aboutsummaryrefslogtreecommitdiffstats
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
parent81724738fc6c8a41485a2dcfc4671f10c47cbc1c (diff)
downloadgsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.gz
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.bz2
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.lz
gsoc2013-evolution-7b8da87e1785d12a1c72cabec20c0015fdde0e40.tar.xz
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
-rw-r--r--widgets/misc/ChangeLog11
-rw-r--r--widgets/misc/e-source-option-menu.c37
-rw-r--r--widgets/misc/e-util-marshal.list1
-rw-r--r--widgets/misc/test-source-option-menu.c10
4 files changed, 51 insertions, 8 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 15a2bee117..9caa036471 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,5 +1,16 @@
2003-11-30 Ettore Perazzoli <ettore@ximian.com>
+ * 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".
+
+2003-11-30 Ettore Perazzoli <ettore@ximian.com>
+
* test-source-option-menu.c: New test.
* e-source-option-menu.h: New.
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
diff --git a/widgets/misc/e-util-marshal.list b/widgets/misc/e-util-marshal.list
index f5d8f046b7..0cb9a24afe 100644
--- a/widgets/misc/e-util-marshal.list
+++ b/widgets/misc/e-util-marshal.list
@@ -1,2 +1,3 @@
NONE:NONE
NONE:INT
+NONE:POINTER
diff --git a/widgets/misc/test-source-option-menu.c b/widgets/misc/test-source-option-menu.c
index 91a7941e29..a473c0f972 100644
--- a/widgets/misc/test-source-option-menu.c
+++ b/widgets/misc/test-source-option-menu.c
@@ -33,6 +33,15 @@
#include <libgnomeui/gnome-ui-init.h>
+static void
+source_selected_callback (ESourceOptionMenu *menu,
+ ESource *source,
+ void *unused_data)
+{
+ g_print ("source selected: \"%s\"\n", e_source_peek_name (source));
+}
+
+
static int
on_idle_create_widget (const char *gconf_path)
{
@@ -46,6 +55,7 @@ on_idle_create_widget (const char *gconf_path)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
option_menu = e_source_option_menu_new (source_list);
+ g_signal_connect (option_menu, "source_selected", G_CALLBACK (source_selected_callback), NULL);
gtk_container_add (GTK_CONTAINER (window), option_menu);
gtk_widget_show_all (window);