2008-05-26 [colin] 3.4.0cvs70
authorColin Leroy <colin@colino.net>
Mon, 26 May 2008 19:33:40 +0000 (19:33 +0000)
committerColin Leroy <colin@colino.net>
Mon, 26 May 2008 19:33:40 +0000 (19:33 +0000)
* src/mainwindow.c
* src/mainwindow.h
Define THEME_CHANGED_HOOKLIST and invoke
it on theme change
* src/plugins/trayicon/trayicon.c
Listen to THEME_CHANGED_HOOKLIST and
update accordingly

ChangeLog
PATCHSETS
configure.ac
src/mainwindow.c
src/mainwindow.h
src/plugins/trayicon/trayicon.c

index c5e6252..1cf5231 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-05-26 [colin]     3.4.0cvs70
+
+       * src/mainwindow.c
+       * src/mainwindow.h
+               Define THEME_CHANGED_HOOKLIST and invoke
+               it on theme change
+       * src/plugins/trayicon/trayicon.c
+               Listen to THEME_CHANGED_HOOKLIST and
+               update accordingly
+
 2008-05-26 [paul]      3.4.0cvs69
 
        * src/mimeview.c
index 2c753fa..6e8e81c 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.155.2.86 -r 1.155.2.87 src/Makefile.am;  cvs diff -u -r 1.25.2.56 -r 1.25.2.57 src/stock_pixmap.c;  cvs diff -u -r 1.18.2.35 -r 1.18.2.36 src/stock_pixmap.h;  cvs diff -u -r 1.43.2.100 -r 1.43.2.101 src/toolbar.c;  diff -u /dev/null src/pixmaps/cancel.xpm;  cvs diff -u -r 1.1.14.2 -r 1.1.14.3 src/pixmaps/close.xpm;  ) > 3.4.0cvs67.patchset
 ( cvs diff -u -r 1.20.2.61 -r 1.20.2.62 src/common/utils.h;  ) > 3.4.0cvs68.patchset
 ( cvs diff -u -r 1.83.2.131 -r 1.83.2.132 src/mimeview.c;  ) > 3.4.0cvs69.patchset
+( cvs diff -u -r 1.274.2.244 -r 1.274.2.245 src/mainwindow.c;  cvs diff -u -r 1.39.2.45 -r 1.39.2.46 src/mainwindow.h;  cvs diff -u -r 1.14.2.62 -r 1.14.2.63 src/plugins/trayicon/trayicon.c;  ) > 3.4.0cvs70.patchset
index 9552e53..84d5016 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=69
+EXTRA_VERSION=70
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 99c5604..8137e66 100644 (file)
@@ -2061,6 +2061,7 @@ static gboolean reflect_prefs_timeout_cb(gpointer data)
                        gtk_widget_show(pixmap);
                        mainwin->offline_pixmap = pixmap;
 #endif
+                       hooks_invoke(THEME_CHANGED_HOOKLIST, NULL);
                }
                
                headerview_set_font(mainwin->messageview->headerview);
index 069ddf9..f5e57f8 100644 (file)
@@ -35,7 +35,7 @@ typedef struct _MainWindow  MainWindow;
 #define ACCOUNT_LIST_CHANGED_HOOKLIST "account_list_changed"
 #define MAIN_WINDOW_CLOSE "mainwindow_close"
 #define MAIN_WINDOW_GOT_ICONIFIED "mainwindow_iconified"
-
+#define THEME_CHANGED_HOOKLIST "theme_changed"
 typedef enum
 {
        M_UNLOCKED            = 1 << 0,
index 45aef83..94ac0c2 100644 (file)
@@ -57,21 +57,22 @@ static guint offline_hook_id;
 static guint account_hook_id;
 static guint close_hook_id;
 static guint iconified_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 guint theme_hook_id;
+
+static GdkPixmap *newmail_pixmap[2] = {NULL, NULL};
+static GdkPixmap *newmail_bitmap[2] = {NULL, NULL};
+static GdkPixmap *unreadmail_pixmap[2] = {NULL, NULL};
+static GdkPixmap *unreadmail_bitmap[2] = {NULL, NULL};
+static GdkPixmap *newmarkedmail_pixmap[2] = {NULL, NULL};
+static GdkPixmap *newmarkedmail_bitmap[2] = {NULL, NULL};
+static GdkPixmap *unreadmarkedmail_pixmap[2] = {NULL, NULL};
+static GdkPixmap *unreadmarkedmail_bitmap[2] = {NULL, NULL};
+static GdkPixmap *nomail_pixmap[2] = {NULL, NULL};
+static GdkPixmap *nomail_bitmap[2] = {NULL, NULL};
 
 static EggTrayIcon *trayicon;
 static GtkWidget *eventbox;
-static GtkWidget *image;
+static GtkWidget *image = NULL;
 static GtkTooltips *tooltips;
 static GtkWidget *traymenu_popup;
 static GtkItemFactory *traymenu_factory;
@@ -349,15 +350,8 @@ static void destroy_cb(GtkWidget *widget, gpointer *data)
        create_trayicon();
 }
 
