aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-source-option-menu.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-12-01 10:55:47 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-12-01 10:55:47 +0800
commit7b8da87e1785d12a1c72cabec20c0015fdde0e40 (patch)
tree9f6dc90b367fc677d979b6d3bc0982db87affbfe /widgets/misc/e-source-option-menu.c
parent81724738fc6c8a41485a2dcfc4671f10c47cbc1c (diff)
downloadgsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.gz
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.zst
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.zip
Add NONE:POINTER.
* e-util-marshal.list: Add NONE:POINTER. * test-source-option-menu.c (source_selected_callback): New callback to test the "source_selected" signal. (on_idle_create_widget): Connect. * e-source-option-menu.c: Add "source_selected" signal. (select_source): Assume source != NULL and emit "source_selected". svn path=/trunk/; revision=23512
Diffstat (limited to 'widgets/misc/e-source-option-menu.c')
-rw-r--r--widgets/misc/e-source-option-menu.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/widgets/misc/e-source-option-menu.c b/widgets/misc/e-source-option-menu.c
index 3904a20dba..f2b5b4b5cc 100644
--- a/widgets/misc/e-source-option-menu.c
+++ b/widgets/misc/e-source-option-menu.c
@@ -24,6 +24,8 @@
#include "e-source-option-menu.h"
+#include "e-util-marshal.h"
+
#include <gal/util/e-util.h>
#include <gtk/gtkmenu.h>
@@ -45,6 +47,14 @@ struct _ESourceOptionMenuPrivate {
};
+enum {
+ SOURCE_SELECTED,
+ NUM_SIGNALS
+};
+
+static uint signals[NUM_SIGNALS] = { 0 };
+
+
/* Selecting a source. */
typedef struct {
@@ -68,21 +78,22 @@ static void
select_source (ESourceOptionMenu *menu,
ESource *source)
{
+ ForeachMenuItemData *foreach_data;
+
if (menu->priv->selected_source != NULL)
g_object_unref (menu->priv->selected_source);
menu->priv->selected_source = source;
- if (source != NULL) {
- ForeachMenuItemData *foreach_data = g_new0 (ForeachMenuItemData, 1);
+ foreach_data = g_new0 (ForeachMenuItemData, 1);
+ foreach_data->option_menu = menu;
- foreach_data->option_menu = menu;
+ gtk_container_foreach (GTK_CONTAINER (GTK_OPTION_MENU (menu)->menu),
+ (GtkCallback) select_source_foreach_menu_item, foreach_data);
- gtk_container_foreach (GTK_CONTAINER (GTK_OPTION_MENU (menu)->menu),
- (GtkCallback) select_source_foreach_menu_item, foreach_data);
+ g_free (foreach_data);
+ g_object_ref (source);
- g_free (foreach_data);
- g_object_ref (source);
- }
+ g_signal_emit (menu, signals[SOURCE_SELECTED], 0, source);
}
@@ -223,6 +234,16 @@ class_init (ESourceOptionMenuClass *class)
object_class->finalize = impl_finalize;
parent_class = g_type_class_peek_parent (class);
+
+ signals[SOURCE_SELECTED] =
+ g_signal_new ("source_selected",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESourceOptionMenuClass, source_selected),
+ NULL, NULL,
+ e_util_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
}
static void