[gnome-panel/wip/muktupavels/wnck-handle: 385/385] wncklet: port to WnckHandle




commit e882a5bdd7f10e1e20c812df1bbfee3062cbc5f3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Aug 20 17:46:18 2019 +0300

    wncklet: port to WnckHandle

 modules/wncklet/showdesktop.c        | 19 ++++++++++++++++++-
 modules/wncklet/window-list.c        | 17 ++++++++++++++++-
 modules/wncklet/window-menu.c        | 17 ++++++++++++++++-
 modules/wncklet/wncklet-module.c     |  2 --
 modules/wncklet/workspace-switcher.c | 19 +++++++++++++++++--
 5 files changed, 67 insertions(+), 7 deletions(-)
---
diff --git a/modules/wncklet/showdesktop.c b/modules/wncklet/showdesktop.c
index 95b883dfb..89452eded 100644
--- a/modules/wncklet/showdesktop.c
+++ b/modules/wncklet/showdesktop.c
@@ -34,6 +34,8 @@ struct _ShowDesktopApplet
 {
         GpApplet parent;
 
+        WnckHandle *handle;
+
         GtkWidget *button;
         GtkWidget *image;
 
@@ -291,7 +293,7 @@ show_desktop_applet_realized (GtkWidget         *widget,
                                                      theme_changed_callback,
                                                      sdd);
 
-       sdd->wnck_screen = wnck_screen_get_default ();
+       sdd->wnck_screen = wnck_handle_get_default_screen (sdd->handle);
 
        if (sdd->wnck_screen != NULL)
                wncklet_connect_while_alive (sdd->wnck_screen,
@@ -319,6 +321,8 @@ show_desktop_applet_fill (GpApplet *applet)
 
        sdd = SHOW_DESKTOP_APPLET (applet);
 
+       sdd->handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER);
+
        sdd->image = gtk_image_new ();
        sdd->orient = gp_applet_get_orientation (applet);
 
@@ -370,6 +374,18 @@ show_desktop_applet_constructed (GObject *object)
        show_desktop_applet_fill (GP_APPLET (object));
 }
 
+static void
+show_desktop_applet_dispose (GObject *object)
+{
+       ShowDesktopApplet *sdd;
+
+       sdd = SHOW_DESKTOP_APPLET (object);
+
+       g_clear_object (&sdd->handle);
+
+       G_OBJECT_CLASS (show_desktop_applet_parent_class)->dispose (object);
+}
+
 static void
 show_desktop_applet_placement_changed (GpApplet        *applet,
                                        GtkOrientation   orientation,
@@ -397,6 +413,7 @@ show_desktop_applet_class_init (ShowDesktopAppletClass *sdd_class)
        applet_class = GP_APPLET_CLASS (sdd_class);
 
        object_class->constructed = show_desktop_applet_constructed;
+       object_class->dispose = show_desktop_applet_dispose;
 
        applet_class->placement_changed = show_desktop_applet_placement_changed;
 }
diff --git a/modules/wncklet/window-list.c b/modules/wncklet/window-list.c
index 107130128..7a6a627dd 100644
--- a/modules/wncklet/window-list.c
+++ b/modules/wncklet/window-list.c
@@ -34,6 +34,7 @@ struct _WindowListApplet
 {
        GpApplet parent;
 
+       WnckHandle *handle;
        GtkWidget *tasklist;
 
        gboolean include_all_workspaces;
@@ -448,7 +449,8 @@ window_list_applet_fill (GpApplet *applet)
 
        tasklist->orientation = gp_applet_get_orientation (applet);
 
-       tasklist->tasklist = wnck_tasklist_new ();
+       tasklist->handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER);
+       tasklist->tasklist = wnck_tasklist_new_with_handle (tasklist->handle);
        tasklist->icon_theme = gtk_icon_theme_get_default ();
 
        wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation);
@@ -482,6 +484,18 @@ window_list_applet_constructed (GObject *object)
        window_list_applet_fill (GP_APPLET (object));
 }
 
+static void
+window_list_applet_dispose (GObject *object)
+{
+       WindowListApplet *tasklist;
+
+       tasklist = WINDOW_LIST_APPLET (object);
+
+       g_clear_object (&tasklist->handle);
+
+       G_OBJECT_CLASS (window_list_applet_parent_class)->dispose (object);
+}
+
 static void
 window_list_applet_placement_changed (GpApplet        *applet,
                                       GtkOrientation   orientation,
@@ -511,6 +525,7 @@ window_list_applet_class_init (WindowListAppletClass *tasklist_class)
        applet_class = GP_APPLET_CLASS (tasklist_class);
 
        object_class->constructed = window_list_applet_constructed;
+       object_class->dispose = window_list_applet_dispose;
 
        applet_class->placement_changed = window_list_applet_placement_changed;
 }
