[anjuta] glade: deactivate plugin correctly if loading of file failed
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] glade: deactivate plugin correctly if loading of file failed
- Date: Sun, 16 May 2010 12:38:55 +0000 (UTC)
commit 87307a18a3d6a51392494f831c821734516ac4c1
Author: Johannes Schmid <jhs gnome org>
Date: Fri May 14 13:15:47 2010 +0200
glade: deactivate plugin correctly if loading of file failed
plugins/glade/plugin.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index eb05bf3..f7bb79b 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -387,6 +387,7 @@ activate_plugin (AnjutaPlugin *plugin)
gtk_paned_add1 (GTK_PANED(priv->paned), priv->view_box);
gtk_paned_add2 (GTK_PANED(priv->paned), GTK_WIDGET(glade_app_get_editor()));
+ gtk_widget_set_size_request (priv->view_box, -1, 300);
gtk_widget_show_all (priv->paned);
gtk_notebook_set_scrollable (GTK_NOTEBOOK (glade_app_get_editor ()->notebook),
@@ -528,6 +529,7 @@ gchar* glade_get_filename(GladePlugin *plugin)
static void
ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
{
+ AnjutaPlugin* plugin = ANJUTA_PLUGIN (ifile);
GladePluginPriv *priv;
GladeProject *project;
GtkListStore *store;
@@ -540,6 +542,7 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
g_return_if_fail (file != NULL);
priv = ANJUTA_PLUGIN_GLADE (ifile)->priv;
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->projects_combo)));
filename = g_file_get_path (file);
if (!filename)
@@ -547,6 +550,9 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
gchar* uri = g_file_get_parse_name(file);
anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
_("Not local file: %s"), uri);
+ if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) <= 0)
+ anjuta_plugin_deactivate (ANJUTA_PLUGIN (plugin));
+
g_free (uri);
return;
}
@@ -585,10 +591,11 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
gchar* name = g_file_get_parse_name (file);
anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
_("Could not open %s"), name);
+ if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) <= 0)
+ anjuta_plugin_deactivate (ANJUTA_PLUGIN (plugin));
g_free (name);
return;
}
- store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->projects_combo)));
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, NAME_COL, glade_project_get_name(project),
PROJECT_COL, project, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]