diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-06-24 23:25:44 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-06-24 23:25:44 +0800 |
commit | 4e1fe266e73c23d628ebf4765ae931a7b91b4e3f (patch) | |
tree | 6a8e246b945d4af7666c5729f45882ce36e94acb /shell | |
parent | ea40bb0823d313579eb992f441d6fd08f7ef23a7 (diff) | |
download | gsoc2013-evolution-4e1fe266e73c23d628ebf4765ae931a7b91b4e3f.tar.gz gsoc2013-evolution-4e1fe266e73c23d628ebf4765ae931a7b91b4e3f.tar.zst gsoc2013-evolution-4e1fe266e73c23d628ebf4765ae931a7b91b4e3f.zip |
Derive ETaskWidget from GtkEventBox instead of GtkFrame so that we can
get button_press events from it. Also, get the EActivtyHandler to
properly dispatch "Clicked" events when the user clicks on an
ETaskWidget.
svn path=/trunk/; revision=10450
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 11 | ||||
-rw-r--r-- | shell/e-activity-handler.c | 34 | ||||
-rw-r--r-- | shell/e-task-widget.c | 13 | ||||
-rw-r--r-- | shell/e-task-widget.h | 6 |
4 files changed, 57 insertions, 7 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 41871ad4d6..a492ef0c9c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,16 @@ 2001-06-24 Ettore Perazzoli <ettore@ximian.com> + * e-task-widget.h, e-task-widget.c: Changed to derive from + GtkEventBox. + + * e-activity-handler.c (task_widget_button_press_event_callback): + New callback for the "button_press_event" signal on the + ETaskWidgets. Dispatch the "Clicked" event through the Bonobo + listener. + (task_widget_new_from_activity_info): Connect here. + +2001-06-24 Ettore Perazzoli <ettore@ximian.com> + * evolution-test-component.c: Changed to use the `EvolutionActivityClient' object. New global static variable `activity_client'. diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c index 09342b1af4..32076f1f94 100644 --- a/shell/e-activity-handler.c +++ b/shell/e-activity-handler.c @@ -134,6 +134,37 @@ lookup_activity (GList *list, } +/* ETaskWidget callbacks. */ + +static int +task_widget_button_press_event_callback (GtkWidget *widget, + GdkEventButton *button_event, + void *data) +{ + CORBA_Environment ev; + ActivityInfo *activity_info; + CORBA_any *null_value; + + activity_info = (ActivityInfo *) data; + + CORBA_exception_init (&ev); + + null_value = CORBA_any__alloc (); + null_value->_type = TC_null; + + Bonobo_Listener_event (activity_info->event_listener, "Clicked", null_value, &ev); + if (ev._major != CORBA_NO_EXCEPTION) + g_warning ("EActivityHandler: Cannot report `Clicked' event -- %s", + ev._repo_id); + + CORBA_free (null_value); + + CORBA_exception_free (&ev); + + return TRUE; +} + + /* Creating and destroying ActivityInfos. */ static ActivityInfo * @@ -184,6 +215,9 @@ task_widget_new_from_activity_info (ActivityInfo *activity_info) widget = e_task_widget_new (activity_info->icon_pixbuf, activity_info->information); gtk_widget_show (widget); + gtk_signal_connect (GTK_OBJECT (widget), "button_press_event", + GTK_SIGNAL_FUNC (task_widget_button_press_event_callback), activity_info); + return E_TASK_WIDGET (widget); } diff --git a/shell/e-task-widget.c b/shell/e-task-widget.c index e67baaf0e7..384e1cc27f 100644 --- a/shell/e-task-widget.c +++ b/shell/e-task-widget.c @@ -27,6 +27,7 @@ #include "e-task-widget.h" +#include <gtk/gtkframe.h> #include <gtk/gtkhbox.h> #include <gtk/gtklabel.h> #include <gtk/gtkpixmap.h> @@ -40,8 +41,8 @@ #define SPACING 2 -#define PARENT_TYPE (gtk_frame_get_type ()) -static GtkFrameClass *parent_class = NULL; +#define PARENT_TYPE (gtk_event_box_get_type ()) +static GtkEventBoxClass *parent_class = NULL; struct _ETaskWidgetPrivate { GdkPixbuf *icon_pixbuf; @@ -95,6 +96,7 @@ e_task_widget_construct (ETaskWidget *task_widget, GdkPixmap *pixmap; GdkBitmap *mask; GtkWidget *box; + GtkWidget *frame; g_return_if_fail (task_widget != NULL); g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); @@ -103,10 +105,13 @@ e_task_widget_construct (ETaskWidget *task_widget, priv = task_widget->priv; - gtk_frame_set_shadow_type (GTK_FRAME (task_widget), GTK_SHADOW_IN); + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_container_add (GTK_CONTAINER (task_widget), frame); + gtk_widget_show (frame); box = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (task_widget), box); + gtk_container_add (GTK_CONTAINER (frame), box); gtk_widget_show (box); priv->icon_pixbuf = gdk_pixbuf_ref (icon_pixbuf); diff --git a/shell/e-task-widget.h b/shell/e-task-widget.h index cc177252ce..dacb09fbdd 100644 --- a/shell/e-task-widget.h +++ b/shell/e-task-widget.h @@ -24,7 +24,7 @@ #ifndef _E_TASK_WIDGET_H_ #define _E_TASK_WIDGET_H_ -#include <gtk/gtkframe.h> +#include <gtk/gtkeventbox.h> #include <gdk-pixbuf/gdk-pixbuf.h> #ifdef __cplusplus @@ -44,13 +44,13 @@ typedef struct _ETaskWidgetPrivate ETaskWidgetPrivate; typedef struct _ETaskWidgetClass ETaskWidgetClass; struct _ETaskWidget { - GtkFrame parent; + GtkEventBox parent; ETaskWidgetPrivate *priv; }; struct _ETaskWidgetClass { - GtkFrameClass parent_class; + GtkEventBoxClass parent_class; }; |