Skip to content

Commit 7ebb494

Browse files
sc0wlukefromdc
authored andcommitted
fish.c: avoid 'gtk_dialog_new_with_buttons' with stock id
1 parent 33e4655 commit 7ebb494

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

‎applets/fish/fish.c‎

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,26 @@ set_environment (gpointer display)
802802
g_setenv ("DISPLAY", display, TRUE);
803803
}
804804

805+
static GtkWidget*
806+
panel_dialog_add_button (GtkDialog *dialog,
807+
const gchar *button_text,
808+
const gchar *icon_name,
809+
gint response_id)
810+
{
811+
GtkWidget *button;
812+
813+
button = gtk_button_new_with_mnemonic (button_text);
814+
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
815+
816+
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
817+
gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
818+
gtk_widget_set_can_default (button, TRUE);
819+
gtk_widget_show (button);
820+
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
821+
822+
return button;
823+
}
824+
805825
static void display_fortune_dialog(FishApplet* fish)
806826
{
807827
GError *error = NULL;
@@ -831,12 +851,16 @@ static void display_fortune_dialog(FishApplet* fish)
831851
int screen_width;
832852
int screen_height;
833853

834-
fish->fortune_dialog =
835-
gtk_dialog_new_with_buttons (
836-
"", NULL, 0,
837-
_("_Speak again"), FISH_RESPONSE_SPEAK,
838-
"gtk-close", GTK_RESPONSE_CLOSE,
839-
NULL);
854+
fish->fortune_dialog = gtk_dialog_new ();
855+
gtk_window_set_title (GTK_WINDOW (fish->fortune_dialog), "");
856+
857+
gtk_dialog_add_button (GTK_DIALOG (fish->fortune_dialog),
858+
_("_Speak again"),
859+
FISH_RESPONSE_SPEAK);
860+
861+
panel_dialog_add_button (GTK_DIALOG (fish->fortune_dialog),
862+
_("_Close"), "window-close",
863+
GTK_RESPONSE_CLOSE);
840864

841865
gtk_window_set_icon_name (GTK_WINDOW (fish->fortune_dialog),
842866
FISH_ICON);

0 commit comments

Comments
 (0)