[gtk+/gtk-3-22] gtkplacessidebar: Fix new tab/window handling for cloud accounts



commit 7e49a02acf07854886b6d6a705d79359fbdedbd9
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Oct 30 21:47:07 2017 +0100

    gtkplacessidebar: Fix new tab/window handling for cloud accounts
    
    It wasn't taking into account whether the sidebar had support for them
    or not, resulting in a file chooser with open in new tab/window menu
    items when it's not supported.
    
    To fix it, do as with the other menus and check for the availability of
    new tab/window flags.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786123

 gtk/gtkplacessidebar.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 1102baf..c11e909 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -3593,12 +3593,18 @@ build_popup_menu_using_gmenu (GtkSidebarRow *row)
       item = g_menu_item_new (_("_Open"), "row.open");
       g_menu_item_set_action_and_target_value (item, "row.open", 
g_variant_new_int32(GTK_PLACES_OPEN_NORMAL));
       g_menu_append_item (menu, item);
-      item = g_menu_item_new (_("Open in New _Tab"), "row.open-other");
-      g_menu_item_set_action_and_target_value (item, "row.open-other", 
g_variant_new_int32(GTK_PLACES_OPEN_NEW_TAB));
-      g_menu_append_item (menu, item);
-      item = g_menu_item_new (_("Open in New _Window"), "row.open-other");
-      g_menu_item_set_action_and_target_value (item, "row.open-other", 
g_variant_new_int32(GTK_PLACES_OPEN_NEW_WINDOW));
-      g_menu_append_item (menu, item);
+      if (sidebar->open_flags & GTK_PLACES_OPEN_NEW_TAB)
+        {
+          item = g_menu_item_new (_("Open in New _Tab"), "row.open-other");
+          g_menu_item_set_action_and_target_value (item, "row.open-other", 
g_variant_new_int32(GTK_PLACES_OPEN_NEW_TAB));
+          g_menu_append_item (menu, item);
+        }
+      if (sidebar->open_flags & GTK_PLACES_OPEN_NEW_WINDOW)
+        {
+          item = g_menu_item_new (_("Open in New _Window"), "row.open-other");
+          g_menu_item_set_action_and_target_value (item, "row.open-other", 
g_variant_new_int32(GTK_PLACES_OPEN_NEW_WINDOW));
+          g_menu_append_item (menu, item);
+        }
       cloud_provider_menu = cloud_providers_account_get_menu_model (cloud_provider_account);
       cloud_provider_action_group = cloud_providers_account_get_action_group (cloud_provider_account);
       if (cloud_provider_menu != NULL && cloud_provider_action_group != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]