commit a0de6c1b8f0f28f03b65d068e202defaa75b85fd
parent af149c96df6c62e371e5678d7f6443de9b552d6b
Author: Jean-Yves Lefort <jylefort@brutele.be>
Date: Fri, 12 Mar 2004 23:00:16 +1000
mail-notification-0.3.3
* A bug in the mbox checking code has been fixed (reported by
Pau Artigas)
* A few minor bugs have been fixed
* A few memory leaks have been fixed
Diffstat:
34 files changed, 581 insertions(+), 419 deletions(-)
diff --git a/AUTHORS b/AUTHORS
@@ -8,7 +8,6 @@ copyright holder for all the files in the distribution, except:
* files saying otherwise in their top notice
* art/about-icon.png
- art/add-icon.png
art/logo.png
art/mail-notification.png
art/mail.png
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,88 @@
+2004-03-12 13:57 jylefort
+
+ * configure.ac: Version 0.3.3
+
+2004-03-12 13:44 jylefort
+
+ * src/mn-ui.c: Updated copyright date
+
+2004-03-12 13:35 jylefort
+
+ * art/Makefile.am, art/add-icon.png, src/mn-preferences.c,
+ ui/add-pop3.glade: Add dialogs are now transient
+
+2004-03-12 13:25 jylefort
+
+ * src/: mn-check.c, mn-mail-icon.c, mn-mail-icon.h,
+ mn-preferences.c, mn-ui.c: Cleanups
+
+2004-03-12 12:23 jylefort
+
+ * src/: mn-check.c, mn-mailboxes.c, mn-mailboxes.h,
+ mn-preferences.c, mn-util.c, mn-util.h: The mailbox list is now
+ thread-safe; fixed a memory leak in the preferences code
+
+2004-03-12 11:52 jylefort
+
+ * src/mn-mail-icon.c: Do not update the sensitivity of the "Check
+ for Mail" item while the menu is popped up (looked bad)
+
+2004-03-12 10:40 jylefort
+
+ * src/mn-check.c: Calls gdk_flush() before GDK_THREADS_LEAVE(), as
+ recommended by the GDK documentation
+
+2004-03-12 10:32 jylefort
+
+ * src/mn-mbox-mailbox.c: A logic bug caused new mail to be
+ immediately forgotten at the next check: fixed (reported by Pau
+ Artigas)
+
+2004-03-12 10:23 jylefort
+
+ * src/mn-mailbox.c: Type isn't instantiatable, so we use
+ G_TYPE_FLAG_ABSTRACT
+
+2004-03-12 10:21 jylefort
+
+ * src/: mn-mbox-mailbox.c, mn-mh-mailbox.c: GIOChannel objects were
+ not unreferenced after being shutdown, resulting in memory leaks:
+ fixed
+
+2004-03-12 10:15 jylefort
+
+ * src/mn-unsupported-mailbox.c: Cleanups
+
+2004-03-12 10:12 jylefort
+
+ * src/: mn-pop3-mailbox.c, mn-pop3-mailbox.h: Cleanups
+
+2004-03-12 09:57 jylefort
+
+ * src/: mn-mbox-mailbox.c, mn-mbox-mailbox.h, mn-mh-mailbox.c:
+ Cleanups
+
+2004-03-12 09:51 jylefort
+
+ * src/mn-maildir-mailbox.c: Cleanups
+
+2004-03-12 09:41 jylefort
+
+ * src/: mn-mailbox.c, mn-mailbox.h: Cleanups
+
+2004-03-12 09:37 jylefort
+
+ * src/: mn-check.h, mn-mail-icon.c: Cleanups
+
+2003-12-24 15:59 jylefort
+
+ * art/Makefile.am, data/Makefile.am, ui/Makefile.am: Automake fixes
+
+2003-12-24 15:49 jylefort
+
+ * src/: mn-preferences.c, mn-ui.c: Forgot to set window icon for
+ "add local mailbox" and "about" dialogs
+
2003-12-24 15:22 jylefort
* configure.ac: Version 0.3.2
diff --git a/NEWS b/NEWS
@@ -1,3 +1,10 @@
+0.3.3 12 March 2004
+
+ * A bug in the mbox checking code has been fixed (reported by
+ Pau Artigas)
+ * A few minor bugs have been fixed
+ * A few memory leaks have been fixed
+
0.3.2 24 December 2003
* A bug in the Sylpheed checking code has been fixed
diff --git a/README b/README
@@ -11,9 +11,9 @@ Index
0. About this document
- $Id: README,v 1.10 2003/12/24 14:19:53 jylefort Exp $
+ $Id: README,v 1.11 2004/03/12 12:55:59 jylefort Exp $
- Copyright (c) 2003 Jean-Yves Lefort.
+ Copyright (c) 2003, 2004 Jean-Yves Lefort.
This document is part of Mail Notification.
It may be distributed under the same terms as Mail Notification.
@@ -27,8 +27,10 @@ Index
Notification uses the EggTrayIcon backend, which adheres to
the freedesktop's System Tray Specification
(http://www.freedesktop.org/Standards/systemtray-spec). This
- might allow Mail Notification to function with the KDE System
- Tray (untested).
+ might allow Mail Notification to function with other trays
+ implementing that specification, such as the KDE System Tray
+ or the XFce 4 system tray. However, Mail Notification has only
+ been tested with the GNOME Notification Area.
Features:
@@ -42,23 +44,22 @@ Index
Usage:
- Right-click the dot icon in the Notification Area to
- access the popup menu.
+ Right-click the mail icon to access the popup menu.
The two GTK+ stock icons are named
"mail-notification-no-mail" and
- "mail-notification-mail".
-
- See http://developer.gnome.org/doc/API/2.0/gtk/gtk-Res-
- ource-Files.html for details about how to customize
- them in your ~/.gtkrc-2.0.
+ "mail-notification-mail" (see
+ http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html
+ for details about how to customize them in your
+ ~/.gtkrc-2.0).
If the program does not work as expected, run it from
a terminal and watch for possible error messages.
2. Release notes
- libglade is now used instead of code generation.
+ A bug in the mbox checking code has been fixed (thanks to Pau
+ Artigas for reporting it).
3. Documentation map
diff --git a/art/Makefile.am b/art/Makefile.am
@@ -1,7 +1,6 @@
GNOME_IMAGES = mail-notification.png
APP_IMAGES = \
about-icon.png \
- add-icon.png \
logo.png \
mail.png \
no-mail.png \
diff --git a/art/Makefile.in b/art/Makefile.in
@@ -153,7 +153,6 @@ target_alias = @target_alias@
GNOME_IMAGES = mail-notification.png
APP_IMAGES = \
about-icon.png \
- add-icon.png \
logo.png \
mail.png \
no-mail.png \
diff --git a/art/add-icon.png b/art/add-icon.png
Binary files differ.
diff --git a/configure b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57 for mail-notification 0.3.2.
+# Generated by GNU Autoconf 2.57 for mail-notification 0.3.3.
#
# Report bugs to <jylefort@brutele.be>.
#
@@ -268,8 +268,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='mail-notification'
PACKAGE_TARNAME='mail-notification'
-PACKAGE_VERSION='0.3.2'
-PACKAGE_STRING='mail-notification 0.3.2'
+PACKAGE_VERSION='0.3.3'
+PACKAGE_STRING='mail-notification 0.3.3'
PACKAGE_BUGREPORT='jylefort@brutele.be'
ac_unique_file="src/mail-notification.c"
@@ -779,7 +779,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures mail-notification 0.3.2 to adapt to many kinds of systems.
+\`configure' configures mail-notification 0.3.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -841,7 +841,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mail-notification 0.3.2:";;
+ short | recursive ) echo "Configuration of mail-notification 0.3.3:";;
esac
cat <<\_ACEOF
@@ -946,7 +946,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-mail-notification configure 0.3.2
+mail-notification configure 0.3.3
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -961,7 +961,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by mail-notification $as_me 0.3.2, which was
+It was created by mail-notification $as_me 0.3.3, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
@@ -1685,7 +1685,7 @@ fi
# Define the identity of the package.
PACKAGE='mail-notification'
- VERSION='0.3.2'
+ VERSION='0.3.3'
cat >>confdefs.h <<_ACEOF
@@ -7267,7 +7267,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by mail-notification $as_me 0.3.2, which was
+This file was extended by mail-notification $as_me 0.3.3, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7330,7 +7330,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-mail-notification config.status 0.3.2
+mail-notification config.status 0.3.3
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(mail-notification, 0.3.2, jylefort@brutele.be)
+AC_INIT(mail-notification, 0.3.3, jylefort@brutele.be)
AC_CONFIG_SRCDIR(src/mail-notification.c)
AC_PREREQ(2.57)
diff --git a/po/ChangeLog b/po/ChangeLog
@@ -1,3 +1,11 @@
+2004-03-12 13:57 jylefort
+
+ * fr.po: Version 0.3.3
+
+2004-03-12 13:42 jylefort
+
+ * fr.po: Updated
+
2003-12-24 15:22 jylefort
* fr.po: Version 0.3.2
diff --git a/po/fr.gmo b/po/fr.gmo
Binary files differ.
diff --git a/po/fr.po b/po/fr.po
@@ -1,13 +1,13 @@
# French translation of mail-notification.
-# Copyright (c) 2003 Jean-Yves Lefort.
-# Jean-Yves Lefort <jylefort@brutele.be>, 2003.
+# Copyright (c) 2003, 2004 Jean-Yves Lefort.
+# Jean-Yves Lefort <jylefort@brutele.be>, 2004.
#
msgid ""
msgstr ""
-"Project-Id-Version: mail-notification 0.3.2\n"
+"Project-Id-Version: mail-notification 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2003-12-24 15:51+0100\n"
-"PO-Revision-Date: 2003-12-24 15:21+0100\n"
+"POT-Creation-Date: 2004-03-12 13:59+0100\n"
+"PO-Revision-Date: 2004-03-12 13:57+0100\n"
"Last-Translator: Jean-Yves Lefort <jylefort@brutele.be>\n"
"Language-Team: Jean-Yves Lefort <jylefort@brutele.be>\n"
"MIME-Version: 1.0\n"
@@ -38,61 +38,61 @@ msgstr "Afficher les prises en charge disponibles et quitter"
msgid "the GLib thread system is unavailable"
msgstr "le système de thread GLib n'est pas disponible"
-#: src/mail-notification.c:100 src/mn-ui.c:104
+#: src/mail-notification.c:100 src/mn-ui.c:144
msgid "Mail Notification"
msgstr "Notification de Courrier"
-#: src/mn-check.c:74 src/mn-check.c:130
+#: src/mn-check.c:75 src/mn-check.c:134
msgid "Check error."
msgstr "Erreur de vérification."
-#: src/mn-check.c:75
+#: src/mn-check.c:76
#, c-format
msgid "Unable to create a thread: %s."
msgstr "Impossible de créer un thread: %s."
-#: src/mn-check.c:78
+#: src/mn-check.c:79
#, c-format
msgid "unable to create a thread: %s"
msgstr "impossible de créer un thread: %s"
-#: src/mn-check.c:122
+#: src/mn-check.c:126
#, c-format
msgid "checking if there is new mail in %s"
msgstr "vérification du nouveau courrier dans %s en cours"
-#: src/mn-check.c:131
+#: src/mn-check.c:135
#, c-format
msgid "Unable to check mailbox <i>%s</i>: %s."
msgstr "Impossible de vérifier la boîte aux lettres <i>%s</i>: %s."
-#: src/mn-check.c:137
+#: src/mn-check.c:142
#, c-format
msgid "unable to check mailbox %s: %s"
msgstr "impossible de vérifier la boîte aux lettres %s: %s"
-#: src/mn-check.c:150
+#: src/mn-check.c:155
#, c-format
msgid "%s has new mail"
msgstr "%s a du nouveau courrier"
-#: src/mn-check.c:151
+#: src/mn-check.c:156
#, c-format
msgid "%s has no new mail"
msgstr "%s n'a pas de nouveau courrier"
-#: src/mn-check.c:211 src/mn-mail-icon.c:221
+#: src/mn-check.c:216 src/mn-ui.c:86
msgid "Command error."
msgstr "Erreur de commande."
-#: src/mn-check.c:212
+#: src/mn-check.c:217
#, c-format
msgid "Unable to execute new mail command: %s."
msgstr ""
"Impossible d'exécuter la commande associée à l'arrivée d'un nouveau message: "
"%s."
-#: src/mn-check.c:217
+#: src/mn-check.c:223
#, c-format
msgid "unable to execute new mail command: %s"
msgstr ""
@@ -133,16 +133,11 @@ msgstr "impossible d'effacer la clé de configuration %s: %s"
msgid "%s: FATAL ERROR: %s\n"
msgstr "%s: ERREUR FATALE: %s\n"
-#: src/mn-mail-icon.c:131 src/mn-mail-icon.c:270
+#: src/mn-mail-icon.c:137 src/mn-mail-icon.c:266
msgid "You have no new mail"
msgstr "Vous n'avez pas de courrier"
-#: src/mn-mail-icon.c:222
-#, c-format
-msgid "Unable to execute clicked command: %s."
-msgstr "Impossible d'exécuter la commande associée au click sur l'icône: %s."
-
-#: src/mn-mail-icon.c:270
+#: src/mn-mail-icon.c:266
msgid "You have new mail"
msgstr "Vous avez du courrier"
@@ -151,141 +146,137 @@ msgstr "Vous avez du courrier"
msgid "unable to initialize %s mailbox: %s"
msgstr "impossible d'initialiser la boîte aux lettres %s: %s"
-#: src/mn-mailbox.c:140
+#: src/mn-mailbox.c:139
msgid "The mailbox's locator"
msgstr "Le chemin de la boîte aux lettres"
-#: src/mn-mailbox.c:205
+#: src/mn-mailbox.c:200
msgid "mailbox not found"
msgstr "boîte aux lettres non trouvée"
-#: src/mn-mailbox.c:225
+#: src/mn-mailbox.c:220
msgid "unknown mailbox format"
msgstr "format de boîte aux lettres inconnu"
-#: src/mn-mailboxes.c:60
+#: src/mn-mailboxes.c:54
msgid "Mailbox error."
msgstr "Erreur de boîte aux lettres."
-#: src/mn-mailboxes.c:61
+#: src/mn-mailboxes.c:55
#, c-format
msgid "Mailbox <i>%s</i> is unsupported: %s."
msgstr "La boîte aux lettres <i>%s</i> n'est pas supportée: %s."
-#: src/mn-mailboxes.c:73
+#: src/mn-mailboxes.c:66
#, c-format
msgid "registered remote %s mailbox %s"
msgstr "boîte aux lettres distante (%s) %s enregistrée"
-#: src/mn-mailboxes.c:74
+#: src/mn-mailboxes.c:67
#, c-format
msgid "registered local %s mailbox %s"
msgstr "boîte aux lettres locale (%s) %s enregistrée"
-#: src/mn-mailboxes.c:99
-msgid "unregistered all mailboxes"
-msgstr "toutes les boîtes aux lettres ont été désenregistrées"
-
-#: src/mn-maildir-mailbox.c:111 src/mn-mbox-mailbox.c:130
-#: src/mn-mh-mailbox.c:103
+#: src/mn-maildir-mailbox.c:110 src/mn-mbox-mailbox.c:155
+#: src/mn-mh-mailbox.c:102
#, c-format
msgid "unable to open %s: %s"
msgstr "impossible d'ouvrir %s: %s"
-#: src/mn-mbox-mailbox.c:105 src/mn-sylpheed-mailbox.c:131
+#: src/mn-mbox-mailbox.c:130 src/mn-sylpheed-mailbox.c:130
#, c-format
msgid "unable to stat %s: %s"
msgstr "impossible d'utiliser stat() sur %s: %s"
-#: src/mn-mbox-mailbox.c:143
+#: src/mn-mbox-mailbox.c:168
#, c-format
msgid "unable to set the encoding for %s: %s"
msgstr "impossible de configurer la page de code pour %s: %s"
-#: src/mn-mbox-mailbox.c:178 src/mn-mh-mailbox.c:134
+#: src/mn-mbox-mailbox.c:205 src/mn-mh-mailbox.c:133
#, c-format
msgid "error while reading %s: %s"
msgstr "erreur lors de la lecture de %s: %s"
-#: src/mn-pop3-mailbox.c:224
+#: src/mn-pop3-mailbox.c:219
#, c-format
msgid "unable to parse locator \"%s\""
msgstr "impossible d'analyser le chemin \"%s\""
-#: src/mn-pop3-mailbox.c:248
+#: src/mn-pop3-mailbox.c:243
#, c-format
msgid "resolving IP address of %s"
msgstr "résolution de l'adresse IP de %s en cours"
-#: src/mn-pop3-mailbox.c:254
+#: src/mn-pop3-mailbox.c:249
#, c-format
msgid "unable to resolve %s"
msgstr "impossible de résoudre %s"
-#: src/mn-pop3-mailbox.c:259
+#: src/mn-pop3-mailbox.c:254
#, c-format
msgid "connecting to POP3 server %s:%i"
msgstr "connection au server POP3 %s:%i en cours"
-#: src/mn-pop3-mailbox.c:268
+#: src/mn-pop3-mailbox.c:263
#, c-format
msgid "unable to connect to %s"
msgstr "impossible de se connecter à %s"
-#: src/mn-pop3-mailbox.c:273
+#: src/mn-pop3-mailbox.c:268
#, c-format
msgid "successfully connected to %s:%i"
msgstr "connecté à %s:%i"
-#: src/mn-pop3-mailbox.c:316
+#: src/mn-pop3-mailbox.c:311
#, c-format
msgid "unable to read from %s"
msgstr "impossible de lire depuis %s"
-#: src/mn-pop3-mailbox.c:379
+#: src/mn-pop3-mailbox.c:371
#, c-format
msgid "acknowledgement error (server replied \"%s\")"
msgstr "erreur de bienvenue (le serveur a répondu \"%s\")"
-#: src/mn-pop3-mailbox.c:390
+#: src/mn-pop3-mailbox.c:382
msgid "unable to send username"
msgstr "impossible d'envoyer le nom d'utilisateur"
-#: src/mn-pop3-mailbox.c:398
+#: src/mn-pop3-mailbox.c:390
#, c-format
msgid "username authentication error (server replied \"%s\")"
msgstr ""
"erreur d'authentification de nom d'utilisateur (le serveur a répondu \"%s\")"
-#: src/mn-pop3-mailbox.c:407
+#: src/mn-pop3-mailbox.c:399
msgid "unable to send password"
msgstr "impossible d'envoyer le mot de passe"
-#: src/mn-pop3-mailbox.c:415
+#: src/mn-pop3-mailbox.c:407
#, c-format
msgid "password authentication error (server replied \"%s\")"
msgstr ""
"erreur d'authentification de mot de passe (le serveur a répondu \"%s\")"
-#: src/mn-pop3-mailbox.c:424
+#: src/mn-pop3-mailbox.c:416
msgid "unable to issue a STAT"
msgstr "impossible d'envoyer un STAT"
-#: src/mn-pop3-mailbox.c:432
+#: src/mn-pop3-mailbox.c:424
#, c-format
msgid "error in STAT reply (server replied \"%s\")"
msgstr "erreur de réponse à STAT (le serveur a répondu \"%s\")"
-#: src/mn-pop3-mailbox.c:440
+#: src/mn-pop3-mailbox.c:432
#, c-format
msgid "could not parse STAT reply \"%s\""
msgstr "n'a pas pu analyser la réponse à STAT \"%s\""
-#: src/mn-pop3-mailbox.c:450
+#: src/mn-pop3-mailbox.c:442
msgid "unable to issue a QUIT"
msgstr "impossible d'envoyer un QUIT"
-#: src/mn-pop3-mailbox.c:458
+#: src/mn-pop3-mailbox.c:450
#, c-format
msgid "error in QUIT reply (server replied \"%s\")"
msgstr "erreur de réponse à QUIT (le serveur a répondu \"%s\")"
@@ -298,53 +289,59 @@ msgstr "Boîte aux lettres"
msgid "Format"
msgstr "Format"
-#: src/mn-preferences.c:346
+#: src/mn-preferences.c:349
msgid "Select One or More Mailboxes"
msgstr "Sélectionnez Une ou Plusieurs Boîtes aux Lettres"
-#: src/mn-preferences.c:444 src/mn-preferences.c:451 src/mn-preferences.c:458
-#: src/mn-preferences.c:465 src/mn-preferences.c:472
+#: src/mn-preferences.c:446 src/mn-preferences.c:453 src/mn-preferences.c:460
+#: src/mn-preferences.c:467 src/mn-preferences.c:474
msgid "Unable to add mailbox."
msgstr "Impossible d'ajouter la boîte aux lettres."
-#: src/mn-preferences.c:445
+#: src/mn-preferences.c:447
msgid "The hostname field must be filled."
msgstr "Le champ de nom d'hôte doit être rempli."
-#: src/mn-preferences.c:452
+#: src/mn-preferences.c:454
msgid "The port field must be filled."
msgstr "Le champ de port doit être rempli."
-#: src/mn-preferences.c:459
+#: src/mn-preferences.c:461
msgid "The port field must be numeric."
msgstr "Le champ de port doit être numérique."
-#: src/mn-preferences.c:466
+#: src/mn-preferences.c:468
msgid "The username field must be filled."
msgstr "Le champ de nom d'utilisateur doit être rempli."
-#: src/mn-preferences.c:473
+#: src/mn-preferences.c:475
msgid "The password field must be filled."
msgstr "Le champ de mot de passe doit être rempli."
-#: src/mn-sylpheed-mailbox.c:109
+#: src/mn-sylpheed-mailbox.c:108
#, c-format
msgid "unable to open directory %s: %s"
msgstr "impossible d'ouvrir le répertoire %s: %s"
-#: src/mn-ui.c:106
-msgid "Copyright (c) 2003 Jean-Yves Lefort"
+#: src/mn-ui.c:87
+#, c-format
+msgid "Unable to execute clicked command: %s."
+msgstr "Impossible d'exécuter la commande associée au click sur l'icône: %s."
+
+#: src/mn-ui.c:146
+#, fuzzy
+msgid "Copyright (c) 2003, 2004 Jean-Yves Lefort"
msgstr "Copyright (c) 2003 Jean-Yves Lefort"
-#: src/mn-ui.c:107
+#: src/mn-ui.c:147
msgid "A Mail Notification for the Panel Notification Area"
msgstr "Une Notification de Courrier pour l'Aire de Notification du Panneau"
-#: src/mn-unsupported-mailbox.c:63
+#: src/mn-unsupported-mailbox.c:62
msgid "unsupported"
msgstr "non supporté"
-#: src/mn-util.c:100
+#: src/mn-util.c:130
#, c-format
msgid "error loading image: %s"
msgstr "erreur de chargement d'image: %s"
@@ -370,7 +367,7 @@ msgstr "Nom d'_hôte:"
#: ui/add-pop3-strings.c:20 ui/preferences-strings.c:23
#: ui/preferences-strings.c:25
msgid "*"
-msgstr ""
+msgstr "*"
#: ui/add-pop3-strings.c:12
msgid "_Port:"
diff --git a/po/mail-notification.pot b/po/mail-notification.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2003-12-24 15:51+0100\n"
+"POT-Creation-Date: 2004-03-12 13:59+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -40,59 +40,59 @@ msgstr ""
msgid "the GLib thread system is unavailable"
msgstr ""
-#: src/mail-notification.c:100 src/mn-ui.c:104
+#: src/mail-notification.c:100 src/mn-ui.c:144
msgid "Mail Notification"
msgstr ""
-#: src/mn-check.c:74 src/mn-check.c:130
+#: src/mn-check.c:75 src/mn-check.c:134
msgid "Check error."
msgstr ""
-#: src/mn-check.c:75
+#: src/mn-check.c:76
#, c-format
msgid "Unable to create a thread: %s."
msgstr ""
-#: src/mn-check.c:78
+#: src/mn-check.c:79
#, c-format
msgid "unable to create a thread: %s"
msgstr ""
-#: src/mn-check.c:122
+#: src/mn-check.c:126
#, c-format
msgid "checking if there is new mail in %s"
msgstr ""
-#: src/mn-check.c:131
+#: src/mn-check.c:135
#, c-format
msgid "Unable to check mailbox <i>%s</i>: %s."
msgstr ""
-#: src/mn-check.c:137
+#: src/mn-check.c:142
#, c-format
msgid "unable to check mailbox %s: %s"
msgstr ""
-#: src/mn-check.c:150
+#: src/mn-check.c:155
#, c-format
msgid "%s has new mail"
msgstr ""
-#: src/mn-check.c:151
+#: src/mn-check.c:156
#, c-format
msgid "%s has no new mail"
msgstr ""
-#: src/mn-check.c:211 src/mn-mail-icon.c:221
+#: src/mn-check.c:216 src/mn-ui.c:86
msgid "Command error."
msgstr ""
-#: src/mn-check.c:212
+#: src/mn-check.c:217
#, c-format
msgid "Unable to execute new mail command: %s."
msgstr ""
-#: src/mn-check.c:217
+#: src/mn-check.c:223
#, c-format
msgid "unable to execute new mail command: %s"
msgstr ""
@@ -131,16 +131,11 @@ msgstr ""
msgid "%s: FATAL ERROR: %s\n"
msgstr ""
-#: src/mn-mail-icon.c:131 src/mn-mail-icon.c:270
+#: src/mn-mail-icon.c:137 src/mn-mail-icon.c:266
msgid "You have no new mail"
msgstr ""
-#: src/mn-mail-icon.c:222
-#, c-format
-msgid "Unable to execute clicked command: %s."
-msgstr ""
-
-#: src/mn-mail-icon.c:270
+#: src/mn-mail-icon.c:266
msgid "You have new mail"
msgstr ""
@@ -149,139 +144,135 @@ msgstr ""
msgid "unable to initialize %s mailbox: %s"
msgstr ""
-#: src/mn-mailbox.c:140
+#: src/mn-mailbox.c:139
msgid "The mailbox's locator"
msgstr ""
-#: src/mn-mailbox.c:205
+#: src/mn-mailbox.c:200
msgid "mailbox not found"
msgstr ""
-#: src/mn-mailbox.c:225
+#: src/mn-mailbox.c:220
msgid "unknown mailbox format"
msgstr ""
-#: src/mn-mailboxes.c:60
+#: src/mn-mailboxes.c:54
msgid "Mailbox error."
msgstr ""
-#: src/mn-mailboxes.c:61
+#: src/mn-mailboxes.c:55
#, c-format
msgid "Mailbox <i>%s</i> is unsupported: %s."
msgstr ""
-#: src/mn-mailboxes.c:73
+#: src/mn-mailboxes.c:66
#, c-format
msgid "registered remote %s mailbox %s"
msgstr ""
-#: src/mn-mailboxes.c:74
+#: src/mn-mailboxes.c:67
#, c-format
msgid "registered local %s mailbox %s"
msgstr ""
-#: src/mn-mailboxes.c:99
-msgid "unregistered all mailboxes"
-msgstr ""
-
-#: src/mn-maildir-mailbox.c:111 src/mn-mbox-mailbox.c:130
-#: src/mn-mh-mailbox.c:103
+#: src/mn-maildir-mailbox.c:110 src/mn-mbox-mailbox.c:155
+#: src/mn-mh-mailbox.c:102
#, c-format
msgid "unable to open %s: %s"
msgstr ""
-#: src/mn-mbox-mailbox.c:105 src/mn-sylpheed-mailbox.c:131
+#: src/mn-mbox-mailbox.c:130 src/mn-sylpheed-mailbox.c:130
#, c-format
msgid "unable to stat %s: %s"
msgstr ""
-#: src/mn-mbox-mailbox.c:143
+#: src/mn-mbox-mailbox.c:168
#, c-format
msgid "unable to set the encoding for %s: %s"
msgstr ""
-#: src/mn-mbox-mailbox.c:178 src/mn-mh-mailbox.c:134
+#: src/mn-mbox-mailbox.c:205 src/mn-mh-mailbox.c:133
#, c-format
msgid "error while reading %s: %s"
msgstr ""
-#: src/mn-pop3-mailbox.c:224
+#: src/mn-pop3-mailbox.c:219
#, c-format
msgid "unable to parse locator \"%s\""
msgstr ""
-#: src/mn-pop3-mailbox.c:248
+#: src/mn-pop3-mailbox.c:243
#, c-format
msgid "resolving IP address of %s"
msgstr ""
-#: src/mn-pop3-mailbox.c:254
+#: src/mn-pop3-mailbox.c:249
#, c-format
msgid "unable to resolve %s"
msgstr ""
-#: src/mn-pop3-mailbox.c:259
+#: src/mn-pop3-mailbox.c:254
#, c-format
msgid "connecting to POP3 server %s:%i"
msgstr ""
-#: src/mn-pop3-mailbox.c:268
+#: src/mn-pop3-mailbox.c:263
#, c-format
msgid "unable to connect to %s"
msgstr ""
-#: src/mn-pop3-mailbox.c:273
+#: src/mn-pop3-mailbox.c:268
#, c-format
msgid "successfully connected to %s:%i"
msgstr ""
-#: src/mn-pop3-mailbox.c:316
+#: src/mn-pop3-mailbox.c:311
#, c-format
msgid "unable to read from %s"
msgstr ""
-#: src/mn-pop3-mailbox.c:379
+#: src/mn-pop3-mailbox.c:371
#, c-format
msgid "acknowledgement error (server replied \"%s\")"
msgstr ""
-#: src/mn-pop3-mailbox.c:390
+#: src/mn-pop3-mailbox.c:382
msgid "unable to send username"
msgstr ""
-#: src/mn-pop3-mailbox.c:398
+#: src/mn-pop3-mailbox.c:390
#, c-format
msgid "username authentication error (server replied \"%s\")"
msgstr ""
-#: src/mn-pop3-mailbox.c:407
+#: src/mn-pop3-mailbox.c:399
msgid "unable to send password"
msgstr ""
-#: src/mn-pop3-mailbox.c:415
+#: src/mn-pop3-mailbox.c:407
#, c-format
msgid "password authentication error (server replied \"%s\")"
msgstr ""
-#: src/mn-pop3-mailbox.c:424
+#: src/mn-pop3-mailbox.c:416
msgid "unable to issue a STAT"
msgstr ""
-#: src/mn-pop3-mailbox.c:432
+#: src/mn-pop3-mailbox.c:424
#, c-format
msgid "error in STAT reply (server replied \"%s\")"
msgstr ""
-#: src/mn-pop3-mailbox.c:440
+#: src/mn-pop3-mailbox.c:432
#, c-format
msgid "could not parse STAT reply \"%s\""
msgstr ""
-#: src/mn-pop3-mailbox.c:450
+#: src/mn-pop3-mailbox.c:442
msgid "unable to issue a QUIT"
msgstr ""
-#: src/mn-pop3-mailbox.c:458
+#: src/mn-pop3-mailbox.c:450
#, c-format
msgid "error in QUIT reply (server replied \"%s\")"
msgstr ""
@@ -294,53 +285,58 @@ msgstr ""
msgid "Format"
msgstr ""
-#: src/mn-preferences.c:346
+#: src/mn-preferences.c:349
msgid "Select One or More Mailboxes"
msgstr ""
-#: src/mn-preferences.c:444 src/mn-preferences.c:451 src/mn-preferences.c:458
-#: src/mn-preferences.c:465 src/mn-preferences.c:472
+#: src/mn-preferences.c:446 src/mn-preferences.c:453 src/mn-preferences.c:460
+#: src/mn-preferences.c:467 src/mn-preferences.c:474
msgid "Unable to add mailbox."
msgstr ""
-#: src/mn-preferences.c:445
+#: src/mn-preferences.c:447
msgid "The hostname field must be filled."
msgstr ""
-#: src/mn-preferences.c:452
+#: src/mn-preferences.c:454
msgid "The port field must be filled."
msgstr ""
-#: src/mn-preferences.c:459
+#: src/mn-preferences.c:461
msgid "The port field must be numeric."
msgstr ""
-#: src/mn-preferences.c:466
+#: src/mn-preferences.c:468
msgid "The username field must be filled."
msgstr ""
-#: src/mn-preferences.c:473
+#: src/mn-preferences.c:475
msgid "The password field must be filled."
msgstr ""
-#: src/mn-sylpheed-mailbox.c:109
+#: src/mn-sylpheed-mailbox.c:108
#, c-format
msgid "unable to open directory %s: %s"
msgstr ""
-#: src/mn-ui.c:106
-msgid "Copyright (c) 2003 Jean-Yves Lefort"
+#: src/mn-ui.c:87
+#, c-format
+msgid "Unable to execute clicked command: %s."
+msgstr ""
+
+#: src/mn-ui.c:146
+msgid "Copyright (c) 2003, 2004 Jean-Yves Lefort"
msgstr ""
-#: src/mn-ui.c:107
+#: src/mn-ui.c:147
msgid "A Mail Notification for the Panel Notification Area"
msgstr ""
-#: src/mn-unsupported-mailbox.c:63
+#: src/mn-unsupported-mailbox.c:62
msgid "unsupported"
msgstr ""
-#: src/mn-util.c:100
+#: src/mn-util.c:130
#, c-format
msgid "error loading image: %s"
msgstr ""
diff --git a/src/mn-check.c b/src/mn-check.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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,6 +23,7 @@
#include "mn-dialog.h"
#include "mn-ui.h"
#include "mn-util.h"
+#include "mn-mailbox.h"
#include "mn-mailboxes.h"
#include "mn-check.h"
#include "mn-settings.h"
@@ -93,12 +94,14 @@ mn_check_thread_cb (gpointer data)
gboolean *has_new = flags & MN_CHECK_REMOTE ? &has_new_remote : &has_new_local;
static int threads = 0; /* number of check threads currently running */
G_LOCK_DEFINE_STATIC(threads);
+ GSList *mailboxes;
G_LOCK(threads);
if (threads++ == 0) /* threads just switched from 0 to 1, update */
{
GDK_THREADS_ENTER();
mn_ui_set_can_check(FALSE);
+ gdk_flush();
GDK_THREADS_LEAVE();
}
G_UNLOCK(threads);
@@ -107,7 +110,8 @@ mn_check_thread_cb (gpointer data)
*has_new = FALSE;
- MN_LIST_FOREACH(l, mn_mailboxes)
+ mailboxes = mn_mailboxes_get();
+ MN_LIST_FOREACH(l, mailboxes)
{
MNMailbox *mailbox = l->data;
MNMailboxClass *class;
@@ -131,6 +135,7 @@ mn_check_thread_cb (gpointer data)
_("Unable to check mailbox <i>%s</i>: %s."),
mailbox->name,
err->message);
+ gdk_flush();
GDK_THREADS_LEAVE();
}
else
@@ -156,6 +161,7 @@ mn_check_thread_cb (gpointer data)
}
}
}
+ mn_objects_free(mailboxes);
mn_check_update_state(has_new_local || has_new_remote, flags);
@@ -166,6 +172,7 @@ mn_check_thread_cb (gpointer data)
{
GDK_THREADS_ENTER();
mn_ui_set_can_check(TRUE);
+ gdk_flush();
GDK_THREADS_LEAVE();
}
G_UNLOCK(threads);
@@ -176,22 +183,20 @@ mn_check_thread_cb (gpointer data)
static void
mn_check_update_state (gboolean has_new, int flags)
{
- static GStaticMutex old_has_new_mutex = G_STATIC_MUTEX_INIT;
static gboolean old_has_new = FALSE;
+ G_LOCK_DEFINE_STATIC(old_has_new);
gboolean state_changed;
- g_static_mutex_lock(&old_has_new_mutex);
+ G_LOCK(old_has_new);
state_changed = has_new != old_has_new;
- g_static_mutex_unlock(&old_has_new_mutex);
+ old_has_new = has_new;
+ G_UNLOCK(old_has_new);
if (state_changed)
{
- g_static_mutex_lock(&old_has_new_mutex);
- old_has_new = has_new;
- g_static_mutex_unlock(&old_has_new_mutex);
-
GDK_THREADS_ENTER();
mn_ui_set_has_new(has_new);
+ gdk_flush();
GDK_THREADS_LEAVE();
if (has_new && mn_conf_get_bool("/apps/mail-notification/commands/new-mail/enabled"))
@@ -211,6 +216,7 @@ mn_check_update_state (gboolean has_new, int flags)
mn_error_dialog(_("Command error."),
_("Unable to execute new mail command: %s."),
err->message);
+ gdk_flush();
GDK_THREADS_LEAVE();
}
else
diff --git a/src/mn-check.h b/src/mn-check.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -21,7 +21,7 @@
#include <glib.h>
-#define MN_CHECK_REMOTE (1) /* check remote mailboxes */
+#define MN_CHECK_REMOTE (1 << 0) /* check remote mailboxes */
#define MN_CHECK_INTERACTIVE (1 << 1) /* called from the GUI */
void mn_check (gboolean local);
diff --git a/src/mn-mail-icon.c b/src/mn-mail-icon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -19,10 +19,7 @@
#include "config.h"
#include <libgnome/gnome-i18n.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
-#include "mn-dialog.h"
#include "mn-mail-icon.h"
-#include "mn-conf.h"
#include "mn-util.h"
/*** cpp *********************************************************************/
@@ -32,18 +29,22 @@
/*** types *******************************************************************/
+enum {
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
struct _MNMailIconPrivate
{
- GladeXML *xml;
GtkTooltips *tooltips;
GtkWidget *image;
- GtkWidget *menu;
- GtkWidget *check_for_mail_item;
+ GtkMenu *menu;
};
/*** variables ***************************************************************/
static GObjectClass *parent_class = NULL;
+static unsigned int mail_icon_signals[LAST_SIGNAL] = { 0 };
/*** functions ***************************************************************/
@@ -93,14 +94,23 @@ mn_mail_icon_get_type (void)
static void
mn_mail_icon_class_init (MNMailIconClass *class)
{
- GObjectClass *object_class;
+ GObjectClass *object_class = G_OBJECT_CLASS(class);
parent_class = g_type_class_peek_parent(class);
- object_class = G_OBJECT_CLASS(class);
object_class->finalize = mn_mail_icon_finalize;
mn_mail_icon_stock_init();
+
+ mail_icon_signals[ACTIVATE] = g_signal_new("activate",
+ MN_TYPE_MAIL_ICON,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(MNMailIconClass, activate),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
static void
@@ -108,21 +118,17 @@ mn_mail_icon_init (MNMailIcon *icon)
{
GtkWidget *event_box;
- icon->priv = g_new(MNMailIconPrivate, 1);
+ icon->priv = g_new0(MNMailIconPrivate, 1);
/* create widgets */
event_box = gtk_event_box_new();
- icon->priv->xml = mn_glade_xml_new("menu");
-
icon->priv->tooltips = gtk_tooltips_new();
g_object_ref(icon->priv->tooltips);
gtk_object_sink(GTK_OBJECT(icon->priv->tooltips));
icon->priv->image = gtk_image_new_from_stock(MAIL_NOTIFICATION_STOCK_NO_MAIL, GTK_ICON_SIZE_MENU);
- icon->priv->menu = glade_xml_get_widget(icon->priv->xml, "menu");
- icon->priv->check_for_mail_item = glade_xml_get_widget(icon->priv->xml, "check_for_mail");
/* configure widgets */
@@ -152,14 +158,11 @@ mn_mail_icon_init (MNMailIcon *icon)
static void
mn_mail_icon_finalize (GObject *object)
{
- MNMailIcon *icon;
-
- icon = MN_MAIL_ICON(object);
+ MNMailIcon *icon = MN_MAIL_ICON(object);
g_object_unref(icon->priv->tooltips);
- gtk_widget_destroy(icon->priv->menu);
- g_object_unref(icon->priv->xml);
-
+ if (icon->priv->menu)
+ gtk_widget_destroy(GTK_WIDGET(icon->priv->menu));
g_free(icon->priv);
G_OBJECT_CLASS(parent_class)->finalize(object);
@@ -176,7 +179,6 @@ mn_mail_icon_stock_init (void)
{ MAIL_NOTIFICATION_STOCK_MAIL, "mail.png" },
{ MAIL_NOTIFICATION_STOCK_NO_MAIL, "no-mail.png" }
};
-
GtkIconFactory *factory;
int i;
@@ -191,44 +193,25 @@ mn_mail_icon_stock_init (void)
pixbuf = mn_pixbuf_new(icons[i].filename);
icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
- gtk_icon_factory_add(factory, icons[i].stock_id, icon_set);
+ g_object_unref(pixbuf);
+ gtk_icon_factory_add(factory, icons[i].stock_id, icon_set);
gtk_icon_set_unref(icon_set);
- g_object_unref(pixbuf);
}
g_object_unref(factory);
}
static gboolean
-mn_mail_icon_press (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
+mn_mail_icon_press (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
MNMailIcon *icon = data;
- if (event->button == 1 && mn_conf_get_bool("/apps/mail-notification/commands/clicked/enabled"))
- {
- const char *command;
-
- command = mn_conf_get_string("/apps/mail-notification/commands/clicked/command");
- if (command)
- {
- GError *err = NULL;
-
- if (! g_spawn_command_line_async(command, &err))
- {
- mn_error_dialog(_("Command error."),
- _("Unable to execute clicked command: %s."),
- err->message);
- g_error_free(err);
- }
- }
- }
- else if (event->button == 3)
+ if (event->button == 1)
+ g_signal_emit(icon, mail_icon_signals[ACTIVATE], 0);
+ else if (event->button == 3 && icon->priv->menu)
{
- gtk_menu_popup(GTK_MENU(icon->priv->menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
+ gtk_menu_popup(icon->priv->menu, NULL, NULL, NULL, NULL, event->button, event->time);
return TRUE;
}
@@ -242,9 +225,9 @@ mn_mail_icon_release (GtkWidget *widget,
{
MNMailIcon *icon = data;
- if (event->button == 3)
+ if (event->button == 3 && icon->priv->menu)
{
- gtk_menu_popdown(GTK_MENU(icon->priv->menu));
+ gtk_menu_popdown(icon->priv->menu);
return TRUE;
}
@@ -257,6 +240,19 @@ mn_mail_icon_new (void)
return g_object_new(MN_TYPE_MAIL_ICON, "title", "Mail Notification", NULL);
}
+/*
+ * This owns MENU.
+ */
+void
+mn_mail_icon_set_popup_menu (MNMailIcon *icon, GtkMenu *menu)
+{
+ g_return_if_fail(MN_IS_MAIL_ICON(icon));
+ g_return_if_fail(GTK_IS_MENU(menu));
+ g_return_if_fail(icon->priv->menu == NULL);
+
+ icon->priv->menu = menu;
+}
+
void
mn_mail_icon_set_has_new (MNMailIcon *icon, gboolean has_new)
{
@@ -270,11 +266,3 @@ mn_mail_icon_set_has_new (MNMailIcon *icon, gboolean has_new)
has_new ? _("You have new mail") : _("You have no new mail"),
NULL);
}
-
-void
-mn_mail_icon_set_can_check (MNMailIcon *icon, gboolean can_check)
-{
- g_return_if_fail(MN_IS_MAIL_ICON(icon));
-
- gtk_widget_set_sensitive(icon->priv->check_for_mail_item, can_check);
-}
diff --git a/src/mn-mail-icon.h b/src/mn-mail-icon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -19,6 +19,7 @@
#ifndef _MN_MAIL_ICON_H
#define _MN_MAIL_ICON_H
+#include <gtk/gtk.h>
#include "eggtrayicon.h"
#define MN_TYPE_MAIL_ICON (mn_mail_icon_get_type())
@@ -40,14 +41,17 @@ typedef struct
typedef struct
{
EggTrayIconClass icon_class;
+
+ /* signals */
+ void (*activate) (void);
} MNMailIconClass;
GType mn_mail_icon_get_type (void);
GtkWidget *mn_mail_icon_new (void);
+void mn_mail_icon_set_popup_menu (MNMailIcon *icon,
+ GtkMenu *menu);
void mn_mail_icon_set_has_new (MNMailIcon *icon,
gboolean has_new);
-void mn_mail_icon_set_can_check (MNMailIcon *icon,
- gboolean can_check);
#endif /* _MN_MAIL_ICON_H */
diff --git a/src/mn-mailbox.c b/src/mn-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -111,7 +111,7 @@ mn_mailbox_get_type (void)
mailbox_type = g_type_register_static(G_TYPE_OBJECT,
"MNMailbox",
&mailbox_info,
- 0);
+ G_TYPE_FLAG_ABSTRACT);
}
return mailbox_type;
@@ -120,7 +120,7 @@ mn_mailbox_get_type (void)
static void
mn_mailbox_class_init (MNMailboxClass *class)
{
- GObjectClass *object_class;
+ GObjectClass *object_class = G_OBJECT_CLASS(class);
parent_class = g_type_class_peek_parent(class);
@@ -129,7 +129,6 @@ mn_mailbox_class_init (MNMailboxClass *class)
class->is = NULL;
class->has_new = NULL;
- object_class = G_OBJECT_CLASS(class);
object_class->set_property = mn_mailbox_set_property;
object_class->finalize = mn_mailbox_finalize;
@@ -148,9 +147,7 @@ mn_mailbox_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- MNMailbox *mailbox;
-
- mailbox = MN_MAILBOX(object);
+ MNMailbox *mailbox = MN_MAILBOX(object);
switch (prop_id)
{
@@ -180,9 +177,7 @@ mn_mailbox_init (MNMailbox *mailbox)
static void
mn_mailbox_finalize (GObject *object)
{
- MNMailbox *mailbox;
-
- mailbox = MN_MAILBOX(object);
+ MNMailbox *mailbox = MN_MAILBOX(object);
g_free(mailbox->locator);
if (mailbox->err)
diff --git a/src/mn-mailbox.h b/src/mn-mailbox.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -38,8 +38,7 @@ typedef enum
MN_MAILBOX_ERROR_UNKNOWN_FORMAT
} MNMailboxError;
-typedef struct _MNMailbox MNMailbox;
-struct _MNMailbox
+typedef struct
{
GObject object;
@@ -47,7 +46,7 @@ struct _MNMailbox
char *name; /* visible mailbox name */
GError *err; /* initialization error */
-};
+} MNMailbox;
typedef struct
{
diff --git a/src/mn-mailboxes.c b/src/mn-mailboxes.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -26,11 +26,8 @@
/*** variables ***************************************************************/
-GSList *mn_mailboxes = NULL;
-
-/*** functions ***************************************************************/
-
-static void mn_mailboxes_unregister_all (void);
+static GSList *mailboxes = NULL;
+G_LOCK_DEFINE_STATIC(mailboxes);
/*** implementation **********************************************************/
@@ -38,11 +35,9 @@ void
mn_mailboxes_register_all (void)
{
GSList *gconf_mailboxes;
+ GSList *new_mailboxes = NULL;
GSList *l;
- if (mn_mailboxes)
- mn_mailboxes_unregister_all();
-
gconf_mailboxes = mn_conf_get_list("/apps/mail-notification/mailboxes", GCONF_VALUE_STRING);
MN_LIST_FOREACH(l, gconf_mailboxes)
@@ -54,14 +49,12 @@ mn_mailboxes_register_all (void)
mailbox = mn_mailbox_new(locator, &err);
g_return_if_fail(mailbox != NULL);
- mn_mailboxes = g_slist_append(mn_mailboxes, mailbox);
+ new_mailboxes = g_slist_append(new_mailboxes, mailbox);
if (err)
- {
- mn_error_dialog(_("Mailbox error."),
- _("Mailbox <i>%s</i> is unsupported: %s."),
- mailbox->name,
- err->message);
- }
+ mn_error_dialog(_("Mailbox error."),
+ _("Mailbox <i>%s</i> is unsupported: %s."),
+ mailbox->name,
+ err->message);
else
{
MNMailboxClass *class;
@@ -79,22 +72,22 @@ mn_mailboxes_register_all (void)
}
g_slist_free(gconf_mailboxes);
+
+ G_LOCK(mailboxes);
+ mn_objects_free(mailboxes);
+ mailboxes = new_mailboxes;
+ G_UNLOCK(mailboxes);
+
}
-static void
-mn_mailboxes_unregister_all (void)
+GSList *
+mn_mailboxes_get (void)
{
- GSList *l;
+ GSList *copy;
- MN_LIST_FOREACH(l, mn_mailboxes)
- {
- MNMailbox *mailbox = l->data;
- g_object_unref(mailbox);
- }
-
- g_slist_free(mn_mailboxes);
- mn_mailboxes = NULL;
-
- if (mn_settings.debug)
- mn_notice(_("unregistered all mailboxes"));
+ G_LOCK(mailboxes);
+ copy = mn_objects_copy(mailboxes);
+ G_UNLOCK(mailboxes);
+
+ return copy;
}
diff --git a/src/mn-mailboxes.h b/src/mn-mailboxes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -20,10 +20,8 @@
#define _MN_MAILBOXES_H
#include <glib.h>
-#include "mn-mailbox.h"
-extern GSList *mn_mailboxes;
-
-void mn_mailboxes_register_all (void);
+void mn_mailboxes_register_all (void);
+GSList *mn_mailboxes_get (void);
#endif /* _MN_MAILBOXES_H */
diff --git a/src/mn-maildir-mailbox.c b/src/mn-maildir-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -60,9 +60,8 @@ mn_maildir_mailbox_get_type (void)
static void
mn_maildir_mailbox_class_init (MNMaildirMailboxClass *class)
{
- MNMailboxClass *mailbox_class;
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = "Maildir";
mailbox_class->is_remote = FALSE;
mailbox_class->is = mn_maildir_mailbox_is;
diff --git a/src/mn-mbox-mailbox.c b/src/mn-mbox-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -24,10 +24,24 @@
#include <string.h>
#include "mn-mbox-mailbox.h"
+/*** types *******************************************************************/
+
+struct _MNmboxMailboxPrivate
+{
+ time_t last_mtime;
+ off_t last_size;
+ gboolean last_has_new;
+};
+
+/*** variables ***************************************************************/
+
+static GObjectClass *parent_class = NULL;
+
/*** functions ***************************************************************/
static void mn_mbox_mailbox_class_init (MNmboxMailboxClass *class);
static void mn_mbox_mailbox_init (MNmboxMailbox *mailbox);
+static void mn_mbox_mailbox_finalize (GObject *object);
static gboolean mn_mbox_mailbox_is (const char *locator);
static gboolean mn_mbox_mailbox_has_new (MNMailbox *mailbox,
GError **err);
@@ -65,9 +79,13 @@ mn_mbox_mailbox_get_type (void)
static void
mn_mbox_mailbox_class_init (MNmboxMailboxClass *class)
{
- MNMailboxClass *mailbox_class;
+ GObjectClass *object_class = G_OBJECT_CLASS(class);
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
+
+ parent_class = g_type_class_peek_parent(class);
+
+ object_class->finalize = mn_mbox_mailbox_finalize;
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = "mbox";
mailbox_class->is_remote = FALSE;
mailbox_class->is = mn_mbox_mailbox_is;
@@ -77,8 +95,17 @@ mn_mbox_mailbox_class_init (MNmboxMailboxClass *class)
static void
mn_mbox_mailbox_init (MNmboxMailbox *mailbox)
{
- mailbox->last_mtime = 0;
- mailbox->last_size = 0;
+ mailbox->priv = g_new0(MNmboxMailboxPrivate, 1);
+}
+
+static void
+mn_mbox_mailbox_finalize (GObject *object)
+{
+ MNmboxMailbox *mbox_mailbox = MN_MBOX_MAILBOX(object);
+
+ g_free(mbox_mailbox->priv);
+
+ G_OBJECT_CLASS(parent_class)->finalize(object);
}
static gboolean
@@ -92,11 +119,9 @@ mn_mbox_mailbox_is (const char *locator)
static gboolean
mn_mbox_mailbox_has_new (MNMailbox *mailbox, GError **err)
{
- MNmboxMailbox *mbox_mailbox;
+ MNmboxMailbox *mbox_mailbox = MN_MBOX_MAILBOX(mailbox);
struct stat sb;
- mbox_mailbox = MN_MBOX_MAILBOX(mailbox);
-
if (stat(mailbox->locator, &sb) == -1)
{
g_set_error(err,
@@ -108,7 +133,7 @@ mn_mbox_mailbox_has_new (MNMailbox *mailbox, GError **err)
return FALSE;
}
- if (mbox_mailbox->last_mtime != sb.st_mtime || mbox_mailbox->last_size != sb.st_size)
+ if (mbox_mailbox->priv->last_mtime != sb.st_mtime || mbox_mailbox->priv->last_size != sb.st_size)
{
GIOChannel *channel;
GIOStatus status;
@@ -118,8 +143,8 @@ mn_mbox_mailbox_has_new (MNMailbox *mailbox, GError **err)
int seen_count = 0;
gboolean in_header = FALSE;
- mbox_mailbox->last_mtime = sb.st_mtime;
- mbox_mailbox->last_size = sb.st_size;
+ mbox_mailbox->priv->last_mtime = sb.st_mtime;
+ mbox_mailbox->priv->last_size = sb.st_size;
channel = g_io_channel_new_file(mailbox->locator, "r", &tmp_err);
if (! channel)
@@ -144,7 +169,9 @@ mn_mbox_mailbox_has_new (MNMailbox *mailbox, GError **err)
mailbox->locator,
tmp_err->message);
g_error_free(tmp_err);
+
g_io_channel_shutdown(channel, TRUE, NULL);
+ g_io_channel_unref(channel);
return FALSE;
}
@@ -179,17 +206,20 @@ mn_mbox_mailbox_has_new (MNMailbox *mailbox, GError **err)
mailbox->locator,
tmp_err->message);
g_error_free(tmp_err);
+
g_io_channel_shutdown(channel, TRUE, NULL);
+ g_io_channel_unref(channel);
return FALSE;
}
g_io_channel_shutdown(channel, TRUE, NULL);
+ g_io_channel_unref(channel);
- return total_count != seen_count;
+ return mbox_mailbox->priv->last_has_new = total_count != seen_count;
}
- return FALSE;
+ return mbox_mailbox->priv->last_has_new;
}
GQuark
diff --git a/src/mn-mbox-mailbox.h b/src/mn-mbox-mailbox.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -21,7 +21,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <sys/types.h>
#include "mn-mailbox.h"
#define MN_TYPE_MBOX_MAILBOX (mn_mbox_mailbox_get_type())
@@ -41,12 +40,13 @@ typedef enum
MN_MBOX_MAILBOX_ERROR_READ
} MNmboxMailboxError;
+typedef struct _MNmboxMailboxPrivate MNmboxMailboxPrivate;
+
typedef struct
{
MNMailbox mailbox;
- time_t last_mtime;
- off_t last_size;
+ MNmboxMailboxPrivate *priv;
} MNmboxMailbox;
typedef struct
diff --git a/src/mn-mh-mailbox.c b/src/mn-mh-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -62,9 +62,8 @@ mn_mh_mailbox_get_type (void)
static void
mn_mh_mailbox_class_init (MNMHMailboxClass *class)
{
- MNMailboxClass *mailbox_class;
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = "MH";
mailbox_class->is_remote = FALSE;
mailbox_class->is = mn_mh_mailbox_is;
@@ -138,6 +137,7 @@ mn_mh_mailbox_has_new (MNMailbox *mailbox, GError **err)
}
g_io_channel_shutdown(channel, TRUE, NULL);
+ g_io_channel_unref(channel);
end:
g_free(sequences);
diff --git a/src/mn-pop3-mailbox.c b/src/mn-pop3-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -32,6 +32,20 @@
#define MN_POP3_MAILBOX_MAX_RESPONSE_LEN 512 /* RFC 1939 */
+/*** types *******************************************************************/
+
+struct _MNPOP3MailboxPrivate
+{
+ char *hostname;
+ int port;
+
+ char *user;
+ char *password;
+
+ GTcpSocket *socket;
+ GIOChannel *channel;
+};
+
/*** variables ***************************************************************/
static GObjectClass *parent_class = NULL;
@@ -92,16 +106,14 @@ mn_pop3_mailbox_get_type (void)
static void
mn_pop3_mailbox_class_init (MNPOP3MailboxClass *class)
{
- GObjectClass *object_class;
- MNMailboxClass *mailbox_class;
+ GObjectClass *object_class = G_OBJECT_CLASS(class);
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
parent_class = g_type_class_peek_parent(class);
- object_class = G_OBJECT_CLASS(class);
object_class->constructor = mn_pop3_mailbox_constructor;
object_class->finalize = mn_pop3_mailbox_finalize;
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = "POP3";
mailbox_class->is_remote = TRUE;
mailbox_class->is = mn_pop3_mailbox_is;
@@ -111,12 +123,7 @@ mn_pop3_mailbox_class_init (MNPOP3MailboxClass *class)
static void
mn_pop3_mailbox_init (MNPOP3Mailbox *mailbox)
{
- mailbox->hostname = NULL;
- mailbox->port = 0;
- mailbox->user = NULL;
- mailbox->password = NULL;
- mailbox->socket = NULL;
- mailbox->channel = NULL;
+ mailbox->priv = g_new0(MNPOP3MailboxPrivate, 1);
}
static GObject *
@@ -125,13 +132,11 @@ mn_pop3_mailbox_constructor (GType type,
GObjectConstructParam *construct_params)
{
GObject *object;
- MNMailbox *mailbox;
MNPOP3Mailbox *pop3_mailbox;
object = G_OBJECT_CLASS(parent_class)->constructor(type,
n_construct_properties,
construct_params);
- mailbox = MN_MAILBOX(object);
pop3_mailbox = MN_POP3_MAILBOX(object);
mn_pop3_mailbox_parse_locator(pop3_mailbox);
@@ -142,18 +147,16 @@ mn_pop3_mailbox_constructor (GType type,
static void
mn_pop3_mailbox_finalize (GObject *object)
{
- MNMailbox *mailbox;
- MNPOP3Mailbox *pop3_mailbox;
-
- mailbox = MN_MAILBOX(object);
- pop3_mailbox = MN_POP3_MAILBOX(object);
+ MNMailbox *mailbox = MN_MAILBOX(object);
+ MNPOP3Mailbox *pop3_mailbox = MN_POP3_MAILBOX(object);
if (! mailbox->err) /* mailbox->name has been set only if ! mailbox->err */
g_free(mailbox->name);
- g_free(pop3_mailbox->user);
- g_free(pop3_mailbox->password);
- g_free(pop3_mailbox->hostname);
+ g_free(pop3_mailbox->priv->user);
+ g_free(pop3_mailbox->priv->password);
+ g_free(pop3_mailbox->priv->hostname);
+ g_free(pop3_mailbox->priv);
G_OBJECT_CLASS(parent_class)->finalize(object);
}
@@ -169,14 +172,12 @@ mn_pop3_mailbox_is (const char *locator)
static void
mn_pop3_mailbox_parse_locator (MNPOP3Mailbox *pop3_mailbox)
{
- MNMailbox *mailbox;
+ MNMailbox *mailbox = MN_MAILBOX(pop3_mailbox);
char *user;
char *password;
char *hostname;
char *port;
- mailbox = MN_MAILBOX(pop3_mailbox);
-
g_assert(mailbox->locator != NULL);
user = mailbox->locator + 5;
@@ -200,21 +201,15 @@ mn_pop3_mailbox_parse_locator (MNPOP3Mailbox *pop3_mailbox)
|| (port - hostname - 1 <= 0))
goto error;
- pop3_mailbox->user = g_strdup(user);
- pop3_mailbox->user[password - user - 1] = 0;
-
- pop3_mailbox->password = g_strdup(password);
- pop3_mailbox->password[hostname - password - 1] = 0;
-
- pop3_mailbox->hostname = g_strdup(hostname);
- pop3_mailbox->hostname[port - hostname - 1] = 0;
-
- pop3_mailbox->port = atoi(port);
+ pop3_mailbox->priv->user = g_strndup(user, password - user - 1);
+ pop3_mailbox->priv->password = g_strndup(password, hostname - password - 1);
+ pop3_mailbox->priv->hostname = g_strndup(hostname, port - hostname - 1);
+ pop3_mailbox->priv->port = atoi(port);
mailbox->name = g_strdup_printf("%s@%s:%i",
- pop3_mailbox->user,
- pop3_mailbox->hostname,
- pop3_mailbox->port);
+ pop3_mailbox->priv->user,
+ pop3_mailbox->priv->hostname,
+ pop3_mailbox->priv->port);
return; /* locator's okay */
@@ -245,35 +240,35 @@ mn_pop3_mailbox_server_connect (MNPOP3Mailbox *mailbox, GError **err)
GInetAddr *addr;
if (mn_settings.debug)
- mn_notice(_("resolving IP address of %s"), mailbox->hostname);
+ mn_notice(_("resolving IP address of %s"), mailbox->priv->hostname);
- addr = gnet_inetaddr_new(mailbox->hostname, mailbox->port);
+ addr = gnet_inetaddr_new(mailbox->priv->hostname, mailbox->priv->port);
if (! addr)
{
g_set_error(err, MN_POP3_MAILBOX_ERROR, MN_POP3_MAILBOX_ERROR_RESOLVE,
- _("unable to resolve %s"), mailbox->hostname);
+ _("unable to resolve %s"), mailbox->priv->hostname);
return FALSE;
}
if (mn_settings.debug)
mn_notice(_("connecting to POP3 server %s:%i"),
- mailbox->hostname, mailbox->port);
+ mailbox->priv->hostname, mailbox->priv->port);
- mailbox->socket = gnet_tcp_socket_new(addr);
+ mailbox->priv->socket = gnet_tcp_socket_new(addr);
gnet_inetaddr_unref(addr);
- if (! mailbox->socket)
+ if (! mailbox->priv->socket)
{
g_set_error(err, MN_POP3_MAILBOX_ERROR, MN_POP3_MAILBOX_ERROR_CONNECT,
- _("unable to connect to %s"), mailbox->hostname);
+ _("unable to connect to %s"), mailbox->priv->hostname);
return FALSE;
}
if (mn_settings.debug)
mn_notice(_("successfully connected to %s:%i"),
- mailbox->hostname, mailbox->port);
+ mailbox->priv->hostname, mailbox->priv->port);
- mailbox->channel = gnet_tcp_socket_get_io_channel(mailbox->socket);
+ mailbox->priv->channel = gnet_tcp_socket_get_io_channel(mailbox->priv->socket);
return TRUE;
}
@@ -293,7 +288,7 @@ mn_pop3_mailbox_server_read (MNPOP3Mailbox *mailbox, char *buf)
GIOError status;
gsize count;
- status = gnet_io_channel_readline(mailbox->channel,
+ status = gnet_io_channel_readline(mailbox->priv->channel,
buf,
MN_POP3_MAILBOX_MAX_RESPONSE_LEN,
&count);
@@ -310,10 +305,10 @@ mn_pop3_mailbox_server_read (MNPOP3Mailbox *mailbox, char *buf)
strcpy(tmp, buf);
mn_pop3_mailbox_strip_crlf(tmp);
- mn_notice("<%20-s> %s", mailbox->hostname, tmp);
+ mn_notice("<%20-s> %s", mailbox->priv->hostname, tmp);
}
else
- mn_notice(_("unable to read from %s"), mailbox->hostname);
+ mn_notice(_("unable to read from %s"), mailbox->priv->hostname);
}
return status == G_IO_ERROR_NONE && count != 0 && ! strncmp(buf, "+OK", 3);
@@ -348,7 +343,7 @@ mn_pop3_mailbox_server_command (MNPOP3Mailbox *mailbox,
g_free(command);
len = strlen(full);
- status = gnet_io_channel_writen(mailbox->channel, full, len, &count);
+ status = gnet_io_channel_writen(mailbox->priv->channel, full, len, &count);
g_free(full);
return status == G_IO_ERROR_NONE && count == len;
@@ -357,16 +352,13 @@ mn_pop3_mailbox_server_command (MNPOP3Mailbox *mailbox,
static gboolean
mn_pop3_mailbox_has_new (MNMailbox *mailbox, GError **err)
{
- MNPOP3Mailbox *pop3_mailbox;
+ MNPOP3Mailbox *pop3_mailbox = MN_POP3_MAILBOX(mailbox);
char buf[MN_POP3_MAILBOX_MAX_RESPONSE_LEN];
gboolean has_new = FALSE;
-
char ok[4];
int count;
int size;
- pop3_mailbox = MN_POP3_MAILBOX(mailbox);
-
if (! mn_pop3_mailbox_server_connect(pop3_mailbox, err))
return FALSE;
@@ -384,7 +376,7 @@ mn_pop3_mailbox_has_new (MNMailbox *mailbox, GError **err)
if (! mn_pop3_mailbox_server_command(pop3_mailbox,
"USER %s",
- pop3_mailbox->user))
+ pop3_mailbox->priv->user))
{
g_set_error(err, MN_POP3_MAILBOX_ERROR, MN_POP3_MAILBOX_ERROR_SEND,
_("unable to send username"));
@@ -401,7 +393,7 @@ mn_pop3_mailbox_has_new (MNMailbox *mailbox, GError **err)
if (! mn_pop3_mailbox_server_command(pop3_mailbox,
"PASS %s",
- pop3_mailbox->password))
+ pop3_mailbox->priv->password))
{
g_set_error(err, MN_POP3_MAILBOX_ERROR, MN_POP3_MAILBOX_ERROR_SEND,
_("unable to send password"));
@@ -460,7 +452,7 @@ mn_pop3_mailbox_has_new (MNMailbox *mailbox, GError **err)
}
end:
- gnet_tcp_socket_delete(pop3_mailbox->socket);
+ gnet_tcp_socket_delete(pop3_mailbox->priv->socket);
return has_new;
}
diff --git a/src/mn-pop3-mailbox.h b/src/mn-pop3-mailbox.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -21,7 +21,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <gnet.h>
#include "mn-mailbox.h"
#define MN_TYPE_POP3_MAILBOX (mn_pop3_mailbox_get_type())
@@ -44,18 +43,13 @@ typedef enum
MN_POP3_MAILBOX_ERROR_REPLY
} MNPOP3MailboxError;
+typedef struct _MNPOP3MailboxPrivate MNPOP3MailboxPrivate;
+
typedef struct
{
MNMailbox mailbox;
- char *hostname;
- int port;
-
- char *user;
- char *password;
-
- GTcpSocket *socket;
- GIOChannel *channel;
+ MNPOP3MailboxPrivate *priv;
} MNPOP3Mailbox;
typedef struct
diff --git a/src/mn-preferences.c b/src/mn-preferences.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -31,7 +31,7 @@
/*** types *******************************************************************/
enum {
- COLUMN_PTR,
+ COLUMN_OBJECT,
COLUMN_MAILBOX,
COLUMN_FORMAT,
N_COLUMNS
@@ -39,31 +39,31 @@ enum {
/*** variables ***************************************************************/
-GladeXML *preferences_xml = NULL;
-GtkWidget *preferences;
+static GladeXML *preferences_xml = NULL;
+static GtkWidget *preferences;
-GtkWidget *local_check;
-GtkWidget *local_minutes_spin;
-GtkWidget *local_minutes_label;
-GtkWidget *local_seconds_spin;
-GtkWidget *local_seconds_label;
+static GtkWidget *local_check;
+static GtkWidget *local_minutes_spin;
+static GtkWidget *local_minutes_label;
+static GtkWidget *local_seconds_spin;
+static GtkWidget *local_seconds_label;
-GtkWidget *remote_check;
-GtkWidget *remote_minutes_spin;
-GtkWidget *remote_minutes_label;
-GtkWidget *remote_seconds_spin;
-GtkWidget *remote_seconds_label;
+static GtkWidget *remote_check;
+static GtkWidget *remote_minutes_spin;
+static GtkWidget *remote_minutes_label;
+static GtkWidget *remote_seconds_spin;
+static GtkWidget *remote_seconds_label;
-GtkWidget *list;
-GtkWidget *add_remote;
-GtkWidget *remove;
+static GtkWidget *list;
+static GtkWidget *add_remote;
+static GtkWidget *remove;
-GtkWidget *command_new_mail_check;
-GtkWidget *command_new_mail_entry;
-GtkWidget *command_clicked_check;
-GtkWidget *command_clicked_entry;
+static GtkWidget *command_new_mail_check;
+static GtkWidget *command_new_mail_entry;
+static GtkWidget *command_clicked_check;
+static GtkWidget *command_clicked_entry;
-GtkListStore *store;
+static GtkListStore *store;
/*** functions ***************************************************************/
@@ -195,6 +195,7 @@ mn_preferences_update_values (void)
{
const char *command_new_mail;
const char *command_clicked;
+ GSList *mailboxes;
GSList *l;
command_new_mail = mn_conf_get_string("/apps/mail-notification/commands/new-mail/command");
@@ -220,7 +221,9 @@ mn_preferences_update_values (void)
gtk_entry_set_text(GTK_ENTRY(command_clicked_entry), command_clicked ? command_clicked : "");
gtk_list_store_clear(store);
- MN_LIST_FOREACH(l, mn_mailboxes)
+
+ mailboxes = mn_mailboxes_get();
+ MN_LIST_FOREACH(l, mailboxes)
{
MNMailbox *mailbox = l->data;
MNMailboxClass *class;
@@ -231,11 +234,12 @@ mn_preferences_update_values (void)
gtk_list_store_append(store, &iter);
gtk_list_store_set(store,
&iter,
- COLUMN_PTR, mailbox,
+ COLUMN_OBJECT, mailbox,
COLUMN_MAILBOX, mailbox->name,
COLUMN_FORMAT, class->format,
-1);
}
+ mn_objects_free(mailboxes);
}
}
@@ -340,14 +344,10 @@ static void
mn_preferences_add_local_mailbox (void)
{
GtkWidget *file_selection;
- GdkPixbuf *icon;
static char *path = NULL;
file_selection = gtk_file_selection_new(_("Select One or More Mailboxes"));
-
- icon = mn_pixbuf_new("add-icon.png");
- gtk_window_set_icon(GTK_WINDOW(file_selection), icon);
- g_object_unref(icon);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selection), GTK_WINDOW(preferences));
if (path)
gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_selection), path);
@@ -415,6 +415,8 @@ mn_preferences_add_remote_mailbox (void)
gtk_size_group_add_widget(size_group, username_label);
gtk_size_group_add_widget(size_group, password_label);
+ gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(preferences));
+
run:
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
{
@@ -506,8 +508,9 @@ mn_preferences_remove_mailbox_cb (GtkTreeModel *model,
{
MNMailbox *mailbox;
- gtk_tree_model_get(model, iter, COLUMN_PTR, &mailbox, -1);
+ gtk_tree_model_get(model, iter, COLUMN_OBJECT, &mailbox, -1);
mn_conf_remove_mailbox(mailbox->locator);
+ g_object_unref(mailbox);
}
/* libglade callbacks */
diff --git a/src/mn-sylpheed-mailbox.c b/src/mn-sylpheed-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -64,9 +64,8 @@ mn_sylpheed_mailbox_get_type (void)
static void
mn_sylpheed_mailbox_class_init (MNSylpheedMailboxClass *class)
{
- MNMailboxClass *mailbox_class;
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = "Sylpheed";
mailbox_class->is_remote = FALSE;
mailbox_class->is = mn_sylpheed_mailbox_is;
diff --git a/src/mn-ui.c b/src/mn-ui.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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,14 +23,18 @@
#include "mn-preferences.h"
#include "mn-dialog.h"
#include "mn-util.h"
+#include "mn-conf.h"
/*** variables ***************************************************************/
static MNMailIcon *mail_icon;
+static GtkWidget *check_for_mail_item;
/*** functions ***************************************************************/
static void mn_ui_icon_init (void);
+static void mn_ui_icon_activate_h (MNMailIcon *icon,
+ gpointer user_data);
static void mn_ui_icon_destroy_h (GtkObject *object,
gpointer user_data);
@@ -45,7 +49,20 @@ mn_ui_init (void)
static void
mn_ui_icon_init (void)
{
+ GladeXML *xml;
+ GtkWidget *menu;
+
mail_icon = MN_MAIL_ICON(mn_mail_icon_new());
+
+ xml = mn_glade_xml_new("menu");
+ menu = glade_xml_get_widget(xml, "menu");
+ check_for_mail_item = glade_xml_get_widget(xml, "check_for_mail");
+ g_object_unref(xml);
+
+ mn_mail_icon_set_popup_menu(mail_icon, GTK_MENU(menu));
+
+ g_signal_connect(G_OBJECT(mail_icon), "activate",
+ G_CALLBACK(mn_ui_icon_activate_h), NULL);
g_signal_connect(G_OBJECT(mail_icon), "destroy",
G_CALLBACK(mn_ui_icon_destroy_h), NULL);
@@ -53,6 +70,29 @@ mn_ui_icon_init (void)
}
static void
+mn_ui_icon_activate_h (MNMailIcon *icon, gpointer user_data)
+{
+ if (mn_conf_get_bool("/apps/mail-notification/commands/clicked/enabled"))
+ {
+ const char *command;
+
+ command = mn_conf_get_string("/apps/mail-notification/commands/clicked/command");
+ if (command)
+ {
+ GError *err = NULL;
+
+ if (! g_spawn_command_line_async(command, &err))
+ {
+ mn_error_dialog(_("Command error."),
+ _("Unable to execute clicked command: %s."),
+ err->message);
+ g_error_free(err);
+ }
+ }
+ }
+}
+
+static void
mn_ui_icon_destroy_h (GtkObject *object, gpointer user_data)
{
/* The Notification Area applet has been terminated. Recreate the icon. */
@@ -68,7 +108,7 @@ mn_ui_set_has_new (gboolean has_new)
void
mn_ui_set_can_check (gboolean can_check)
{
- mn_mail_icon_set_can_check(mail_icon, can_check);
+ gtk_widget_set_sensitive(check_for_mail_item, can_check);
}
/* libglade callbacks */
@@ -103,7 +143,7 @@ mn_ui_about_activate_h (GtkMenuItem *menuitem, gpointer user_data)
logo = mn_pixbuf_new("logo.png");
about = gnome_about_new(_("Mail Notification"),
VERSION,
- _("Copyright (c) 2003 Jean-Yves Lefort"),
+ _("Copyright (c) 2003, 2004 Jean-Yves Lefort"),
_("A Mail Notification for the Panel Notification Area"),
authors,
NULL,
diff --git a/src/mn-unsupported-mailbox.c b/src/mn-unsupported-mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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,7 +22,7 @@
/*** functions ***************************************************************/
-static void mn_unsupported_mailbox_class_init (MNUnsupportedMailboxClass *class);
+static void mn_unsupported_mailbox_class_init (MNUnsupportedMailboxClass *class);
/*** implementation **********************************************************/
@@ -57,9 +57,8 @@ mn_unsupported_mailbox_get_type (void)
static void
mn_unsupported_mailbox_class_init (MNUnsupportedMailboxClass *class)
{
- MNMailboxClass *mailbox_class;
+ MNMailboxClass *mailbox_class = MN_MAILBOX_CLASS(class);
- mailbox_class = MN_MAILBOX_CLASS(class);
mailbox_class->format = _("unsupported");
mailbox_class->is_remote = FALSE;
mailbox_class->is = NULL;
diff --git a/src/mn-util.c b/src/mn-util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -29,7 +29,7 @@
/*** implementation **********************************************************/
/*
- * Frees a singly linked list of heap pointers.
+ * Free a singly linked list of heap pointers.
*/
void
mn_slist_free (GSList *list)
@@ -42,6 +42,36 @@ mn_slist_free (GSList *list)
g_slist_free(list);
}
+/*
+ * Free a singly linked list of objects.
+ */
+void
+mn_objects_free (GSList *list)
+{
+ GSList *l;
+
+ MN_LIST_FOREACH(l, list)
+ g_object_unref(l->data);
+
+ g_slist_free(list);
+}
+
+/*
+ * Copy a singly linked list of objects.
+ */
+GSList *
+mn_objects_copy (GSList *list)
+{
+ GSList *l;
+ GSList *copy;
+
+ copy = g_slist_copy(list);
+ MN_LIST_FOREACH(l, copy)
+ g_object_ref(l->data);
+
+ return copy;
+}
+
#ifdef HAVE_GNET
GIOError
mn_gnet_io_channel_printf (GIOChannel *channel, const char *format, ...)
diff --git a/src/mn-util.h b/src/mn-util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Jean-Yves Lefort <jylefort@brutele.be>
+ * Copyright (c) 2003, 2004 Jean-Yves Lefort <jylefort@brutele.be>
*
* 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
@@ -30,6 +30,9 @@ for ((var) = (head); \
void mn_slist_free (GSList *list);
+void mn_objects_free (GSList *list);
+GSList *mn_objects_copy (GSList *list);
+
#ifdef HAVE_GNET
GIOError mn_gnet_io_channel_printf (GIOChannel *channel,
const char *format,
diff --git a/ui/add-pop3.glade b/ui/add-pop3.glade
@@ -12,7 +12,6 @@
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
- <property name="icon">add-icon.png</property>
<property name="has_separator">False</property>
<child internal-child="vbox">