diff options
author | Adam Hooper <adamh@src.gnome.org> | 2004-06-01 18:23:03 +0800 |
---|---|---|
committer | Adam Hooper <adamh@src.gnome.org> | 2004-06-01 18:23:03 +0800 |
commit | 95d0030e6b938dc8858bd8c482723ceabbbac7e8 (patch) | |
tree | c2f819f795d50d5b535070c77e088a6f24cb3637 /lib | |
parent | 3573507fc5e6f1e29b90573101236977d89f43aa (diff) | |
download | gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar.gz gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar.bz2 gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar.lz gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar.xz gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.tar.zst gsoc2013-epiphany-95d0030e6b938dc8858bd8c482723ceabbbac7e8.zip |
Update from libegg
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/egg/egg-toolbar-editor.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index 031bb118a..01d1b37c6 100755 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -99,9 +99,12 @@ egg_toolbar_editor_get_type (void) return egg_toolbar_editor_type; } -static int -compare_func (GtkAction *a, GtkAction *b) +static gint +compare_actions (gconstpointer a, gconstpointer b) { + g_return_val_if_fail (GTK_IS_ACTION (a), 0); + g_return_val_if_fail (GTK_IS_ACTION (b), 0); + GValue value_a = { 0, }, value_b = { 0, }; const char *short_label_a, *short_label_b; int ret; @@ -122,13 +125,6 @@ compare_func (GtkAction *a, GtkAction *b) return ret; } -static void -sort_list (EggToolbarEditor *editor) -{ - editor->priv->actions_list = g_list_sort (editor->priv->actions_list, - (GCompareFunc) compare_func); -} - static GtkAction * find_action (EggToolbarEditor *t, const char *name) @@ -325,10 +321,9 @@ editor_drag_data_received_cb (GtkWidget *widget, if (g_list_find (editor->priv->default_actions_list, action)) { - editor->priv->actions_list = g_list_append - (editor->priv->actions_list, action); + editor->priv->actions_list = g_list_insert_sorted + (editor->priv->actions_list, action, compare_actions); } - sort_list (editor); update_editor_sheet (editor); } @@ -347,7 +342,6 @@ editor_drag_data_delete_cb (GtkWidget *widget, editor->priv->actions_list = g_list_remove (editor->priv->actions_list, action); } - sort_list (editor); update_editor_sheet (editor); } @@ -618,10 +612,8 @@ egg_toolbar_editor_add_action (EggToolbarEditor *editor, action = find_action (editor, action_name); g_return_if_fail (action != NULL); - editor->priv->default_actions_list = g_list_append - (editor->priv->default_actions_list, action); - - sort_list (editor); + editor->priv->default_actions_list = g_list_insert_sorted + (editor->priv->default_actions_list, action, compare_actions); } static void @@ -683,12 +675,10 @@ update_actions_list (EggToolbarEditor *editor) if (!model_has_action (editor->priv->model, action)) { - editor->priv->actions_list = g_list_prepend - (editor->priv->actions_list, action); + editor->priv->actions_list = g_list_insert_sorted + (editor->priv->actions_list, action, compare_actions); } } - - sort_list (editor); } void |