Thu, 22 Feb 2024 06:03:16 -0600
Add a favorite property to PurpleContactInfo
This will be used in the future for toggling whether or not contacts are
favorited or starred.
Testing Done:
Ran the unit tests under valgrind.
Reviewed at https://reviews.imfreedom.org/r/2965/
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
1 | /* |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
| 6065 | 4 | * |
| 15884 | 5 | * Purple is the legal property of its developers, whose names are too numerous |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 8046 | 7 | * source distribution. |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9791
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
12 | * any later version. |
| 6065 | 13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
17 | * more details. |
| 6065 | 18 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42584
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
| 6065 | 21 | */ |
|
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
|
22 | |
|
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 | #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
|
24 | |
|
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" |
|
42557
e868bfcc092a
Only include headers when they're necessary for header files
Gary Kramlich <grim@reaperworld.com>
parents:
42478
diff
changeset
|
32 | #include "protocols.h" |
|
40537
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
33 | #include "purpleaccountpresence.h" |
|
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
34 | #include "purplebuddypresence.h" |
| 6065 | 35 | #include "status.h" |
| 36 | ||
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
37 | /* |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
38 | * A type of status. |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
39 | */ |
| 15884 | 40 | struct _PurpleStatusType |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
41 | { |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
42 | 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
|
43 | |
| 15884 | 44 | PurpleStatusPrimitive primitive; |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
45 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
46 | char *id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
47 | char *name; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
48 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
49 | gboolean saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
50 | gboolean user_settable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
51 | gboolean independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
52 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
53 | GList *attrs; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
54 | }; |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
55 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
56 | /* |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
57 | * A status attribute. |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
58 | */ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
59 | struct _PurpleStatusAttribute |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
60 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
61 | char *id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
62 | 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
|
63 | GValue *value_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
64 | }; |
| 6065 | 65 | |
|
39543
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
66 | struct _PurpleStatus |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
67 | { |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
68 | GObject parent; |
|
b72187eb4335
Use G_DECLARE_FINAL_TYPE for PurpleStatus.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39514
diff
changeset
|
69 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
70 | PurpleStatusType *status_type; |
| 15884 | 71 | PurplePresence *presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
72 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
73 | gboolean active; |
| 6065 | 74 | |
|
23236
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
75 | /* |
|
e6acfffcc51b
Borrow a reference to a string instead of g_strdup'ing it. The
Mark Doliner <markdoliner@pidgin.im>
parents:
22793
diff
changeset
|
76 | * 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
|
77 | * 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
|
78 | * 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
|
79 | * 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
|
80 | */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
81 | GHashTable *attr_values; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
82 | }; |
| 6065 | 83 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
84 | /* GObject property enums */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
85 | enum |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
86 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
87 | PROP_0, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
88 | PROP_STATUS_TYPE, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
89 | PROP_PRESENCE, |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
90 | PROP_ACTIVE, |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42576
diff
changeset
|
91 | N_PROPERTIES, |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
92 | }; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
93 | |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42576
diff
changeset
|
94 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
95 | |
|
42576
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
96 | G_DEFINE_FINAL_TYPE(PurpleStatus, purple_status, G_TYPE_OBJECT) |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39352
diff
changeset
|
97 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
98 | static int primitive_scores[] = |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
99 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
100 | 0, /* unset */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
101 | -500, /* offline */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
102 | 100, /* available */ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
103 | -75, /* unavailable */ |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
104 | -50, /* invisible */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
105 | -100, /* away */ |
|
10860
8f600347b9e4
[gaim-migrate @ 12543]
Palmer Cox <enix@users.sourceforge.net>
parents:
10760
diff
changeset
|
106 | -200, /* extended away */ |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
107 | -400, /* mobile */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
108 | -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
|
109 | -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
|
110 | 10 /* Offline messageable */ |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
111 | }; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
112 | |
|
42478
0f3a16f3ce7f
Fix warnings from clang
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42164
diff
changeset
|
113 | enum { |
|
0f3a16f3ce7f
Fix warnings from clang
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42164
diff
changeset
|
114 | SCORE_IDLE = PURPLE_STATUS_NUM_PRIMITIVES, |
|
0f3a16f3ce7f
Fix warnings from clang
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42164
diff
changeset
|
115 | SCORE_IDLE_TIME, |
|
0f3a16f3ce7f
Fix warnings from clang
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42164
diff
changeset
|
116 | SCORE_OFFLINE_MESSAGE, |
|
0f3a16f3ce7f
Fix warnings from clang
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42164
diff
changeset
|
117 | }; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
118 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
119 | /************************************************************************** |
| 15884 | 120 | * PurpleStatusPrimitive API |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
121 | **************************************************************************/ |
| 15884 | 122 | static struct PurpleStatusPrimitiveMap |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
123 | { |
| 15884 | 124 | PurpleStatusPrimitive type; |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
125 | const char *id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
126 | const char *name; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
127 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
128 | } const status_primitive_map[] = |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
129 | { |
|
24907
13118548c74c
Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents:
23389
diff
changeset
|
130 | { 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
|
131 | { 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
|
132 | { 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
|
133 | { 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
|
134 | { 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
|
135 | { 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
|
136 | { 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
|
137 | { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") }, |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
138 | }; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
139 | |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
140 | int * |
|
35091
cb6e94789b5a
Moved declaerations of shared private functions to internal.h
Ankit Vani <a@nevitus.org>
parents:
35085
diff
changeset
|
141 | _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
|
142 | { |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
143 | 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
|
144 | } |
|
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
145 | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
146 | const char * |
| 15884 | 147 | purple_primitive_get_id_from_type(PurpleStatusPrimitive type) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
148 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
149 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
150 | |
| 15884 | 151 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
152 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
153 | if (type == status_primitive_map[i].type) |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
154 | return status_primitive_map[i].id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
155 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
156 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
157 | return status_primitive_map[0].id; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
158 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
159 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
160 | const char * |
| 15884 | 161 | purple_primitive_get_name_from_type(PurpleStatusPrimitive type) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
162 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
163 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
164 | |
| 15884 | 165 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
166 | { |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
167 | if (type == status_primitive_map[i].type) |
|
13249
b3cc208601b5
[gaim-migrate @ 15614]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13193
diff
changeset
|
168 | return _(status_primitive_map[i].name); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
169 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
170 | |
|
13249
b3cc208601b5
[gaim-migrate @ 15614]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13193
diff
changeset
|
171 | return _(status_primitive_map[0].name); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
172 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
173 | |
| 15884 | 174 | PurpleStatusPrimitive |
| 175 | purple_primitive_get_type_from_id(const char *id) | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
176 | { |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
177 | int i; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
178 | |
| 15884 | 179 | g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
180 | |
| 15884 | 181 | for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
182 | { |
|
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
|
183 | if (purple_strequal(id, status_primitive_map[i].id)) |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
184 | return status_primitive_map[i].type; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
185 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
186 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
187 | return status_primitive_map[0].type; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
188 | } |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
189 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
190 | |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
191 | /************************************************************************** |
| 15884 | 192 | * PurpleStatusType API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
193 | **************************************************************************/ |
| 15884 | 194 | PurpleStatusType * |
| 195 | purple_status_type_new_full(PurpleStatusPrimitive primitive, const char *id, | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
196 | const char *name, gboolean saveable, |
|
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
197 | gboolean user_settable, gboolean independent) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
198 | { |
| 15884 | 199 | PurpleStatusType *status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
200 | |
| 15884 | 201 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
202 | |
| 15884 | 203 | status_type = g_new0(PurpleStatusType, 1); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
204 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
205 | status_type->primitive = primitive; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
206 | status_type->saveable = saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
207 | status_type->user_settable = user_settable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
208 | status_type->independent = independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
209 | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
210 | if (id != NULL) |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
211 | status_type->id = g_strdup(id); |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
212 | else |
| 15884 | 213 | 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
|
214 | |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
215 | if (name != NULL) |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
216 | status_type->name = g_strdup(name); |
|
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12587
diff
changeset
|
217 | else |
| 15884 | 218 | 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
|
219 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
220 | return status_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
221 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
222 | |
| 15884 | 223 | PurpleStatusType * |
| 224 | purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, | |
|
10009
8a4fcc043f47
[gaim-migrate @ 10926]
Mark Doliner <markdoliner@pidgin.im>
parents:
10006
diff
changeset
|
225 | const char *name, gboolean user_settable) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
226 | { |
| 15884 | 227 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
228 | |
|
25445
b36f23e05c50
Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <datallah@pidgin.im>
parents:
23389
diff
changeset
|
229 | return purple_status_type_new_full(primitive, id, name, TRUE, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
230 | user_settable, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
231 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
232 | |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
233 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
234 | 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
|
235 | const char *name, GValue *value) |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
236 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
237 | PurpleStatusAttribute *attr; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
238 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
239 | g_return_if_fail(status_type != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
240 | g_return_if_fail(id != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
241 | g_return_if_fail(name != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
242 | g_return_if_fail(value != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
243 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
244 | 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
|
245 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
246 | 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
|
247 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
248 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
249 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
250 | 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
|
251 | { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
252 | 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
|
253 | GValue *value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
254 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
255 | g_return_if_fail(status_type != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
256 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
257 | while ((id = va_arg(args, const char *)) != NULL) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
258 | { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
259 | name = va_arg(args, const char *); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
260 | g_return_if_fail(name != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
261 | |
|
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
|
262 | value = va_arg(args, GValue *); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
263 | g_return_if_fail(value != NULL); |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
264 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
265 | 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
|
266 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
267 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
268 | |
| 15884 | 269 | PurpleStatusType * |
| 270 | purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
271 | const char *id, const char *name, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
272 | gboolean saveable, gboolean user_settable, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
273 | 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
|
274 | const char *attr_name, GValue *attr_value, |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
275 | ...) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
276 | { |
| 15884 | 277 | PurpleStatusType *status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
278 | va_list args; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
279 | |
| 15884 | 280 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
| 10012 | 281 | g_return_val_if_fail(attr_id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
282 | g_return_val_if_fail(attr_name != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
283 | g_return_val_if_fail(attr_value != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
284 | |
| 15884 | 285 | 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
|
286 | user_settable, independent); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
287 | |
|
10010
d9ee01f0659a
[gaim-migrate @ 10927]
Mark Doliner <markdoliner@pidgin.im>
parents:
10009
diff
changeset
|
288 | /* Add the first attribute */ |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
289 | 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
|
290 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
291 | va_start(args, attr_value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
292 | status_type_add_attrs_vargs(status_type, args); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
293 | va_end(args); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
294 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
295 | return status_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
296 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
297 | |
|
41760
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
298 | PurpleStatusType * |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
299 | purple_status_type_new_with_attrsv(PurpleStatusPrimitive primitive, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
300 | const char *id, const char *name, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
301 | gboolean saveable, gboolean user_settable, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
302 | gboolean independent, guint n_attributes, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
303 | const char *attr_id[], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
304 | const char *attr_name[], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
305 | GValue *attr_value[]) |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
306 | { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
307 | PurpleStatusType *status_type; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
308 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
309 | g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
310 | g_return_val_if_fail(attr_id != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
311 | g_return_val_if_fail(attr_name != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
312 | g_return_val_if_fail(attr_value != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
313 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
314 | status_type = purple_status_type_new_full(primitive, id, name, saveable, |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
315 | user_settable, independent); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
316 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
317 | for(guint i = 0; i < n_attributes; i++) { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
318 | if(attr_id[i] == NULL || attr_name[i] == NULL || |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
319 | attr_value[i] == NULL) |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
320 | { |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
321 | purple_status_type_destroy(status_type); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
322 | g_return_val_if_fail(attr_id[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
323 | g_return_val_if_fail(attr_name[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
324 | g_return_val_if_fail(attr_value[i] != NULL, NULL); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
325 | return NULL; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
326 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
327 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
328 | status_type_add_attr(status_type, attr_id[i], attr_name[i], |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
329 | attr_value[i]); |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
330 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
331 | |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
332 | return status_type; |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
333 | } |
|
50a483611feb
Add introspectable version of purple_status_type_new_with_attrs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41726
diff
changeset
|
334 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
335 | void |
| 15884 | 336 | purple_status_type_destroy(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_if_fail(status_type != 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 | g_free(status_type->id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
341 | g_free(status_type->name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
342 | |
|
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
|
343 | 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
|
344 | (GDestroyNotify)purple_status_attribute_destroy); |
|
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_free(status_type); |
|
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 | |
| 15884 | 349 | PurpleStatusPrimitive |
| 350 | purple_status_type_get_primitive(const PurpleStatusType *status_type) | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
351 | { |
| 15884 | 352 | 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
|
353 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
354 | return status_type->primitive; |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
357 | const char * |
| 15884 | 358 | purple_status_type_get_id(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
359 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
360 | g_return_val_if_fail(status_type != NULL, NULL); |
|
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 | return status_type->id; |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
365 | const char * |
| 15884 | 366 | purple_status_type_get_name(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
367 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
368 | g_return_val_if_fail(status_type != NULL, NULL); |
|
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 | return status_type->name; |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
373 | gboolean |
| 15884 | 374 | purple_status_type_is_saveable(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
375 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
376 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
377 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
378 | return status_type->saveable; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
379 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
380 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
381 | gboolean |
| 15884 | 382 | purple_status_type_is_user_settable(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
383 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
384 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
385 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
386 | return status_type->user_settable; |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
389 | gboolean |
| 15884 | 390 | purple_status_type_is_independent(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
391 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
392 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
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 | return status_type->independent; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
395 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
396 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
397 | gboolean |
| 15884 | 398 | purple_status_type_is_exclusive(const PurpleStatusType *status_type) |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
399 | { |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
400 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
401 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
402 | return !status_type->independent; |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
403 | } |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
404 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
405 | gboolean |
| 15884 | 406 | purple_status_type_is_available(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
407 | { |
| 15884 | 408 | PurpleStatusPrimitive primitive; |
|
9949
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 | g_return_val_if_fail(status_type != NULL, FALSE); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
411 | |
| 15884 | 412 | primitive = purple_status_type_get_primitive(status_type); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
413 | |
| 15884 | 414 | return (primitive == PURPLE_STATUS_AVAILABLE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
415 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
416 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
417 | PurpleStatusAttribute * |
| 15884 | 418 | 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
|
419 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
420 | GList *l; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
421 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
422 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
423 | g_return_val_if_fail(id != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
424 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
425 | for (l = status_type->attrs; l != NULL; l = l->next) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
426 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
427 | PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
428 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
429 | if (purple_strequal(purple_status_attribute_get_id(attr), id)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
430 | return attr; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
431 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
432 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
433 | return NULL; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
434 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
435 | |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
17515
diff
changeset
|
436 | GList * |
| 15884 | 437 | purple_status_type_get_attrs(const PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
438 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
439 | g_return_val_if_fail(status_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
440 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
441 | return status_type->attrs; |
|
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 | |
| 15884 | 444 | const PurpleStatusType * |
| 445 | 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
|
446 | { |
| 15884 | 447 | PurpleStatusType *status_type; |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
448 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
449 | g_return_val_if_fail(id != NULL, NULL); |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
450 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
451 | while (status_types != NULL) |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
452 | { |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
453 | status_type = status_types->data; |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
454 | |
|
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
|
455 | if (purple_strequal(id, status_type->id)) |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
456 | return status_type; |
| 10895 | 457 | |
| 458 | status_types = status_types->next; | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
459 | } |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
460 | |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
461 | return NULL; |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
462 | } |
|
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10343
diff
changeset
|
463 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
464 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
465 | /************************************************************************** |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
466 | * PurpleStatusAttribute API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
467 | **************************************************************************/ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
468 | PurpleStatusAttribute * |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
469 | 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
|
470 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
471 | PurpleStatusAttribute *attr; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
472 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
473 | g_return_val_if_fail(id != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
474 | g_return_val_if_fail(name != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
475 | g_return_val_if_fail(value_type != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
476 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
477 | attr = g_new0(PurpleStatusAttribute, 1); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
478 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
479 | attr->id = g_strdup(id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
480 | attr->name = g_strdup(name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
481 | attr->value_type = value_type; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
482 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
483 | return attr; |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
486 | void |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
487 | purple_status_attribute_destroy(PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
488 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
489 | g_return_if_fail(attr != NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
490 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
491 | g_free(attr->id); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
492 | g_free(attr->name); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
493 | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
494 | purple_value_free(attr->value_type); |
|
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_free(attr); |
|
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
499 | const char * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
500 | purple_status_attribute_get_id(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
501 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
502 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
503 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
504 | return attr->id; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
505 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
506 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
507 | const char * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
508 | purple_status_attribute_get_name(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
509 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
510 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
511 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
512 | return attr->name; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
513 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
514 | |
|
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
|
515 | GValue * |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
516 | purple_status_attribute_get_value(const PurpleStatusAttribute *attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
517 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
518 | g_return_val_if_fail(attr != NULL, NULL); |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
519 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
520 | return attr->value_type; |
|
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 | /************************************************************************** |
| 15884 | 525 | * PurpleStatus API |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
526 | **************************************************************************/ |
| 6065 | 527 | static void |
| 15884 | 528 | notify_status_update(PurplePresence *presence, PurpleStatus *old_status, |
| 529 | PurpleStatus *new_status) | |
| 6065 | 530 | { |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
531 | if (PURPLE_IS_ACCOUNT_PRESENCE(presence)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
532 | { |
|
34847
770ba2679b24
Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
533 | 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
|
534 | PURPLE_ACCOUNT_PRESENCE(presence)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
535 | |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
536 | if (purple_account_get_enabled(account)) |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
537 | purple_protocol_change_account_status(account, old_status, new_status); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
538 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
539 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
540 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
541 | static void |
| 15884 | 542 | status_has_changed(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
543 | { |
| 15884 | 544 | PurplePresence *presence; |
| 545 | PurpleStatus *old_status; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
546 | |
| 15884 | 547 | presence = purple_status_get_presence(status); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
548 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
549 | /* |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
550 | * 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
|
551 | * 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
|
552 | * active status to "inactive." |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
553 | */ |
| 15884 | 554 | if (purple_status_is_exclusive(status)) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
555 | { |
| 15884 | 556 | 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
|
557 | if (old_status != NULL && (old_status != status)) { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
558 | old_status->active = FALSE; |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
559 | 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
|
560 | 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
|
561 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
562 | } |
|
10754
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
563 | else |
|
d5f1ddb4146f
[gaim-migrate @ 12357]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
564 | old_status = NULL; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
565 | |
|
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
|
566 | 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
|
567 | 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
|
568 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
569 | notify_status_update(presence, old_status, status); |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
570 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
571 | |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
572 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
573 | 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
|
574 | gboolean value) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
575 | { |
|
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
|
576 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
577 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
578 | 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
|
579 | g_return_if_fail(id != NULL); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
580 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
581 | /* 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | |
|
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
|
586 | g_value_set_boolean(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
587 | } |
|
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 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
590 | 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
|
591 | { |
|
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
|
592 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
593 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
594 | 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
|
595 | g_return_if_fail(id != NULL); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
596 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
597 | /* 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
|
598 | 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
|
599 | 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
|
600 | 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
|
601 | |
|
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
|
602 | g_value_set_int(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
603 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
604 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
605 | static void |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
606 | 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
|
607 | const char *value) |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
608 | { |
|
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
|
609 | GValue *attr_value; |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
610 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
611 | 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
|
612 | g_return_if_fail(id != NULL); |
|
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 | /* 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
|
615 | 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
|
616 | /* 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
|
617 | * let's generate a log error for now. */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
618 | /* g_return_if_fail(attr_value != NULL); */ |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
619 | if (attr_value == NULL) { |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
620 | purple_debug_error("status", |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
621 | "Attempted to set status attribute '%s' for " |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
622 | "status '%s', which is not legal. Fix " |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
623 | "this!\n", id, |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
624 | 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
|
625 | return; |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
626 | } |
|
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
|
627 | 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
|
628 | |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
629 | /* 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
|
630 | * 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
|
631 | g_value_set_string(attr_value, value); |
|
32303
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
632 | } |
|
4fb5a17a920d
Remove deprecated PurpleStatuc functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32228
diff
changeset
|
633 | |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
634 | void |
| 15884 | 635 | purple_status_set_active(PurpleStatus *status, gboolean active) |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
636 | { |
|
41782
5fb843f4e356
Merge purple_status_set_active_with_attrs{,_dict}
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41760
diff
changeset
|
637 | purple_status_set_active_with_attributes(status, active, NULL); |
|
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 |
|
41782
5fb843f4e356
Merge purple_status_set_active_with_attrs{,_dict}
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41760
diff
changeset
|
641 | purple_status_set_active_with_attributes(PurpleStatus *status, gboolean active, |
|
5fb843f4e356
Merge purple_status_set_active_with_attrs{,_dict}
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41760
diff
changeset
|
642 | GHashTable *attrs) |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
643 | { |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
644 | 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
|
645 | GList *l; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
646 | GList *specified_attr_ids = NULL; |
| 15884 | 647 | PurpleStatusType *status_type; |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
648 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
649 | 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
|
650 | |
|
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
|
651 | if(!active && purple_status_is_exclusive(status)) { |
| 15884 | 652 | 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
|
653 | "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
|
654 | purple_status_get_id(status)); |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
655 | return; |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
656 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
657 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
658 | if(status->active != active) { |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
659 | changed = TRUE; |
|
10738
63ca8277c234
[gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents:
10714
diff
changeset
|
660 | } |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
661 | status->active = active; |
| 6065 | 662 | |
|
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
|
663 | 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
|
664 | 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
|
665 | gpointer key, data; |
|
11249
efc82f3e1bd3
[gaim-migrate @ 13418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11187
diff
changeset
|
666 | |
|
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
|
667 | /* 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
|
668 | 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
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
674 | "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
|
675 | "\"%s\" is not supported.", |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
676 | id, status->status_type->name); |
|
10713
648a49b350f2
[gaim-migrate @ 12307]
Mark Doliner <markdoliner@pidgin.im>
parents:
10580
diff
changeset
|
677 | |
|
40709
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
678 | /* 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
|
679 | 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
|
680 | } |
|
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 | |
|
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 | 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
|
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 | 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
|
685 | const gchar *string_data = (const gchar *)data; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
686 | |
|
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
|
687 | 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
|
688 | 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
|
689 | } |
|
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 | |
|
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 | 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
|
692 | 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
|
693 | } 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
|
694 | 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
|
695 | |
|
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 | 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
|
697 | 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
|
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 | |
|
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 | 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
|
701 | 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
|
702 | } 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
|
703 | 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
|
704 | |
|
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 | 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
|
706 | continue; |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
707 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
708 | |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
709 | 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
|
710 | 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
|
711 | } |
|
10204
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
712 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
713 | } |
|
874e91e2a3b3
[gaim-migrate @ 11325]
Mark Doliner <markdoliner@pidgin.im>
parents:
10200
diff
changeset
|
714 | |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
715 | /* 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
|
716 | status_type = purple_status_get_status_type(status); |
| 15884 | 717 | 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
|
718 | while(l != NULL) { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
719 | 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
|
720 | 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
|
721 | 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
|
722 | default_value = NULL; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
723 | |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
724 | 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
|
725 | l = l->next; |
|
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
726 | |
|
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
|
727 | 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
|
728 | (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
|
729 | 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
|
730 | 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
|
731 | } |
|
55f4486bf6bc
Clean up purple_status_set_active_with_attrs_dict to handle a NULL attrs dict
Gary Kramlich <grim@reaperworld.com>
parents:
40613
diff
changeset
|
732 | |
|
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 | 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
|
734 | 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
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | |
|
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 | 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
|
740 | 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
|
741 | } |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
742 | |
|
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
|
743 | 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
|
744 | } 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
|
745 | 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
|
746 | 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
|
747 | |
|
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 | 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
|
749 | 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
|
750 | } |
|
25471
e67902dda5bd
A slightly "warmenhoved" patch from Jon Turney to prevent some unnecessary
Daniel Atallah <datallah@pidgin.im>
parents:
25445
diff
changeset
|
751 | |
|
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
|
752 | 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
|
753 | } 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
|
754 | 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
|
755 | 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
|
756 | |
|
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
|
757 | 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
|
758 | continue; |
|
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 | |
|
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 | status_set_attr_boolean(status, attr->id, def); |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
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 | changed = TRUE; |
|
13374
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
764 | } |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
765 | g_list_free(specified_attr_ids); |
|
e5da5325b1fa
[gaim-migrate @ 15746]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13249
diff
changeset
|
766 | |
|
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
|
767 | 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
|
768 | 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
|
769 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
770 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
771 | |
| 15884 | 772 | 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
|
773 | purple_status_get_status_type(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
774 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
775 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
776 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
777 | return status->status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
778 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
779 | |
| 15884 | 780 | 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
|
781 | purple_status_get_presence(PurpleStatus *status) |
| 6065 | 782 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
783 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
784 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
785 | return status->presence; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
786 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
787 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
788 | 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
|
789 | purple_status_get_id(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
790 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
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 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
793 | 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
|
794 | } |
|
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 | 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
|
797 | purple_status_get_name(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
798 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
799 | g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
800 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
801 | 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
|
802 | } |
|
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 | 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
|
805 | purple_status_is_independent(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
806 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
807 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
808 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
809 | 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
|
810 | } |
|
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 | 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
|
813 | purple_status_is_exclusive(PurpleStatus *status) |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
814 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
815 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
10067
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
816 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
817 | 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
|
818 | } |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
819 | |
|
d04171b6f098
[gaim-migrate @ 11043]
Mark Doliner <markdoliner@pidgin.im>
parents:
10056
diff
changeset
|
820 | 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
|
821 | purple_status_is_available(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
822 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
823 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
824 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
825 | 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
|
826 | } |
| 6216 | 827 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
828 | 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
|
829 | purple_status_is_active(PurpleStatus *status) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
830 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
831 | g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
832 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
833 | return status->active; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
834 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
835 | |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
836 | 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
|
837 | purple_status_is_online(PurpleStatus *status) |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
838 | { |
| 15884 | 839 | PurpleStatusPrimitive primitive; |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
840 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
841 | 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
|
842 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
843 | 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
|
844 | |
| 15884 | 845 | return (primitive != PURPLE_STATUS_UNSET && |
| 846 | primitive != PURPLE_STATUS_OFFLINE); | |
|
10040
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
847 | } |
|
b74aeb350fc5
[gaim-migrate @ 10999]
Dave West <kat@users.sourceforge.net>
parents:
10013
diff
changeset
|
848 | |
|
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
|
849 | 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
|
850 | purple_status_get_attr_value(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
851 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39543
diff
changeset
|
852 | 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
|
853 | g_return_val_if_fail(id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
854 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
855 | return (GValue *)g_hash_table_lookup(status->attr_values, id); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
856 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
857 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
858 | 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
|
859 | purple_status_get_attr_boolean(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
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 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
862 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34858
diff
changeset
|
863 | 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
|
864 | g_return_val_if_fail(id != NULL, FALSE); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
865 | |
| 15884 | 866 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
867 | return FALSE; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
868 | |
|
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
|
869 | 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
|
870 | |
|
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
|
871 | return g_value_get_boolean(value); |
|
9949
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
874 | 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
|
875 | purple_status_get_attr_int(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
876 | { |
|
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
|
877 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
878 | |
|
34983
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(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
|
880 | g_return_val_if_fail(id != NULL, 0); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
881 | |
| 15884 | 882 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
| 10507 | 883 | return 0; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
884 | |
|
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
|
885 | 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
|
886 | |
|
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
|
887 | return g_value_get_int(value); |
|
9949
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
890 | 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
|
891 | purple_status_get_attr_string(PurpleStatus *status, const char *id) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
892 | { |
|
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
|
893 | const GValue *value; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
894 | |
|
34983
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(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
|
896 | g_return_val_if_fail(id != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
897 | |
| 15884 | 898 | if ((value = purple_status_get_attr_value(status, id)) == NULL) |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10500
diff
changeset
|
899 | return NULL; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
900 | |
|
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
|
901 | 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
|
902 | |
|
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
|
903 | return g_value_get_string(value); |
|
9949
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 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
906 | 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
|
907 | purple_status_compare(PurpleStatus *status1, PurpleStatus *status2) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
908 | { |
| 15884 | 909 | PurpleStatusType *type1, *type2; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
910 | int score1 = 0, score2 = 0; |
| 6065 | 911 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
912 | if ((status1 == NULL && status2 == NULL) || |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
913 | (status1 == status2)) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
914 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
915 | return 0; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
916 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
917 | else if (status1 == NULL) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
918 | return 1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
919 | else if (status2 == NULL) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
920 | return -1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
921 | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
922 | type1 = purple_status_get_status_type(status1); |
|
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
923 | type2 = purple_status_get_status_type(status2); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
924 | |
| 15884 | 925 | if (purple_status_is_active(status1)) |
| 926 | score1 = primitive_scores[purple_status_type_get_primitive(type1)]; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
927 | |
| 15884 | 928 | if (purple_status_is_active(status2)) |
| 929 | score2 = primitive_scores[purple_status_type_get_primitive(type2)]; | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
930 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
931 | if (score1 > score2) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
932 | return -1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
933 | else if (score1 < score2) |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
934 | return 1; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
935 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
936 | return 0; |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
937 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
938 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
939 | |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
940 | /************************************************************************** |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
941 | * GBoxed code for PurpleStatusType |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
942 | **************************************************************************/ |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
943 | 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
|
944 | purple_status_type_ref(PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
945 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
946 | g_return_val_if_fail(status_type != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
947 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
948 | status_type->box_count++; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
949 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
950 | return status_type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
951 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
952 | |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
953 | 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
|
954 | purple_status_type_unref(PurpleStatusType *status_type) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
955 | { |
|
35598
a7891d305408
Use a box reference count for PurpleStatusType's GBoxed copy and free functions
Ankit Vani <a@nevitus.org>
parents:
35466
diff
changeset
|
956 | 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
|
957 | g_return_if_fail(status_type->box_count >= 0); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
958 | |
|
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 | 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
|
960 | purple_status_type_destroy(status_type); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
961 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
962 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
963 | GType |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
964 | purple_status_type_get_type(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
965 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
966 | static GType type = 0; |
| 6216 | 967 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
968 | if (type == 0) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
969 | 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
|
970 | (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
|
971 | (GBoxedFreeFunc)purple_status_type_unref); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
972 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
973 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
974 | return type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
975 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
976 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
977 | /************************************************************************** |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
978 | * GBoxed code for PurpleStatusAttribute |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
979 | **************************************************************************/ |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
980 | static PurpleStatusAttribute * |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
981 | purple_status_attribute_copy(PurpleStatusAttribute *status_attr) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
982 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
983 | g_return_val_if_fail(status_attr != NULL, NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
984 | |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
985 | 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
|
986 | status_attr->name, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
987 | purple_value_dup(status_attr->value_type)); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
988 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
989 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
990 | GType |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
991 | purple_status_attribute_get_type(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
992 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
993 | static GType type = 0; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
994 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
995 | if (type == 0) { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
996 | type = g_boxed_type_register_static("PurpleStatusAttribute", |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
997 | (GBoxedCopyFunc)purple_status_attribute_copy, |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
998 | (GBoxedFreeFunc)purple_status_attribute_destroy); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
999 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1000 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1001 | return type; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1002 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1003 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1004 | /************************************************************************** |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1005 | * GObject code |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1006 | **************************************************************************/ |
|
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 | /* Set method for GObject properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1009 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1010 | 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
|
1011 | GParamSpec *pspec) |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1012 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1013 | PurpleStatus *status = PURPLE_STATUS(obj); |
| 12145 | 1014 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1015 | switch (param_id) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1016 | case PROP_STATUS_TYPE: |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1017 | status->status_type = g_value_get_pointer(value); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1018 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1019 | case PROP_PRESENCE: |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1020 | status->presence = g_value_get_object(value); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1021 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1022 | case PROP_ACTIVE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1023 | 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
|
1024 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1025 | default: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1026 | 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
|
1027 | break; |
|
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 | } |
|
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
|
1030 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1031 | /* Get method for GObject properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1032 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1033 | 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
|
1034 | GParamSpec *pspec) |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1035 | { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1036 | PurpleStatus *status = PURPLE_STATUS(obj); |
|
11975
0abdd0c63f0f
[gaim-migrate @ 14268]
Mark Doliner <markdoliner@pidgin.im>
parents:
11973
diff
changeset
|
1037 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1038 | switch (param_id) { |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1039 | case PROP_STATUS_TYPE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1040 | 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
|
1041 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1042 | case PROP_PRESENCE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1043 | 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
|
1044 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1045 | case PROP_ACTIVE: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1046 | 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
|
1047 | break; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1048 | default: |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1049 | 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
|
1050 | break; |
|
11551
ba20005d8f78
[gaim-migrate @ 13806]
Luke Schierer <lschiere@pidgin.im>
parents:
11522
diff
changeset
|
1051 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1052 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1053 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1054 | /* GObject initialization function */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1055 | 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
|
1056 | purple_status_init(PurpleStatus *status) |
|
10006
800a81666868
[gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents:
9949
diff
changeset
|
1057 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1058 | status->attr_values = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1059 | (GDestroyNotify)purple_value_free); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1060 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1061 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1062 | /* Called when done constructing */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1063 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1064 | purple_status_constructed(GObject *object) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1065 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1066 | PurpleStatus *status = PURPLE_STATUS(object); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1067 | GList *l; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1068 | |
|
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
|
1069 | G_OBJECT_CLASS(purple_status_parent_class)->constructed(object); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1070 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1071 | for (l = purple_status_type_get_attrs(status->status_type); l != NULL; l = l->next) |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1072 | { |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1073 | PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data; |
|
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1074 | 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
|
1075 | GValue *new_value = purple_value_dup(value); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1076 | |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1077 | g_hash_table_insert(status->attr_values, |
|
34858
28ac3a0418f1
Renamed PurpleStatusAttr to PurpleStatusAttribute for simplicity.
Ankit Vani <a@nevitus.org>
parents:
34857
diff
changeset
|
1078 | (char *)purple_status_attribute_get_id(attr), |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1079 | new_value); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1080 | } |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1081 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1082 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1083 | /* |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1084 | * GObject finalize function |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1085 | * 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
|
1086 | * remove it from the PurplePresence? |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1087 | */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1088 | 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
|
1089 | purple_status_finalize(GObject *obj) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1090 | { |
|
41726
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1091 | PurpleStatus *status = PURPLE_STATUS(obj); |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1092 | |
|
7b804aa31355
De-privatize PurpleStatus
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
1093 | g_hash_table_destroy(status->attr_values); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1094 | |
|
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
|
1095 | G_OBJECT_CLASS(purple_status_parent_class)->finalize(obj); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1096 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1097 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1098 | /* Class initializer function */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1099 | static void |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1100 | purple_status_class_init(PurpleStatusClass *klass) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1101 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1102 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1103 | |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1104 | obj_class->finalize = purple_status_finalize; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1105 | obj_class->constructed = purple_status_constructed; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1106 | |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1107 | /* Setup properties */ |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1108 | obj_class->get_property = purple_status_get_property; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1109 | obj_class->set_property = purple_status_set_property; |
|
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1110 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1111 | 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
|
1112 | "Status type", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35018
diff
changeset
|
1113 | "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
|
1114 | 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
|
1115 | G_PARAM_STATIC_STRINGS); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1116 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1117 | 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
|
1118 | "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
|
1119 | 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
|
1120 | 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
|
1121 | G_PARAM_STATIC_STRINGS); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1122 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1123 | 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
|
1124 | "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
|
1125 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1126 | |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42576
diff
changeset
|
1127 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1128 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1129 | |
| 15884 | 1130 | PurpleStatus * |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1131 | purple_status_new(PurpleStatusType *status_type, PurplePresence *presence) |
| 6065 | 1132 | { |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1133 | 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
|
1134 | 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
|
1135 | |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1136 | 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
|
1137 | "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
|
1138 | "presence", presence, |
|
34857
cfe2b7ce3421
Added GObject code to status.[ch]
Ankit Vani <a@nevitus.org>
parents:
34856
diff
changeset
|
1139 | NULL); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1140 | } |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1141 | |
| 6065 | 1142 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1143 | /************************************************************************** |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1144 | * Status subsystem |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1145 | **************************************************************************/ |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1146 | static void |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41895
diff
changeset
|
1147 | score_pref_changed_cb(G_GNUC_UNUSED const char *name, |
|
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41895
diff
changeset
|
1148 | G_GNUC_UNUSED PurplePrefType type, gconstpointer value, |
|
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41895
diff
changeset
|
1149 | gpointer data) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1150 | { |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1151 | int index = GPOINTER_TO_INT(data); |
| 6065 | 1152 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1153 | primitive_scores[index] = GPOINTER_TO_INT(value); |
| 6065 | 1154 | } |
| 1155 | ||
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1156 | void * |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1157 | purple_statuses_get_handle(void) { |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1158 | static int handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1159 | |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1160 | return &handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1161 | } |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1162 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1163 | void |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1164 | purple_statuses_init(void) |
| 6065 | 1165 | { |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34854
diff
changeset
|
1166 | void *handle = purple_statuses_get_handle(); |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10077
diff
changeset
|
1167 | |
|
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
|
1168 | 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
|
1169 | purple_prefs_add_none("/purple/status/scores"); |
| 6065 | 1170 | |
|
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
|
1171 | purple_prefs_add_int("/purple/status/scores/offline", |
| 15884 | 1172 | 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
|
1173 | purple_prefs_add_int("/purple/status/scores/available", |
| 15884 | 1174 | 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
|
1175 | purple_prefs_add_int("/purple/status/scores/invisible", |
| 15884 | 1176 | 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
|
1177 | purple_prefs_add_int("/purple/status/scores/away", |
| 15884 | 1178 | 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
|
1179 | purple_prefs_add_int("/purple/status/scores/extended_away", |
| 15884 | 1180 | 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
|
1181 | purple_prefs_add_int("/purple/status/scores/idle", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1182 | 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
|
1183 | 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
|
1184 | 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
|
1185 | 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
|
1186 | primitive_scores[SCORE_OFFLINE_MESSAGE]); |
| 6065 | 1187 | |
|
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
|
1188 | purple_prefs_connect_callback(handle, "/purple/status/scores/offline", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1189 | score_pref_changed_cb, |
| 15884 | 1190 | 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
|
1191 | purple_prefs_connect_callback(handle, "/purple/status/scores/available", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1192 | score_pref_changed_cb, |
| 15884 | 1193 | 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
|
1194 | purple_prefs_connect_callback(handle, "/purple/status/scores/invisible", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1195 | score_pref_changed_cb, |
| 15884 | 1196 | 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
|
1197 | purple_prefs_connect_callback(handle, "/purple/status/scores/away", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1198 | score_pref_changed_cb, |
| 15884 | 1199 | 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
|
1200 | purple_prefs_connect_callback(handle, "/purple/status/scores/extended_away", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1201 | score_pref_changed_cb, |
| 15884 | 1202 | 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
|
1203 | purple_prefs_connect_callback(handle, "/purple/status/scores/idle", |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1204 | score_pref_changed_cb, |
|
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1205 | GINT_TO_POINTER(SCORE_IDLE)); |
|
34856
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1206 | 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
|
1207 | score_pref_changed_cb, |
|
2c190f625652
Some refactoring for GObject status API.
Ankit Vani <a@nevitus.org>
parents:
34855
diff
changeset
|
1208 | 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
|
1209 | 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
|
1210 | 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
|
1211 | GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE)); |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1212 | |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1213 | purple_prefs_trigger_callback("/purple/status/scores/offline"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1214 | purple_prefs_trigger_callback("/purple/status/scores/available"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1215 | purple_prefs_trigger_callback("/purple/status/scores/invisible"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1216 | purple_prefs_trigger_callback("/purple/status/scores/away"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1217 | purple_prefs_trigger_callback("/purple/status/scores/extended_away"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1218 | 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
|
1219 | purple_prefs_trigger_callback("/purple/status/scores/idle_time"); |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
1220 | purple_prefs_trigger_callback("/purple/status/scores/offline_msg"); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1221 | } |
| 6065 | 1222 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1223 | void |
|
34854
8417ea6a9235
Started GObjectification of PurpleStatus.
Ankit Vani <a@nevitus.org>
parents:
34851
diff
changeset
|
1224 | purple_statuses_uninit(void) |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1225 | { |
|
40572
ff16d3fc907e
Fix a bug where we tell the preferences to disconnect the wrong signals
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
1226 | purple_prefs_disconnect_by_handle(purple_statuses_get_handle()); |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9944
diff
changeset
|
1227 | } |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1228 | |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1229 | /**************************************************************************/ |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1230 | /* Helpers */ |
|
40327
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1231 | /**************************************************************************/ |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1232 | GHashTable * |
|
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1233 | 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
|
1234 | { |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1235 | 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
|
1236 | 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
|
1237 | |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1238 | 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
|
1239 | { |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1240 | 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
|
1241 | |
|
40328
45e719e8d3bc
Replace lists of PurpleAttr with GHashTable
qarkai <qarkai@gmail.com>
parents:
40327
diff
changeset
|
1242 | 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
|
1243 | } |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1244 | |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1245 | return attrs; |
|
4caeb8c0b1ca
Add PurpleAttr to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents:
40195
diff
changeset
|
1246 | } |