[gnome-control-center] shell: Replace g_object_new with gtk widget methods
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Replace g_object_new with gtk widget methods
- Date: Mon, 19 Oct 2020 04:12:03 +0000 (UTC)
commit 01874f7650fb8328a96925a985c287abfe21cefd
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Sep 25 16:26:51 2020 +1200
shell: Replace g_object_new with gtk widget methods
This improves compile time type checking.
shell/cc-panel-list.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index d425067d7..d201c0f50 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -282,12 +282,11 @@ row_data_new (CcPanelCategory category,
data->keywords = g_strdupv (keywords);
/* Setup the row */
- grid = g_object_new (GTK_TYPE_GRID,
- "visible", TRUE,
- "hexpand", TRUE,
- "border-width", 12,
- "column-spacing", 12,
- NULL);
+ grid = gtk_grid_new ();
+ gtk_widget_show (grid);
+ gtk_widget_set_hexpand (grid, TRUE);
+ gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
/* Icon */
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON);
@@ -298,21 +297,17 @@ row_data_new (CcPanelCategory category,
gtk_widget_show (image);
/* Name label */
- label = g_object_new (GTK_TYPE_LABEL,
- "label", name,
- "visible", TRUE,
- "xalign", 0.0,
- "hexpand", TRUE,
- NULL);
+ label = gtk_label_new (name);
+ gtk_widget_show (label);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
/* Description label */
- label = g_object_new (GTK_TYPE_LABEL,
- "label", description,
- "visible", FALSE,
- "xalign", 0.0,
- "hexpand", TRUE,
- NULL);
+ label = gtk_label_new (description);
+ gtk_widget_show (label);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_widget_set_hexpand (label, TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (label), 25);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]