From 2217a021ca5c5ac918dd6e41c4ef29435b5a6b8e Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Thu, 18 Jan 2018 23:24:59 +0100 Subject: avoid deprecated GtkStock --- plugins/filebrowser/pluma-file-browser-plugin.c | 8 +++--- plugins/filebrowser/pluma-file-browser-utils.c | 18 +++++++++---- plugins/filebrowser/pluma-file-browser-utils.h | 2 +- plugins/filebrowser/pluma-file-browser-widget.c | 34 ++++++++++++++----------- plugins/sort/pluma-sort-plugin.c | 2 +- plugins/spell/pluma-automatic-spell-checker.c | 10 ++++---- plugins/spell/pluma-spell-language-dialog.c | 6 ++--- plugins/spell/pluma-spell-plugin.c | 2 +- plugins/taglist/pluma-taglist-plugin.c | 8 +++--- plugins/time/pluma-time-plugin.c | 2 +- 10 files changed, 52 insertions(+), 40 deletions(-) (limited to 'plugins') diff --git a/plugins/filebrowser/pluma-file-browser-plugin.c b/plugins/filebrowser/pluma-file-browser-plugin.c index b619309e..775d7b36 100644 --- a/plugins/filebrowser/pluma-file-browser-plugin.c +++ b/plugins/filebrowser/pluma-file-browser-plugin.c @@ -574,7 +574,7 @@ on_selection_changed_cb (GtkTreeSelection *selection, static GtkActionEntry extra_actions[] = { - {"SetActiveRoot", GTK_STOCK_JUMP_TO, N_("_Set root to active document"), + {"SetActiveRoot", "go-jump", N_("_Set root to active document"), NULL, N_("Set the root to the active document location"), G_CALLBACK (on_action_set_active_root)} @@ -717,7 +717,7 @@ pluma_file_browser_plugin_activate (PeasActivatable *activatable) image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); } else { - image = gtk_image_new_from_stock(GTK_STOCK_INDEX, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name("gtk-index", GTK_ICON_SIZE_MENU); } gtk_widget_show(image); @@ -1141,7 +1141,7 @@ on_confirm_no_trash_cb (PlumaFileBrowserWidget * widget, GTK_MESSAGE_QUESTION, message, secondary, - GTK_STOCK_DELETE, + "gtk-delete", NULL); g_free (secondary); @@ -1176,7 +1176,7 @@ on_confirm_delete_cb (PlumaFileBrowserWidget *widget, GTK_MESSAGE_QUESTION, message, secondary, - GTK_STOCK_DELETE, + "gtk-delete", NULL); g_free (message); diff --git a/plugins/filebrowser/pluma-file-browser-utils.c b/plugins/filebrowser/pluma-file-browser-utils.c index 3a232f8d..1443125a 100644 --- a/plugins/filebrowser/pluma-file-browser-utils.c +++ b/plugins/filebrowser/pluma-file-browser-utils.c @@ -149,7 +149,7 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, GtkMessageType type, gchar const *message, gchar const *secondary, - gchar const * button_stock, + gchar const * button_image, gchar const * button_label) { GtkWidget *dlg; @@ -167,7 +167,12 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, (GTK_MESSAGE_DIALOG (dlg), "%s", secondary); /* Add a cancel button */ - button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); + button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON, + "label", "gtk-cancel", + "use-stock", TRUE, + "use-underline", TRUE, + NULL)); + gtk_widget_show (button); gtk_widget_set_can_default (button, TRUE); @@ -176,10 +181,13 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, GTK_RESPONSE_CANCEL); /* Add custom button */ - button = gtk_button_new_from_stock (button_stock); - + button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON, + "label", button_image, + "use-stock", TRUE, + "use-underline", TRUE, + NULL)); + if (button_label) { - gtk_button_set_use_stock (GTK_BUTTON (button), FALSE); gtk_button_set_label (GTK_BUTTON (button), button_label); } diff --git a/plugins/filebrowser/pluma-file-browser-utils.h b/plugins/filebrowser/pluma-file-browser-utils.h index 0ac4296a..ffe6159e 100644 --- a/plugins/filebrowser/pluma-file-browser-utils.h +++ b/plugins/filebrowser/pluma-file-browser-utils.h @@ -19,7 +19,7 @@ gboolean pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, GtkMessageType type, gchar const *message, gchar const *secondary, - gchar const * button_stock, + gchar const * button_image, gchar const * button_label); #endif /* __PLUMA_FILE_BROWSER_UTILS_H__ */ diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index 46087bbf..6187696e 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -802,30 +802,30 @@ static const GtkActionEntry tree_actions_selection[] = {"FileMoveToTrash", "mate-stock-trash", N_("_Move to Trash"), NULL, N_("Move selected file or folder to trash"), G_CALLBACK (on_action_file_move_to_trash)}, - {"FileDelete", GTK_STOCK_DELETE, N_("_Delete"), NULL, + {"FileDelete", "edit-delete", N_("_Delete"), NULL, N_("Delete selected file or folder"), G_CALLBACK (on_action_file_delete)} }; static const GtkActionEntry tree_actions_file_selection[] = { - {"FileOpen", GTK_STOCK_OPEN, NULL, NULL, + {"FileOpen", "document-open", N_("_Open"), NULL, N_("Open selected file"), G_CALLBACK (on_action_file_open)} }; static const GtkActionEntry tree_actions[] = { - {"DirectoryUp", GTK_STOCK_GO_UP, N_("Up"), NULL, + {"DirectoryUp", "go-up", N_("Up"), NULL, N_("Open the parent folder"), G_CALLBACK (on_action_directory_up)} }; static const GtkActionEntry tree_actions_single_most_selection[] = { - {"DirectoryNew", GTK_STOCK_ADD, N_("_New Folder"), NULL, + {"DirectoryNew", "list-add", N_("_New Folder"), NULL, N_("Add new empty folder"), G_CALLBACK (on_action_directory_new)}, - {"FileNew", GTK_STOCK_NEW, N_("New F_ile"), NULL, + {"FileNew", "document-new", N_("New F_ile"), NULL, N_("Add new empty file"), G_CALLBACK (on_action_file_new)} }; @@ -838,22 +838,22 @@ static const GtkActionEntry tree_actions_single_selection[] = static const GtkActionEntry tree_actions_sensitive[] = { - {"DirectoryPrevious", GTK_STOCK_GO_BACK, N_("_Previous Location"), + {"DirectoryPrevious", "go-previous", N_("_Previous Location"), NULL, N_("Go to the previous visited location"), G_CALLBACK (on_action_directory_previous)}, - {"DirectoryNext", GTK_STOCK_GO_FORWARD, N_("_Next Location"), NULL, + {"DirectoryNext", "go-next", N_("_Next Location"), NULL, N_("Go to the next visited location"), G_CALLBACK (on_action_directory_next)}, - {"DirectoryRefresh", GTK_STOCK_REFRESH, N_("Re_fresh View"), NULL, + {"DirectoryRefresh", "view-refresh", N_("Re_fresh View"), NULL, N_("Refresh the view"), G_CALLBACK (on_action_directory_refresh)}, - {"DirectoryOpen", GTK_STOCK_OPEN, N_("_View Folder"), NULL, + {"DirectoryOpen", "document-open", N_("_View Folder"), NULL, N_("View folder in file manager"), G_CALLBACK (on_action_directory_open)} }; static const GtkToggleActionEntry tree_actions_toggle[] = { - {"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION, + {"FilterHidden", "dialog-password", N_("Show _Hidden"), NULL, N_("Show hidden files and folders"), G_CALLBACK (on_action_filter_hidden), FALSE}, @@ -864,7 +864,7 @@ static const GtkToggleActionEntry tree_actions_toggle[] = static const GtkActionEntry bookmark_actions[] = { - {"BookmarkOpen", GTK_STOCK_OPEN, N_("_View Folder"), NULL, + {"BookmarkOpen", "document-open", N_("_View Folder"), NULL, N_("View folder in file manager"), G_CALLBACK (on_action_bookmark_open)} }; @@ -986,11 +986,13 @@ create_toolbar (PlumaFileBrowserWidget * obj, obj->priv->location_previous_menu = gtk_menu_new (); gtk_widget_show (obj->priv->location_previous_menu); - widget = GTK_WIDGET (gtk_menu_tool_button_new_from_stock (GTK_STOCK_GO_BACK)); + widget = GTK_WIDGET (gtk_menu_tool_button_new (gtk_image_new_from_icon_name ("go-previous", + GTK_ICON_SIZE_MENU), + _("Previous location"))); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (widget), obj->priv->location_previous_menu); - g_object_set (widget, "label", _("Previous location"), NULL); gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (widget), _("Go to previous location")); gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (widget), @@ -1007,11 +1009,13 @@ create_toolbar (PlumaFileBrowserWidget * obj, obj->priv->location_next_menu = gtk_menu_new (); gtk_widget_show (obj->priv->location_next_menu); - widget = GTK_WIDGET (gtk_menu_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD)); + widget = GTK_WIDGET (gtk_menu_tool_button_new (gtk_image_new_from_icon_name ("go-next", + GTK_ICON_SIZE_MENU), + _("Next location"))); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (widget), obj->priv->location_next_menu); - g_object_set (widget, "label", _("Next location"), NULL); gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (widget), _("Go to next location")); gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (widget), diff --git a/plugins/sort/pluma-sort-plugin.c b/plugins/sort/pluma-sort-plugin.c index 67a3a1ce..49d804bf 100644 --- a/plugins/sort/pluma-sort-plugin.c +++ b/plugins/sort/pluma-sort-plugin.c @@ -90,7 +90,7 @@ static void sort_real (SortDialog *dialog); static const GtkActionEntry action_entries[] = { { "Sort", - GTK_STOCK_SORT_ASCENDING, + "view-sort-ascending", N_("S_ort..."), NULL, N_("Sort the current document or selection"), diff --git a/plugins/spell/pluma-automatic-spell-checker.c b/plugins/spell/pluma-automatic-spell-checker.c index 76d4be96..0bf16147 100644 --- a/plugins/spell/pluma-automatic-spell-checker.c +++ b/plugins/spell/pluma-automatic-spell-checker.c @@ -498,8 +498,8 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* Ignore all */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Ignore All")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_stock (GTK_STOCK_GOTO_BOTTOM, - GTK_ICON_SIZE_MENU)); + gtk_image_new_from_icon_name ("go-bottom", + GTK_ICON_SIZE_MENU)); g_signal_connect (mi, "activate", @@ -513,8 +513,8 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* + Add to Dictionary */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Add")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_stock (GTK_STOCK_ADD, - GTK_ICON_SIZE_MENU)); + gtk_image_new_from_icon_name ("list-add", + GTK_ICON_SIZE_MENU)); g_signal_connect (mi, "activate", @@ -549,7 +549,7 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi); /* then, on top of it, the suggestions menu. */ - img = gtk_image_new_from_stock (GTK_STOCK_SPELL_CHECK, GTK_ICON_SIZE_MENU); + img = gtk_image_new_from_icon_name ("tools-check-spelling", GTK_ICON_SIZE_MENU); mi = gtk_image_menu_item_new_with_mnemonic (_("_Spelling Suggestions...")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), img); diff --git a/plugins/spell/pluma-spell-language-dialog.c b/plugins/spell/pluma-spell-language-dialog.c index 0690e1cc..beaf9572 100644 --- a/plugins/spell/pluma-spell-language-dialog.c +++ b/plugins/spell/pluma-spell-language-dialog.c @@ -130,11 +130,11 @@ create_dialog (PlumaSpellLanguageDialog *dlg, }; gtk_dialog_add_buttons (GTK_DIALOG (dlg), - GTK_STOCK_CANCEL, + "gtk-cancel", GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, + "gtk-ok", GTK_RESPONSE_OK, - GTK_STOCK_HELP, + "gtk-help", GTK_RESPONSE_HELP, NULL); diff --git a/plugins/spell/pluma-spell-plugin.c b/plugins/spell/pluma-spell-plugin.c index b7f96eb3..ad5d3c56 100644 --- a/plugins/spell/pluma-spell-plugin.c +++ b/plugins/spell/pluma-spell-plugin.c @@ -96,7 +96,7 @@ static void auto_spell_cb (GtkAction *action, PlumaSpellPlugin *plugin); static const GtkActionEntry action_entries[] = { { "CheckSpell", - GTK_STOCK_SPELL_CHECK, + "tools-check-spelling", N_("_Check Spelling..."), "F7", N_("Check the current document for incorrect spelling"), diff --git a/plugins/taglist/pluma-taglist-plugin.c b/plugins/taglist/pluma-taglist-plugin.c index 6032d101..bbeec250 100644 --- a/plugins/taglist/pluma-taglist-plugin.c +++ b/plugins/taglist/pluma-taglist-plugin.c @@ -120,10 +120,10 @@ pluma_taglist_plugin_activate (PeasActivatable *activatable) priv->taglist_panel = pluma_taglist_plugin_panel_new (window, data_dir); g_free (data_dir); - pluma_panel_add_item_with_stock_icon (side_panel, - priv->taglist_panel, - _("Tags"), - "list-add"); + pluma_panel_add_item_with_icon (side_panel, + priv->taglist_panel, + _("Tags"), + "list-add"); } static void diff --git a/plugins/time/pluma-time-plugin.c b/plugins/time/pluma-time-plugin.c index 57026e65..561c47be 100644 --- a/plugins/time/pluma-time-plugin.c +++ b/plugins/time/pluma-time-plugin.c @@ -919,7 +919,7 @@ get_choose_format_dialog (GtkWindow *parent, err_dialog = gtk_dialog_new_with_buttons (NULL, parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + "gtk-ok", GTK_RESPONSE_ACCEPT, NULL); if (wg != NULL) -- cgit v1.2.1