Fri, 30 Jul 2021 03:31:35 -0500
Update the unity plugin for the PurpleConversationManager API
Testing Done:
Compiled and tested it under Unity. Didn't notice much as configuration is broken and Unity did not like the graphics of my vm and kept not repainting the screen.
Reviewed at https://reviews.imfreedom.org/r/857/
| 35122 | 1 | /* |
| 2 | * Integration with Unity's messaging menu and launcher | |
| 3 | * Copyright (C) 2013 Ankit Vani <a@nevitus.org> | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or modify | |
| 6 | * it under the terms of the GNU General Public License as published by | |
| 7 | * the Free Software Foundation; either version 2 of the License, or | |
| 8 | * (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * along with this program; if not, write to the Free Software | |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
| 18 | */ | |
|
40947
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
19 | #include <glib.h> |
|
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
20 | #include <glib/gi18n-lib.h> |
|
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
21 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
22 | #include <purple.h> |
| 35122 | 23 | |
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
24 | #include <pidgin.h> |
| 35122 | 25 | |
|
40947
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
26 | #include <talkatu.h> |
|
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
27 | |
| 35122 | 28 | #include <unity.h> |
| 29 | #include <messaging-menu.h> | |
| 30 | ||
| 31 | #define UNITY_PLUGIN_ID "gtk-unity-integration" | |
| 32 | ||
| 33 | static MessagingMenuApp *mmapp = NULL; | |
| 34 | static UnityLauncherEntry *launcher = NULL; | |
| 35 | static guint n_sources = 0; | |
| 36 | static gint launcher_count; | |
| 37 | static gint messaging_menu_text; | |
| 38 | static gboolean alert_chat_nick = TRUE; | |
| 39 | ||
| 40 | enum { | |
| 41 | LAUNCHER_COUNT_DISABLE, | |
| 42 | LAUNCHER_COUNT_MESSAGES, | |
| 43 | LAUNCHER_COUNT_SOURCES, | |
| 44 | }; | |
| 45 | ||
| 46 | enum { | |
| 47 | MESSAGING_MENU_COUNT, | |
| 48 | MESSAGING_MENU_TIME, | |
| 49 | }; | |
| 50 | ||
| 51 | static int attach_signals(PurpleConversation *conv); | |
| 52 | static void detach_signals(PurpleConversation *conv); | |
| 53 | ||
| 54 | static void | |
| 55 | update_launcher() | |
| 56 | { | |
| 57 | guint count = 0; | |
| 58 | GList *convs = NULL; | |
| 35124 | 59 | g_return_if_fail(launcher != NULL); |
| 60 | if (launcher_count == LAUNCHER_COUNT_DISABLE) | |
| 61 | return; | |
| 35122 | 62 | |
| 63 | if (launcher_count == LAUNCHER_COUNT_MESSAGES) { | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
64 | PurpleConversationManager *manager = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
65 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
66 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
67 | convs = purple_conversation_manager_get_all(manager); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
68 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
69 | while(convs != NULL) { |
| 35122 | 70 | PurpleConversation *conv = convs->data; |
| 35123 | 71 | count += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), |
| 72 | "unity-message-count")); | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
73 | convs = g_list_delete_link(convs, convs); |
| 35122 | 74 | } |
| 75 | } else { | |
| 76 | count = n_sources; | |
| 77 | } | |
| 78 | ||
| 79 | if (launcher != NULL) { | |
| 80 | if (count > 0) | |
| 81 | unity_launcher_entry_set_count_visible(launcher, TRUE); | |
| 82 | else | |
| 83 | unity_launcher_entry_set_count_visible(launcher, FALSE); | |
| 84 | unity_launcher_entry_set_count(launcher, count); | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | static gchar * | |
| 89 | conversation_id(PurpleConversation *conv) | |
| 90 | { | |
| 91 | PurpleAccount *account = purple_conversation_get_account(conv); | |
| 92 | ||
| 35123 | 93 | return g_strconcat((PURPLE_IS_IM_CONVERSATION(conv) ? "im" : |
| 94 | PURPLE_IS_CHAT_CONVERSATION(conv) ? "chat" : "misc"), ":", | |
| 95 | purple_conversation_get_name(conv), ":", | |
| 96 | purple_account_get_username(account), ":", | |
| 97 | purple_account_get_protocol_id(account), NULL); | |
| 35122 | 98 | } |
| 99 | ||
| 100 | static void | |
| 101 | messaging_menu_add_conversation(PurpleConversation *conv, gint count) | |
| 102 | { | |
| 103 | gchar *id; | |
| 104 | g_return_if_fail(count > 0); | |
| 105 | id = conversation_id(conv); | |
| 106 | ||
| 107 | /* GBytesIcon may be useful for messaging menu source icons using buddy | |
| 108 | icon data for IMs */ | |
| 109 | if (!messaging_menu_app_has_source(mmapp, id)) | |
| 110 | messaging_menu_app_append_source(mmapp, id, NULL, | |
| 35123 | 111 | purple_conversation_get_title(conv)); |
| 35122 | 112 | |
| 113 | if (messaging_menu_text == MESSAGING_MENU_TIME) | |
| 114 | messaging_menu_app_set_source_time(mmapp, id, g_get_real_time()); | |
| 115 | else if (messaging_menu_text == MESSAGING_MENU_COUNT) | |
| 116 | messaging_menu_app_set_source_count(mmapp, id, count); | |
| 117 | messaging_menu_app_draw_attention(mmapp, id); | |
| 118 | ||
| 119 | g_free(id); | |
| 120 | } | |
| 121 | ||
| 122 | static void | |
| 123 | messaging_menu_remove_conversation(PurpleConversation *conv) | |
| 124 | { | |
| 125 | gchar *id = conversation_id(conv); | |
| 126 | if (messaging_menu_app_has_source(mmapp, id)) | |
| 127 | messaging_menu_app_remove_source(mmapp, id); | |
| 128 | g_free(id); | |
| 129 | } | |
| 130 | ||
| 131 | static void | |
| 132 | refill_messaging_menu() | |
| 133 | { | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
134 | PurpleConversationManager *manager = NULL; |
| 35122 | 135 | GList *convs; |
| 136 | ||
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
137 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
138 | convs = purple_conversation_manager_get_all(manager); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
139 | while(convs != NULL) { |
| 35122 | 140 | PurpleConversation *conv = convs->data; |
| 141 | messaging_menu_add_conversation(conv, | |
| 35123 | 142 | GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), |
| 143 | "unity-message-count"))); | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
144 | convs = g_list_delete_link(convs, convs); |
| 35122 | 145 | } |
| 146 | } | |
| 147 | ||
| 148 | static int | |
| 149 | alert(PurpleConversation *conv) | |
| 150 | { | |
| 151 | gint count; | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35534
diff
changeset
|
152 | PidginConvWindow *purplewin = NULL; |
| 35122 | 153 | if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) |
| 154 | return 0; | |
| 155 | ||
| 156 | purplewin = PIDGIN_CONVERSATION(conv)->win; | |
| 157 | ||
| 158 | if (!pidgin_conv_window_has_focus(purplewin) || | |
| 159 | !pidgin_conv_window_is_active_conversation(conv)) | |
| 160 | { | |
| 35123 | 161 | count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), |
| 162 | "unity-message-count")); | |
| 35122 | 163 | if (!count++) |
| 164 | ++n_sources; | |
| 165 | ||
| 35123 | 166 | g_object_set_data(G_OBJECT(conv), "unity-message-count", |
| 167 | GINT_TO_POINTER(count)); | |
| 35122 | 168 | messaging_menu_add_conversation(conv, count); |
| 169 | update_launcher(); | |
| 170 | } | |
| 171 | ||
| 172 | return 0; | |
| 173 | } | |
| 174 | ||
| 175 | static void | |
| 176 | unalert(PurpleConversation *conv) | |
| 177 | { | |
| 35123 | 178 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unity-message-count")) > 0) |
| 35122 | 179 | --n_sources; |
| 35123 | 180 | |
| 181 | g_object_set_data(G_OBJECT(conv), "unity-message-count", | |
| 182 | GINT_TO_POINTER(0)); | |
| 35122 | 183 | messaging_menu_remove_conversation(conv); |
| 184 | update_launcher(); | |
| 185 | } | |
| 186 | ||
| 187 | static int | |
| 188 | unalert_cb(GtkWidget *widget, gpointer data, PurpleConversation *conv) | |
| 189 | { | |
| 190 | unalert(conv); | |
| 191 | return 0; | |
| 192 | } | |
| 193 | ||
| 194 | static gboolean | |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36103
diff
changeset
|
195 | message_displayed_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer _unused) |
| 35122 | 196 | { |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36103
diff
changeset
|
197 | PurpleMessageFlags flags = purple_message_get_flags(msg); |
|
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36103
diff
changeset
|
198 | |
| 35123 | 199 | if ((PURPLE_IS_CHAT_CONVERSATION(conv) && alert_chat_nick && |
| 200 | !(flags & PURPLE_MESSAGE_NICK))) | |
| 35122 | 201 | return FALSE; |
| 202 | ||
| 203 | if ((flags & PURPLE_MESSAGE_RECV) && !(flags & PURPLE_MESSAGE_DELAYED)) | |
| 204 | alert(conv); | |
| 205 | ||
| 206 | return FALSE; | |
| 207 | } | |
| 208 | ||
| 209 | static void | |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
210 | im_sent_im(PurpleAccount *account, PurpleMessage *msg, gpointer _unused) |
| 35122 | 211 | { |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
212 | PurpleConversation *im = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
213 | PurpleConversationManager *manager = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
214 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
215 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
216 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
217 | im = purple_conversation_manager_find_im(manager, account, |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
218 | purple_message_get_recipient(msg)); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
219 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
220 | unalert(im); |
| 35122 | 221 | } |
| 222 | ||
| 223 | static void | |
|
36082
247d94c903c3
Switch sent-chat-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36081
diff
changeset
|
224 | chat_sent_im(PurpleAccount *account, PurpleMessage *msg, int id) |
| 35122 | 225 | { |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
226 | PurpleConversation *chat = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
227 | PurpleConversationManager *manager = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
228 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
229 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
230 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
231 | chat = purple_conversation_manager_find_chat_by_id(manager, account, id); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
232 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
233 | unalert(chat); |
| 35122 | 234 | } |
| 235 | ||
| 236 | static void | |
| 237 | conv_created(PurpleConversation *conv) | |
| 238 | { | |
| 35123 | 239 | g_object_set_data(G_OBJECT(conv), "unity-message-count", |
| 240 | GINT_TO_POINTER(0)); | |
| 35122 | 241 | attach_signals(conv); |
| 242 | } | |
| 243 | ||
| 244 | static void | |
| 245 | deleting_conv(PurpleConversation *conv) | |
| 246 | { | |
| 247 | detach_signals(conv); | |
| 248 | unalert(conv); | |
| 249 | } | |
| 250 | ||
| 251 | static void | |
| 252 | message_source_activated(MessagingMenuApp *app, const gchar *id, | |
| 35123 | 253 | gpointer user_data) |
| 35122 | 254 | { |
| 255 | gchar **sections = g_strsplit(id, ":", 0); | |
| 256 | PurpleConversation *conv = NULL; | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
257 | PurpleConversationManager *manager = NULL; |
| 35122 | 258 | PurpleAccount *account; |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35534
diff
changeset
|
259 | PidginConvWindow *purplewin = NULL; |
| 35122 | 260 | |
| 261 | char *type = sections[0]; | |
| 262 | char *cname = sections[1]; | |
| 263 | char *aname = sections[2]; | |
| 264 | char *protocol = sections[3]; | |
| 265 | ||
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
266 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
267 | |
| 35122 | 268 | account = purple_accounts_find(aname, protocol); |
| 35123 | 269 | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
270 | if (g_strcmp0(type, "im") == 0) { |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
271 | conv = purple_conversation_manager_find_im(manager, account, cname); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
272 | } else if (g_strcmp0(type, "chat") == 0) { |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
273 | conv = purple_conversation_manager_find_chat(manager, account, cname); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
274 | } else { |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
275 | conv = purple_conversation_manager_find(manager, account, cname); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
276 | } |
| 35122 | 277 | |
| 278 | if (conv) { | |
| 279 | unalert(conv); | |
| 280 | purplewin = PIDGIN_CONVERSATION(conv)->win; | |
| 281 | pidgin_conv_window_switch_gtkconv(purplewin, PIDGIN_CONVERSATION(conv)); | |
| 282 | gdk_window_focus(gtk_widget_get_window(purplewin->window), time(NULL)); | |
| 283 | } | |
| 284 | g_strfreev (sections); | |
| 285 | } | |
| 286 | ||
| 287 | static PurpleSavedStatus * | |
| 288 | create_transient_status(PurpleStatusPrimitive primitive, PurpleStatusType *status_type) | |
| 289 | { | |
| 290 | PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive); | |
| 291 | ||
| 292 | if(status_type != NULL) { | |
| 293 | GList *tmp, *active_accts = purple_accounts_get_all_active(); | |
| 294 | for (tmp = active_accts; tmp != NULL; tmp = tmp->next) { | |
| 295 | purple_savedstatus_set_substatus(saved_status, | |
| 296 | (PurpleAccount*) tmp->data, status_type, NULL); | |
| 297 | } | |
| 298 | g_list_free(active_accts); | |
| 299 | } | |
| 300 | ||
| 301 | return saved_status; | |
| 302 | } | |
| 303 | ||
| 304 | static void | |
| 305 | status_changed_cb(PurpleSavedStatus *saved_status) | |
| 306 | { | |
| 307 | MessagingMenuStatus status = MESSAGING_MENU_STATUS_AVAILABLE; | |
| 308 | ||
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35317
diff
changeset
|
309 | switch (purple_savedstatus_get_primitive_type(saved_status)) { |
| 35122 | 310 | case PURPLE_STATUS_AVAILABLE: |
| 311 | case PURPLE_STATUS_MOOD: | |
| 312 | case PURPLE_STATUS_TUNE: | |
| 313 | case PURPLE_STATUS_UNSET: | |
| 314 | status = MESSAGING_MENU_STATUS_AVAILABLE; | |
| 315 | break; | |
| 316 | ||
| 317 | case PURPLE_STATUS_AWAY: | |
| 318 | case PURPLE_STATUS_EXTENDED_AWAY: | |
| 319 | status = MESSAGING_MENU_STATUS_AWAY; | |
| 320 | break; | |
| 321 | ||
| 322 | case PURPLE_STATUS_INVISIBLE: | |
| 323 | status = MESSAGING_MENU_STATUS_INVISIBLE; | |
| 324 | break; | |
| 325 | ||
| 326 | case PURPLE_STATUS_MOBILE: | |
| 327 | case PURPLE_STATUS_OFFLINE: | |
| 328 | status = MESSAGING_MENU_STATUS_OFFLINE; | |
| 329 | break; | |
| 330 | ||
| 331 | case PURPLE_STATUS_UNAVAILABLE: | |
| 332 | status = MESSAGING_MENU_STATUS_BUSY; | |
| 333 | break; | |
| 334 | ||
| 335 | default: | |
| 336 | g_assert_not_reached(); | |
| 337 | } | |
| 338 | messaging_menu_app_set_status(mmapp, status); | |
| 339 | } | |
| 340 | ||
| 341 | static void | |
| 342 | messaging_menu_status_changed(MessagingMenuApp *mmapp, | |
| 35123 | 343 | MessagingMenuStatus mm_status, gpointer user_data) |
| 35122 | 344 | { |
| 345 | PurpleSavedStatus *saved_status; | |
| 346 | PurpleStatusPrimitive primitive = PURPLE_STATUS_UNSET; | |
| 347 | ||
| 348 | switch (mm_status) { | |
| 349 | case MESSAGING_MENU_STATUS_AVAILABLE: | |
| 350 | primitive = PURPLE_STATUS_AVAILABLE; | |
| 351 | break; | |
| 352 | ||
| 353 | case MESSAGING_MENU_STATUS_AWAY: | |
| 354 | primitive = PURPLE_STATUS_AWAY; | |
| 355 | break; | |
| 356 | ||
| 357 | case MESSAGING_MENU_STATUS_BUSY: | |
| 358 | primitive = PURPLE_STATUS_UNAVAILABLE; | |
| 359 | break; | |
| 360 | ||
| 361 | case MESSAGING_MENU_STATUS_INVISIBLE: | |
| 362 | primitive = PURPLE_STATUS_INVISIBLE; | |
| 363 | break; | |
| 364 | ||
| 365 | case MESSAGING_MENU_STATUS_OFFLINE: | |
| 366 | primitive = PURPLE_STATUS_OFFLINE; | |
| 367 | break; | |
| 368 | ||
| 369 | default: | |
| 370 | g_assert_not_reached(); | |
| 371 | } | |
| 372 | ||
| 373 | saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL); | |
| 374 | if (saved_status == NULL) | |
| 375 | saved_status = create_transient_status(primitive, NULL); | |
| 376 | purple_savedstatus_activate(saved_status); | |
| 377 | } | |
| 378 | ||
| 379 | static void | |
| 380 | alert_config_cb(GtkWidget *widget, gpointer data) | |
| 381 | { | |
| 382 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 383 | purple_prefs_set_bool("/plugins/gtk/unity/alert_chat_nick", on); | |
| 384 | alert_chat_nick = on; | |
| 385 | } | |
| 386 | ||
| 387 | static void | |
| 388 | launcher_config_cb(GtkWidget *widget, gpointer data) | |
| 389 | { | |
| 390 | gint option = GPOINTER_TO_INT(data); | |
| 35124 | 391 | if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) |
| 392 | return; | |
| 35122 | 393 | |
| 394 | purple_prefs_set_int("/plugins/gtk/unity/launcher_count", option); | |
| 395 | launcher_count = option; | |
| 396 | if (option == LAUNCHER_COUNT_DISABLE) | |
| 397 | unity_launcher_entry_set_count_visible(launcher, FALSE); | |
| 398 | else | |
| 399 | update_launcher(); | |
| 400 | } | |
| 401 | ||
| 402 | static void | |
| 403 | messaging_menu_config_cb(GtkWidget *widget, gpointer data) | |
| 404 | { | |
| 405 | gint option = GPOINTER_TO_INT(data); | |
| 35124 | 406 | if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) |
| 407 | return; | |
| 35122 | 408 | |
| 409 | purple_prefs_set_int("/plugins/gtk/unity/messaging_menu_text", option); | |
| 410 | messaging_menu_text = option; | |
| 411 | refill_messaging_menu(); | |
| 412 | } | |
| 413 | ||
| 414 | static int | |
| 415 | attach_signals(PurpleConversation *conv) | |
| 416 | { | |
| 417 | PidginConversation *gtkconv = NULL; | |
| 418 | guint id; | |
| 419 | ||
| 420 | gtkconv = PIDGIN_CONVERSATION(conv); | |
| 421 | if (!gtkconv) | |
| 422 | return 0; | |
| 423 | ||
| 424 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
| 35123 | 425 | G_CALLBACK(unalert_cb), conv); |
| 426 | g_object_set_data(G_OBJECT(conv), "unity-entry-signal", GUINT_TO_POINTER(id)); | |
| 35122 | 427 | |
|
40947
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
428 | id = g_signal_connect(G_OBJECT(gtkconv->history), "focus-in-event", |
| 35123 | 429 | G_CALLBACK(unalert_cb), conv); |
|
40947
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
430 | g_object_set_data(G_OBJECT(conv), "unity-history-signal", GUINT_TO_POINTER(id)); |
| 35122 | 431 | |
| 432 | return 0; | |
| 433 | } | |
| 434 | ||
| 435 | static void | |
| 436 | detach_signals(PurpleConversation *conv) | |
| 437 | { | |
| 438 | PidginConversation *gtkconv = NULL; | |
| 439 | guint id; | |
| 440 | gtkconv = PIDGIN_CONVERSATION(conv); | |
| 441 | if (!gtkconv) | |
| 442 | return; | |
| 443 | ||
|
40947
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
444 | id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unity-history-signal")); |
|
4169f8090a0e
Make the unity plugin compile again and add stuff to ci ubuntu builds
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
445 | g_signal_handler_disconnect(gtkconv->history, id); |
| 35122 | 446 | |
| 35123 | 447 | id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unity-entry-signal")); |
| 35122 | 448 | g_signal_handler_disconnect(gtkconv->entry, id); |
| 449 | ||
| 35123 | 450 | g_object_set_data(G_OBJECT(conv), "unity-message-count", |
| 451 | GINT_TO_POINTER(0)); | |
| 35122 | 452 | } |
| 453 | ||
| 454 | static GtkWidget * | |
| 455 | get_config_frame(PurplePlugin *plugin) | |
| 456 | { | |
| 457 | GtkWidget *ret = NULL, *frame = NULL; | |
| 458 | GtkWidget *vbox = NULL, *toggle = NULL; | |
| 459 | ||
|
35534
8e72593def2c
Fix gtk_[hv]box_new gtk3 deprecation warnings in unity plugin
Ankit Vani <a@nevitus.org>
parents:
35378
diff
changeset
|
460 | ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); |
| 35122 | 461 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 462 | ||
| 463 | /* Alerts */ | |
| 464 | ||
| 465 | frame = pidgin_make_frame(ret, _("Chatroom alerts")); | |
|
35534
8e72593def2c
Fix gtk_[hv]box_new gtk3 deprecation warnings in unity plugin
Ankit Vani <a@nevitus.org>
parents:
35378
diff
changeset
|
466 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 35122 | 467 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 468 | ||
| 469 | toggle = gtk_check_button_new_with_mnemonic(_("Chatroom message alerts _only where someone says your username")); | |
| 470 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 471 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 35123 | 472 | purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick")); |
| 35122 | 473 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 35123 | 474 | G_CALLBACK(alert_config_cb), NULL); |
| 35122 | 475 | |
| 476 | /* Launcher integration */ | |
| 477 | ||
| 478 | frame = pidgin_make_frame(ret, _("Launcher Icon")); | |
|
35534
8e72593def2c
Fix gtk_[hv]box_new gtk3 deprecation warnings in unity plugin
Ankit Vani <a@nevitus.org>
parents:
35378
diff
changeset
|
479 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 35122 | 480 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 481 | ||
| 482 | toggle = gtk_radio_button_new_with_mnemonic(NULL, _("_Disable launcher integration")); | |
| 483 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 484 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 485 | purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_DISABLE); | |
| 486 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 35123 | 487 | G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_DISABLE)); |
| 35122 | 488 | |
| 489 | toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), | |
| 35123 | 490 | _("Show number of unread _messages on launcher icon")); |
| 35122 | 491 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 492 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 493 | purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_MESSAGES); | |
| 494 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 35123 | 495 | G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_MESSAGES)); |
| 35122 | 496 | |
| 497 | toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), | |
|
35317
3c9c77b80a6c
Merge the release-2.x.y branch into default.
Mark Doliner <mark@kingant.net>
diff
changeset
|
498 | _("Show number of unread co_nversations on launcher icon")); |
| 35122 | 499 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 500 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 501 | purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_SOURCES); | |
| 502 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 35123 | 503 | G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_SOURCES)); |
| 35122 | 504 | |
| 505 | /* Messaging menu integration */ | |
| 506 | ||
| 507 | frame = pidgin_make_frame(ret, _("Messaging Menu")); | |
|
35534
8e72593def2c
Fix gtk_[hv]box_new gtk3 deprecation warnings in unity plugin
Ankit Vani <a@nevitus.org>
parents:
35378
diff
changeset
|
508 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 35122 | 509 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 510 | ||
| 511 | toggle = gtk_radio_button_new_with_mnemonic(NULL, | |
| 35123 | 512 | _("Show number of _unread messages for conversations in messaging menu")); |
| 35122 | 513 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 514 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 515 | purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text") == MESSAGING_MENU_COUNT); | |
| 516 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 35123 | 517 | G_CALLBACK(messaging_menu_config_cb), GUINT_TO_POINTER(MESSAGING_MENU_COUNT)); |
| 35122 | 518 | |
| 519 | toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), | |
| 35123 | 520 | _("Show _elapsed time for unread conversations in messaging menu")); |
| 35122 | 521 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 522 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 523 | purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text") == MESSAGING_MENU_TIME); | |
| 524 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 35123 | 525 | G_CALLBACK(messaging_menu_config_cb), GUINT_TO_POINTER(MESSAGING_MENU_TIME)); |
| 35122 | 526 | |
| 527 | gtk_widget_show_all(ret); | |
| 528 | return ret; | |
| 529 | } | |
| 530 | ||
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
531 | static GPluginPluginInfo * |
|
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
532 | unity_query(GError **error) |
|
36969
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
533 | { |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
534 | const gchar * const authors[] = { |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
535 | "Ankit Vani <a@nevitus.org>", |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
536 | NULL |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
537 | }; |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
538 | |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
539 | return pidgin_plugin_info_new( |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
540 | "id", UNITY_PLUGIN_ID, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
541 | "name", N_("Unity Integration"), |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
542 | "version", DISPLAY_VERSION, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
543 | "category", N_("Notification"), |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
544 | "summary", N_("Provides integration with Unity."), |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
545 | "description", N_("Provides integration with Unity's " |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
546 | "messaging menu and launcher."), |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
547 | "authors", authors, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
548 | "website", PURPLE_WEBSITE, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
549 | "abi-version", PURPLE_ABI_VERSION, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
550 | "gtk-config-frame-cb", get_config_frame, |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
551 | NULL |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
552 | ); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
553 | } |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
554 | |
| 35122 | 555 | static gboolean |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
556 | unity_load(GPluginPlugin *plugin, GError **error) { |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
557 | GList *convs = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
558 | PurpleConversationManager *manager = NULL; |
| 35122 | 559 | PurpleSavedStatus *saved_status; |
| 560 | void *conv_handle = purple_conversations_get_handle(); | |
| 561 | void *gtk_conv_handle = pidgin_conversations_get_handle(); | |
| 562 | void *savedstat_handle = purple_savedstatuses_get_handle(); | |
| 563 | ||
|
36969
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
564 | purple_prefs_add_none("/plugins/gtk"); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
565 | purple_prefs_add_none("/plugins/gtk/unity"); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
566 | purple_prefs_add_int("/plugins/gtk/unity/launcher_count", LAUNCHER_COUNT_SOURCES); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
567 | purple_prefs_add_int("/plugins/gtk/unity/messaging_menu_text", MESSAGING_MENU_COUNT); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
568 | purple_prefs_add_bool("/plugins/gtk/unity/alert_chat_nick", TRUE); |
|
c78437610c6d
Refactored unity plugin to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
35125
diff
changeset
|
569 | |
| 35122 | 570 | alert_chat_nick = purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick"); |
| 571 | ||
| 572 | mmapp = messaging_menu_app_new("pidgin.desktop"); | |
| 573 | g_object_ref(mmapp); | |
| 574 | messaging_menu_app_register(mmapp); | |
| 575 | messaging_menu_text = purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text"); | |
| 576 | ||
| 577 | g_signal_connect(mmapp, "activate-source", | |
| 35123 | 578 | G_CALLBACK(message_source_activated), NULL); |
| 35122 | 579 | g_signal_connect(mmapp, "status-changed", |
| 35123 | 580 | G_CALLBACK(messaging_menu_status_changed), NULL); |
| 35122 | 581 | |
| 582 | saved_status = purple_savedstatus_get_current(); | |
| 583 | status_changed_cb(saved_status); | |
| 584 | ||
| 585 | purple_signal_connect(savedstat_handle, "savedstatus-changed", plugin, | |
| 35123 | 586 | PURPLE_CALLBACK(status_changed_cb), NULL); |
| 35122 | 587 | |
| 588 | launcher = unity_launcher_entry_get_for_desktop_id("pidgin.desktop"); | |
| 589 | g_object_ref(launcher); | |
| 590 | launcher_count = purple_prefs_get_int("/plugins/gtk/unity/launcher_count"); | |
| 591 | ||
| 592 | purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, | |
| 35123 | 593 | PURPLE_CALLBACK(message_displayed_cb), NULL); |
| 35122 | 594 | purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, |
| 35123 | 595 | PURPLE_CALLBACK(message_displayed_cb), NULL); |
| 35122 | 596 | purple_signal_connect(conv_handle, "sent-im-msg", plugin, |
| 35123 | 597 | PURPLE_CALLBACK(im_sent_im), NULL); |
| 35122 | 598 | purple_signal_connect(conv_handle, "sent-chat-msg", plugin, |
| 35123 | 599 | PURPLE_CALLBACK(chat_sent_im), NULL); |
| 35122 | 600 | purple_signal_connect(conv_handle, "conversation-created", plugin, |
| 35123 | 601 | PURPLE_CALLBACK(conv_created), NULL); |
| 35122 | 602 | purple_signal_connect(conv_handle, "deleting-conversation", plugin, |
| 35123 | 603 | PURPLE_CALLBACK(deleting_conv), NULL); |
| 35122 | 604 | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
605 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
606 | convs = purple_conversation_manager_get_all(manager); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
607 | while(convs != NULL) { |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
608 | PurpleConversation *conv = PURPLE_CONVERSATION(convs->data); |
| 35122 | 609 | attach_signals(conv); |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
610 | convs = g_list_delete_link(convs, convs); |
| 35122 | 611 | } |
| 612 | ||
| 613 | return TRUE; | |
| 614 | } | |
| 615 | ||
| 616 | static gboolean | |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
617 | unity_unload(GPluginPlugin *plugin, GError **error) { |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
618 | GList *convs = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
619 | PurpleConversationManager *manager = NULL; |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
620 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
621 | manager = purple_conversation_manager_get_default(); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
622 | convs = purple_conversation_manager_get_all(manager); |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
623 | |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
624 | while(convs != NULL) { |
|
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
625 | PurpleConversation *conv = PURPLE_CONVERSATION(convs->data); |
| 35122 | 626 | unalert(conv); |
| 627 | detach_signals(conv); | |
|
41002
717c8a3f95a3
Update the unity plugin for the PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40947
diff
changeset
|
628 | convs = g_list_delete_link(convs, convs); |
| 35122 | 629 | } |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
630 | |
| 35122 | 631 | unity_launcher_entry_set_count_visible(launcher, FALSE); |
| 632 | messaging_menu_app_unregister(mmapp); | |
| 633 | ||
| 634 | g_object_unref(launcher); | |
| 635 | g_object_unref(mmapp); | |
| 636 | return TRUE; | |
| 637 | } | |
| 638 | ||
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
639 | GPLUGIN_NATIVE_PLUGIN_DECLARE(unity) |