Thu, 29 Sep 2022 06:30:35 -0500
Add introspectable version of purple_status_type_new_with_attrs
Also cleanup a bit of the other constructor docs.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1859/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20055
diff
changeset
|
1 | /* purple |
| 6065 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9791
diff
changeset
|
6 | * |
| 6065 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18284
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6065 | 20 | */ |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
21 | |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40332
diff
changeset
|
24 | #include "purpleprivate.h" |
|
25893
77f655480a0f
Slap some PURPLE_DISABLE_DEPRECATED checks around the functions Mark just
Richard Laager <rlaager@pidgin.im>
parents:
25871
diff
changeset
|
25 | |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34699
diff
changeset
|
26 | #include "buddylist.h" |
| 10400 | 27 | #include "core.h" |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
28 | #include "debug.h" |
|
10337
778231f38df6
[gaim-migrate @ 11545]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
29 | #include "notify.h" |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
30 | #include "prefs.h" |
|
40537
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
31 | #include "purpleaccountpresence.h" |
|
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
32 | #include "purplebuddypresence.h" |
| 6065 | 33 | #include "status.h" |
| 34 | ||
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
35 | /* |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
36 | * A type of status. |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
37 | */ |
| 15884 | 38 | struct _PurpleStatusType |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
39 | { |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
40 | int box_count; |
|
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
41 | |
| 15884 | 42 | PurpleStatusPrimitive primitive; |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
43 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
44 | char *id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
45 | char *name; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
46 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
47 | gboolean saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
48 | gboolean user_settable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
49 | gboolean independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
50 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
51 | GList *attrs; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
52 | }; |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
53 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
54 | /* |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
55 | * A status attribute. |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
56 | */ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
57 | struct _PurpleStatusAttribute |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
58 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
59 | char *id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
60 | char *name; |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
61 | GValue *value_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
62 | }; |
| 6065 | 63 | |
|
39543
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
64 | struct _PurpleStatus |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
65 | { |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
66 | GObject parent; |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
67 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
68 | PurpleStatusType *status_type; |
| 15884 | 69 | PurplePresence *presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
70 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
71 | gboolean active; |
| 6065 | 72 | |
|
23236
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
73 | /* |
|
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
74 | * The current values of the attributes for this status. The |
|
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
75 | * key is a string containing the name of the attribute. It is |
|
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
76 | * a borrowed reference from the list of attrs in the |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
77 | * PurpleStatusType. The value is a GValue. |
|
23236
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
78 | */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
79 | GHashTable *attr_values; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
80 | }; |
| 6065 | 81 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
82 | /* GObject property enums */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
83 | enum |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
84 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
85 | PROP_0, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
86 | PROP_STATUS_TYPE, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
87 | PROP_PRESENCE, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
88 | PROP_ACTIVE, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
89 | PROP_LAST |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
90 | }; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
91 | |
| 6065 | 92 | typedef struct |
| 93 | { | |
| 15884 | 94 | PurpleAccount *account; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
95 | char *name; |
| 15884 | 96 | } PurpleStatusBuddyKey; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
97 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
98 | static GParamSpec *properties[PROP_LAST]; |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
99 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
100 | G_DEFINE_TYPE(PurpleStatus, purple_status, G_TYPE_OBJECT); |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
101 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
102 | static int primitive_scores[] = |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
103 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
104 | 0, /* unset */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
105 | -500, /* offline */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
106 | 100, /* available */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
107 | -75, /* unavailable */ |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
108 | -50, /* invisible */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
109 | -100, /* away */ |
|
10860
8f600347b9e4
[gaim-migrate @ 12543]
Palmer Cox <enix@users.sourceforge.net>
parents:
10760
diff
changeset
|
110 | -200, /* extended away */ |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
111 | -400, /* mobile */ |
|
22793
b58dbbc5955e
Patch from Maiku: "When the buddy list is set to sort contacts by status,
Will Thompson <resiak@pidgin.im>
parents:
22765
diff
changeset
|
112 | 0, /* tune */ |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
113 | 0, /* mood */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
114 | -10, /* idle, special case. */ |
|
16856
3e42fed1dd43
Change some of the PurplePresence stuff to reflect how it's actually used
Sean Egan <seanegan@pidgin.im>
parents:
16592
diff
changeset
|
115 | -5, /* idle time, special case. */ |
|
3e42fed1dd43
Change some of the PurplePresence stuff to reflect how it's actually used
Sean Egan <seanegan@pidgin.im>
parents:
16592
diff
changeset
|
116 | 10 /* Offline messageable */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
117 | }; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
118 | |
|
22793
b58dbbc5955e
Patch from Maiku: "When the buddy list is set to sort contacts by status,
Will Thompson <resiak@pidgin.im>
parents:
22765
diff
changeset
|
119 | #define SCORE_IDLE 9 |
|
b58dbbc5955e
Patch from Maiku: "When the buddy list is set to sort contacts by status,
Will Thompson <resiak@pidgin.im>
parents:
22765
diff
changeset
|
120 | #define SCORE_IDLE_TIME 10 |
|
b58dbbc5955e
Patch from Maiku: "When the buddy list is set to sort contacts by status,
Will Thompson <resiak@pidgin.im>
parents:
22765
diff
changeset
|
121 | #define SCORE_OFFLINE_MESSAGE 11 |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
122 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
123 | /************************************************************************** |
| 15884 | 124 | * PurpleStatusPrimitive API |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
125 | **************************************************************************/ |
| 15884 | 126 | static struct PurpleStatusPrimitiveMap |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
127 | { |
| 15884 | 128 | PurpleStatusPrimitive type; |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
129 | const char *id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
130 | const char *name; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
131 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
132 | } const status_primitive_map[] = |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
133 | { |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
134 | { PURPLE_STATUS_UNSET, "unset", N_("Unset") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
135 | { PURPLE_STATUS_OFFLINE, "offline", N_("Offline") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
136 | { PURPLE_STATUS_AVAILABLE, "available", N_("Available") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
137 | { PURPLE_STATUS_UNAVAILABLE, "unavailable", N_("Do not disturb") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
138 | { PURPLE_STATUS_INVISIBLE, "invisible", N_("Invisible") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
139 | { PURPLE_STATUS_AWAY, "away", N_("Away") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
140 | { PURPLE_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended away") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
141 | { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
142 | { PURPLE_STATUS_TUNE, "tune", N_("Listening to music"), }, |
|
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
143 | { PURPLE_STATUS_MOOD, "mood", N_("Feeling") }, |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
144 | }; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
145 | |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
146 | int * |
|
35091
cb6e94789b5a
Moved declaerations of shared private functions to internal.h
Ankit Vani <a@nevitus.org>
parents:
35085
diff
changeset
|
147 | _purple_statuses_get_primitive_scores(void) |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
148 | { |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
149 | return primitive_scores; |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
150 | } |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
151 | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
152 | const char * |
| 15884 | 153 | purple_primitive_get_id_from_type(PurpleStatusPrimitive type) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
154 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
155 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
156 | |
| 15884 | 157 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
158 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
159 | if (type == status_primitive_map[i].type) |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
160 | return status_primitive_map[i].id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
161 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
162 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
163 | return status_primitive_map[0].id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
164 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
165 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
166 | const char * |
| 15884 | 167 | purple_primitive_get_name_from_type(PurpleStatusPrimitive type) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
168 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
169 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
170 | |
| 15884 | 171 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
172 | { |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
173 | if (type == status_primitive_map[i].type) |
|
13249
b3cc208601b5
[gaim-migrate @ 15614]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13193
diff
changeset
|
174 | return _(status_primitive_map[i].name); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
175 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
176 | |
|
13249
b3cc208601b5
[gaim-migrate @ 15614]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13193
diff
changeset
|
177 | return _(status_primitive_map[0].name); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
178 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
179 | |
| 15884 | 180 | PurpleStatusPrimitive |
| 181 | purple_primitive_get_type_from_id(const char *id) | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
182 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
183 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
184 | |
| 15884 | 185 | g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
186 | |
| 15884 | 187 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
188 | { |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24955
diff
changeset
|
189 | if (purple_strequal(id, status_primitive_map[i].id)) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
190 | return status_primitive_map[i].type; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
191 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
192 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
193 | return status_primitive_map[0].type; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
194 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
195 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
196 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
197 | /************************************************************************** |
| 15884 | 198 | * PurpleStatusType API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
199 | **************************************************************************/ |
| 15884 | 200 | PurpleStatusType * |
| 201 | purple_status_type_new_full(PurpleStatusPrimitive primitive, const char *id, | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
202 | const char *name, gboolean saveable, |
|
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
203 | gboolean user_settable, gboolean independent) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
204 | { |
| 15884 | 205 | PurpleStatusType *status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
206 | |
| 15884 | 207 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
208 | |
| 15884 | 209 | status_type = g_new0(PurpleStatusType, 1); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
210 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
211 | status_type->primitive = primitive; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
212 | status_type->saveable = saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
213 | status_type->user_settable = user_settable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
214 | status_type->independent = independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
215 | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
216 | if (id != NULL) |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
217 | status_type->id = g_strdup(id); |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
218 | else |
| 15884 | 219 | status_type->id = g_strdup(purple_primitive_get_id_from_type(primitive)); |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
220 | |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
221 | if (name != NULL) |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
222 | status_type->name = g_strdup(name); |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
223 | else |
| 15884 | 224 | status_type->name = g_strdup(purple_primitive_get_name_from_type(primitive)); |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
225 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
226 | return status_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
227 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
228 | |
| 15884 | 229 | PurpleStatusType * |
| 230 | purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
231 | const char *name, gboolean user_settable) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
232 | { |
| 15884 | 233 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
234 | |
|
25445
b36f23e05c50
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents:
23389
diff
changeset
|
235 | return purple_status_type_new_full(primitive, id, name, TRUE, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
236 | user_settable, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
237 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
238 | |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
239 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
240 | status_type_add_attr(PurpleStatusType *status_type, const char *id, |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
241 | const char *name, GValue *value) |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
242 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
243 | PurpleStatusAttribute *attr; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
244 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
245 | g_return_if_fail(status_type != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
246 | g_return_if_fail(id != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
247 | g_return_if_fail(name != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
248 | g_return_if_fail(value != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
249 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
250 | attr = purple_status_attribute_new(id, name, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
251 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
252 | status_type->attrs = g_list_append(status_type->attrs, attr); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
253 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
254 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
255 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
256 | status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
257 | { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
258 | const char *id, *name; |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
259 | GValue *value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
260 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
261 | g_return_if_fail(status_type != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
262 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
263 | while ((id = va_arg(args, const char *)) != NULL) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
264 | { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
265 | name = va_arg(args, const char *); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
266 | g_return_if_fail(name != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
267 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
268 | value = va_arg(args, GValue *); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
269 | g_return_if_fail(value != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
270 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
271 | status_type_add_attr(status_type, id, name, value); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
272 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
273 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
274 | |
| 15884 | 275 | PurpleStatusType * |
| 276 | purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
277 | const char *id, const char *name, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
278 | gboolean saveable, gboolean user_settable, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
279 | gboolean independent, const char *attr_id, |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
280 | const char *attr_name, GValue *attr_value, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
281 | ...) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
282 | { |
| 15884 | 283 | PurpleStatusType *status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
284 | va_list args; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
285 | |
| 15884 | 286 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
| 10012 | 287 | g_return_val_if_fail(attr_id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
288 | g_return_val_if_fail(attr_name != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
289 | g_return_val_if_fail(attr_value != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
290 | |
| 15884 | 291 | status_type = purple_status_type_new_full(primitive, id, name, saveable, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
292 | user_settable, independent); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
293 | |
|
10010
d9ee01f0659a
[gaim-migrate @ 10927]
Mark Doliner <markdoliner@pidgin.im>
parents:
10009
diff
changeset
|
294 | /* Add the first attribute */ |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
295 | status_type_add_attr(status_type, attr_id, attr_name, attr_value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
296 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
297 | va_start(args, attr_value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
298 | status_type_add_attrs_vargs(status_type, args); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
299 | va_end(args); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
300 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
301 | return status_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
302 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
303 | |
|
41760
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
304 | PurpleStatusType * |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
305 | purple_status_type_new_with_attrsv(PurpleStatusPrimitive primitive, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
306 | const char *id, const char *name, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
307 | gboolean saveable, gboolean user_settable, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
308 | gboolean independent, guint n_attributes, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
309 | const char *attr_id[], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
310 | const char *attr_name[], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
311 | GValue *attr_value[]) |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
312 | { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
313 | PurpleStatusType *status_type; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
314 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
315 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
316 | g_return_val_if_fail(attr_id != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
317 | g_return_val_if_fail(attr_name != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
318 | g_return_val_if_fail(attr_value != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
319 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
320 | status_type = purple_status_type_new_full(primitive, id, name, saveable, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
321 | user_settable, independent); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
322 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
323 | for(guint i = 0; i < n_attributes; i++) { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
324 | if(attr_id[i] == NULL || attr_name[i] == NULL || |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
325 | attr_value[i] == NULL) |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
326 | { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
327 | purple_status_type_destroy(status_type); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
328 | g_return_val_if_fail(attr_id[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
329 | g_return_val_if_fail(attr_name[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
330 | g_return_val_if_fail(attr_value[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
331 | return NULL; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
332 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
333 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
334 | status_type_add_attr(status_type, attr_id[i], attr_name[i], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
335 | attr_value[i]); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
336 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
337 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
338 | return status_type; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
339 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
340 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
341 | void |
| 15884 | 342 | purple_status_type_destroy(PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
343 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
344 | g_return_if_fail(status_type != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
345 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
346 | g_free(status_type->id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
347 | g_free(status_type->name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
348 | |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
349 | g_list_free_full(status_type->attrs, |
|
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
350 | (GDestroyNotify)purple_status_attribute_destroy); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
351 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
352 | g_free(status_type); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
353 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
354 | |
| 15884 | 355 | PurpleStatusPrimitive |
| 356 | purple_status_type_get_primitive(const PurpleStatusType *status_type) | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
357 | { |
| 15884 | 358 | g_return_val_if_fail(status_type != NULL, PURPLE_STATUS_UNSET); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
359 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
360 | return status_type->primitive; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
361 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
362 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
363 | const char * |
| 15884 | 364 | purple_status_type_get_id(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
365 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
366 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
367 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
368 | return status_type->id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
369 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
370 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
371 | const char * |
| 15884 | 372 | purple_status_type_get_name(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
373 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
374 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
375 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
376 | return status_type->name; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
377 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
378 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
379 | gboolean |
| 15884 | 380 | purple_status_type_is_saveable(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
381 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
382 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
383 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
384 | return status_type->saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
385 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
386 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
387 | gboolean |
| 15884 | 388 | purple_status_type_is_user_settable(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
389 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
390 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
391 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
392 | return status_type->user_settable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
393 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
394 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
395 | gboolean |
| 15884 | 396 | purple_status_type_is_independent(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
397 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
398 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
399 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
400 | return status_type->independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
401 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
402 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
403 | gboolean |
| 15884 | 404 | purple_status_type_is_exclusive(const PurpleStatusType *status_type) |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
405 | { |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
406 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
407 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
408 | return !status_type->independent; |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
409 | } |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
410 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
411 | gboolean |
| 15884 | 412 | purple_status_type_is_available(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
413 | { |
| 15884 | 414 | PurpleStatusPrimitive primitive; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
415 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
416 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
417 | |
| 15884 | 418 | primitive = purple_status_type_get_primitive(status_type); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
419 | |
| 15884 | 420 | return (primitive == PURPLE_STATUS_AVAILABLE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
421 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
422 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
423 | PurpleStatusAttribute * |
| 15884 | 424 | purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
425 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
426 | GList *l; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
427 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
428 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
429 | g_return_val_if_fail(id != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
430 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
431 | for (l = status_type->attrs; l != NULL; l = l->next) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
432 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
433 | PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
434 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
435 | if (purple_strequal(purple_status_attribute_get_id(attr), id)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
436 | return attr; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
437 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
438 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
439 | return NULL; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
440 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
441 | |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
17515
diff
changeset
|
442 | GList * |
| 15884 | 443 | purple_status_type_get_attrs(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
444 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
445 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
446 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
447 | return status_type->attrs; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
448 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
449 | |
| 15884 | 450 | const PurpleStatusType * |
| 451 | purple_status_type_find_with_id(GList *status_types, const char *id) | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
452 | { |
| 15884 | 453 | PurpleStatusType *status_type; |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
454 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
455 | g_return_val_if_fail(id != NULL, NULL); |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
456 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
457 | while (status_types != NULL) |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
458 | { |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
459 | status_type = status_types->data; |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
460 | |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24955
diff
changeset
|
461 | if (purple_strequal(id, status_type->id)) |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
462 | return status_type; |
| 10895 | 463 | |
| 464 | status_types = status_types->next; | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
465 | } |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
466 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
467 | return NULL; |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
468 | } |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
469 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
470 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
471 | /************************************************************************** |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
472 | * PurpleStatusAttribute API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
473 | **************************************************************************/ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
474 | PurpleStatusAttribute * |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
475 | purple_status_attribute_new(const char *id, const char *name, GValue *value_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
476 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
477 | PurpleStatusAttribute *attr; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
478 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
479 | g_return_val_if_fail(id != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
480 | g_return_val_if_fail(name != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
481 | g_return_val_if_fail(value_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
482 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
483 | attr = g_new0(PurpleStatusAttribute, 1); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
484 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
485 | attr->id = g_strdup(id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
486 | attr->name = g_strdup(name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
487 | attr->value_type = value_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
488 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
489 | return attr; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
490 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
491 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
492 | void |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
493 | purple_status_attribute_destroy(PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
494 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
495 | g_return_if_fail(attr != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
496 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
497 | g_free(attr->id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
498 | g_free(attr->name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
499 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
500 | purple_value_free(attr->value_type); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
501 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
502 | g_free(attr); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
503 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
504 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
505 | const char * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
506 | purple_status_attribute_get_id(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
507 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
508 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
509 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
510 | return attr->id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
511 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
512 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
513 | const char * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
514 | purple_status_attribute_get_name(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
515 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
516 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
517 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
518 | return attr->name; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
519 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
520 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
521 | GValue * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
522 | purple_status_attribute_get_value(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
523 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
524 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
525 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
526 | return attr->value_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
527 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
528 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
529 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
530 | /************************************************************************** |
| 15884 | 531 | * PurpleStatus API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
532 | **************************************************************************/ |
| 6065 | 533 | static void |
| 15884 | 534 | notify_status_update(PurplePresence *presence, PurpleStatus *old_status, |
| 535 | PurpleStatus *new_status) | |
| 6065 | 536 | { |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
537 | if (PURPLE_IS_ACCOUNT_PRESENCE(presence)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
538 | { |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
539 | PurpleAccount *account = purple_account_presence_get_account( |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
540 | PURPLE_ACCOUNT_PRESENCE(presence)); |
| 15884 | 541 | PurpleAccountUiOps *ops = purple_accounts_get_ui_ops(); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
542 | |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
543 | if (purple_account_get_enabled(account)) |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
544 | purple_protocol_change_account_status(account, old_status, new_status); |
|
10176
753b4c93479d
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
545 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
546 | if (ops != NULL && ops->status_changed != NULL) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
547 | { |
|
10176
753b4c93479d
[gaim-migrate @ 11291]
Christian Hammond <chipx86@chipx86.com>
parents:
10153
diff
changeset
|
548 | ops->status_changed(account, new_status); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
549 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
550 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
551 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
552 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
553 | static void |
| 15884 | 554 | status_has_changed(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
555 | { |
| 15884 | 556 | PurplePresence *presence; |
| 557 | PurpleStatus *old_status; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
558 | |
| 15884 | 559 | presence = purple_status_get_presence(status); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
560 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
561 | /* |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
562 | * If this status is exclusive, then we must be setting it to "active." |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
563 | * Since we are setting it to active, we want to set the currently |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
564 | * active status to "inactive." |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
565 | */ |
| 15884 | 566 | if (purple_status_is_exclusive(status)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
567 | { |
| 15884 | 568 | old_status = purple_presence_get_active_status(presence); |
|
35018
16313df69717
Invoke g_object_notify for old_status only if it exists when status changes
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
569 | if (old_status != NULL && (old_status != status)) { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
570 | old_status->active = FALSE; |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
571 | g_object_notify_by_pspec(G_OBJECT(old_status), |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
572 | properties[PROP_ACTIVE]); |
|
35018
16313df69717
Invoke g_object_notify for old_status only if it exists when status changes
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
573 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
574 | } |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
575 | else |
|
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
576 | old_status = NULL; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
577 | |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
578 | g_object_set(presence, "active-status", status, NULL); |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
579 | g_object_notify_by_pspec(G_OBJECT(status), properties[PROP_ACTIVE]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
580 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
581 | notify_status_update(presence, old_status, status); |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
582 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
583 | |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
584 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
585 | status_set_attr_boolean(PurpleStatus *status, const char *id, |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
586 | gboolean value) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
587 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
588 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
589 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
590 | g_return_if_fail(PURPLE_IS_STATUS(status)); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
591 | g_return_if_fail(id != NULL); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
592 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
593 | /* Make sure this attribute exists and is the correct type. */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
594 | attr_value = purple_status_get_attr_value(status, id); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
595 | g_return_if_fail(attr_value != NULL); |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
596 | g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_BOOLEAN); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
597 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
598 | g_value_set_boolean(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
599 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
600 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
601 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
602 | status_set_attr_int(PurpleStatus *status, const char *id, int value) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
603 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
604 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
605 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
606 | g_return_if_fail(PURPLE_IS_STATUS(status)); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
607 | g_return_if_fail(id != NULL); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
608 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
609 | /* Make sure this attribute exists and is the correct type. */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
610 | attr_value = purple_status_get_attr_value(status, id); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
611 | g_return_if_fail(attr_value != NULL); |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
612 | g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_INT); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
613 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
614 | g_value_set_int(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
615 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
616 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
617 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
618 | status_set_attr_string(PurpleStatus *status, const char *id, |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
619 | const char *value) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
620 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
621 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
622 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
623 | g_return_if_fail(PURPLE_IS_STATUS(status)); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
624 | g_return_if_fail(id != NULL); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
625 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
626 | /* Make sure this attribute exists and is the correct type. */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
627 | attr_value = purple_status_get_attr_value(status, id); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
628 | /* This used to be g_return_if_fail, but it's failing a LOT, so |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
629 | * let's generate a log error for now. */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
630 | /* g_return_if_fail(attr_value != NULL); */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
631 | if (attr_value == NULL) { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
632 | purple_debug_error("status", |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
633 | "Attempted to set status attribute '%s' for " |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
634 | "status '%s', which is not legal. Fix " |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
635 | "this!\n", id, |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
636 | purple_status_type_get_name(purple_status_get_status_type(status))); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
637 | return; |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
638 | } |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
639 | g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_STRING); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
640 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
641 | /* XXX: Check if the value has actually changed. If it has, and the status |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
642 | * is active, should this trigger 'status_has_changed'? */ |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
643 | g_value_set_string(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
644 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
645 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
646 | void |
| 15884 | 647 | purple_status_set_active(PurpleStatus *status, gboolean active) |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
648 | { |
|
40332
cd2da3a58f6d
Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents:
40328
diff
changeset
|
649 | purple_status_set_active_with_attrs_dict(status, active, NULL); |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
650 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
651 | |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
652 | /* |
|
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
653 | * This used to parse the va_list directly, but now it creates a GList |
| 15884 | 654 | * and passes it to purple_status_set_active_with_attrs_list(). That |
| 35011 | 655 | * function was created because account.c needs to pass a GList of |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
656 | * attributes to the status API. |
|
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
657 | */ |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
658 | void |
| 15884 | 659 | purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, va_list args) |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
660 | { |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
661 | GHashTable *attrs = purple_attrs_from_vargs(args); |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
662 | |
|
40332
cd2da3a58f6d
Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents:
40328
diff
changeset
|
663 | purple_status_set_active_with_attrs_dict(status, active, attrs); |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
664 | g_hash_table_destroy(attrs); |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
665 | } |
|
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
666 | |
|
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
667 | void |
|
40332
cd2da3a58f6d
Rename purple_account_set_status_list and purple_status_set_active_with_attrs_list
qarkai <qarkai@gmail.com>
parents:
40328
diff
changeset
|
668 | purple_status_set_active_with_attrs_dict(PurpleStatus *status, gboolean active, |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
669 | GHashTable *attrs) |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
670 | { |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
671 | gboolean changed = FALSE; |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
17515
diff
changeset
|
672 | GList *l; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
673 | GList *specified_attr_ids = NULL; |
| 15884 | 674 | PurpleStatusType *status_type; |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
675 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
676 | g_return_if_fail(PURPLE_IS_STATUS(status)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
677 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
678 | if(!active && purple_status_is_exclusive(status)) { |
| 15884 | 679 | purple_debug_error("status", |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
680 | "Cannot deactivate an exclusive status (%s).", |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
681 | purple_status_get_id(status)); |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
682 | return; |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
683 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
684 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
685 | if(status->active != active) { |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
686 | changed = TRUE; |
|
10738
63ca8277c234
[gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents:
10714
diff
changeset
|
687 | } |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
688 | status->active = active; |
| 6065 | 689 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
690 | if(attrs != NULL) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
691 | GHashTableIter iter; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
692 | gpointer key, data; |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
693 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
694 | /* Set any attributes */ |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
695 | g_hash_table_iter_init(&iter, attrs); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
696 | while(g_hash_table_iter_next(&iter, &key, &data)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
697 | gchar *id = (gchar *)key; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
698 | GValue *value = purple_status_get_attr_value(status, id); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
699 | if(value == NULL) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
700 | purple_debug_warning("status", |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
701 | "The attribute \"%s\" on the status " |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
702 | "\"%s\" is not supported.", |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
703 | id, status->status_type->name); |
|
10713
648a49b350f2
[gaim-migrate @ 12307]
Mark Doliner <markdoliner@pidgin.im>
parents:
10580
diff
changeset
|
704 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
705 | /* Skip over the data and move on to the next attribute */ |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
706 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
707 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
708 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
709 | specified_attr_ids = g_list_prepend(specified_attr_ids, id); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
710 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
711 | if(G_VALUE_HOLDS_STRING(value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
712 | const gchar *string_data = (const gchar *)data; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
713 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
714 | if(purple_strequal(string_data, g_value_get_string(value))) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
715 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
716 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
717 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
718 | status_set_attr_string(status, id, string_data); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
719 | changed = TRUE; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
720 | } else if(G_VALUE_HOLDS_INT(value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
721 | gint int_data = GPOINTER_TO_INT(data); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
722 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
723 | if(int_data == g_value_get_int(value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
724 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
725 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
726 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
727 | status_set_attr_int(status, id, int_data); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
728 | changed = TRUE; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
729 | } else if(G_VALUE_HOLDS_BOOLEAN(value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
730 | gboolean boolean_data = GPOINTER_TO_INT(data); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
731 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
732 | if(boolean_data == g_value_get_boolean(value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
733 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
734 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
735 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
736 | status_set_attr_boolean(status, id, boolean_data); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
737 | changed = TRUE; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
738 | } |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
739 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
740 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
741 | |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
742 | /* Reset any unspecified attributes to their default value */ |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
743 | status_type = purple_status_get_status_type(status); |
| 15884 | 744 | l = purple_status_type_get_attrs(status_type); |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
745 | while(l != NULL) { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
746 | PurpleStatusAttribute *attr; |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
747 | GList *found = NULL; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
748 | GValue *default_value = NULL; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
749 | default_value = NULL; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
750 | |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
751 | attr = l->data; |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
752 | l = l->next; |
|
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
753 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
754 | found = g_list_find_custom(specified_attr_ids, attr->id, |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
755 | (GCompareFunc)g_strcmp0); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
756 | if(found != NULL) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
757 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
758 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
759 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
760 | default_value = purple_status_attribute_get_value(attr); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
761 | if(G_VALUE_HOLDS_STRING(default_value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
762 | const gchar *cur = purple_status_get_attr_string(status, |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
763 | attr->id); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
764 | const gchar *def = g_value_get_string(default_value); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
765 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
766 | if (purple_strequal(cur, def)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
767 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
768 | } |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
769 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
770 | status_set_attr_string(status, attr->id, def); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
771 | } else if(G_VALUE_HOLDS_INT(default_value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
772 | gint cur = purple_status_get_attr_int(status, attr->id); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
773 | gint def = g_value_get_int(default_value); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
774 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
775 | if(cur == def) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
776 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
777 | } |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
778 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
779 | status_set_attr_int(status, attr->id, def); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
780 | } else if(G_VALUE_HOLDS_BOOLEAN(default_value)) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
781 | gboolean cur = purple_status_get_attr_boolean(status, attr->id); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
782 | gboolean def = g_value_get_boolean(default_value); |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
783 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
784 | if(cur == def) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
785 | continue; |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
786 | } |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
787 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
788 | status_set_attr_boolean(status, attr->id, def); |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
789 | } |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
790 | changed = TRUE; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
791 | } |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
792 | g_list_free(specified_attr_ids); |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
793 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
794 | if(changed) { |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
795 | status_has_changed(status); |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
796 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
797 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
798 | |
| 15884 | 799 | PurpleStatusType * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
800 | purple_status_get_status_type(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
801 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
802 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
803 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
804 | return status->status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
805 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
806 | |
| 15884 | 807 | PurplePresence * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
808 | purple_status_get_presence(PurpleStatus *status) |
| 6065 | 809 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
810 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
811 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
812 | return status->presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
813 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
814 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
815 | const char * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
816 | purple_status_get_id(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
817 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
818 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
819 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
820 | return purple_status_type_get_id(purple_status_get_status_type(status)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
821 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
822 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
823 | const char * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
824 | purple_status_get_name(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
825 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
826 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
827 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
828 | return purple_status_type_get_name(purple_status_get_status_type(status)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
829 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
830 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
831 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
832 | purple_status_is_independent(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
833 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
834 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
835 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
836 | return purple_status_type_is_independent(purple_status_get_status_type(status)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
837 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
838 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
839 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
840 | purple_status_is_exclusive(PurpleStatus *status) |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
841 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
842 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
843 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
844 | return purple_status_type_is_exclusive(purple_status_get_status_type(status)); |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
845 | } |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
846 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
847 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
848 | purple_status_is_available(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
849 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
850 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
851 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
852 | return purple_status_type_is_available(purple_status_get_status_type(status)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
853 | } |
| 6216 | 854 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
855 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
856 | purple_status_is_active(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
857 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
858 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
859 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
860 | return status->active; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
861 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
862 | |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
863 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
864 | purple_status_is_online(PurpleStatus *status) |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
865 | { |
| 15884 | 866 | PurpleStatusPrimitive primitive; |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
867 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
868 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
869 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
870 | primitive = purple_status_type_get_primitive(purple_status_get_status_type(status)); |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
871 | |
| 15884 | 872 | return (primitive != PURPLE_STATUS_UNSET && |
| 873 | primitive != PURPLE_STATUS_OFFLINE); | |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
874 | } |
|
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
875 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
876 | GValue * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
877 | purple_status_get_attr_value(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
878 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
879 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
880 | g_return_val_if_fail(id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
881 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
882 | return (GValue *)g_hash_table_lookup(status->attr_values, id); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
883 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
884 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
885 | gboolean |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
886 | purple_status_get_attr_boolean(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
887 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
888 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
889 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
890 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
891 | g_return_val_if_fail(id != NULL, FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
892 | |
| 15884 | 893 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
894 | return FALSE; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
895 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
896 | g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_BOOLEAN, FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
897 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
898 | return g_value_get_boolean(value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
899 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
900 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
901 | int |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
902 | purple_status_get_attr_int(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
903 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
904 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
905 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
906 | g_return_val_if_fail(PURPLE_IS_STATUS(status), 0); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
907 | g_return_val_if_fail(id != NULL, 0); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
908 | |
| 15884 | 909 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
| 10507 | 910 | return 0; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
911 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
912 | g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_INT, 0); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
913 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
914 | return g_value_get_int(value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
915 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
916 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
917 | const char * |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
918 | purple_status_get_attr_string(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
919 | { |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
920 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
921 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
922 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
923 | g_return_val_if_fail(id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
924 | |
| 15884 | 925 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10500
diff
changeset
|
926 | return NULL; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
927 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
928 | g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_STRING, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
929 | |
|
34824
6868ad1739a3
Refactored dbus-server, signals, sound, status to use GType and GValue instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
930 | return g_value_get_string(value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
931 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
932 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
933 | gint |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
934 | purple_status_compare(PurpleStatus *status1, PurpleStatus *status2) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
935 | { |
| 15884 | 936 | PurpleStatusType *type1, *type2; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
937 | int score1 = 0, score2 = 0; |
| 6065 | 938 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
939 | if ((status1 == NULL && status2 == NULL) || |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
940 | (status1 == status2)) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
941 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
942 | return 0; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
943 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
944 | else if (status1 == NULL) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
945 | return 1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
946 | else if (status2 == NULL) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
947 | return -1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
948 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
949 | type1 = purple_status_get_status_type(status1); |
|
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
950 | type2 = purple_status_get_status_type(status2); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
951 | |
| 15884 | 952 | if (purple_status_is_active(status1)) |
| 953 | score1 = primitive_scores[purple_status_type_get_primitive(type1)]; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
954 | |
| 15884 | 955 | if (purple_status_is_active(status2)) |
| 956 | score2 = primitive_scores[purple_status_type_get_primitive(type2)]; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
957 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
958 | if (score1 > score2) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
959 | return -1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
960 | else if (score1 < score2) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
961 | return 1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
962 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
963 | return 0; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
964 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
965 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
966 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
967 | /************************************************************************** |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
968 | * GBoxed code for PurpleStatusType |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
969 | **************************************************************************/ |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
970 | static PurpleStatusType * |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
971 | purple_status_type_ref(PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
972 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
973 | g_return_val_if_fail(status_type != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
974 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
975 | status_type->box_count++; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
976 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
977 | return status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
978 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
979 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
980 | static void |
|
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
981 | purple_status_type_unref(PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
982 | { |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
983 | g_return_if_fail(status_type != NULL); |
|
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
984 | g_return_if_fail(status_type->box_count >= 0); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
985 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
986 | if (!status_type->box_count--) |
|
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
987 | purple_status_type_destroy(status_type); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
988 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
989 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
990 | GType |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
991 | purple_status_type_get_type(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
992 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
993 | static GType type = 0; |
| 6216 | 994 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
995 | if (type == 0) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
996 | type = g_boxed_type_register_static("PurpleStatusType", |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
997 | (GBoxedCopyFunc)purple_status_type_ref, |
|
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
998 | (GBoxedFreeFunc)purple_status_type_unref); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
999 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1000 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1001 | return type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1002 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1003 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1004 | /************************************************************************** |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1005 | * GBoxed code for PurpleStatusAttribute |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1006 | **************************************************************************/ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1007 | static PurpleStatusAttribute * |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1008 | purple_status_attribute_copy(PurpleStatusAttribute *status_attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1009 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1010 | g_return_val_if_fail(status_attr != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1011 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1012 | return purple_status_attribute_new(status_attr->id, |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1013 | status_attr->name, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1014 | purple_value_dup(status_attr->value_type)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1015 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1016 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1017 | GType |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1018 | purple_status_attribute_get_type(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1019 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1020 | static GType type = 0; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1021 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1022 | if (type == 0) { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1023 | type = g_boxed_type_register_static("PurpleStatusAttribute", |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1024 | (GBoxedCopyFunc)purple_status_attribute_copy, |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1025 | (GBoxedFreeFunc)purple_status_attribute_destroy); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1026 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1027 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1028 | return type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1029 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1030 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1031 | /************************************************************************** |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1032 | * GBoxed code for PurpleMood |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1033 | **************************************************************************/ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1034 | static PurpleMood * |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1035 | purple_mood_copy(PurpleMood *mood) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1036 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1037 | PurpleMood *mood_copy; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1038 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1039 | g_return_val_if_fail(mood != NULL, NULL); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1040 | |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1041 | mood_copy = g_new(PurpleMood, 1); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1042 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1043 | mood_copy->mood = g_strdup(mood->mood); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1044 | mood_copy->description = g_strdup(mood->description); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1045 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1046 | return mood_copy; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1047 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1048 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1049 | static void |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1050 | purple_mood_free(PurpleMood *mood) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1051 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1052 | g_free((gchar *)mood->mood); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1053 | g_free((gchar *)mood->description); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1054 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1055 | g_free(mood); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1056 | } |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
13507
diff
changeset
|
1057 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1058 | GType |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1059 | purple_mood_get_type(void) |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1060 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1061 | static GType type = 0; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1062 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1063 | if (type == 0) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1064 | type = g_boxed_type_register_static("PurpleMood", |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1065 | (GBoxedCopyFunc)purple_mood_copy, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1066 | (GBoxedFreeFunc)purple_mood_free); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1067 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1068 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1069 | return type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1070 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1071 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1072 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1073 | /************************************************************************** |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1074 | * GObject code |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1075 | **************************************************************************/ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1076 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1077 | /* Set method for GObject properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1078 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1079 | purple_status_set_property(GObject *obj, guint param_id, const GValue *value, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1080 | GParamSpec *pspec) |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1081 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1082 | PurpleStatus *status = PURPLE_STATUS(obj); |
| 12145 | 1083 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1084 | switch (param_id) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1085 | case PROP_STATUS_TYPE: |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1086 | status->status_type = g_value_get_pointer(value); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1087 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1088 | case PROP_PRESENCE: |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1089 | status->presence = g_value_get_object(value); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1090 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1091 | case PROP_ACTIVE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1092 | purple_status_set_active(status, g_value_get_boolean(value)); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1093 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1094 | default: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1095 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1096 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1097 | } |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1098 | } |
|
17515
d96963b3074e
A patch from QuLogic to fix a bug with a zero timestamp for unidle notices
Richard Laager <rlaager@pidgin.im>
parents:
17514
diff
changeset
|
1099 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1100 | /* Get method for GObject properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1101 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1102 | purple_status_get_property(GObject *obj, guint param_id, GValue *value, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1103 | GParamSpec *pspec) |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1104 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1105 | PurpleStatus *status = PURPLE_STATUS(obj); |
|
11975
0abdd0c63f0f
[gaim-migrate @ 14268]
Mark Doliner <markdoliner@pidgin.im>
parents:
11973
diff
changeset
|
1106 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1107 | switch (param_id) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1108 | case PROP_STATUS_TYPE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1109 | g_value_set_pointer(value, purple_status_get_status_type(status)); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1110 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1111 | case PROP_PRESENCE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1112 | g_value_set_object(value, purple_status_get_presence(status)); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1113 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1114 | case PROP_ACTIVE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1115 | g_value_set_boolean(value, purple_status_is_active(status)); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1116 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1117 | default: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1118 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1119 | break; |
|
11551
ba20005d8f78
[gaim-migrate @ 13806]
Luke Schierer <lschiere@pidgin.im>
parents:
11522
diff
changeset
|
1120 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1121 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1122 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1123 | /* GObject initialization function */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1124 | static void |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
1125 | purple_status_init(PurpleStatus *status) |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
1126 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1127 | status->attr_values = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1128 | (GDestroyNotify)purple_value_free); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1129 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1130 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1131 | /* Called when done constructing */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1132 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1133 | purple_status_constructed(GObject *object) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1134 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1135 | PurpleStatus *status = PURPLE_STATUS(object); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1136 | GList *l; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1137 | |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
1138 | G_OBJECT_CLASS(purple_status_parent_class)->constructed(object); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1139 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1140 | for (l = purple_status_type_get_attrs(status->status_type); l != NULL; l = l->next) |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1141 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1142 | PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data; |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1143 | GValue *value = purple_status_attribute_get_value(attr); |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1144 | GValue *new_value = purple_value_dup(value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1145 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1146 | g_hash_table_insert(status->attr_values, |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1147 | (char *)purple_status_attribute_get_id(attr), |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1148 | new_value); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1149 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1150 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1151 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1152 | /* |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1153 | * GObject finalize function |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1154 | * TODO: If the PurpleStatus is in a PurplePresence, then |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1155 | * remove it from the PurplePresence? |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1156 | */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1157 | static void |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
1158 | purple_status_finalize(GObject *obj) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1159 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1160 | PurpleStatus *status = PURPLE_STATUS(obj); |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1161 | |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1162 | g_hash_table_destroy(status->attr_values); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1163 | |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
1164 | G_OBJECT_CLASS(purple_status_parent_class)->finalize(obj); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1165 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1166 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1167 | /* Class initializer function */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1168 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1169 | purple_status_class_init(PurpleStatusClass *klass) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1170 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1171 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1172 | |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1173 | obj_class->finalize = purple_status_finalize; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1174 | obj_class->constructed = purple_status_constructed; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1175 | |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1176 | /* Setup properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1177 | obj_class->get_property = purple_status_get_property; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1178 | obj_class->set_property = purple_status_set_property; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1179 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1180 | properties[PROP_STATUS_TYPE] = g_param_spec_pointer("status-type", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1181 | "Status type", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35018
diff
changeset
|
1182 | "The PurpleStatusType of the status.", |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1183 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1184 | G_PARAM_STATIC_STRINGS); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1185 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1186 | properties[PROP_PRESENCE] = g_param_spec_object("presence", "Presence", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1187 | "The presence that the status belongs to.", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1188 | PURPLE_TYPE_PRESENCE, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1189 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1190 | G_PARAM_STATIC_STRINGS); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1191 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1192 | properties[PROP_ACTIVE] = g_param_spec_boolean("active", "Active", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1193 | "Whether the status is active or not.", FALSE, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1194 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1195 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
1196 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1197 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1198 | |
| 15884 | 1199 | PurpleStatus * |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1200 | purple_status_new(PurpleStatusType *status_type, PurplePresence *presence) |
| 6065 | 1201 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1202 | g_return_val_if_fail(status_type != NULL, NULL); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
1203 | g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL); |
|
22765
fa78f0291dee
Between an offline presence with offline-message capability, and a mobile online presence, choose the latter over the former when sending an instant message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22390
diff
changeset
|
1204 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1205 | return g_object_new(PURPLE_TYPE_STATUS, |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35011
diff
changeset
|
1206 | "status-type", status_type, |
|
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35011
diff
changeset
|
1207 | "presence", presence, |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1208 | NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1209 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1210 | |
| 6065 | 1211 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1212 | /************************************************************************** |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1213 | * Status subsystem |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1214 | **************************************************************************/ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1215 | static void |
| 15884 | 1216 | score_pref_changed_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12797
diff
changeset
|
1217 | gconstpointer value, gpointer data) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1218 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1219 | int index = GPOINTER_TO_INT(data); |
| 6065 | 1220 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1221 | primitive_scores[index] = GPOINTER_TO_INT(value); |
| 6065 | 1222 | } |
| 1223 | ||
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1224 | void * |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1225 | purple_statuses_get_handle(void) { |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1226 | static int handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1227 | |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1228 | return &handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1229 | } |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1230 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1231 | void |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1232 | purple_statuses_init(void) |
| 6065 | 1233 | { |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
1234 | void *handle = purple_statuses_get_handle(); |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1235 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1236 | purple_prefs_add_none("/purple/status"); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1237 | purple_prefs_add_none("/purple/status/scores"); |
| 6065 | 1238 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1239 | purple_prefs_add_int("/purple/status/scores/offline", |
| 15884 | 1240 | primitive_scores[PURPLE_STATUS_OFFLINE]); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1241 | purple_prefs_add_int("/purple/status/scores/available", |
| 15884 | 1242 | primitive_scores[PURPLE_STATUS_AVAILABLE]); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1243 | purple_prefs_add_int("/purple/status/scores/invisible", |
| 15884 | 1244 | primitive_scores[PURPLE_STATUS_INVISIBLE]); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1245 | purple_prefs_add_int("/purple/status/scores/away", |
| 15884 | 1246 | primitive_scores[PURPLE_STATUS_AWAY]); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1247 | purple_prefs_add_int("/purple/status/scores/extended_away", |
| 15884 | 1248 | primitive_scores[PURPLE_STATUS_EXTENDED_AWAY]); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1249 | purple_prefs_add_int("/purple/status/scores/idle", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1250 | primitive_scores[SCORE_IDLE]); |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
1251 | purple_prefs_add_int("/purple/status/scores/idle_time", |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
1252 | primitive_scores[SCORE_IDLE_TIME]); |
|
16857
10072d5790f4
Give offline buddies that support offline messaging a higher score than offline buddies that don't.
Sean Egan <seanegan@pidgin.im>
parents:
16856
diff
changeset
|
1253 | purple_prefs_add_int("/purple/status/scores/offline_msg", |
|
10072d5790f4
Give offline buddies that support offline messaging a higher score than offline buddies that don't.
Sean Egan <seanegan@pidgin.im>
parents:
16856
diff
changeset
|
1254 | primitive_scores[SCORE_OFFLINE_MESSAGE]); |
| 6065 | 1255 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1256 | purple_prefs_connect_callback(handle, "/purple/status/scores/offline", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1257 | score_pref_changed_cb, |
| 15884 | 1258 | GINT_TO_POINTER(PURPLE_STATUS_OFFLINE)); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1259 | purple_prefs_connect_callback(handle, "/purple/status/scores/available", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1260 | score_pref_changed_cb, |
| 15884 | 1261 | GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE)); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1262 | purple_prefs_connect_callback(handle, "/purple/status/scores/invisible", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1263 | score_pref_changed_cb, |
| 15884 | 1264 | GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE)); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1265 | purple_prefs_connect_callback(handle, "/purple/status/scores/away", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1266 | score_pref_changed_cb, |
| 15884 | 1267 | GINT_TO_POINTER(PURPLE_STATUS_AWAY)); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1268 | purple_prefs_connect_callback(handle, "/purple/status/scores/extended_away", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1269 | score_pref_changed_cb, |
| 15884 | 1270 | GINT_TO_POINTER(PURPLE_STATUS_EXTENDED_AWAY)); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
1271 | purple_prefs_connect_callback(handle, "/purple/status/scores/idle", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1272 | score_pref_changed_cb, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1273 | GINT_TO_POINTER(SCORE_IDLE)); |
|
34856
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1274 | purple_prefs_connect_callback(handle, "/purple/status/scores/idle_time", |
|
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1275 | score_pref_changed_cb, |
|
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1276 | GINT_TO_POINTER(SCORE_IDLE_TIME)); |
|
16857
10072d5790f4
Give offline buddies that support offline messaging a higher score than offline buddies that don't.
Sean Egan <seanegan@pidgin.im>
parents:
16856
diff
changeset
|
1277 | purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg", |
|
10072d5790f4
Give offline buddies that support offline messaging a higher score than offline buddies that don't.
Sean Egan <seanegan@pidgin.im>
parents:
16856
diff
changeset
|
1278 | score_pref_changed_cb, |
|
10072d5790f4
Give offline buddies that support offline messaging a higher score than offline buddies that don't.
Sean Egan <seanegan@pidgin.im>
parents:
16856
diff
changeset
|
1279 | GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE)); |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1280 | |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1281 | purple_prefs_trigger_callback("/purple/status/scores/offline"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1282 | purple_prefs_trigger_callback("/purple/status/scores/available"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1283 | purple_prefs_trigger_callback("/purple/status/scores/invisible"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1284 | purple_prefs_trigger_callback("/purple/status/scores/away"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1285 | purple_prefs_trigger_callback("/purple/status/scores/extended_away"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1286 | purple_prefs_trigger_callback("/purple/status/scores/idle"); |
|
34856
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1287 | purple_prefs_trigger_callback("/purple/status/scores/idle_time"); |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1288 | purple_prefs_trigger_callback("/purple/status/scores/offline_msg"); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1289 | } |
| 6065 | 1290 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1291 | void |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1292 | purple_statuses_uninit(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1293 | { |
|
40572
ff16d3fc907e
Fix a bug where we tell the preferences to disconnect the wrong signals
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
1294 | purple_prefs_disconnect_by_handle(purple_statuses_get_handle()); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1295 | } |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1296 | |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1297 | /**************************************************************************/ |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1298 | /* Helpers */ |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1299 | /**************************************************************************/ |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1300 | GHashTable * |
|
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1301 | purple_attrs_from_vargs(va_list args) |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1302 | { |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1303 | GHashTable *attrs = g_hash_table_new(g_str_hash, g_str_equal); |
|
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1304 | gchar *id; |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1305 | |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1306 | while ((id = va_arg(args, gchar *)) != NULL) |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1307 | { |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1308 | gpointer data = va_arg(args, gpointer); |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1309 | |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1310 | g_hash_table_insert(attrs, id, data); |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1311 | } |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1312 | |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1313 | return attrs; |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1314 | } |