[virt-tools-list] [PATCH] Don't use deprecated (since gtk 3.10) STOCK items

Christophe Fergeau cfergeau at redhat.com
Mon Oct 6 12:44:09 UTC 2014


Hey,

A bit torn on that one as this means suddenly parts of the UI will
become untranslated. I don't know how active/up to date virt-viewer
translations are?

Christophe

On Mon, Oct 06, 2014 at 01:58:28PM +0200, Fabiano Fidêncio wrote:
> ---
>  src/remote-viewer.c               |  4 ++--
>  src/virt-viewer-auth.xml          |  8 ++++----
>  src/virt-viewer-guest-details.xml |  4 ++--
>  src/virt-viewer-session-spice.c   |  2 +-
>  src/virt-viewer-window.c          | 10 ++++++----
>  src/virt-viewer.xml               | 15 +++++----------
>  6 files changed, 20 insertions(+), 23 deletions(-)
> 
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index 164067d..9e110f6 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -1031,9 +1031,9 @@ connect_dialog(gchar **uri)
>      dialog = gtk_dialog_new_with_buttons(_("Connection details"),
>                                           NULL,
>                                           GTK_DIALOG_DESTROY_WITH_PARENT,
> -                                         GTK_STOCK_CANCEL,
> +                                         _("_Cancel"),
>                                           GTK_RESPONSE_REJECT,
> -                                         GTK_STOCK_CONNECT,
> +                                         _("C_onnect"),
>                                           GTK_RESPONSE_ACCEPT,
>                                           NULL);
>      gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
> diff --git a/src/virt-viewer-auth.xml b/src/virt-viewer-auth.xml
> index d307754..2920780 100644
> --- a/src/virt-viewer-auth.xml
> +++ b/src/virt-viewer-auth.xml
> @@ -24,12 +24,12 @@
>              <property name="layout_style">end</property>
>              <child>
>                <object class="GtkButton" id="button-cancel">
> -                <property name="label">gtk-cancel</property>
> +                <property name="label" translatable="yes">_Cancel</property>
>                  <property name="visible">True</property>
>                  <property name="can_focus">True</property>
>                  <property name="receives_default">True</property>
>                  <property name="use_action_appearance">False</property>
> -                <property name="use_stock">True</property>
> +                <property name="use_underline">True</property>
>                </object>
>                <packing>
>                  <property name="expand">False</property>
> @@ -39,14 +39,14 @@
>              </child>
>              <child>
>                <object class="GtkButton" id="button-ok">
> -                <property name="label">gtk-ok</property>
> +                <property name="label" translatable="yes">_OK</property>
>                  <property name="visible">True</property>
>                  <property name="can_focus">True</property>
>                  <property name="can_default">True</property>
>                  <property name="has_default">True</property>
>                  <property name="receives_default">True</property>
>                  <property name="use_action_appearance">False</property>
> -                <property name="use_stock">True</property>
> +                <property name="use_underline">True</property>
>                </object>
>                <packing>
>                  <property name="expand">False</property>
> diff --git a/src/virt-viewer-guest-details.xml b/src/virt-viewer-guest-details.xml
> index 7f00567..209272f 100644
> --- a/src/virt-viewer-guest-details.xml
> +++ b/src/virt-viewer-guest-details.xml
> @@ -20,11 +20,11 @@
>              <property name="layout_style">end</property>
>              <child>
>                <object class="GtkButton" id="button1">
> -                <property name="label">gtk-close</property>
> +                <property name="label" translatable="yes">_Close</property>
>                  <property name="visible">True</property>
>                  <property name="can_focus">True</property>
>                  <property name="receives_default">True</property>
> -                <property name="use_stock">True</property>
> +                <property name="use_underline">True</property>
>                </object>
>                <packing>
>                  <property name="expand">False</property>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index 1d05140..17f39c7 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -628,7 +628,7 @@ virt_viewer_session_spice_usb_device_selection(VirtViewerSession *session,
>      /* Create the widgets */
>      dialog = gtk_dialog_new_with_buttons(_("Select USB devices for redirection"), parent,
>                                           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);
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 64cf865..a05b2f3 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -973,8 +973,8 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu G_GNUC_UNUSED,
>      dialog = gtk_file_chooser_dialog_new("Save screenshot",
>                                           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);
>      gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER (dialog), TRUE);
>      gtk_window_set_transient_for(GTK_WINDOW(dialog),
> @@ -1103,7 +1103,8 @@ virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
>      gtk_toolbar_set_style(GTK_TOOLBAR(priv->toolbar), GTK_TOOLBAR_BOTH_HORIZ);
>  
>      /* Close connection */
> -    button = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE));
> +    button = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
> +    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(button), "window-closed");
>      gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), _("Disconnect"));
>      gtk_widget_show(GTK_WIDGET(button));
>      gtk_toolbar_insert(GTK_TOOLBAR(priv->toolbar), GTK_TOOL_ITEM (button), 0);
> @@ -1131,7 +1132,8 @@ virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
>      priv->toolbar_send_key = button;
>  
>      /* Leave fullscreen */
> -    button = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_LEAVE_FULLSCREEN));
> +    button = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
> +    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(button), "view-restore");
>      gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), _("Leave fullscreen"));
>      gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), _("Leave fullscreen"));
>      gtk_tool_item_set_is_important(GTK_TOOL_ITEM(button), TRUE);
> diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
> index 849fc7d..b955452 100644
> --- a/src/virt-viewer.xml
> +++ b/src/virt-viewer.xml
> @@ -76,12 +76,11 @@
>                      </child>
>                      <child>
>                        <object class="GtkImageMenuItem" id="imagemenuitem5">
> -                        <property name="label">gtk-quit</property>
> +                        <property name="label" translatable="yes">_Quit</property>
>                          <property name="visible">True</property>
>                          <property name="can_focus">False</property>
>                          <property name="use_action_appearance">False</property>
>                          <property name="use_underline">True</property>
> -                        <property name="use_stock">True</property>
>                          <accelerator key="q" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
>                          <signal name="activate" handler="virt_viewer_window_menu_file_quit" swapped="no"/>
>                        </object>
> @@ -128,24 +127,22 @@
>                              <child>
>                                <object class="GtkImageMenuItem" id="menu-view-zoom-in">
>                                  <property name="accel_path"><virt-viewer>/view/zoom-in</property>
> -                                <property name="label">gtk-zoom-in</property>
> +                                <property name="label" translatable="yes">Zoom _In</property>
>                                  <property name="visible">True</property>
>                                  <property name="can_focus">False</property>
>                                  <property name="use_action_appearance">False</property>
>                                  <property name="use_underline">True</property>
> -                                <property name="use_stock">True</property>
>                                  <signal name="activate" handler="virt_viewer_window_menu_view_zoom_in" swapped="no"/>
>                                </object>
>                              </child>
>                              <child>
>                                <object class="GtkImageMenuItem" id="menu-view-zoom-out">
>                                  <property name="accel_path"><virt-viewer>/view/zoom-out</property>
> -                                <property name="label">gtk-zoom-out</property>
> +                                <property name="label" translatable="yes">Zoom _Out</property>
>                                  <property name="visible">True</property>
>                                  <property name="can_focus">False</property>
>                                  <property name="use_action_appearance">False</property>
>                                  <property name="use_underline">True</property>
> -                                <property name="use_stock">True</property>
>                                  <signal name="activate" handler="virt_viewer_window_menu_view_zoom_out" swapped="no"/>
>                                </object>
>                              </child>
> @@ -158,12 +155,11 @@
>                              <child>
>                                <object class="GtkImageMenuItem" id="menu-view-zoom-reset">
>                                  <property name="accel_path"><virt-viewer>/view/zoom-reset</property>
> -                                <property name="label">gtk-zoom-100</property>
> +                                <property name="label" translatable="yes">_Normal Size</property>
>                                  <property name="visible">True</property>
>                                  <property name="can_focus">False</property>
>                                  <property name="use_action_appearance">False</property>
>                                  <property name="use_underline">True</property>
> -                                <property name="use_stock">True</property>
>                                  <signal name="activate" handler="virt_viewer_window_menu_view_zoom_reset" swapped="no"/>
>                                </object>
>                              </child>
> @@ -226,12 +222,11 @@
>                      </child>
>                      <child>
>                        <object class="GtkImageMenuItem" id="imagemenuitem10">
> -                        <property name="label">gtk-about</property>
> +                        <property name="label" translatable="yes">_About</property>
>                          <property name="visible">True</property>
>                          <property name="can_focus">False</property>
>                          <property name="use_action_appearance">False</property>
>                          <property name="use_underline">True</property>
> -                        <property name="use_stock">True</property>
>                          <signal name="activate" handler="virt_viewer_window_menu_help_about" swapped="no"/>
>                        </object>
>                      </child>
> -- 
> 2.1.0
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20141006/848a812b/attachment.sig>


More information about the virt-tools-list mailing list