[glade3/signal-tree-model] Make GladeSignalModel a deligate of GladeWidget
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3/signal-tree-model] Make GladeSignalModel a deligate of GladeWidget
- Date: Thu, 16 Dec 2010 11:45:45 +0000 (UTC)
commit a4abbf6fea060cc6c160a668a86908bdf7ba2d2f
Author: Johannes Schmid <jhs gnome org>
Date: Thu Dec 16 12:43:57 2010 +0100
Make GladeSignalModel a deligate of GladeWidget
gladeui/glade-signal-editor.c | 10 ++--------
gladeui/glade-widget.c | 24 +++++++++++++++++++++++-
gladeui/glade-widget.h | 6 ++++++
3 files changed, 31 insertions(+), 9 deletions(-)
---
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index 9261da7..1420d50 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -314,15 +314,13 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
}
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->signal_tree), NULL);
- if (priv->model)
- g_object_unref (priv->model);
priv->model = NULL;
if (!widget)
return;
- priv->model = glade_signal_model_new (widget);
+ priv->model = glade_widget_get_signal_model (widget);
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->signal_tree), priv->model);
g_object_set (priv->renderer_userdata, "model", glade_app_get_project (), NULL);
}
@@ -364,10 +362,6 @@ glade_signal_editor_enable_dnd (GladeSignalEditor *editor, gboolean enabled)
static void
glade_signal_editor_dispose (GObject *object)
{
- GladeSignalEditor *self = GLADE_SIGNAL_EDITOR (object);
-
- glade_signal_editor_load_widget (self, NULL);
-
G_OBJECT_CLASS (glade_signal_editor_parent_class)->dispose (object);
}
@@ -406,7 +400,7 @@ create_rich_drag_icon (GtkWidget* widget, const gchar* text)
{
PangoLayout* layout = pango_layout_new (gtk_widget_get_pango_context (widget));
GdkPixmap* pixmap;
- cairo_t cr;
+ cairo_t* cr;
gint width, height;
pango_layout_set_text (layout, text, -1);
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 6ef84f7..223f9b4 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -56,7 +56,7 @@
#include "glade-app.h"
#include "glade-design-view.h"
#include "glade-widget-action.h"
-
+#include "glade-signal-model.h"
static void glade_widget_set_adaptor (GladeWidget *widget,
@@ -895,6 +895,11 @@ glade_widget_dispose (GObject *object)
g_list_foreach (widget->packing_actions, (GFunc)g_object_unref, NULL);
g_list_free (widget->packing_actions);
}
+ if (widget->signal_model)
+ {
+ g_object_unref (widget->signal_model);
+ widget->signal_model = NULL;
+ }
G_OBJECT_CLASS (glade_widget_parent_class)->dispose (object);
}
@@ -4483,3 +4488,20 @@ glade_widget_support_changed (GladeWidget *widget)
g_signal_emit (widget, glade_widget_signals[SUPPORT_CHANGED], 0);
}
+
+/**
+ * glade_widget_get_signal_model:
+ * @widget: A #GladeWidget
+ *
+ * Returns: a GtkTreeModel that can be used to view the widget's signals.
+ * The signal model is owned by the #GladeWidget.
+ */
+GtkTreeModel *
+glade_widget_get_signal_model (GladeWidget *widget)
+{
+ if (!widget->signal_model)
+ {
+ widget->signal_model = glade_signal_model_new (widget);
+ }
+ return widget->signal_model;
+}
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index a4fdef9..4426992 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -107,6 +107,9 @@ struct _GladeWidget
*/
GList *locked_widgets; /* A list of widgets this widget has locked down.
*/
+
+ GtkTreeModel *signal_model; /* Signal model (or NULL if not yet requested) */
+
/* Construct parameters: */
GladeWidget *construct_template;
@@ -431,6 +434,9 @@ void glade_widget_unlock (GladeWidget *w
void glade_widget_support_changed (GladeWidget *widget);
+GtkTreeModel *glade_widget_get_signal_model (GladeWidget *widget);
+
+
G_END_DECLS
#endif /* __GLADE_WIDGET_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]