-static void create_trayicon()
+static gboolean trayicon_update_theme(gpointer source, gpointer data)
 {
-       gint n_entries = 0;
-
-       trayicon = egg_tray_icon_new("Claws Mail");
-       gtk_widget_realize(GTK_WIDGET(trayicon));
-       gtk_window_set_default_size(GTK_WINDOW(trayicon), 16, 16);
-       gtk_container_set_border_width(GTK_CONTAINER(trayicon), 0);
-
        stock_pixmap_gdk(GTK_WIDGET(trayicon), STOCK_PIXMAP_TRAY_NOMAIL, &nomail_pixmap[0], &nomail_bitmap[0]);
        stock_pixmap_gdk(GTK_WIDGET(trayicon), STOCK_PIXMAP_TRAY_UNREADMAIL, &unreadmail_pixmap[0], &unreadmail_bitmap[0]);
        stock_pixmap_gdk(GTK_WIDGET(trayicon), STOCK_PIXMAP_TRAY_NEWMAIL, &newmail_pixmap[0], &newmail_bitmap[0]);
@@ -370,6 +364,22 @@ static void create_trayicon()
        stock_pixmap_gdk(GTK_WIDGET(trayicon), STOCK_PIXMAP_TRAY_UNREADMARKEDMAIL_OFFLINE, &unreadmarkedmail_pixmap[1], &unreadmarkedmail_bitmap[1]);
        stock_pixmap_gdk(GTK_WIDGET(trayicon), STOCK_PIXMAP_TRAY_NEWMARKEDMAIL_OFFLINE, &newmarkedmail_pixmap[1], &newmarkedmail_bitmap[1]);
 
+       if (image != NULL)
+               update(NULL);
+
+       return FALSE;
+}
+
+static void create_trayicon()
+{
+       gint n_entries = 0;
+
+       trayicon = egg_tray_icon_new("Claws Mail");
+       gtk_widget_realize(GTK_WIDGET(trayicon));
+       gtk_window_set_default_size(GTK_WINDOW(trayicon), 16, 16);
+       gtk_container_set_border_width(GTK_CONTAINER(trayicon), 0);
+
+       trayicon_update_theme(NULL, NULL);
 
        eventbox = gtk_event_box_new();
        gtk_container_set_border_width(GTK_CONTAINER(eventbox), 0);
@@ -442,6 +452,12 @@ int plugin_init(gchar **error)
                goto err_out_iconified;
        }
 
+       theme_hook_id = hooks_register_hook(THEME_CHANGED_HOOKLIST, trayicon_update_theme, NULL);
+       if (theme_hook_id == -1) {
+               *error = g_strdup(_("Failed to register theme change hook"));
+               goto err_out_theme;
+       }
+
        create_trayicon();
        trayicon_set_accounts_hook(NULL, NULL);
 
@@ -457,6 +473,8 @@ int plugin_init(gchar **error)
 
        return 0;
 
+err_out_theme:
+       hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, iconified_hook_id);
 err_out_iconified:
        hooks_unregister_hook(MAIN_WINDOW_CLOSE, close_hook_id);
 err_out_close:
@@ -481,6 +499,7 @@ gboolean plugin_done(void)
        hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, account_hook_id);
        hooks_unregister_hook(MAIN_WINDOW_CLOSE, close_hook_id);
        hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, iconified_hook_id);
+       hooks_unregister_hook(THEME_CHANGED_HOOKLIST, theme_hook_id);
 
        if (claws_is_exiting())
                return TRUE;