summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-04-09 20:47:07 +0200
committerPablo Barciela <[email protected]>2018-04-09 20:53:39 +0200
commita518a93b575372faee1a3da6aaa9f20cf2e10ec1 (patch)
treec51b7b40e3d2ed6f5740d1d8f76b753964177ea3
parent397531135d3510562b7c787eae2ac165dde65ef9 (diff)
downloadmate-panel-a518a93b575372faee1a3da6aaa9f20cf2e10ec1.tar.bz2
mate-panel-a518a93b575372faee1a3da6aaa9f20cf2e10ec1.tar.xz
avoid gtk_dialog_add_buttons with stock ids
-rw-r--r--mate-panel/libpanel-util/panel-gtk.c20
-rw-r--r--mate-panel/libpanel-util/panel-gtk.h5
-rw-r--r--mate-panel/panel-addto.c28
-rw-r--r--mate-panel/panel-applet-frame.c17
-rw-r--r--mate-panel/panel-ditem-editor.c36
-rw-r--r--mate-panel/panel-force-quit.c15
-rw-r--r--mate-panel/panel-recent.c12
-rw-r--r--mate-panel/panel.c13
8 files changed, 99 insertions, 47 deletions
diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c
index b096d24f..aed2ce9c 100644
--- a/mate-panel/libpanel-util/panel-gtk.c
+++ b/mate-panel/libpanel-util/panel-gtk.c
@@ -81,3 +81,23 @@ panel_gtk_file_chooser_add_image_preview (GtkFileChooser *chooser)
/*
* End of code coming from panel-properties-dialog.c
*/
+
+GtkWidget*
+panel_dialog_add_button (GtkDialog *dialog,
+ const gchar *button_text,
+ const gchar *icon_name,
+ gint response_id)
+{
+ GtkWidget *button;
+
+ button = gtk_button_new_with_mnemonic (button_text);
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
+
+ gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
+ gtk_widget_set_can_default (button, TRUE);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
+
+ return button;
+}
diff --git a/mate-panel/libpanel-util/panel-gtk.h b/mate-panel/libpanel-util/panel-gtk.h
index d4aa6b25..19950a71 100644
--- a/mate-panel/libpanel-util/panel-gtk.h
+++ b/mate-panel/libpanel-util/panel-gtk.h
@@ -35,6 +35,11 @@ extern "C" {
void panel_gtk_file_chooser_add_image_preview (GtkFileChooser *chooser);
+GtkWidget* panel_dialog_add_button (GtkDialog *dialog,
+ const gchar *button_text,
+ const gchar *icon_name,
+ gint response_id);
+
#ifdef __cplusplus
}
#endif
diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c
index 49296882..98064220 100644
--- a/mate-panel/panel-addto.c
+++ b/mate-panel/panel-addto.c
@@ -33,6 +33,7 @@
#include <libpanel-util/panel-glib.h>
#include <libpanel-util/panel-show.h>
+#include <libpanel-util/panel-gtk.h>
#include "launcher.h"
#include "panel.h"
@@ -1220,17 +1221,22 @@ panel_addto_dialog_new (PanelWidget *panel_widget)
dialog);
dialog->addto_dialog = gtk_dialog_new ();
- gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
- "gtk-help", GTK_RESPONSE_HELP);
- dialog->back_button = gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
- "gtk-go-back",
- PANEL_ADDTO_RESPONSE_BACK);
- dialog->add_button = gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
- "gtk-add",
- PANEL_ADDTO_RESPONSE_ADD);
- gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
- "gtk-close",
- GTK_RESPONSE_CLOSE);
+
+ panel_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
+ _("_Help"), "help-browser", GTK_RESPONSE_HELP);
+
+ dialog->back_button = panel_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
+ _("_Back"), "go-previous",
+ PANEL_ADDTO_RESPONSE_BACK);
+
+ dialog->add_button = panel_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
+ _("_Add"), "list-add",
+ PANEL_ADDTO_RESPONSE_ADD);
+
+ panel_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
+ _("_Close"), "window-close",
+ GTK_RESPONSE_CLOSE);
+
gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog->addto_dialog),
diff --git a/mate-panel/panel-applet-frame.c b/mate-panel/panel-applet-frame.c
index a78b8c88..5b4b96c9 100644
--- a/mate-panel/panel-applet-frame.c
+++ b/mate-panel/panel-applet-frame.c
@@ -33,6 +33,8 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#include <libpanel-util/panel-gtk.h>
+
#include "panel-applets-manager.h"
#include "panel-profile.h"
#include "panel.h"
@@ -948,17 +950,18 @@ mate_panel_applet_frame_loading_failed (const char *iid,
g_free (problem_txt);
if (locked_down) {
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- "gtk-ok", LOADING_FAILED_RESPONSE_DONT_DELETE,
- NULL);
+ panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_OK"), "gtk-ok", LOADING_FAILED_RESPONSE_DONT_DELETE);
} else {
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("Do you want to delete the applet "
"from your configuration?"));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- PANEL_STOCK_DONT_DELETE, LOADING_FAILED_RESPONSE_DONT_DELETE,
- "gtk-delete", LOADING_FAILED_RESPONSE_DELETE,
- NULL);
+
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ PANEL_STOCK_DONT_DELETE, LOADING_FAILED_RESPONSE_DONT_DELETE);
+
+ panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Delete"), "edit-delete", LOADING_FAILED_RESPONSE_DELETE);
}
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
diff --git a/mate-panel/panel-ditem-editor.c b/mate-panel/panel-ditem-editor.c
index 77addfb8..f85979e0 100644
--- a/mate-panel/panel-ditem-editor.c
+++ b/mate-panel/panel-ditem-editor.c
@@ -34,6 +34,7 @@
#include <libpanel-util/panel-keyfile.h>
#include <libpanel-util/panel-show.h>
#include <libpanel-util/panel-xdg.h>
+#include <libpanel-util/panel-gtk.h>
#include "panel-ditem-editor.h"
#include "panel-icon-names.h"
@@ -648,24 +649,29 @@ panel_ditem_editor_make_ui (PanelDItemEditor *dialog)
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->comment_label),
priv->comment_entry);
- priv->help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-help",
- GTK_RESPONSE_HELP);
- priv->revert_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-revert-to-saved",
- REVERT_BUTTON);
+ priv->help_button = panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Help"), "help-browser",
+ GTK_RESPONSE_HELP);
+
+ priv->revert_button = panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Revert"), "document-revert",
+ REVERT_BUTTON);
+
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
REVERT_BUTTON,
FALSE);
- priv->close_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-close",
- GTK_RESPONSE_CLOSE);
- priv->cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-cancel",
- GTK_RESPONSE_CANCEL);
- priv->ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-ok",
- GTK_RESPONSE_OK);
+
+ priv->close_button = panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Close"), "window-close",
+ GTK_RESPONSE_CLOSE);
+
+ priv->cancel_button = panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
+
+ priv->ok_button = panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_OK"), "gtk-ok",
+ GTK_RESPONSE_OK);
/* FIXME: There needs to be a way to edit ALL keys/sections */
}
diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c
index fdd19438..5a994fdc 100644
--- a/mate-panel/panel-force-quit.c
+++ b/mate-panel/panel-force-quit.c
@@ -34,6 +34,8 @@
#include <X11/extensions/XInput2.h>
+#include <libpanel-util/panel-gtk.h>
+
#include "panel-icon-names.h"
#include "panel-stock-icons.h"
@@ -224,12 +226,13 @@ kill_window_question (gpointer window)
"to exit, unsaved changes in any open documents "
"in it might get lost."));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- "gtk-cancel",
- GTK_RESPONSE_CANCEL,
- PANEL_STOCK_FORCE_QUIT,
- GTK_RESPONSE_ACCEPT,
- NULL);
+ panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
+
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ PANEL_STOCK_FORCE_QUIT,
+ GTK_RESPONSE_ACCEPT);
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_CANCEL);
diff --git a/mate-panel/panel-recent.c b/mate-panel/panel-recent.c
index bd1287a1..e111c157 100644
--- a/mate-panel/panel-recent.c
+++ b/mate-panel/panel-recent.c
@@ -31,6 +31,7 @@
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-show.h>
+#include <libpanel-util/panel-gtk.h>
#include "menu.h"
#include "panel-util.h"
@@ -150,10 +151,13 @@ recent_documents_clear_cb (GtkMenuItem *menuitem,
"\342\200\242 All items from the Places \342\206\222 Recent Documents menu item.\n"
"\342\200\242 All items from the recent documents list in all applications."));
- gtk_dialog_add_buttons (GTK_DIALOG (clear_recent_dialog),
- "gtk-cancel", GTK_RESPONSE_CANCEL,
- PANEL_STOCK_CLEAR, GTK_RESPONSE_ACCEPT,
- NULL);
+ panel_dialog_add_button (GTK_DIALOG (clear_recent_dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
+
+ gtk_dialog_add_button (GTK_DIALOG (clear_recent_dialog),
+ PANEL_STOCK_CLEAR,
+ GTK_RESPONSE_ACCEPT);
gtk_container_set_border_width (GTK_CONTAINER (clear_recent_dialog), 6);
diff --git a/mate-panel/panel.c b/mate-panel/panel.c
index aa129e4b..72b9e6cd 100644
--- a/mate-panel/panel.c
+++ b/mate-panel/panel.c
@@ -22,6 +22,7 @@
#include <gtk/gtkx.h> /* for GTK_IS_SOCKET */
#include <libpanel-util/panel-glib.h>
+#include <libpanel-util/panel-gtk.h>
#include "panel.h"
@@ -1342,10 +1343,14 @@ panel_deletion_dialog (PanelToplevel *toplevel)
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", text2);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- "gtk-cancel", GTK_RESPONSE_CANCEL,
- "gtk-delete", GTK_RESPONSE_OK,
- NULL);
+
+ panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
+
+ panel_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Delete"), "edit-delete",
+ GTK_RESPONSE_OK);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);