shell: Replace g_object_new with gtk widget methods

This improves compile time type checking.
This commit is contained in:
Robert Ancell 2020-09-25 16:26:51 +12:00 committed by Robert Ancell
parent 35790b5430
commit 01874f7650

View file

@ -282,12 +282,11 @@ row_data_new (CcPanelCategory category,
data->keywords = g_strdupv (keywords); data->keywords = g_strdupv (keywords);
/* Setup the row */ /* Setup the row */
grid = g_object_new (GTK_TYPE_GRID, grid = gtk_grid_new ();
"visible", TRUE, gtk_widget_show (grid);
"hexpand", TRUE, gtk_widget_set_hexpand (grid, TRUE);
"border-width", 12, gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
"column-spacing", 12, gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
NULL);
/* Icon */ /* Icon */
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON); 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); gtk_widget_show (image);
/* Name label */ /* Name label */
label = g_object_new (GTK_TYPE_LABEL, label = gtk_label_new (name);
"label", name, gtk_widget_show (label);
"visible", TRUE, gtk_label_set_xalign (GTK_LABEL (label), 0.0);
"xalign", 0.0, gtk_widget_set_hexpand (label, TRUE);
"hexpand", TRUE,
NULL);
gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1); gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
/* Description label */ /* Description label */
label = g_object_new (GTK_TYPE_LABEL, label = gtk_label_new (description);
"label", description, gtk_widget_show (label);
"visible", FALSE, gtk_label_set_xalign (GTK_LABEL (label), 0.0);
"xalign", 0.0, gtk_widget_set_hexpand (label, TRUE);
"hexpand", TRUE,
NULL);
gtk_label_set_max_width_chars (GTK_LABEL (label), 25); gtk_label_set_max_width_chars (GTK_LABEL (label), 25);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);