diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2015-01-25 17:12:09 +0000 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2015-01-26 11:19:22 +0000 |
commit | be0f488a2d2525deab363ebf98ce548395e60d90 (patch) | |
tree | a17b1c6baa1037ec431a89ae494e1d014f6796c3 /src/nautilus-view.c | |
parent | b20990b1eb4d1d4636d409f3235133358994059a (diff) | |
download | nautilus-be0f488a2d2525deab363ebf98ce548395e60d90.tar.gz |
toolbar: rework how Undo/Redo actions are added to the menu
Currently we always reload the menu from scratch and reset the menu
button; the intent of the code here is to modify the menu in-place.
Diffstat (limited to 'src/nautilus-view.c')
-rw-r--r-- | src/nautilus-view.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nautilus-view.c b/src/nautilus-view.c index 7443f4ad6..d689b5249 100644 --- a/src/nautilus-view.c +++ b/src/nautilus-view.c @@ -6417,8 +6417,8 @@ real_update_toolbar_menus (NautilusView *view) NautilusFileUndoManagerState undo_state; gboolean undo_active, redo_active; gchar *undo_label, *undo_description, *redo_label, *redo_description; - GMenuItem *undo_menu_item, *redo_menu_item; gboolean is_undo; + GMenu* undo_section; undo_label = undo_description = redo_label = redo_description = NULL; @@ -6441,17 +6441,18 @@ real_update_toolbar_menus (NautilusView *view) &redo_label, &redo_description); } + undo_section = g_menu_new (); undo_label = undo_active ? undo_label : g_strdup (_("Undo")); redo_label = redo_active ? redo_label : g_strdup (_("Redo")); - undo_menu_item = g_menu_item_new (undo_label, "view.undo"); - redo_menu_item = g_menu_item_new (redo_label, "view.redo"); - nautilus_toolbar_action_menu_add_item (toolbar, undo_menu_item, "undo-redo-section"); - nautilus_toolbar_action_menu_add_item (toolbar, redo_menu_item, "undo-redo-section"); + g_menu_append (undo_section, undo_label, "view.undo"); + g_menu_append (undo_section, redo_label, "view.redo"); + nautilus_gmenu_replace_section (nautilus_toolbar_get_action_menu (toolbar), + "undo-redo-section", + G_MENU_MODEL (undo_section)); nautilus_view_update_actions_state (view); - g_object_unref (undo_menu_item); - g_object_unref (redo_menu_item); + g_object_unref (undo_section); g_free (undo_label); g_free (undo_description); g_free (redo_label); |