comparison plugins/docklet/docklet.c @ 9958:de25b23933fa

[gaim-migrate @ 10864] (21:02:12) Me: think you can find time and interest to get the docklet functional? (21:02:26) Me: if you think it unlikely tell me and i'll find someone else (21:04:01) Robot101: I already updated HEAD (21:22:57) Robot101: there we go, compiles committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 07 Sep 2004 01:40:50 +0000
parents f8e395a054e2
children 499a71d5d20f
comparison
equal deleted inserted replaced
9957:b229d6fade9d 9958:de25b23933fa
56 /* globals */ 56 /* globals */
57 57
58 GaimPlugin *handle = NULL; 58 GaimPlugin *handle = NULL;
59 static struct docklet_ui_ops *ui_ops = NULL; 59 static struct docklet_ui_ops *ui_ops = NULL;
60 static enum docklet_status status = offline; 60 static enum docklet_status status = offline;
61 #if 0 /* XXX CUI */
61 #ifdef _WIN32 62 #ifdef _WIN32
62 __declspec(dllimport) GSList *unread_message_queue; 63 __declspec(dllimport) GSList *unread_message_queue;
63 __declspec(dllimport) GSList *away_messages; 64 __declspec(dllimport) GSList *away_messages;
64 __declspec(dllimport) struct away_message *awaymessage; 65 __declspec(dllimport) struct away_message *awaymessage;
65 __declspec(dllimport) GSList *message_queue; 66 __declspec(dllimport) GSList *message_queue;
66 #endif 67 #endif
68 #endif
67 69
68 /* private functions */ 70 /* private functions */
69 71
70 static void 72 static void
71 docklet_toggle_mute(GtkWidget *toggle, void *data) 73 docklet_toggle_mute(GtkWidget *toggle, void *data)
84 { 86 {
85 gaim_accounts_auto_login(GAIM_GTK_UI); 87 gaim_accounts_auto_login(GAIM_GTK_UI);
86 } 88 }
87 89
88 #ifdef _WIN32 90 #ifdef _WIN32
91 #if 0 /* XXX NEW STATUS */
89 /* This is workaround for a bug in windows GTK+. Clicking outside of the 92 /* This is workaround for a bug in windows GTK+. Clicking outside of the
90 parent menu (including on a submenu-item) close the whole menu before 93 parent menu (including on a submenu-item) close the whole menu before
91 the "activate" event is thrown for the given submenu-item. Fixed by 94 the "activate" event is thrown for the given submenu-item. Fixed by
92 replacing "activate" by "button-release-event". */ 95 replacing "activate" by "button-release-event". */
93 static gboolean 96 static gboolean
101 docklet_menu_create_away_mess(GtkWidget *widget, GdkEventButton *event, gpointer user_data) 104 docklet_menu_create_away_mess(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
102 { 105 {
103 create_away_mess(widget, user_data); 106 create_away_mess(widget, user_data);
104 return FALSE; 107 return FALSE;
105 } 108 }
109 #endif
106 110
107 /* This is a workaround for a bug in windows GTK+. Clicking outside of the 111 /* This is a workaround for a bug in windows GTK+. Clicking outside of the
108 menu does not get rid of it, so instead we get rid of it as soon as the 112 menu does not get rid of it, so instead we get rid of it as soon as the
109 pointer leaves the menu. */ 113 pointer leaves the menu. */
110 static gboolean 114 static gboolean
144 case offline_connecting: 148 case offline_connecting:
145 break; 149 break;
146 case online: 150 case online:
147 case online_connecting: 151 case online_connecting:
148 case online_pending: { 152 case online_pending: {
153 #if 0 /* XXX NEW STATUS */
149 GtkWidget *docklet_awaymenu; 154 GtkWidget *docklet_awaymenu;
150 GSList *awy = NULL; 155 GSList *awy = NULL;
151 struct away_message *a = NULL; 156 struct away_message *a = NULL;
152 157
153 docklet_awaymenu = gtk_menu_new(); 158 docklet_awaymenu = gtk_menu_new();
179 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); 184 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry);
180 185
181 entry = gtk_menu_item_new_with_label(_("Away")); 186 entry = gtk_menu_item_new_with_label(_("Away"));
182 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu); 187 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu);
183 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); 188 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
189 #endif
184 } break; 190 } break;
185 case away: 191 case away:
186 case away_pending: 192 case away_pending:
193 #if 0 /* XXX NEW STATUS */
187 entry = gtk_menu_item_new_with_label(_("Back")); 194 entry = gtk_menu_item_new_with_label(_("Back"));
188 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_im_back), NULL); 195 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_im_back), NULL);
189 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); 196 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
197 #endif
190 break; 198 break;
191 } 199 }
192 200
193 gaim_separator(menu); 201 gaim_separator(menu);
194 202
259 enum docklet_status oldstatus; 267 enum docklet_status oldstatus;
260 268
261 oldstatus = status; 269 oldstatus = status;
262 270
263 if (gaim_connections_get_all()) { 271 if (gaim_connections_get_all()) {
272 #if 0 /* XXX NEW STATUS */
264 if (unread_message_queue) { 273 if (unread_message_queue) {
265 status = online_pending; 274 status = online_pending;
266 } else if (awaymessage) { 275 } else if (awaymessage) {
267 if (message_queue) { 276 if (message_queue) {
268 status = away_pending; 277 status = away_pending;
269 } else { 278 } else {
270 status = away; 279 status = away;
271 } 280 }
272 } else if (gaim_connections_get_connecting()) { 281 } else if (gaim_connections_get_connecting()) {
282 #else
283 if (gaim_connections_get_connecting()) {
284 #endif
273 status = online_connecting; 285 status = online_connecting;
274 } else { 286 } else {
275 status = online; 287 status = online;
276 } 288 }
277 } else { 289 } else {
294 } 306 }
295 307
296 return FALSE; /* for when we're called by the glib idle handler */ 308 return FALSE; /* for when we're called by the glib idle handler */
297 } 309 }
298 310
299 void 311 #if 0 /* XXX CUI */
312 static void
300 docklet_flush_queue() 313 docklet_flush_queue()
301 { 314 {
302 if (unread_message_queue) { 315 if (unread_message_queue) {
303 purge_away_queue(&unread_message_queue); 316 purge_away_queue(&unread_message_queue);
304 } 317 }
305 } 318 }
306 319 #endif
307 void 320
321 static void
308 docklet_remove_callbacks() 322 docklet_remove_callbacks()
309 { 323 {
310 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "removing callbacks"); 324 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "removing callbacks");
311 325
312 while (g_source_remove_by_user_data(&handle)) { 326 while (g_source_remove_by_user_data(&handle)) {
321 void 335 void
322 docklet_clicked(int button_type) 336 docklet_clicked(int button_type)
323 { 337 {
324 switch (button_type) { 338 switch (button_type) {
325 case 1: 339 case 1:
340 #if 0 /* XXX CUI */
326 if (unread_message_queue) { 341 if (unread_message_queue) {
327 docklet_flush_queue(); 342 docklet_flush_queue();
328 } else { 343 } else {
344 #endif
329 gaim_gtk_blist_docklet_toggle(); 345 gaim_gtk_blist_docklet_toggle();
346 #if 0 /* XXX CUI */
330 } 347 }
348 #endif
331 break; 349 break;
332 case 2: 350 case 2:
333 switch (status) { 351 switch (status) {
334 case offline: 352 case offline:
335 case offline_connecting: 353 case offline_connecting:
359 docklet_remove(gboolean visible) 377 docklet_remove(gboolean visible)
360 { 378 {
361 if (visible) 379 if (visible)
362 gaim_gtk_blist_docklet_remove(); 380 gaim_gtk_blist_docklet_remove();
363 381
382 #if 0 /* XXX CUI */
364 docklet_flush_queue(); 383 docklet_flush_queue();
384 #endif
365 } 385 }
366 386
367 void 387 void
368 docklet_set_ui_ops(struct docklet_ui_ops *ops) 388 docklet_set_ui_ops(struct docklet_ui_ops *ops)
369 { 389 {
426 446
427 /* We need this because the blist purge_away_queue cb won't be called before the 447 /* We need this because the blist purge_away_queue cb won't be called before the
428 plugin is unloaded, when quitting */ 448 plugin is unloaded, when quitting */
429 static void gaim_quit_cb() { 449 static void gaim_quit_cb() {
430 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "dealing with queued messages on exit\n"); 450 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "dealing with queued messages on exit\n");
451 #if 0 /* XXX CUI */
431 docklet_flush_queue(); 452 docklet_flush_queue();
453 #endif
432 } 454 }
433 455
434 456
435 /* static void gaim_buddy_signon(GaimConnection *gc, char *who, void *data) { 457 /* static void gaim_buddy_signon(GaimConnection *gc, char *who, void *data) {
436 } 458 }