[Xfce4-commits] <thunar:master> Don't add a bookmark to the same location twice.

Nick Schermer noreply at xfce.org
Thu Nov 8 20:46:01 CET 2012


Updating branch refs/heads/master
         to 574c7dfa31dbe24e0f907945e21f411408a69b03 (commit)
       from fa11bfe6069e5fdce5367894b764b732f3d883fa (commit)

commit 574c7dfa31dbe24e0f907945e21f411408a69b03
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Nov 8 20:43:42 2012 +0100

    Don't add a bookmark to the same location twice.
    
    This avoids action-name collision and its not really usefull
    either.

 thunar/thunar-window.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 04d3e41..211f6a5 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1975,18 +1975,21 @@ thunar_window_bookmark_merge_line (GFile       *file_path,
 
   if (G_LIKELY (action != NULL))
     {
-      /* connect action */
-      g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_window_action_open_bookmark), window);
-
-      /* insert the bookmark in the group */
-      gtk_action_group_add_action_with_accel (window->bookmark_action_group, action, NULL);
-
-      /* add the action to the UI manager */
-      gtk_ui_manager_add_ui (window->ui_manager,
-                             window->bookmark_items_actions_merge_id,
-                             path,
-                             unique_name, unique_name,
-                             GTK_UI_MANAGER_MENUITEM, FALSE);
+      if (gtk_action_group_get_action (window->bookmark_action_group, unique_name) == NULL)
+        {
+          /* connect action */
+          g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_window_action_open_bookmark), window);
+
+          /* insert the bookmark in the group */
+          gtk_action_group_add_action_with_accel (window->bookmark_action_group, action, NULL);
+
+          /* add the action to the UI manager */
+          gtk_ui_manager_add_ui (window->ui_manager,
+                                 window->bookmark_items_actions_merge_id,
+                                 path,
+                                 unique_name, unique_name,
+                                 GTK_UI_MANAGER_MENUITEM, FALSE);
+        }
 
       g_object_unref (action);
     }


More information about the Xfce4-commits mailing list