Compare commits
No commits in common. "master" and "khorben/gtkdoc" have entirely different histories.
master
...
khorben/gt
|
@ -1,4 +1,3 @@
|
|||
../src/account.c
|
||||
../src/common.c
|
||||
../src/compose.c
|
||||
../src/compose-main.c
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2006-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2006-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mailer */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -33,7 +33,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
#include <System.h>
|
||||
#include "folder.h"
|
||||
#include "mailer.h"
|
||||
|
@ -41,8 +40,6 @@
|
|||
#include "account.h"
|
||||
#include "../config.h"
|
||||
|
||||
#define _(string) gettext(string)
|
||||
|
||||
|
||||
/* constants */
|
||||
#ifndef PREFIX
|
||||
|
@ -154,7 +151,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)
|
||||
|
@ -544,7 +541,7 @@ static void _helper_event_status(Account * account, AccountEvent * event)
|
|||
switch(event->status.status)
|
||||
{
|
||||
case AS_IDLE:
|
||||
message = _("Ready");
|
||||
message = "Ready";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -565,8 +562,8 @@ static char * _account_helper_authenticate(Account * account,
|
|||
GtkWidget * widget;
|
||||
|
||||
dialog = gtk_dialog_new();
|
||||
/* XXX enumerate the methods available */
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), _("Authentication"));
|
||||
/* XXX translate this, 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
|
||||
|
@ -598,11 +595,12 @@ 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);
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), _("Confirm"));
|
||||
/* XXX translate this */
|
||||
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-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2006-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mailer */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -47,42 +47,29 @@
|
|||
#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,
|
||||
|
@ -165,7 +152,7 @@ typedef void (*MailerForeachMessageCallback)(Mailer * mailer,
|
|||
|
||||
|
||||
/* constants */
|
||||
static const char * _title[AAP_COUNT] =
|
||||
static const char * _title[3] =
|
||||
{
|
||||
N_("New account"), N_("Account settings"), N_("Account confirmation")
|
||||
};
|
||||
|
@ -386,7 +373,7 @@ Mailer * mailer_new(void)
|
|||
|
||||
if((mailer = object_new(sizeof(*mailer))) == NULL)
|
||||
{
|
||||
error_print(PROGNAME_MAILER);
|
||||
error_print("mailer");
|
||||
return NULL;
|
||||
}
|
||||
/* accounts */
|
||||
|
@ -649,7 +636,7 @@ static int _new_accounts(Mailer * mailer)
|
|||
{
|
||||
error_set_code(1, "%s: %s", dirname, strerror(errno));
|
||||
string_delete(dirname);
|
||||
return error_print(PROGNAME_MAILER);
|
||||
return error_print("mailer");
|
||||
}
|
||||
for(de = readdir(dir); de != NULL; de = readdir(dir))
|
||||
{
|
||||
|
@ -661,22 +648,21 @@ static int _new_accounts(Mailer * mailer)
|
|||
if((p = realloc(mailer->available, (mailer->available_cnt + 1)
|
||||
* sizeof(*p))) == NULL)
|
||||
{
|
||||
error_set_print(PROGNAME_MAILER, 1, "%s",
|
||||
strerror(errno));
|
||||
error_set_print("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(PROGNAME_MAILER);
|
||||
error_print("mailer");
|
||||
continue;
|
||||
}
|
||||
mailer->available_cnt++;
|
||||
}
|
||||
if(closedir(dir) != 0)
|
||||
ret = error_set_print(PROGNAME_MAILER, 1, "%s: %s", dirname,
|
||||
strerror(errno));
|
||||
ret = error_set_print("mailer", 1, "%s: %s", dirname, strerror(
|
||||
errno));
|
||||
string_delete(dirname);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1128,7 +1114,7 @@ int mailer_error(Mailer * mailer, char const * message, int ret)
|
|||
#endif
|
||||
|
||||
if(mailer == NULL)
|
||||
return error_set_print(PROGNAME_MAILER, ret, "%s", message);
|
||||
return error_set_print("mailer", ret, "%s", message);
|
||||
#if GTK_CHECK_VERSION(2, 18, 0)
|
||||
/* info bar */
|
||||
gtk_label_set_text(GTK_LABEL(mailer->fo_infobar_label), message);
|
||||
|
@ -2159,7 +2145,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[AAP_INTRO]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[0]));
|
||||
gtk_assistant_set_page_type(assistant, page, GTK_ASSISTANT_PAGE_INTRO);
|
||||
gtk_assistant_set_page_complete(assistant, page, FALSE);
|
||||
/* plug-in preferences */
|
||||
|
@ -2168,7 +2154,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[AAP_SETTINGS]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[1]));
|
||||
gtk_assistant_set_page_type(assistant, page,
|
||||
GTK_ASSISTANT_PAGE_CONTENT);
|
||||
gtk_assistant_set_page_complete(assistant, page, TRUE);
|
||||
|
@ -2177,7 +2163,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[AAP_CONFIRM]));
|
||||
gtk_assistant_set_page_title(assistant, page, _(_title[2]));
|
||||
gtk_assistant_set_page_type(assistant, page,
|
||||
GTK_ASSISTANT_PAGE_CONFIRM);
|
||||
gtk_assistant_set_page_complete(assistant, page, TRUE);
|
||||
|
@ -2230,17 +2216,17 @@ static GtkWidget * _account_display(Account * account);
|
|||
static void _on_assistant_prepare(GtkWidget * widget, GtkWidget * page,
|
||||
gpointer data)
|
||||
{
|
||||
static int old = AAP_INTRO;
|
||||
static int old = 0;
|
||||
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 == AAP_SETTINGS)
|
||||
if(i == 1)
|
||||
{
|
||||
gtk_container_remove(GTK_CONTAINER(page), ad->settings);
|
||||
if(old == AAP_INTRO)
|
||||
if(old == 0)
|
||||
{
|
||||
if(ad->account != NULL)
|
||||
account_delete(ad->account);
|
||||
|
@ -2252,7 +2238,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),
|
||||
AAP_INTRO);
|
||||
0);
|
||||
ad->settings = _assistant_account_select(ad);
|
||||
}
|
||||
else
|
||||
|
@ -2261,7 +2247,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 == AAP_CONFIRM)
|
||||
else if(i == 2)
|
||||
{
|
||||
gtk_container_remove(GTK_CONTAINER(page), ad->confirm);
|
||||
ad->confirm = _account_display(ad->account);
|
||||
|
@ -2344,32 +2330,13 @@ 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,
|
||||
complete);
|
||||
strlen(ad->title) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
static void _account_add_label(GtkWidget * box, PangoFontDescription * desc,
|
||||
|
@ -3010,6 +2977,7 @@ static int _preferences_ok_accounts(Mailer * mailer)
|
|||
{
|
||||
GtkTreeModel * model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel * view_model;
|
||||
gboolean loop;
|
||||
Account * account;
|
||||
gboolean active;
|
||||
|
@ -3021,6 +2989,8 @@ 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` -ldl
|
||||
#ldflags=`pkg-config --libs gtk+-2.0`
|
||||
#for Gtk+ 3
|
||||
cflags=`pkg-config --cflags gtk+-3.0`
|
||||
ldflags=`pkg-config --libs gtk+-3.0` -ldl
|
||||
ldflags=`pkg-config --libs gtk+-3.0`
|
||||
sources=plugins.c
|
||||
|
||||
[tests.log]
|
||||
|
|
Loading…
Reference in New Issue
Block a user