2006-10-19 [colin] 2.5.6cvs2
authorColin Leroy <colin@colino.net>
Thu, 19 Oct 2006 16:49:56 +0000 (16:49 +0000)
committerColin Leroy <colin@colino.net>
Thu, 19 Oct 2006 16:49:56 +0000 (16:49 +0000)
* src/gtk/quicksearch.c
Fix emptying in type-ahead+extended mode
* src/mainwindow.c
* src/mainwindow.h
Add a hook for offline state change
* src/plugins/trayicon/trayicon.c
Use it to display offline icons
* src/plugins/trayicon/Makefile.am
* src/plugins/trayicon/newmail.offline.xpm
* src/plugins/trayicon/newmarkedmail.offline.xpm
* src/plugins/trayicon/nomail.offline.xpm
* src/plugins/trayicon/unreadmail.offline.xpm
* src/plugins/trayicon/unreadmarkedmail.offline.xpm
Add the icons

13 files changed:
ChangeLog
PATCHSETS
configure.ac
src/gtk/quicksearch.c
src/mainwindow.c
src/mainwindow.h
src/plugins/trayicon/Makefile.am
src/plugins/trayicon/newmail.offline.xpm [new file with mode: 0644]
src/plugins/trayicon/newmarkedmail.offline.xpm [new file with mode: 0644]
src/plugins/trayicon/nomail.offline.xpm [new file with mode: 0644]
src/plugins/trayicon/trayicon.c
src/plugins/trayicon/unreadmail.offline.xpm [new file with mode: 0644]
src/plugins/trayicon/unreadmarkedmail.offline.xpm [new file with mode: 0644]

index 7ad2950..fea6188 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-10-19 [colin]     2.5.6cvs2
+
+       * src/gtk/quicksearch.c
+               Fix emptying in type-ahead+extended mode
+       * src/mainwindow.c
+       * src/mainwindow.h
+               Add a hook for offline state change
+       * src/plugins/trayicon/trayicon.c
+               Use it to display offline icons
+       * src/plugins/trayicon/Makefile.am
+       * src/plugins/trayicon/newmail.offline.xpm
+       * src/plugins/trayicon/newmarkedmail.offline.xpm
+       * src/plugins/trayicon/nomail.offline.xpm
+       * src/plugins/trayicon/unreadmail.offline.xpm
+       * src/plugins/trayicon/unreadmarkedmail.offline.xpm
+               Add the icons
+
 2006-10-12 [paul]      2.5.6cvs1
 
        * NEWS
index 59a5182..a6c5b05 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.204.2.105 -r 1.204.2.106 src/prefs_common.c;  cvs diff -u -r 1.103.2.63 -r 1.103.2.64 src/prefs_common.h;  cvs diff -u -r 1.395.2.263 -r 1.395.2.264 src/summaryview.c;  cvs diff -u -r 1.1.2.47 -r 1.1.2.48 src/gtk/quicksearch.c;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/gtk/quicksearch.h;  ) > 2.5.5cvs16.patchset
 ( cvs diff -u -r 1.1.2.48 -r 1.1.2.49 src/gtk/quicksearch.c;  ) > 2.5.5cvs17.patchset
 ( cvs diff -u -r 1.1.2.12 -r 1.1.2.13 manual/handling.xml;  ) > 2.5.5cvs18.patchset
