static void nmt_add_connection_constructed (GObject *object) { NmtAddConnectionPrivate *priv = NMT_ADD_CONNECTION_GET_PRIVATE (object); NMEditorConnectionTypeData **types; char *text; int i, num_types; if (priv->secondary_text) { text = g_strdup_printf ("%s\n\n%s", priv->primary_text, priv->secondary_text); } else text = g_strdup (priv->primary_text); nmt_newt_textbox_set_text (priv->textbox, text); g_free (text); types = nm_editor_utils_get_connection_type_list (); for (i = num_types = 0; types[i]; i++) { if (priv->type_filter && !priv->type_filter (types[i]->setting_type, priv->type_filter_data)) continue; nmt_newt_listbox_append (priv->listbox, types[i]->name, GSIZE_TO_POINTER (types[i]->setting_type)); num_types++; } if (num_types == 1) priv->single_type = TRUE; G_OBJECT_CLASS (nmt_add_connection_parent_class)->constructed (object); }
static void nmt_password_dialog_constructed (GObject *object) { NmtPasswordDialog *dialog = NMT_PASSWORD_DIALOG (object); NmtPasswordDialogPrivate *priv = NMT_PASSWORD_DIALOG_GET_PRIVATE (dialog); NmtNewtWidget *widget; NmtNewtGrid *grid, *secret_grid; NmtNewtButtonBox *bbox; int i; widget = nmt_newt_grid_new (); nmt_newt_form_set_content (NMT_NEWT_FORM (dialog), widget); grid = NMT_NEWT_GRID (widget); widget = nmt_newt_textbox_new (0, 60); nmt_newt_textbox_set_text (NMT_NEWT_TEXTBOX (widget), priv->prompt); nmt_newt_grid_add (grid, widget, 0, 0); widget = nmt_newt_grid_new (); nmt_newt_grid_add (grid, widget, 0, 1); nmt_newt_widget_set_padding (widget, 0, 1, 0, 1); priv->secret_grid = widget; secret_grid = NMT_NEWT_GRID (widget); for (i = 0; i < priv->secrets->len; i++) { NMSecretAgentSimpleSecret *secret = priv->secrets->pdata[i]; NmtNewtEntryFlags flags; widget = nmt_newt_label_new (secret->name); nmt_newt_grid_add (secret_grid, widget, 0, i); nmt_newt_widget_set_padding (widget, 4, 0, 1, 0); flags = NMT_NEWT_ENTRY_NONEMPTY; if (secret->password) flags |= NMT_NEWT_ENTRY_PASSWORD; widget = nmt_newt_entry_new (30, flags); nmt_newt_grid_add (secret_grid, widget, 1, i); g_ptr_array_add (priv->entries, widget); if (i == priv->secrets->len - 1) { priv->last_entry = widget; g_signal_connect (widget, "activated", G_CALLBACK (maybe_save_input_and_exit), dialog); } } widget = nmt_newt_button_box_new (NMT_NEWT_BUTTON_BOX_HORIZONTAL); nmt_newt_grid_add (grid, widget, 0, 2); bbox = NMT_NEWT_BUTTON_BOX (widget); priv->cancel = nmt_newt_button_box_add_end (NMT_NEWT_BUTTON_BOX (bbox), _("Cancel")); nmt_newt_widget_set_exit_on_activate (priv->cancel, TRUE); priv->ok = nmt_newt_button_box_add_end (NMT_NEWT_BUTTON_BOX (bbox), _("OK")); g_signal_connect (priv->ok, "activated", G_CALLBACK (maybe_save_input_and_exit), dialog); g_object_bind_property (priv->secret_grid, "valid", priv->ok, "sensitive", G_BINDING_SYNC_CREATE); G_OBJECT_CLASS (nmt_password_dialog_parent_class)->constructed (object); }