[glade] Bug 697926: Signal Editor now initially expands rows which contain handlers
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Bug 697926: Signal Editor now initially expands rows which contain handlers
- Date: Tue, 16 Apr 2013 13:03:57 +0000 (UTC)
commit 8ffd04f962f7fa47479718ccc499b4e4b5cb3651
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Tue Apr 16 22:02:11 2013 +0900
Bug 697926: Signal Editor now initially expands rows which contain handlers
gladeui/glade-signal-editor.c | 48 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
---
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index ebd01d6..7913cd9 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -629,6 +629,13 @@ glade_signal_editor_new ()
return signal_editor;
}
+static gint
+find_adaptor_by_name (GladeWidgetAdaptor *adaptor,
+ const gchar *name)
+{
+ return g_strcmp0 (glade_widget_adaptor_get_name (adaptor), name);
+}
+
/**
* glade_signal_editor_load_widget:
* @editor: a #GladeSignalEditor
@@ -642,8 +649,10 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
GladeWidget *widget)
{
GladeSignalEditorPrivate *priv = editor->priv;
+ GList *signals, *l, *adaptors = NULL;
GtkTreePath *path;
GtkTreeIter iter;
+ gboolean valid;
if (priv->widget != widget)
{
@@ -672,6 +681,45 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
gtk_tree_view_expand_row (GTK_TREE_VIEW (priv->signal_tree), path, FALSE);
gtk_tree_path_free (path);
}
+
+ /* Collect a list of adaptors which actually have used signals */
+ signals = glade_widget_get_signal_list (widget);
+ for (l = signals; l; l = l->next)
+ {
+ GladeSignal *signal = l->data;
+ const GladeSignalClass *signal_class;
+ GladeWidgetAdaptor *adaptor;
+
+ signal_class = glade_signal_get_class (signal);
+ adaptor = glade_signal_class_get_adaptor (signal_class);
+
+ if (!g_list_find (adaptors, adaptor))
+ adaptors = g_list_prepend (adaptors, adaptor);
+ }
+ g_list_free (signals);
+
+ /* Expand any rows which actually contain used signals */
+ valid = gtk_tree_model_iter_children (priv->model, &iter, NULL);
+ while (valid)
+ {
+ gchar *name = NULL;
+
+ gtk_tree_model_get (priv->model, &iter,
+ GLADE_SIGNAL_COLUMN_NAME, &name,
+ -1);
+
+ if (g_list_find_custom (adaptors, name, (GCompareFunc)find_adaptor_by_name))
+ {
+ path = gtk_tree_model_get_path (priv->model, &iter);
+ gtk_tree_view_expand_row (GTK_TREE_VIEW (priv->signal_tree), path, FALSE);
+ gtk_tree_path_free (path);
+ }
+
+ g_free (name);
+ valid = gtk_tree_model_iter_next (priv->model, &iter);
+ }
+
+ g_list_free (adaptors);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]