From: Herman B. <her...@us...> - 2003-09-19 23:18:43
|
Update of /cvsroot/gaim/gaim/plugins/docklet In directory sc8-pr-cvs1:/tmp/cvs-serv8721/plugins/docklet Modified Files: docklet-win32.c docklet-x11.c docklet.c docklet.h Log Message: 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 Index: docklet-win32.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/docklet/docklet-win32.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- docklet-win32.c 11 Aug 2003 18:54:38 -0000 1.7 +++ docklet-win32.c 19 Sep 2003 23:18:40 -0000 1.8 @@ -55,6 +55,7 @@ static HICON sysicon_conn=0; 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_init_icon(HWND hWnd, 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_update_icon(enum } } +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 @@ static void wgaim_tray_create() { 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 @@ static struct docklet_ui_ops wgaim_tray_ { 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 */ Index: docklet-x11.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/docklet/docklet-x11.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- docklet-x11.c 5 Aug 2003 10:55:00 -0000 1.2 +++ docklet-x11.c 19 Sep 2003 23:18:40 -0000 1.3 @@ -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 @@ docklet_x11_update_icon(enum docklet_sta } 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 @@ docklet_x11_destroy() 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 @@ static struct docklet_ui_ops ui_ops = { docklet_x11_create, docklet_x11_destroy, - docklet_x11_update_icon + docklet_x11_update_icon, + docklet_x11_blank_icon }; void Index: docklet.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/docklet/docklet.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -p -r1.53 -r1.54 --- docklet.c 18 Aug 2003 01:03:42 -0000 1.53 +++ docklet.c 19 Sep 2003 23:18:40 -0000 1.54 @@ -84,7 +84,7 @@ docklet_auto_login() } #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 @@ static gboolean 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 @@ docklet_update_status() /* 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 @@ docklet_embedded() 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 @@ plugin_load(GaimPlugin *plugin) 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 @@ plugin_load(GaimPlugin *plugin) 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 */ Index: docklet.h =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/docklet/docklet.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- docklet.h 18 Jul 2003 03:45:39 -0000 1.2 +++ docklet.h 19 Sep 2003 23:18:40 -0000 1.3 @@ -41,6 +41,7 @@ struct docklet_ui_ops void (*create)(); void (*destroy)(); void (*update_icon)(enum docklet_status); + void (*blank_icon)(); }; /* useful for setting idle callbacks that will be cleaned up */ |