network: Store widgets inside objects
This is a step towards replacing GtkBuilder with GtkTemplate
This commit is contained in:
parent
b331d75df5
commit
8b6e3fb736
31 changed files with 1200 additions and 1428 deletions
|
@ -126,16 +126,14 @@ wsec_size_group_clear (GtkSizeGroup *group)
|
|||
static void
|
||||
security_combo_changed (CEPageSecurity *page)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GList *l, *children;
|
||||
g_autoptr(WirelessSecurity) sec = NULL;
|
||||
|
||||
wsec_size_group_clear (page->group);
|
||||
|
||||
vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "box"));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (vbox));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (page->box));
|
||||
for (l = children; l; l = l->next) {
|
||||
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (l->data));
|
||||
gtk_container_remove (GTK_CONTAINER (page->box), GTK_WIDGET (l->data));
|
||||
}
|
||||
|
||||
sec = security_combo_get_active (page);
|
||||
|
@ -149,10 +147,10 @@ security_combo_changed (CEPageSecurity *page)
|
|||
if (parent)
|
||||
gtk_container_remove (GTK_CONTAINER (parent), sec_widget);
|
||||
|
||||
gtk_size_group_add_widget (page->group, page->security_heading);
|
||||
gtk_size_group_add_widget (page->group, GTK_WIDGET (page->security_label));
|
||||
wireless_security_add_to_size_group (sec, page->group);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), sec_widget);
|
||||
gtk_container_add (GTK_CONTAINER (page->box), sec_widget);
|
||||
}
|
||||
|
||||
ce_page_changed (CE_PAGE (page));
|
||||
|
@ -213,7 +211,6 @@ finish_setup (CEPageSecurity *page)
|
|||
NMUtilsSecurityType default_type = NMU_SEC_NONE;
|
||||
int active = -1;
|
||||
int item = 0;
|
||||
GtkComboBox *combo;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
sw = nm_connection_get_setting_wireless (connection);
|
||||
|
@ -221,8 +218,9 @@ finish_setup (CEPageSecurity *page)
|
|||
|
||||
page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
page->security_heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "security_label"));
|
||||
page->security_combo = combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "security_combo"));
|
||||
page->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "box"));
|
||||
page->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "security_label"));
|
||||
page->security_combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "security_combo"));
|
||||
|
||||
dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
|
||||
| NM_WIFI_DEVICE_CAP_CIPHER_WEP104
|
||||
|
@ -338,20 +336,18 @@ finish_setup (CEPageSecurity *page)
|
|||
}
|
||||
}
|
||||
|
||||
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (sec_model));
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
|
||||
gtk_combo_box_set_model (page->security_combo, GTK_TREE_MODEL (sec_model));
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (page->security_combo));
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", S_NAME_COLUMN, NULL);
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), renderer, set_sensitive, &page->adhoc, NULL);
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (page->security_combo), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (page->security_combo), renderer, "text", S_NAME_COLUMN, NULL);
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (page->security_combo), renderer, set_sensitive, &page->adhoc, NULL);
|
||||
|
||||
gtk_combo_box_set_active (combo, active < 0 ? 0 : (guint32) active);
|
||||
|
||||
page->security_combo = combo;
|
||||
gtk_combo_box_set_active (page->security_combo, active < 0 ? 0 : (guint32) active);
|
||||
|
||||
security_combo_changed (page);
|
||||
g_signal_connect_swapped (combo, "changed",
|
||||
g_signal_connect_swapped (page->security_combo, "changed",
|
||||
G_CALLBACK (security_combo_changed), page);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue