[Spice-devel] [PATCH spice-gtk] Do not use deprecated GtkStock

Victor Toso lists at victortoso.com
Mon May 2 07:41:50 UTC 2016


On Thu, Apr 07, 2016 at 01:03:51PM +0200, Pavel Grunt wrote:
> Use labels or named icons
>
> Deprecated since Gtk 3.10

Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  src/spicy.c             | 23 +++++++++++------------
>  src/usb-device-widget.c | 12 ++++++------
>  2 files changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/src/spicy.c b/src/spicy.c
> index ca9db84..0475530 100644
> --- a/src/spicy.c
> +++ b/src/spicy.c
> @@ -143,9 +143,9 @@ static int ask_user(GtkWidget *parent, char *title, char *message,
>      dialog = gtk_dialog_new_with_buttons(title,
>                                           parent ? GTK_WINDOW(parent) : NULL,
>                                           GTK_DIALOG_DESTROY_WITH_PARENT,
> -                                         GTK_STOCK_OK,
> +                                         "_OK",
>                                           GTK_RESPONSE_ACCEPT,
> -                                         GTK_STOCK_CANCEL,
> +                                         "_Cancel",
>                                           GTK_RESPONSE_REJECT,
>                                           NULL);
>      gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
> @@ -370,7 +370,7 @@ static void menu_cb_select_usb_devices(GtkAction *action, void *data)
>                      "Select USB devices for redirection",
>                      GTK_WINDOW(win->toplevel),
>                      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
> -                    GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
> +                    "_Close", GTK_RESPONSE_ACCEPT,
>                      NULL);
>      gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
>      gtk_container_set_border_width(GTK_CONTAINER(dialog), 12);
> @@ -462,7 +462,7 @@ static void menu_cb_about(GtkAction *action, void *data)
>                            "authors",         authors,
>                            "comments",        comments,
>                            "copyright",       copyright,
> -                          "logo-icon-name",  GTK_STOCK_ABOUT,
> +                          "logo-icon-name",  "help-about",
>                            "website",         website,
>                            "version",         PACKAGE_VERSION,
>                            "license",         "LGPLv2.1",
> @@ -640,12 +640,12 @@ static const GtkActionEntry entries[] = {
>  
>          /* File menu */
>          .name        = "Connect",
> -        .stock_id    = GTK_STOCK_CONNECT,
> +        .stock_id    = "_Connect",
>          .label       = "_Connect ...",
>          .callback    = G_CALLBACK(menu_cb_connect),
>      },{
>          .name        = "Close",
> -        .stock_id    = GTK_STOCK_CLOSE,
> +        .stock_id    = "window-close",
>          .label       = "_Close",
>          .callback    = G_CALLBACK(menu_cb_close),
>          .accelerator = "", /* none (disable default "<control>W") */
> @@ -653,13 +653,13 @@ static const GtkActionEntry entries[] = {
>  
>          /* Edit menu */
>          .name        = "CopyToGuest",
> -        .stock_id    = GTK_STOCK_COPY,
> +        .stock_id    = "edit-copy",
>          .label       = "_Copy to guest",
>          .callback    = G_CALLBACK(menu_cb_copy),
>          .accelerator = "", /* none (disable default "<control>C") */
>      },{
>          .name        = "PasteFromGuest",
> -        .stock_id    = GTK_STOCK_PASTE,
> +        .stock_id    = "edit-paste",
>          .label       = "_Paste from guest",
>          .callback    = G_CALLBACK(menu_cb_paste),
>          .accelerator = "", /* none (disable default "<control>V") */
> @@ -667,7 +667,7 @@ static const GtkActionEntry entries[] = {
>  
>          /* View menu */
>          .name        = "Fullscreen",
> -        .stock_id    = GTK_STOCK_FULLSCREEN,
> +        .stock_id    = "view-fullscreen",
>          .label       = "_Fullscreen",
>          .callback    = G_CALLBACK(menu_cb_fullscreen),
>          .accelerator = "<shift>F11",
> @@ -695,7 +695,7 @@ static const GtkActionEntry entries[] = {
>  
>          /* Help menu */
>          .name        = "About",
> -        .stock_id    = GTK_STOCK_ABOUT,
> +        .stock_id    = "help-about",
>          .label       = "_About ...",
>          .callback    = G_CALLBACK(menu_cb_about),
>      }
> @@ -1486,8 +1486,7 @@ TransferTaskWidgets *transfer_task_widgets_new(SpiceFileTransferTask *task)
>  
>      widgets->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
>      widgets->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
> -    widgets->cancel = gtk_button_new_from_icon_name(GTK_STOCK_CANCEL,
> -                                                    GTK_ICON_SIZE_SMALL_TOOLBAR);
> +    widgets->cancel = gtk_button_new_with_label("_Cancel");
>  
>      widgets->progress = gtk_progress_bar_new();
>      widgets->label = gtk_label_new(spice_file_transfer_task_get_filename(task));
> diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
> index d3ea79a..05c7054 100644
> --- a/src/usb-device-widget.c
> +++ b/src/usb-device-widget.c
> @@ -166,8 +166,8 @@ spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget *self,
>      hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
>      gtk_container_add(GTK_CONTAINER(content_area), hbox);
>  
> -    widget = gtk_image_new_from_stock(stock_icon_id,
> -                                      GTK_ICON_SIZE_SMALL_TOOLBAR);
> +    widget = gtk_image_new_from_icon_name(stock_icon_id,
> +                                          GTK_ICON_SIZE_SMALL_TOOLBAR);
>      gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
>  
>      widget = gtk_label_new(message);
> @@ -214,7 +214,7 @@ static GObject *spice_usb_device_widget_constructor(
>      if (err) {
>          spice_usb_device_widget_show_info_bar(self, err->message,
>                                                GTK_MESSAGE_WARNING,
> -                                              GTK_STOCK_DIALOG_WARNING);
> +                                              "dialog-warning");
>          g_clear_error(&err);
>          return obj;
>      }
> @@ -432,13 +432,13 @@ static gboolean spice_usb_device_widget_update_status(gpointer user_data)
>      if (priv->err_msg) {
>          spice_usb_device_widget_show_info_bar(self, priv->err_msg,
>                                                GTK_MESSAGE_INFO,
> -                                              GTK_STOCK_DIALOG_WARNING);
> +                                              "dialog-warning");
>          g_free(priv->err_msg);
>          priv->err_msg = NULL;
>      } else if (redirecting) {
>          spice_usb_device_widget_show_info_bar(self, _("Redirecting USB Device..."),
>                                                GTK_MESSAGE_INFO,
> -                                              GTK_STOCK_DIALOG_INFO);
> +                                              "dialog-information");
>      } else {
>          spice_usb_device_widget_hide_info_bar(self);
>      }
> @@ -446,7 +446,7 @@ static gboolean spice_usb_device_widget_update_status(gpointer user_data)
>      if (priv->device_count == 0)
>          spice_usb_device_widget_show_info_bar(self, _("No USB devices detected"),
>                                                GTK_MESSAGE_INFO,
> -                                              GTK_STOCK_DIALOG_INFO);
> +                                              "dialog-information");
>      return FALSE;
>  }
>  
> -- 
> 2.8.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list