[nautilus] libnautilus-private: don't use deprecated GtkImageMenuItem and GtkStock



commit 3a61cbb24090dea76af0cc14a128f0c57fba77dc
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Aug 10 20:15:53 2013 +0200

    libnautilus-private: don't use deprecated GtkImageMenuItem and GtkStock

 libnautilus-private/nautilus-bookmark.c            |   25 +-------
 libnautilus-private/nautilus-clipboard.c           |   12 ++--
 libnautilus-private/nautilus-column-chooser.c      |   20 +-----
 .../nautilus-desktop-link-monitor.c                |    4 +-
 .../nautilus-file-conflict-dialog.c                |   10 ++--
 libnautilus-private/nautilus-file-operations.c     |   70 ++++++++++----------
 .../nautilus-mime-application-chooser.c            |    2 +-
 7 files changed, 54 insertions(+), 89 deletions(-)
---
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 4b3652d..2f09fc3 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -171,7 +171,7 @@ apply_warning_emblem (GIcon **base,
        if (symbolic) {
                warning = g_themed_icon_new ("dialog-warning-symbolic");
        } else {
-               warning = g_themed_icon_new (GTK_STOCK_DIALOG_WARNING);
+               warning = g_themed_icon_new ("dialog-warning");
        }
 
        emblem = g_emblem_new (warning);
@@ -762,19 +762,6 @@ nautilus_bookmark_new (GFile *location,
        return new_bookmark;
 }                               
 
-static GtkWidget *
-create_image_widget_for_bookmark (NautilusBookmark *bookmark)
-{
-       GIcon *icon;
-       GtkWidget *widget;
-
-       icon = nautilus_bookmark_get_symbolic_icon (bookmark);
-        widget = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
-       g_object_unref (icon);
-
-       return widget;
-}
-
 /**
  * nautilus_bookmark_menu_item_new:
  * 
@@ -786,24 +773,16 @@ GtkWidget *
 nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark)
 {
        GtkWidget *menu_item;
-       GtkWidget *image_widget;
        GtkLabel *label;
        const char *name;
 
        name = nautilus_bookmark_get_name (bookmark);
-       menu_item = gtk_image_menu_item_new_with_label (name);
+       menu_item = gtk_menu_item_new_with_label (name);
        label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (menu_item)));
        gtk_label_set_use_underline (label, FALSE);
        gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
        gtk_label_set_max_width_chars (label, ELLIPSISED_MENU_ITEM_MIN_CHARS);
 
-       image_widget = create_image_widget_for_bookmark (bookmark);
-       if (image_widget != NULL) {
-               gtk_widget_show (image_widget);
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
-                                              image_widget);
-       }
-
        return menu_item;
 }
 
diff --git a/libnautilus-private/nautilus-clipboard.c b/libnautilus-private/nautilus-clipboard.c
index 1d528e3..feb58de 100644
--- a/libnautilus-private/nautilus-clipboard.c
+++ b/libnautilus-private/nautilus-clipboard.c
@@ -354,16 +354,16 @@ target_data_free (TargetCallbackData *target_data)
 }
 
 static const GtkActionEntry clipboard_entries[] = {
-  /* name, stock id */      { "Cut", GTK_STOCK_CUT,
-  /* label, accelerator */    NULL, NULL,
+  /* name, stock id */      { "Cut", NULL,
+  /* label, accelerator */    N_("Cu_t"), NULL,
   /* tooltip */               N_("Cut the selected text to the clipboard"),
                               G_CALLBACK (action_cut_callback) },
-  /* name, stock id */      { "Copy", GTK_STOCK_COPY,
-  /* label, accelerator */    NULL, NULL,
+  /* name, stock id */      { "Copy", NULL,
+  /* label, accelerator */    N_("_Copy"), NULL,
   /* tooltip */               N_("Copy the selected text to the clipboard"),
                               G_CALLBACK (action_copy_callback) },
-  /* name, stock id */      { "Paste", GTK_STOCK_PASTE,
-  /* label, accelerator */    NULL, NULL,
+  /* name, stock id */      { "Paste", NULL,
+  /* label, accelerator */    N_("_Paste"), NULL,
   /* tooltip */               N_("Paste the text stored on the clipboard"),
                               G_CALLBACK (action_paste_callback) },
   /* name, stock id */      { "Select All", NULL,
diff --git a/libnautilus-private/nautilus-column-chooser.c b/libnautilus-private/nautilus-column-chooser.c
index 984135e..ee4f370 100644
--- a/libnautilus-private/nautilus-column-chooser.c
+++ b/libnautilus-private/nautilus-column-chooser.c
@@ -363,20 +363,6 @@ use_default_clicked_callback (GtkWidget *button, gpointer user_data)
                       signals[USE_DEFAULT], 0);
 }
 
-static GtkWidget *
-button_new_with_mnemonic (const gchar *stockid, const gchar *str)
-{
-       GtkWidget *image;
-       GtkWidget *button;
-       
-       button = gtk_button_new_with_mnemonic (str);
-       image = gtk_image_new_from_stock (stockid, GTK_ICON_SIZE_BUTTON);
-       
-       gtk_button_set_image (GTK_BUTTON (button), image);
-
-       return button;
-}
-
 static void
 add_buttons (NautilusColumnChooser *chooser)
 {
@@ -386,8 +372,7 @@ add_buttons (NautilusColumnChooser *chooser)
        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
        gtk_widget_show (box);
        
-       chooser->details->move_up_button = button_new_with_mnemonic (GTK_STOCK_GO_UP,
-                                                                    _("Move _Up"));
+       chooser->details->move_up_button = gtk_button_new_with_mnemonic (_("Move _Up"));
        g_signal_connect (chooser->details->move_up_button, 
                          "clicked",  G_CALLBACK (move_up_clicked_callback),
                          chooser);
@@ -396,8 +381,7 @@ add_buttons (NautilusColumnChooser *chooser)
        gtk_box_pack_start (GTK_BOX (box), chooser->details->move_up_button,
                            FALSE, FALSE, 0);
 
-       chooser->details->move_down_button = button_new_with_mnemonic (GTK_STOCK_GO_DOWN,
-                                                                      _("Move Dow_n"));
+       chooser->details->move_down_button = gtk_button_new_with_mnemonic (_("Move Dow_n"));
        g_signal_connect (chooser->details->move_down_button, 
                          "clicked",  G_CALLBACK (move_down_clicked_callback),
                          chooser);
diff --git a/libnautilus-private/nautilus-desktop-link-monitor.c 
b/libnautilus-private/nautilus-desktop-link-monitor.c
index 8bc82fb..de1a242 100644
--- a/libnautilus-private/nautilus-desktop-link-monitor.c
+++ b/libnautilus-private/nautilus-desktop-link-monitor.c
@@ -98,7 +98,7 @@ volume_delete_dialog (GtkWidget *parent_view,
                                 dialog_str,
                                 _("If you want to eject the volume, please use Eject in the "
                                   "popup menu of the volume."),
-                                GTK_STOCK_OK, NULL);
+                                _("_OK"), NULL);
                } else {
                        eel_run_simple_dialog
                                (parent_view, 
@@ -107,7 +107,7 @@ volume_delete_dialog (GtkWidget *parent_view,
                                 dialog_str,
                                 _("If you want to unmount the volume, please use Unmount Volume in the "
                                   "popup menu of the volume."),
-                                GTK_STOCK_OK, NULL);
+                                _("_OK"), NULL);
                }
 
                g_object_unref (mount);
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c 
b/libnautilus-private/nautilus-file-conflict-dialog.c
index c20e081..5b68140 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -476,8 +476,8 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
        gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
 
        /* Setup the dialog image */
-       widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
-                                          GTK_ICON_SIZE_DIALOG);
+       widget = gtk_image_new_from_icon_name ("dialog-warning",
+                                              GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
        gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.0);
 
@@ -522,8 +522,8 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
 
        widget = gtk_button_new_with_label (_("Reset"));
        gtk_button_set_image (GTK_BUTTON (widget),
-                             gtk_image_new_from_stock (GTK_STOCK_UNDO,
-                                                       GTK_ICON_SIZE_MENU));
+                             gtk_image_new_from_icon_name ("edit-undo",
+                                                           GTK_ICON_SIZE_MENU));
        gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
        g_signal_connect (widget, "clicked",
                          G_CALLBACK (reset_button_clicked_cb), dialog);
