[anjuta] libanjuta: Add a model property to AnjutaTreeComboBox



commit 8fdd0a7aec3a41706e9357f21f049ced6c458478
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sat Dec 31 17:53:10 2011 +0100

    libanjuta: Add a model property to AnjutaTreeComboBox

 libanjuta/anjuta-tree-combo.c |   61 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/libanjuta/anjuta-tree-combo.c b/libanjuta/anjuta-tree-combo.c
index 74ab567..8b2c322 100644
--- a/libanjuta/anjuta-tree-combo.c
+++ b/libanjuta/anjuta-tree-combo.c
@@ -65,6 +65,11 @@ enum {
 	LAST_SIGNAL
 };
 
+enum {
+  PROP_0,
+  PROP_MODEL
+};
+
 static guint signals[LAST_SIGNAL] = {0,};
 
 #define SCROLL_TIME  100
@@ -989,6 +994,44 @@ anjuta_tree_combo_box_init (AnjutaTreeComboBox *combo)
 }
 
 static void
+anjuta_tree_combo_box_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+	AnjutaTreeComboBox *combo = ANJUTA_TREE_COMBO_BOX (object);
+
+	switch (prop_id)
+	{
+    case PROP_MODEL:
+		anjuta_tree_combo_box_set_model (combo, g_value_get_object (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+anjuta_tree_combo_box_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+	AnjutaTreeComboBox *combo = ANJUTA_TREE_COMBO_BOX (object);
+
+	switch (prop_id)
+	{
+	case PROP_MODEL:
+        g_value_set_object (value, combo->priv->model);
+        break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+    }
+}
+
+static void
 anjuta_tree_combo_box_class_init (AnjutaTreeComboBoxClass * class)
 {
 	GObjectClass *gobject_class;
@@ -1000,6 +1043,9 @@ anjuta_tree_combo_box_class_init (AnjutaTreeComboBoxClass * class)
 
 	gobject_class = G_OBJECT_CLASS (class);
 	gobject_class->dispose = anjuta_tree_combo_box_dispose;
+	gobject_class->set_property = anjuta_tree_combo_box_set_property;
+	gobject_class->get_property = anjuta_tree_combo_box_get_property;
+
 
 	/* Signals */
 	signals[CHANGED] = g_signal_new ("changed",
@@ -1026,6 +1072,21 @@ anjuta_tree_combo_box_class_init (AnjutaTreeComboBoxClass * class)
 	                                               g_cclosure_marshal_VOID__VOID,
 	                                               G_TYPE_NONE, 0);
 
+	/**
+	 * AnjutaTreeCombo:model:
+	 *
+	 * The model from which the combo box takes the values shown
+	 * in the list.
+	 *
+	 */
+	g_object_class_install_property (gobject_class,
+	                                 PROP_MODEL,
+	                                 g_param_spec_object ("model",
+	                                                      _("ComboBox model"),
+	                                                      _("The model for the combo box"),
+	                                                      GTK_TYPE_TREE_MODEL,
+	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
 	/* Key bindings */
 	binding_set = gtk_binding_set_by_class (widget_class);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]