[libwnck/wip/muktupavels/wnck-handle: 5/8] wnckprop: port to WnckHandle




commit d838f4c432085535f046e8b6173b929767d8b2b9
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Aug 19 21:47:28 2019 +0300

    wnckprop: port to WnckHandle

 libwnck/wnckprop.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/libwnck/wnckprop.c b/libwnck/wnckprop.c
index 9a0d3ab..fa4844a 100644
--- a/libwnck/wnckprop.c
+++ b/libwnck/wnckprop.c
@@ -1861,6 +1861,7 @@ main (int argc, char **argv)
   GOptionContext *ctxt;
   GOptionGroup   *group;
   GError         *error;
+  WnckHandle     *handle;
   WnckScreen     *screen;
 
   bindtextdomain (GETTEXT_PACKAGE, WNCK_LOCALEDIR);
@@ -1933,17 +1934,19 @@ main (int argc, char **argv)
 
   gtk_init (&argc, &argv);
 
-  wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
+  handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER);
 
   if ((option_screen && interact_screen < 0) || !option_screen)
-    screen = wnck_screen_get_default ();
+    screen = wnck_handle_get_default_screen (handle);
   else
     {
-      screen = wnck_screen_get (interact_screen);
+      screen = wnck_handle_get_screen (handle, interact_screen);
       if (!screen)
         {
-         g_printerr (_("Cannot interact with screen %d: "
-                       "the screen does not exist\n"), interact_screen);
+          g_printerr (_("Cannot interact with screen %d: "
+                        "the screen does not exist\n"), interact_screen);
+
+          g_object_unref (handle);
           return 0;
         }
     }
@@ -1968,7 +1971,10 @@ main (int argc, char **argv)
       gtk_main ();
 
       if (!got_from_user)
-        return 0;
+        {
+          g_object_unref (handle);
+          return 0;
+        }
     }
 
   if (mode == SCREEN_READ_MODE)
@@ -2072,5 +2078,7 @@ main (int argc, char **argv)
                       "the window cannot be found\n"), xid);
     }
 
+  g_object_unref (handle);
+
   return 0;
 }


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