[anjuta] glade: Fix with latest glade3 master changes and fix undo/redo and save ui updates



commit 4469e1df0376c328167b738878be4e8664e171af
Author: Johannes Schmid <jhs gnome org>
Date:   Thu Jan 13 00:44:30 2011 +0100

    glade: Fix with latest glade3 master changes and fix undo/redo and save ui updates

 plugins/glade/anjuta-design-document.c |   20 +++++++++---
 plugins/glade/plugin.c                 |   50 ++++++++++++++++----------------
 2 files changed, 40 insertions(+), 30 deletions(-)
---
diff --git a/plugins/glade/anjuta-design-document.c b/plugins/glade/anjuta-design-document.c
index 0eaec96..a3e3454 100644
--- a/plugins/glade/anjuta-design-document.c
+++ b/plugins/glade/anjuta-design-document.c
@@ -44,9 +44,16 @@ struct _AnjutaDesignDocumentPrivate
 	(G_TYPE_INSTANCE_GET_PRIVATE ((o), ANJUTA_TYPE_DESIGN_DOCUMENT, AnjutaDesignDocumentPrivate))
 
 static void
+on_project_changed (GladeProject* project, GladeCommand* command, gboolean forward, AnjutaDesignDocument* doc)
+{
+	g_signal_emit_by_name (doc, "update-save-ui", NULL);
+	g_signal_emit_by_name (doc, "update-ui", NULL);
+}
+
+static void
 anjuta_design_document_instance_init (AnjutaDesignDocument *object)
 {
-	
+
 }
 
 static void
@@ -102,10 +109,13 @@ anjuta_design_document_class_init (AnjutaDesignDocumentClass *klass)
 GtkWidget*
 anjuta_design_document_new (GladePlugin* glade_plugin, GladeProject* project)
 {
-	return GTK_WIDGET(g_object_new(ANJUTA_TYPE_DESIGN_DOCUMENT, 
-								   "plugin", glade_plugin,
-								   "project", project,
-								   NULL));
+	GObject* doc = g_object_new(ANJUTA_TYPE_DESIGN_DOCUMENT, 
+	                            "plugin", glade_plugin,
+	                            "project", project,
+	                            NULL);
+	g_signal_connect (project, "changed", G_CALLBACK (on_project_changed), doc);
+
+	return GTK_WIDGET (doc);
 }
 
 static void ifile_open(IAnjutaFile* ifile, GFile* file, GError **e)
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index a7861a9..e1bc9a5 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -373,36 +373,36 @@ activate_plugin (AnjutaPlugin *plugin)
 
 	register_stock_icons (plugin);
 
+	anjuta_status_busy_push (status);
+	anjuta_status_set (status, "%s", _("Loading Gladeâ?¦"));
+	
+	priv->app = glade_app_get ();
 	if (!priv->app)
 	{
-		anjuta_status_busy_push (status);
-		anjuta_status_set (status, "%s", _("Loading Gladeâ?¦"));
+		priv->app = glade_app_new ();
+	}
 
-		priv->app = glade_app_get ();
+	glade_app_set_window (GTK_WIDGET (ANJUTA_PLUGIN(plugin)->shell));
 
-		glade_app_set_window (GTK_WIDGET (ANJUTA_PLUGIN(plugin)->shell));
-		glade_app_set_transient_parent (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell));
-		
-		priv->inspector = glade_inspector_new ();
+	priv->inspector = glade_inspector_new ();
 
-		g_signal_connect (priv->inspector, "item-activated",
-		                  G_CALLBACK (inspector_item_activated_cb),
-		                  plugin);
+	g_signal_connect (priv->inspector, "item-activated",
+	                  G_CALLBACK (inspector_item_activated_cb),
+	                  plugin);
 
-		priv->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
+	priv->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
 
-		priv->editor = GTK_WIDGET(glade_editor_new());
-		priv->palette = glade_palette_new();
+	priv->editor = GTK_WIDGET(glade_editor_new());
+	priv->palette = glade_palette_new();
 
-		gtk_paned_add1 (GTK_PANED(priv->paned), priv->inspector);
-		gtk_paned_add2 (GTK_PANED(priv->paned), priv->editor);
+	gtk_paned_add1 (GTK_PANED(priv->paned), priv->inspector);
+	gtk_paned_add2 (GTK_PANED(priv->paned), priv->editor);
 
-		gtk_widget_set_size_request (priv->inspector, -1, 300);
-		
-		gtk_widget_show_all (priv->paned);
+	gtk_widget_set_size_request (priv->inspector, -1, 300);
 
-		anjuta_status_busy_pop (status);
-	}
+	gtk_widget_show_all (priv->paned);
+
+	anjuta_status_busy_pop (status);
 
 	g_signal_connect(plugin->shell, "destroy",
 	                 G_CALLBACK(on_shell_destroy), plugin);
@@ -419,12 +419,12 @@ activate_plugin (AnjutaPlugin *plugin)
 	                         priv->paned,
 	                         "AnjutaGladeTree", _("Widgets"),
 	                         "glade-plugin-widgets",
-	                         ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
+	                         ANJUTA_SHELL_PLACEMENT_RIGHT, NULL);
 	anjuta_shell_add_widget (ANJUTA_PLUGIN (plugin)->shell,
 	                         priv->palette,
 	                         "AnjutaGladePalette", _("Palette"),
 	                         "glade-plugin-palette",
-	                         ANJUTA_SHELL_PLACEMENT_RIGHT, NULL);
+	                         ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
 	/* Connect to save session */
 	g_signal_connect (G_OBJECT (plugin->shell), "save_session",
 	                  G_CALLBACK (on_session_save), plugin);
@@ -611,11 +611,11 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
 static GFile*
 ifile_get_file (IAnjutaFile* ifile, GError** e)
 {
-	/*FIXME: const gchar* path = glade_project_get_path(glade_app_get_project());
+	GladePlugin* plugin = (GladePlugin*) ifile;
+	const gchar* path = 
+		glade_project_get_path(glade_inspector_get_project(GLADE_INSPECTOR (plugin->priv->inspector)));
 	GFile* file = g_file_new_for_path (path);
 	return file;
-	*/
-	return NULL;
 }
 
 static void



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