[monet] [item] add parameters to constructor
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [monet] [item] add parameters to constructor
- Date: Fri, 25 Sep 2009 14:37:15 +0000 (UTC)
commit 5fdbc2662e210fea73997974cc4911ee29bbc460
Author: Thomas Wood <thomas wood intel com>
Date: Fri Sep 25 15:15:05 2009 +0100
[item] add parameters to constructor
Add commonly set properties to the constructor function
monet/mn-item.c | 14 ++++++++++++--
monet/mn-item.h | 3 ++-
tests/test-stylable.c | 16 +++-------------
3 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/monet/mn-item.c b/monet/mn-item.c
index ff94442..87d8f8c 100644
--- a/monet/mn-item.c
+++ b/monet/mn-item.c
@@ -224,7 +224,17 @@ mn_item_init (MnItem *self)
}
MnItem *
-mn_item_new (void)
+mn_item_new (MnStyle *style,
+ gchar *style_type,
+ gchar *style_class,
+ gchar *style_id,
+ gchar *style_pseudo_class)
{
- return g_object_new (MN_TYPE_ITEM, NULL);
+ return g_object_new (MN_TYPE_ITEM,
+ "style", style,
+ "style-type", style_type,
+ "style-class", style_class,
+ "style-id", style_id,
+ "style-pseudo-class", style_pseudo_class,
+ NULL);
}
diff --git a/monet/mn-item.h b/monet/mn-item.h
index 93e0e20..3fd1dc0 100644
--- a/monet/mn-item.h
+++ b/monet/mn-item.h
@@ -22,6 +22,7 @@
#define _MN_ITEM_H
#include <glib-object.h>
+#include <monet/mn-style.h>
G_BEGIN_DECLS
@@ -65,7 +66,7 @@ struct _MnItemClass
GType mn_item_get_type (void);
-MnItem *mn_item_new (void);
+MnItem *mn_item_new (MnStyle *style, gchar *style_type, gchar *style_class, gchar *style_id, gchar *style_pseudo_class);
G_END_DECLS
diff --git a/tests/test-stylable.c b/tests/test-stylable.c
index d28d963..9f7c776 100644
--- a/tests/test-stylable.c
+++ b/tests/test-stylable.c
@@ -21,19 +21,9 @@ main (int argc, char **argv)
return 1;
}
- item1 = mn_item_new ();
- g_object_set (item1,
- "style", style,
- "style-type", "TestItem",
- "style-id", "item-one",
- NULL);
-
- item2 = mn_item_new ();
- g_object_set (item2,
- "style", style,
- "style-type", "TestItem",
- "style-id", "item-two",
- NULL);
+ item1 = mn_item_new (style, "TestItem", NULL, "item-one", NULL);
+
+ item2 = mn_item_new (style, "TestItem", NULL, "item-two", NULL);
mn_stylable_get (MN_STYLABLE (item1), "background-color", &color, NULL);
string = mn_color_to_string (color);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]