diff --git a/modules/wncklet/window-menu.c b/modules/wncklet/window-menu.c
index c86a9fa66..74e4d380b 100644
--- a/modules/wncklet/window-menu.c
+++ b/modules/wncklet/window-menu.c
@@ -38,6 +38,7 @@ struct _WindowMenuApplet
 {
        GpApplet parent;
 
+       WnckHandle   *handle;
        GtkWidget    *selector;
        int           size;
        GtkOrientation orient;
@@ -175,7 +176,8 @@ window_menu_applet_fill (GpApplet *applet)
 
        window_menu->orient = gp_applet_get_orientation (applet);
 
-       window_menu->selector = wnck_selector_new ();
+       window_menu->handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER);
+       window_menu->selector = wnck_selector_new_with_handle (window_menu->handle);
        gtk_container_add (GTK_CONTAINER (window_menu),
                           window_menu->selector);
 
@@ -205,6 +207,18 @@ window_menu_applet_constructed (GObject *object)
        window_menu_applet_fill (GP_APPLET (object));
 }
 
+static void
+window_menu_applet_dispose (GObject *object)
+{
+       WindowMenuApplet *window_menu;
+
+       window_menu = WINDOW_MENU_APPLET (object);
+
+       g_clear_object (&window_menu->handle);
+
+       G_OBJECT_CLASS (window_menu_applet_parent_class)->dispose (object);
+}
+
 static void
 window_menu_applet_class_init (WindowMenuAppletClass *window_menu_class)
 {
@@ -213,6 +227,7 @@ window_menu_applet_class_init (WindowMenuAppletClass *window_menu_class)
        object_class = G_OBJECT_CLASS (window_menu_class);
 
        object_class->constructed = window_menu_applet_constructed;
+       object_class->dispose = window_menu_applet_dispose;
 }
 
 static void
diff --git a/modules/wncklet/wncklet-module.c b/modules/wncklet/wncklet-module.c
index 559069bee..6ad6c4b6b 100644
--- a/modules/wncklet/wncklet-module.c
+++ b/modules/wncklet/wncklet-module.c
@@ -102,8 +102,6 @@ gp_module_load (GpModule *module)
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   gp_module_set_gettext_domain (module, GETTEXT_PACKAGE);
 
-  wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
-
   gp_module_set_abi_version (module, GP_MODULE_ABI_VERSION);
 
   gp_module_set_id (module, "org.gnome.gnome-panel.wncklet");
diff --git a/modules/wncklet/workspace-switcher.c b/modules/wncklet/workspace-switcher.c
index 054278de0..e2cb1e6f2 100644
--- a/modules/wncklet/workspace-switcher.c
+++ b/modules/wncklet/workspace-switcher.c
@@ -42,6 +42,7 @@ struct _WorkspaceSwitcherApplet
 {
        GpApplet parent;
 
+       WnckHandle *handle;
        GtkWidget *pager;
 
        WnckScreen *screen;
@@ -153,7 +154,7 @@ static void
 applet_realized (GtkWidget               *widget,
                  WorkspaceSwitcherApplet *pager)
 {
-       pager->screen = wnck_screen_get_default ();
+       pager->screen = wnck_handle_get_default_screen (pager->handle);
 
        window_manager_changed (pager->screen, pager);
        wncklet_connect_while_alive (pager->screen, "window_manager_changed",
@@ -695,7 +696,8 @@ workspace_switcher_applet_fill (GpApplet *applet)
 
        pager->orientation = gp_applet_get_orientation (applet);
 
-       pager->pager = wnck_pager_new ();
+       pager->handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER);
+       pager->pager = wnck_pager_new_with_handle (pager->handle);
        pager->screen = NULL;
        pager->wm = PAGER_WM_UNKNOWN;
        wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager), GTK_SHADOW_IN);
@@ -735,6 +737,18 @@ workspace_switcher_applet_constructed (GObject *object)
        workspace_switcher_applet_fill (GP_APPLET (object));
 }
 
+static void
+workspace_switcher_applet_dispose (GObject *object)
+{
+       WorkspaceSwitcherApplet *pager;
+
+       pager = WORKSPACE_SWITCHER_APPLET (object);
+
+       g_clear_object (&pager->handle);
+
+       G_OBJECT_CLASS (workspace_switcher_applet_parent_class)->dispose (object);
+}
+
 static void
 workspace_switcher_applet_placement_changed (GpApplet        *applet,
                                              GtkOrientation   orientation,
@@ -764,6 +778,7 @@ workspace_switcher_applet_class_init (WorkspaceSwitcherAppletClass *pager_class)
        applet_class = GP_APPLET_CLASS (pager_class);
 
        object_class->constructed = workspace_switcher_applet_constructed;
+       object_class->dispose = workspace_switcher_applet_dispose;
 
        applet_class->placement_changed = workspace_switcher_applet_placement_changed;
 }


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