Mon, 30 Jun 2025 14:22:13 -0500
Update the flatpak to gnome 48 and to the matching birb version
The birb version was missed here when it was updated.
Testing Done:
Built the flatpak with the instructions in the readme.
Reviewed at https://reviews.imfreedom.org/r/4038/
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
7 | * source distribution. |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
12 | * any later version. |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
17 | * more details. |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
18 | * |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purpleavatar.h" |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | struct _PurpleAvatar { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | GObject parent; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | char *filename; |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
29 | |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | GdkPixbuf *pixbuf; |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
31 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
32 | gboolean animated; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
33 | GdkPixbufAnimation *animation; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
34 | |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PurpleTags *tags; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | }; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | enum { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | PROP_0, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PROP_FILENAME, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PROP_PIXBUF, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
42 | PROP_ANIMATED, |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
43 | PROP_ANIMATION, |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_TAGS, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | N_PROPERTIES, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | }; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | /****************************************************************************** |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
50 | * Helpers |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
51 | *****************************************************************************/ |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
52 | static void |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
53 | purple_avatar_set_filename(PurpleAvatar *avatar, const char *filename) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
54 | g_return_if_fail(PURPLE_IS_AVATAR(avatar)); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
55 | |
|
42767
8cf1d11b59c1
Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42613
diff
changeset
|
56 | if(g_set_str(&avatar->filename, filename)) { |
|
8cf1d11b59c1
Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42613
diff
changeset
|
57 | g_object_notify_by_pspec(G_OBJECT(avatar), properties[PROP_FILENAME]); |
|
8cf1d11b59c1
Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42613
diff
changeset
|
58 | } |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
59 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
60 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
61 | static PurpleAvatar * |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
62 | purple_avatar_new_common(const char *filename, GdkPixbufAnimation *animation) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
63 | PurpleAvatar *avatar = NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
64 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
65 | avatar = g_object_new(PURPLE_TYPE_AVATAR, "filename", filename, NULL); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
66 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
67 | if(gdk_pixbuf_animation_is_static_image(animation)) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
68 | /* If we loaded a static image, grab the static image and set it to our |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
69 | * pixbuf member, clear the animation, and return the new avatar. |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
70 | */ |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
71 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
72 | avatar->pixbuf = gdk_pixbuf_animation_get_static_image(animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
73 | g_object_ref(avatar->pixbuf); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
74 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
75 | g_clear_object(&animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
76 | } else { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
77 | /* If we did load an animation, set the appropriate properties and |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
78 | * return the avatar. |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
79 | */ |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
80 | avatar->animated = TRUE; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
81 | avatar->animation = animation; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
82 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
83 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
84 | return avatar; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
85 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
86 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
87 | /****************************************************************************** |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | * GObject Implementation |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | *****************************************************************************/ |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
90 | G_DEFINE_FINAL_TYPE(PurpleAvatar, purple_avatar, G_TYPE_OBJECT) |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
91 | |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | static void |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | purple_avatar_get_property(GObject *obj, guint param_id, GValue *value, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | GParamSpec *pspec) |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | PurpleAvatar *avatar = PURPLE_AVATAR(obj); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | switch(param_id) { |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
99 | case PROP_FILENAME: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
100 | g_value_set_string(value, purple_avatar_get_filename(avatar)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
101 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
102 | case PROP_PIXBUF: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
103 | g_value_set_object(value, purple_avatar_get_pixbuf(avatar)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
104 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
105 | case PROP_ANIMATED: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
106 | g_value_set_boolean(value, purple_avatar_get_animated(avatar)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
107 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
108 | case PROP_ANIMATION: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
109 | g_value_set_object(value, purple_avatar_get_animation(avatar)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
110 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
111 | case PROP_TAGS: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
112 | g_value_set_object(value, purple_avatar_get_tags(avatar)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
113 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
114 | default: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
115 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
116 | break; |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | static void |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | purple_avatar_set_property(GObject *obj, guint param_id, const GValue *value, |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | GParamSpec *pspec) |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | PurpleAvatar *avatar = PURPLE_AVATAR(obj); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | switch(param_id) { |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
127 | case PROP_FILENAME: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
128 | purple_avatar_set_filename(avatar, g_value_get_string(value)); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
129 | break; |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
130 | default: |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
131 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
132 | break; |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | static void |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | purple_avatar_finalize(GObject *obj) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | PurpleAvatar *avatar = PURPLE_AVATAR(obj); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | g_clear_pointer(&avatar->filename, g_free); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | g_clear_object(&avatar->pixbuf); |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
142 | g_clear_object(&avatar->animation); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | g_clear_object(&avatar->tags); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | G_OBJECT_CLASS(purple_avatar_parent_class)->finalize(obj); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | static void |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | purple_avatar_init(PurpleAvatar *avatar) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | avatar->tags = purple_tags_new(); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | static void |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | purple_avatar_class_init(PurpleAvatarClass *klass) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | obj_class->finalize = purple_avatar_finalize; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | obj_class->get_property = purple_avatar_get_property; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | obj_class->set_property = purple_avatar_set_property; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | /** |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | * PurpleAvatar:filename: |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | * |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
164 | * The filename that this avatar was created from. |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
166 | * Since: 3.0 |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | */ |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | properties[PROP_FILENAME] = g_param_spec_string( |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
169 | "filename", NULL, NULL, |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | NULL, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
171 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | /** |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | * PurpleAvatar:pixbuf: |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | * |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
176 | * The [class@GdkPixbuf.Pixbuf] of the avatar. If |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
177 | * [property@Purple.Avatar:animated] is %TRUE, this will be a static frame |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
178 | * from the animation. |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
180 | * Since: 3.0 |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | */ |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | properties[PROP_PIXBUF] = g_param_spec_object( |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
183 | "pixbuf", NULL, NULL, |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | GDK_TYPE_PIXBUF, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
185 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
186 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
187 | /** |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
188 | * PurpleAvatar:animated: |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
189 | * |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
190 | * Whether or not this avatar is animated. |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
191 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
192 | * Since: 3.0 |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
193 | */ |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
194 | properties[PROP_ANIMATED] = g_param_spec_boolean( |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
195 | "animated", NULL, NULL, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
196 | FALSE, |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
197 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
198 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
199 | /** |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
200 | * PurpleAvatar:animation: |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
201 | * |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
202 | * The [class@GdkPixbuf.PixbufAnimation] if |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
203 | * [property@Purple.Avatar:animated] is %TRUE. |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
204 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
205 | * Since: 3.0 |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
206 | */ |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
207 | properties[PROP_ANIMATION] = g_param_spec_object( |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
208 | "animation", NULL, NULL, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
209 | GDK_TYPE_PIXBUF_ANIMATION, |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
210 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | /** |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | * PurpleAvatar:tags: |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | * |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | * The [class@Purple.Tags] for the avatar. |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | * |
|
42613
780d7efe37c2
Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
217 | * Since: 3.0 |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | */ |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | properties[PROP_TAGS] = g_param_spec_object( |
|
42841
fbb5c5cb37f4
Modernize files that start with purplea
Gary Kramlich <grim@reaperworld.com>
parents:
42767
diff
changeset
|
220 | "tags", NULL, NULL, |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | PURPLE_TYPE_TAGS, |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
222 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | /****************************************************************************** |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | * Public API |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | *****************************************************************************/ |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | PurpleAvatar * |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
231 | purple_avatar_new_from_filename(const char *filename, GError **error) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
232 | GdkPixbufAnimation *animation = NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
233 | GError *local_error = NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
234 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
235 | g_return_val_if_fail(filename != NULL, NULL); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
236 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
237 | animation = gdk_pixbuf_animation_new_from_file(filename, &local_error); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
238 | if(!GDK_IS_PIXBUF_ANIMATION(animation) || local_error != NULL) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
239 | g_clear_object(&animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
240 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
241 | g_propagate_error(error, local_error); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
242 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
243 | return NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
244 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
245 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
246 | return purple_avatar_new_common(filename, animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
247 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
248 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
249 | PurpleAvatar * |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
250 | purple_avatar_new_from_resource(const char *resource_path, GError **error) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
251 | GdkPixbufAnimation *animation = NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
252 | GError *local_error = NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
253 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
254 | g_return_val_if_fail(resource_path != NULL, NULL); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
255 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
256 | animation = gdk_pixbuf_animation_new_from_resource(resource_path, |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
257 | &local_error); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
258 | if(!GDK_IS_PIXBUF_ANIMATION(animation) || local_error != NULL) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
259 | g_clear_object(&animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
260 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
261 | g_propagate_error(error, local_error); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
262 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
263 | return NULL; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
264 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
265 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
266 | return purple_avatar_new_common(NULL, animation); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | const char * |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | purple_avatar_get_filename(PurpleAvatar *avatar) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | g_return_val_if_fail(PURPLE_IS_AVATAR(avatar), NULL); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | return avatar->filename; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | GdkPixbuf * |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | purple_avatar_get_pixbuf(PurpleAvatar *avatar) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | g_return_val_if_fail(PURPLE_IS_AVATAR(avatar), NULL); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
280 | if(avatar->animated) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
281 | return gdk_pixbuf_animation_get_static_image(avatar->animation); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
282 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
283 | |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | return avatar->pixbuf; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
287 | gboolean |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
288 | purple_avatar_get_animated(PurpleAvatar *avatar) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
289 | g_return_val_if_fail(PURPLE_IS_AVATAR(avatar), FALSE); |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | |
|
42008
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
291 | return avatar->animated; |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
292 | } |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
293 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
294 | GdkPixbufAnimation * |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
295 | purple_avatar_get_animation(PurpleAvatar *avatar) { |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
296 | g_return_val_if_fail(PURPLE_IS_AVATAR(avatar), NULL); |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
297 | |
|
ae3fa963c1b3
Add animation support to PurpleAvatar
Gary Kramlich <grim@reaperworld.com>
parents:
41966
diff
changeset
|
298 | return avatar->animation; |
|
41966
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | } |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | PurpleTags * |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | purple_avatar_get_tags(PurpleAvatar *avatar) { |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | g_return_val_if_fail(PURPLE_IS_AVATAR(avatar), NULL); |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | return avatar->tags; |
|
c7bcaf2f41ef
Create PurpleAvatar to represent avatars
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | } |