Tue, 14 Dec 2021 01:14:27 -0600
port Pidgin to the new PurpleAccountManager api
Testing Done:
Compiled and ran locally, everything seemed to be okay.
Reviewed at https://reviews.imfreedom.org/r/1149/
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * pidgin |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * source distribution. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "pidgin/pidginmooddialog.h" |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
40444
f2d8204dcf4e
Some stuff got missed when making internal.h libpurple only.
Gary Kramlich <grim@reaperworld.com>
parents:
40388
diff
changeset
|
25 | #include <glib/gi18n-lib.h> |
|
f2d8204dcf4e
Some stuff got missed when making internal.h libpurple only.
Gary Kramlich <grim@reaperworld.com>
parents:
40388
diff
changeset
|
26 | |
|
f2d8204dcf4e
Some stuff got missed when making internal.h libpurple only.
Gary Kramlich <grim@reaperworld.com>
parents:
40388
diff
changeset
|
27 | #include "config.h" |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | /*< private > |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | * pidgin_mood_update_status: |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | * @account: The #PurpleAccount instance. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | * @mood: The id of the new mood. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | * @text: The new status text. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | * Updates the current status for @account with the given @mood and @text. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | static void |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | update_status_with_mood(PurpleAccount *account, const gchar *mood, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | const gchar *text) |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | if (mood && *mood) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | if (text) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | purple_account_set_status(account, "mood", TRUE, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PURPLE_MOOD_NAME, mood, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PURPLE_MOOD_COMMENT, text, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | purple_account_set_status(account, "mood", TRUE, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PURPLE_MOOD_NAME, mood, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | purple_account_set_status(account, "mood", FALSE, NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | /*< private |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | * pidgin_mood_edit_cb: |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
59 | * @connection: The #PurpleConnection instance. |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | * @fields: The #PurpleRequestFields |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | * This a callback function for when the request dialog has been accepted. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | static void |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
65 | pidgin_mood_dialog_edit_cb(PurpleConnection *connection, |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
66 | PurpleRequestFields *fields) |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
67 | { |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
68 | PurpleRequestField *mood_field = NULL; |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
69 | GList *l = NULL; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | const gchar *mood = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | mood_field = purple_request_fields_get_field(fields, "mood"); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | l = purple_request_field_list_get_selected(mood_field); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | if(l == NULL) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | return; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | mood = purple_request_field_list_get_data(mood_field, l->data); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
81 | if(connection != NULL) { |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
82 | PurpleAccount *account = purple_connection_get_account(connection); |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
83 | PurpleConnectionFlags flags; |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
84 | const gchar *text = NULL; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
86 | flags = purple_connection_get_flags(connection); |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
87 | if (flags & PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES) { |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
88 | PurpleRequestField *text_field = NULL; |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
89 | |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | text_field = purple_request_fields_get_field(fields, "text"); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | text = purple_request_field_string_get_value(text_field); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | text = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | update_status_with_mood(account, mood, text); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | } else { |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
98 | PurpleAccountManager *manager = purple_account_manager_get_default(); |
|
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
99 | GList *accounts = purple_account_manager_get_all(manager); |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | PurpleAccount *account = (PurpleAccount *) accounts->data; |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
103 | |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
104 | connection = purple_account_get_connection(account); |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
105 | if(PURPLE_IS_CONNECTION(connection)) { |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
106 | PurpleConnectionFlags flags; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
108 | flags = purple_connection_get_flags(connection); |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
109 | if(flags & PURPLE_CONNECTION_FLAG_SUPPORT_MOODS) { |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
110 | update_status_with_mood(account, mood, NULL); |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
111 | } |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | /*< private > |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | * pidgin_mood_get_global_moods: |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | * Returns an array of all global moods. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | * This function should be in libpurple, and it needs a lot of cleanup. It |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | * should probably also be returning a GList of moods as that's easier to deal |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | * with. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | * |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
126 | * Also, there is non-deterministic behavior here that the order of the |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
127 | * returned moods depends purely on the order that the accounts where connected |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
128 | * in. This is probably okay, but we should look at fixing that somehow. |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | * |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
130 | * Returns: (transfer full): A list of all global moods. |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | static PurpleMood * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | pidgin_mood_get_global_moods(void) { |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
134 | PurpleAccountManager *manager = NULL; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | GHashTable *global_moods = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | GHashTable *mood_counts = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | GList *accounts = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | PurpleMood *result = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | GList *out_moods = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | int i = 0; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | int num_accounts = 0; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | global_moods = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | mood_counts = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
146 | manager = purple_account_manager_get_default(); |
|
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
147 | accounts = purple_account_manager_get_active(manager); |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | PurpleAccount *account = (PurpleAccount *) accounts->data; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | if (purple_account_is_connected(account)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | PurpleConnection *gc = purple_account_get_connection(account); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_SUPPORT_MOODS) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | PurpleMood *mood = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
157 | for (mood = purple_protocol_client_get_moods(PURPLE_PROTOCOL_CLIENT(protocol), account) ; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | mood->mood != NULL ; mood++) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | int mood_count = |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood)); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
162 | if (!g_hash_table_contains(global_moods, mood->mood)) { |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | g_hash_table_insert(global_moods, (gpointer)mood->mood, mood); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | g_hash_table_insert(mood_counts, (gpointer)mood->mood, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | GINT_TO_POINTER(mood_count + 1)); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | num_accounts++; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | result = g_new0(PurpleMood, g_hash_table_size(global_moods) + 1); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | out_moods = g_hash_table_get_values(global_moods); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | while (out_moods) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | PurpleMood *mood = (PurpleMood *) out_moods->data; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | int in_num_accounts = |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood)); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | if (in_num_accounts == num_accounts) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | /* mood is present in all accounts supporting moods */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | result[i].mood = mood->mood; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | result[i].description = mood->description; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | i++; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | out_moods = g_list_delete_link(out_moods, out_moods); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | g_hash_table_destroy(global_moods); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | g_hash_table_destroy(mood_counts); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | return result; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | /*< private > |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | * pidgin_mood_get_global_status: |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | * Get the currently selected mood name for all mood support accounts. If no |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | * mood is set, or accounts have different moods then %NULL is returned. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | * Returns: The currently selected mood name or %NULL if a mood is not set, or |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | * accounts are using different moods. |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | static const gchar * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | pidgin_mood_get_global_status(void) { |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
208 | PurpleAccountManager *manager = NULL; |
|
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
209 | GList *accounts = NULL; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | const gchar *found_mood = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
212 | manager = purple_account_manager_get_default(); |
|
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
40647
diff
changeset
|
213 | accounts = purple_account_manager_get_active(manager); |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | PurpleAccount *account = (PurpleAccount *) accounts->data; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | if (purple_account_is_connected(account) && |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | (purple_connection_get_flags(purple_account_get_connection(account)) & |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | PURPLE_CONNECTION_FLAG_SUPPORT_MOODS)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | PurplePresence *presence = purple_account_get_presence(account); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | PurpleStatus *status = purple_presence_get_status(presence, "mood"); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | const gchar *curr_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | if (found_mood != NULL && !purple_strequal(curr_mood, found_mood)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | /* found a different mood */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | found_mood = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | break; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | found_mood = curr_mood; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | return found_mood; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | /****************************************************************************** |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | * Public API |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | *****************************************************************************/ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | void |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | pidgin_mood_dialog_show(PurpleAccount *account) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | const gchar *current_mood; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | PurpleRequestFields *fields; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | PurpleRequestFieldGroup *g; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | PurpleRequestField *f; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | PurpleConnection *gc = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | PurpleProtocol *protocol = NULL; |
|
40647
33d7e6abb37f
Fix a few random issues that scanbuild found.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
248 | PurpleMood *mood = NULL; |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | PurpleMood *global_moods = NULL; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | if (account) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | PurplePresence *presence = purple_account_get_presence(account); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | PurpleStatus *status = purple_presence_get_status(presence, "mood"); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | gc = purple_account_get_connection(account); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | g_return_if_fail(purple_connection_get_protocol(gc) != NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | protocol = purple_connection_get_protocol(gc); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | current_mood = pidgin_mood_get_global_status(); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | fields = purple_request_fields_new(); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | g = purple_request_field_group_new(NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | f = purple_request_field_list_new("mood", _("Please select your mood from the list")); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | purple_request_field_list_add_icon(f, _("None"), NULL, ""); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | if (current_mood == NULL) |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | purple_request_field_list_add_selected(f, _("None")); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | /* TODO: rlaager wants this sorted. */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | /* TODO: darkrain wants it sorted post-translation */ |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
272 | if (account && PURPLE_IS_PROTOCOL_CLIENT(protocol)) { |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
273 | mood = purple_protocol_client_get_moods(PURPLE_PROTOCOL_CLIENT(protocol), account); |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
274 | } |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
275 | |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
276 | if(mood == NULL) { |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | mood = global_moods = pidgin_mood_get_global_moods(); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | } |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
279 | |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
280 | for ( ; mood != NULL && mood->mood != NULL ; mood++) { |
|
40385
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | char *path; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | if (mood->description == NULL) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | continue; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | path = pidgin_mood_get_icon_path(mood->mood); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | purple_request_field_list_add_icon(f, _(mood->description), |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | path, (gpointer)mood->mood); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | g_free(path); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | if (current_mood && purple_strequal(current_mood, mood->mood)) |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | purple_request_field_list_add_selected(f, _(mood->description)); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | purple_request_field_group_add_field(g, f); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | purple_request_fields_add_group(fields, g); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | /* if the connection allows setting a mood message */ |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES)) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | g = purple_request_field_group_new(NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | f = purple_request_field_string_new("text", |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | _("Message (optional)"), NULL, FALSE); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | purple_request_field_group_add_field(g, f); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | purple_request_fields_add_group(fields, g); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"), |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | NULL, fields, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | _("OK"), G_CALLBACK(pidgin_mood_dialog_edit_cb), |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | _("Cancel"), NULL, |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | purple_request_cpar_from_connection(gc), gc); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | g_free(global_moods); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | gchar * |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | pidgin_mood_get_icon_path(const gchar *mood) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | gchar *path; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | if(purple_strequal(mood, "busy")) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | path = g_build_filename(PURPLE_DATADIR, "pidgin", "icons", |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | "hicolor", "16x16", "status", "user-busy.png", NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | } else if(purple_strequal(mood, "hiptop")) { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | path = g_build_filename(PURPLE_DATADIR, "pidgin", "icons", |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | "hicolor", "16x16", "emblems", "emblem-hiptop.png", |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | } else { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | gchar *filename = g_strdup_printf("%s.png", mood); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | path = g_build_filename(PURPLE_DATADIR, "pixmaps", "pidgin", |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | "emotes", "small", filename, NULL); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | g_free(filename); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | return path; |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 |