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