anjuta r4801 - in trunk: . plugins/glade



Author: jhs
Date: Wed Feb 25 21:57:21 2009
New Revision: 4801
URL: http://svn.gnome.org/viewvc/anjuta?rev=4801&view=rev

Log:
2009-02-25  Johannes Schmid  <jhs gnome org>

	* plugins/glade/plugin.c (check_deactivation),
	(on_document_destroy), (ifile_open):
	Deactivate plugin if opening of project fails and no other projects are open

Modified:
   trunk/ChangeLog
   trunk/plugins/glade/plugin.c

Modified: trunk/plugins/glade/plugin.c
==============================================================================
--- trunk/plugins/glade/plugin.c	(original)
+++ trunk/plugins/glade/plugin.c	Wed Feb 25 21:57:21 2009
@@ -438,6 +438,14 @@
 }
 
 static void
+check_deactivation (GladePlugin* plugin)
+{
+	GtkTreeModel* model = model = gtk_combo_box_get_model (GTK_COMBO_BOX (plugin->priv->projects_combo));
+	if (!plugin->priv->deactivating && gtk_tree_model_iter_n_children (model, NULL) <= 0)
+		anjuta_plugin_deactivate (ANJUTA_PLUGIN (plugin));
+}
+
+static void
 on_document_destroy (AnjutaDesignDocument* doc, GladePlugin *plugin)
 {
 	GladeProject *project;
@@ -478,8 +486,7 @@
 
 	glade_do_close (plugin, project);
 
-	if (!plugin->priv->deactivating && gtk_tree_model_iter_n_children (model, NULL) <= 0)
-		anjuta_plugin_deactivate (ANJUTA_PLUGIN (plugin));
+	check_deactivation(plugin);
 }
 
 static void
@@ -4656,10 +4663,11 @@
 	GList *glade_obj_node;
 	const gchar *project_name;
 	AnjutaDesignDocument *doc;
+	GladePlugin* plugin = ANJUTA_PLUGIN_GLADE (ifile);
 
 	g_return_if_fail (file != NULL);
 
-	priv = ANJUTA_PLUGIN_GLADE (ifile)->priv;
+	priv = plugin->priv;
 
 	filename = g_file_get_path (file);
 	if (!filename)
@@ -4668,7 +4676,7 @@
 		anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
 								    _("Not local file: %s"), uri);
 		g_free (uri);
-		return;
+		check_deactivation(plugin);
 	}
 
 	docman = anjuta_shell_get_interface(ANJUTA_PLUGIN(ifile)->shell, IAnjutaDocumentManager,
@@ -4678,7 +4686,7 @@
 	{
 		project = get_project_from_design_document (doc);
 		glade_app_set_project (project);
-		return;
+		check_deactivation(plugin);
 	}
 
 	project = glade_project_load (filename);
@@ -4689,7 +4697,7 @@
 		anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
 								    _("Could not open %s"), name);
 		g_free (name);
-		return;
+		check_deactivation(plugin);
 	}
 	project_name = glade_project_get_name(project);
 



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