[gnome-panel] libgnome-panel: add compatibility function



commit a0e30a72f77ed65478643b662bae855e3cb27df5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Nov 10 17:56:13 2016 +0200

    libgnome-panel: add compatibility function

 applets/clock/clock-module.c          |   10 ++++++++++
 applets/fish/fish-module.c            |   10 ++++++++++
 applets/notification-area/na-module.c |   10 ++++++++++
 applets/status-notifier/sn-module.c   |    1 +
 applets/wncklet/wncklet-module.c      |   16 ++++++++++++++++
 libgnome-panel/gp-module.h            |   29 ++++++++++++++++++++++++-----
 6 files changed, 71 insertions(+), 5 deletions(-)
---
diff --git a/applets/clock/clock-module.c b/applets/clock/clock-module.c
index ac7640a..392b030 100644
--- a/applets/clock/clock-module.c
+++ b/applets/clock/clock-module.c
@@ -58,6 +58,15 @@ clock_get_applet_type (const gchar *applet)
   return CLOCK_TYPE_APPLET;
 }
 
+static const gchar *
+clock_get_applet_from_iid (const gchar *iid)
+{
+  if (g_strcmp0 (iid, "ClockAppletFactory::ClockApplet") == 0)
+    return "clock";
+
+  return NULL;
+}
+
 guint32
 gp_module_get_abi_version (void)
 {
@@ -71,6 +80,7 @@ gp_module_get_vtable (GpModuleVTable *vtable)
     clock_get_module_info,
     clock_get_applet_info,
     clock_get_applet_type,
+    clock_get_applet_from_iid,
     NULL
   };
 }
diff --git a/applets/fish/fish-module.c b/applets/fish/fish-module.c
index 9dccb31..5c6a37b 100644
--- a/applets/fish/fish-module.c
+++ b/applets/fish/fish-module.c
@@ -58,6 +58,15 @@ fish_get_applet_type (const gchar *applet)
   return FISH_TYPE_APPLET;
 }
 
+static const gchar *
+fish_get_applet_from_iid (const gchar *iid)
+{
+  if (g_strcmp0 (iid, "FishAppletFactory::FishApplet") == 0)
+    return "fish";
+
+  return NULL;
+}
+
 guint32
 gp_module_get_abi_version (void)
 {
@@ -71,6 +80,7 @@ gp_module_get_vtable (GpModuleVTable *vtable)
     fish_get_module_info,
     fish_get_applet_info,
     fish_get_applet_type,
+    fish_get_applet_from_iid,
     NULL
   };
 }
diff --git a/applets/notification-area/na-module.c b/applets/notification-area/na-module.c
index f3a7a80..e9890b0 100644
--- a/applets/notification-area/na-module.c
+++ b/applets/notification-area/na-module.c
@@ -58,6 +58,15 @@ na_get_applet_type (const gchar *applet)
   return NA_TYPE_APPLET;
 }
 
+static const gchar *
+na_get_applet_from_iid (const gchar *iid)
+{
+  if (g_strcmp0 (iid, "NotificationAreaAppletFactory::NotificationArea") == 0)
+    return "notification-area";
+
+  return NULL;
+}
+
 guint32
 gp_module_get_abi_version (void)
 {
@@ -71,6 +80,7 @@ gp_module_get_vtable (GpModuleVTable *vtable)
     na_get_module_info,
     na_get_applet_info,
     na_get_applet_type,
+    na_get_applet_from_iid,
     NULL
   };
 }
diff --git a/applets/status-notifier/sn-module.c b/applets/status-notifier/sn-module.c
index dae28b2..751352a 100644
--- a/applets/status-notifier/sn-module.c
+++ b/applets/status-notifier/sn-module.c
@@ -70,6 +70,7 @@ gp_module_get_vtable (GpModuleVTable *vtable)
     sn_get_module_info,
     sn_get_applet_info,
     sn_get_applet_type,
+    NULL,
     NULL
   };
 }
diff --git a/applets/wncklet/wncklet-module.c b/applets/wncklet/wncklet-module.c
index 7f67565..b206893 100644
--- a/applets/wncklet/wncklet-module.c
+++ b/applets/wncklet/wncklet-module.c
@@ -116,6 +116,21 @@ wncklet_get_applet_type (const gchar *applet)
   return G_TYPE_NONE;
 }
 
+static const gchar *
+wncklet_get_applet_from_iid (const gchar *iid)
+{
+  if (g_strcmp0 (iid, "WnckletFactory::ShowDesktopApplet") == 0)
+    return "show-desktop";
+  else if (g_strcmp0 (iid, "WnckletFactory::WindowListApplet") == 0)
+    return "window-list";
+  else if (g_strcmp0 (iid, "WnckletFactory::WindowMenuApplet") == 0)
+    return "window-menu";
+  else if (g_strcmp0 (iid, "WnckletFactory::WorkspaceSwitcherApplet") == 0)
+    return "workspace-switcher";
+
+  return NULL;
+}
+
 guint32
 gp_module_get_abi_version (void)
 {
@@ -129,6 +144,7 @@ gp_module_get_vtable (GpModuleVTable *vtable)
     wncklet_get_module_info,
     wncklet_get_applet_info,
     wncklet_get_applet_type,
+    wncklet_get_applet_from_iid,
     NULL
   };
 }
diff --git a/libgnome-panel/gp-module.h b/libgnome-panel/gp-module.h
index d0f8d9f..47f633b 100644
--- a/libgnome-panel/gp-module.h
+++ b/libgnome-panel/gp-module.h
@@ -91,6 +91,21 @@ G_BEGIN_DECLS
  *   return G_TYPE_NONE;
  * }
  *
+ * static const gchar *
+ * example_get_applet_from_iid (const gchar *iid)
+ * {
+ *   if (g_strcmp0 (iid, "ExampleAppletFactory::Example1Applet") == 0)
+ *     {
+ *       return "example1";
+ *     }
+ *   else if (g_strcmp0 (iid, "ExampleAppletFactory::Example2Applet") == 0)
+ *     {
+ *       return "example2";
+ *     }
+ *
+ *   return NULL;
+ * }
+ *
  * static gboolean
  * example_setup_about (GtkAboutDialog *dialog,
  *                      const gchar    *applet)
@@ -120,6 +135,7 @@ G_BEGIN_DECLS
  *     example_get_module_info,
  *     example_get_applet_info,
  *     example_get_applet_type,
+ *     example_get_applet_from_iid, // or NULL if not needed
  *     example_setup_about // or NULL if not needed
  *   };
  * }
@@ -138,6 +154,7 @@ G_BEGIN_DECLS
  * @get_module_info: (transfer full): returns a #GpModuleInfo
  * @get_applet_info: (transfer full): returns a #GpAppletInfo.
  * @get_applet_type: returns a #GType.
+ * @get_applet_from_iid: Compatibility function.
  * @setup_about: Function for setting up about dialog.
  *
  * The #GpModuleVTable provides the functions required by the #GpModule.
@@ -145,14 +162,16 @@ G_BEGIN_DECLS
 typedef struct _GpModuleVTable GpModuleVTable;
 struct _GpModuleVTable
 {
-  GpModuleInfo * (* get_module_info) (void);
+  GpModuleInfo * (* get_module_info)     (void);
+
+  GpAppletInfo * (* get_applet_info)     (const gchar    *applet);
 
-  GpAppletInfo * (* get_applet_info) (const gchar    *applet);
+  GType          (* get_applet_type)     (const gchar    *applet);
 
-  GType          (* get_applet_type) (const gchar    *applet);
+  const gchar  * (* get_applet_from_iid) (const gchar    *iid);
 
-  gboolean       (* setup_about)     (GtkAboutDialog *dialog,
-                                      const gchar    *applet);
+  gboolean       (* setup_about)         (GtkAboutDialog *dialog,
+                                          const gchar    *applet);
 };
 
 /**


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