[anjuta] project-manager: Fix new project manager combo box when the glade plugin is loaded



commit 852868ed1d79e4939540aa5b330eca4b89cbe13e
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Thu Feb 2 22:00:33 2012 +0100

    project-manager: Fix new project manager combo box when the glade plugin is loaded
    
    The new AnjutaPmChooserButton widget is defined in the project manager plugin not in libanjuta.
    Anjuta glade library doesn't include this widget and glade creates a dummy widget for it (using parent attribute).
    But when the glade plugin is loaded in Anjuta, if it creates this dummy widget, the project manager cannot create the real widget later.
    So the project manager plugin must be loaded and create the new widget type before the glade plugin.

 plugins/glade/anjuta-glade.plugin.in      |    1 +
 plugins/project-manager/plugin.c          |    6 ++++--
 plugins/project-manager/project-chooser.c |   21 ++++++++++++++++++---
 plugins/project-manager/project-chooser.h |    3 ++-
 4 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/plugins/glade/anjuta-glade.plugin.in b/plugins/glade/anjuta-glade.plugin.in
index 3caf462..e573cf6 100644
--- a/plugins/glade/anjuta-glade.plugin.in
+++ b/plugins/glade/anjuta-glade.plugin.in
@@ -4,6 +4,7 @@ _Description=Glade Plugin for Anjuta.
 Location=anjuta-glade:GladePlugin
 Icon=anjuta-glade-plugin-48.png
 Interfaces=IAnjutaFile,IAnjutaWizard
+Dependencies=anjuta-project-manager:ProjectManagerPlugin
 UserActivatable=no
 
 [File Loader]
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index e1524ba..150ba8c 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -35,6 +35,7 @@
 
 #include "project-util.h"
 #include "dialogs.h"
+#include "project-chooser.h"
 
 #include "plugin.h"
 
@@ -2422,8 +2423,9 @@ ifile_iface_init(IAnjutaFileIface *iface)
 }
 
 ANJUTA_PLUGIN_BEGIN (ProjectManagerPlugin, project_manager_plugin);
-ANJUTA_PLUGIN_ADD_INTERFACE (iproject_manager, IANJUTA_TYPE_PROJECT_MANAGER);
-ANJUTA_PLUGIN_ADD_INTERFACE (ifile, IANJUTA_TYPE_FILE);
+	ANJUTA_PLUGIN_ADD_INTERFACE (iproject_manager, IANJUTA_TYPE_PROJECT_MANAGER);
+	ANJUTA_PLUGIN_ADD_INTERFACE (ifile, IANJUTA_TYPE_FILE);
+	anjuta_pm_chooser_button_register (module);
 ANJUTA_PLUGIN_END;
 
 ANJUTA_SIMPLE_PLUGIN (ProjectManagerPlugin, project_manager_plugin);
diff --git a/plugins/project-manager/project-chooser.c b/plugins/project-manager/project-chooser.c
index d45c52b..3cd381e 100644
--- a/plugins/project-manager/project-chooser.c
+++ b/plugins/project-manager/project-chooser.c
@@ -49,9 +49,12 @@ struct _AnjutaPmChooserButtonPrivate
 
 static void ianjuta_project_chooser_init (IAnjutaProjectChooserIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (AnjutaPmChooserButton, anjuta_pm_chooser_button, ANJUTA_TYPE_TREE_COMBO_BOX,
-                         G_IMPLEMENT_INTERFACE (IANJUTA_TYPE_PROJECT_CHOOSER,
-                                                ianjuta_project_chooser_init))
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (AnjutaPmChooserButton,
+                                anjuta_pm_chooser_button,
+                                ANJUTA_TYPE_TREE_COMBO_BOX,
+                                0,
+                                G_IMPLEMENT_INTERFACE (IANJUTA_TYPE_PROJECT_CHOOSER,
+                                                       ianjuta_project_chooser_init));
 
 /* Helpers functions
  *---------------------------------------------------------------------------*/
@@ -429,5 +432,17 @@ anjuta_pm_chooser_button_class_init (AnjutaPmChooserButtonClass * klass)
 	object_class = (GObjectClass *)klass;
 	object_class->constructor = anjuta_pm_chooser_button_constructor;
 
+	g_message ("anjuta_pm_chooser_button_class_init");
 	g_type_class_add_private (klass, sizeof (AnjutaPmChooserButtonPrivate));
 }
+
+static void
+anjuta_pm_chooser_button_class_finalize (AnjutaPmChooserButtonClass * klass)
+{
+}
+
+void
+anjuta_pm_chooser_button_register (GTypeModule *module)
+{
+	anjuta_pm_chooser_button_register_type (module);
+}
diff --git a/plugins/project-manager/project-chooser.h b/plugins/project-manager/project-chooser.h
index c3d3657..70af996 100644
--- a/plugins/project-manager/project-chooser.h
+++ b/plugins/project-manager/project-chooser.h
@@ -58,9 +58,10 @@ struct _AnjutaPmChooserButtonClass
 
 GType			anjuta_pm_chooser_button_get_type (void) G_GNUC_CONST;
 
-
 GtkWidget *		anjuta_pm_chooser_button_new (void);
 
+void			anjuta_pm_chooser_button_register (GTypeModule *module);
+
 
 G_END_DECLS
 



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