Wed, 20 Jun 2018 02:13:44 -0400
prefs: Add binding versions of pref widget functions.
These just bind settings to existing widgets and copy the saved value to
the widget, except for combos which are produced from runtime lists.
Those are populated in a similar way as before.
There are some extra _bind_ words that will probably be dropped once the
other functions are unused.
|
35701
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
1 | /* purple |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
2 | * |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
5 | * source distribution. |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
6 | * |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
15 | * GNU General Public License for more details. |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
21 | |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
22 | #include "smiley-list.h" |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
23 | |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
24 | #include "dbus-maybe.h" |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
25 | #include "debug.h" |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35713
diff
changeset
|
26 | #include "smiley-parser.h" |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
27 | #include "trie.h" |
|
35701
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
28 | |
|
38411
b7f2d7c563fb
smiley-list: Fix missing include for strstr()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38283
diff
changeset
|
29 | #include <string.h> |
|
b7f2d7c563fb
smiley-list: Fix missing include for strstr()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38283
diff
changeset
|
30 | |
|
35701
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
31 | #define PURPLE_SMILEY_LIST_GET_PRIVATE(obj) \ |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
32 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SMILEY_LIST, \ |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
33 | PurpleSmileyListPrivate)) |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
34 | |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
35 | typedef struct { |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
36 | GList *smileys; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
37 | GList *smileys_end; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
38 | PurpleTrie *trie; |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
39 | GHashTable *path_map; |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
40 | GHashTable *shortcut_map; |
|
35755
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
41 | |
|
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
42 | gboolean drop_failed_remotes; |
|
35701
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
43 | } PurpleSmileyListPrivate; |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
44 | |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
45 | enum |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
46 | { |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
47 | PROP_0, |
|
35755
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
48 | PROP_DROP_FAILED_REMOTES, |
|
35701
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
49 | PROP_LAST |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
50 | }; |
|
34f4a4318d19
Initial PurpleSmileyList implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
51 | |
|
35755
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
52 | static GParamSpec *properties[PROP_LAST]; |
|
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
53 | |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
54 | /******************************************************************************* |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
55 | * Object stuff |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
56 | ******************************************************************************/ |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
57 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleSmileyList, purple_smiley_list, G_TYPE_OBJECT); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
58 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
59 | static void |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
60 | purple_smiley_list_init(PurpleSmileyList *list) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
61 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
62 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
63 | priv->trie = purple_trie_new(); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
64 | priv->path_map = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
65 | g_free, NULL); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
66 | priv->shortcut_map = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
67 | g_free, NULL); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
68 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
69 | PURPLE_DBUS_REGISTER_POINTER(list, PurpleSmileyList); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
70 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
71 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
72 | static void |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
73 | purple_smiley_list_finalize(GObject *obj) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
74 | PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
75 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
76 | GList *it; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
77 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
78 | g_object_unref(priv->trie); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
79 | g_hash_table_destroy(priv->path_map); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
80 | g_hash_table_destroy(priv->shortcut_map); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
81 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
82 | for (it = priv->smileys; it; it = g_list_next(it)) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
83 | PurpleSmiley *smiley = it->data; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
84 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", NULL); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
85 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem", NULL); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
86 | g_object_unref(smiley); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
87 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
88 | g_list_free(priv->smileys); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
89 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
90 | PURPLE_DBUS_UNREGISTER_POINTER(sl); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
91 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
92 | G_OBJECT_CLASS(purple_smiley_list_parent_class)->finalize(obj); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
93 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
94 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
95 | static void |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
96 | purple_smiley_list_get_property(GObject *obj, guint param_id, GValue *value, |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
97 | GParamSpec *pspec) |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
98 | { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
99 | PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
100 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
101 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
102 | switch (param_id) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
103 | case PROP_DROP_FAILED_REMOTES: |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
104 | g_value_set_boolean(value, priv->drop_failed_remotes); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
105 | break; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
106 | default: |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
107 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
108 | break; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
109 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
110 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
111 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
112 | static void |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
113 | purple_smiley_list_set_property(GObject *obj, guint param_id, |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
114 | const GValue *value, GParamSpec *pspec) |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
115 | { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
116 | PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
117 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(sl); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
118 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
119 | switch (param_id) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
120 | case PROP_DROP_FAILED_REMOTES: |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
121 | priv->drop_failed_remotes = g_value_get_boolean(value); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
122 | /* XXX: we could scan for remote smiley's on our list |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
123 | * and change the setting, but we don't care that much. |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
124 | */ |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
125 | break; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
126 | default: |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
127 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
128 | break; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
129 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
130 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
131 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
132 | static void |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
133 | purple_smiley_list_class_init(PurpleSmileyListClass *klass) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
134 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
135 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
136 | obj_class->get_property = purple_smiley_list_get_property; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
137 | obj_class->set_property = purple_smiley_list_set_property; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
138 | obj_class->finalize = purple_smiley_list_finalize; |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
139 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
140 | properties[PROP_DROP_FAILED_REMOTES] = g_param_spec_boolean( |
|
38548
46e985dde7a5
libpurple: Remove references to dropped PurpleRemoteSmileys
Mike Ruprecht <cmaiku@gmail.com>
parents:
38411
diff
changeset
|
141 | "drop-failed-remotes", "Drop failed remote PurpleSmileys", |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
142 | "Watch added remote smileys and remove them from the list, " |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
143 | "if they change their state to failed", FALSE, |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
144 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
145 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
146 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
147 | } |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
148 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
149 | /****************************************************************************** |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
150 | * Helpers |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
151 | *****************************************************************************/ |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
152 | static void |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
153 | _list_append2(GList **head_p, GList **tail_p, gpointer data) |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
154 | { |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
155 | GList *head = *head_p; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
156 | GList *tail = *tail_p; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
157 | GList *elem; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
158 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
159 | g_return_if_fail((head == NULL) == (tail == NULL)); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
160 | g_return_if_fail((tail == NULL) || (tail->next == NULL)); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
161 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
162 | elem = g_list_alloc(); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
163 | elem->data = data; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
164 | elem->prev = tail; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
165 | elem->next = NULL; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
166 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
167 | if (head) { |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
168 | tail->next = elem; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
169 | *tail_p = elem; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
170 | } else |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
171 | *head_p = *tail_p = elem; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
172 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
173 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
174 | static void |
|
35758
87c51487e197
Fix g_slist_remove_link misuse, remove debug printfs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35757
diff
changeset
|
175 | _list_delete_link2(GList **head_p, GList **tail_p, GList *link) |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
176 | { |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
177 | GList *head = *head_p; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
178 | GList *tail = *tail_p; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
179 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
180 | g_return_if_fail(head != NULL); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
181 | g_return_if_fail(tail != NULL); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
182 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
183 | if (link == tail) |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
184 | *tail_p = tail->prev; |
|
35758
87c51487e197
Fix g_slist_remove_link misuse, remove debug printfs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35757
diff
changeset
|
185 | *head_p = g_list_delete_link(head, link); |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
186 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
187 | |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
188 | static const gchar * |
|
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
189 | smiley_get_uniqid(PurpleSmiley *smiley) |
|
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
190 | { |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
191 | return purple_image_get_path(PURPLE_IMAGE(smiley)); |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
192 | } |
|
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
193 | |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
194 | /******************************************************************************* |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
195 | * API implementation |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
196 | ******************************************************************************/ |
|
35709
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
197 | PurpleSmileyList * |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
198 | purple_smiley_list_new(void) { |
|
35709
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
199 | return g_object_new(PURPLE_TYPE_SMILEY_LIST, NULL); |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
200 | } |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
201 | |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
202 | gboolean |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
203 | purple_smiley_list_add(PurpleSmileyList *list, PurpleSmiley *smiley) { |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
204 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
205 | const gchar *smiley_path; |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
206 | gboolean succ; |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
207 | gchar *shortcut_escaped; |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35713
diff
changeset
|
208 | const gchar *shortcut; |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
209 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
210 | g_return_val_if_fail(priv != NULL, FALSE); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
211 | g_return_val_if_fail(PURPLE_IS_SMILEY(smiley), FALSE); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
212 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
213 | if (g_object_get_data(G_OBJECT(smiley), "purple-smiley-list") != NULL) { |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
214 | purple_debug_warning("smiley-list", |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
215 | "smiley is already associated with some list"); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
216 | return FALSE; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
217 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
218 | |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35713
diff
changeset
|
219 | shortcut = purple_smiley_get_shortcut(smiley); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
220 | |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
221 | if (g_hash_table_lookup(priv->shortcut_map, shortcut) != NULL) |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
222 | return FALSE; |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
223 | |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
224 | shortcut_escaped = g_markup_escape_text(shortcut, -1); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
225 | succ = purple_trie_add(priv->trie, shortcut_escaped, smiley); |
|
35847
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
226 | |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
227 | /* A special-case for WebKit, which unescapes apos entity. |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
228 | * Please, don't trust this hack - it may be removed in future releases. |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
229 | */ |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
230 | if (succ && strstr(shortcut_escaped, "'") != NULL) { |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
231 | gchar *tmp = shortcut_escaped; |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
232 | shortcut_escaped = purple_strreplace(shortcut_escaped, |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
233 | "'", "'"); |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
234 | g_free(tmp); |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
235 | succ = purple_trie_add(priv->trie, shortcut_escaped, smiley); |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
236 | } |
|
cbe2085f6355
Fix :'( smiley bug by a tiny hack
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
237 | |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
238 | g_free(shortcut_escaped); |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
239 | if (!succ) |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
240 | return FALSE; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
241 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
242 | g_object_ref(smiley); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
243 | _list_append2(&priv->smileys, &priv->smileys_end, smiley); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
244 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", list); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
245 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem", |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
246 | priv->smileys_end); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
247 | |
|
35747
25085b485441
Remote smileys: parse them too
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35746
diff
changeset
|
248 | g_hash_table_insert(priv->shortcut_map, g_strdup(shortcut), smiley); |
|
25085b485441
Remote smileys: parse them too
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35746
diff
changeset
|
249 | |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
250 | smiley_path = smiley_get_uniqid(smiley); |
|
35746
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
251 | |
|
35755
d91c44b4a8e6
Remote smileys: correctly handle failed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35747
diff
changeset
|
252 | /* TODO: add to the table, when the smiley sets the path */ |
|
35746
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
253 | if (!smiley_path) |
|
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
254 | return TRUE; |
|
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
255 | |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
256 | if (g_hash_table_lookup(priv->path_map, smiley_path) == NULL) { |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
257 | g_hash_table_insert(priv->path_map, |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
258 | g_strdup(smiley_path), smiley); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
259 | } |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
260 | |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
261 | return TRUE; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
262 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
263 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
264 | void |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
265 | purple_smiley_list_remove(PurpleSmileyList *list, PurpleSmiley *smiley) { |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
266 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
267 | GList *list_elem, *it; |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
268 | const gchar *shortcut, *path; |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
269 | gchar *shortcut_escaped; |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
270 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
271 | g_return_if_fail(priv != NULL); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
272 | g_return_if_fail(PURPLE_IS_SMILEY(smiley)); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
273 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
274 | if (g_object_get_data(G_OBJECT(smiley), "purple-smiley-list") != list) { |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
275 | purple_debug_warning("smiley-list", "remove: invalid list"); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
276 | return; |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
277 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
278 | |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
279 | list_elem = g_object_get_data(G_OBJECT(smiley), |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
280 | "purple-smiley-list-elem"); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
281 | |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
282 | shortcut = purple_smiley_get_shortcut(smiley); |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
283 | path = smiley_get_uniqid(smiley); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
284 | |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
285 | g_hash_table_remove(priv->shortcut_map, shortcut); |
|
35746
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
286 | if (path) |
|
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
287 | g_hash_table_remove(priv->path_map, path); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
288 | |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
289 | shortcut_escaped = g_markup_escape_text(shortcut, -1); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
290 | purple_trie_remove(priv->trie, shortcut); |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35755
diff
changeset
|
291 | g_free(shortcut_escaped); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
292 | |
|
35758
87c51487e197
Fix g_slist_remove_link misuse, remove debug printfs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35757
diff
changeset
|
293 | _list_delete_link2(&priv->smileys, &priv->smileys_end, list_elem); |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
294 | |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
295 | /* re-add entry to path_map if smiley was not unique */ |
|
35746
e4a656378516
Remote smileys: partial implementation with XMPP
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
296 | for (it = priv->smileys; it && path; it = g_list_next(it)) { |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
297 | PurpleSmiley *smiley = it->data; |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
298 | |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
299 | if (g_strcmp0(smiley_get_uniqid(smiley), path) == 0) { |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
300 | g_hash_table_insert(priv->path_map, |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
301 | g_strdup(path), smiley); |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
302 | break; |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
303 | } |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
304 | } |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
305 | |
|
35702
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
306 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", NULL); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
307 | g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem", NULL); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
308 | g_object_unref(smiley); |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
309 | } |
|
06a934baa610
Smiley list: add/remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35701
diff
changeset
|
310 | |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
311 | gboolean |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
312 | purple_smiley_list_is_empty(const PurpleSmileyList *list) { |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
313 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
314 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
315 | g_return_val_if_fail(priv != NULL, TRUE); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
316 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
317 | return (priv->smileys == NULL); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
318 | } |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
319 | |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
320 | PurpleSmiley * |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
321 | purple_smiley_list_get_by_shortcut(PurpleSmileyList *list, |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
322 | const gchar *shortcut) |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
323 | { |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
324 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
325 | |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
326 | g_return_val_if_fail(priv != NULL, NULL); |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
327 | |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
328 | return g_hash_table_lookup(priv->shortcut_map, shortcut); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
329 | } |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
330 | |
|
35709
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
331 | PurpleTrie * |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
332 | purple_smiley_list_get_trie(PurpleSmileyList *list) { |
|
35709
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
333 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
334 | |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
335 | g_return_val_if_fail(priv != NULL, NULL); |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
336 | |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
337 | return priv->trie; |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
338 | } |
|
0d7a84931572
Smileys: implement and use new parser, only themes for now
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35702
diff
changeset
|
339 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
340 | GList * |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
341 | purple_smiley_list_get_unique(PurpleSmileyList *list) { |
|
35799
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
342 | GList *unique = NULL, *it; |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
343 | GHashTable *unique_map; |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
344 | PurpleSmileyListPrivate *priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
345 | |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
346 | g_return_val_if_fail(priv != NULL, NULL); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
347 | |
|
35799
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
348 | /* We could just return g_hash_table_get_values(priv->path_map) here, |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
349 | * but it won't be in order. */ |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
350 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
351 | unique_map = g_hash_table_new(g_str_hash, g_str_equal); |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
352 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
353 | for (it = priv->smileys; it; it = g_list_next(it)) { |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
354 | PurpleSmiley *smiley = it->data; |
|
35839
a7f91bd51911
Drop purple_smiley_get_path in favor of purple_image_get_path (or don't use it at all)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35838
diff
changeset
|
355 | const gchar *path = smiley_get_uniqid(smiley); |
|
35799
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
356 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
357 | if (g_hash_table_lookup(unique_map, path)) |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
358 | continue; |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
359 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
360 | unique = g_list_prepend(unique, smiley); |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
361 | g_hash_table_insert(unique_map, (gpointer)path, smiley); |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
362 | } |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
363 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
364 | g_hash_table_destroy(unique_map); |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
365 | |
|
04b439a886e6
Smileys: don't shuffle smileys when displaying smiley toolbar window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
366 | return g_list_reverse(unique); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
367 | } |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
368 | |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
369 | GList * |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
370 | purple_smiley_list_get_all(PurpleSmileyList *list) { |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
371 | PurpleSmileyListPrivate *priv = NULL; |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
372 | |
|
38281
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
373 | g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), NULL); |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
374 | |
|
df274be2afa2
A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
375 | priv = PURPLE_SMILEY_LIST_GET_PRIVATE(list); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
376 | |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
377 | return g_hash_table_get_values(priv->shortcut_map); |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35709
diff
changeset
|
378 | } |