Sun, 22 Nov 2009 23:27:26 +0000
Change lookup of docklet icons to use an 'icon name' instead of a stock
name. This chooses the correct size without weird scaling, but I don't
think it will work properly with icon themes, so I'll need to look into
that eventually.
|
29643
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 | * System tray icon (aka docklet) plugin for Purple |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 | * Copyright (C) 2007 Anders Hasselqvist |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 | * modify it under the terms of the GNU General Public License as |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 | * published by the Free Software Foundation; either version 2 of the |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 | * License, or (at your option) any later version. |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 | * |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, but |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 | * General Public License for more details. |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 | * |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 | * 02111-1307, USA. |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 | #include "internal.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 | #include "pidgin.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 | #include "debug.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 | #include "prefs.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 | #include "pidginstock.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 | #include "gtkdocklet.h" |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 | #if GTK_CHECK_VERSION(2,10,0) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
30 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 | /* globals */ |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 | GtkStatusIcon *docklet = NULL; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
34 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
35 | docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
36 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 | purple_debug_info("docklet", "button clicked %d\n", 1); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 | pidgin_docklet_clicked(1); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 | docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 | purple_debug_info("docklet", "button clicked %d\n", button); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 | pidgin_docklet_clicked(button); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
48 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
49 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
51 | docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
52 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
53 | const gchar *icon_name = NULL; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
55 | switch (status) { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
56 | case PURPLE_STATUS_OFFLINE: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
57 | icon_name = PIDGIN_STOCK_TRAY_OFFLINE; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
58 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
59 | case PURPLE_STATUS_AWAY: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
60 | icon_name = PIDGIN_STOCK_TRAY_AWAY; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
61 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
62 | case PURPLE_STATUS_UNAVAILABLE: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
63 | icon_name = PIDGIN_STOCK_TRAY_BUSY; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
64 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
65 | case PURPLE_STATUS_EXTENDED_AWAY: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
66 | icon_name = PIDGIN_STOCK_TRAY_XA; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
67 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
68 | case PURPLE_STATUS_INVISIBLE: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
69 | icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
70 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 | default: |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
72 | icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 | break; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
74 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 | if (pending) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
77 | icon_name = PIDGIN_STOCK_TRAY_PENDING; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
78 | if (connecting) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
79 | icon_name = PIDGIN_STOCK_TRAY_CONNECT; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
80 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
81 | if (icon_name) { |
|
29659
140f0c97a939
Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29643
diff
changeset
|
82 | gtk_status_icon_set_from_icon_name(docklet, icon_name); |
|
29643
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
83 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
84 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
85 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
86 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
87 | docklet_gtk_status_set_tooltip(gchar *tooltip) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
88 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 | if (tooltip) { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
90 | gtk_status_icon_set_tooltip(docklet, tooltip); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 | } else { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
92 | gtk_status_icon_set_tooltip(docklet, NULL); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
93 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
94 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
95 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
96 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
97 | docklet_gtk_status_position_menu(GtkMenu *menu, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
98 | int *x, int *y, gboolean *push_in, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
99 | gpointer user_data) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
100 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
101 | gtk_status_icon_position_menu(menu, x, y, push_in, docklet); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
102 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
104 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
105 | docklet_gtk_status_destroy(void) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
106 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
107 | g_return_if_fail(docklet != NULL); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
108 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
109 | pidgin_docklet_remove(); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
110 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
111 | g_object_unref(G_OBJECT(docklet)); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
112 | docklet = NULL; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
113 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
114 | purple_debug_info("docklet", "destroyed\n"); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
115 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
116 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
117 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
118 | docklet_gtk_status_create(gboolean recreate) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
119 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
120 | if (docklet) { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
121 | /* if this is being called when a tray icon exists, it's because |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
122 | something messed up. try destroying it before we proceed, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
123 | although docklet_refcount may be all hosed. hopefully won't happen. */ |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
124 | purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 | docklet_gtk_status_destroy(); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
126 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
127 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 | docklet = gtk_status_icon_new(); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
129 | g_return_if_fail(docklet != NULL); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
130 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
131 | g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 | g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
134 | pidgin_docklet_embedded(); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
135 | gtk_status_icon_set_visible(docklet, TRUE); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 | purple_debug_info("docklet", "created\n"); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 | static void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 | docklet_gtk_status_create_ui_op(void) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 | docklet_gtk_status_create(FALSE); |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
143 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
145 | static struct docklet_ui_ops ui_ops = |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
146 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
147 | docklet_gtk_status_create_ui_op, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 | docklet_gtk_status_destroy, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 | docklet_gtk_status_update_icon, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
150 | NULL, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
151 | docklet_gtk_status_set_tooltip, |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
152 | docklet_gtk_status_position_menu |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
153 | }; |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
154 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
155 | void |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 | docklet_ui_init(void) |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 | { |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
158 | pidgin_docklet_set_ui_ops(&ui_ops); |
|
29659
140f0c97a939
Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29643
diff
changeset
|
159 | gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), |
|
140f0c97a939
Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29643
diff
changeset
|
160 | DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); |
|
29643
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 | } |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 | |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
163 | #endif /* GTK_CHECK_VERSION(2,10,0) */ |
|
d03c32ee4bd5
Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 |