summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-12-12 00:52:21 +0100
committerZenWalker <[email protected]>2018-12-15 22:47:22 +0100
commit7cd2ccc48b5a90cd54ba24f6bcdfe36dd8b495f6 (patch)
treef5bc23514956c286ccaf659b69dcb63e91771d3a
parent717a8f94d63a2040e8af7e6613d55d74660e07ed (diff)
downloadmate-session-manager-7cd2ccc48b5a90cd54ba24f6bcdfe36dd8b495f6.tar.bz2
mate-session-manager-7cd2ccc48b5a90cd54ba24f6bcdfe36dd8b495f6.tar.xz
avoid 'gtk_dialog_add_button' with stock ids
-rw-r--r--capplet/gsm-app-dialog.c15
-rw-r--r--mate-session/gsm-logout-dialog.c13
-rw-r--r--mate-session/gsm-util.c20
-rw-r--r--mate-session/gsm-util.h6
4 files changed, 42 insertions, 12 deletions
diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c
index fbcfbef..f14701e 100644
--- a/capplet/gsm-app-dialog.c
+++ b/capplet/gsm-app-dialog.c
@@ -186,19 +186,22 @@ setup_dialog (GsmAppDialog *dialog)
"resizable", FALSE,
NULL);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-cancel", GTK_RESPONSE_CANCEL);
+ gsm_util_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
if (dialog->name == NULL
&& dialog->command == NULL
&& dialog->comment == NULL) {
gtk_window_set_title (GTK_WINDOW (dialog), _("Add Startup Program"));
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-add", GTK_RESPONSE_OK);
+ gsm_util_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Add"), "list-add",
+ GTK_RESPONSE_OK);
} else {
gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Startup Program"));
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- "gtk-save", GTK_RESPONSE_OK);
+ gsm_util_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Save"), "document-save",
+ GTK_RESPONSE_OK);
}
dialog->name_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME));
diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c
index 0b5741c..36aad7b 100644
--- a/mate-session/gsm-logout-dialog.c
+++ b/mate-session/gsm-logout-dialog.c
@@ -33,6 +33,7 @@
#endif
#include "gsm-consolekit.h"
#include "mdm.h"
+#include "gsm-util.h"
#define GSM_ICON_LOGOUT "system-log-out"
#define GSM_ICON_SHUTDOWN "system-shutdown"
@@ -447,9 +448,9 @@ gsm_get_dialog (GsmDialogLogoutType type,
GSM_LOGOUT_RESPONSE_SWITCH_USER);
}
- gtk_dialog_add_button (GTK_DIALOG (logout_dialog),
- "gtk-cancel",
- GTK_RESPONSE_CANCEL);
+ gsm_util_dialog_add_button (GTK_DIALOG (logout_dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (logout_dialog),
_("_Log Out"),
@@ -480,9 +481,9 @@ gsm_get_dialog (GsmDialogLogoutType type,
GSM_LOGOUT_RESPONSE_REBOOT);
}
- gtk_dialog_add_button (GTK_DIALOG (logout_dialog),
- "gtk-cancel",
- GTK_RESPONSE_CANCEL);
+ gsm_util_dialog_add_button (GTK_DIALOG (logout_dialog),
+ _("_Cancel"), "process-stop",
+ GTK_RESPONSE_CANCEL);
if (gsm_logout_supports_shutdown (logout_dialog)) {
gtk_dialog_add_button (GTK_DIALOG (logout_dialog),
diff --git a/mate-session/gsm-util.c b/mate-session/gsm-util.c
index 92e813b..a769d8c 100644
--- a/mate-session/gsm-util.c
+++ b/mate-session/gsm-util.c
@@ -688,3 +688,23 @@ gsm_util_setenv (const char *variable,
}
#endif
}
+
+GtkWidget*
+gsm_util_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-session/gsm-util.h b/mate-session/gsm-util.h
index 2c406af..dcec60e 100644
--- a/mate-session/gsm-util.h
+++ b/mate-session/gsm-util.h
@@ -21,6 +21,7 @@
#define __GSM_UTIL_H__
#include <glib.h>
+#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
@@ -57,6 +58,11 @@ gboolean gsm_util_export_user_environment (GError **error);
void gsm_util_setenv (const char *variable,
const char *value);
+GtkWidget* gsm_util_dialog_add_button (GtkDialog *dialog,
+ const gchar *button_text,
+ const gchar *icon_name,
+ gint response_id);
+
#ifdef __cplusplus
}
#endif