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