From 2e46a2f412528df58446c7bb712160dc1f9390d9 Mon Sep 17 00:00:00 2001 From: Andre Miranda <andreldm@xfce.org> Date: Sat, 2 Jun 2018 12:35:59 -0300 Subject: [PATCH] Silence gtk_image_menu_item_* deprecations --- thunar/thunar-dnd.c | 4 ++++ thunar/thunar-history.c | 4 ++++ thunar/thunar-shortcuts-view.c | 30 ++++++++++++++++++++++++++++++ thunar/thunar-templates-action.c | 6 ++++++ thunar/thunar-tree-view.c | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/thunar/thunar-dnd.c b/thunar/thunar-dnd.c index 6c8f45175..fdb54ef49 100644 --- a/thunar/thunar-dnd.c +++ b/thunar/thunar-dnd.c @@ -97,7 +97,9 @@ thunar_dnd_ask (GtkWidget *widget, for (n = 0; n < G_N_ELEMENTS (dnd_action_items); ++n) if (G_LIKELY ((dnd_actions & dnd_action_items[n]) != 0)) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_(dnd_action_names[n])); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_data (G_OBJECT (item), I_("dnd-action"), GUINT_TO_POINTER (dnd_action_items[n])); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (dnd_action_selected), &dnd_action); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -107,7 +109,9 @@ thunar_dnd_ask (GtkWidget *widget, if (G_LIKELY (dnd_action_icons[n] != NULL)) { image = gtk_image_new_from_icon_name (dnd_action_icons[n], GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS } } diff --git a/thunar/thunar-history.c b/thunar/thunar-history.c index 599104838..8e21047a3 100644 --- a/thunar/thunar-history.c +++ b/thunar/thunar-history.c @@ -655,7 +655,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS { /* add an item for this file */ display_name = g_object_get_qdata (G_OBJECT (lp->data), thunar_history_display_name_quark); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_label (display_name); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_qdata (G_OBJECT (item), thunar_history_gfile_quark, lp->data); g_signal_connect (G_OBJECT (item), "activate", handler, history); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -695,7 +697,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS } /* release the icon factory */ diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c index 8980d7dc0..e7ef4949e 100644 --- a/thunar/thunar-shortcuts-view.c +++ b/thunar/thunar-shortcuts-view.c @@ -1096,23 +1096,31 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, menu = gtk_menu_new (); /* append the "Open" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Open")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open_clicked), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); /* set the icon */ image = gtk_image_new_from_icon_name ("document-open", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* append the "Open in New Tab" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Tab")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open_in_new_tab_clicked), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); /* append the "Open in New Window" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Window")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open_in_new_window_clicked), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -1133,19 +1141,25 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, gtk_widget_show (item); /* append the "Mount" item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Mount")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_visible (item, can_mount); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_mount), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); /* append the "Unmount" item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_visible (item, can_unmount); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_unmount), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); /* append the "Disconnect" (eject + safely remove drive) item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Eject")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_visible (item, can_eject); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_eject), view); @@ -1162,14 +1176,18 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, shortcuts_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model)); /* append the "Disconnect" item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Create _Shortcut")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_sensitive (item, mount_point != NULL && !thunar_shortcuts_model_has_bookmark (THUNAR_SHORTCUTS_MODEL (shortcuts_model), mount_point)); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_create_shortcut), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); image = gtk_image_new_from_stock (THUNAR_STOCK_SHORTCUTS, GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS if (mount_point != NULL) g_object_unref (mount_point); @@ -1183,14 +1201,18 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, gtk_widget_show (item); /* append the "Disconnect" item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Disconn_ect")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_sensitive (item, thunar_device_can_eject (device)); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_eject), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); image = gtk_image_new_from_stock (GTK_STOCK_DISCONNECT, GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS break; case THUNAR_SHORTCUT_GROUP_PLACES_TRASH: @@ -1200,7 +1222,9 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, gtk_widget_show (item); /* append the "Empty Trash" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Empty Trash")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_sensitive (item, (thunar_file_get_item_count (file) > 0)); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_empty_trash), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -1254,7 +1278,9 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Shortcut")); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_data_full (G_OBJECT (item), I_("thunar-shortcuts-row"), gtk_tree_row_reference_new (model, path), (GDestroyNotify) gtk_tree_row_reference_free); @@ -1265,10 +1291,14 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view, /* set the remove icon */ image = gtk_image_new_from_icon_name ("list-remove", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* append the rename menu item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Re_name Shortcut")); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_data_full (G_OBJECT (item), I_("thunar-shortcuts-row"), gtk_tree_row_reference_new (model, path), (GDestroyNotify) gtk_tree_row_reference_free); diff --git a/thunar/thunar-templates-action.c b/thunar/thunar-templates-action.c index ace5e07cf..33a263d89 100644 --- a/thunar/thunar-templates-action.c +++ b/thunar/thunar-templates-action.c @@ -361,7 +361,9 @@ thunar_templates_action_files_ready (ThunarJob *job, gtk_menu_set_screen (GTK_MENU (submenu), gtk_widget_get_screen (menu)); /* allocate a new menu item for the directory */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_label (thunar_file_get_display_name (file)); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); /* prepend the directory, its item and the parent menu it should @@ -379,7 +381,9 @@ thunar_templates_action_files_ready (ThunarJob *job, *dot = '\0'; /* allocate a new menu item */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_label (label); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_data_full (G_OBJECT (item), I_("thunar-file"), g_object_ref (file), g_object_unref); g_signal_connect (item, "activate", G_CALLBACK (item_activated), @@ -397,7 +401,9 @@ thunar_templates_action_files_ready (ThunarJob *job, /* allocate an image based on the icon */ image = gtk_image_new_from_pixbuf (icon); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* release the icon reference */ g_object_unref (icon); diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c index 2abcb7df3..81ebdf9ce 100644 --- a/thunar/thunar-tree-view.c +++ b/thunar/thunar-tree-view.c @@ -1280,7 +1280,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, menu = gtk_menu_new (); /* append the "Open" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Open")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_open), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (file != NULL || device != NULL)); @@ -1288,7 +1290,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("document-open", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* append the "Open in New Tab" menu action */ item = gtk_menu_item_new_with_mnemonic (_("Open in New _Tab")); @@ -1366,7 +1370,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, if (G_LIKELY (file != NULL && !thunar_file_is_trashed (file))) { /* append the "Create Folder" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Create _Folder...")); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_sensitive (item, thunar_file_is_writable (file)); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_create_folder), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -1375,7 +1381,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ icon = g_themed_icon_new ("folder-new"); image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_unref (icon); /* append a separator item */ @@ -1393,7 +1401,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, parent_file = thunar_file_get_parent (file, NULL); /* append the "Cut" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Cu_t")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_cut), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (parent_file != NULL && thunar_file_is_writable (parent_file))); @@ -1401,10 +1411,14 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("edit-cut", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* append the "Copy" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Copy")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_copy), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (parent_file != NULL)); @@ -1412,7 +1426,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("edit-copy", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* cleanup */ if (G_LIKELY (parent_file != NULL)) @@ -1420,7 +1436,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, } /* append the "Paste Into Folder" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Paste Into Folder")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_paste_into_folder), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (thunar_file_is_writable (file) && thunar_clipboard_manager_get_can_paste (view->clipboard))); @@ -1428,7 +1446,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("edit-paste", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* "Delete" and "Rename" don't make much sense for devices */ @@ -1446,7 +1466,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, && thunar_file_can_be_trashed (file)) { /* append the "Move to Tash" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("Mo_ve to Trash")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_move_to_trash), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (parent_file != NULL && thunar_file_is_writable (parent_file))); @@ -1454,11 +1476,15 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("user-trash-full", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS } /* append the "Delete" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("_Delete")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_delete), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (parent_file != NULL && thunar_file_is_writable (parent_file))); @@ -1466,7 +1492,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* cleanup */ if (G_LIKELY (parent_file != NULL)) @@ -1532,7 +1560,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, } /* append the "Properties" menu action */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS item = gtk_image_menu_item_new_with_mnemonic (_("P_roperties...")); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_properties), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_set_sensitive (item, (file != NULL)); @@ -1540,7 +1570,9 @@ thunar_tree_view_context_menu (ThunarTreeView *view, /* set the icon */ image = gtk_image_new_from_icon_name ("document-properties", GTK_ICON_SIZE_MENU); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); +G_GNUC_END_IGNORE_DEPRECATIONS /* run the menu (taking over the floating reference on the menu) */ thunar_gtk_menu_run (GTK_MENU (menu)); -- GitLab