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

Re: [virt-tools-list] [PATCH virt-viewer 0/9] Add customizable key bindings



On Wed, Feb 15, 2012 at 1:42 AM, Marc-André Lureau
<marcandre lureau gmail com> wrote:
> On Wed, Feb 15, 2012 at 1:29 AM, Marc-André Lureau
> <marcandre lureau gmail com> wrote:
>> Gtk+ requirement bump to 2.16 is supported by RHEL5
>> (needed for various accelgroup code).
>
> That's actually incorrect. I knew I had to double check that.

I worked on a patch to support < gtk 2.14 for the part I added, and I
figured we actually use symbols from 2.18:

virt-viewer-app.c: In function 'count_window_visible':
virt-viewer-app.c:220: warning: implicit declaration of function
'gtk_widget_get_visible'
virt-viewer-app.c:220: warning: nested extern declaration of
'gtk_widget_get_visible'
virt-viewer-app.c: In function 'virt_viewer_app_bell':
virt-viewer-app.c:888: warning: implicit declaration of function
'gtk_widget_get_window'
virt-viewer-app.c:888: warning: nested extern declaration of
'gtk_widget_get_window'
virt-viewer-app.c:888: warning: passing argument 1 of
'gdk_window_beep' makes pointer from integer without a cast


Should we just bump gtk deps to 2.18?

Then the patch series can be reviewed in its current form.

regards

-- 
Marc-André Lureau
From d45face2925e8d9b6147405b163b70bf6f331f8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre lureau gmail com>
Date: Fri, 17 Feb 2012 00:27:58 +0100
Subject: [PATCH virt-viewer 1/2] Add compatibility code for GTK < 2.14

---
 configure.ac             |    2 +-
 src/virt-viewer-window.c |   16 ++++++++++++++++
 src/virt-viewer.xml      |    4 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 14af9d4..3e3d81c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ AM_SILENT_RULES([yes])
 GMODULE2_REQUIRED=2.12.0
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.6.0"
-GTK2_REQUIRED="2.16.0"
+GTK2_REQUIRED="2.12.0"
 GTK3_REQUIRED="3.0"
 GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 78adb74..a005541 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -306,6 +306,22 @@ virt_viewer_window_init (VirtViewerWindow *self)
 
     priv->accel_group = GTK_ACCEL_GROUP(gtk_builder_get_object(priv->builder, "accelgroup"));
 
+#if !GTK_CHECK_VERSION(2,14,0)
+    /* those are not properties in this case, and need to be set manually */
+    gtk_menu_set_accel_group(gtk_builder_get_object(priv->builder, "gtkmenu-file"),
+                             priv->accel_group);
+    gtk_menu_set_accel_group(gtk_builder_get_object(priv->builder, "gtkmenu-view"),
+                             priv->accel_group);
+    gtk_menu_item_set_accel_path(gtk_builder_get_object(priv->builder, "menu-view-fullscreen"),
+                                 "<virt-viewer>/view/fullscreen");
+    gtk_menu_item_set_accel_path(gtk_builder_get_object(priv->builder, "menu-view-release-cursor"),
+                                 "<virt-viewer>/view/release-cursor");
+    gtk_menu_item_set_accel_path(gtk_builder_get_object(priv->builder, "menu-file-smartcard-insert"),
+                                 "<virt-viewer>/file/smartcard-insert");
+    gtk_menu_item_set_accel_path(gtk_builder_get_object(priv->builder, "menu-file-smartcard-remove"),
+                                 "<virt-viewer>/file/smartcard-remove");
+#endif
+
     /* 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);
diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
index cce1f0d..ac0e7f7 100644
--- a/src/virt-viewer.xml
+++ b/src/virt-viewer.xml
@@ -23,7 +23,7 @@
                 <property name="label" translatable="yes">_File</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
-                  <object class="GtkMenu" id="menu1">
+                  <object class="GtkMenu" id="gtkmenu-file">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="accel_group">accelgroup</property>
@@ -98,7 +98,7 @@
                 <property name="label" translatable="yes">_View</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
-                  <object class="GtkMenu" id="menu2">
+                  <object class="GtkMenu" id="gtkmenu-view">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="accel_group">accelgroup</property>
-- 
1.7.7.6


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