+( cvs diff -u -r 1.274.2.152 -r 1.274.2.153 src/mainwindow.c;  cvs diff -u -r 1.39.2.24 -r 1.39.2.25 src/mainwindow.h;  cvs diff -u -r 1.1.2.49 -r 1.1.2.50 src/gtk/quicksearch.c;  cvs diff -u -r 1.4.2.6 -r 1.4.2.7 src/plugins/trayicon/Makefile.am;  diff -u /dev/null src/plugins/trayicon/newmail.offline.xpm;  diff -u /dev/null src/plugins/trayicon/newmarkedmail.offline.xpm;  diff -u /dev/null src/plugins/trayicon/nomail.offline.xpm;  cvs diff -u -r 1.14.2.39 -r 1.14.2.40 src/plugins/trayicon/trayicon.c;  diff -u /dev/null src/plugins/trayicon/unreadmail.offline.xpm;  diff -u /dev/null src/plugins/trayicon/unreadmarkedmail.offline.xpm;  ) > 2.5.6cvs2.patchset
index 55d26d3..ddca193 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=1
+EXTRA_VERSION=2
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c38f4c6..3cebc7b 100644 (file)
@@ -174,7 +174,8 @@ static void searchbar_run(QuickSearch *quicksearch, gboolean run_only_if_fast)
        if (run_only_if_fast && !quicksearch->is_fast)
                return;
        if (quicksearch->matcher_list == NULL && 
-           prefs_common.summary_quicksearch_type == QUICK_SEARCH_EXTENDED)
+           prefs_common.summary_quicksearch_type == QUICK_SEARCH_EXTENDED &&
+           search_string && strlen(search_string) != 0)
                return;
        quicksearch_set_running(quicksearch, TRUE);
        if (quicksearch->callback != NULL)
index 8ca8964..68729fe 100644 (file)
@@ -3300,6 +3300,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                mainwindow_check_synchronise(mainwin, TRUE);
                prefs_common.work_offline = TRUE;
                imap_disconnect_all();
+               hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        } else {
                /*go online */
                if (!prefs_common.work_offline)
@@ -3310,6 +3311,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                prefs_common.work_offline = FALSE;
                inc_autocheck_timer_set();
                refresh_resolvers();
+               hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        }
 }
 
index d536312..7a7635e 100644 (file)
@@ -31,6 +31,8 @@ typedef struct _MainWindow  MainWindow;
 #include "logwindow.h"
 #include "toolbar.h"
 
