summaryrefslogtreecommitdiff
path: root/mate-panel/libpanel-util
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 /mate-panel/libpanel-util
parent397531135d3510562b7c787eae2ac165dde65ef9 (diff)
downloadmate-panel-a518a93b575372faee1a3da6aaa9f20cf2e10ec1.tar.bz2
mate-panel-a518a93b575372faee1a3da6aaa9f20cf2e10ec1.tar.xz
avoid gtk_dialog_add_buttons with stock ids
Diffstat (limited to 'mate-panel/libpanel-util')
-rw-r--r--mate-panel/libpanel-util/panel-gtk.c20
-rw-r--r--mate-panel/libpanel-util/panel-gtk.h5
2 files changed, 25 insertions, 0 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