comparison src/buddy.c @ 3517:6b0cb60162f4

[gaim-migrate @ 3590] Rob McQueen added a mute feature to his nice little docklet. I added a queuing feature. Configure the docklet in the plugins dialog to queue unread messages, and when you receive a message the docklet will eat it up and show a little message pending icon. Click on it, and read your message. ICQ people will like it. I also made plugin_event use a va_list. I bet this breaks perl. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 16 Sep 2002 08:35:24 +0000
parents e23909729192
children c078fba4d7e3
comparison
equal deleted inserted replaced
3516:db00eb77997d 3517:6b0cb60162f4
108 GSList *members; 108 GSList *members;
109 char *name; 109 char *name;
110 }; 110 };
111 static GSList *shows = NULL; 111 static GSList *shows = NULL;
112 112
113 static gboolean blist_hidden; 113 static int docklet_count = 0;
114 static int docklet_refcount = 0;
115 114
116 /* Predefine some functions */ 115 /* Predefine some functions */
117 static void new_bp_callback(GtkWidget *w, struct buddy *bs); 116 static void new_bp_callback(GtkWidget *w, struct buddy *bs);
118 static struct group_show *find_group_show(char *group); 117 static struct group_show *find_group_show(char *group);
119 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name); 118 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name);
701 } 700 }
702 } 701 }
703 } 702 }
704 703
705 /* we send the menu widget so we can add menuitems within a plugin */ 704 /* we send the menu widget so we can add menuitems within a plugin */
706 plugin_event(event_draw_menu, menu, b->name, 0, 0); 705 plugin_event(event_draw_menu, menu, b->name);
707 706
708 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); 707 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
709 708
710 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { 709 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) {
711 if (!g_strcasecmp("zilding", normalize (b->name))) 710 if (!g_strcasecmp("zilding", normalize (b->name)))
1398 } 1397 }
1399 1398
1400 void do_quit() 1399 void do_quit()
1401 { 1400 {
1402 /* first we tell those who have requested it we're quitting */ 1401 /* first we tell those who have requested it we're quitting */
1403 plugin_event(event_quit, 0, 0, 0, 0); 1402 plugin_event(event_quit);
1404 1403
1405 signoff_all(); 1404 signoff_all();
1406 #ifdef GAIM_PLUGINS 1405 #ifdef GAIM_PLUGINS
1407 /* then we remove everyone in a mass suicide */ 1406 /* then we remove everyone in a mass suicide */
1408 remove_all_plugins(); 1407 remove_all_plugins();
1991 } 1990 }
1992 1991
1993 return g; 1992 return g;
1994 } 1993 }
1995 1994
1995
1996 void docklet_toggle() {
1997 /* Useful for the docklet plugin and also for the win32 tray icon*/
1998 /* This is called when one of those is clicked--it will show/hide the
1999 buddy list/login window--depending on which is active */
2000 if (connections) {
2001 if (GTK_WIDGET_VISIBLE(blist)) {
2002 if (DOCKLET_WINDOW_ICONIFIED(blist)) {
2003 unhide_buddy_list();
2004 } else {
2005 hide_buddy_list();
2006 }
2007 } else {
2008 unhide_buddy_list();
2009 }
2010 } else {
2011 if (GTK_WIDGET_VISIBLE(mainwindow)) {
2012 if (DOCKLET_WINDOW_ICONIFIED(mainwindow)) {
2013 gtk_window_present(GTK_WINDOW(mainwindow));
2014 } else {
2015 gtk_widget_hide(mainwindow);
2016 }
2017 } else {
2018 gtk_window_present(GTK_WINDOW(mainwindow));
2019 }
2020 }
2021 }
2022
2023
1996 /* used by this file, and by iconaway.so */ 2024 /* used by this file, and by iconaway.so */
1997 void hide_buddy_list() { 2025 void hide_buddy_list() {
1998 if (blist) { 2026 if (blist) {
1999 if (!connections || docklet_refcount) { 2027 if (!connections || docklet_count) {
2000 gtk_widget_hide(blist); 2028 gtk_widget_hide(blist);
2001 } else { 2029 } else {
2002 gtk_window_iconify(GTK_WINDOW(blist)); 2030 gtk_window_iconify(GTK_WINDOW(blist));
2003 } 2031 }
2004 } 2032 }
2018 } 2046 }
2019 } 2047 }
2020 2048
2021 /* for the delete_event handler */ 2049 /* for the delete_event handler */
2022 static void close_buddy_list() { 2050 static void close_buddy_list() {
2023 if (docklet_refcount) { 2051 if (docklet_count) {
2024 hide_buddy_list(); 2052 hide_buddy_list();
2025 } else { 2053 } else {
2026 do_quit(); 2054 do_quit();
2027 } 2055 }
2028 } 2056 }
2029 2057
2030 void docklet_add() { 2058 void docklet_add() {
2031 docklet_refcount++; 2059 docklet_count++;
2032 printf("docklet_refcount: %d\n",docklet_refcount); 2060 printf("docklet_count: %d\n",docklet_count);
2033 } 2061 }
2034 2062
2035 void docklet_remove() { 2063 void docklet_remove() {
2036 if (docklet_refcount) { 2064 if (docklet_count) {
2037 docklet_refcount--; 2065 docklet_count--;
2038 } 2066 }
2039 printf("docklet_refcount: %d\n",docklet_refcount); 2067 printf("docklet_count: %d\n",docklet_count);
2040 if (!docklet_refcount) { 2068 if (!docklet_count) {
2041 if (connections) { 2069 if (connections) {
2042 unhide_buddy_list(); 2070 unhide_buddy_list();
2043 } else { 2071 } else {
2044 gtk_window_present(GTK_WINDOW(mainwindow)); 2072 gtk_window_present(GTK_WINDOW(mainwindow));
2045 } 2073 }