+#define OFFLINE_SWITCH_HOOKLIST "offline_switch"
+
 typedef enum
 {
        M_UNLOCKED            = 1 << 0,
index dbf452d..c3467bb 100644 (file)
@@ -39,4 +39,9 @@ EXTRA_DIST = \
        newmarkedmail.xpm \
        nomail.xpm \
        unreadmail.xpm \
-       unreadmarkedmail.xpm
+       unreadmarkedmail.xpm \
+       newmail.offline.xpm \
+       newmarkedmail.offline.xpm \
+       nomail.offline.xpm \
+       unreadmail.offline.xpm \
+       unreadmarkedmail.offline.xpm
diff --git a/src/plugins/trayicon/newmail.offline.xpm b/src/plugins/trayicon/newmail.offline.xpm
new file mode 100644 (file)
index 0000000..e0ba855
--- /dev/null
@@ -0,0 +1,29 @@
+/* XPM */
+static char * newmail_offline_xpm[] = {
+"16 16 10 1",
+"      c None",
+".     c #787878",
+"+     c #FFFFFF",
+"@     c #FF7878",
+"#     c #CDCDCD",
+"$     c #000000",
+"%     c #DFDFDF",
+"&     c #6666CC",
+"*     c #BCBCBC",
+"=     c #A7A7A7",
+"       ..       ",
+"      .++.      ",
+"     .++@+.     ",
+"    .++@@@+.    ",
+"   .++++@+++.   ",
+"  .+++#+++#++.  ",
+" .+++#+++#+++.. ",
+"....$$++#+$$....",
+".+%$&$$$++$&$*=.",
+"$$$&&$#+++$&&$$$",
+"&&&&&$$$+%$&&&&&",
+"$$$&&$%%%%$&&$$$",
+".+%$&$$$**$&$*=.",
+".+%#$$****$$**=.",
+" .%#**********. ",
+"  ............  "};
diff --git a/src/plugins/trayicon/newmarkedmail.offline.xpm b/src/plugins/trayicon/newmarkedmail.offline.xpm
new file mode 100644 (file)
index 0000000..345c4e9
--- /dev/null
@@ -0,0 +1,30 @@
+/* XPM */
+static char * newmarkedmail_offline_xpm[] = {
+"16 16 11 1",
+"      c None",
+".     c #EE9595",
+"+     c #FFFFFF",
+"@     c #FF7878",
+"#     c #CDCDCD",
+"$     c #000000",
+"%     c #DFDFDF",
+"&     c #6666CC",
+"*     c #BCBCBC",
+"=     c #A7A7A7",
+"-     c #787878",
+"       ..       ",
+"      .++.      ",
+"     .++@+.     ",
+"    .++@@@+.    ",
+"   .++++@+++.   ",
+"  .+++#+++#++.  ",
+" .+++#+++#+++.. ",
+"....$$++#+$$....",
+".+%$&$$$++$&$*=.",
+"$$$&&$#+++$&&$$$",
+"&&&&&$$$+%$&&&&&",
+"$$$&&$%%%%$&&$$$",
+".+%$&$$$**$&$*=.",
+".+%#$$****$$**=.",
+" -%#**********. ",
+"  ............  "};
diff --git a/src/plugins/trayicon/nomail.offline.xpm b/src/plugins/trayicon/nomail.offline.xpm
new file mode 100644 (file)
index 0000000..ff11f10
--- /dev/null
@@ -0,0 +1,29 @@
+/* XPM */
+static char * nomail_offline_xpm[] = {
+"16 16 10 1",
+"      c None",
+".     c #787878",
+"+     c #CDCDCD",
+"@     c #ECECEC",
+"#     c #BCBCBC",
+"$     c #DFDFDF",
+"%     c #000000",
+"&     c #FFFFFF",
+"*     c #6666CC",
+"=     c #A7A7A7",
+"                ",
+"                ",
+"                ",
+"    ........    ",
+"   .++@@@@#$.   ",
+"  .+#########.  ",
+" .+++$$$$$$###. ",
+"....%%$$$$%%....",
+".&$%*%%%$$%*%#=.",
+"%%%**%$$$$%**%%%",
+"*****%%%$$%*****",
+"%%%**%$$$$%**%%%",
+".&$%*%%%##%*%#=.",
+".&$+%%####%%##=.",
+" .$+##########. ",
+"  ............  "};
index 28ed6ca..20b3ced 100644 (file)
 #include "gtk/manage_window.h"
 
 #include "eggtrayicon.h"
+
 #include "newmarkedmail.xpm"
 #include "unreadmarkedmail.xpm"
 #include "newmail.xpm"
 #include "unreadmail.xpm"
 #include "nomail.xpm"
+#include "newmarkedmail.offline.xpm"
+#include "unreadmarkedmail.offline.xpm"
+#include "newmail.offline.xpm"
+#include "unreadmail.offline.xpm"
+#include "nomail.offline.xpm"
 
 static guint item_hook_id;
 static guint folder_hook_id;
-
-static GdkPixmap *newmail_pixmap;
-static GdkPixmap *newmail_bitmap;
-static GdkPixmap *unreadmail_pixmap;
-static GdkPixmap *unreadmail_bitmap;
-static GdkPixmap *newmarkedmail_pixmap;
-static GdkPixmap *newmarkedmail_bitmap;
-static GdkPixmap *unreadmarkedmail_pixmap;
-static GdkPixmap *unreadmarkedmail_bitmap;
-static GdkPixmap *nomail_pixmap;
-static GdkPixmap *nomail_bitmap;
+static guint offline_hook_id;
+
+static GdkPixmap *newmail_pixmap[2];
+static GdkPixmap *newmail_bitmap[2];
+static GdkPixmap *unreadmail_pixmap[2];
+static GdkPixmap *unreadmail_bitmap[2];
+static GdkPixmap *newmarkedmail_pixmap[2];
+static GdkPixmap *newmarkedmail_bitmap[2];
+static GdkPixmap *unreadmarkedmail_pixmap[2];
+static GdkPixmap *unreadmarkedmail_bitmap[2];
+static GdkPixmap *nomail_pixmap[2];
+static GdkPixmap *nomail_bitmap[2];
 
 static EggTrayIcon *trayicon;
 static GtkWidget *eventbox;
@@ -109,24 +116,24 @@ static void set_trayicon_pixmap(TrayIconType icontype)
 
        switch(icontype) {
        case TRAYICON_NEW:
-               pixmap = newmail_pixmap;
-               bitmap = newmail_bitmap;
+               pixmap = newmail_pixmap[prefs_common.work_offline];
+               bitmap = newmail_bitmap[prefs_common.work_offline];
                break;
        case TRAYICON_NEWMARKED:
-               pixmap = newmarkedmail_pixmap;
-               bitmap = newmarkedmail_bitmap;
+               pixmap = newmarkedmail_pixmap[prefs_common.work_offline];
+               bitmap = newmarkedmail_bitmap[prefs_common.work_offline];
                break;
        case TRAYICON_UNREAD:
-               pixmap = unreadmail_pixmap;
-               bitmap = unreadmail_bitmap;
+               pixmap = unreadmail_pixmap[prefs_common.work_offline];
+               bitmap = unreadmail_bitmap[prefs_common.work_offline];
                break;
        case TRAYICON_UNREADMARKED:
-               pixmap = unreadmarkedmail_pixmap;
-               bitmap = unreadmarkedmail_bitmap;
+               pixmap = unreadmarkedmail_pixmap[prefs_common.work_offline];
+               bitmap = unreadmarkedmail_bitmap[prefs_common.work_offline];
                break;
        default:
-               pixmap = nomail_pixmap;
-               bitmap = nomail_bitmap;
+               pixmap = nomail_pixmap[prefs_common.work_offline];
+               bitmap = nomail_bitmap[prefs_common.work_offline];
                break;
        }
 
@@ -189,6 +196,12 @@ static gboolean folder_update_hook(gpointer source, gpointer data)
        return FALSE;
 }
 
