Compare commits
9 Commits
khorben/gt
...
master
Author | SHA1 | Date | |
---|---|---|---|
a3d2a53f6d | |||
21ea78abc6 | |||
3734225289 | |||
bfd136ca0e | |||
3cbbf64616 | |||
998fa48f05 | |||
5df17d2378 | |||
fba7942580 | |||
6f3f8258ea |
|
@ -1,3 +1,4 @@
|
|||
../src/account.c
|
||||
../src/common.c
|
||||
../src/compose.c
|
||||
../src/compose-main.c
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2006-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2006-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mailer */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
#include <System.h>
|
||||
#include "folder.h"
|
||||
#include "mailer.h"
|
||||
|
@ -40,6 +41,8 @@
|
|||
#include "account.h"
|
||||
#include "../config.h"
|
||||
|
||||
#define _(string) gettext(string)
|
||||
|
||||
|
||||
/* constants */
|
||||
#ifndef PREFIX
|
||||
|
@ -151,7 +154,7 @@ Account * account_new(Mailer * mailer, char const * type, char const * title,
|
|||
|| account->definition->get_config == NULL)
|
||||
{
|
||||
account_delete(account);
|
||||
error_set_code(1, "%s%s", "Invalid plug-in ", type);
|
||||
error_set_code(1, "%s%s", _("Invalid plug-in "), type);
|
||||
return NULL;
|
||||
}
|
||||
if(store != NULL)
|
||||
|
@ -541,7 +544,7 @@ static void _helper_event_status(Account * account, AccountEvent * event)
|
|||
switch(event->status.status)
|
||||
{
|
||||
case AS_IDLE:
|
||||
message = "Ready";
|
||||
message = _("Ready");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -562,8 +565,8 @@ static char * _account_helper_authenticate(Account * account,
|
|||
GtkWidget * widget;
|
||||
|
||||
dialog = gtk_dialog_new();
|
||||
/* XXX translate this, enumerate the methods available */
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), "Authentication");
|
||||
/* XXX enumerate the methods available */
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), _("Authentication"));
|
||||
#if GTK_CHECK_VERSION(2, 14, 0)
|
||||
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||
#else
|
||||
|
@ -595,12 +598,11 @@ static int _account_helper_confirm(Account * account, char const * message)
|
|||
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_YES_NO,
|
||||
#if GTK_CHECK_VERSION(2, 6, 0)
|
||||
"%s", "Confirm");
|
||||
"%s", _("Confirm"));
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
#endif
|
||||
"%s", message);
|
||||
/* XXX translate this */
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), "Confirm");
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), _("Confirm"));
|
||||
ret = (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES) ? 0 : 1;
|
||||
gtk_widget_destroy(dialog);
|
||||
return ret;
|
||||
|
|
80
src/mailer.c
80
src/mailer.c
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2006-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2006-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mailer */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -47,29 +47,42 @@
|
|||
#include "callbacks.h"
|
||||
#include "mailer.h"
|
||||
#include "../config.h"
|
||||
|
||||
#define _(string) gettext(string)
|
||||
#define N_(string) (string)
|
||||
#include "common.c"
|
||||
|
||||
|
||||
/* constants */
|
||||
#ifndef PROGNAME_MAILER
|
||||
# define PROGNAME_MAILER "mailer"
|
||||
#endif
|
||||
#ifndef PREFIX
|
||||
# define PREFIX "/usr/local"
|
||||
# define PREFIX "/usr/local"
|
||||
#endif
|
||||
#ifndef LIBDIR
|
||||
# define LIBDIR PREFIX "/lib"
|
||||
# define LIBDIR PREFIX "/lib"
|
||||
#endif
|
||||
#ifndef PLUGINDIR
|
||||
# define PLUGINDIR LIBDIR "/Mailer"
|
||||
# define PLUGINDIR LIBDIR "/Mailer"
|
||||
#endif
|
||||
#ifndef SYSCONFDIR
|
||||
# define SYSCONFDIR PREFIX "/etc"
|
||||
# define SYSCONFDIR PREFIX "/etc"
|
||||
#endif
|
||||
|
||||
|
||||
/* Mailer */
|
||||
/* private */
|
||||
/* types */
|
||||
typedef enum _AccountAssistantPage
|
||||
{
|
||||
AAP_INTRO = 0,
|
||||
AAP_SETTINGS,
|
||||
AAP_CONFIRM
|
||||
} AccountAssistantPage;
|
||||
#define AAP_LAST AAP_CONFIRM
|
||||
#define AAP_COUNT (AAP_LAST + 1)
|
||||
|
||||
typedef enum _MailerPluginColumn
|
||||
{
|
||||
MPC_NAME = 0,
|
||||
|
@ -152,7 +165,7 @@ typedef void (*MailerForeachMessageCallback)(Mailer * mailer,
|
|||
|
||||
|
||||
/* constants */
|
||||
static const char * _title[3] =
|
||||
static const char * _title[AAP_COUNT] =
|
||||
{
|
||||
N_("New account"), N_("Account settings"), N_("Account confirmation")
|
||||
};
|
||||
|
@ -373,7 +386,7 @@ Mailer * mailer_new(void)
|
|||
|
||||
if((mailer = object_new(sizeof(*mailer))) == NULL)
|
||||
{
|
||||
error_print("mailer");
|
||||
error_print(PROGNAME_MAILER);
|
||||
return NULL;
|
||||
}
|
||||
/* accounts */
|
||||
|
@ -636,7 +649,7 @@ static int _new_accounts(Mailer * mailer)
|
|||
{
|
||||
error_set_code(1, "%s: %s", dirname, strerror(errno));
|
||||
string_delete(dirname);
|
||||
return error_print("mailer");
|
||||
return error_print(PROGNAME_MAILER);
|
||||
}
|
||||
for(de = readdir(dir); de != NULL; de = readdir(dir))
|
||||
{
|
||||
|
@ -648,21 +661,22 @@ static int _new_accounts(Mailer * mailer)
|
|||
if((p = realloc(mailer->available, (mailer->available_cnt + 1)
|
||||
* sizeof(*p))) == NULL)
|
||||
{
|
||||
error_set_print("mailer", 1, "%s", strerror(errno));
|
||||
error_set_print(PROGNAME_MAILER, 1, "%s",
|
||||
strerror(errno));
|
||||
continue;
|
||||
}
|
||||
mailer->available = p;
|
||||
if((p[mailer->available_cnt] = account_new(NULL, de->d_name,
|
||||
NULL, NULL)) == NULL)
|
||||
{
|
||||
error_print("mailer");
|
||||
error_print(PROGNAME_MAILER);
|
||||
continue;
|
||||
}
|
||||
mailer->available_cnt++;
|
||||
}
|
||||
if(closedir(dir) != 0)
|
||||
ret = error_set_print("mailer", 1, "%s: %s", dirname, strerror(
|
||||
errno));
|
||||
ret = error_set_print(PROGNAME_MAILER, 1, "%s: %s", dirname,
|
||||
strerror(errno));
|
||||
string_delete(dirname);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1114,7 +1128,7 @@ int mailer_error(Mailer * mailer, char const * message, int ret)
|
|||
#endif
|
||||
|
||||
if(mailer == NULL)
|
||||
return error_set_print("mailer", ret, "%s", message);
|
||||
return error_set_print(PROGNAME_MAILER, ret, "%s", message);
|
||||
#if GTK_CHECK_VERSION(2, 18, 0)
|
||||
/* info bar */
|
||||
gtk_label_set_text(GTK_LABEL(mailer->fo_infobar_label), message);
|
||||
|
@ -2145,7 +2159,7 @@ static void _on_preferences_account_new(gpointer data)
|
|||
/* plug-in selection */
|
||||
page = _assistant_account_select(ad);
|
||||
gtk_assistant_append_page(assistant, page);
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[0]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[AAP_INTRO]));
|
||||
gtk_assistant_set_page_type(assistant, page, GTK_ASSISTANT_PAGE_INTRO);
|
||||
gtk_assistant_set_page_complete(assistant, page, FALSE);
|
||||
/* plug-in preferences */
|
||||
|
@ -2154,7 +2168,7 @@ static void _on_preferences_account_new(gpointer data)
|
|||
ad->settings = page;
|
||||
gtk_widget_show(page);
|
||||
gtk_assistant_append_page(assistant, page);
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[1]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[AAP_SETTINGS]));
|
||||
gtk_assistant_set_page_type(assistant, page,
|
||||
GTK_ASSISTANT_PAGE_CONTENT);
|
||||
gtk_assistant_set_page_complete(assistant, page, TRUE);
|
||||
|
@ -2163,7 +2177,7 @@ static void _on_preferences_account_new(gpointer data)
|
|||
ad->confirm = page;
|
||||
gtk_widget_show(page);
|
||||
gtk_assistant_append_page(assistant, page);
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[2]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[AAP_CONFIRM]));
|
||||
gtk_assistant_set_page_type(assistant, page,
|
||||
GTK_ASSISTANT_PAGE_CONFIRM);
|
||||
gtk_assistant_set_page_complete(assistant, page, TRUE);
|
||||
|
@ -2216,17 +2230,17 @@ static GtkWidget * _account_display(Account * account);
|
|||
static void _on_assistant_prepare(GtkWidget * widget, GtkWidget * page,
|
||||
gpointer data)
|
||||
{
|
||||
static int old = 0;
|
||||
static int old = AAP_INTRO;
|
||||
AccountData * ad = data;
|
||||
unsigned int i;
|
||||
Account * ac;
|
||||
|
||||
i = gtk_assistant_get_current_page(GTK_ASSISTANT(widget));
|
||||
gtk_window_set_title(GTK_WINDOW(widget), _(_title[i]));
|
||||
if(i == 1)
|
||||
if(i == AAP_SETTINGS)
|
||||
{
|
||||
gtk_container_remove(GTK_CONTAINER(page), ad->settings);
|
||||
if(old == 0)
|
||||
if(old == AAP_INTRO)
|
||||
{
|
||||
if(ad->account != NULL)
|
||||
account_delete(ad->account);
|
||||
|
@ -2238,7 +2252,7 @@ static void _on_assistant_prepare(GtkWidget * widget, GtkWidget * page,
|
|||
{
|
||||
mailer_error(ad->mailer, error_get(NULL), 0);
|
||||
gtk_assistant_set_current_page(GTK_ASSISTANT(widget),
|
||||
0);
|
||||
AAP_INTRO);
|
||||
ad->settings = _assistant_account_select(ad);
|
||||
}
|
||||
else
|
||||
|
@ -2247,7 +2261,7 @@ static void _on_assistant_prepare(GtkWidget * widget, GtkWidget * page,
|
|||
gtk_container_add(GTK_CONTAINER(page), ad->settings);
|
||||
gtk_widget_show_all(ad->settings);
|
||||
}
|
||||
else if(i == 2)
|
||||
else if(i == AAP_CONFIRM)
|
||||
{
|
||||
gtk_container_remove(GTK_CONTAINER(page), ad->confirm);
|
||||
ad->confirm = _account_display(ad->account);
|
||||
|
@ -2330,13 +2344,32 @@ static void _on_account_name_changed(GtkWidget * widget, gpointer data)
|
|||
AccountData * ad = data;
|
||||
int current;
|
||||
GtkWidget * page;
|
||||
gboolean complete;
|
||||
unsigned int i;
|
||||
|
||||
_on_entry_changed(widget, &ad->title);
|
||||
current = gtk_assistant_get_current_page(GTK_ASSISTANT(ad->assistant));
|
||||
page = gtk_assistant_get_nth_page(GTK_ASSISTANT(ad->assistant),
|
||||
current);
|
||||
if((complete = (strlen(ad->title) > 0) ? TRUE : FALSE) == TRUE)
|
||||
for(i = 0; i < ad->mailer->account_cnt; i++)
|
||||
if(strcmp(account_get_title(ad->mailer->account[i]),
|
||||
ad->title) == 0)
|
||||
{
|
||||
complete = FALSE;
|
||||
break;
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2, 16, 0)
|
||||
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
(strlen(ad->title) > 0 && complete == FALSE)
|
||||
? "gtk-dialog-warning" : NULL);
|
||||
gtk_entry_set_icon_tooltip_text(GTK_ENTRY(widget),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
_("An account with that name already exists"));
|
||||
#endif
|
||||
gtk_assistant_set_page_complete(GTK_ASSISTANT(ad->assistant), page,
|
||||
strlen(ad->title) ? TRUE : FALSE);
|
||||
complete);
|
||||
}
|
||||
|
||||
static void _account_add_label(GtkWidget * box, PangoFontDescription * desc,
|
||||
|
@ -2977,7 +3010,6 @@ static int _preferences_ok_accounts(Mailer * mailer)
|
|||
{
|
||||
GtkTreeModel * model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel * view_model;
|
||||
gboolean loop;
|
||||
Account * account;
|
||||
gboolean active;
|
||||
|
@ -2989,8 +3021,6 @@ static int _preferences_ok_accounts(Mailer * mailer)
|
|||
char * p;
|
||||
|
||||
model = gtk_tree_view_get_model(GTK_TREE_VIEW(mailer->pr_accounts));
|
||||
view_model = gtk_tree_view_get_model(GTK_TREE_VIEW(
|
||||
mailer->fo_view));
|
||||
for(loop = gtk_tree_model_get_iter_first(model, &iter); loop == TRUE;
|
||||
loop = gtk_tree_model_iter_next(model, &iter))
|
||||
{
|
||||
|
|
|
@ -37,10 +37,10 @@ ldflags=`pkg-config --libs glib-2.0 libSystem` `pkg-config --libs openssl`
|
|||
type=binary
|
||||
#for Gtk+ 2
|
||||
#cflags=`pkg-config --cflags gtk+-2.0`
|
||||
#ldflags=`pkg-config --libs gtk+-2.0`
|
||||
#ldflags=`pkg-config --libs gtk+-2.0` -ldl
|
||||
#for Gtk+ 3
|
||||
cflags=`pkg-config --cflags gtk+-3.0`
|
||||
ldflags=`pkg-config --libs gtk+-3.0`
|
||||
ldflags=`pkg-config --libs gtk+-3.0` -ldl
|
||||
sources=plugins.c
|
||||
|
||||
[tests.log]
|
||||
|
|
Loading…
Reference in New Issue
Block a user