summaryrefslogtreecommitdiff
path: root/gladeui/glade-inspector.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 01:23:47 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 01:25:02 +0900
commit2712e27243157356618d5aa718e7dba9ca08c49d (patch)
treef1ac8815d49c71a711a72cc3d527f42d76060964 /gladeui/glade-inspector.c
parentb65dae9daa0f8e0eb96ad8f0f9d8f1e975a1bbf8 (diff)
downloadglade-2712e27243157356618d5aa718e7dba9ca08c49d.tar.gz
* gladeui/glade-inspector.c:
- Avoid changing project selection when selection is cleared, selection get's cleared when the user changes a widget name and a filter is applied (removing the entry from the filtered model), avoiding syncing project selection avoids making the editor disappear when the user changes a widget name (fixes bug 604322). - Also plugged some leaked objects retrieved by gtk_tree_model_get(). * gladeui/glade-editor-table.c: Fire a warning when entry is edited with no widget loaded, also change the ->loading flag strategy for blocking signal emission instead.
Diffstat (limited to 'gladeui/glade-inspector.c')
-rw-r--r--gladeui/glade-inspector.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 5daaec5f..6dff1682 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -578,30 +578,50 @@ static void
selection_foreach_func (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
- gpointer data)
+ GList **selection)
{
GObject* object;
gtk_tree_model_get (model, iter, GLADE_PROJECT_MODEL_COLUMN_OBJECT, &object, -1);
if (object)
- glade_app_selection_add (object, FALSE);
+ {
+ *selection = g_list_prepend (*selection, object);
+ g_object_unref (object);
+ }
}
static void
selection_changed_cb (GtkTreeSelection *selection,
GladeInspector *inspector)
{
+ GList *sel = NULL, *l;
+
+ gtk_tree_selection_selected_foreach (selection,
+ (GtkTreeSelectionForeachFunc)selection_foreach_func,
+ &sel);
+
+ /* We dont modify the project selection for a change that
+ * leaves us with no selection.
+ *
+ * This is typically because the user is changing the name
+ * of a widget and the filter is active, the new name causes
+ * the row to go out of the model and the selection to be
+ * cleared, if we clear the selection we remove the editor
+ * that the user is trying to type into.
+ */
+ if (!sel)
+ return;
+
g_signal_handlers_block_by_func (inspector->priv->project,
G_CALLBACK (project_selection_changed_cb),
inspector);
-
+
glade_app_selection_clear (FALSE);
-
- gtk_tree_selection_selected_foreach (selection,
- selection_foreach_func,
- inspector);
+ for (l = sel; l; l = l->next)
+ glade_app_selection_add (G_OBJECT (l->data), FALSE);
glade_app_selection_changed ();
+ g_list_free (sel);
g_signal_handlers_unblock_by_func (inspector->priv->project,
G_CALLBACK (project_selection_changed_cb),
@@ -648,7 +668,8 @@ button_press_cb (GtkWidget *widget,
GLADE_PROJECT_MODEL_COLUMN_OBJECT, &object, -1);
if (widget != NULL)
- glade_popup_widget_pop (glade_widget_get_from_gobject (object), event, TRUE);
+ glade_popup_widget_pop (glade_widget_get_from_gobject (object),
+ event, TRUE);
else
glade_popup_simple_pop (event);
@@ -864,6 +885,7 @@ glade_inspector_get_selected_items (GladeInspector *inspector)
gtk_tree_model_get (GTK_TREE_MODEL (priv->project), &iter,
GLADE_PROJECT_MODEL_COLUMN_OBJECT, &object, -1);
+ g_object_unref (object);
items = g_list_prepend (items, glade_widget_get_from_gobject (object));
}