Skip to content
Permalink
Browse files

avoid gtk_dialog_add_buttons with stock ids

  • Loading branch information...
sc0w committed Apr 9, 2018
1 parent 3975311 commit a518a93b575372faee1a3da6aaa9f20cf2e10ec1
@@ -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;
}
@@ -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
@@ -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),
@@ -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),
@@ -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 */
}
@@ -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);
@@ -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);

@@ -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);

0 comments on commit a518a93

Please sign in to comment.
You can’t perform that action at this time.