[gcr] ui: Stop using GtkStock now that it's been deprecated



commit c5a36b6c497181b131638a25444932963cdef05f
Author: Stef Walter <stefw gnome org>
Date:   Sun Jan 5 20:12:16 2014 +0100

    ui: Stop using GtkStock now that it's been deprecated

 ui/gcr-certificate-exporter.c |    6 +++---
 ui/gcr-display-view.c         |   14 +++++++-------
 ui/gcr-live-search.c          |    4 ++--
 ui/gcr-pkcs11-import-dialog.c |    7 +++++--
 ui/gcr-prompt-dialog.c        |   19 +++++++++----------
 ui/gcr-viewer-window.c        |    2 +-
 6 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/ui/gcr-certificate-exporter.c b/ui/gcr-certificate-exporter.c
index 8b0977f..41d455b 100644
--- a/ui/gcr-certificate-exporter.c
+++ b/ui/gcr-certificate-exporter.c
@@ -227,7 +227,7 @@ on_create_file_ready (GObject *source, GAsyncResult *res, gpointer user_data)
                     _("A file already exists with this name."),
                     _("Do you want to replace it with a new file?"));
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                       _("_Cancel"), GTK_RESPONSE_CANCEL,
                                        _("_Replace"), GTK_RESPONSE_ACCEPT, NULL);
 
                g_signal_connect (dialog, "response",
@@ -304,8 +304,8 @@ exporter_display_chooser (GcrCertificateExporter *self)
 
        dialog = gtk_file_chooser_dialog_new (_("Export certificate"),
                             NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
-                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                            GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+                            _("_Cancel"), GTK_RESPONSE_CANCEL,
+                            _("_Save"), GTK_RESPONSE_ACCEPT,
                             NULL);
 
        self->pv->chooser_dialog = g_object_ref_sink(dialog);
diff --git a/ui/gcr-display-view.c b/ui/gcr-display-view.c
index fa4f4e9..e058b45 100644
--- a/ui/gcr-display-view.c
+++ b/ui/gcr-display-view.c
@@ -1129,7 +1129,7 @@ _gcr_display_view_append_message (GcrDisplayView *self,
                                   GtkMessageType message_type,
                                   const gchar *message)
 {
-       const gchar *stock_id = NULL;
+       const gchar *name = NULL;
        GtkWidget *image = NULL;
        GcrDisplayItem *item;
        GtkTextChildAnchor *anchor;
@@ -1143,19 +1143,19 @@ _gcr_display_view_append_message (GcrDisplayView *self,
 
        switch (message_type) {
        case GTK_MESSAGE_INFO:
-               stock_id = GTK_STOCK_DIALOG_INFO;
+               name = "dialog-information";
                break;
 
        case GTK_MESSAGE_QUESTION:
-               stock_id = GTK_STOCK_DIALOG_QUESTION;
+               name = "dialog-question";
                break;
 
        case GTK_MESSAGE_WARNING:
-               stock_id = GTK_STOCK_DIALOG_WARNING;
+               name = "dialog-warning";
                break;
 
        case GTK_MESSAGE_ERROR:
-               stock_id = GTK_STOCK_DIALOG_ERROR;
+               name = "dialog-error";
                break;
 
        case GTK_MESSAGE_OTHER:
@@ -1168,8 +1168,8 @@ _gcr_display_view_append_message (GcrDisplayView *self,
 
        gtk_text_buffer_get_iter_at_mark (self->pv->buffer, &iter, item->ending);
 
-       if (stock_id != NULL) {
-               image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
+       if (name != NULL) {
+               image = gtk_image_new_from_icon_name (name, GTK_ICON_SIZE_MENU);
                gtk_misc_set_padding (GTK_MISC (image), MESSAGE_PADDING, 0);
                gtk_widget_show (image);
 
diff --git a/ui/gcr-live-search.c b/ui/gcr-live-search.c
index 7e85729..fe8c371 100644
--- a/ui/gcr-live-search.c
+++ b/ui/gcr-live-search.c
@@ -525,8 +525,8 @@ _gcr_live_search_init (GcrLiveSearch *self)
        gtk_widget_set_no_show_all (GTK_WIDGET (self), TRUE);
 
        self->pv->search_entry = gtk_entry_new ();
-       gtk_entry_set_icon_from_stock (GTK_ENTRY (self->pv->search_entry),
-                                      GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLOSE);
+       gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->pv->search_entry),
+                                          GTK_ENTRY_ICON_SECONDARY, "window-close");
        gtk_entry_set_icon_activatable (GTK_ENTRY (self->pv->search_entry),
                                        GTK_ENTRY_ICON_SECONDARY, TRUE);
        gtk_entry_set_icon_sensitive (GTK_ENTRY (self->pv->search_entry),
diff --git a/ui/gcr-pkcs11-import-dialog.c b/ui/gcr-pkcs11-import-dialog.c
index ca56ceb..fbb5b3b 100644
--- a/ui/gcr-pkcs11-import-dialog.c
+++ b/ui/gcr-pkcs11-import-dialog.c
@@ -79,6 +79,7 @@ _gcr_pkcs11_import_dialog_constructed (GObject *obj)
        GtkEntryBuffer *buffer;
        GtkWidget *widget;
        GtkBox *contents;
+       GtkWidget *button;
 
        G_OBJECT_CLASS (_gcr_pkcs11_import_dialog_parent_class)->constructed (obj);
 
@@ -112,8 +113,10 @@ _gcr_pkcs11_import_dialog_constructed (GObject *obj)
        gtk_entry_set_activates_default (self->label_entry, TRUE);
 
        /* Add our various buttons */
-       gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-       gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_OK, GTK_RESPONSE_OK);
+       button = gtk_dialog_add_button (GTK_DIALOG (self), _("_Cancel"), GTK_RESPONSE_CANCEL);
+       gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
+       button = gtk_dialog_add_button (GTK_DIALOG (self), _("_OK"), GTK_RESPONSE_OK);
+       gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
        gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
 
        gtk_window_set_modal (GTK_WINDOW (self), TRUE);
diff --git a/ui/gcr-prompt-dialog.c b/ui/gcr-prompt-dialog.c
index 59747ac..c8327bd 100644
--- a/ui/gcr-prompt-dialog.c
+++ b/ui/gcr-prompt-dialog.c
@@ -501,10 +501,12 @@ gcr_prompt_dialog_constructed (GObject *obj)
        G_OBJECT_CLASS (gcr_prompt_dialog_parent_class)->constructed (obj);
 
        dialog = GTK_DIALOG (self);
-       button = gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+       button = gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
        g_object_bind_property (self, "cancel-label", button, "label", G_BINDING_DEFAULT | 
G_BINDING_SYNC_CREATE);
-       button = gtk_dialog_add_button (dialog, GTK_STOCK_OK, GTK_RESPONSE_OK);
+       gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
+       button = gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
        g_object_bind_property (self, "continue-label", button, "label", G_BINDING_DEFAULT | 
G_BINDING_SYNC_CREATE);
+       gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
        self->pv->continue_button = button;
 
        gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_NORMAL);
@@ -522,8 +524,7 @@ gcr_prompt_dialog_constructed (GObject *obj)
        gtk_grid_set_row_spacing (grid, 6);
 
        /* The prompt image */
-       self->pv->image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
-                                                   GTK_ICON_SIZE_DIALOG);
+       self->pv->image = gtk_image_new_from_icon_name ("dialog-password", GTK_ICON_SIZE_DIALOG);
        gtk_widget_set_valign (self->pv->image, GTK_ALIGN_START);
        gtk_grid_attach (grid, self->pv->image, -1, 0, 1, 4);
        gtk_widget_show (self->pv->image);
@@ -851,9 +852,8 @@ gcr_prompt_dialog_password_async (GcrPrompt *prompt,
                return;
        }
 
-       gtk_image_set_from_stock (GTK_IMAGE (self->pv->image),
-                                 GTK_STOCK_DIALOG_AUTHENTICATION,
-                                 GTK_ICON_SIZE_DIALOG);
+       gtk_image_set_from_icon_name (GTK_IMAGE (self->pv->image),
+                                     "dialog-password", GTK_ICON_SIZE_DIALOG);
        gtk_widget_set_sensitive (self->pv->continue_button, TRUE);
        gtk_widget_set_sensitive (self->pv->widget_grid, TRUE);
        gtk_widget_hide (self->pv->spinner);
@@ -912,9 +912,8 @@ gcr_prompt_dialog_confirm_async (GcrPrompt *prompt,
                return;
        }
 
-       gtk_image_set_from_stock (GTK_IMAGE (self->pv->image),
-                                 GTK_STOCK_DIALOG_QUESTION,
-                                 GTK_ICON_SIZE_DIALOG);
+       gtk_image_set_from_icon_name (GTK_IMAGE (self->pv->image),
+                                     "dialog-question", GTK_ICON_SIZE_DIALOG);
        gtk_widget_set_sensitive (self->pv->continue_button, TRUE);
        gtk_widget_set_sensitive (self->pv->widget_grid, TRUE);
        gtk_widget_hide (self->pv->spinner);
diff --git a/ui/gcr-viewer-window.c b/ui/gcr-viewer-window.c
index 0df5e78..5e09fb2 100644
--- a/ui/gcr-viewer-window.c
+++ b/ui/gcr-viewer-window.c
@@ -114,7 +114,7 @@ gcr_viewer_window_constructed (GObject *obj)
                                 self, 0);
        gtk_widget_show (GTK_WIDGET (self->pv->import));
 
-       button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+       button = gtk_button_new_with_mnemonic (_("_Close"));
        g_signal_connect_object  (button, "clicked",
                                  G_CALLBACK (on_close_clicked),
                                  self, 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]