diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2012-09-09 15:42:52 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2012-10-08 07:29:58 +0200 |
commit | 15d8c257d11a2c16094e644d9d609614b39b8b09 (patch) | |
tree | 837e0ec52f63d93cbb2982671448be89cb9174ec /liblogdiag | |
parent | ec4f78c008e12b08e55149b2480ed9654556737c (diff) | |
download | logdiag-15d8c257d11a2c16094e644d9d609614b39b8b09.tar.gz logdiag-15d8c257d11a2c16094e644d9d609614b39b8b09.tar.xz logdiag-15d8c257d11a2c16094e644d9d609614b39b8b09.zip |
Add an LdCategory * argument to new() functions.
Diffstat (limited to 'liblogdiag')
-rw-r--r-- | liblogdiag/ld-category-symbol-view.c | 9 | ||||
-rw-r--r-- | liblogdiag/ld-category-symbol-view.h | 2 | ||||
-rw-r--r-- | liblogdiag/ld-category-view.c | 17 | ||||
-rw-r--r-- | liblogdiag/ld-category-view.h | 2 |
4 files changed, 18 insertions, 12 deletions
diff --git a/liblogdiag/ld-category-symbol-view.c b/liblogdiag/ld-category-symbol-view.c index 7489668..85f7c1e 100644 --- a/liblogdiag/ld-category-symbol-view.c +++ b/liblogdiag/ld-category-symbol-view.c @@ -205,13 +205,18 @@ on_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) /** * ld_category_symbol_view_new: + * @category: (allow-none): a category to be assigned to the widget. * * Create an instance. */ GtkWidget * -ld_category_symbol_view_new (void) +ld_category_symbol_view_new (LdCategory *category) { - return g_object_new (LD_TYPE_CATEGORY_SYMBOL_VIEW, NULL); + LdCategorySymbolView *self; + + self = g_object_new (LD_TYPE_CATEGORY_SYMBOL_VIEW, NULL); + ld_category_symbol_view_set_category (self, category); + return GTK_WIDGET (self); } /** diff --git a/liblogdiag/ld-category-symbol-view.h b/liblogdiag/ld-category-symbol-view.h index 10da898..80e6aaa 100644 --- a/liblogdiag/ld-category-symbol-view.h +++ b/liblogdiag/ld-category-symbol-view.h @@ -50,7 +50,7 @@ struct _LdCategorySymbolViewClass GType ld_category_symbol_view_get_type (void) G_GNUC_CONST; -GtkWidget *ld_category_symbol_view_new (void); +GtkWidget *ld_category_symbol_view_new (LdCategory *category); void ld_category_symbol_view_set_category (LdCategorySymbolView *self, LdCategory *category); diff --git a/liblogdiag/ld-category-view.c b/liblogdiag/ld-category-view.c index 5c0d7d4..7abf35c 100644 --- a/liblogdiag/ld-category-view.c +++ b/liblogdiag/ld-category-view.c @@ -134,13 +134,18 @@ ld_category_view_set_property (GObject *object, guint property_id, /** * ld_category_view_new: + * @category: (allow-none): a category to be assigned to the widget. * * Create an instance. */ GtkWidget * -ld_category_view_new (void) +ld_category_view_new (LdCategory *category) { - return g_object_new (LD_TYPE_CATEGORY_VIEW, NULL); + LdCategoryView *self; + + self = g_object_new (LD_TYPE_CATEGORY_VIEW, NULL); + ld_category_view_set_category (self, category); + return GTK_WIDGET (self); } /** @@ -272,9 +277,7 @@ reload_category (LdCategoryView *self) { GtkWidget *symbol_view; - symbol_view = ld_category_symbol_view_new (); - ld_category_symbol_view_set_category - (LD_CATEGORY_SYMBOL_VIEW (symbol_view), self->priv->category); + symbol_view = ld_category_symbol_view_new (self->priv->category); gtk_box_pack_start (GTK_BOX (self), symbol_view, FALSE, FALSE, 0); } @@ -312,9 +315,7 @@ load_category_cb (gpointer data, gpointer user_data) gtk_expander_set_use_markup (GTK_EXPANDER (expander), TRUE); g_free (label_markup); - child = ld_category_view_new (); - ld_category_view_set_category (LD_CATEGORY_VIEW (child), cat); - + child = ld_category_view_new (cat); gtk_container_add (GTK_CONTAINER (expander), child); gtk_box_pack_start (GTK_BOX (self), expander, FALSE, FALSE, 0); } diff --git a/liblogdiag/ld-category-view.h b/liblogdiag/ld-category-view.h index 38b3f4b..5b5c81e 100644 --- a/liblogdiag/ld-category-view.h +++ b/liblogdiag/ld-category-view.h @@ -50,7 +50,7 @@ struct _LdCategoryViewClass GType ld_category_view_get_type (void) G_GNUC_CONST; -GtkWidget *ld_category_view_new (void); +GtkWidget *ld_category_view_new (LdCategory *category); void ld_category_view_set_category (LdCategoryView *self, LdCategory *category); LdCategory *ld_category_view_get_category (LdCategoryView *self); |