@@ -541,7 +541,7 @@ nautilus_file_conflict_dialog_init (NautilusFileConflictDialog *fcd)
 
        /* Add buttons */
        gtk_dialog_add_buttons (dialog,
-                               GTK_STOCK_CANCEL,
+                               _("_Cancel"),
                                GTK_RESPONSE_CANCEL,
                                _("_Skip"),
                                CONFLICT_RESPONSE_SKIP,
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index d955331..7002d88 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -182,9 +182,11 @@ typedef struct {
 
 #define IS_IO_ERROR(__error, KIND) (((__error)->domain == G_IO_ERROR && (__error)->code == G_IO_ERROR_ ## 
KIND))
 
+#define CANCEL _("_Cancel")
 #define SKIP _("_Skip")
 #define SKIP_ALL _("S_kip All")
 #define RETRY _("_Retry")
+#define DELETE _("_Delete")
 #define DELETE_ALL _("Delete _All")
 #define REPLACE _("_Replace")
 #define REPLACE_ALL _("Replace _All")
@@ -1336,7 +1338,7 @@ confirm_delete_from_trash (CommonJob *job,
                                f (_("If you delete an item, it will be permanently lost.")),
                                NULL,
                                FALSE,
-                               GTK_STOCK_CANCEL, GTK_STOCK_DELETE,
+                               CANCEL, DELETE,
                                NULL);
        
        return (response == 1);
