diff options
author | rbuj <[email protected]> | 2019-09-12 22:40:22 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2019-09-15 03:43:21 +0000 |
commit | bfc93ef400c067e191b6d96b593fcad8edee9793 (patch) | |
tree | ccc2f89040babacb66cd0edb54b060a3e53e1966 | |
parent | e1a45d490e4ccba44fb0b5a7cac97d490982483a (diff) | |
download | engrampa-bfc93ef400c067e191b6d96b593fcad8edee9793.tar.bz2 engrampa-bfc93ef400c067e191b6d96b593fcad8edee9793.tar.xz |
dlg-package-installer: show icons in error dialog buttons
-rw-r--r-- | src/dlg-package-installer.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/dlg-package-installer.c b/src/dlg-package-installer.c index ccc5dce..313b0df 100644 --- a/src/dlg-package-installer.c +++ b/src/dlg-package-installer.c @@ -246,6 +246,26 @@ confirm_search_dialog_response_cb (GtkDialog *dialog, } } +static GtkWidget * +create_button (const char *icon_name, + const char *text) +{ + GtkIconTheme *icon_theme; + GtkWidget *button; + + button = gtk_button_new_with_mnemonic (text); + icon_theme = gtk_icon_theme_get_default (); + if (gtk_icon_theme_has_icon (icon_theme, icon_name)) { + GtkWidget *image; + image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (button), image); + } + gtk_widget_set_can_default (button, TRUE); + + gtk_widget_show (button); + + return button; +} #endif /* ENABLE_PACKAGEKIT */ @@ -294,9 +314,18 @@ dlg_package_installer (FrWindow *window, "dialog-error", _("Could not open this file type"), secondary_text, - _("_Cancel"), GTK_RESPONSE_NO, - _("_Search Command"), GTK_RESPONSE_YES, NULL); + + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), + create_button ("process-stop", _("_Cancel")), + GTK_RESPONSE_NO); + + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), + create_button ("edit-find", _("_Search Command")), + GTK_RESPONSE_YES); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); + g_signal_connect (dialog, "response", G_CALLBACK (confirm_search_dialog_response_cb), idata); gtk_widget_show (dialog); |