[Xfce4-commits] <xfce4-appfinder:nick/gtk3> Port to gtk3.

Nick Schermer noreply at xfce.org
Sat May 5 11:26:02 CEST 2012


Updating branch refs/heads/nick/gtk3
         to 08e27b7fc82cae42a46c1ff24032dfb0a5a01d64 (commit)
       from e9a079ecc9127b30febd5abc8e18c086e1b43bc0 (commit)

commit 08e27b7fc82cae42a46c1ff24032dfb0a5a01d64
Author: Nick Schermer <nick at xfce.org>
Date:   Sat May 5 11:24:52 2012 +0200

    Port to gtk3.

 configure.ac.in                 |   16 ++--
 src/appfinder-preferences.c     |    6 +-
 src/appfinder-preferences.glade |  158 +++++++++++++++++++++++----------------
 src/appfinder-window.c          |   80 ++++++++++++--------
 4 files changed, 152 insertions(+), 108 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 4d66210..a9e4672 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -71,15 +71,15 @@ XDT_I18N([@LINGUAS@])
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0])
-XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.24.0])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
-XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.20.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.9.0])
-XDT_CHECK_PACKAGE([GARCON], [garcon-1], [0.1.7])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.30.0])
+XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.30.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.2.0])
+XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.30.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.10.0])
+XDT_CHECK_PACKAGE([GARCON], [garcon-1], [0.2.0])
 XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.84])
-XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0])
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0])
 
 dnl ***********************************
 dnl *** Check for debugging support ***
diff --git a/src/appfinder-preferences.c b/src/appfinder-preferences.c
index becc111..8638e3c 100644
--- a/src/appfinder-preferences.c
+++ b/src/appfinder-preferences.c
@@ -107,7 +107,7 @@ xfce_appfinder_preferences_init (XfceAppfinderPreferences *preferences)
                                appfinder_preferences_ui_length, NULL);
 
   preferences->dialog = gtk_builder_get_object (GTK_BUILDER (preferences), "dialog");
-  appfinder_return_if_fail (XFCE_IS_TITLED_DIALOG (preferences->dialog));
+  //appfinder_return_if_fail (XFCE_IS_TITLED_DIALOG (preferences->dialog));
   g_signal_connect (G_OBJECT (preferences->dialog), "response",
       G_CALLBACK (xfce_appfinder_preferences_response), preferences);
 
@@ -192,10 +192,8 @@ xfce_appfinder_preferences_response (GtkWidget                *window,
   else
     {
       g_signal_handler_disconnect (preferences->channel, preferences->property_watch_id);
-
-      gtk_widget_destroy (window);
-
       g_object_unref (G_OBJECT (preferences));
+      gtk_widget_destroy (window);
     }
 }
 
diff --git a/src/appfinder-preferences.glade b/src/appfinder-preferences.glade
index f1b6cc3..a98e01c 100644
--- a/src/appfinder-preferences.glade
+++ b/src/appfinder-preferences.glade
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.20"/>
-  <!-- interface-requires libxfce4ui 4.5 -->
-  <!-- interface-naming-policy project-wide -->
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkListStore" id="action-types">
     <columns>
       <!-- column-name title -->
@@ -25,40 +23,6 @@
       <column type="gint"/>
     </columns>
   </object>
-  <object class="GtkListStore" id="icon-sizes">
-    <columns>
-      <!-- column-name name -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Very Small</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Smaller</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Small</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Normal</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Large</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Larger</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Very Large</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkImage" id="image3">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="stock">gtk-clear</property>
-  </object>
   <object class="XfceTitledDialog" id="dialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Application Finder</property>
@@ -67,44 +31,47 @@
     <property name="icon_name">gtk-preferences</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox1">
+      <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
+          <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button-close">
-                <property name="label">gtk-close</property>
+              <object class="GtkButton" id="button-help">
+                <property name="label">gtk-help</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button-help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="button-close">
+                <property name="label">gtk-close</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -121,10 +88,11 @@
             <property name="can_focus">True</property>
             <property name="border_width">6</property>
             <child>
-              <object class="GtkVBox" id="vbox3">
+              <object class="GtkBox" id="vbox3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkFrame" id="frame1">
@@ -138,10 +106,11 @@
                         <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="GtkVBox" id="vbox4">
