Fri, 05 Mar 2021 03:31:29 -0600
Create a PidginAvatar widget.
This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.
The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.
Testing Done:
Ran locally.
Reviewed at https://reviews.imfreedom.org/r/528/
|
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 { |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | GList *accounts = purple_accounts_get_all_active(); |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
101 | 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
|
102 | |
|
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
103 | 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
|
104 | 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
|
105 | 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
|
106 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
107 | 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
|
108 | 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
|
109 | 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
|
110 | } |
|
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
|
111 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | /*< 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
|
117 | * 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
|
118 | * |
|
c3e9a7d14e6f
Move the mood api to 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 | * 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
|
120 | * |
|
c3e9a7d14e6f
Move the mood api to 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 | * 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
|
122 | * 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
|
123 | * 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
|
124 | * |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
125 | * 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
|
126 | * 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
|
127 | * 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
|
128 | * |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
129 | * 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
|
130 | */ |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
132 | pidgin_mood_get_global_moods(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
|
133 | 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
|
134 | 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
|
135 | 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
|
136 | 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
|
137 | 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
|
138 | 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
|
139 | 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
|
140 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
142 | 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
|
143 | |
|
c3e9a7d14e6f
Move the mood api to 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 | accounts = purple_accounts_get_all_active(); |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
146 | 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
|
147 | 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
|
148 | 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
|
149 | |
|
c3e9a7d14e6f
Move the mood api to 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_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
|
151 | 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
|
152 | 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
|
153 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
154 | 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
|
155 | 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
|
156 | 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
|
157 | 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
|
158 | |
|
40388
3f2e9e346f6f
Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents:
40385
diff
changeset
|
159 | 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
|
160 | 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
|
161 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | 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
|
163 | 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
|
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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
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 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
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 | 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
|
174 | 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
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
180 | /* 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
186 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
189 | 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
|
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 | 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
|
192 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | /*< 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
|
195 | * 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
|
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 | * 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
|
198 | * 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
|
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 | * 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
|
201 | * 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
|
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 | 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
|
204 | pidgin_mood_get_global_status(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
|
205 | GList *accounts = purple_accounts_get_all_active(); |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
207 | |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | 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
|
209 | 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
|
210 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
212 | (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
|
213 | 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
|
214 | 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
|
215 | 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
|
216 | 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
|
217 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
219 | /* 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
|
220 | 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
|
221 | 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
|
222 | } 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
|
223 | 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
|
224 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
229 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | * 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
|
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 | 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
|
235 | 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
|
236 | 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
|
237 | 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
|
238 | 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
|
239 | 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
|
240 | 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
|
241 | PurpleProtocol *protocol = NULL; |
|
40647
33d7e6abb37f
Fix a few random issues that scanbuild found.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
242 | 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
|
243 | 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
|
244 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
246 | 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
|
247 | 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
|
248 | 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
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | } 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
|
253 | 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
|
254 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
257 | 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
|
258 | 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
|
259 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
261 | 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
|
262 | 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
|
263 | |
|
c3e9a7d14e6f
Move the mood api to 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 | /* 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
|
265 | /* 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
|
266 | 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
|
267 | 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
|
268 | } |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
269 | |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
270 | 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
|
271 | 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
|
272 | } |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
273 | |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40444
diff
changeset
|
274 | 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
|
275 | 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
|
276 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
278 | 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
|
279 | } |
|
c3e9a7d14e6f
Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
282 | 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
|
283 | 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
|
284 | 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
|
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 | 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
|
287 | 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
|
288 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
290 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
292 | |
|
c3e9a7d14e6f
Move the mood api to 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 | /* 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
|
294 | 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
|
295 | 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
|
296 | 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
|
297 | _("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
|
298 | 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
|
299 | 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
|
300 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
303 | 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
|
304 | _("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
|
305 | _("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
|
306 | 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
|
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 | 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
|
309 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
312 | 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
|
313 | 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
|
314 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
316 | 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
|
317 | "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
|
318 | } 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
|
319 | 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
|
320 | "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
|
321 | 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
|
322 | } 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
|
323 | 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
|
324 | 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
|
325 | "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
|
326 | 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
|
327 | } |
|
c3e9a7d14e6f
Move the mood api to 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 | |
|
c3e9a7d14e6f
Move the mood api to 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 | 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
|
330 | } |
|
c3e9a7d14e6f
Move the mood api to 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 |