# HG changeset patch # User Herman Bloggs # Date 1064013520 0 # Node ID c2fb9192377b55d7255f8c5cf7603f312b438bcb # Parent 126e123bf065d4ea65411b2f997c5512ac9089de [gaim-migrate @ 7441] robot101: instead of blinking between the one with the envelope, and the one without, it's going to blink between blank and the one with the envelope committer: Tailor Script diff -r 126e123bf065 -r c2fb9192377b pixmaps/gaim_blank_4bit_16.ico Binary file pixmaps/gaim_blank_4bit_16.ico has changed diff -r 126e123bf065 -r c2fb9192377b plugins/docklet/docklet-win32.c --- a/plugins/docklet/docklet-win32.c Fri Sep 19 15:54:45 2003 +0000 +++ b/plugins/docklet/docklet-win32.c Fri Sep 19 23:18:40 2003 +0000 @@ -55,6 +55,7 @@ static HICON sysicon_away=0; static HICON sysicon_pend=0; static HICON sysicon_awypend=0; +static HICON sysicon_blank=0; static NOTIFYICONDATA wgaim_nid; @@ -151,9 +152,11 @@ static void systray_change_icon(HICON icon, char* text) { char *locenc=NULL; wgaim_nid.hIcon = icon; - locenc = g_locale_from_utf8(text, -1, NULL, NULL, NULL); - lstrcpy(wgaim_nid.szTip, locenc); - g_free(locenc); + if(text) { + locenc = g_locale_from_utf8(text, -1, NULL, NULL, NULL); + lstrcpy(wgaim_nid.szTip, locenc); + g_free(locenc); + } Shell_NotifyIcon(NIM_MODIFY,&wgaim_nid); } @@ -184,6 +187,10 @@ } } +static void wgaim_tray_blank_icon() { + systray_change_icon(sysicon_blank, NULL); +} + static void wgaim_tray_create() { /* dummy window to process systray messages */ systray_hwnd = systray_create_hiddenwin(); @@ -194,6 +201,7 @@ sysicon_away = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_pend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_PEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_awypend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAYPEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_blank = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_BLANK_TRAY_ICON), IMAGE_ICON, 16, 16, 0); /* Create icon in systray */ systray_init_icon(systray_hwnd, sysicon_disconn); @@ -210,7 +218,8 @@ { wgaim_tray_create, wgaim_tray_destroy, - wgaim_tray_update_icon + wgaim_tray_update_icon, + wgaim_tray_blank_icon }; /* Used by docklet's plugin load func */ diff -r 126e123bf065 -r c2fb9192377b plugins/docklet/docklet-x11.c --- a/plugins/docklet/docklet-x11.c Fri Sep 19 15:54:45 2003 +0000 +++ b/plugins/docklet/docklet-x11.c Fri Sep 19 23:18:40 2003 +0000 @@ -36,6 +36,7 @@ /* globals */ static EggTrayIcon *docklet = NULL; static GtkWidget *image = NULL; +static GdkPixbuf *blank_icon = NULL; /* protos */ static void docklet_x11_create(); @@ -109,6 +110,20 @@ } static void +docklet_x11_blank_icon() +{ + if (!blank_icon) { + gint width, height; + + gtk_icon_size_lookup(GTK_ICON_SIZE_LARGE_TOOLBAR, &width, &height); + blank_icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); + gdk_pixbuf_fill(blank_icon, 0); + } + + gtk_image_set_from_pixbuf(GTK_IMAGE(image), blank_icon); +} + +static void docklet_x11_destroy() { docklet_remove(GTK_WIDGET_VISIBLE(docklet)); @@ -119,6 +134,10 @@ g_object_unref(G_OBJECT(docklet)); docklet = NULL; + if (blank_icon) + g_object_unref(G_OBJECT(blank_icon)); + blank_icon = NULL; + gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n"); } @@ -157,7 +176,8 @@ { docklet_x11_create, docklet_x11_destroy, - docklet_x11_update_icon + docklet_x11_update_icon, + docklet_x11_blank_icon }; void diff -r 126e123bf065 -r c2fb9192377b plugins/docklet/docklet.c --- a/plugins/docklet/docklet.c Fri Sep 19 15:54:45 2003 +0000 +++ b/plugins/docklet/docklet.c Fri Sep 19 23:18:40 2003 +0000 @@ -84,7 +84,7 @@ } #ifdef _WIN32 -/* This is a workaround for a bug in windows GTK+.. Clicking outside of the +/* This is a workaround for a bug in windows GTK+. Clicking outside of the menu does not get rid of it, so instead we get rid of it as soon as the pointer leaves the menu. */ static gboolean @@ -197,36 +197,30 @@ docklet_blink_icon() { static gboolean blinked = FALSE; - enum docklet_status icon = status; blinked = !blinked; - if (status == online_pending) { - if (blinked) { - /* last icon was the right one... let's change it */ - icon = online; - } else { - /* last icon was the wrong one, change it back */ - icon = online_pending; - } - } else if (status == away_pending) { - if (blinked) { - /* last icon was the right one... let's change it */ - icon = away; - } else { - /* last icon was the wrong one, change it back */ - icon = away_pending; - } - } else { - /* no messages, stop blinking */ - blinked = FALSE; - return FALSE; + switch (status) { + case online_pending: + case away_pending: + if (blinked) { + if (ui_ops && ui_ops->blank_icon) + ui_ops->blank_icon(); + } else { + if (ui_ops && ui_ops->update_icon) + ui_ops->update_icon(status); + } + return TRUE; /* keep blinking */ + break; + case offline: + case offline_connecting: + case online: + case online_connecting: + case away: + blinked = FALSE; + return FALSE; /* no more blinking */ + break; } - - if (ui_ops->update_icon) - ui_ops->update_icon(icon); - - return TRUE; /* keep blinking */ } static gboolean @@ -260,7 +254,7 @@ /* update the icon if we changed status */ if (status != oldstatus) { - if (ui_ops->update_icon) + if (ui_ops && ui_ops->update_icon) ui_ops->update_icon(status); /* and schedule the blinker function if messages are pending */ @@ -327,7 +321,7 @@ gaim_gtk_blist_docklet_add(); docklet_update_status(); - if (ui_ops->update_icon) + if (ui_ops && ui_ops->update_icon) ui_ops->update_icon(status); } @@ -428,7 +422,7 @@ handle = plugin; docklet_ui_init(); - if (ui_ops->create) + if (ui_ops && ui_ops->create) ui_ops->create(); gaim_signal_connect(conn_handle, "signed-on", @@ -455,7 +449,7 @@ static gboolean plugin_unload(GaimPlugin *plugin) { - if (ui_ops->destroy) + if (ui_ops && ui_ops->destroy) ui_ops->destroy(); /* XXX: do this while gaim has no other way to toggle the global mute */ diff -r 126e123bf065 -r c2fb9192377b plugins/docklet/docklet.h --- a/plugins/docklet/docklet.h Fri Sep 19 15:54:45 2003 +0000 +++ b/plugins/docklet/docklet.h Fri Sep 19 23:18:40 2003 +0000 @@ -41,6 +41,7 @@ void (*create)(); void (*destroy)(); void (*update_icon)(enum docklet_status); + void (*blank_icon)(); }; /* useful for setting idle callbacks that will be cleaned up */ diff -r 126e123bf065 -r c2fb9192377b src/win32/gaimrc.rc --- a/src/win32/gaimrc.rc Fri Sep 19 15:54:45 2003 +0000 +++ b/src/win32/gaimrc.rc Fri Sep 19 23:18:40 2003 +0000 @@ -6,3 +6,4 @@ GAIM_AWAY_TRAY_ICON ICON "../pixmaps/gaim_away_4bit_16.ico" GAIM_PEND_TRAY_ICON ICON "../pixmaps/gaim_msgunread_4bit_16.ico" GAIM_AWAYPEND_TRAY_ICON ICON "../pixmaps/gaim_msgpend_4bit_16.ico" +GAIM_BLANK_TRAY_ICON ICON "../pixmaps/gaim_blank_4bit_16.ico" diff -r 126e123bf065 -r c2fb9192377b src/win32/resource.h --- a/src/win32/resource.h Fri Sep 19 15:54:45 2003 +0000 +++ b/src/win32/resource.h Fri Sep 19 23:18:40 2003 +0000 @@ -6,3 +6,4 @@ #define GAIM_AWAY_TRAY_ICON 109 #define GAIM_PEND_TRAY_ICON 110 #define GAIM_AWAYPEND_TRAY_ICON 111 +#define GAIM_BLANK_TRAY_ICON 112