Account configuration dialogs can now have separators

This commit is contained in:
Pierre Pronchery 2011-06-26 23:44:55 +00:00
parent 61db49a089
commit a229dcedd4
5 changed files with 38 additions and 30 deletions

View File

@ -43,7 +43,8 @@ typedef enum _AccountConfigType
ACT_PASSWORD,
ACT_FILE,
ACT_UINT16,
ACT_BOOLEAN
ACT_BOOLEAN,
ACT_SEPARATOR
} AccountConfigType;
typedef struct _AccountConfig

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mailer 0.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-06-27 00:59+0200\n"
"POT-Creation-Date: 2011-06-27 01:44+0200\n"
"PO-Revision-Date: 2010-10-02 23:25+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -394,7 +394,7 @@ msgstr "Affichage"
msgid "No account plug-in available"
msgstr "Aucun greffon de compte disponible"
#: ../src/mailer.c:1594 ../src/mailer.c:1880
#: ../src/mailer.c:1594 ../src/mailer.c:1882
msgid "Account name"
msgstr "Nom du compte"
@ -410,56 +410,56 @@ msgstr "Adresse e-mail"
msgid "Type of account"
msgstr "Type de compte"
#: ../src/mailer.c:1769
#: ../src/mailer.c:1771
msgid "Choose file"
msgstr "Choisir un fichier"
#: ../src/mailer.c:1950
#: ../src/mailer.c:1953
msgid "hidden"
msgstr "masqué"
#: ../src/mailer.c:1984
#: ../src/mailer.c:1987
msgid "Yes"
msgstr "Oui"
#: ../src/mailer.c:1984
#: ../src/mailer.c:1987
msgid "No"
msgstr "Non"
#: ../src/mailer.c:2012
#: ../src/mailer.c:2015
msgid "Account type "
msgstr "Type de compte "
#: ../src/mailer.c:2013
#: ../src/mailer.c:2016
msgid " active\n"
msgstr " actif\n"
#: ../src/mailer.c:2057
#: ../src/mailer.c:2060
msgid "Edit account: "
msgstr "Modification du compte: "
#: ../src/mailer.c:2124
#: ../src/mailer.c:2123
msgid "An error occured while saving preferences"
msgstr "Une erreur est survenue pendant la sauvegarde des préférences"
#: ../src/mailer.c:2256 ../src/mailer.c:2261
#: ../src/mailer.c:2255 ../src/mailer.c:2260
msgid "Question"
msgstr "Question"
#: ../src/mailer.c:2330
#: ../src/mailer.c:2329
#, c-format
msgid "%s/%s: %d %s"
msgstr "%s/%s: %d %s"
#: ../src/mailer.c:2333
#: ../src/mailer.c:2332
msgid "messages"
msgstr "messages"
#: ../src/mailer.c:2333
#: ../src/mailer.c:2332
msgid "message"
msgstr "message"
#: ../src/mailer.c:2336
#: ../src/mailer.c:2335
msgid "Ready"
msgstr "Prêt"

View File

@ -266,9 +266,10 @@ int account_config_load(Account * account, Config * config)
continue;
switch(p->type)
{
case ACT_PASSWORD:
/* FIXME unscramble */
case ACT_FILE:
case ACT_STRING:
case ACT_PASSWORD: /* FIXME unscramble */
free(p->value);
p->value = strdup(value);
break;
@ -277,8 +278,10 @@ int account_config_load(Account * account, Config * config)
if(value[0] != '\0' && *q == '\0')
p->value = (void*)l;
break;
case ACT_BOOLEAN: /* FIXME implement the rest */
case ACT_BOOLEAN:
/* FIXME implement */
case ACT_NONE:
case ACT_SEPARATOR:
break;
}
}
@ -304,9 +307,10 @@ int account_config_save(Account * account, Config * config)
{
switch(p->type)
{
case ACT_PASSWORD:
/* FIXME scramble */
case ACT_FILE:
case ACT_STRING:
case ACT_PASSWORD: /* FIXME scramble */
if(config_set(config, account->title, p->name,
p->value) != 0)
return 1;
@ -318,8 +322,10 @@ int account_config_save(Account * account, Config * config)
buf) != 0)
return 1;
break;
case ACT_BOOLEAN: /* FIXME implement the rest */
case ACT_BOOLEAN:
/* FIXME implement */
case ACT_NONE:
case ACT_SEPARATOR:
break;
}
}

View File

@ -73,6 +73,7 @@ typedef enum _IMAP4ConfigValue
#if 0 /* FIXME SSL is not supported yet */
I4CV_SSL,
#endif
I4CV_PADDING0,
I4CV_PREFIX
} IMAP4Config;
#define I4CV_LAST I4CV_PREFIX
@ -168,6 +169,7 @@ AccountConfig _imap4_config[I4CV_COUNT + 1] =
{ "sent", "Sent mails folder", ACT_NONE, NULL },
{ "draft", "Draft mails folder", ACT_NONE, NULL },
#endif
{ NULL, NULL, ACT_SEPARATOR, NULL },
{ "prefix", "Prefix", ACT_STRING, NULL },
{ NULL, NULL, ACT_NONE, NULL }
};

View File

@ -1689,12 +1689,10 @@ static GtkWidget * _assistant_account_config(AccountConfig * config)
vbox = gtk_vbox_new(FALSE, 4);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
for(i = 0; config != NULL && config[i].name != NULL; i++)
for(i = 0; config != NULL && config[i].type != ACT_NONE; i++)
{
switch(config[i].type)
{
case ACT_NONE:
continue;
case ACT_STRING:
widget = _update_string(&config[i], NULL,
group);
@ -1713,7 +1711,11 @@ static GtkWidget * _assistant_account_config(AccountConfig * config)
case ACT_BOOLEAN:
widget = _update_boolean(&config[i]);
break;
case ACT_SEPARATOR:
widget = gtk_hseparator_new();
break;
default: /* should not happen */
assert(0);
continue;
}
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
@ -1883,12 +1885,10 @@ static GtkWidget * _account_display(Account * account)
pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
widget = _display_string(&p, desc, group);
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
for(i = 0; config[i].name != NULL; i++)
for(i = 0; config[i].type != ACT_NONE; i++)
{
switch(config[i].type)
{
case ACT_NONE:
continue;
case ACT_STRING:
widget = _display_string(&config[i], desc,
group);
@ -1908,6 +1908,9 @@ static GtkWidget * _account_display(Account * account)
widget = _display_boolean(&config[i], desc,
group);
break;
case ACT_SEPARATOR:
widget = gtk_hseparator_new();
break;
default: /* should not happen */
assert(0);
continue;
@ -2066,10 +2069,6 @@ static void _account_edit(Mailer * mailer, Account * account)
widget = _assistant_account_config(account_get_config(account));
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
hbox = gtk_hbox_new(FALSE, 0);
widget = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 4);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
hbox = gtk_hbox_new(FALSE, 0);
group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
widget = gtk_button_new_from_stock(GTK_STOCK_OK);
gtk_size_group_add_widget(group, widget);