@@ -1360,7 +1362,7 @@ confirm_empty_trash (CommonJob *job)
                                f(_("All items in the Trash will be permanently deleted.")),
                                NULL,
                                FALSE,
-                               GTK_STOCK_CANCEL, _("Empty _Trash"),
+                               CANCEL, _("Empty _Trash"),
                                NULL);
 
        return (response == 1);
@@ -1402,7 +1404,7 @@ confirm_delete_directly (CommonJob *job,
                                f (_("If you delete an item, it will be permanently lost.")),
                                NULL,
                                FALSE,
-                               GTK_STOCK_CANCEL, GTK_STOCK_DELETE,
+                               CANCEL, DELETE,
                                NULL);
 
        return response == 1;
@@ -1536,7 +1538,7 @@ delete_dir (CommonJob *job, GFile *dir,
                                                secondary,
                                                details,
                                                FALSE,
-                                               GTK_STOCK_CANCEL, _("_Skip files"),
+                                               CANCEL, _("_Skip files"),
                                                NULL);
                        
                        g_error_free (error);
@@ -1569,7 +1571,7 @@ delete_dir (CommonJob *job, GFile *dir,
                                        secondary,
                                        details,
                                        FALSE,
-                                       GTK_STOCK_CANCEL, SKIP, RETRY,
+                                       CANCEL, SKIP, RETRY,
                                        NULL);
 
                g_error_free (error);
@@ -1602,7 +1604,7 @@ delete_dir (CommonJob *job, GFile *dir,
                                                secondary,
                                                details,
                                                (source_info->num_files - transfer_info->num_files) > 1,
-                                               GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                               CANCEL, SKIP_ALL, SKIP,
                                                NULL);
                        
                        if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -1679,7 +1681,7 @@ delete_file (CommonJob *job, GFile *file,
                                        secondary,
                                        details,
                                        (source_info->num_files - transfer_info->num_files) > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -1819,7 +1821,7 @@ trash_files (CommonJob *job, GList *files, int *files_skipped)
                                                 secondary,
                                                 details,
                                                 (total_files - files_trashed) > 1,
-                                                GTK_STOCK_CANCEL, SKIP_ALL, SKIP, DELETE_ALL, 
GTK_STOCK_DELETE,
+                                                CANCEL, SKIP_ALL, SKIP, DELETE_ALL, DELETE,
                                                 NULL);
 
                        if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -2237,7 +2239,7 @@ prompt_empty_trash (GtkWindow *parent_window)
                                                    "will be permanently lost."));
        gtk_dialog_add_buttons (GTK_DIALOG (dialog), 
                                _("Do _not Empty Trash"), GTK_RESPONSE_REJECT, 
-                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 
+                               CANCEL, GTK_RESPONSE_CANCEL, 
                                _("Empty _Trash"), GTK_RESPONSE_ACCEPT, NULL);
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
        gtk_window_set_title (GTK_WINDOW (dialog), ""); /* as per HIG */
