diff options
author | Not Zed <NotZed@Ximian.com> | 2004-10-06 11:22:01 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-10-06 11:22:01 +0800 |
commit | d80f89af7503afd6460698e7cc0f84cf84a6eb4d (patch) | |
tree | 9b8359e83ec48549cdf7bcd2ddad2568212cb7bc /widgets/misc/e-source-selector.c | |
parent | 98c149a69b046b7c8d0756e51a3e47689076fdac (diff) | |
download | gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar.gz gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar.bz2 gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar.lz gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar.xz gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.tar.zst gsoc2013-evolution-d80f89af7503afd6460698e7cc0f84cf84a6eb4d.zip |
added boolean object boxed.
2004-10-01 Not Zed <NotZed@Ximian.com>
* e-util-marshal.list: added boolean object boxed.
* e-source-selector.c (class_init): add new 'popup event' signal,
to replace fill_popup_menu.
(selector_button_press_event): emit a POPUP_EVENT rather than a
FILL_POPUP_MENU.
svn path=/trunk/; revision=27465
Diffstat (limited to 'widgets/misc/e-source-selector.c')
-rw-r--r-- | widgets/misc/e-source-selector.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/widgets/misc/e-source-selector.c b/widgets/misc/e-source-selector.c index 898e8b6c00..9b63e8b674 100644 --- a/widgets/misc/e-source-selector.c +++ b/widgets/misc/e-source-selector.c @@ -67,7 +67,7 @@ typedef struct { enum { SELECTION_CHANGED, PRIMARY_SELECTION_CHANGED, - FILL_POPUP_MENU, + POPUP_EVENT, NUM_SIGNALS }; static unsigned int signals[NUM_SIGNALS] = { 0 }; @@ -579,10 +579,10 @@ static gboolean selector_button_press_event (GtkWidget *widget, GdkEventButton *event, ESourceSelector *selector) { ESourceSelectorPrivate *priv = selector->priv; - GtkWidget *menu; GtkTreePath *path; ESource *source = NULL; - + gboolean res = FALSE; + priv->toggled_last = FALSE; /* only process right-clicks */ @@ -596,7 +596,8 @@ selector_button_press_event (GtkWidget *widget, GdkEventButton *event, ESourceSe if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->tree_store), &iter, path)) { gtk_tree_model_get (GTK_TREE_MODEL (priv->tree_store), &iter, 0, &data, -1); - + + /* TODO: we could still emit a popup event for this and let the callee decide? */ if (E_IS_SOURCE_GROUP (data)) { g_object_unref (data); @@ -607,19 +608,15 @@ selector_button_press_event (GtkWidget *widget, GdkEventButton *event, ESourceSe } } - if (source) { + if (source) e_source_selector_set_primary_selection (selector, source); - g_object_unref (source); - } - - /* create the menu */ - menu = gtk_menu_new (); - g_signal_emit (G_OBJECT (selector), signals[FILL_POPUP_MENU], 0, GTK_MENU (menu)); - /* popup the menu */ - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); + g_signal_emit(selector, signals[POPUP_EVENT], 0, source, event, &res); - return TRUE; + if (source) + g_object_unref (source); + + return res; } /* GObject methods. */ @@ -666,6 +663,15 @@ impl_finalize (GObject *object) /* Initialization. */ +static gboolean +ess_bool_accumulator(GSignalInvocationHint *ihint, GValue *out, const GValue *in, void *data) +{ + gboolean val = g_value_get_boolean(in); + + g_value_set_boolean(out, val); + + return !val; +} static void class_init (ESourceSelectorClass *class) @@ -694,14 +700,15 @@ class_init (ESourceSelectorClass *class) NULL, NULL, e_util_marshal_VOID__VOID, G_TYPE_NONE, 0); - signals[FILL_POPUP_MENU] = - g_signal_new ("fill_popup_menu", + signals[POPUP_EVENT] = + g_signal_new ("popup_event", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESourceSelectorClass, fill_popup_menu), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, G_TYPE_OBJECT); + G_STRUCT_OFFSET (ESourceSelectorClass, popup_event), + ess_bool_accumulator, NULL, + e_util_marshal_BOOLEAN__OBJECT_BOXED, + G_TYPE_BOOLEAN, 2, G_TYPE_OBJECT, + GDK_TYPE_EVENT|G_SIGNAL_TYPE_STATIC_SCOPE); } static void |