annotate plugins/docklet/docklet-x11.c @ 12540:b0ba132271a9

[gaim-migrate @ 14853] this doesn't make it work, but it does make it more correct committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 17 Dec 2005 21:01:40 +0000
parents dd2b171a624c
children 039cc76492b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /*
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
2 * System tray icon (aka docklet) plugin for Gaim
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
3 *
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
6 * Inspired by a similar plugin by:
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
7 * John (J5) Palmieri <johnp@martianrock.com>
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
8 *
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
11 * published by the Free Software Foundation; either version 2 of the
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
13 *
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
17 * General Public License for more details.
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
18 *
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 * 02111-1307, USA.
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 */
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25 #include "internal.h"
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
26 #include "gtkgaim.h"
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 #include "debug.h"
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10268
diff changeset
28 #include "gtkstock.h"
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 #include "gaim.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9229
diff changeset
31 #include "gtkdialogs.h"
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33 #include "eggtrayicon.h"
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34 #include "docklet.h"
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
36 #define EMBED_TIMEOUT 3000
10491
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
37
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38 /* globals */
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 static EggTrayIcon *docklet = NULL;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 static GtkWidget *image = NULL;
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
41 static GtkTooltips *tooltips = NULL;
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
42 static GdkPixbuf *blank_icon = NULL;
10491
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
43 static int embed_timeout = 0;
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 /* protos */
12397
8d1cf3f847b1 [gaim-migrate @ 14704]
Richard Laager <rlaager@wiktel.com>
parents: 12026
diff changeset
46 static void docklet_x11_create(void);
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 static gboolean
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 docklet_x11_create_cb()
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51 docklet_x11_create();
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 return FALSE; /* for when we're called by the glib idle handler */
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 static void
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57 docklet_x11_embedded_cb(GtkWidget *widget, void *data)
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "embedded\n");
10491
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
60
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
61 g_source_remove(embed_timeout);
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
62 embed_timeout = 0;
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
63 docklet_embedded();
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 static void
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67 docklet_x11_destroyed_cb(GtkWidget *widget, void *data)
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n");
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
71 docklet_remove();
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 g_object_unref(G_OBJECT(docklet));
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 docklet = NULL;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
76 g_idle_add(docklet_x11_create_cb, &handle);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
78
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79 static void
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 docklet_x11_clicked_cb(GtkWidget *button, GdkEventButton *event, void *data)
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 if (event->type != GDK_BUTTON_PRESS)
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 return;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 docklet_clicked(event->button);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 static void
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
89 docklet_x11_update_icon(DockletStatus icon)
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
90 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
91 const gchar *icon_name = NULL;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
93 g_return_if_fail(image != NULL);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
94
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95 switch (icon) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
96 case DOCKLET_STATUS_OFFLINE:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97 icon_name = GAIM_STOCK_ICON_OFFLINE;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 break;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
99 case DOCKLET_STATUS_CONNECTING:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
100 icon_name = GAIM_STOCK_ICON_CONNECT;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101 break;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
102 case DOCKLET_STATUS_ONLINE:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103 icon_name = GAIM_STOCK_ICON_ONLINE;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104 break;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
105 case DOCKLET_STATUS_ONLINE_PENDING:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
106 icon_name = GAIM_STOCK_ICON_ONLINE_MSG;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
107 break;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
108 case DOCKLET_STATUS_AWAY:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
109 icon_name = GAIM_STOCK_ICON_AWAY;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110 break;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11631
diff changeset
111 case DOCKLET_STATUS_AWAY_PENDING:
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
112 icon_name = GAIM_STOCK_ICON_AWAY_MSG;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113 break;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
114 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
115
12525
dd2b171a624c [gaim-migrate @ 14837]
Nathan Walp <nwalp@pidgin.im>
parents: 12498
diff changeset
116 if(icon_name)
dd2b171a624c [gaim-migrate @ 14837]
Nathan Walp <nwalp@pidgin.im>
parents: 12498
diff changeset
117 gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
10771
acf54edfde3d [gaim-migrate @ 12379]
Tim Ringenbach <marv@pidgin.im>
parents: 10766
diff changeset
118
10766
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
119 #if 0
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
120 GdkPixbuf *p;
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
121 GdkBitmap *mask = NULL;
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
122
10765
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
123 p = gtk_widget_render_icon(GTK_WIDGET(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
124
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
125 if (p && (gdk_pixbuf_get_colorspace(p) == GDK_COLORSPACE_RGB) && (gdk_pixbuf_get_bits_per_sample(p) == 8)
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
126 && (gdk_pixbuf_get_has_alpha(p)) && (gdk_pixbuf_get_n_channels(p) == 4)) {
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
127 int len = gdk_pixbuf_get_width(p) * gdk_pixbuf_get_height(p);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
128 guchar *data = gdk_pixbuf_get_pixels(p);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
129 guchar *bitmap = g_malloc((len / 8) + 1);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
130 int i;
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
131
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
132 for (i = 0; i < len; i++)
10766
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
133 if (data[i*4 + 3] > 55)
10765
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
134 bitmap[i/8] |= 1 << i % 8;
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
135 else
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
136 bitmap[i/8] &= ~(1 << i % 8);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
137
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
138 mask = gdk_bitmap_create_from_data(GDK_DRAWABLE(GTK_WIDGET(image)->window), bitmap, gdk_pixbuf_get_width(p), gdk_pixbuf_get_height(p));
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
139 g_free(bitmap);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
140 }
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
141
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
142 if (mask)
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
143 gdk_window_shape_combine_mask(image->window, mask, 0, 0);
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
144
80b8be10dc42 [gaim-migrate @ 12370]
Tim Ringenbach <marv@pidgin.im>
parents: 10574
diff changeset
145 g_object_unref(G_OBJECT(p));
10766
4e64283bf3cb [gaim-migrate @ 12371]
Tim Ringenbach <marv@pidgin.im>
parents: 10765
diff changeset
146 #endif
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149 static void
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
150 docklet_x11_blank_icon()
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
151 {
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
152 if (!blank_icon) {
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
153 gint width, height;
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
154
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
155 gtk_icon_size_lookup(GTK_ICON_SIZE_LARGE_TOOLBAR, &width, &height);
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
156 blank_icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
157 gdk_pixbuf_fill(blank_icon, 0);
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
158 }
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
159
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
160 gtk_image_set_from_pixbuf(GTK_IMAGE(image), blank_icon);
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
161 }
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
162
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
163 static void
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
164 docklet_x11_set_tooltip(gchar *tooltip)
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
165 {
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
166 if (!tooltips)
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
167 tooltips = gtk_tooltips_new();
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
168
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
169 /* image->parent is a GtkEventBox */
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
170 if (tooltip) {
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
171 gtk_tooltips_enable(tooltips);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
172 gtk_tooltips_set_tip(tooltips, image->parent, tooltip, NULL);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
173 } else {
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
174 gtk_tooltips_set_tip(tooltips, image->parent, "", NULL);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
175 gtk_tooltips_disable(tooltips);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
176 }
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
177 }
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
178
10505
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
179 #if GTK_CHECK_VERSION(2,2,0)
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
180 static void
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
181 docklet_x11_position_menu(GtkMenu *menu, int *x, int *y, gboolean *push_in,
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
182 gpointer user_data)
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
183 {
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
184 GtkWidget *widget = GTK_WIDGET(docklet);
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
185 GtkRequisition req;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
186 gint menu_xpos, menu_ypos;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
187
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
188 gtk_widget_size_request(GTK_WIDGET(menu), &req);
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
189 gdk_window_get_origin(widget->window, &menu_xpos, &menu_ypos);
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
190
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
191 menu_xpos += widget->allocation.x;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
192 menu_ypos += widget->allocation.y;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
193
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
194 if (menu_ypos > gdk_screen_get_height(gtk_widget_get_screen(widget)) / 2)
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
195 menu_ypos -= req.height;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
196 else
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
197 menu_ypos += widget->allocation.height;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
198
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
199 *x = menu_xpos;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
200 *y = menu_ypos;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
201
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
202 *push_in = TRUE;
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
203 }
10505
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
204 #endif
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
205
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
206 static void
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
207 docklet_x11_destroy()
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
208 {
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
209 g_return_if_fail(docklet != NULL);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
210
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
211 docklet_remove();
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
212
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
213 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_x11_destroyed_cb), NULL);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
214 gtk_widget_destroy(GTK_WIDGET(docklet));
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
215
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
216 g_object_unref(G_OBJECT(docklet));
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
217 docklet = NULL;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
218
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
219 if (blank_icon)
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
220 g_object_unref(G_OBJECT(blank_icon));
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
221 blank_icon = NULL;
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
222
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
223 image = NULL;
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
224
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
225 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n");
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
226 }
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
227
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
228 static gboolean
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
229 docklet_x11_embed_timeout_cb()
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
230 {
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
231 /* The docklet was not embedded within the timeout.
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
232 * Remove it as a visibility manager, but leave the plugin
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
233 * loaded so that it can embed automatically if/when a notification
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
234 * area becomes available.
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
235 */
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
236 gaim_debug_info("tray icon", "failed to embed within timeout\n");
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
237 docklet_remove();
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
238
10491
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
239 return FALSE;
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
240 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
241
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
242 static void
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
243 docklet_x11_create()
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
244 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
245 GtkWidget *box;
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
246
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
247 if (docklet) {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
248 /* if this is being called when a tray icon exists, it's because
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
249 something messed up. try destroying it before we proceed,
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
250 although docklet_refcount may be all hosed. hopefully won't happen. */
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
251 gaim_debug(GAIM_DEBUG_WARNING, "tray icon", "trying to create icon but it already exists?\n");
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
252 docklet_x11_destroy();
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
253 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
254
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
255 docklet = egg_tray_icon_new("Gaim");
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
256 box = gtk_event_box_new();
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
257 image = gtk_image_new();
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
258
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
259 g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(docklet_x11_embedded_cb), NULL);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
260 g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_x11_destroyed_cb), NULL);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
261 g_signal_connect(G_OBJECT(box), "button-press-event", G_CALLBACK(docklet_x11_clicked_cb), NULL);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
262
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
263 gtk_container_add(GTK_CONTAINER(box), image);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
264 gtk_container_add(GTK_CONTAINER(docklet), box);
9229
395e62cf7bf6 [gaim-migrate @ 10025]
Tim Ringenbach <marv@pidgin.im>
parents: 6894
diff changeset
265
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
266 if (!gtk_check_version(2,4,0))
9229
395e62cf7bf6 [gaim-migrate @ 10025]
Tim Ringenbach <marv@pidgin.im>
parents: 6894
diff changeset
267 g_object_set(G_OBJECT(box), "visible-window", FALSE, NULL);
395e62cf7bf6 [gaim-migrate @ 10025]
Tim Ringenbach <marv@pidgin.im>
parents: 6894
diff changeset
268
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
269 gtk_widget_show_all(GTK_WIDGET(docklet));
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
270
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
271 /* ref the docklet before we bandy it about the place */
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
272 g_object_ref(G_OBJECT(docklet));
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
273
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
274 /* This is a hack to avoid a race condition between the docklet getting
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
275 * embedded in the notification area and the gtkblist restoring its
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
276 * previous visibility state. If the docklet does not get embedded within
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
277 * the timeout, it will be removed as a visibility manager until it does
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
278 * get embedded. Ideally, we would only call docklet_embedded() when the
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
279 * icon was actually embedded.
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
280 */
10491
9655389f4b81 [gaim-migrate @ 11781]
Sean Egan <seanegan@gmail.com>
parents: 10297
diff changeset
281 docklet_embedded();
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10491
diff changeset
282 embed_timeout = g_timeout_add(EMBED_TIMEOUT, docklet_x11_embed_timeout_cb, NULL);
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
283
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
284 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "created\n");
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
285 }
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
286
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
287 static struct docklet_ui_ops ui_ops =
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
288 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
289 docklet_x11_create,
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
290 docklet_x11_destroy,
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6371
diff changeset
291 docklet_x11_update_icon,
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
292 docklet_x11_blank_icon,
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12397
diff changeset
293 docklet_x11_set_tooltip,
10505
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
294 #if GTK_CHECK_VERSION(2,2,0)
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
295 docklet_x11_position_menu
10505
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
296 #else
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
297 NULL
91f17026b693 [gaim-migrate @ 11799]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
298 #endif
6209
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
299 };
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
300
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
301 void
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
302 docklet_ui_init()
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
303 {
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
304 docklet_set_ui_ops(&ui_ops);
dd715b02df41 [gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
305 }