Re: [gnome-db] Replacing deprecated GTK+ 3 API



On Tue, 2011-07-19 at 22:17 +0200, Vivien Malerba wrote:
> 
> 
> On 18 July 2011 21:39, Vivien Malerba <vmalerba gmail com> wrote:
>         
>         
>         On 4 July 2011 13:54, Murray Cumming <murrayc murrayc com>
>         wrote:
>                 In master, I have made some commits to replace the use
>                 of most
>                 deprecated API. Hopefully things still work OK.
>                 
>                 But there is still some use of GtkStyle (instead of
>                 GtkStyleContext)
>                 that needs to be replaced. I couldn't see a way to
>                 copy a
>                 GtkStyleContext, so I couldn't replace this code:
>                 http://git.gnome.org/browse/libgda/tree/libgda-ui/data-entries/gdaui-entry-shell.c#n379
>                 
>         Ok, I'll check this ASAP.
>         
>         
> 
> Can you check with commit
> http://git.gnome.org/browse/libgda/commit/?id=7df900b6a0c92334e4d25a2cb5fe2b86fa989a28?

Thanks. I fixed some more.

However, there are still some uses of gdk_pointer_grab(),
gdk_keyboard_grab() and gdk_pointer_ungrab(). I don't actually use
libgda-ui so I wouldn't risk porting that strange code myself.
w

The attached patch makes an attempt to fix one use, but I'm just
guessing at some of the parameters.

You can pass --enable-warnings=fatal to configure to see these errors.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 0e71c1e..3991268 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -945,15 +945,22 @@ date_calendar_choose_cb (GtkWidget *button, GdauiEntryCommonTime *mgtim)
 static gboolean
 popup_grab_on_window (GdkWindow *window, guint32 activate_time)
 {
-        if ((gdk_pointer_grab (window, TRUE,
+        GdkDevice *device = gtk_get_current_event_device ();
+        GdkDevice *keyboard = gdk_device_get_associated_device (device);
+        
+        if ((gdk_device_grab (device, window, 
+                               GDK_OWNERSHIP_WINDOW, TRUE,
                                GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
                                GDK_POINTER_MOTION_MASK,
-                               NULL, NULL, activate_time) == 0)) {
-                if (gdk_keyboard_grab (window, TRUE,
-                                       activate_time) == 0)
+                               NULL, activate_time) == 0)) {
+                if (gdk_device_grab (keyboard, window,
+                                     GDK_OWNERSHIP_WINDOW, TRUE,
+                                     GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+                                     GDK_POINTER_MOTION_MASK,
+                                     NULL, activate_time) == 0)
                         return TRUE;
                 else {
-                        gdk_pointer_ungrab (activate_time);
+                        gdk_device_ungrab (device, activate_time);
                         return FALSE;
                 }
         }


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