aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-03 05:02:56 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-03 05:02:56 +0800
commita5f3fea0ef60ab829e3818d03589cb413c713fdf (patch)
treec00c6d8344fd211f9fabf2b4dcf044d01752b8de
parentb006d69369cd746250a0d807f9b92629c7901eb3 (diff)
downloadgsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.gz
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.bz2
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.lz
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.xz
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.zst
gsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.zip
Take a callback function and user_data so that we can add listeners to
2001-07-02 Jeffrey Stedfast <fejj@ximian.com> * e-charset-picker.c (e_charset_picker_bonobo_ui_populate): Take a callback function and user_data so that we can add listeners to each of the menu items. svn path=/trunk/; revision=10702
-rw-r--r--widgets/misc/ChangeLog6
-rw-r--r--widgets/misc/e-charset-picker.c28
-rw-r--r--widgets/misc/e-charset-picker.h3
3 files changed, 34 insertions, 3 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 49d671f1d2..5066477a8c 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,5 +1,11 @@
2001-07-02 Jeffrey Stedfast <fejj@ximian.com>
+ * e-charset-picker.c (e_charset_picker_bonobo_ui_populate): Take a
+ callback function and user_data so that we can add listeners to
+ each of the menu items.
+
+2001-07-02 Jeffrey Stedfast <fejj@ximian.com>
+
* Makefile.am: Updated to build e-charset-picker.c
* e-charset-picker.[c,h]: Moved here from gal.
diff --git a/widgets/misc/e-charset-picker.c b/widgets/misc/e-charset-picker.c
index b275930dfd..2ce6291e2c 100644
--- a/widgets/misc/e-charset-picker.c
+++ b/widgets/misc/e-charset-picker.c
@@ -356,9 +356,25 @@ e_charset_picker_dialog (const char *title, const char *prompt,
return charset;
}
-
+/**
+ * e_charset_picker_bonobo_ui_populate:
+ * @uic: Bonobo UI Component
+ * @default_charset: the default character set, or %NULL to use the
+ * locale character set.
+ * @cb: Callback function
+ * @user_data: data to be passed to the callback.
+ *
+ * This creates a Bonobo UI menu and fills it in with a selection
+ * of available character sets. The @default_charset (or locale character
+ * set if @default_charset is %NULL) will be listed first, and selected
+ * by default (except that iso-8859-1 will always be used instead of
+ * US-ASCII). Any other character sets of the same language class as
+ * the default will be listed next, followed by the remaining character
+ * sets.
+ **/
void
-e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default_charset)
+e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default_charset,
+ BonoboUIListenerFn cb, gpointer user_data)
{
char *locale_charset, *encoded_label, *label;
GString *menuitems;
@@ -410,6 +426,10 @@ e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default
charsets[i].name);
g_free (encoded_label);
+
+ label = g_strdup_printf ("Charset-%s", charsets[i].name);
+ bonobo_ui_component_add_listener (uic, label, cb, user_data);
+ g_free (label);
}
if (def == num_charsets) {
@@ -431,6 +451,10 @@ e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default
default_charset);
g_free (encoded_label);
+
+ label = g_strdup_printf ("Charset-%s", default_charset);
+ bonobo_ui_component_add_listener (uic, label, cb, user_data);
+ g_free (label);
}
g_string_append (menuitems, "</submenu>\n");
diff --git a/widgets/misc/e-charset-picker.h b/widgets/misc/e-charset-picker.h
index 0fa6e5e0a1..352c09baee 100644
--- a/widgets/misc/e-charset-picker.h
+++ b/widgets/misc/e-charset-picker.h
@@ -38,7 +38,8 @@ char *e_charset_picker_dialog (const char *title, const char *prompt,
GtkWindow *parent);
/* bonobo equivalents */
-void e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default_charset);
+void e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *default_charset,
+ BonoboUIListenerFn cb, gpointer user_data);
#ifdef __cplusplus
}