[virt-tools-list] [PATCH virt-viewer 3/3] Make zoom-reset a global key binding

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jul 23 14:31:39 UTC 2013


---
 src/virt-gtk-compat.h    | 1 +
 src/virt-viewer-app.c    | 1 +
 src/virt-viewer-window.c | 2 ++
 src/virt-viewer.xml      | 3 ++-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/virt-gtk-compat.h b/src/virt-gtk-compat.h
index 954c322..81d2fbd 100644
--- a/src/virt-gtk-compat.h
+++ b/src/virt-gtk-compat.h
@@ -53,6 +53,7 @@ G_BEGIN_DECLS
 #define GDK_F10 GDK_KEY_F10
 #define GDK_F11 GDK_KEY_F11
 #define GDK_F12 GDK_KEY_F12
+#define GDK_0 GDK_KEY_0
 #endif
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 9692f2c..6c77ef3 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1474,6 +1474,7 @@ virt_viewer_app_constructor (GType gtype,
     gtk_accel_map_add_entry("<virt-viewer>/file/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);
+    gtk_accel_map_add_entry("<virt-viewer>/view/zoom-reset", GDK_0, GDK_CONTROL_MASK);
 
     return obj;
 }
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 38a0611..d3baeba 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -317,6 +317,8 @@ virt_viewer_window_init (VirtViewerWindow *self)
                      "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);
+    g_signal_connect(gtk_builder_get_object(priv->builder, "menu-view-zoom-reset"),
+                     "can-activate-accel", G_CALLBACK(can_activate_cb), self);
 
     vbox = GTK_WIDGET(gtk_builder_get_object(priv->builder, "viewer-box"));
     virt_viewer_window_toolbar_setup(self);
diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
index ca5d136..e9f91f7 100644
--- a/src/virt-viewer.xml
+++ b/src/virt-viewer.xml
@@ -124,6 +124,7 @@
                           <object class="GtkMenu" id="menu4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="accel_group">accelgroup</property>
                             <child>
                               <object class="GtkImageMenuItem" id="menu-view-zoom-in">
                                 <property name="label">gtk-zoom-in</property>
@@ -156,13 +157,13 @@
                             </child>
                             <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="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="0" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                 <signal name="activate" handler="virt_viewer_window_menu_view_zoom_reset" swapped="no"/>
                               </object>
                             </child>
-- 
1.8.3.rc1.49.g8d97506




More information about the virt-tools-list mailing list