+static gboolean offline_update_hook(gpointer source, gpointer data)
+{
+       update(NULL);
+       return FALSE;
+}
+
 static void resize_cb(GtkWidget *widget, GtkRequisition *req,
                      gpointer user_data)
 {
@@ -253,17 +266,24 @@ static void create_trayicon()
        gtk_window_set_default_size(GTK_WINDOW(trayicon), 16, 16);
        gtk_container_set_border_width(GTK_CONTAINER(trayicon), 0);
 
-       PIXMAP_CREATE(GTK_WIDGET(trayicon), nomail_pixmap, nomail_bitmap, nomail_xpm);
-       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmail_pixmap, unreadmail_bitmap, unreadmail_xpm);
-       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmail_pixmap, newmail_bitmap, newmail_xpm);
-       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmarkedmail_pixmap, unreadmarkedmail_bitmap, unreadmarkedmail_xpm);
-       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmarkedmail_pixmap, newmarkedmail_bitmap, newmarkedmail_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), nomail_pixmap[0], nomail_bitmap[0], nomail_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmail_pixmap[0], unreadmail_bitmap[0], unreadmail_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmail_pixmap[0], newmail_bitmap[0], newmail_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmarkedmail_pixmap[0], unreadmarkedmail_bitmap[0], unreadmarkedmail_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmarkedmail_pixmap[0], newmarkedmail_bitmap[0], newmarkedmail_xpm);
+
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), nomail_pixmap[1], nomail_bitmap[1], nomail_offline_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmail_pixmap[1], unreadmail_bitmap[1], unreadmail_offline_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmail_pixmap[1], newmail_bitmap[1], newmail_offline_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), unreadmarkedmail_pixmap[1], unreadmarkedmail_bitmap[1], unreadmarkedmail_offline_xpm);
+       PIXMAP_CREATE(GTK_WIDGET(trayicon), newmarkedmail_pixmap[1], newmarkedmail_bitmap[1], newmarkedmail_offline_xpm);
+
 
        eventbox = gtk_event_box_new();
        gtk_container_set_border_width(GTK_CONTAINER(eventbox), 0);
        gtk_container_add(GTK_CONTAINER(trayicon), GTK_WIDGET(eventbox));
 
