summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2007-07-17 14:42:12 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2007-07-17 14:42:12 +0000
commit6ae429f3ccb7449ffff56642fcb91c7e14838d66 (patch)
tree4acff6c006311b263f54b19779595c593ae20606
parentb986ee8f0dee87dd56339ba867c315911179146c (diff)
downloadglade-6ae429f3ccb7449ffff56642fcb91c7e14838d66.tar.gz
Removed glade_app_widget_event() and the "widget-event" signal
* gladeui/glade-app.[ch]: Removed glade_app_widget_event() and the "widget-event" signal * gladeui/glade-design-layout.c: Expose glade_design_layout_widget_event() to be used internally by GladeWidget (no longer listening to "widget-event" signal on glade-app). * gladeui/glade-widget.c: glade_widget_event_private() Find the parenting GladeDesignLayout and dispatch the event through glade_design_layout_widget_event() (this fixes multiple projects recieving the same events, bug 456013). svn path=/trunk/; revision=1481
-rw-r--r--ChangeLog13
-rw-r--r--gladeui/glade-app.c57
-rw-r--r--gladeui/glade-app.h6
-rw-r--r--gladeui/glade-design-layout.c38
-rw-r--r--gladeui/glade-design-layout.h4
-rw-r--r--gladeui/glade-widget.c16
6 files changed, 49 insertions, 85 deletions
diff --git a/ChangeLog b/ChangeLog
index fba6eb77..91186807 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,18 @@
2006-07-17 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-widget-adaptor.c: untranslate the "half translated" warning
- message in gwa_displayable_values_check().
+ message in gwa_displayable_values_check().
+
+ * gladeui/glade-app.[ch]: Removed glade_app_widget_event() and the "widget-event"
+ signal
+
+ * gladeui/glade-design-layout.c: Expose glade_design_layout_widget_event() to
+ be used internally by GladeWidget (no longer listening to "widget-event" signal
+ on glade-app).
+
+ * gladeui/glade-widget.c: glade_widget_event_private() Find the parenting
+ GladeDesignLayout and dispatch the event through glade_design_layout_widget_event()
+ (this fixes multiple projects recieving the same events, bug 456013).
2006-07-16 Tristan Van Berkom <tvb@gnome.org>
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index 9d813215..6a44099a 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -44,7 +44,6 @@
enum
{
- WIDGET_EVENT,
UPDATE_UI,
LAST_SIGNAL
};
@@ -494,30 +493,6 @@ glade_app_class_init (GladeAppClass * klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- /**
- * GladeApp::widget-event:
- * @gladeapp: the #GladeApp which received the signal.
- * @arg1: The toplevel #GladeWidget who's hierarchy recieved an event
- * @arg2: The #GdkEvent
- *
- * Emitted when a #GladeWidget or one of its children is a GtkWidget derivative
- * and is about to recieve an event from gdk.
- *
- * Returns: whether the event was handled or not
- */
- glade_app_signals[WIDGET_EVENT] =
- g_signal_new ("widget-event",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GladeAppClass,
- widget_event),
- glade_boolean_handled_accumulator, NULL,
- glade_marshal_BOOLEAN__OBJECT_BOXED,
- G_TYPE_BOOLEAN, 2,
- GLADE_TYPE_WIDGET,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
g_object_class_install_property
(object_class, PROP_ACTIVE_PROJECT,
g_param_spec_object
@@ -739,38 +714,6 @@ glade_app_update_ui (void)
glade_app_signals[UPDATE_UI], 0);
}
-/**
- * glade_app_widget_event:
- * @widget: the #GladeWidget that recieved the event
- * @event: the #GdkEvent
- *
- * Notifies the core that a widget recieved an event,
- * the core will then take responsability of sending
- * the right event to the right widget.
- *
- * Returns whether the event was handled by glade.
- */
-gboolean
-glade_app_widget_event (GladeWidget *widget,
- GdkEvent *event)
-{
- GladeApp *app = glade_app_get ();
- GladeWidget *toplevel = widget;
- gboolean retval = FALSE;
-
- g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- while (toplevel->parent)
- toplevel = toplevel->parent;
-
- g_signal_emit (G_OBJECT (app),
- glade_app_signals[WIDGET_EVENT], 0, widget, event, &retval);
-
- return retval;
-}
-
-
void
glade_app_set_window (GtkWidget *window)
{
diff --git a/gladeui/glade-app.h b/gladeui/glade-app.h
index 14815c4c..f516267a 100644
--- a/gladeui/glade-app.h
+++ b/gladeui/glade-app.h
@@ -77,9 +77,6 @@ struct _GladeAppClass
void (* hide_properties) (GladeApp* app);
/* signals */
- void (* widget_event) (GladeApp *app,
- GladeWidget *toplevel,
- GdkEvent *event);
void (* update_ui_signal) (GladeApp *app);
};
@@ -94,9 +91,6 @@ GladeApp* glade_app_get (void);
void glade_app_update_ui (void);
-gboolean glade_app_widget_event (GladeWidget *widget,
- GdkEvent *event);
-
void glade_app_set_window (GtkWidget *window);
GtkWidget* glade_app_get_window (void);
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index ffcf5a48..45bdfb05 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -74,8 +74,6 @@ struct _GladeDesignLayoutPrivate
gint dy; /* child.height - event.pointer.y */
gint new_width; /* user's new requested width */
gint new_height; /* user's new requested height */
-
- gulong widget_event_id;
};
G_DEFINE_TYPE (GladeDesignLayout, glade_design_layout, GTK_TYPE_BIN)
@@ -714,15 +712,13 @@ glade_design_layout_finalize (GObject *object)
{
GladeDesignLayoutPrivate *priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (object);
- g_signal_handler_disconnect (glade_app_get (), priv->widget_event_id);
-
g_free (priv->current_size_request);
G_OBJECT_CLASS (glade_design_layout_parent_class)->finalize (object);
}
/* creates a gc to draw a nice border around the child */
-GdkGC*
+static GdkGC *
create_outline_gc (GtkWidget *widget)
{
GdkGC *gc;
@@ -793,17 +789,28 @@ glade_design_layout_expose_event (GtkWidget *widget, GdkEventExpose *ev)
return TRUE;
}
-static gboolean
-glade_design_layout_widget_event (GladeApp *app,
+/**
+ * glade_design_layout_widget_event:
+ * @layout: A #GladeDesignLayout
+ * @event_gwidget: the #GladeWidget that recieved event notification
+ * @event: the #GdkEvent
+ *
+ * This is called internally by a #GladeWidget recieving an event,
+ * it will marshall the event to the proper #GladeWidget according
+ * to its position in @layout.
+ *
+ * Returns: Whether or not the event was handled by the retrieved #GladeWidget
+ */
+gboolean
+glade_design_layout_widget_event (GladeDesignLayout *layout,
GladeWidget *event_gwidget,
- GdkEvent *event,
- GladeDesignLayout *layout)
+ GdkEvent *event)
{
GladeWidget *gwidget;
GtkWidget *child;
gboolean retval;
gint x, y;
-
+
gtk_widget_get_pointer (GTK_WIDGET (layout), &x, &y);
gwidget = glade_design_layout_deepest_gwidget_at_position
(GTK_CONTAINER (layout), GTK_CONTAINER (layout), x, y);
@@ -844,9 +851,8 @@ glade_design_layout_propagate_event (GtkWidget *widget,
glade_widget_get_from_gobject (child);
if (gwidget)
- return glade_design_layout_widget_event (glade_app_get (),
- gwidget, event,
- GLADE_DESIGN_LAYOUT (widget));
+ return glade_design_layout_widget_event (GLADE_DESIGN_LAYOUT (widget),
+ gwidget, event);
}
return FALSE;
}
@@ -871,12 +877,6 @@ glade_design_layout_init (GladeDesignLayout *layout)
priv->new_width = -1;
priv->new_height = -1;
-
- priv->widget_event_id =
- g_signal_connect (glade_app_get (), "widget-event",
- G_CALLBACK (glade_design_layout_widget_event),
- layout);
-
}
static void
diff --git a/gladeui/glade-design-layout.h b/gladeui/glade-design-layout.h
index 1b6e00c2..2c15b6f7 100644
--- a/gladeui/glade-design-layout.h
+++ b/gladeui/glade-design-layout.h
@@ -58,6 +58,10 @@ GType glade_design_layout_get_type (void) G_GNUC_CONST;
GtkWidget *glade_design_layout_new (void);
+gboolean glade_design_layout_widget_event (GladeDesignLayout *layout,
+ GladeWidget *event_gwidget,
+ GdkEvent *event);
+
G_END_DECLS
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 756a6887..90ff817d 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3224,8 +3224,20 @@ glade_widget_event_private (GtkWidget *widget,
GdkEvent *event,
GladeWidget *gwidget)
{
- /* Whoa, now that's trust. */
- return glade_app_widget_event (gwidget, event);
+ GtkWidget *layout = widget;
+
+ /* Find the parenting layout container */
+ while (!GLADE_IS_DESIGN_LAYOUT (layout))
+ layout = layout->parent;
+
+ /* Let the parenting GladeDesignLayout decide which GladeWidget to
+ * marshall this event to.
+ */
+ if (GLADE_IS_DESIGN_LAYOUT (layout))
+ return glade_design_layout_widget_event (GLADE_DESIGN_LAYOUT (layout),
+ gwidget, event);
+ else
+ return FALSE;
}
/**