+                          <object class="GtkBox" id="vbox4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="border_width">6</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkCheckButton" id="remember-category">
@@ -150,11 +119,12 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
@@ -167,11 +137,12 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
                                 <property name="tooltip_text" translatable="yes">Center the window on startup.</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
@@ -184,12 +155,13 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
                                 <property name="tooltip_text" translatable="yes">Instead of quitting the application when the last window is closed, keep a running instance to speed up opening new windows. You might want to disable this to reduce memory usage.</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
                                 <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
                                 <property name="position">2</property>
                               </packing>
@@ -242,11 +214,14 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
                                 <property name="right_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
@@ -256,12 +231,15 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
                                 <property name="right_attach">2</property>
                                 <property name="top_attach">1</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
@@ -277,6 +255,7 @@
                                 <property name="top_attach">2</property>
                                 <property name="bottom_attach">3</property>
                                 <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
@@ -292,6 +271,7 @@
                                 <property name="top_attach">3</property>
                                 <property name="bottom_attach">4</property>
                                 <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
@@ -311,6 +291,7 @@
                                 <property name="right_attach">2</property>
                                 <property name="top_attach">2</property>
                                 <property name="bottom_attach">3</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
@@ -330,6 +311,7 @@
                                 <property name="right_attach">2</property>
                                 <property name="top_attach">3</property>
                                 <property name="bottom_attach">4</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                           </object>
@@ -349,7 +331,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
@@ -376,6 +358,7 @@
                             <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="image">image3</property>
                             <property name="use_underline">True</property>
                           </object>
@@ -413,13 +396,14 @@
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="vbox1">
+              <object class="GtkBox" id="vbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkHBox" id="hbox1">
+                  <object class="GtkBox" id="hbox1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="spacing">6</property>
@@ -427,8 +411,6 @@
                       <object class="GtkScrolledWindow" id="scrolledwindow1">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">automatic</property>
-                        <property name="vscrollbar_policy">automatic</property>
                         <property name="shadow_type">etched-in</property>
                         <child>
                           <object class="GtkTreeView" id="actions-treeview">
@@ -439,6 +421,9 @@
                             <property name="rules_hint">True</property>
                             <property name="enable_search">False</property>
                             <property name="search_column">0</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection1"/>
+                            </child>
                             <child>
                               <object class="GtkTreeViewColumn" id="treeviewcolumn1">
                                 <property name="title" translatable="yes">Pattern</property>
@@ -467,9 +452,10 @@
                         <property name="xscale">0</property>
                         <property name="yscale">0</property>
                         <child>
-                          <object class="GtkVBox" id="vbox2">
+                          <object class="GtkBox" id="vbox2">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkButton" id="button-add">
@@ -478,6 +464,7 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="tooltip_text" translatable="yes">Add a new custom action.</property>
+                                <property name="use_action_appearance">False</property>
                                 <child>
                                   <object class="GtkImage" id="image1">
                                     <property name="visible">True</property>
@@ -499,6 +486,7 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="tooltip_text" translatable="yes">Remove the currently selected action.</property>
+                                <property name="use_action_appearance">False</property>
                                 <child>
                                   <object class="GtkImage" id="image2">
                                     <property name="visible">True</property>
@@ -538,6 +526,9 @@
                     <property name="column_spacing">12</property>
                     <property name="row_spacing">6</property>
                     <child>
+                      <placeholder/>
+                    </child>
+                    <child>
                       <object class="GtkEntry" id="command">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -546,14 +537,13 @@
                         <property name="invisible_char_set">True</property>
                         <property name="primary_icon_activatable">False</property>
                         <property name="secondary_icon_activatable">False</property>
-                        <property name="primary_icon_sensitive">True</property>
-                        <property name="secondary_icon_sensitive">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
                         <property name="top_attach">2</property>
                         <property name="bottom_attach">3</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -564,14 +554,13 @@
                         <property name="invisible_char_set">True</property>
                         <property name="primary_icon_activatable">False</property>
                         <property name="secondary_icon_activatable">False</property>
-                        <property name="primary_icon_sensitive">True</property>
-                        <property name="secondary_icon_sensitive">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -587,6 +576,7 @@
                         <property name="top_attach">2</property>
                         <property name="bottom_attach">3</property>
                         <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -602,6 +592,7 @@
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                         <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -615,6 +606,7 @@
                       </object>
                       <packing>
                         <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -640,6 +632,7 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -649,6 +642,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
                       </object>
