aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-charset-picker.c
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 /widgets/misc/e-charset-picker.c
parentb006d69369cd746250a0d807f9b92629c7901eb3 (diff)
downloadgsoc2013-evolution-a5f3fea0ef60ab829e3818d03589cb413c713fdf.tar.gz
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
Diffstat (limited to 'widgets/misc/e-charset-picker.c')
-rw-r--r--widgets/misc/e-charset-picker.c28
1 files changed, 26 insertions, 2 deletions
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");