[gnome-applets/window-picker-module] windowpicker: port to libgnome-panel



commit f77e8ccbf77f78472e12353794c2faafe76ea0b9
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sat Mar 21 17:22:54 2020 +0100

    windowpicker: port to libgnome-panel

 .gitlab-ci.yml                                     |   2 +
 configure.ac                                       |  10 +++
 po/POTFILES.in                                     |   2 +-
 po/POTFILES.skip                                   |   1 -
 windowpicker/data/Makefile.am                      |  18 +---
 ...g.gnome.applets.WindowPicker.panel-applet.in.in |  11 ---
 windowpicker/src/Makefile.am                       |   9 +-
 windowpicker/src/task-list.c                       |  58 +++---------
 windowpicker/src/wp-applet.c                       | 100 ++++++++-------------
 windowpicker/src/wp-applet.h                       |  20 +----
 windowpicker/src/wp-menu.xml                       |  24 ++---
 windowpicker/src/wp-module.c                       |  67 ++++++++++++++
 windowpicker/src/wp-task-title.c                   |  22 +++--
 13 files changed, 161 insertions(+), 183 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aac71cc64..6a7e4e865 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,6 +24,7 @@ build-ubuntu:
                       libdbus-1-dev
                       libdbus-glib-1-dev
                       libglib2.0-dev
+                      libgnome-panel-dev
                       libgtk-3-dev
                       libgtop2-dev
                       libgucharmap-2-90-dev
@@ -68,6 +69,7 @@ coverity:
                       libdbus-1-dev
                       libdbus-glib-1-dev
                       libglib2.0-dev
+                      libgnome-panel-dev
                       libgtk-3-dev
                       libgtop2-dev
                       libgucharmap-2-90-dev
diff --git a/configure.ac b/configure.ac
index fd507701a..70c4d7cd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,7 @@ GTK_REQUIRED=3.20.0
 GLIB_REQUIRED=2.44.0
 GIO_REQUIRED=2.26.0
 LIBPANEL_REQUIRED=3.24.1
+LIBGNOME_PANEL_REQUIRED=3.36.0
 LIBGTOP_REQUIRED=2.11.92
 LIBWNCK_REQUIRED=3.14.1
 LIBNOTIFY_REQUIRED=0.7
@@ -112,6 +113,12 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
 dnl -- check for libpanelapplet (required) ------------------------------------
 PKG_CHECK_MODULES(GNOME_APPLETS, libpanel-applet >= $LIBPANEL_REQUIRED)
 