@@ -657,11 +651,9 @@
                         <property name="right_attach">2</property>
                         <property name="top_attach">3</property>
                         <property name="bottom_attach">4</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
-                    <child>
-                      <placeholder/>
-                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -696,8 +688,42 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">button-close</action-widget>
       <action-widget response="-11">button-help</action-widget>
+      <action-widget response="0">button-close</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkListStore" id="icon-sizes">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Very Small</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Smaller</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Small</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Normal</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Large</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Larger</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Very Large</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-clear</property>
+  </object>
 </interface>
diff --git a/src/appfinder-window.c b/src/appfinder-window.c
index 155e011..75c8b70 100644
--- a/src/appfinder-window.c
+++ b/src/appfinder-window.c
@@ -42,7 +42,7 @@
 
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
-#define APPFINDER_WIDGET_XID(widget) ((guint) GDK_WINDOW_XID (GDK_WINDOW (GTK_WIDGET (widget)->window)))
+#define APPFINDER_WIDGET_XID(widget) ((guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (widget))))
 #else
 #define APPFINDER_WIDGET_XID(widget) (0)
 #endif
@@ -224,12 +224,12 @@ xfce_appfinder_window_init (XfceAppfinderWindow *window)
   if (xfconf_channel_get_bool (window->channel, "/always-center", FALSE))
     gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
 
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (window), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
   gtk_widget_show (vbox);
 
-  hbox = gtk_hbox_new (FALSE, 6);
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
   gtk_widget_show (hbox);
 
@@ -243,7 +243,7 @@ xfce_appfinder_window_init (XfceAppfinderWindow *window)
   gtk_container_add (GTK_CONTAINER (align), image);
   gtk_widget_show (image);
 
-  vbox2 = gtk_vbox_new (FALSE, 6);
+  vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
   gtk_widget_show (vbox2);
 
@@ -283,7 +283,7 @@ xfce_appfinder_window_init (XfceAppfinderWindow *window)
   gtk_box_pack_start (GTK_BOX (vbox2), window->bin_collapsed, FALSE, TRUE, 0);
   gtk_widget_show (window->bin_collapsed);
 
-  window->paned = pane = gtk_hpaned_new ();
+  window->paned = pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_box_pack_start (GTK_BOX (vbox), pane, TRUE, TRUE, 0);
   integer = xfconf_channel_get_int (window->channel, "/last/pane-position", DEFAULT_PANED_POSITION);
   gtk_paned_set_position (GTK_PANED (pane), integer);
@@ -340,7 +340,7 @@ xfce_appfinder_window_init (XfceAppfinderWindow *window)
   gtk_box_pack_start (GTK_BOX (vbox), window->bin_expanded, FALSE, TRUE, 0);
   gtk_widget_show (window->bin_expanded);
 
-  window->bbox = hbox = gtk_hbox_new (FALSE, 6);
+  window->bbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_widget_show (hbox);
 
   window->button_preferences = button = gtk_button_new_from_stock (GTK_STOCK_PREFERENCES);
@@ -348,9 +348,9 @@ xfce_appfinder_window_init (XfceAppfinderWindow *window)
   g_signal_connect (G_OBJECT (button), "clicked",
       G_CALLBACK (xfce_appfinder_window_preferences), window);
 
-  bbox = gtk_hbutton_box_new ();
+  bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
-  gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 6);
+  gtk_box_set_spacing (GTK_BOX (bbox), 6);
   gtk_box_pack_start (GTK_BOX (hbox), bbox, TRUE, TRUE, 0);
   gtk_widget_show (bbox);
 
