annotate plugins/docklet/docklet.c @ 4418:3270d3536e12

[gaim-migrate @ 4691] paco-paco got gaim to compile on solaris :-) (23:18:49) Paco-Paco: Fixes getopt handling and libsocket detection on Solaris committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 26 Jan 2003 04:18:46 +0000
parents 906f61f27479
children 3196d9044a45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
1 /* System tray icon (aka docklet) plugin for Gaim
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * Copyright (C) 2002 Robert McQueen <robot101@debian.org>
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * Inspired by a similar plugin by:
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * John (J5) Palmieri <johnp@martianrock.com>
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * General Public License for more details.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * 02111-1307, USA.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 /* todo (in order of importance):
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
23 - check removing the icon factory actually frees the icons
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
24 - unify the queue so we can have a global away without the dialog
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
25 - handle and update tooltips to show your current accounts/queued messages?
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
26 - show a count of queued messages in the unified queue
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 - dernyi's account status menu in the right click
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
28 - optional pop up notices when GNOME2's system-tray-applet supports it */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 /* includes */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <gtk/gtk.h>
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "gaim.h"
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "eggtrayicon.h"
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3773
diff changeset
35 #ifndef GAIM_PLUGINS
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3773
diff changeset
36 #define GAIM_PLUGINS
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3773
diff changeset
37 #endif
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3773
diff changeset
38
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 /* types */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 enum docklet_status {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
41 offline,
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
42 offline_connecting,
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 online,
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
44 online_connecting,
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
45 online_pending,
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 away,
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
47 away_pending
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 };
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 /* functions */
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
51 static gboolean docklet_create();
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
52 static gboolean docklet_update_status();
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
53 void gaim_plugin_remove();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 /* globals */
3513
ab939e746bdd [gaim-migrate @ 3585]
Luke Schierer <lschiere@pidgin.im>
parents: 3512
diff changeset
56 static EggTrayIcon *docklet = NULL;
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
57 static GtkWidget *image = NULL;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
58 static GtkIconFactory *icon_factory = NULL;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 static enum docklet_status status;
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
60 static enum docklet_status icon;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
62 static void docklet_toggle_mute(GtkWidget *toggle, void *data) {
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
63 mute_sounds = GTK_CHECK_MENU_ITEM(toggle)->active;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
66 static void docklet_toggle_queue(GtkWidget *widget, void *data) {
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
67 away_options ^= OPT_AWAY_QUEUE_UNREAD;
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
68 save_prefs();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
70
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
71 /* static void docklet_toggle_blist_show(GtkWidget *widget, void *data) {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
72 blist_options ^= OPT_BLIST_APP_BUDDY_SHOW;
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
73 save_prefs();
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
74 } */
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
75
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
76 static void docklet_flush_queue() {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
77 if (unread_message_queue) {
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
78 purge_away_queue(&unread_message_queue);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
79 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 static void docklet_menu(GdkEventButton *event) {
3513
ab939e746bdd [gaim-migrate @ 3585]
Luke Schierer <lschiere@pidgin.im>
parents: 3512
diff changeset
83 static GtkWidget *menu = NULL;
3512
1ea341091de8 [gaim-migrate @ 3584]
Luke Schierer <lschiere@pidgin.im>
parents: 3510
diff changeset
84 GtkWidget *entry;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 if (menu) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 gtk_widget_destroy(menu);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 menu = gtk_menu_new();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
92 switch (status) {
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
93 case offline:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
94 case offline_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
95 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
96 case online:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
97 case online_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
98 case online_pending: {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 GtkWidget *docklet_awaymenu;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 GSList *awy = NULL;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 struct away_message *a = NULL;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 docklet_awaymenu = gtk_menu_new();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 awy = away_messages;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 while (awy) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 a = (struct away_message *)awy->data;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 entry = gtk_menu_item_new_with_label(a->name);
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
110 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 gtk_menu_append(GTK_MENU(docklet_awaymenu), entry);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 awy = g_slist_next(awy);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
116 if (away_messages)
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
117 gaim_separator(docklet_awaymenu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 entry = gtk_menu_item_new_with_label(_("New..."));
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
120 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 gtk_menu_append(GTK_MENU(docklet_awaymenu), entry);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 entry = gtk_menu_item_new_with_label(_("Away"));
3512
1ea341091de8 [gaim-migrate @ 3584]
Luke Schierer <lschiere@pidgin.im>
parents: 3510
diff changeset
124 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 gtk_menu_append(GTK_MENU(menu), entry);
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
126 } break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
127 case away:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
128 case away_pending:
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 entry = gtk_menu_item_new_with_label(_("Back"));
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
130 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_im_back), NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 gtk_menu_append(GTK_MENU(menu), entry);
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
132 break;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
135 switch (status) {
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
136 case offline:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
137 case offline_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
138 entry = gtk_menu_item_new_with_label(_("Auto-login"));
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
139 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(auto_login), NULL);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
140 gtk_menu_append(GTK_MENU(menu), entry);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
141 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
142 default:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
143 entry = gtk_menu_item_new_with_label(_("Signoff"));
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
144 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(signoff_all), NULL);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
145 gtk_menu_append(GTK_MENU(menu), entry);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
146 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
147 }
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
148
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
149 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
151 entry = gtk_check_menu_item_new_with_label(_("Mute Sounds"));
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
152 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry), mute_sounds);
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
153 g_signal_connect(G_OBJECT(entry), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
154 gtk_menu_append(GTK_MENU(menu), entry);
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
155
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
156 gaim_new_item_from_pixbuf(menu, _("Accounts..."), "accounts-menu.png", G_CALLBACK(account_editor), NULL, 0, 0, 0);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
157 gaim_new_item_from_stock(menu, _("Preferences..."), GTK_STOCK_PREFERENCES, G_CALLBACK(show_prefs), NULL, 0, 0, 0);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
159 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
161 gaim_new_item_from_pixbuf(menu, _("About Gaim..."), "about_menu.png", G_CALLBACK(show_about), NULL, 0, 0, 0);
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
162 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(do_quit), NULL, 0, 0, 0);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 gtk_widget_show_all(menu);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 static void docklet_clicked(GtkWidget *button, GdkEventButton *event, void *data) {
3939
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3867
diff changeset
169 if (event->type != GDK_BUTTON_PRESS)
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3867
diff changeset
170 return;
49d42b275a68 [gaim-migrate @ 4115]
Luke Schierer <lschiere@pidgin.im>
parents: 3867
diff changeset
171
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 switch (event->button) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 case 1:
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
174 if (unread_message_queue) {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
175 docklet_flush_queue();
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
176 docklet_update_status();
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
177 } else {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
178 docklet_toggle();
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
179 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 break;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 case 2:
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 break;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 case 3:
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 docklet_menu(event);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 break;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
189 static void docklet_update_icon() {
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
190 const gchar *icon_name = NULL;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
192 switch (icon) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
193 case offline:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
194 icon_name = "gaim-docklet-offline";
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
195 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
196 case offline_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
197 case online_connecting:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
198 icon_name = "gaim-docklet-connect";
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
199 break;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 case online:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
201 icon_name = "gaim-docklet-online";
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 break;
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
203 case online_pending:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
204 icon_name = "gaim-docklet-msgunread";
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
205 break;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 case away:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
207 icon_name = "gaim-docklet-away";
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 break;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 case away_pending:
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
210 icon_name = "gaim-docklet-msgpend";
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 break;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
214 gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
215
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
216 debug_printf("Tray Icon: updated icon to '%s'\n", icon_name);
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
217 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
219 static gboolean docklet_blink_icon() {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
220 if (status == online_pending) {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
221 if (status == icon) {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
222 /* last icon was the right one... let's change it */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
223 icon = online;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
224 } else {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
225 /* last icon was the wrong one, change it back */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
226 icon = online_pending;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
227 }
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
228 } else if (status == away_pending) {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
229 if (status == icon) {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
230 /* last icon was the right one... let's change it */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
231 icon = away;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
232 } else {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
233 /* last icon was the wrong one, change it back */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
234 icon = away_pending;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
235 }
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
236 } else {
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
237 /* no messages, stop blinking */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
238 return FALSE;
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
239 }
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
240
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
241 docklet_update_icon();
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
242
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
243 return TRUE; /* keep blinking */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
246 static gboolean docklet_update_status() {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 enum docklet_status oldstatus;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 oldstatus = status;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 if (connections) {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
252 if (unread_message_queue) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
253 status = online_pending;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
254 } else if (awaymessage) {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 if (message_queue) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 status = away_pending;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 } else {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 status = away;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 }
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
260 } else if (connecting_count) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
261 status = online_connecting;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 } else {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 status = online;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 } else {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
266 if (connecting_count) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
267 status = offline_connecting;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
268 } else {
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
269 status = offline;
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
270 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
273 /* update the icon if we changed status */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 if (status != oldstatus) {
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
275 icon = status;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 docklet_update_icon();
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
277
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
278 /* and schedule the blinker function if messages are pending */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
279 if (status == online_pending || status == away_pending) {
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
280 g_timeout_add(500, docklet_blink_icon, &docklet);
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
281 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 }
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
283
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
284 return FALSE; /* for when we're called by the glib idle handler */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
287 static void docklet_embedded(GtkWidget *widget, void *data) {
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
288 debug_printf("Tray Icon: embedded\n");
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
289 docklet_add();
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
290 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
291
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
292 static void docklet_remove_callbacks() {
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
293 debug_printf("Tray Icon: removing callbacks");
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
294
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
295 while (g_source_remove_by_user_data(&docklet)) {
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
296 debug_printf(".");
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
297 }
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
298
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
299 debug_printf("\n");
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
300 }
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
301
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
302 static void docklet_destroyed(GtkWidget *widget, void *data) {
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
303 debug_printf("Tray Icon: destroyed\n");
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
304
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
305 docklet_remove();
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
306
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
307 docklet_flush_queue();
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
308
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
309 docklet_remove_callbacks();
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
310
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
311 g_object_unref(G_OBJECT(docklet));
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
312 docklet = NULL;
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
313
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
314 g_idle_add(docklet_create, &docklet);
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
315 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
316
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
317 static gboolean docklet_create() {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 GtkWidget *box;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
320 if (docklet) {
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
321 /* if this is being called when a tray icon exists, it's because
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
322 something messed up. try destroying it before we proceed,
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
323 although docklet_refcount may be all hosed. hopefully won't happen. */
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
324 debug_printf("Tray Icon: trying to create icon but it already exists?\n");
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
325 gaim_plugin_remove();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 docklet = egg_tray_icon_new("Gaim");
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 box = gtk_event_box_new();
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
330 image = gtk_image_new();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
332 g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(docklet_embedded), NULL);
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
333 g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_destroyed), NULL);
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
334 g_signal_connect(G_OBJECT(box), "button-press-event", G_CALLBACK(docklet_clicked), NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
336 gtk_container_add(GTK_CONTAINER(box), image);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 gtk_container_add(GTK_CONTAINER(docklet), box);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 gtk_widget_show_all(GTK_WIDGET(docklet));
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
340 /* ref the docklet before we bandy it about the place */
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
341 g_object_ref(G_OBJECT(docklet));
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 docklet_update_status();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 docklet_update_icon();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
345 debug_printf("Tray Icon: created\n");
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
346
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
347 return FALSE; /* for when we're called by the glib idle handler */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 static void gaim_signon(struct gaim_connection *gc, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 docklet_update_status();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 static void gaim_signoff(struct gaim_connection *gc, void *data) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
355 /* do this when idle so that if the prpl was connecting
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
356 and was cancelled, we register that connecting_count
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
357 has returned to 0 */
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
358 g_idle_add(docklet_update_status, &docklet);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 static void gaim_connecting(struct aim_user *user, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 docklet_update_status();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 static void gaim_away(struct gaim_connection *gc, char *state, char *message, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 /* we only support global away. this is the way it is, ok? */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 docklet_update_status();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
370 static void gaim_im_recv(struct gaim_connection *gc, char **who, char **what, void *data) {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 /* if message queuing while away is enabled, this event could be the first
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
372 message so we need to see if the status (and hence icon) needs changing.
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
373 do this when idle so that all message processing is completed, queuing
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
374 etc, before we run. */
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
375 g_idle_add(docklet_update_status, &docklet);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
378 /* static void gaim_buddy_signon(struct gaim_connection *gc, char *who, void *data) {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 static void gaim_buddy_signoff(struct gaim_connection *gc, char *who, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 static void gaim_buddy_away(struct gaim_connection *gc, char *who, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 static void gaim_buddy_back(struct gaim_connection *gc, char *who, void *data) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 static void gaim_new_conversation(char *who, void *data) {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
391 } */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
393 static void docklet_register_icon(const char *name, char *fn) {
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
394 gchar *filename;
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
395
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
396 filename = g_build_filename(DATADIR, "pixmaps", "gaim", fn, NULL);
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
397 gtk_icon_factory_add(icon_factory, name,
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
398 gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file(filename, NULL)));
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
399 g_free(filename);
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
400 }
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
401
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
402 static void docklet_register_icon_factory() {
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
403 icon_factory = gtk_icon_factory_new();
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
404
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
405 docklet_register_icon("gaim-docklet-offline", "offline.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
406 docklet_register_icon("gaim-docklet-connect", "connect.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
407 docklet_register_icon("gaim-docklet-online", "online.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
408 docklet_register_icon("gaim-docklet-msgunread", "msgunread.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
409 docklet_register_icon("gaim-docklet-away", "away.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
410 docklet_register_icon("gaim-docklet-msgpend", "msgpend.png");
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
411
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
412 gtk_icon_factory_add_default(icon_factory);
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
413 }
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
414
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
415 static void docklet_unregister_icon_factory() {
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
416 gtk_icon_factory_remove_default(icon_factory);
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
417 }
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
418
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 char *gaim_plugin_init(GModule *handle) {
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
420 docklet_register_icon_factory();
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
421
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
422 docklet_create(NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 gaim_signal_connect(handle, event_signon, gaim_signon, NULL);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 gaim_signal_connect(handle, event_signoff, gaim_signoff, NULL);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 gaim_signal_connect(handle, event_connecting, gaim_connecting, NULL);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 gaim_signal_connect(handle, event_away, gaim_away, NULL);
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
428 gaim_signal_connect(handle, event_im_recv, gaim_im_recv, NULL);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
429 /* gaim_signal_connect(handle, event_buddy_signon, gaim_buddy_signon, NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 gaim_signal_connect(handle, event_buddy_signoff, gaim_buddy_signoff, NULL);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 gaim_signal_connect(handle, event_buddy_away, gaim_buddy_away, NULL);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 gaim_signal_connect(handle, event_buddy_back, gaim_buddy_back, NULL);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
433 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL); */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 return NULL;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
438 void gaim_plugin_remove() {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
439 if (GTK_WIDGET_VISIBLE(docklet)) {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
440 docklet_remove();
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
441 }
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
442
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
443 docklet_flush_queue();
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
444
4274
906f61f27479 [gaim-migrate @ 4525]
Luke Schierer <lschiere@pidgin.im>
parents: 4261
diff changeset
445 docklet_remove_callbacks();
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
446
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
447 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_destroyed), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
448 gtk_widget_destroy(GTK_WIDGET(docklet));
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
449
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
450 g_object_unref(G_OBJECT(docklet));
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
451 docklet = NULL;
4250
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
452
3b884e35e6b5 [gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents: 4157
diff changeset
453 docklet_unregister_icon_factory();
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
454
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
455 debug_printf("Tray Icon: removed\n");
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
456 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
457
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
458 GtkWidget *gaim_plugin_config_gtk() {
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
459 GtkWidget *frame;
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
460 GtkWidget *vbox, *hbox;
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
461 GtkWidget *toggle;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
462
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
463 frame = gtk_vbox_new(FALSE, 18);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
464 gtk_container_set_border_width(GTK_CONTAINER(frame), 12);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
465
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
466 vbox = make_frame(frame, _("Tray Icon Configuration"));
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
467 hbox = gtk_hbox_new(FALSE, 18);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
468 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
469
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
470 /* toggle = gtk_check_button_new_with_mnemonic(_("_Automatically show buddy list on sign on"));
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
471 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), blist_options & OPT_BLIST_APP_BUDDY_SHOW);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
472 g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_blist_show), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
473 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); */
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
474
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
475 toggle = gtk_check_button_new_with_mnemonic(_("_Hide new messages until tray icon is clicked"));
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
476 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), away_options & OPT_AWAY_QUEUE_UNREAD);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
477 g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_queue), NULL);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
478 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
479
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
480 gtk_widget_show_all(frame);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
481 return frame;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
482 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
483
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
484 struct gaim_plugin_description desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
485 struct gaim_plugin_description *gaim_plugin_desc() {
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
486 desc.api_version = PLUGIN_API_VERSION;
3773
3e47ffcbf805 [gaim-migrate @ 3912]
Sean Egan <seanegan@gmail.com>
parents: 3570
diff changeset
487 desc.name = g_strdup(_("Tray Icon"));
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
488 desc.version = g_strdup(VERSION);
4108
274cb26ba8dc [gaim-migrate @ 4323]
Luke Schierer <lschiere@pidgin.im>
parents: 4093
diff changeset
489 desc.description = g_strdup(_("Interacts with a System Tray applet (in GNOME or KDE, for example) to display the current status of Gaim, allow fast access to commonly used functions, and to toggle display of the buddy list or login window. Also allows messages to be queued until the icon is clicked, similar to ICQ (although the icon doesn't flash yet =)."));
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
490 desc.authors = g_strdup(_("Robert McQueen &lt;robot101@debian.org>"));
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
491 desc.url = g_strdup(WEBSITE);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
492 return &desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
493 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
495 char *name() {
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
496 return _("System Tray Icon");
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
499 char *description() {
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
500 return _("Interacts with a System Tray applet (in GNOME or KDE, for example) to display the current status of Gaim, allow fast access to commonly used functions, and to toggle display of the buddy list or login window. Also allows messages to be queued until the icon is clicked, similar to ICQ (although the icon doesn't flash yet =).");
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 }