summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2007-07-24 16:53:38 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2007-07-24 16:53:38 +0000
commitba93bf3734dba6070cdec3345d965ee93fb02dba (patch)
treeae53e7453f9e4b2c0f907db78dd4ae6d89dd179f
parentcfa8ddb4cf1f787c692f07307237e75d3d7a1198 (diff)
downloadglade-ba93bf3734dba6070cdec3345d965ee93fb02dba.tar.gz
Set custom label on the property editor sensitive/insensitive according to
* src/glade-window.c: Set custom label on the property editor sensitive/insensitive according to whether there is a project loaded or not * gladeui/glade-app.c: Unset editor widget and set insensitive when no project is loaded (fixes segfaults from editing widgets that dont exist when project is closed, also looks consistant with the rest of the insensitive UI with no project loaded). svn path=/trunk/; revision=1507
-rw-r--r--ChangeLog10
-rw-r--r--gladeui/glade-app.c11
-rw-r--r--src/glade-window.c19
3 files changed, 36 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 60b4324c..ed5033cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-06-24 Tristan Van Berkom <tvb@gnome.org>
+
+ * src/glade-window.c: Set custom label on the property editor sensitive/insensitive
+ according to whether there is a project loaded or not
+
+ * gladeui/glade-app.c: Unset editor widget and set insensitive when no project is
+ loaded (fixes segfaults from editing widgets that dont exist when project is
+ closed, also looks consistant with the rest of the insensitive UI with no project
+ loaded).
+
2006-06-23 Tristan Van Berkom <tvb@gnome.org>
* NEWS, configure.ac: Rolling 3.3.2
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index 6a44099a..2a704c6a 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -938,8 +938,9 @@ glade_app_add_project (GladeProject *project)
glade_app_set_project (project);
- /* XXX I think the palette should detect this by itself */
+ /* XXX I think the palette & editor should detect this by itself */
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->palette), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (app->priv->editor), TRUE);
}
@@ -960,8 +961,14 @@ glade_app_remove_project (GladeProject *project)
/* If no more projects */
if (app->priv->projects == NULL)
{
- /* XXX I think the palette should detect this. */
+ /* XXX I think the palette & editor should detect this. */
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->palette), FALSE);
+
+ /* set loaded widget to NULL first so that we dont mess
+ * around with sensitivity of the editor children.
+ */
+ glade_editor_load_widget (app->priv->editor, NULL);
+ gtk_widget_set_sensitive (GTK_WIDGET (app->priv->editor), FALSE);
}
else
glade_app_set_project (g_list_last (app->priv->projects)->data);
diff --git a/src/glade-window.c b/src/glade-window.c
index 7bbf4be0..6333635e 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -618,7 +618,9 @@ project_selection_changed_cb (GladeProject *project, GladeWindow *window)
gchar *text;
gint num;
- g_return_if_fail (GLADE_IS_PROJECT (project));
+ /* This is sometimes called with a NULL project (to make the label
+ * insensitive with no projects loaded)
+ */
g_return_if_fail (GLADE_IS_WINDOW (window));
label = window->priv->label;
@@ -627,8 +629,10 @@ project_selection_changed_cb (GladeProject *project, GladeWindow *window)
* the currently active project.
*/
if (glade_app_get_editor() &&
- (project == glade_app_get_project ()))
+ project && (project == glade_app_get_project ()))
{
+ gtk_widget_set_sensitive (GTK_WIDGET (label), TRUE);
+
list = glade_project_selection_get (project);
num = g_list_length (list);
@@ -653,6 +657,13 @@ project_selection_changed_cb (GladeProject *project, GladeWindow *window)
gtk_label_set_text (label, _("Properties"));
}
}
+ else if (glade_app_get_editor ())
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
+ gtk_label_set_text (label, _("Properties"));
+ }
+
+
}
static GladeDesignView *
@@ -1711,6 +1722,8 @@ notebook_tab_added_cb (GtkNotebook *notebook,
refresh_title (window);
+ project_selection_changed_cb (glade_app_get_project (), window);
+
if (window->priv->num_tabs > 0)
gtk_action_group_set_sensitive (window->priv->project_actions, TRUE);
@@ -1750,6 +1763,8 @@ notebook_tab_removed_cb (GtkNotebook *notebook,
refresh_title (window);
+ project_selection_changed_cb (glade_app_get_project (), window);
+
if (window->priv->active_view)
set_sensitivity_according_to_project (window, glade_design_view_get_project (window->priv->active_view));
else