summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--liblogdiag/ld-category-symbol-view.c9
-rw-r--r--liblogdiag/ld-category-symbol-view.h2
-rw-r--r--liblogdiag/ld-category-view.c17
-rw-r--r--liblogdiag/ld-category-view.h2
-rw-r--r--src/ld-window-main.c2
5 files changed, 19 insertions, 13 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);
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 1ab7361..43f4d33 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -262,7 +262,7 @@ ld_window_main_init (LdWindowMain *self)
priv->toolbar = gtk_ui_manager_get_widget (priv->ui_manager, "/Toolbar");
/* Create the remaining widgets. */
- priv->library_view = ld_category_view_new ();
+ priv->library_view = ld_category_view_new (NULL);
priv->view = LD_DIAGRAM_VIEW (ld_diagram_view_new ());
priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);