im.pidgin.pidgin.next.minor: 08acda06a60a49c86dd22b679a931a22c62e3c13

sadrul at pidgin.im sadrul at pidgin.im
Wed Oct 24 06:10:37 EDT 2007


-----------------------------------------------------------------
Revision: 08acda06a60a49c86dd22b679a931a22c62e3c13
Ancestor: 0d423b83c4fa37d15724d416d2fcccc710281ad5
Author: sadrul at pidgin.im
Date: 2007-10-24T10:14:58
Branch: im.pidgin.pidgin.next.minor

Modified files:
        finch/libgnt/gntbox.c

ChangeLog: 

Add properties to boxes. This is the Right Way of doing things.

-------------- next part --------------
============================================================
--- finch/libgnt/gntbox.c	9227cafb184ad4724d054ca82a5d451f0e87f812
+++ finch/libgnt/gntbox.c	b301f26a8664fc4b494cd4a0f5ff3ead9ff4b269
@@ -27,6 +27,13 @@ enum
 
 enum
 {
+	PROP_0,
+	PROP_VERTICAL,
+	PROP_HOMO        /* ... */
+};
+
+enum
+{
 	SIGS = 1,
 };
 
@@ -511,8 +518,44 @@ static void
 }
 
 static void
+gnt_box_set_property(GObject *obj, guint prop_id, const GValue *value,
+		GParamSpec *spec)
+{
+	GntBox *box = GNT_BOX(obj);
+	switch (prop_id) {
+		case PROP_VERTICAL:
+			box->vertical = g_value_get_boolean(value);
+			break;
+		case PROP_HOMO:
+			box->homogeneous = g_value_get_boolean(value);
+			break;
+		default:
+			g_return_if_reached();
+			break;
+	}
+}
+
+static void
+gnt_box_get_property(GObject *obj, guint prop_id, GValue *value,
+		GParamSpec *spec)
+{
+	GntBox *box = GNT_BOX(obj);
+	switch (prop_id) {
+		case PROP_VERTICAL:
+			g_value_set_boolean(value, box->vertical);
+			break;
+		case PROP_HOMO:
+			g_value_set_boolean(value, box->homogeneous);
+			break;
+		default:
+			break;
+	}
+}
+
+static void
 gnt_box_class_init(GntBoxClass *klass)
 {
+	GObjectClass *gclass = G_OBJECT_CLASS(klass);
 	parent_class = GNT_WIDGET_CLASS(klass);
 	parent_class->destroy = gnt_box_destroy;
 	parent_class->draw = gnt_box_draw;
@@ -527,7 +570,24 @@ gnt_box_class_init(GntBoxClass *klass)
 	parent_class->confirm_size = gnt_box_confirm_size;
 	parent_class->size_changed = gnt_box_size_changed;
 
-	GNTDEBUG;
+	gclass->set_property = gnt_box_set_property;
+	gclass->get_property = gnt_box_get_property;
+	g_object_class_install_property(gclass,
+			PROP_VERTICAL,
+			g_param_spec_boolean("vertical", "Vertical",
+				"Whether the child widgets in the box should be stacked vertically.",
+				TRUE,
+				G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
+			)
+		);
+	g_object_class_install_property(gclass,
+			PROP_HOMO,
+			g_param_spec_boolean("homogeneous", "Homogeneous",
+				"Whether the child widgets in the box should have the same size.",
+				TRUE,
+				G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
+			)
+		);
 }
 
 static void


More information about the Commits mailing list