mail-notification

Fork of Jean-Yves Lefort's mail-notification, a tray icon to notify of new mail
git clone https://code.djc.id.au/git/mail-notification/

jbsrc/jb.c (21216B) - raw

      1 /*
      2  * Mail Notification
      3  * Copyright (C) 2003-2008 Jean-Yves Lefort <jylefort@brutele.be>
      4  *
      5  * This program is free software; you can redistribute it and/or modify
      6  * it under the terms of the GNU General Public License as published by
      7  * the Free Software Foundation; either version 3 of the License, or
      8  * (at your option) any later version.
      9  *
     10  * This program is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  * GNU General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU General Public License along
     16  * with this program; if not, write to the Free Software Foundation, Inc.,
     17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     18  */
     19 
     20 #include "jb.h"
     21 
     22 #jb_include <jb-dbus>
     23 #jb_include <jb-endianness>
     24 #jb_include <jb-evolution-plugin>
     25 #jb_include <jb-openssl>
     26 #jb_include <jb-sasl2>
     27 #jb_include <jb-string-arch-unaligned>
     28 
     29 #define MN_WARNING_CFLAGS \
     30   "-Wall "				\
     31   "-Wformat-y2k "			\
     32   "-Wformat-security "			\
     33   "-Wno-unused-parameter "		\
     34   "-Wfloat-equal "			\
     35   "-Wdeclaration-after-statement "	\
     36   "-Wendif-labels "			\
     37   "-Wpointer-arith "			\
     38   "-Wcast-align	"			\
     39   "-Waggregate-return "			\
     40   "-Wmissing-noreturn "			\
     41   "-Wmissing-format-attribute "		\
     42   "-Wpacked "				\
     43   "-Wredundant-decls "			\
     44   "-Wnested-externs "			\
     45   "-Winline "				\
     46   "-Wno-pointer-sign "			\
     47   "-Wshadow "
     48 
     49 static const JBFeature *jb_features[] = {
     50   &jb_pkg_config_feature,
     51   &jb_gettext_feature,
     52   &jb_intltool_feature,
     53   &jb_gconf_feature,
     54   &jb_gnome_help_feature,
     55   &jb_dbus_feature,
     56   &jb_gob2_feature
     57 };
     58 
     59 void
     60 jb_package_init (void)
     61 {
     62   JBVariableGroup *backends_group;
     63   JBVariableGroup *pi_group;
     64 
     65   /* by default, use the GNOME prefix */
     66   jb_set_prefix_from_program("gnome-open");
     67 
     68   /*
     69    * At the time of this writing, gob2 2.0.16 is not yet
     70    * released. What is required is gob2 2.0.15 + my patches (see the
     71    * gob mailing list), which should eventually become gob2 2.0.16.
     72    */
     73   jb_variable_set_string("gob2-minversion", "2.0.17");
     74 
     75   jb_evolution_plugin_init();
     76 
     77   backends_group = jb_variable_add_group("Mailbox backends");
     78   pi_group = jb_variable_add_group("IMAP and POP3 features");
     79 
     80   /* mailbox backends */
     81   jb_variable_add_bool("evolution",
     82 		       "enable Evolution mailbox support",
     83 		       backends_group,
     84 		       JB_VARIABLE_C_DEFINE,
     85 		       TRUE);
     86   jb_variable_add_bool("gmail",
     87 		       "enable Gmail mailbox support",
     88 		       backends_group,
     89 		       JB_VARIABLE_C_DEFINE,
     90 		       TRUE);
     91   jb_variable_add_bool("hotmail",
     92 		       "enable Hotmail mailbox support",
     93 		       backends_group,
     94 		       JB_VARIABLE_C_DEFINE,
     95 		       TRUE);
     96   jb_variable_add_bool("imap",
     97 		       "enable IMAP mailbox support",
     98 		       backends_group,
     99 		       JB_VARIABLE_C_DEFINE,
    100 		       TRUE);
    101   jb_variable_add_bool("maildir",
    102 		       "enable Maildir mailbox support",
    103 		       backends_group,
    104 		       JB_VARIABLE_C_DEFINE,
    105 		       TRUE);
    106   jb_variable_add_bool("mbox",
    107 		       "enable mbox mailbox support",
    108 		       backends_group,
    109 		       JB_VARIABLE_C_DEFINE,
    110 		       TRUE);
    111   jb_variable_add_bool("mh",
    112 		       "enable MH mailbox support",
    113 		       backends_group,
    114 		       JB_VARIABLE_C_DEFINE,
    115 		       TRUE);
    116   jb_variable_add_bool("mozilla",
    117 		       "enable Mozilla products mailbox support",
    118 		       backends_group,
    119 		       JB_VARIABLE_C_DEFINE,
    120 		       TRUE);
    121   jb_variable_add_bool("pop3",
    122 		       "enable POP3 mailbox support",
    123 		       backends_group,
    124 		       JB_VARIABLE_C_DEFINE,
    125 		       TRUE);
    126   jb_variable_add_bool("sylpheed",
    127 		       "enable Sylpheed mailbox support",
    128 		       backends_group,
    129 		       JB_VARIABLE_C_DEFINE,
    130 		       TRUE);
    131   jb_variable_add_bool("yahoo",
    132 		       "enable Yahoo! Mail mailbox support",
    133 		       backends_group,
    134 		       JB_VARIABLE_C_DEFINE,
    135 		       TRUE);
    136 
    137   /* POP3 and IMAP features */
    138   jb_variable_add_bool("ipv6",
    139 		       "enable IPv6 support",
    140 		       pi_group,
    141 		       JB_VARIABLE_C_DEFINE,
    142 		       TRUE);
    143   jb_variable_add_bool("sasl",
    144 		       "enable SASL authentication support",
    145 		       pi_group,
    146 		       JB_VARIABLE_C_DEFINE,
    147 		       TRUE);
    148   jb_variable_add_bool("ssl",
    149 		       "enable SSL/TLS support",
    150 		       pi_group,
    151 		       JB_VARIABLE_C_DEFINE,
    152 		       TRUE);
    153 
    154   /* misc */
    155   jb_variable_add_bool("compile-warnings", NULL, NULL, 0, FALSE);
    156   jb_variable_add_bool("debug", NULL, NULL, 0, FALSE);
    157   jb_variable_add_bool("regression-tests", NULL, NULL, 0, FALSE);
    158   jb_variable_add_bool("gconf-sanity-check", NULL, NULL, JB_VARIABLE_C_DEFINE, TRUE);
    159   jb_variable_add_bool("update-gtk-icon-cache", NULL, NULL, 0, TRUE);
    160 }
    161 
    162 void
    163 jb_package_configure (void)
    164 {
    165   jb_check_glibc();
    166 
    167   jb_require_packages("GNOME", "gnome", "glib-2.0 >= 2.14 gthread-2.0 gconf-2.0 >= 2.4.0 gtk+-2.0 >= 2.12 libgnomeui-2.0 >= 2.14.0 gnome-vfs-2.0 libglade-2.0 libxml-2.0 libnotify >= 0.4.1");
    168   jb_require_packages("D-Bus", "dbus", "dbus-glib-1");
    169 
    170   jb_check_packages_for_options("GMime", "gmime", "gmime-2.0 >= 2.2.7",
    171 				"hotmail",
    172 				"imap",
    173 				"maildir",
    174 				"mbox",
    175 				"mh",
    176 				"mozilla",
    177 				"pop3",
    178 				"sylpheed",
    179 				"yahoo",
    180 				NULL);
    181 
    182   jb_check_packages_for_options("GNOME Keyring", "gnome-keyring", "gnome-keyring-1",
    183 				"pop3",
    184 				"imap",
    185 				"gmail",
    186 				"yahoo",
    187 				"hotmail",
    188 				NULL);
    189 
    190   if (jb_variable_get_bool("pop3") || jb_variable_get_bool("imap"))
    191     {
    192       jb_check_reentrant_dns_resolver();
    193 
    194       if (jb_variable_get_bool("pop3"))
    195 	{
    196 	  /* needed by mn-md5.c */
    197 	  jb_endianness_check();
    198 	  jb_string_arch_unaligned_check();
    199 	}
    200     }
    201   else
    202     {
    203       if (jb_variable_get_bool("ipv6"))
    204 	{
    205 	  jb_warning("disabling option \"ipv6\" since options \"pop3\" and \"imap\" are disabled");
    206 	  jb_variable_set_bool("ipv6", FALSE);
    207 	}
    208       if (jb_variable_get_bool("sasl"))
    209 	{
    210 	  jb_warning("disabling option \"sasl\" since options \"pop3\" and \"imap\" are disabled");
    211 	  jb_variable_set_bool("sasl", FALSE);
    212 	}
    213       if (jb_variable_get_bool("ssl"))
    214 	{
    215 	  jb_warning("disabling option \"ssl\" since options \"pop3\" and \"imap\" are disabled");
    216 	  jb_variable_set_bool("ssl", FALSE);
    217 	}
    218     }
    219 
    220   if (jb_variable_get_bool("sasl"))
    221     {
    222       if (! jb_sasl2_check(NULL))
    223 	{
    224 	  jb_warning("disabling option \"sasl\" since Cyrus SASL was not found");
    225 	  jb_variable_set_bool("sasl", FALSE);
    226 	}
    227     }
    228 
    229   if (jb_variable_get_bool("ssl"))
    230     {
    231       if (jb_openssl_check("0.9.6"))
    232 	{
    233 	  if (! jb_openssl_check_mt())
    234 	    {
    235 	      jb_warning("disabling option \"ssl\" since OpenSSL does not support multi-threading");
    236 	      jb_variable_set_bool("ssl", FALSE);
    237 	    }
    238 	}
    239       else
    240 	{
    241 	  jb_warning("disabling option \"ssl\" since OpenSSL was not found");
    242 	  jb_variable_set_bool("ssl", FALSE);
    243 	}
    244     }
    245 
    246   if (jb_variable_get_bool("evolution"))
    247     {
    248       if (! jb_evolution_plugin_check(NULL))
    249 	{
    250 	  jb_warning("disabling option \"evolution\" since Evolution was not found");
    251 	  jb_variable_set_bool("evolution", FALSE);
    252 	}
    253     }
    254 
    255   if (jb_variable_get_bool("gmail"))
    256     {
    257       if (jb_check_functions("timegm", NULL))
    258 	jb_compile_options_add_cppflags(jb_compile_options, "-DHAVE_TIMEGM");
    259       else
    260 	jb_warning("timegm() not available, Gmail message dates will not be displayed");
    261     }
    262 }
    263 
    264 static void
    265 add_vfs_test (JBGroup *group, const char *name, int block_size)
    266 {
    267   JBObject *object;
    268   char *program_name;
    269   char *cppflags;
    270   int i;
    271 
    272   program_name = g_strdup_printf("test-vfs-read-line-%s", name);
    273   object = JB_OBJECT(jb_program_new(program_name));
    274 
    275   jb_install_options_set_installdir(object->install_options, NULL);
    276 
    277   jb_object_add_sources(object,
    278 			"../src/mn-vfs.c",
    279 			"test-vfs-read-line.c",
    280 			NULL);
    281 
    282   cppflags = g_strdup_printf("-Isrc -DREAD_LINE_BLOCK_SIZE=%i -DMN_REGRESSION_TEST", block_size);
    283   jb_compile_options_add_cppflags(object->compile_options, cppflags);
    284   g_free(cppflags);
    285 
    286   jb_compile_options_add_package(object->compile_options, "gnome");
    287 
    288   jb_group_add_resource(group, JB_GROUP_RESOURCE(object));
    289 
    290   for (i = 1; i < 3; i++)
    291     {
    292       JBRule *rule;
    293       char *outfile;
    294       char *infile;
    295       char *expected;
    296 
    297       outfile = g_strdup_printf("test-vfs-read-line%i-%s.output", i, name);
    298       infile = g_strdup_printf("test-vfs-read-line%i.input", i);
    299       expected = g_strdup_printf("test-vfs-read-line%i.expected", i);
    300 
    301       rule = jb_rule_new();
    302 
    303       jb_rule_add_dependency(rule, JB_GROUP_RESOURCE(object));
    304 
    305       jb_rule_add_input_file(rule, "$builddir/%s", program_name);
    306       jb_rule_add_input_file(rule, "$srcdir/%s", infile);
    307       jb_rule_add_input_file(rule, "$srcdir/%s", expected);
    308       jb_rule_add_output_file(rule, "$builddir/%s", outfile);
    309 
    310       jb_rule_set_build_message(rule, "running VFS test %i-%s", i, name);
    311 
    312       jb_rule_add_build_command(rule, "$builddir/%s file://`pwd`/$srcdir/%s > $builddir/%s",
    313 				program_name, infile, outfile);
    314       jb_rule_add_build_command(rule, "cmp $builddir/%s $srcdir/%s",
    315 				outfile, expected);
    316 
    317       jb_group_add_resource(group, JB_GROUP_RESOURCE(rule));
    318 
    319       jb_group_add_dist_files(group, infile, expected, NULL);
    320 
    321       g_free(outfile);
    322       g_free(infile);
    323       g_free(expected);
    324     }
    325 
    326   g_free(program_name);
    327 }
    328 
    329 void
    330 jb_package_add_resources (void)
    331 {
    332   JBGroup *group;
    333   JBRule *rule;
    334   JBObject *object;
    335 
    336   if (jb_variable_get_bool("compile-warnings"))
    337     jb_compile_options_add_cflags(jb_compile_options, MN_WARNING_CFLAGS " -Werror");
    338 
    339   if (! jb_variable_get_bool("debug"))
    340     jb_compile_options_add_cflags(jb_compile_options, "-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS");
    341 
    342   jb_compile_options_add_gob2flags(jb_compile_options, "--exit-on-warn");
    343 
    344   /*** art *******************************************************************/
    345 
    346   group = jb_group_new("art");
    347 
    348   jb_group_add_data_files(group,
    349 			  "16x16/apps/mail-notification.png", "$datadir/icons/hicolor/16x16/apps",
    350 			  "22x22/apps/mail-notification.png", "$datadir/icons/hicolor/22x22/apps",
    351 			  "24x24/apps/mail-notification.png", "$datadir/icons/hicolor/24x24/apps",
    352 			  "32x32/apps/mail-notification.png", "$datadir/icons/hicolor/32x32/apps",
    353 			  "48x48/apps/mail-notification.png", "$datadir/icons/hicolor/48x48/apps",
    354 			  "scalable/apps/mail-notification.svg", "$datadir/icons/hicolor/scalable/apps",
    355 			  NULL);
    356 
    357   jb_group_add_data_file(group, "logo.png", "$pkgdatadir");
    358 
    359   if (jb_variable_get_bool("gmail"))
    360     jb_group_add_data_file(group, "gmail.png", "$pkgdatadir");
    361 
    362   if (jb_variable_get_bool("yahoo"))
    363     jb_group_add_data_file(group, "yahoo.png", "$pkgdatadir");
    364 
    365   if (jb_variable_get_bool("hotmail"))
    366     jb_group_add_data_file(group, "hotmail.png", "$pkgdatadir");
    367 
    368   if (jb_variable_get_bool("update-gtk-icon-cache")) {
    369     rule = jb_rule_new();
    370     jb_rule_set_install_message(rule, "updating the GTK+ icon cache");
    371     jb_rule_add_install_command(rule, "-gtk-update-icon-cache -f -t $datadir/icons/hicolor");
    372     jb_group_add_resource(group, JB_GROUP_RESOURCE(rule));
    373   }
    374 
    375   jb_group_add(group);
    376 
    377   /*** data ******************************************************************/
    378 
    379   group = jb_group_new("data");
    380 
    381   jb_group_add_desktop_file(group, "mail-notification-properties.desktop.in", "$datadir/applications");
    382   jb_group_add_desktop_file(group, "mail-notification.desktop.in", "$sysconfdir/xdg/autostart");
    383 
    384   jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_template_new("mail-notification.schemas.in.in")));
    385   jb_group_add_gconf_schemas(group, "mail-notification.schemas.in");
    386 
    387   jb_group_add_data_file(group, "new-mail.wav", "$pkgdatadir");
    388 
    389   jb_group_add_dist_file(group, "sylpheed-locking.diff");
    390 
    391   jb_group_add(group);
    392 
    393   /*** help ******************************************************************/
    394 
    395   group = jb_group_new("help");
    396 
    397   jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_gnome_help_new("C", "documentation-license.xml software-license.xml")));
    398 
    399   jb_group_add(group);
    400 
    401   /*** po ********************************************************************/
    402 
    403   group = jb_group_new("po");
    404 
    405   jb_group_add_translations(group, "bg ca cs de es fr ja nl pl pt pt_BR ru sr sr@Latn sv");
    406 
    407   jb_group_add(group);
    408 
    409   /*** src *******************************************************************/
    410 
    411   group = jb_group_new("src");
    412 
    413   jb_compile_options_add_string_defines(group->compile_options,
    414 					"GETTEXT_PACKAGE", "$package",
    415 					NULL);
    416 
    417   object = JB_OBJECT(jb_program_new("mail-notification"));
    418 
    419   if (jb_variable_get_bool("glibc"))
    420     {
    421       /*
    422        * We need -std=c99 for lround(), ...
    423        * We need _BSD_SOURCE (which requires -lbsd-compat) for fchmod(), ...
    424        * We need _POSIX_C_SOURCE for fdopen(), ...
    425        */
    426       jb_compile_options_add_cflags(object->compile_options, "-std=c99");
    427       jb_compile_options_add_cppflags(object->compile_options, "-D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L");
    428       jb_compile_options_add_libs(object->compile_options, "-lbsd-compat");
    429     }
    430 
    431   jb_compile_options_add_string_defines(object->compile_options,
    432 					"PACKAGE", "$package",
    433 					"VERSION", "$version",
    434 					"PREFIX", "$prefix",
    435 					"SYSCONFDIR", "$sysconfdir",
    436 					"DATADIR", "$datadir",
    437 					"PKGDATADIR", "$pkgdatadir",
    438 					"LIBDIR", "$libdir",
    439 					"GNOMELOCALEDIR", "$datadir/locale",
    440 					NULL);
    441 
    442   /*
    443    * We need --export-dynamic because because libglade needs to
    444    * resolve symbols from our own binary in order to autoconnect
    445    * signal handlers.
    446    */
    447   jb_compile_options_add_ldflags(object->compile_options, "-Wl,--export-dynamic");
    448 
    449   jb_compile_options_add_libs(object->compile_options, "-lm");
    450 
    451   jb_compile_options_add_package(object->compile_options, "gettext");
    452   jb_compile_options_add_package(object->compile_options, "gnome");
    453   jb_compile_options_add_package(object->compile_options, "dbus");
    454 
    455   jb_group_add_dbus_interface(group,
    456 			      "org.gnome.MailNotification",
    457 			      "mn-client-dbus.h",
    458 			      "mn-server-dbus.h",
    459 			      "mn_server");
    460 
    461   jb_object_add_sources(object,
    462 			"MN:About:Dialog",
    463 			"MN:Autodetect:Mailbox:Properties",
    464 			"MN:Compact:Message:View",
    465 			"MN:Dialog",
    466 			"MN:File:Chooser:Button",
    467 			"MN:Mail:Icon",
    468 			"MN:Mail:Icon:Widget",
    469 			"MN:Mailbox",
    470 			"MN:Mailbox:Properties",
    471 			"MN:Mailbox:Properties:Dialog",
    472 			"MN:Mailbox:View",
    473 			"MN:Mailboxes",
    474 			"MN:Message",
    475 			"MN:Message:View",
    476 			"MN:Popup",
    477 			"MN:Popups",
    478 			"MN:Properties:Dialog",
    479 			"MN:Server",
    480 			"MN:Shell",
    481 			"MN:Sound:File:Chooser:Dialog",
    482 			"MN:Sound:Player",
    483 			"MN:Standard:Message:View",
    484 			"MN:Test:Mailbox",
    485 			"MN:Text:Table",
    486 			"MN:Tooltips",
    487 			"eggtrayicon",
    488 			"mn-conf",
    489 			"mn-decls.h",
    490 			"mn-locked-callback",
    491 			"mn-main.c",
    492 			"mn-non-linear-range",
    493 			"mn-stock",
    494 			"mn-util",
    495 			"mn-vfs",
    496 			"mn-xml",
    497 			"nautilus-cell-renderer-pixbuf-emblem",
    498 			NULL);
    499 
    500   if (jb_variable_get_bool("mbox"))
    501     jb_object_add_source(object, "MN:Mbox:Mailbox:Backend");
    502 
    503   if (jb_variable_get_bool("mozilla"))
    504     jb_object_add_source(object, "MN:Mozilla:Mailbox:Backend");
    505 
    506   if (jb_variable_get_bool("mbox") || jb_variable_get_bool("mozilla"))
    507     jb_object_add_source(object, "MN:Base:Mbox:Mailbox:Backend");
    508 
    509   if (jb_variable_get_bool("mh"))
    510     jb_object_add_source(object, "MN:MH:Mailbox:Backend");
    511 
    512   if (jb_variable_get_bool("maildir"))
    513     jb_object_add_sources(object,
    514 			  "MN:Maildir:Mailbox:Backend",
    515 			  "MN:Maildir:Message",
    516 			  NULL);
    517 
    518   if (jb_variable_get_bool("pop3"))
    519     jb_object_add_sources(object,
    520 			  "MN:POP3:Mailbox",
    521 			  "MN:POP3:Mailbox:Properties",
    522 			  "mn-md5",
    523 			  NULL);
    524 
    525   if (jb_variable_get_bool("imap"))
    526     jb_object_add_sources(object,
    527 			  "MN:IMAP:Mailbox",
    528 			  "MN:IMAP:Mailbox:Properties",
    529 			  NULL);
    530 
    531   if (jb_variable_get_bool("pop3") || jb_variable_get_bool("imap"))
    532     jb_object_add_sources(object,
    533 			  "MN:Auth:Combo:Box",
    534 			  "MN:PI:Mailbox",
    535 			  "MN:PI:Mailbox:Properties",
    536 			  "mn-client-session",
    537 			  NULL);
    538 
    539   if (jb_variable_get_bool("pop3")
    540       || jb_variable_get_bool("imap")
    541       || jb_variable_get_bool("gmail")
    542       || jb_variable_get_bool("yahoo")
    543       || jb_variable_get_bool("hotmail"))
    544     {
    545       jb_compile_options_add_package(object->compile_options, "gnome-keyring");
    546       jb_object_add_sources(object,
    547 			    "MN:Authenticated:Mailbox",
    548 			    "MN:Authenticated:Mailbox:Properties",
    549 			    "mn-keyring",
    550 			    NULL);
    551     }
    552 
    553   if (jb_variable_get_bool("sylpheed"))
    554     jb_object_add_sources(object,
    555 			  "MN:Sylpheed:Mailbox:Backend",
    556 			  "MN:Sylpheed:Message",
    557 			  NULL);
    558 
    559   if (jb_variable_get_bool("maildir") || jb_variable_get_bool("sylpheed"))
    560     jb_object_add_source(object, "MN:VFS:Message");
    561 
    562   if (jb_variable_get_bool("gmail"))
    563     jb_object_add_sources(object,
    564 			  "MN:Gmail:Mailbox",
    565 			  "MN:Gmail:Mailbox:Properties",
    566 			  NULL);
    567 
    568   if (jb_variable_get_bool("yahoo"))
    569     jb_object_add_sources(object,
    570 			  "MN:Yahoo:Mailbox",
    571 			  "MN:Yahoo:Mailbox:Properties",
    572 			  NULL);
    573 
    574   if (jb_variable_get_bool("hotmail"))
    575     jb_object_add_sources(object,
    576 			  "MN:Hotmail:Mailbox",
    577 			  "MN:Hotmail:Mailbox:Properties",
    578 			  NULL);
    579 
    580   if (jb_variable_get_bool("yahoo") || jb_variable_get_bool("hotmail"))
    581     jb_object_add_sources(object,
    582 			  "MN:Webmail:Mailbox",
    583 			  "MN:Webmail:Mailbox:Properties",
    584 			  NULL);
    585 
    586   if (jb_variable_get_bool("mbox")
    587       || jb_variable_get_bool("mozilla")
    588       || jb_variable_get_bool("mh")
    589       || jb_variable_get_bool("maildir")
    590       || jb_variable_get_bool("sylpheed"))
    591     jb_object_add_sources(object,
    592 			  "MN:Custom:VFS:Mailbox",
    593 			  "MN:Reentrant:Mailbox",
    594 			  "MN:System:VFS:Mailbox",
    595 			  "MN:System:VFS:Mailbox:Properties",
    596 			  "MN:VFS:Mailbox",
    597 			  "MN:VFS:Mailbox:Backend",
    598 			  NULL);
    599 
    600   if (jb_variable_get_bool("hotmail")
    601       || jb_variable_get_bool("imap")
    602       || jb_variable_get_bool("maildir")
    603       || jb_variable_get_bool("mbox")
    604       || jb_variable_get_bool("mh")
    605       || jb_variable_get_bool("mozilla")
    606       || jb_variable_get_bool("pop3")
    607       || jb_variable_get_bool("sylpheed")
    608       || jb_variable_get_bool("yahoo"))
    609     {
    610       jb_compile_options_add_cppflags(object->compile_options, "-DWITH_GMIME=1");
    611       jb_compile_options_add_package(object->compile_options, "gmime");
    612       jb_object_add_sources(object,
    613 			    "mn-message-mime",
    614 			    "MN:GMime:Stream:VFS",
    615 			    NULL);
    616     }
    617 
    618   if (jb_variable_get_bool("ssl"))
    619     {
    620       jb_compile_options_add_package(object->compile_options, "openssl");
    621       jb_object_add_source(object, "mn-ssl");
    622     }
    623 
    624   if (jb_variable_get_bool("sasl"))
    625     {
    626       jb_compile_options_add_package(object->compile_options, "sasl2");
    627       jb_object_add_source(object, "mn-sasl");
    628     }
    629 
    630   if (jb_variable_get_bool("evolution"))
    631     {
    632       JBObject *plugin;
    633 
    634       jb_group_add_resource(group, JB_GROUP_RESOURCE(jb_template_new("org-jylefort-mail-notification.eplug.in")));
    635       jb_group_add_data_file(group, "org-jylefort-mail-notification.eplug", "$evolution-plugin-dir");
    636 
    637       jb_compile_options_add_cflags(object->compile_options, "$evolution-plugin-cflags");
    638 
    639       jb_group_add_dbus_interface(group,
    640 				  "org.freedesktop.DBus.Properties",
    641 				  "mn-dbus-properties-client-dbus.h",
    642 				  NULL,
    643 				  NULL);
    644       jb_group_add_dbus_interface(group,
    645 				  "org.gnome.MailNotification.Evolution",
    646 				  "mn-evolution-client-dbus.h",
    647 				  NULL,
    648 				  NULL);
    649 
    650       jb_object_add_sources(object,
    651 			    "MN:Evolution:Client",
    652 			    "MN:Evolution:Folder:Tree:Client",
    653 			    "MN:Evolution:Mailbox",
    654 			    "MN:Evolution:Mailbox:Properties",
    655 			    "MN:Evolution:Message",
    656 			    "mn-evolution.h",
    657 			    NULL);
    658 
    659       plugin = JB_OBJECT(jb_module_new("liborg-jylefort-mail-notification"));
    660 
    661       jb_install_options_set_installdir(plugin->install_options, "$evolution-plugin-dir");
    662 
    663       jb_compile_options_add_package(plugin->compile_options, "gettext");
    664       jb_compile_options_add_package(plugin->compile_options, "evolution-plugin");
    665       jb_compile_options_add_package(plugin->compile_options, "dbus");
    666 
    667       jb_group_add_dbus_interface(group,
    668 				  "org.gnome.MailNotification.Evolution",
    669 				  NULL,
    670 				  "mn-evolution-server-dbus.h",
    671 				  "mn_evolution_server");
    672       jb_group_add_dbus_interface(group,
    673 				  "org.gnome.MailNotification.Evolution.FolderTree",
    674 				  NULL,
    675 				  "mn-evolution-folder-tree-server-dbus.h",
    676 				  "mn_evolution_folder_tree_server");
    677 
    678       jb_object_add_sources(plugin,
    679 			    "MN:Evolution:Folder:Tree:Server",
    680 			    "MN:Evolution:Server",
    681 			    "mn-evolution-plugin",
    682 			    "mn-evolution.h",
    683 			    NULL);
    684 
    685       jb_group_add_resource(group, JB_GROUP_RESOURCE(plugin));
    686     }
    687 
    688   jb_group_add_resource(group, JB_GROUP_RESOURCE(object));
    689 
    690   jb_group_add(group);
    691 
    692   /*** ui ********************************************************************/
    693 
    694   group = jb_group_new("ui");
    695 
    696   jb_group_add_data_files(group,
    697 			  "mailbox-properties-dialog.glade", "$pkgdatadir",
    698 			  "properties-dialog.glade", "$pkgdatadir",
    699 			  NULL);
    700 
    701   jb_group_add(group);
    702 
    703   if (jb_variable_get_bool("regression-tests"))
    704     {
    705       group = jb_group_new("tests");
    706 
    707       add_vfs_test(group, "smallblock", 4);
    708       add_vfs_test(group, "largeblock", 16384);
    709 
    710       jb_group_add(group);
    711     }
    712 }
    713 
    714 JB_MAIN("mail-notification", "5.4", "Mail Notification")