Mercurial > pidgin
annotate plugins/docklet/docklet-x11.c @ 6371:8f94cce8faa5
[gaim-migrate @ 6876]
I think I touched almost every file. Here's what happened.
I started off fixing up the Makefile.am and configure.ac files to help with
the core/UI split some. Then I got annoyed with the
build_{allow,deny}_list() functions that everything used, and decided to
core/UI split privacy. While doing that, I decided to redesign the dialog.
So now, a lot has changed, but not really so much. Just that most files
got affected.
Oh yeah, and the UI stuff was taken out of internal.h and moved to
gtkinternal.h. If you use this, please be aware of this change.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 05 Aug 2003 10:55:04 +0000 |
parents | dd715b02df41 |
children | c2fb9192377b |
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" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6209
diff
changeset
|
26 #include "gtkinternal.h" |
6209
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
27 #include "debug.h" |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
28 #include "stock.h" |
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" |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
31 #include "ui.h" |
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 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
36 /* globals */ |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
37 static EggTrayIcon *docklet = NULL; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
38 static GtkWidget *image = NULL; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
39 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
40 /* protos */ |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
41 static void docklet_x11_create(); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
42 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
43 static gboolean |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
44 docklet_x11_create_cb() |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
45 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
46 docklet_x11_create(); |
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 return FALSE; /* for when we're called by the glib idle handler */ |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
49 } |
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 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
52 docklet_x11_embedded_cb(GtkWidget *widget, void *data) |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
53 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
54 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "embedded\n"); |
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 docklet_embedded(); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
57 } |
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 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
60 docklet_x11_destroyed_cb(GtkWidget *widget, void *data) |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
61 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
62 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n"); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
63 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
64 docklet_remove(TRUE); |
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 g_object_unref(G_OBJECT(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
67 docklet = NULL; |
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 g_idle_add(docklet_x11_create_cb, &handle); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
70 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
71 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
72 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
73 docklet_x11_clicked_cb(GtkWidget *button, GdkEventButton *event, void *data) |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
74 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
75 if (event->type != GDK_BUTTON_PRESS) |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
76 return; |
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 docklet_clicked(event->button); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
79 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
80 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
81 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
82 docklet_x11_update_icon(enum docklet_status icon) |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
83 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
84 const gchar *icon_name = NULL; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
85 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
86 switch (icon) { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
87 case offline: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
88 icon_name = GAIM_STOCK_ICON_OFFLINE; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
89 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
90 case offline_connecting: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
91 case online_connecting: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
92 icon_name = GAIM_STOCK_ICON_CONNECT; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
93 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
94 case online: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
95 icon_name = GAIM_STOCK_ICON_ONLINE; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
96 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
97 case online_pending: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
98 icon_name = GAIM_STOCK_ICON_ONLINE_MSG; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
99 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
100 case away: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
101 icon_name = GAIM_STOCK_ICON_AWAY; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
102 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
103 case away_pending: |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
104 icon_name = GAIM_STOCK_ICON_AWAY_MSG; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
105 break; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
106 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
107 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
108 gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
109 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
110 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
111 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
112 docklet_x11_destroy() |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
113 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
114 docklet_remove(GTK_WIDGET_VISIBLE(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
115 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
116 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
|
117 gtk_widget_destroy(GTK_WIDGET(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
118 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
119 g_object_unref(G_OBJECT(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
120 docklet = NULL; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
121 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
122 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n"); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
123 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
124 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
125 static void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
126 docklet_x11_create() |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
127 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
128 GtkWidget *box; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
129 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
130 if (docklet) { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
131 /* 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
|
132 something messed up. try destroying it before we proceed, |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
133 although docklet_refcount may be all hosed. hopefully won't happen. */ |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
134 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
|
135 docklet_x11_destroy(); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
136 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
137 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
138 docklet = egg_tray_icon_new("Gaim"); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
139 box = gtk_event_box_new(); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
140 image = gtk_image_new(); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
141 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
146 gtk_container_add(GTK_CONTAINER(box), image); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
147 gtk_container_add(GTK_CONTAINER(docklet), box); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
148 gtk_widget_show_all(GTK_WIDGET(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
149 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
150 /* ref the docklet before we bandy it about the place */ |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
151 g_object_ref(G_OBJECT(docklet)); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
152 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
153 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "created\n"); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
154 } |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
155 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
156 static struct docklet_ui_ops ui_ops = |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
157 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
158 docklet_x11_create, |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
159 docklet_x11_destroy, |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
160 docklet_x11_update_icon |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
161 }; |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
162 |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
163 void |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
164 docklet_ui_init() |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
165 { |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
166 docklet_set_ui_ops(&ui_ops); |
dd715b02df41
[gaim-migrate @ 6695]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
167 } |