예제 #1
0
static void
wireless_security_combo_changed (GtkComboBox *combo,
                                 gpointer user_data)
{
	CEPageWirelessSecurity *self = CE_PAGE_WIRELESS_SECURITY (user_data);
	GtkWidget *vbox;
	GList *elt, *children;
	WirelessSecurity *sec;

	vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (self)->builder, "wireless_security_vbox"));
	g_assert (vbox);

	wsec_size_group_clear (self->group);

	/* Remove any previous wireless security widgets */
	children = gtk_container_get_children (GTK_CONTAINER (vbox));
	for (elt = children; elt; elt = g_list_next (elt))
		gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));

	sec = wireless_security_combo_get_active (self);
	if (sec) {
		GtkWidget *sec_widget;
		GtkWidget *widget, *parent;

		sec_widget = wireless_security_get_widget (sec);
		g_assert (sec_widget);
		parent = gtk_widget_get_parent (sec_widget);
		if (parent)
			gtk_container_remove (GTK_CONTAINER (parent), sec_widget);

		widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (self)->builder, "wireless_security_combo_label"));
		gtk_size_group_add_widget (self->group, widget);
		wireless_security_add_to_size_group (sec, self->group);

		gtk_container_add (GTK_CONTAINER (vbox), sec_widget);
		wireless_security_unref (sec);
	}

	ce_page_changed (CE_PAGE (self));
}
static void
security_combo_changed (GtkComboBox *combo,
                        gpointer     user_data)
{
        CEPageSecurity *page = CE_PAGE_SECURITY (user_data);
        GtkWidget *vbox;
        GList *l, *children;
        WirelessSecurity *sec;

        wsec_size_group_clear (page->group);

        vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "vbox"));
        children = gtk_container_get_children (GTK_CONTAINER (vbox));
        for (l = children; l; l = l->next) {
                gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (l->data));
        }

        sec = security_combo_get_active (page);
        if (sec) {
                GtkWidget *sec_widget;
                GtkWidget *parent;

                sec_widget = wireless_security_get_widget (sec);
                g_assert (sec_widget);
                parent = gtk_widget_get_parent (sec_widget);
                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, page->firewall_heading);
                wireless_security_add_to_size_group (sec, page->group);

                gtk_container_add (GTK_CONTAINER (vbox), sec_widget);
                wireless_security_unref (sec);
        }

        ce_page_changed (CE_PAGE (page));
}