[gnome-todo/wip/gbsneto/plugins: 61/62] activatable: add ::preferences-panel property



commit 1bc51527c590a16628c055decff229964f368240
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jan 14 23:00:23 2016 -0200

    activatable: add ::preferences-panel property
    
    An extension would be able to configure itself
    through the preferences panel, which is handled
    by the plugins dialog.

 plugins/eds/gtd-plugin-eds.c     |   16 ++++++++++++++++
 src/interfaces/gtd-activatable.c |   21 +++++++++++++++++++++
 src/interfaces/gtd-activatable.h |    5 +++++
 3 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/plugins/eds/gtd-plugin-eds.c b/plugins/eds/gtd-plugin-eds.c
index 4d08910..b644128 100644
--- a/plugins/eds/gtd-plugin-eds.c
+++ b/plugins/eds/gtd-plugin-eds.c
@@ -59,6 +59,7 @@ enum
   PROP_0,
   PROP_ACTIVE,
   PROP_OBJECT,
+  PROP_PREFERENCES_PANEL,
   PROP_PROVIDERS,
   PROP_PANELS,
   LAST_PROP
@@ -115,6 +116,12 @@ peas_activatable_iface_init (PeasActivatableInterface *iface)
 /*
  * GtdActivatable interface implementation
  */
+static GtkWidget*
+gtd_plugin_eds_get_preferences_panel (GtdActivatable *activatable)
+{
+  return NULL;
+}
+
 static GList*
 gtd_plugin_eds_get_panels (GtdActivatable *activatable)
 {
@@ -134,6 +141,7 @@ gtd_plugin_eds_get_providers (GtdActivatable *activatable)
 static void
 gtd_activatable_iface_init (GtdActivatableInterface *iface)
 {
+  iface->get_preferences_panel = gtd_plugin_eds_get_preferences_panel;
   iface->get_panels = gtd_plugin_eds_get_panels;
   iface->get_providers = gtd_plugin_eds_get_providers;
 }
@@ -339,6 +347,10 @@ gtd_plugin_eds_get_property (GObject    *object,
       g_value_set_object (value, NULL);
       break;
 
+    case PROP_PREFERENCES_PANEL:
+      g_value_set_object (value, NULL);
+      break;
+
     case PROP_PANELS:
       g_value_set_pointer (value, self->panels);
       break;
@@ -390,6 +402,10 @@ gtd_plugin_eds_class_init (GtdPluginEdsClass *klass)
                                     "panels");
 
   g_object_class_override_property (object_class,
+                                    PROP_PREFERENCES_PANEL,
+                                    "preferences-panel");
+
+  g_object_class_override_property (object_class,
                                     PROP_PROVIDERS,
                                     "providers");
 }
diff --git a/src/interfaces/gtd-activatable.c b/src/interfaces/gtd-activatable.c
index 0ed71fa..5db8c19 100644
--- a/src/interfaces/gtd-activatable.c
+++ b/src/interfaces/gtd-activatable.c
@@ -50,6 +50,18 @@ gtd_activatable_default_init (GtdActivatableInterface *iface)
                                                              G_PARAM_READABLE));
 
   /**
+   * GtdActivatable::preferences-panel:
+   *
+   * The preferences panel of the plugin, or %NULL.
+   */
+  g_object_interface_install_property (iface,
+                                       g_param_spec_object ("preferences-panel",
+                                                            "Preferences panel",
+                                                            "The preferences panel of the plugins",
+                                                            GTK_TYPE_WIDGET,
+                                                            G_PARAM_READABLE));
+
+  /**
    * GtdActivatable::panels:
    *
    * A list of #GtdPanel this plugin carries.
@@ -157,6 +169,15 @@ gtd_activatable_default_init (GtdActivatableInterface *iface)
                                             GTD_TYPE_PROVIDER);
 }
 
+GtkWidget*
+gtd_activatable_get_preferences_panel (GtdActivatable *activatable)
+{
+  g_return_val_if_fail (GTD_IS_ACTIVATABLE (activatable), NULL);
+  g_return_val_if_fail (GTD_ACTIVATABLE_GET_IFACE (activatable)->get_preferences_panel, NULL);
+
+  return GTD_ACTIVATABLE_GET_IFACE (activatable)->get_preferences_panel (activatable);
+}
+
 GList*
 gtd_activatable_get_panels (GtdActivatable *activatable)
 {
diff --git a/src/interfaces/gtd-activatable.h b/src/interfaces/gtd-activatable.h
index 4a14807..b7f45e1 100644
--- a/src/interfaces/gtd-activatable.h
+++ b/src/interfaces/gtd-activatable.h
@@ -20,6 +20,7 @@
 #define GTD_ACTIVATABLE_H
 
 #include <glib.h>
+#include <gtk/gtk.h>
 #include <libpeas/peas.h>
 
 G_BEGIN_DECLS
@@ -32,11 +33,15 @@ struct _GtdActivatableInterface
 {
   PeasActivatableInterface parent;
 
+  GtkWidget*       (*get_preferences_panel)                (GtdActivatable     *activatable);
+
   GList*           (*get_panels)                           (GtdActivatable     *activatable);
 
   GList*           (*get_providers)                        (GtdActivatable     *activatable);
 };
 
+GtkWidget*           gtd_activatable_get_preferences_panel       (GtdActivatable     *activatable);
+
 GList*               gtd_activatable_get_panels                  (GtdActivatable     *activatable);
 
 GList*               gtd_activatable_get_providers               (GtdActivatable     *activatable);


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