[libpeas] Automatically load the PeasGtk typelib when using PeasGtkPluginManager



commit 2546a792f3fa17512a0bfd1a41b07d21ae36a174
Author: Steve Frécinaux <code istique net>
Date:   Mon Jan 17 14:42:31 2011 +0100

    Automatically load the PeasGtk typelib when using PeasGtkPluginManager
    
    PeasGtkPluginManager requires the PeasGtk typelib to work (because it
    uses the PeasGtkConfigurable interface), so we make it so it will load
    it by itself.

 libpeas-gtk/peas-gtk-plugin-manager.c |   11 +++++++++++
 peas-demo/peas-demo.c                 |    2 --
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index 9e2880b..c371f0b 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -27,6 +27,7 @@
 #endif
 
 #include <string.h>
+#include <girepository.h>
 
 #ifdef OS_OSX
 #include <Carbon/Carbon.h>
@@ -361,6 +362,16 @@ peas_gtk_plugin_manager_init (PeasGtkPluginManager *pm)
                                           PEAS_GTK_TYPE_PLUGIN_MANAGER,
                                           PeasGtkPluginManagerPrivate);
 
+  /**
+   * If we are using a PeasGtkPluginManager, we know for sure we will be using
+   * libpeas-gtk, so let's load the typelib for it here.
+   */
+  g_irepository_require (g_irepository_get_default (),
+                         "PeasGtk", "1.0", 0, NULL);
+
+  /**
+   * Let's initialize the widgets of the plugin manager now.
+   */
   pm->priv->engine = g_object_ref (peas_engine_get_default ());
 
   gtk_box_set_spacing (GTK_BOX (pm), 6);
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c
index 6cc615b..b609183 100644
--- a/peas-demo/peas-demo.c
+++ b/peas-demo/peas-demo.c
@@ -118,8 +118,6 @@ main (int    argc,
       g_setenv ("PEAS_PLUGIN_LOADERS_DIR", "../loaders", TRUE);
     }
 
-  g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, NULL);
-
   engine = peas_engine_get_default ();
   plugin_dir = g_build_filename (g_get_user_config_dir (), "peas-demo/plugins", NULL);
   peas_engine_add_search_path (engine, plugin_dir, plugin_dir);



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