+dnl -- check for libgnome-panel (required) ------------------------------------
+PKG_CHECK_MODULES([GNOME_PANEL], [libgnome-panel >= $LIBGNOME_PANEL_REQUIRED])
+
+GNOME_PANEL_MODULES_DIR=`$PKG_CONFIG --variable=modulesdir libgnome-panel`
+AC_SUBST([GNOME_PANEL_MODULES_DIR], [$GNOME_PANEL_MODULES_DIR])
+
 AC_ARG_WITH([libpanel-applet-dir], [], [LIBPANEL_APPLET_DIR=$withval], [LIBPANEL_APPLET_DIR=""])
 if test "$LIBPANEL_APPLET_DIR" == ""; then
        LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanel-applet`
@@ -681,6 +688,9 @@ echo "  libdir ..........................: ${libdir}"
 echo "  libexecdir ......................: ${libexecdir}"
 echo "  sysconfdir ......................: ${sysconfdir}"
 echo ""
+echo "  libgnome-panel"
+echo "    modulesdir ....................: ${GNOME_PANEL_MODULES_DIR}"
+echo ""
 echo "  Applets"
 echo "    accessx-status ................: $HAVE_XKB"
 echo "    batstat .......................: $build_battstat_applet"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 288dfe5ba..9471d2415 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -106,12 +106,12 @@ window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
 [type: gettext/ini]window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
 window-buttons/windowbuttons.c
 [type: gettext/glade]window-buttons/windowbuttons.ui
-[type: gettext/ini]windowpicker/data/org.gnome.applets.WindowPicker.panel-applet.in.in
 windowpicker/data/org.gnome.gnome-applets.window-picker-applet.gschema.xml.in.in
 windowpicker/src/task-item.c
 windowpicker/src/wp-about-dialog.c
 windowpicker/src/wp-applet.c
 [type: gettext/glade]windowpicker/src/wp-menu.xml
+windowpicker/src/wp-module.c
 [type: gettext/glade]windowpicker/src/wp-preferences-dialog.ui
 windowpicker/src/wp-task-title.c
 window-title/org.gnome.gnome-applets.window-title.gschema.xml.in.in
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 32bdae305..6d4ec831f 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -34,7 +34,6 @@ tracker-search-bar/data/org.gnome.panel.SearchBar.panel-applet.in
 trash/data/org.gnome.applets.TrashApplet.panel-applet.in
 window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in
 window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in
-windowpicker/data/org.gnome.applets.WindowPicker.panel-applet.in
 windowpicker/data/org.gnome.gnome-applets.window-picker-applet.gschema.xml.in
 window-title/org.gnome.gnome-applets.window-title.gschema.xml.in
 window-title/org.gnome.panel.WindowTitleApplet.panel-applet.in
diff --git a/windowpicker/data/Makefile.am b/windowpicker/data/Makefile.am
index cca0a6f08..0c4bcb7f0 100644
--- a/windowpicker/data/Makefile.am
+++ b/windowpicker/data/Makefile.am
@@ -1,15 +1,3 @@
-appletdir       = $(LIBPANEL_APPLET_DIR)
-applet_in_files = org.gnome.applets.WindowPicker.panel-applet.in
-applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)
-
-APPLET_LOCATION=$(pkglibdir)/libwindow-picker-applet.so
-
-$(applet_in_files): $(applet_in_files).in Makefile
-       $(AM_V_GEN)sed \
-       -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
-       -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
-       $< > $@
-
 gsettings_schemas_in_in = \
        org.gnome.gnome-applets.window-picker-applet.gschema.xml.in.in \
        $(NULL)
@@ -24,15 +12,11 @@ gsettings_SCHEMAS = $(gsettings_schemas_in:.xml.in=.xml)
 
 @GSETTINGS_RULES@
 
-%.panel-applet: %.panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) 
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-
 EXTRA_DIST = \
-       org.gnome.applets.WindowPicker.panel-applet.in.in \
        $(gsettings_schemas_in_in) \
        $(NULL)
 
-CLEANFILES = $(applet_DATA) \
-       $(applet_DATA).in \
+CLEANFILES = \
        $(gsettings_schemas_in) \
        $(gsettings_SCHEMAS) \
        *.gschema.valid
diff --git a/windowpicker/src/Makefile.am b/windowpicker/src/Makefile.am
index cb55229cd..ab60bf0c5 100644
--- a/windowpicker/src/Makefile.am
+++ b/windowpicker/src/Makefile.am
@@ -1,17 +1,17 @@
 NULL =
 
-window_picker_libdir=${pkglibdir}
+window_picker_libdir=$(GNOME_PANEL_MODULES_DIR)
 window_picker_lib_LTLIBRARIES=libwindow-picker-applet.la
 
 libwindow_picker_applet_la_CFLAGS = \
        -D_GNU_SOURCE \
        -DG_LOG_DOMAIN=\"org.gnome.gnome-applets.window-picker\" \
        -DG_LOG_USE_STRUCTURED=1 \
-       -DGNOMELOCALEDIR=\""$(localedir)"\" \
+       -DLOCALEDIR=\""$(localedir)"\" \
        -DWNCK_I_KNOW_THIS_IS_UNSTABLE=1 \
        -I$(top_builddir) \
        -I$(top_srcdir) \
-       $(GNOME_APPLETS_CFLAGS) \
+       $(GNOME_PANEL_CFLAGS) \
        $(LIBWNCK_CFLAGS) \
        $(X11_CFLAGS) \
        $(GCC_FLAGS) \
@@ -26,7 +26,7 @@ libwindow_picker_applet_la_LDFLAGS = \
        $(NULL)
 
 libwindow_picker_applet_la_LIBADD = \
-       $(GNOME_APPLETS_LIBS) \
+       $(GNOME_PANEL_LIBS) \
        $(LIBWNCK_LIBS) \
        $(X11_LIBS) \
        $(LIBM) \
@@ -37,6 +37,7 @@ libwindow_picker_applet_la_SOURCES = \
        wp-about-dialog.h \
        wp-applet.c \
        wp-applet.h \
+       wp-module.c \
        wp-preferences-dialog.c \
        wp-preferences-dialog.h \
        task-item.c \
diff --git a/windowpicker/src/task-list.c b/windowpicker/src/task-list.c
index b8c6dbce8..6a5698d05 100644
--- a/windowpicker/src/task-list.c
+++ b/windowpicker/src/task-list.c
@@ -22,7 +22,7 @@
 #include "task-item.h"
 
 #include <libwnck/libwnck.h>
-#include <panel-applet.h>
+#include <libgnome-panel/gp-applet.h>
 #include <X11/Xlib.h>
 
 struct _TaskList {
@@ -36,32 +36,6 @@ G_DEFINE_TYPE (TaskList, task_list, GTK_TYPE_BOX)
 
 static GSList *task_lists;
 
-static GtkOrientation
-get_applet_orientation (WpApplet *applet)
-{
-  PanelAppletOrient panel_orientation;
-  GtkOrientation orientation;
-
-  panel_orientation = panel_applet_get_orient(PANEL_APPLET(applet));
-
-  switch(panel_orientation)
-  {
-    case PANEL_APPLET_ORIENT_UP:
-    case PANEL_APPLET_ORIENT_DOWN:
-      orientation = GTK_ORIENTATION_HORIZONTAL;
-      break;
-    case PANEL_APPLET_ORIENT_LEFT:
-    case PANEL_APPLET_ORIENT_RIGHT:
-      orientation = GTK_ORIENTATION_VERTICAL;
-      break;
-    default:
-      orientation = GTK_ORIENTATION_HORIZONTAL;
-      break;
-  }
-
-  return orientation;
-}
-
 static gboolean
 window_is_special (WnckWindow *window)
 {
@@ -202,24 +176,16 @@ static void type_changed (WnckWindow *window,
       }
 }
 
-static void on_task_list_orient_changed(PanelApplet *applet,
-                                        guint orient,
-                                        GtkBox *box)
+static void
+on_task_list_placement_changed (GpApplet        *applet,
+                                GtkOrientation   orientation,
+                                GtkPositionType  position,
+                                GtkBox          *box)
 {
     g_return_if_fail(box);
-    switch(orient) {
-        case PANEL_APPLET_ORIENT_UP:
-        case PANEL_APPLET_ORIENT_DOWN:
-            gtk_orientable_set_orientation(GTK_ORIENTABLE(box), GTK_ORIENTATION_HORIZONTAL);
-            break;
-        case PANEL_APPLET_ORIENT_LEFT:
-        case PANEL_APPLET_ORIENT_RIGHT:
-            gtk_orientable_set_orientation(GTK_ORIENTABLE(box), GTK_ORIENTATION_VERTICAL);
-            break;
-        default:
-            gtk_orientable_set_orientation(GTK_ORIENTABLE(box), GTK_ORIENTATION_HORIZONTAL);
-            break;
-    }
+
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (box), orientation);
+
     gtk_widget_queue_resize(GTK_WIDGET(box));
 }
 
@@ -372,7 +338,7 @@ GtkWidget *task_list_new (WpApplet *windowPickerApplet) {
     GtkOrientation orientation;
     TaskList* taskList;
 
-    orientation = get_applet_orientation (windowPickerApplet);
+    orientation = gp_applet_get_orientation (GP_APPLET (windowPickerApplet));
 
     taskList = g_object_new (TASK_TYPE_LIST,
                              "orientation", orientation,
@@ -382,8 +348,8 @@ GtkWidget *task_list_new (WpApplet *windowPickerApplet) {
 
     taskList->windowPickerApplet = windowPickerApplet;
 
-    g_signal_connect_object (windowPickerApplet, "change-orient",
-                             G_CALLBACK (on_task_list_orient_changed), taskList, 0);
+    g_signal_connect_object (windowPickerApplet, "placement-changed",
+                             G_CALLBACK (on_task_list_placement_changed), taskList, 0);
 
     g_signal_connect_object (taskList->screen, "window-opened",
                              G_CALLBACK (on_window_opened), taskList, 0);
diff --git a/windowpicker/src/wp-applet.c b/windowpicker/src/wp-applet.c
index e797e99bd..33bc7629f 100644
--- a/windowpicker/src/wp-applet.c
+++ b/windowpicker/src/wp-applet.c
@@ -43,7 +43,7 @@
 
 struct _WpApplet
 {
-  PanelApplet  parent;
+  GpApplet     parent;
 
   GSettings   *settings;
 
@@ -68,7 +68,7 @@ enum
 
 static GParamSpec *properties[LAST_PROP] = { NULL };
 
-G_DEFINE_TYPE (WpApplet, wp_applet, PANEL_TYPE_APPLET)
+G_DEFINE_TYPE (WpApplet, wp_applet, GP_TYPE_APPLET)
 
 static void
 wp_about_dialog_response_cb (GtkDialog *dialog,
@@ -146,28 +146,18 @@ display_prefs_dialog (GSimpleAction *action,
 
 static const GActionEntry menu_actions[] = {
   { "preferences", display_prefs_dialog },
-  { "about",       display_about_dialog }
+  { "about",       display_about_dialog },
+  { NULL }
 };
 
 static void
-wp_applet_setup_menu (PanelApplet *applet)
+wp_applet_setup_menu (GpApplet *applet)
 {
-  GSimpleActionGroup *action_group;
   const gchar *resource_name;
 
-  action_group = g_simple_action_group_new ();
   resource_name = GRESOURCE "wp-menu.xml";
 
-  g_action_map_add_action_entries (G_ACTION_MAP (action_group), menu_actions,
-                                   G_N_ELEMENTS (menu_actions), applet);
-
-  panel_applet_setup_menu_from_resource (applet, resource_name, action_group,
-                                         GETTEXT_PACKAGE);
-
-  gtk_widget_insert_action_group (GTK_WIDGET (applet), "window-picker-applet",
-                                  G_ACTION_GROUP (action_group));
-
-  g_object_unref (action_group);
+  gp_applet_setup_menu_from_resource (applet, resource_name, menu_actions);
 }
 
 static void
@@ -182,9 +172,9 @@ wp_applet_setup_list (WpApplet *applet)
 static void
 wp_applet_setup_title (WpApplet *applet)
 {
-  PanelApplet *panel_applet;
+  GpApplet *panel_applet;
 
-  panel_applet = PANEL_APPLET (applet);
+  panel_applet = GP_APPLET (applet);
 
   applet->title = wp_task_title_new (TITLE_BUTTON_SPACE);
 
@@ -192,7 +182,7 @@ wp_applet_setup_title (WpApplet *applet)
                           applet->title, "orientation",
                           G_BINDING_DEFAULT);
 
-  g_object_bind_property (panel_applet, "orient",
+  g_object_bind_property (panel_applet, "orientation",
                           applet->title, "orient",
                           G_BINDING_DEFAULT);
 
@@ -201,18 +191,22 @@ wp_applet_setup_title (WpApplet *applet)
 }
 
 static void
-wp_applet_load (PanelApplet *panel_applet)
+wp_applet_contructed (GObject *object)
 {
   WpApplet *applet;
+  GpApplet *gp_applet;
 
-  applet = WP_APPLET (panel_applet);
+  G_OBJECT_CLASS (wp_applet_parent_class)->constructed (object);
+
+  applet = WP_APPLET (object);
+  gp_applet = GP_APPLET (object);
 
   wp_applet_setup_list (applet);
   wp_applet_setup_title (applet);
 
-  wp_applet_setup_menu (panel_applet);
+  wp_applet_setup_menu (gp_applet);
 
-  applet->settings = panel_applet_settings_new (panel_applet, SETTINGS_SCHEMA);
+  applet->settings = gp_applet_settings_new (gp_applet, SETTINGS_SCHEMA);
 
   g_settings_bind (applet->settings, KEY_SHOW_ALL_WINDOWS,
                    applet, KEY_SHOW_ALL_WINDOWS, G_SETTINGS_BIND_GET);
@@ -231,33 +225,12 @@ wp_applet_load (PanelApplet *panel_applet)
   gtk_widget_show_all (GTK_WIDGET (applet));
 }
 
-static gboolean
-wp_applet_factory (PanelApplet *applet,
-                   const gchar *iid,
-                   gpointer     data)
-{
-  static gboolean client_type_registered = FALSE;
-
-  if (client_type_registered == FALSE)
-    {
-      wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
-      client_type_registered = TRUE;
-    }
-
-  if (g_strcmp0 (iid, "WindowPicker") != 0)
-    return FALSE;
-
-  wp_applet_load (applet);
-
-  return TRUE;
-}
-
 static void
 wp_applet_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
   WpApplet *applet;
-  PanelApplet *panel_applet;
+  GpApplet *panel_applet;
   GtkOrientation orientation;
   gint size_hints[2];
   gint size;
@@ -265,9 +238,9 @@ wp_applet_size_allocate (GtkWidget     *widget,
   GTK_WIDGET_CLASS (wp_applet_parent_class)->size_allocate (widget, allocation);
 
   applet = WP_APPLET (widget);
-  panel_applet = PANEL_APPLET (widget);
+  panel_applet = GP_APPLET (widget);
 
-  orientation = panel_applet_get_gtk_orientation (panel_applet);
+  orientation = gp_applet_get_orientation (panel_applet);
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     gtk_widget_get_preferred_width (applet->tasks, NULL, &size);
@@ -290,7 +263,7 @@ wp_applet_size_allocate (GtkWidget     *widget,
       size_hints[0] += size;
     }
 
-  panel_applet_set_size_hints (panel_applet, size_hints, 2, 0);
+  gp_applet_set_size_hints (panel_applet, size_hints, 2, 0);
 }
 
 static void
@@ -360,14 +333,13 @@ wp_applet_get_property (GObject    *object,
 }
 
 static void
-wp_applet_change_orient (PanelApplet       *panel_applet,
-                         PanelAppletOrient  orient)
+wp_applet_placement_changed (GpApplet        *panel_applet,
+                             GtkOrientation   orientation,
+                             GtkPositionType  position)
 {
   WpApplet *applet;
-  GtkOrientation orientation;
 
   applet = WP_APPLET (panel_applet);
-  orientation = panel_applet_get_gtk_orientation (panel_applet);
 
   gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->container),
                                   orientation);
@@ -391,19 +363,20 @@ wp_applet_class_init (WpAppletClass *applet_class)
 {
   GObjectClass *object_class;
   GtkWidgetClass *widget_class;
-  PanelAppletClass *panel_applet_class;
+  GpAppletClass *panel_applet_class;
 
   object_class = G_OBJECT_CLASS (applet_class);
   widget_class = GTK_WIDGET_CLASS (applet_class);
-  panel_applet_class = PANEL_APPLET_CLASS (applet_class);
+  panel_applet_class = GP_APPLET_CLASS (applet_class);
 
   widget_class->size_allocate = wp_applet_size_allocate;
 
   object_class->dispose = wp_applet_dispose;
   object_class->set_property = wp_applet_set_property;
   object_class->get_property = wp_applet_get_property;
+  object_class->constructed = wp_applet_contructed;
 
-  panel_applet_class->change_orient = wp_applet_change_orient;
+  panel_applet_class->placement_changed = wp_applet_placement_changed;
 
   properties[PROP_SHOW_ALL_WINDOWS] =
     g_param_spec_boolean ("show-all-windows",
@@ -425,17 +398,17 @@ wp_applet_class_init (WpAppletClass *applet_class)
 static void
 wp_applet_init (WpApplet *applet)
 {
-  PanelApplet *panel_applet;
-  PanelAppletFlags flags;
+  GpApplet *panel_applet;
+  GpAppletFlags flags;
   GtkOrientation orientation;
 
-  panel_applet = PANEL_APPLET (applet);
+  panel_applet = GP_APPLET (applet);
 
-  flags = PANEL_APPLET_EXPAND_MINOR | PANEL_APPLET_HAS_HANDLE |
-          PANEL_APPLET_EXPAND_MAJOR;
-  orientation = panel_applet_get_gtk_orientation (panel_applet);
+  flags = GP_APPLET_FLAGS_EXPAND_MINOR | GP_APPLET_FLAGS_HAS_HANDLE |
+          GP_APPLET_FLAGS_EXPAND_MAJOR;
+  orientation = gp_applet_get_orientation (panel_applet);
 
-  panel_applet_set_flags (panel_applet, flags);
+  gp_applet_set_flags (panel_applet, flags);
 
   applet->container = gtk_box_new (orientation, CONTAINER_SPACING);
   gtk_container_add (GTK_CONTAINER (applet), applet->container);
@@ -458,6 +431,3 @@ wp_applet_get_icons_greyscale (WpApplet *applet)
 {
   return applet->icons_greyscale;
 }
-
-PANEL_APPLET_IN_PROCESS_FACTORY ("WindowPickerFactory", WP_TYPE_APPLET,
-                                 wp_applet_factory, NULL);
diff --git a/windowpicker/src/wp-applet.h b/windowpicker/src/wp-applet.h
index feac05aee..3803e1812 100644
--- a/windowpicker/src/wp-applet.h
+++ b/windowpicker/src/wp-applet.h
@@ -23,26 +23,14 @@
 #ifndef WP_APPLET_H
 #define WP_APPLET_H
 
-#include <panel-applet.h>
+#include <glib-object.h>
+#include <libgnome-panel/gp-applet.h>
 
 G_BEGIN_DECLS
 
-#define WP_TYPE_APPLET         (wp_applet_get_type ())
-#define WP_APPLET(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), WP_TYPE_APPLET, WpApplet))
-#define WP_APPLET_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c),    WP_TYPE_APPLET, WpAppletClass))
-#define WP_IS_APPLET(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), WP_TYPE_APPLET))
-#define WP_IS_APPLET_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),    WP_TYPE_APPLET))
-#define WP_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o),   WP_TYPE_APPLET, WpAppletClass))
+#define WP_TYPE_APPLET (wp_applet_get_type ())
 
-typedef struct _WpApplet      WpApplet;
-typedef struct _WpAppletClass WpAppletClass;
-
-struct _WpAppletClass
-{
-  PanelAppletClass parent_class;
-};
-
-GType      wp_applet_get_type             (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (WpApplet, wp_applet, WP, APPLET, GpApplet)
 
 GtkWidget *wp_applet_get_tasks            (WpApplet *applet);
 gboolean   wp_applet_get_show_all_windows (WpApplet *applet);
diff --git a/windowpicker/src/wp-menu.xml b/windowpicker/src/wp-menu.xml
index 227f5a9aa..f030973c6 100644
--- a/windowpicker/src/wp-menu.xml
+++ b/windowpicker/src/wp-menu.xml
@@ -1,10 +1,14 @@
-<section>
-       <item>
-               <attribute name="label" translatable="yes">_Preferences</attribute>
-               <attribute name="action">window-picker-applet.preferences</attribute>
-       </item>
-       <item>
-               <attribute name="label" translatable="yes">_About</attribute>
-               <attribute name="action">window-picker-applet.about</attribute>
-       </item>
-</section>
+<interface>
+  <menu id="window-picker-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">window-picker.preferences</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About</attribute>
+        <attribute name="action">window-picker.about</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
diff --git a/windowpicker/src/wp-module.c b/windowpicker/src/wp-module.c
new file mode 100644
index 000000000..b3206a181
--- /dev/null
+++ b/windowpicker/src/wp-module.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2020 Sebastian Geiger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <libgnome-panel/gp-module.h>
+
+#include "wp-applet.h"
+
+static GpAppletInfo *
+get_applet_info (const gchar *id)
+{
+  const gchar *name;
+  const gchar *description;
+  const gchar *icon;
+  GpAppletInfo *info;
+
+  name = _("Window Picker");
+  description = _("Shows a list of icons for the open windows.");
+  icon = "preferences-system-windows";
+
+  info = gp_applet_info_new (wp_applet_get_type, name, description, icon);
+
+  return info;
+}
+
+static const gchar *
+get_applet_id_from_iid (const gchar *iid)
+{
+  if (g_strcmp0 (iid, "WindowPickerFactory::WindowPicker") == 0)
+    return "window-picker";
+
+  return NULL;
+}
+
+void
+gp_module_load (GpModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  gp_module_set_gettext_domain (module, GETTEXT_PACKAGE);
+
+  gp_module_set_abi_version (module, GP_MODULE_ABI_VERSION);
+
+  gp_module_set_id (module, "org.gnome.gnome-applets.window-picker");
+  gp_module_set_version (module, PACKAGE_VERSION);
+
+  gp_module_set_applet_ids (module, "window-picker", NULL);
+
+  gp_module_set_get_applet_info (module, get_applet_info);
+  gp_module_set_compatibility (module, get_applet_id_from_iid);
+}
diff --git a/windowpicker/src/wp-task-title.c b/windowpicker/src/wp-task-title.c
index b4bbdcc9a..498fc0070 100644
--- a/windowpicker/src/wp-task-title.c
+++ b/windowpicker/src/wp-task-title.c
@@ -26,7 +26,7 @@
 #include <glib/gi18n-lib.h>
 #include <gio/gio.h>
 #include <libwnck/libwnck.h>
-#include <panel-applet.h>
+#include <libgnome-panel/gp-applet.h>
 
 #include "wp-task-title.h"
 
@@ -43,7 +43,7 @@ struct _WpTaskTitle
 
   gboolean           show_application_title;
   gboolean           show_home_title;
-  PanelAppletOrient  applet_orient;
+  GtkOrientation     orientation;
 
   WnckWindow        *active_window;
   GDBusProxy        *session_proxy;
@@ -342,8 +342,7 @@ update_label_rotation (WpTaskTitle *title)
 {
   gdouble angle;
 
-  if (title->applet_orient == PANEL_APPLET_ORIENT_RIGHT ||
-      title->applet_orient == PANEL_APPLET_ORIENT_LEFT)
+  if (title->orientation == GTK_ORIENTATION_VERTICAL)
     angle = 270;
   else
     angle = 0;
@@ -378,7 +377,7 @@ wp_task_title_set_property (GObject      *object,
   WpTaskTitle *title;
   gboolean show_application_title;
   gboolean show_home_title;
-  PanelAppletOrient orient;
+  GtkOrientation orientation;
 
   title = WP_TASK_TITLE (object);
 
@@ -405,11 +404,11 @@ wp_task_title_set_property (GObject      *object,
         break;
 
       case PROP_APPLET_ORIENT:
-        orient = (PanelAppletOrient) g_value_get_uint (value);
+        orientation = g_value_get_enum (value);
 
-        if (title->applet_orient != orient)
+        if (title->orientation != orientation)
           {
-            title->applet_orient = orient;
+            title->orientation = orientation;
             update_label_rotation (title);
           }
         break;
@@ -459,12 +458,11 @@ wp_task_title_class_init (WpTaskTitleClass *title_class)
                           G_PARAM_WRITABLE);
 
   properties[PROP_APPLET_ORIENT] =
-    g_param_spec_uint ("orient",
+    g_param_spec_enum ("orient",
                        "Orient",
                        "Panel Applet Orientation",
-                       PANEL_APPLET_ORIENT_FIRST,
-                       PANEL_APPLET_ORIENT_LAST,
-                       PANEL_APPLET_ORIENT_UP,
+                       GTK_TYPE_ORIENTATION,
+                       GTK_ORIENTATION_HORIZONTAL,
                        G_PARAM_WRITABLE);
 
   g_object_class_install_properties (object_class, LAST_PROP, properties);


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