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
This commit is contained in:
Carlos Soriano 2017-10-30 21:47:07 +01:00
parent f54e7712c5
commit 1b1cb8295b

View File

@ -3568,14 +3568,18 @@ build_popup_menu_using_gmenu (GtkSidebarRow *row)
g_menu_item_set_action_and_target_value (item, "row.open", g_menu_item_set_action_and_target_value (item, "row.open",
g_variant_new_int32 (GTK_PLACES_OPEN_NORMAL)); g_variant_new_int32 (GTK_PLACES_OPEN_NORMAL));
g_menu_append_item (menu, item); 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"); 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_menu_item_set_action_and_target_value (item, "row.open-other", g_variant_new_int32(GTK_PLACES_OPEN_NEW_TAB));
g_variant_new_int32 (GTK_PLACES_OPEN_NEW_TAB));
g_menu_append_item (menu, item); 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"); 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_menu_item_set_action_and_target_value (item, "row.open-other", g_variant_new_int32(GTK_PLACES_OPEN_NEW_WINDOW));
g_variant_new_int32 (GTK_PLACES_OPEN_NEW_WINDOW));
g_menu_append_item (menu, item); g_menu_append_item (menu, item);
}
cloud_provider_menu = cloud_providers_account_get_menu_model (cloud_provider_account); 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); cloud_provider_action_group = cloud_providers_account_get_action_group (cloud_provider_account);
if (cloud_provider_menu != NULL && cloud_provider_action_group != NULL) if (cloud_provider_menu != NULL && cloud_provider_action_group != NULL)