@@ -450,7 +450,7 @@ xfce_appfinder_window_key_press_event (GtkWidget   *widget,
   GtkWidget             *entry;
   XfceAppfinderIconSize  icon_size = XFCE_APPFINDER_ICON_SIZE_DEFAULT_ITEM;
 
-  if (event->keyval == GDK_Escape)
+  if (event->keyval == GDK_KEY_Escape)
     {
       gtk_widget_destroy (widget);
       return TRUE;
@@ -459,7 +459,7 @@ xfce_appfinder_window_key_press_event (GtkWidget   *widget,
     {
       switch (event->keyval)
         {
-        case GDK_l:
+        case GDK_KEY_l:
           entry = XFCE_APPFINDER_WINDOW (widget)->entry;
 
           gtk_widget_grab_focus (entry);
@@ -467,19 +467,19 @@ xfce_appfinder_window_key_press_event (GtkWidget   *widget,
 
           return TRUE;
 
-        case GDK_1:
-        case GDK_2:
+        case GDK_KEY_1:
+        case GDK_KEY_2:
           /* toggle between icon and tree view */
           xfconf_channel_set_bool (window->channel, "/icon-view",
-                                   event->keyval == GDK_1);
+                                   event->keyval == GDK_KEY_1);
           return TRUE;
 
-        case GDK_plus:
-        case GDK_minus:
-        case GDK_KP_Add:
-        case GDK_KP_Subtract:
+        case GDK_KEY_plus:
+        case GDK_KEY_minus:
+        case GDK_KEY_KP_Add:
+        case GDK_KEY_KP_Subtract:
           g_object_get (G_OBJECT (window->model), "icon-size", &icon_size, NULL);
-          if ((event->keyval == GDK_plus || event->keyval == GDK_KP_Add))
+          if ((event->keyval == GDK_KEY_plus || event->keyval == GDK_KEY_KP_Add))
             {
               if (icon_size < XFCE_APPFINDER_ICON_SIZE_LARGEST)
                 icon_size++;
@@ -489,8 +489,8 @@ xfce_appfinder_window_key_press_event (GtkWidget   *widget,
               icon_size--;
             }
 
-        case GDK_0:
-        case GDK_KP_0:
+        case GDK_KEY_0:
+        case GDK_KEY_KP_0:
           g_object_set (G_OBJECT (window->model), "icon-size", icon_size, NULL);
           return TRUE;
         }
@@ -999,10 +999,12 @@ static void
 xfce_appfinder_window_set_padding (GtkWidget *entry,
                                    GtkWidget *align)
 {
-  gint padding;
+  gint          padding;
+  GtkAllocation alloc;
 
   /* 48 is the icon size of XFCE_APPFINDER_ICON_SIZE_48 */
-  padding = (48 - entry->allocation.height) / 2;
+  gtk_widget_get_allocation (entry, &alloc);
+  padding = (48 - alloc.height) / 2;
   gtk_alignment_set_padding (GTK_ALIGNMENT (align), MAX (0, padding), 0, 0, 0);
 }
 
@@ -1150,18 +1152,36 @@ xfce_appfinder_window_entry_key_press_event (GtkWidget           *entry,
                                              GdkEventKey         *event,
                                              XfceAppfinderWindow *window)
 {
-  gboolean expand, is_expanded;
+  gboolean          expand, is_expanded;
+  GdkDeviceManager *device_manager;
+  GList            *devices, *li;
+  GdkDisplay       *display;
 
-  if (event->keyval == GDK_Up || event->keyval == GDK_Down)
+  if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_Down)
     {
-      expand = (event->keyval == GDK_Down);
+      expand = (event->keyval == GDK_KEY_Down);
       is_expanded = gtk_widget_get_visible (window->paned);
       if (is_expanded != expand)
         {
           /* don't break entry completion navigation in collapsed mode */
-          if (!is_expanded
-              && gdk_pointer_is_grabbed ())
-            return FALSE;
+          if (!is_expanded)
+            {
+              display = gtk_widget_get_display (entry);
+              device_manager = gdk_display_get_device_manager (display);
+              devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+
+              for (li = devices; li != NULL; li = li->next)
+                {
+                  if (gdk_device_get_source (li->data) == GDK_SOURCE_MOUSE
+                      && gdk_display_device_is_grabbed (display, li->data))
+                    {
+                      g_list_free (devices);
+                      return FALSE;
+                    }
+                }
+
+              g_list_free (devices);
+            }
 
           xfce_appfinder_window_set_expanded (window, expand);
           return TRUE;
@@ -1229,7 +1249,7 @@ xfce_appfinder_window_treeview_key_press_event (GtkWidget           *widget,
 {
   if (widget == window->view)
     {
-      if (event->keyval == GDK_Left)
+      if (event->keyval == GDK_KEY_Left)
         {
           gtk_widget_grab_focus (window->sidepane);
           return TRUE;
@@ -1237,7 +1257,7 @@ xfce_appfinder_window_treeview_key_press_event (GtkWidget           *widget,
     }
   else if (widget == window->sidepane)
     {
-      if (event->keyval == GDK_Right)
+      if (event->keyval == GDK_KEY_Right)
         {
           gtk_widget_grab_focus (window->view);
           return TRUE;


More information about the Xfce4-commits mailing list