@@ -2566,7 +2568,7 @@ scan_dir (GFile *dir,
                                                secondary,
                                                details,
                                                FALSE,
-                                               GTK_STOCK_CANCEL, RETRY, SKIP,
+                                               CANCEL, RETRY, SKIP,
                                                NULL);
 
                        g_error_free (error);
@@ -2607,7 +2609,7 @@ scan_dir (GFile *dir,
                                        secondary,
                                        details,
                                        TRUE,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP, RETRY,
+                                       CANCEL, SKIP_ALL, SKIP, RETRY,
                                        NULL);
                
                g_error_free (error);
@@ -2684,7 +2686,7 @@ scan_file (GFile *file,
                                        secondary,
                                        details,
                                        TRUE,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP, RETRY,
+                                       CANCEL, SKIP_ALL, SKIP, RETRY,
                                        NULL);
                
                g_error_free (error);
@@ -2790,7 +2792,7 @@ verify_destination (CommonJob *job,
                                      secondary,
                                      details,
                                      FALSE,
-                                     GTK_STOCK_CANCEL, RETRY,
+                                     CANCEL, RETRY,
                                      NULL);
                
                g_error_free (error);
@@ -2831,7 +2833,7 @@ verify_destination (CommonJob *job,
                           secondary,
                           NULL,
                           FALSE,
-                          GTK_STOCK_CANCEL,
+                          CANCEL,
                           NULL);
                
                abort_job (job);
@@ -2872,7 +2874,7 @@ verify_destination (CommonJob *job,
                                                secondary,
                                                details,
                                                FALSE,
-                                               GTK_STOCK_CANCEL,
+                                               CANCEL,
                                                COPY_FORCE,
                                                RETRY,
                                                NULL);
@@ -2900,7 +2902,7 @@ verify_destination (CommonJob *job,
                           secondary,
                           NULL,
                           FALSE,
-                          GTK_STOCK_CANCEL,
+                          CANCEL,
                           NULL);
                
                g_error_free (error);
@@ -3443,7 +3445,7 @@ create_dest_dir (CommonJob *job,
                                        secondary,
                                        details,
                                        FALSE,
-                                       GTK_STOCK_CANCEL, SKIP, RETRY,
+                                       CANCEL, SKIP, RETRY,
                                        NULL);
 
                g_error_free (error);
@@ -3576,7 +3578,7 @@ copy_move_directory (CopyMoveJob *copy_job,
                                                secondary,
                                                details,
                                                FALSE,
-                                               GTK_STOCK_CANCEL, _("_Skip files"),
+                                               CANCEL, _("_Skip files"),
                                                NULL);
                        
                        g_error_free (error);
@@ -3621,7 +3623,7 @@ copy_move_directory (CopyMoveJob *copy_job,
                                        secondary,
                                        details,
                                        FALSE,
-                                       GTK_STOCK_CANCEL, SKIP, RETRY,
+                                       CANCEL, SKIP, RETRY,
                                        NULL);
 
                g_error_free (error);