-       image = gtk_image_new_from_pixmap(nomail_pixmap, nomail_bitmap);
+       image = gtk_image_new_from_pixmap(nomail_pixmap[0], nomail_bitmap[0]);
        gtk_container_add(GTK_CONTAINER(eventbox), image);
 
        destroy_signal_id =
@@ -313,6 +333,12 @@ int plugin_init(gchar **error)
                return -1;
        }
 
+       offline_hook_id = hooks_register_hook (OFFLINE_SWITCH_HOOKLIST, offline_update_hook, NULL);
+       if (offline_hook_id == -1) {
+               *error = g_strdup(_("Failed to register offline switch hook"));
+               return -1;
+       }
+
        create_trayicon();
 
        return 0;
@@ -322,6 +348,7 @@ void plugin_done(void)
 {
        hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, item_hook_id);
        hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, folder_hook_id);
+       hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, offline_hook_id);
 
        if (sylpheed_is_exiting())
                return;
@@ -389,7 +416,7 @@ static void trayicon_toggle_offline_cb( gpointer data, guint action, GtkWidget *
        /* toggle offline mode if menu checkitem has been clicked */
        if (!updating_menu) {
                MainWindow *mainwin = mainwindow_get_mainwindow();
-               main_window_toggle_work_offline(mainwin, !prefs_common.work_offline, FALSE);
+               main_window_toggle_work_offline(mainwin, !prefs_common.work_offline, TRUE);
        }
 }
 
diff --git a/src/plugins/trayicon/unreadmail.offline.xpm b/src/plugins/trayicon/unreadmail.offline.xpm
new file mode 100644 (file)
index 0000000..a02e02a
--- /dev/null
@@ -0,0 +1,29 @@
+/* XPM */
+static char * unreadmail_offline_xpm[] = {
+"16 16 10 1",
+"      c None",
+".     c #787878",
+"+     c #DFDFDF",
+"@     c #FFFFFF",
+"#     c #BCBCBC",
+"$     c #FF7878",
+"%     c #000000",
+"&     c #6666CC",
+"*     c #ACACAC",
+"=     c #CDCDCD",
+"   ...........  ",
+"  .+++++++++++. ",
+" .............. ",
+" .@@@@@@@@@@@@. ",
+" .@####@@@@$$@. ",
+" .@@@@@@@@@$$@. ",
+" .@@@@@@@@@@@@. ",
+"....%%++++%%....",
+".@+%&%%%@@%&%#*.",
+"%%%&&%@@++%&&%%%",
+"&&&&&%%%@@%&&&&&",
+"%%%&&%++++%&&%%%",
+".@+%&%%%##%&%#*.",
+".@+=%%####%%##*.",
+" .+=##########. ",
+"  ............  "};
diff --git a/src/plugins/trayicon/unreadmarkedmail.offline.xpm b/src/plugins/trayicon/unreadmarkedmail.offline.xpm
new file mode 100644 (file)
index 0000000..7ab1837
--- /dev/null
@@ -0,0 +1,29 @@
+/* XPM */
+static char * unreadmarkedmail_offline_xpm[] = {
+"16 16 10 1",
+"      c None",
+".     c #EE9595",
+"+     c #DFDFDF",
+"@     c #FFFFFF",
+"#     c #BCBCBC",
+"$     c #FF7878",
+"%     c #000000",
+"&     c #6666CC",
+"*     c #ACACAC",
+"=     c #CDCDCD",
+"   ...........  ",
+"  .+++++++++++. ",
+" .............. ",
+" .@@@@@@@@@@@@. ",
+" .@####@@@@$$@. ",
+" .@@@@@@@@@$$@. ",
+" .@@@@@@@@@@@@. ",
+"....%%++++%%....",
+".@+%&%%%@@%&%#*.",
+"%%%&&%@@++%&&%%%",
+"&&&&&%%%@@%&&&&&",
+"%%%&&%++++%&&%%%",
+".@+%&%%%##%&%#*.",
+".@+=%%####%%##*.",
+" .+=##########. ",
+"  ............  "};