From 9d915124c28eb0772b4e1086d6988e7d56d9a04c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 31 Dec 2008 20:24:59 +0000 Subject: Get the Character Encoding menu working. Kill e_charset_picker_bonobo_ui_populate(). svn path=/branches/kill-bonobo/; revision=36950 --- e-util/e-util.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'e-util/e-util.c') diff --git a/e-util/e-util.c b/e-util/e-util.c index 373002d4d9..3fce52f9bd 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -163,6 +163,41 @@ e_load_ui_definition (GtkUIManager *ui_manager, return merge_id; } +/** + * e_action_compare_by_label: + * @action1: a #GtkAction + * @action2: a #GtkAction + * + * Compares the labels for @action1 and @action2 using g_utf8_collate(). + * + * Returns: < 0 if @action1 compares before @action2, 0 if they + * compare equal, > 0 if @action1 compares after @action2 + **/ +gint +e_action_compare_by_label (GtkAction *action1, + GtkAction *action2) +{ + gchar *label1; + gchar *label2; + gint result; + + /* XXX This is horribly inefficient but will generally only be + * used on short lists of actions during UI construction. */ + + if (action1 == action2) + return 0; + + g_object_get (action1, "label", &label1, NULL); + g_object_get (action2, "label", &label2, NULL); + + result = g_utf8_collate (label1, label2); + + g_free (label1); + g_free (label2); + + return result; +} + /** * e_action_group_remove_all_actions: * @action_group: a #GtkActionGroup -- cgit v1.2.3