aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-10-06 11:22:01 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-10-06 11:22:01 +0800
commitd80f89af7503afd6460698e7cc0f84cf84a6eb4d (patch)
tree9b8359e83ec48549cdf7bcd2ddad2568212cb7bc
parent98c149a69b046b7c8d0756e51a3e47689076fdac (diff)
downloadgsoc2013-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
-rw-r--r--widgets/misc/ChangeLog9
-rw-r--r--widgets/misc/e-source-selector.c47
-rw-r--r--widgets/misc/e-source-selector.h2
-rw-r--r--widgets/misc/e-util-marshal.list1
4 files changed, 38 insertions, 21 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index ac88cc8b95..b08c9683dc 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2004-09-13 Rodney Dawes <dobey@novell.com>
* e-multi-config-dialog.c (impl_response):
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
diff --git a/widgets/misc/e-source-selector.h b/widgets/misc/e-source-selector.h
index 92b5e7b67c..1c24261a18 100644
--- a/widgets/misc/e-source-selector.h
+++ b/widgets/misc/e-source-selector.h
@@ -50,7 +50,7 @@ struct _ESourceSelectorClass {
void (* selection_changed) (ESourceSelector *selector);
void (* primary_selection_changed) (ESourceSelector *selector);
- void (* fill_popup_menu) (ESourceSelector *selector, GtkMenu *menu);
+ gboolean (*popup_event)(ESourceSelector *selector, ESource *primary, GdkEventButton *event);
};
diff --git a/widgets/misc/e-util-marshal.list b/widgets/misc/e-util-marshal.list
index 0cb9a24afe..787be7d723 100644
--- a/widgets/misc/e-util-marshal.list
+++ b/widgets/misc/e-util-marshal.list
@@ -1,3 +1,4 @@
NONE:NONE
NONE:INT
NONE:POINTER
+BOOLEAN:OBJECT,BOXED