[virt-tools-list] [virt-viewer][PATCH 2/6] Move File menu subitems to the more appropriate Actions menu.

lagarcia at linux.vnet.ibm.com lagarcia at linux.vnet.ibm.com
Fri Jan 18 17:27:34 UTC 2013


From: Leonardo Garcia <lagarcia at br.ibm.com>

Move the following File menu subitems:
 - USB device selection
 - Smartcard insertion
 - Smartcard removal

to the new Actions menu.
---
 src/virt-viewer-app.c    |    4 +-
 src/virt-viewer-window.c |   20 +++++++-------
 src/virt-viewer.xml      |   60 ++++++++++++++++++++++-----------------------
 3 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 6b3ad6d..9849908 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1349,8 +1349,8 @@ virt_viewer_app_constructor (GType gtype,
     priv->main_window = virt_viewer_app_window_new(self, priv->container, 0);
     priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(priv->main_window));
 
-    gtk_accel_map_add_entry("<virt-viewer>/file/smartcard-insert", GDK_F8, GDK_SHIFT_MASK);
-    gtk_accel_map_add_entry("<virt-viewer>/file/smartcard-remove", GDK_F9, GDK_SHIFT_MASK);
+    gtk_accel_map_add_entry("<virt-viewer>/actions/smartcard-insert", GDK_F8, GDK_SHIFT_MASK);
+    gtk_accel_map_add_entry("<virt-viewer>/actions/smartcard-remove", GDK_F9, GDK_SHIFT_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/view/fullscreen", GDK_F11, 0);
     gtk_accel_map_add_entry("<virt-viewer>/view/release-cursor", GDK_F12, GDK_SHIFT_MASK);
 
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 6adba8e..e9982a4 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -53,9 +53,9 @@ void virt_viewer_window_menu_view_fullscreen(GtkWidget *menu, VirtViewerWindow *
 void virt_viewer_window_menu_view_resize(GtkWidget *menu, VirtViewerWindow *self);
 void virt_viewer_window_menu_send(GtkWidget *menu, VirtViewerWindow *self);
 void virt_viewer_window_menu_file_screenshot(GtkWidget *menu, VirtViewerWindow *self);
-void virt_viewer_window_menu_file_usb_device_selection(GtkWidget *menu, VirtViewerWindow *self);
-void virt_viewer_window_menu_file_smartcard_insert(GtkWidget *menu, VirtViewerWindow *self);
-void virt_viewer_window_menu_file_smartcard_remove(GtkWidget *menu, VirtViewerWindow *self);
+void virt_viewer_window_menu_actions_usb_device_selection(GtkWidget *menu, VirtViewerWindow *self);
+void virt_viewer_window_menu_actions_smartcard_insert(GtkWidget *menu, VirtViewerWindow *self);
+void virt_viewer_window_menu_actions_smartcard_remove(GtkWidget *menu, VirtViewerWindow *self);
 void virt_viewer_window_menu_view_release_cursor(GtkWidget *menu, VirtViewerWindow *self);
 
 /* Internal methods */
@@ -305,9 +305,9 @@ virt_viewer_window_init (VirtViewerWindow *self)
     /* make sure they can be activated even if the menu item is not visible */
     g_signal_connect(gtk_builder_get_object(priv->builder, "menu-view-fullscreen"),
                      "can-activate-accel", G_CALLBACK(can_activate_cb), self);
-    g_signal_connect(gtk_builder_get_object(priv->builder, "menu-file-smartcard-insert"),
+    g_signal_connect(gtk_builder_get_object(priv->builder, "menu-actions-smartcard-insert"),
                      "can-activate-accel", G_CALLBACK(can_activate_cb), self);
-    g_signal_connect(gtk_builder_get_object(priv->builder, "menu-file-smartcard-remove"),
+    g_signal_connect(gtk_builder_get_object(priv->builder, "menu-actions-smartcard-remove"),
                      "can-activate-accel", G_CALLBACK(can_activate_cb), self);
     g_signal_connect(gtk_builder_get_object(priv->builder, "menu-view-release-cursor"),
                      "can-activate-accel", G_CALLBACK(can_activate_cb), self);
@@ -857,7 +857,7 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu G_GNUC_UNUSED,
 }
 
 G_MODULE_EXPORT void
-virt_viewer_window_menu_file_usb_device_selection(GtkWidget *menu G_GNUC_UNUSED,
+virt_viewer_window_menu_actions_usb_device_selection(GtkWidget *menu G_GNUC_UNUSED,
                                                   VirtViewerWindow *self)
 {
     virt_viewer_session_usb_device_selection(virt_viewer_app_get_session(self->priv->app),
@@ -865,14 +865,14 @@ virt_viewer_window_menu_file_usb_device_selection(GtkWidget *menu G_GNUC_UNUSED,
 }
 
 G_MODULE_EXPORT void
-virt_viewer_window_menu_file_smartcard_insert(GtkWidget *menu G_GNUC_UNUSED,
+virt_viewer_window_menu_actions_smartcard_insert(GtkWidget *menu G_GNUC_UNUSED,
                                               VirtViewerWindow *self)
 {
     virt_viewer_session_smartcard_insert(virt_viewer_app_get_session(self->priv->app));
 }
 
 G_MODULE_EXPORT void
-virt_viewer_window_menu_file_smartcard_remove(GtkWidget *menu G_GNUC_UNUSED,
+virt_viewer_window_menu_actions_smartcard_remove(GtkWidget *menu G_GNUC_UNUSED,
                                               VirtViewerWindow *self)
 {
     virt_viewer_session_smartcard_remove(virt_viewer_app_get_session(self->priv->app));
@@ -928,7 +928,7 @@ virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
     gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), _("USB device selection"));
     gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), _("USB device selection"));
     gtk_toolbar_insert(GTK_TOOLBAR(priv->toolbar), GTK_TOOL_ITEM(button), 0);
-    g_signal_connect(button, "clicked", G_CALLBACK(virt_viewer_window_menu_file_usb_device_selection), self);
+    g_signal_connect(button, "clicked", G_CALLBACK(virt_viewer_window_menu_actions_usb_device_selection), self);
     priv->toolbar_usb_device_selection = button;
 
     /* Send key */
@@ -1060,7 +1060,7 @@ virt_viewer_window_set_usb_options_sensitive(VirtViewerWindow *self, gboolean se
     g_return_if_fail(VIRT_VIEWER_IS_WINDOW(self));
 
     priv = self->priv;
-    menu = GTK_WIDGET(gtk_builder_get_object(priv->builder, "menu-file-usb-device-selection"));
+    menu = GTK_WIDGET(gtk_builder_get_object(priv->builder, "menu-actions-usb-device-selection"));
     gtk_widget_set_sensitive(menu, sensitive);
     gtk_widget_set_visible(priv->toolbar_usb_device_selection, sensitive);
 }
diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
index 851d3fc..42f58f0 100644
--- a/src/virt-viewer.xml
+++ b/src/virt-viewer.xml
@@ -38,37 +38,6 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkMenuItem" id="menu-file-usb-device-selection">
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes">USB device selection</property>
-                        <property name="use_underline">True</property>
-                        <signal name="activate" handler="virt_viewer_window_menu_file_usb_device_selection" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menu-file-smartcard-insert">
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="accel_path"><virt-viewer>/file/smartcard-insert</property>
-                        <property name="label" translatable="yes">Smartcard insertion</property>
-                        <property name="use_underline">True</property>
-                        <signal name="activate" handler="virt_viewer_window_menu_file_smartcard_insert" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menu-file-smartcard-remove">
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="accel_path"><virt-viewer>/file/smartcard-remove</property>
-                        <property name="label" translatable="yes">Smartcard removal</property>
-                        <property name="use_underline">True</property>
-                        <signal name="activate" handler="virt_viewer_window_menu_file_smartcard_remove" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
                       <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -103,6 +72,35 @@
                     <property name="can_focus">False</property>
                     <property name="accel_group">accelgroup</property>
                     <child>
+                      <object class="GtkMenuItem" id="menu-actions-usb-device-selection">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="label" translatable="yes">USB device selection</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="virt_viewer_window_menu_actions_usb_device_selection" swapped="no"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuItem" id="menu-actions-smartcard-insert">
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="accel_path"><virt-viewer>/actions/smartcard-insert</property>
+                        <property name="label" translatable="yes">Smartcard insertion</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="virt_viewer_window_menu_actions_smartcard_insert" swapped="no"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuItem" id="menu-actions-smartcard-remove">
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="accel_path"><virt-viewer>/actions/smartcard-remove</property>
+                        <property name="label" translatable="yes">Smartcard removal</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="virt_viewer_window_menu_actions_smartcard_remove" swapped="no"/>
+                      </object>
                     </child>
                   </object>
                 </child>
-- 
1.7.1




More information about the virt-tools-list mailing list