@@ -3663,7 +3665,7 @@ copy_move_directory (CopyMoveJob *copy_job,
                                                secondary,
                                                details,
                                                (source_info->num_files - transfer_info->num_files) > 1,
-                                               GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                               CANCEL, SKIP_ALL, SKIP,
                                                NULL);
                        
                        if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -3752,7 +3754,7 @@ remove_target_recursively (CommonJob *job,
                                        secondary,
                                        details,
                                        TRUE,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
                
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -3793,7 +3795,7 @@ remove_target_recursively (CommonJob *job,
                                        secondary,
                                        details,
                                        TRUE,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
                
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4111,7 +4113,7 @@ copy_move_file (CopyMoveJob *copy_job,
                                        secondary,
                                        NULL,
                                        (source_info->num_files - transfer_info->num_files) > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4144,7 +4146,7 @@ copy_move_file (CopyMoveJob *copy_job,
                                        secondary,
                                        NULL,
                                        (source_info->num_files - transfer_info->num_files) > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4362,7 +4364,7 @@ copy_move_file (CopyMoveJob *copy_job,
                                                        secondary,
                                                        details,
                                                        TRUE,
-                                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                                       CANCEL, SKIP_ALL, SKIP,
                                                        NULL);
                                
                                g_error_free (error);
@@ -4429,7 +4431,7 @@ copy_move_file (CopyMoveJob *copy_job,
                                        secondary,
                                        details,
                                        (source_info->num_files - transfer_info->num_files) > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                g_error_free (error);
@@ -4814,7 +4816,7 @@ move_file_prepare (CopyMoveJob *move_job,
                                        secondary,
                                        NULL,
                                        files_left > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
                
                if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4971,7 +4973,7 @@ move_file_prepare (CopyMoveJob *move_job,
                                        secondary,
                                        details,
                                        files_left > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                g_error_free (error);
@@ -5416,7 +5418,7 @@ link_file (CopyMoveJob *job,
                                        secondary,
                                        details,
                                        files_left > 1,
-                                       GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+                                       CANCEL, SKIP_ALL, SKIP,
                                        NULL);
 
                if (error) {
@@ -6193,7 +6195,7 @@ create_job (GIOSchedulerJob *io_job,
                                                secondary,
                                                details,
                                                FALSE,
-                                               GTK_STOCK_CANCEL, SKIP,
+                                               CANCEL, SKIP,
                                                NULL);
                        
                        g_error_free (error);
@@ -6506,7 +6508,7 @@ mark_desktop_file_trusted (CommonJob *common,
                                              error->message,
                                              NULL,
                                              FALSE,
-                                             GTK_STOCK_CANCEL, RETRY,
+                                             CANCEL, RETRY,
                                              NULL);
                } else {
                        response = 0;
@@ -6547,7 +6549,7 @@ mark_desktop_file_trusted (CommonJob *common,
                                                      error->message,
                                                      NULL,
                                                      FALSE,
-                                                     GTK_STOCK_CANCEL, RETRY,
+                                                     CANCEL, RETRY,
                                                      NULL);
                        } else {
                                response = 0;
@@ -6582,7 +6584,7 @@ mark_desktop_file_trusted (CommonJob *common,
                                              error->message,
                                              NULL,
                                              FALSE,
-                                             GTK_STOCK_CANCEL, RETRY,
+                                             CANCEL, RETRY,
                                              NULL);
                } else {
                        response = 0;
@@ -6617,7 +6619,7 @@ mark_desktop_file_trusted (CommonJob *common,
                                                              error->message,
                                                              NULL,
                                                              FALSE,
-                                                             GTK_STOCK_CANCEL, RETRY,
+                                                             CANCEL, RETRY,
                                                              NULL);
                                } else {
                                        response = 0;
diff --git a/libnautilus-private/nautilus-mime-application-chooser.c 
b/libnautilus-private/nautilus-mime-application-chooser.c
index 541f3e3..0200e13 100644
--- a/libnautilus-private/nautilus-mime-application-chooser.c
+++ b/libnautilus-private/nautilus-mime-application-chooser.c
@@ -322,7 +322,7 @@ nautilus_mime_application_chooser_build_ui (NautilusMimeApplicationChooser *choo
        gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
        gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (box), button, TRUE);
 
-       button = gtk_button_new_from_stock (GTK_STOCK_ADD);
+       button = gtk_button_new_with_mnemonic (_("_Add"));
        g_signal_connect (button, "clicked", 
                          G_CALLBACK (add_clicked_cb),
                          chooser);


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