Reworking the plug-in management

This commit is contained in:
Pierre Pronchery 2012-01-05 18:29:38 +00:00
parent e947af50c3
commit a0c178ddca
5 changed files with 162 additions and 137 deletions

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,17 +34,17 @@ typedef struct _MailerPluginHelper
typedef struct _MailerPlugin MailerPlugin;
struct _MailerPlugin
typedef const struct _MailerPluginDefinition
{
MailerPluginHelper * helper;
char const * name;
char const * icon;
GtkWidget * (*init)(MailerPlugin * plugin);
char const * description;
MailerPlugin * (*init)(MailerPluginHelper * helper);
void (*destroy)(MailerPlugin * plugin);
GtkWidget * (*get_widget)(MailerPlugin * plugin);
void (*refresh)(MailerPlugin * plugin, Folder * folder,
Message * message);
void * priv;
};
} MailerPluginDefinition;
/* functions */

170
po/fr.po
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-12-10 18:53+0100\n"
"POT-Creation-Date: 2012-01-05 19:24+0100\n"
"PO-Revision-Date: 2010-10-02 23:25+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -28,11 +28,11 @@ msgstr "_Enregistrer"
msgid "Save _as..."
msgstr "Enregistrer _sous..."
#: ../src/compose.c:121 ../src/mailer.c:159
#: ../src/compose.c:121 ../src/mailer.c:162
msgid "_Print"
msgstr "_Imprimer"
#: ../src/compose.c:122 ../src/mailer.c:160
#: ../src/compose.c:122 ../src/mailer.c:163
msgid "Print pre_view"
msgstr "_Aperçu avant impression"
@ -52,7 +52,7 @@ msgstr "_Annuler"
msgid "_Redo"
msgstr "_Refaire"
#: ../src/compose.c:138 ../src/mailer.c:170
#: ../src/compose.c:138 ../src/mailer.c:173
msgid "_Cut"
msgstr "Co_uper"
@ -60,7 +60,7 @@ msgstr "Co_uper"
msgid "_Copy"
msgstr "_Copier"
#: ../src/compose.c:142 ../src/mailer.c:174
#: ../src/compose.c:142 ../src/mailer.c:177
msgid "_Paste"
msgstr "C_oller"
@ -68,7 +68,7 @@ msgstr "C_oller"
msgid "_Select all"
msgstr "Sélectionner _tout"
#: ../src/compose.c:152 ../src/mailer.c:184
#: ../src/compose.c:152 ../src/mailer.c:187
msgid "_Unselect all"
msgstr "Tout _désélectionner"
@ -76,16 +76,16 @@ msgstr "Tout _désélectionner"
msgid "Add field"
msgstr "Ajouter un champ"
#: ../src/compose.c:167 ../src/compose.c:169 ../src/mailer.c:211
#: ../src/mailer.c:213
#: ../src/compose.c:167 ../src/compose.c:169 ../src/mailer.c:214
#: ../src/mailer.c:216
msgid "_About"
msgstr "_A propos"
#: ../src/compose.c:176 ../src/mailer.c:220
#: ../src/compose.c:176 ../src/mailer.c:223
msgid "_File"
msgstr "_Fichier"
#: ../src/compose.c:177 ../src/mailer.c:221
#: ../src/compose.c:177 ../src/mailer.c:224
msgid "_Edit"
msgstr "_Edition"
@ -93,7 +93,7 @@ msgstr "_Edition"
msgid "_View"
msgstr "_Vue"
#: ../src/compose.c:179 ../src/mailer.c:223
#: ../src/compose.c:179 ../src/mailer.c:226
msgid "_Help"
msgstr "_Aide"
@ -161,8 +161,8 @@ msgstr "Sujet: "
msgid "Attach file..."
msgstr "Joindre un fichier..."
#: ../src/compose.c:689 ../src/compose.c:693 ../src/mailer.c:997
#: ../src/mailer.c:1001
#: ../src/compose.c:689 ../src/compose.c:693 ../src/mailer.c:1003
#: ../src/mailer.c:1007
msgid "Error"
msgstr "Erreur"
@ -206,151 +206,151 @@ msgstr "Envoyés"
msgid "Trash"
msgstr "Corbeille"
#: ../src/mailer.c:135
#: ../src/mailer.c:138
msgid "New account"
msgstr "Nouveau compte"
#: ../src/mailer.c:135
#: ../src/mailer.c:138
msgid "Account settings"
msgstr "Paramètres du compte"
#: ../src/mailer.c:135
#: ../src/mailer.c:138
msgid "Account confirmation"
msgstr "Confirmation du compte"
#: ../src/mailer.c:153
#: ../src/mailer.c:156
msgid "_New mail"
msgstr "_Nouveau message"
#: ../src/mailer.c:156 ../src/mailer.c:233
#: ../src/mailer.c:159 ../src/mailer.c:236
msgid "Send / Receive"
msgstr "Envoyer / Recevoir"
#: ../src/mailer.c:163
#: ../src/mailer.c:166
msgid "_Quit"
msgstr "_Quitter"
#: ../src/mailer.c:172
#: ../src/mailer.c:175
msgid "Cop_y"
msgstr "_Copier"
#: ../src/mailer.c:177
#: ../src/mailer.c:180
msgid "Select _all"
msgstr "Sélectionner _tout"
#: ../src/mailer.c:186
#: ../src/mailer.c:189
msgid "_Preferences"
msgstr "_Préférences"
#: ../src/mailer.c:193
#: ../src/mailer.c:196
msgid "_Reply"
msgstr "_Répondre"
#: ../src/mailer.c:195
#: ../src/mailer.c:198
msgid "Reply to _all"
msgstr "Répondre à _tous"
#: ../src/mailer.c:197
#: ../src/mailer.c:200
msgid "_Forward"
msgstr "_Transmettre"
#: ../src/mailer.c:200
#: ../src/mailer.c:203
msgid "_Delete"
msgstr "_Supprimer"
#: ../src/mailer.c:203
#: ../src/mailer.c:206
msgid "_View source"
msgstr "Afficher la _source"
#: ../src/mailer.c:222
#: ../src/mailer.c:225
msgid "_Message"
msgstr "_Message"
#: ../src/mailer.c:230 ../src/mailer.c:256 ../src/mailer.c:270
#: ../src/mailer.c:233 ../src/mailer.c:259 ../src/mailer.c:273
msgid "New mail"
msgstr "Nouveau message"
#: ../src/mailer.c:234
#: ../src/mailer.c:237
msgid "Stop"
msgstr "Stop"
#: ../src/mailer.c:237 ../src/mailer.c:259 ../src/mailer.c:273
#: ../src/mailer.c:240 ../src/mailer.c:262 ../src/mailer.c:276
msgid "Reply"
msgstr "Répondre"
#: ../src/mailer.c:238 ../src/mailer.c:260 ../src/mailer.c:274
#: ../src/mailer.c:241 ../src/mailer.c:263 ../src/mailer.c:277
msgid "Reply to all"
msgstr "Répondre à tous"
#: ../src/mailer.c:240 ../src/mailer.c:262 ../src/mailer.c:276
#: ../src/mailer.c:243 ../src/mailer.c:265 ../src/mailer.c:279
msgid "Forward"
msgstr "Transmettre"
#: ../src/mailer.c:243 ../src/mailer.c:264 ../src/mailer.c:278
#: ../src/mailer.c:246 ../src/mailer.c:267 ../src/mailer.c:281
msgid "Delete"
msgstr "Supprimer"
#: ../src/mailer.c:244 ../src/mailer.c:279
#: ../src/mailer.c:247 ../src/mailer.c:282
msgid "Print"
msgstr "Imprimer"
#: ../src/mailer.c:247
#: ../src/mailer.c:250
msgid "Preferences"
msgstr "Préférences"
#: ../src/mailer.c:379
#: ../src/mailer.c:382
msgid " - Folders"
msgstr " - Dossiers"
#: ../src/mailer.c:430
#: ../src/mailer.c:433
msgid "Message list"
msgstr "Liste des messages"
#: ../src/mailer.c:460
#: ../src/mailer.c:463
msgid "Message"
msgstr "Message"
#: ../src/mailer.c:497 ../src/mailer.c:1762
#: ../src/mailer.c:500 ../src/mailer.c:1773
msgid "Plug-ins"
msgstr "Greffons"
#: ../src/mailer.c:610
#: ../src/mailer.c:614
msgid "Folders"
msgstr "Dossiers"
#: ../src/mailer.c:668
#: ../src/mailer.c:672
msgid "Subject"
msgstr "Sujet"
#: ../src/mailer.c:670
#: ../src/mailer.c:674
msgid "From"
msgstr "De"
#: ../src/mailer.c:672
#: ../src/mailer.c:676
msgid "To"
msgstr "À"
#: ../src/mailer.c:674
#: ../src/mailer.c:678
msgid "Date"
msgstr "Date"
#: ../src/mailer.c:788
#: ../src/mailer.c:792
msgid " Subject: "
msgstr " Sujet: "
#: ../src/mailer.c:789
#: ../src/mailer.c:793
msgid " From: "
msgstr " De: "
#: ../src/mailer.c:790
#: ../src/mailer.c:794
msgid " To: "
msgstr " À: "
#: ../src/mailer.c:791
#: ../src/mailer.c:795
msgid " Date: "
msgstr " Date: "
#: ../src/mailer.c:1129
#: ../src/mailer.c:1135
msgid ""
"The messages selected will be deleted.\n"
"Continue?"
@ -358,144 +358,144 @@ msgstr ""
"Les messages sélectionnés vont être effacés.\n"
"Continuer?"
#: ../src/mailer.c:1287
#: ../src/mailer.c:1298
msgid "Mailer - View source"
msgstr "Mailer - Source"
#: ../src/mailer.c:1362
#: ../src/mailer.c:1373
msgid "Re: "
msgstr "Re: "
#: ../src/mailer.c:1474
#: ../src/mailer.c:1485
msgid "translator-credits"
msgstr "Pierre Pronchery <khorben@defora.org>"
#: ../src/mailer.c:1571
#: ../src/mailer.c:1582
msgid "Mailer preferences"
msgstr "Préférences de Mailer"
#: ../src/mailer.c:1648 ../src/mailer.c:1745
#: ../src/mailer.c:1659 ../src/mailer.c:1756
msgid "Enabled"
msgstr "Actif"
#: ../src/mailer.c:1652 ../src/mailer.c:1751
#: ../src/mailer.c:1663 ../src/mailer.c:1762
msgid "Name"
msgstr "Nom"
#: ../src/mailer.c:1656
#: ../src/mailer.c:1667
msgid "Type"
msgstr "Type"
#: ../src/mailer.c:1693
#: ../src/mailer.c:1704
msgid "Accounts"
msgstr "Comptes"
#: ../src/mailer.c:1708
#: ../src/mailer.c:1719
msgid "Messages font:"
msgstr "Police des messages:"
#: ../src/mailer.c:1718
#: ../src/mailer.c:1729
msgid "Display"
msgstr "Affichage"
#: ../src/mailer.c:1886
#: ../src/mailer.c:1896
msgid "No account plug-in available"
msgstr "Aucun greffon de compte disponible"
#: ../src/mailer.c:2041 ../src/mailer.c:2329
#: ../src/mailer.c:2051 ../src/mailer.c:2339
msgid "Account name"
msgstr "Nom du compte"
#: ../src/mailer.c:2048
#: ../src/mailer.c:2058
msgid "Your name"
msgstr "Votre nom"
#: ../src/mailer.c:2055
#: ../src/mailer.c:2065
msgid "e-mail address"
msgstr "Adresse e-mail"
#: ../src/mailer.c:2062
#: ../src/mailer.c:2072
msgid "Type of account"
msgstr "Type de compte"
#: ../src/mailer.c:2218
#: ../src/mailer.c:2228
msgid "Choose file"
msgstr "Choisir un fichier"
#: ../src/mailer.c:2400
#: ../src/mailer.c:2410
msgid "hidden"
msgstr "masqué"
#: ../src/mailer.c:2434
#: ../src/mailer.c:2444
msgid "Yes"
msgstr "Oui"
#: ../src/mailer.c:2434
#: ../src/mailer.c:2444
msgid "No"
msgstr "Non"
#: ../src/mailer.c:2462
#: ../src/mailer.c:2472
msgid "Account type "
msgstr "Type de compte "
#: ../src/mailer.c:2463
#: ../src/mailer.c:2473
msgid " active\n"
msgstr " actif\n"
#: ../src/mailer.c:2525
#: ../src/mailer.c:2535
msgid "Edit account: "
msgstr "Modification du compte: "
#: ../src/mailer.c:2547
#: ../src/mailer.c:2557
msgid "Account name:"
msgstr "Nom du compte :"
#: ../src/mailer.c:2556
#: ../src/mailer.c:2566
msgid "Identity:"
msgstr "Identité :"
#: ../src/mailer.c:2561
#: ../src/mailer.c:2571
msgid "Name:"
msgstr "Nom :"
#: ../src/mailer.c:2572
#: ../src/mailer.c:2582
msgid "Address:"
msgstr "Adresse :"
#: ../src/mailer.c:2583
#: ../src/mailer.c:2593
msgid "Organization:"
msgstr "Organisation :"
#: ../src/mailer.c:2596
#: ../src/mailer.c:2606
msgid "Account"
msgstr "Compte"
#: ../src/mailer.c:2601
#: ../src/mailer.c:2611
msgid "Settings"
msgstr "Paramètres"
#: ../src/mailer.c:2694
#: ../src/mailer.c:2704
msgid "An error occured while saving preferences"
msgstr "Une erreur est survenue pendant la sauvegarde des préférences"
#: ../src/mailer.c:2988 ../src/mailer.c:2992
#: ../src/mailer.c:3000 ../src/mailer.c:3004
msgid "Question"
msgstr "Question"
#: ../src/mailer.c:3059
#: ../src/mailer.c:3073
#, c-format
msgid "%s/%s: %d %s"
msgstr "%s/%s: %d %s"
#: ../src/mailer.c:3062
#: ../src/mailer.c:3076
msgid "messages"
msgstr "messages"
#: ../src/mailer.c:3062
#: ../src/mailer.c:3076
msgid "message"
msgstr "message"
#: ../src/mailer.c:3065
#: ../src/mailer.c:3079
msgid "Ready"
msgstr "Prêt"

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -12,6 +12,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* TODO:
* - properly show/hide plug-ins in the right pane */
@ -61,6 +63,7 @@ typedef enum _MailerPluginColumn
MPC_ICON,
MPC_NAME_DISPLAY,
MPC_PLUGIN,
MPC_MAILERPLUGINDEFINITION,
MPC_MAILERPLUGIN,
MPC_WIDGET
} MailerPluginColumn;
@ -138,7 +141,7 @@ static const char * _title[3] =
/* variables */
#ifdef EMBEDDED
static DesktopAccel _mailer_accel[] =
static const DesktopAccel _mailer_accel[] =
{
{ G_CALLBACK(on_quit), GDK_CONTROL_MASK, GDK_KEY_Q },
{ G_CALLBACK(on_view_source), GDK_CONTROL_MASK, GDK_KEY_U },
@ -502,7 +505,8 @@ Mailer * mailer_new(void)
#endif
mailer->pl_store = gtk_list_store_new(MPC_COUNT, G_TYPE_STRING,
G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER,
G_TYPE_POINTER);
mailer->pl_combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(
mailer->pl_store));
g_signal_connect_swapped(G_OBJECT(mailer->pl_combo), "changed",
@ -933,6 +937,7 @@ static void _delete_plugins(Mailer * mailer)
GtkTreeModel * model = GTK_TREE_MODEL(mailer->pl_store);
GtkTreeIter iter;
gboolean valid;
MailerPluginDefinition * mpd;
MailerPlugin * mp;
Plugin * plugin;
@ -940,9 +945,10 @@ static void _delete_plugins(Mailer * mailer)
valid = gtk_tree_model_iter_next(model, &iter))
{
gtk_tree_model_get(model, &iter, MPC_PLUGIN, &plugin,
MPC_MAILERPLUGINDEFINITION, &mpd,
MPC_MAILERPLUGIN, &mp, -1);
if(mp->destroy != NULL)
mp->destroy(mp);
if(mpd->destroy != NULL)
mpd->destroy(mp);
plugin_delete(plugin);
}
}
@ -1209,6 +1215,7 @@ void mailer_cut(Mailer * mailer)
int mailer_load(Mailer * mailer, char const * plugin)
{
Plugin * p;
MailerPluginDefinition * mpd;
MailerPlugin * mp;
GtkWidget * widget;
GtkTreeIter iter;
@ -1222,28 +1229,32 @@ int mailer_load(Mailer * mailer, char const * plugin)
return 0;
if((p = plugin_new(LIBDIR, PACKAGE, "plugins", plugin)) == NULL)
return -mailer_error(NULL, error_get(), 1);
if((mp = plugin_lookup(p, "plugin")) == NULL)
if((mpd = plugin_lookup(p, "plugin")) == NULL)
{
plugin_delete(p);
return -mailer_error(NULL, error_get(), 1);
}
mp->helper = &mailer->pl_helper;
if(mp->init == NULL || (widget = mp->init(mp)) == NULL)
if(mpd->init == NULL || mpd->destroy == NULL
|| (mp = mpd->init(&mailer->pl_helper)) == NULL)
{
plugin_delete(p);
return -mailer_error(NULL, error_get(), 1);
}
theme = gtk_icon_theme_get_default();
if(mp->icon != NULL)
icon = gtk_icon_theme_load_icon(theme, mp->icon, 24, 0, NULL);
if(mpd->icon != NULL)
icon = gtk_icon_theme_load_icon(theme, mpd->icon, 24, 0, NULL);
if(icon == NULL)
icon = gtk_icon_theme_load_icon(theme, "gnome-settings", 24, 0,
NULL);
widget = (mpd->get_widget != NULL) ? mpd->get_widget(mp) : NULL;
/* FIXME hide from the list of active plug-ins if there is no widget */
gtk_list_store_append(mailer->pl_store, &iter);
gtk_list_store_set(mailer->pl_store, &iter, MPC_NAME, plugin,
MPC_ICON, icon, MPC_NAME_DISPLAY, mp->name,
MPC_PLUGIN, p, MPC_MAILERPLUGIN, mp, MPC_WIDGET, widget,
-1);
MPC_ICON, icon, MPC_NAME_DISPLAY, mpd->name,
MPC_PLUGIN, p, MPC_MAILERPLUGINDEFINITION, mpd,
MPC_MAILERPLUGIN, mp, MPC_WIDGET, widget, -1);
if(widget == NULL)
return 0;
gtk_box_pack_start(GTK_BOX(mailer->pl_box), widget, TRUE, TRUE, 0);
if(gtk_widget_get_no_show_all(mailer->pl_view) == TRUE)
{
@ -1780,7 +1791,7 @@ static void _preferences_set_plugins(Mailer * mailer)
char const ext[] = ".so";
size_t len;
Plugin * p;
MailerPlugin * mp;
MailerPluginDefinition * mpd;
GtkTreeIter iter;
gboolean enabled;
GdkPixbuf * icon;
@ -1802,22 +1813,21 @@ static void _preferences_set_plugins(Mailer * mailer)
if((p = plugin_new(LIBDIR, PACKAGE, "plugins", de->d_name))
== NULL)
continue;
if((mp = plugin_lookup(p, "plugin")) == NULL)
if((mpd = plugin_lookup(p, "plugin")) == NULL)
{
plugin_delete(p);
continue;
}
enabled = _mailer_plugin_is_enabled(mailer, de->d_name);
icon = NULL;
if(mp->icon != NULL)
icon = gtk_icon_theme_load_icon(theme, mp->icon, 24, 0,
NULL);
icon = (mpd->icon != NULL) ? gtk_icon_theme_load_icon(theme,
mpd->icon, 24, 0, NULL) : NULL;
if(icon == NULL)
icon = gtk_icon_theme_load_icon(theme, "gnome-settings",
24, 0, NULL);
gtk_list_store_append(mailer->pr_plugins_store, &iter);
gtk_list_store_set(mailer->pr_plugins_store, &iter,
0, de->d_name, 1, enabled, 2, icon, 3, mp->name,
MPC_NAME, de->d_name, MPC_ENABLED, enabled,
MPC_ICON, icon, MPC_NAME_DISPLAY, mpd->name,
-1);
plugin_delete(p);
}
@ -2835,6 +2845,7 @@ int mailer_unload(Mailer * mailer, char const * plugin)
gboolean valid;
gchar * p;
Plugin * pp;
MailerPluginDefinition * mpd;
MailerPlugin * mp;
gboolean enabled = FALSE;
@ -2843,6 +2854,7 @@ int mailer_unload(Mailer * mailer, char const * plugin)
valid = gtk_tree_model_iter_next(model, &iter))
{
gtk_tree_model_get(model, &iter, MPC_NAME, &p, MPC_PLUGIN, &pp,
MPC_MAILERPLUGINDEFINITION, &mpd,
MPC_MAILERPLUGIN, &mp, -1);
enabled = (strcmp(p, plugin) == 0) ? TRUE : FALSE;
g_free(p);
@ -2852,8 +2864,8 @@ int mailer_unload(Mailer * mailer, char const * plugin)
if(enabled != TRUE)
return 0;
gtk_list_store_remove(mailer->pl_store, &iter);
if(mp->destroy != NULL)
mp->destroy(mp);
if(mpd->destroy != NULL)
mpd->destroy(mp);
plugin_delete(pp);
return 0;
}
@ -3032,15 +3044,17 @@ static void _mailer_refresh_plugin(Mailer * mailer)
{
GtkTreeModel * model = GTK_TREE_MODEL(mailer->pl_store);
GtkTreeIter iter;
MailerPluginDefinition * mpd;
MailerPlugin * mp;
if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(mailer->pl_combo), &iter)
!= TRUE)
return;
gtk_tree_model_get(model, &iter, MPC_MAILERPLUGIN, &mp, -1);
if(mp->refresh == NULL)
gtk_tree_model_get(model, &iter, MPC_MAILERPLUGINDEFINITION, &mpd,
MPC_MAILERPLUGIN, &mp, -1);
if(mpd->refresh == NULL)
return;
mp->refresh(mp, mailer->folder_cur, mailer->message_cur);
mpd->refresh(mp, mailer->folder_cur, mailer->message_cur);
}

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,36 +22,42 @@
/* Mailing-lists */
/* private */
/* types */
typedef struct _MailingLists
typedef struct _MailerPlugin MailingLists;
struct _MailerPlugin
{
MailerPluginHelper * helper;
/* widgets */
GtkWidget * vbox;
GtkWidget * folder;
GtkWidget * message;
GtkWidget * name;
} MailingLists;
};
/* protected */
/* prototypes */
/* plug-in */
static GtkWidget * _ml_init(MailerPlugin * plugin);
static void _ml_destroy(MailerPlugin * plugin);
static void _ml_refresh(MailerPlugin * plugin, Folder * folder,
static MailerPlugin * _ml_init(MailerPluginHelper * helper);
static void _ml_destroy(MailingLists * ml);
static GtkWidget * _ml_get_widget(MailingLists * ml);
static void _ml_refresh(MailingLists * ml, Folder * folder,
Message * message);
/* public */
/* variables */
/* plug-in */
MailerPlugin plugin =
MailerPluginDefinition plugin =
{
NULL,
"Mailing-lists",
NULL,
"Mailing-lists management",
_ml_init,
_ml_destroy,
_ml_refresh,
NULL
_ml_get_widget,
_ml_refresh
};
@ -59,14 +65,15 @@ MailerPlugin plugin =
/* functions */
/* plug-in */
/* ml_init */
static GtkWidget * _ml_init(MailerPlugin * plugin)
static MailerPlugin * _ml_init(MailerPluginHelper * helper)
{
MailingLists * ml;
PangoFontDescription * bold;
if((ml = malloc(sizeof(*ml))) == NULL)
return NULL;
plugin->priv = ml;
ml->helper = helper;
/* widgets */
bold = pango_font_description_new();
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
ml->vbox = gtk_vbox_new(FALSE, 4);
@ -81,24 +88,28 @@ static GtkWidget * _ml_init(MailerPlugin * plugin)
gtk_misc_set_alignment(GTK_MISC(ml->name), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(ml->vbox), ml->name, FALSE, TRUE, 0);
pango_font_description_free(bold);
return ml->vbox;
return ml;
}
/* ml_destroy */
static void _ml_destroy(MailerPlugin * plugin)
static void _ml_destroy(MailingLists * ml)
{
MailingLists * ml = plugin->priv;
free(ml);
}
/* ml_get_widget */
static GtkWidget * _ml_get_widget(MailingLists * ml)
{
return ml->vbox;
}
/* ml_refresh */
static void _ml_refresh(MailerPlugin * plugin, Folder * folder,
static void _ml_refresh(MailingLists * ml, Folder * folder,
Message * message)
{
MailingLists * ml = plugin->priv;
char const * id;
if(folder == NULL)

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Mailer */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,11 +23,11 @@
/* protected */
/* variables */
/* plug-in */
MailerPlugin plugin =
MailerPluginDefinition plugin =
{
NULL,
"Search",
"search",
"Search inside messages",
NULL,
NULL,
NULL,