Fri, 28 Sep 2007 04:37:27 +0000
Fix yahoo doodling once again. This should hopefully be less prone to break as we now use the remote party's doodle IMV key.
| 10295 | 1 | /* |
| 15918 | 2 | * Themes for Pidgin |
| 10295 | 3 | * |
| 15918 | 4 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 10295 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
7 | * |
| 10295 | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18535
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 10295 | 21 | * |
| 22 | */ | |
| 23 | #include "internal.h" | |
| 15577 | 24 | #include "pidgin.h" |
| 10295 | 25 | |
| 26 | #include "conversation.h" | |
| 27 | #include "debug.h" | |
| 28 | #include "prpl.h" | |
| 29 | #include "util.h" | |
| 30 | ||
| 31 | #include "gtkconv.h" | |
| 32 | #include "gtkdialogs.h" | |
| 33 | #include "gtkimhtml.h" | |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
34 | #include "gtkthemes.h" |
| 10295 | 35 | |
| 36 | GSList *smiley_themes = NULL; | |
| 37 | struct smiley_theme *current_smiley_theme; | |
| 38 | ||
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
39 | static void pidgin_themes_destroy_smiley_theme_smileys(struct smiley_theme *theme); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
40 | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
41 | gboolean pidgin_themes_smileys_disabled() |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
42 | { |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
43 | if (!current_smiley_theme) |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
44 | return 1; |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
45 | |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
46 | return strcmp(current_smiley_theme->name, "none") == 0; |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
47 | } |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
48 | |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
49 | static void |
|
18535
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
50 | pidgin_themes_destroy_smiley_theme(struct smiley_theme *theme) |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
51 | { |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
52 | pidgin_themes_destroy_smiley_theme_smileys(theme); |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
53 | |
|
18535
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
54 | g_free(theme->name); |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
55 | g_free(theme->desc); |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
56 | g_free(theme->author); |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
57 | g_free(theme->icon); |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
58 | g_free(theme->path); |
|
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
59 | g_free(theme); |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
60 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
61 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
62 | static void pidgin_themes_remove_theme_dir(const char *theme_dir_name) |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
63 | { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
64 | GString *str = NULL; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
65 | const char *file_name = NULL; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
66 | GDir *theme_dir = NULL; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
67 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
68 | if ((theme_dir = g_dir_open(theme_dir_name, 0, NULL)) != NULL) { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
69 | if ((str = g_string_new(theme_dir_name)) != NULL) { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
70 | while ((file_name = g_dir_read_name(theme_dir)) != NULL) { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
71 | g_string_printf(str, "%s%s%s", theme_dir_name, G_DIR_SEPARATOR_S, file_name); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
72 | g_unlink(str->str); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
73 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
74 | g_string_free(str, TRUE); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
75 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
76 | g_dir_close(theme_dir); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
77 | g_rmdir(theme_dir_name); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
78 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
79 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
80 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
81 | void pidgin_themes_remove_smiley_theme(const char *file) |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
82 | { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
83 | char *theme_dir = NULL, *last_slash = NULL; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
84 | g_return_if_fail(NULL != file); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
85 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
86 | if (!g_file_test(file, G_FILE_TEST_EXISTS)) return; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
87 | if ((theme_dir = g_strdup(file)) == NULL) return ; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
88 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
89 | if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
90 | GSList *iter = NULL; |
|
17482
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
91 | struct smiley_theme *theme = NULL, *new_theme = NULL; |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
92 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
93 | *last_slash = 0; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
94 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
95 | /* Delete files on disk */ |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
96 | pidgin_themes_remove_theme_dir(theme_dir); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
97 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
98 | /* Find theme in themes list and remove it */ |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
99 | for (iter = smiley_themes ; iter ; iter = iter->next) { |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
100 | theme = ((struct smiley_theme *)(iter->data)); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
101 | if (!strcmp(theme->path, file)) |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
102 | break ; |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
103 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
104 | if (iter) { |
|
17482
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
105 | if (theme == current_smiley_theme) { |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
106 | new_theme = ((struct smiley_theme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data)); |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
107 | if (new_theme) |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
108 | purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme->name); |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
109 | else |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
110 | current_smiley_theme = NULL; |
|
d4bbeba47e82
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17481
diff
changeset
|
111 | } |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
112 | smiley_themes = g_slist_delete_link(smiley_themes, iter); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
113 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
114 | /* Destroy theme structure */ |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
115 | pidgin_themes_destroy_smiley_theme(theme); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
116 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
117 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
118 | |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
119 | g_free(theme_dir); |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
120 | } |
|
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
121 | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
122 | void pidgin_themes_smiley_themeize(GtkWidget *imhtml) |
| 10295 | 123 | { |
| 124 | struct smiley_list *list; | |
| 125 | if (!current_smiley_theme) | |
| 126 | return; | |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
127 | |
| 10295 | 128 | gtk_imhtml_remove_smileys(GTK_IMHTML(imhtml)); |
| 129 | list = current_smiley_theme->list; | |
| 130 | while (list) { | |
| 131 | char *sml = !strcmp(list->sml, "default") ? NULL : list->sml; | |
| 132 | GSList *icons = list->smileys; | |
| 133 | while (icons) { | |
| 134 | gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), sml, icons->data); | |
| 135 | icons = icons->next; | |
| 136 | } | |
| 137 | list = list->next; | |
| 138 | } | |
| 139 | } | |
| 140 | ||
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
141 | static void |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
142 | pidgin_themes_destroy_smiley_theme_smileys(struct smiley_theme *theme) |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
143 | { |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
144 | GHashTable *already_freed; |
|
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
145 | struct smiley_list *wer; |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
146 | |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
147 | already_freed = g_hash_table_new(g_direct_hash, g_direct_equal); |
|
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
148 | for (wer = theme->list; wer != NULL; wer = theme->list) { |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
149 | while (wer->smileys) { |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
150 | GtkIMHtmlSmiley *uio = wer->smileys->data; |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
151 | if (uio->icon) |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
152 | g_object_unref(uio->icon); |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
153 | if (g_hash_table_lookup(already_freed, uio->file) == NULL) { |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
154 | g_free(uio->file); |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
155 | g_hash_table_insert(already_freed, uio->file, GINT_TO_POINTER(1)); |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
156 | } |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
157 | g_free(uio->smile); |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
158 | g_free(uio); |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
159 | wer->smileys = g_slist_remove(wer->smileys, uio); |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
160 | } |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
161 | theme->list = wer->next; |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
162 | g_free(wer->sml); |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
163 | g_free(wer); |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
164 | } |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
165 | theme->list = NULL; |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
166 | |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
167 | g_hash_table_destroy(already_freed); |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
168 | } |
|
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
169 | |
| 17521 | 170 | static void |
| 171 | pidgin_smiley_themes_remove_non_existing() | |
| 172 | { | |
| 173 | static struct smiley_theme *theme = NULL; | |
| 174 | GSList *iter = NULL; | |
| 175 | ||
| 176 | if (!smiley_themes) return ; | |
| 177 | ||
| 178 | for (iter = smiley_themes ; iter ; iter = iter->next) { | |
| 179 | theme = ((struct smiley_theme *)(iter->data)); | |
| 180 | if (!g_file_test(theme->path, G_FILE_TEST_EXISTS)) { | |
| 181 | if (theme == current_smiley_theme) | |
| 182 | current_smiley_theme = ((struct smiley_theme *)(NULL == iter->next ? NULL : iter->next->data)); | |
|
18535
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
183 | pidgin_themes_destroy_smiley_theme(theme); |
| 17521 | 184 | iter->data = NULL; |
| 185 | } | |
| 186 | } | |
| 187 | /* Remove all elements whose data is NULL */ | |
| 188 | smiley_themes = g_slist_remove_all(smiley_themes, NULL); | |
| 189 | ||
| 17522 | 190 | if (!current_smiley_theme && smiley_themes) { |
| 191 | struct smiley_theme *smile = g_slist_last(smiley_themes)->data; | |
| 192 | pidgin_themes_load_smiley_theme(smile->path, TRUE); | |
| 193 | } | |
| 17521 | 194 | } |
| 195 | ||
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
196 | void pidgin_themes_load_smiley_theme(const char *file, gboolean load) |
| 10295 | 197 | { |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10295
diff
changeset
|
198 | FILE *f = g_fopen(file, "r"); |
| 10295 | 199 | char buf[256]; |
| 200 | char *i; | |
| 201 | struct smiley_theme *theme=NULL; | |
| 202 | struct smiley_list *list = NULL; | |
| 203 | GSList *lst = smiley_themes; | |
| 204 | char *dirname; | |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
205 | gboolean new_theme = FALSE; |
| 10295 | 206 | |
| 207 | if (!f) | |
| 208 | return; | |
| 209 | ||
| 210 | while (lst) { | |
| 211 | struct smiley_theme *thm = lst->data; | |
| 212 | if (!strcmp(thm->path, file)) { | |
| 213 | theme = thm; | |
| 214 | break; | |
| 215 | } | |
| 216 | lst = lst->next; | |
| 217 | } | |
| 218 | ||
| 219 | if (!theme) { | |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
220 | new_theme = TRUE; |
| 10295 | 221 | theme = g_new0(struct smiley_theme, 1); |
| 222 | theme->path = g_strdup(file); | |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
223 | } else if (theme == current_smiley_theme) { |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
224 | /* Don't reload the theme if it is already loaded */ |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
225 | fclose(f); |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
226 | return; |
| 10295 | 227 | } |
| 228 | ||
| 229 | dirname = g_path_get_dirname(file); | |
| 230 | ||
| 231 | while (!feof(f)) { | |
| 232 | if (!fgets(buf, sizeof(buf), f)) { | |
| 233 | break; | |
| 234 | } | |
| 235 | ||
| 236 | if (buf[0] == '#' || buf[0] == '\0') | |
| 237 | continue; | |
| 238 | ||
| 239 | i = buf; | |
| 240 | while (isspace(*i)) | |
| 241 | i++; | |
| 242 | ||
| 243 | if (*i == '[' && strchr(i, ']') && load) { | |
| 244 | struct smiley_list *child = g_new0(struct smiley_list, 1); | |
| 245 | child->sml = g_strndup(i+1, strchr(i, ']') - i - 1); | |
| 246 | if (theme->list) | |
| 247 | list->next = child; | |
| 248 | else | |
| 249 | theme->list = child; | |
|
17534
609ab183a700
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17474
diff
changeset
|
250 | /* Reverse the Smiley list since it was built in reverse order for efficiency reasons */ |
|
609ab183a700
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17474
diff
changeset
|
251 | if (list != NULL) |
|
609ab183a700
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17474
diff
changeset
|
252 | list->smileys = g_slist_reverse(list->smileys); |
| 10295 | 253 | list = child; |
| 254 | } else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) { | |
| 15338 | 255 | int len; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13625
diff
changeset
|
256 | g_free(theme->name); |
|
17474
a7f61acc10f6
A somewhat-Warmenhoved patch from tfujiwara to allow for the smiley theme
Richard Laager <rlaager@pidgin.im>
parents:
16458
diff
changeset
|
257 | theme->name = g_strdup(i + strlen("Name=")); |
| 15338 | 258 | len = strlen(theme->name); |
| 259 | theme->name[len-1] = 0; | |
| 260 | if(len > 2 && theme->name[len-2] == '\r') | |
| 261 | theme->name[len-2] = 0; | |
| 10295 | 262 | } else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13625
diff
changeset
|
263 | g_free(theme->desc); |
| 10295 | 264 | theme->desc = g_strdup(i + strlen("Description=")); |
| 265 | theme->desc[strlen(theme->desc)-1] = 0; | |
| 266 | } else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) { | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13625
diff
changeset
|
267 | g_free(theme->icon); |
| 10295 | 268 | theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL); |
| 269 | theme->icon[strlen(theme->icon)-1] = 0; | |
| 270 | } else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) { | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13625
diff
changeset
|
271 | g_free(theme->author); |
| 10295 | 272 | theme->author = g_strdup(i + strlen("Author=")); |
| 273 | theme->author[strlen(theme->author)-1] = 0; | |
| 274 | } else if (load && list) { | |
| 275 | gboolean hidden = FALSE; | |
| 276 | char *sfile = NULL; | |
|
16194
ca4861bb467f
Fix a memory leak that occurs when a smiley theme lists a filename,
Mark Doliner <markdoliner@pidgin.im>
parents:
16123
diff
changeset
|
277 | gboolean have_used_sfile = FALSE; |
| 10295 | 278 | |
| 279 | if (*i == '!' && *(i + 1) == ' ') { | |
| 280 | hidden = TRUE; | |
| 281 | i = i + 2; | |
| 282 | } | |
| 283 | while (*i) { | |
| 284 | char l[64]; | |
| 285 | int li = 0; | |
|
13134
e5898f2191a4
[gaim-migrate @ 15495]
Christophe Chapuis <tofe2tofe@users.sourceforge.net>
parents:
12915
diff
changeset
|
286 | while (!isspace(*i) && li < sizeof(l) - 1) { |
|
e5898f2191a4
[gaim-migrate @ 15495]
Christophe Chapuis <tofe2tofe@users.sourceforge.net>
parents:
12915
diff
changeset
|
287 | if (*i == '\\' && *(i+1) != '\0' && *(i+1) != '\n' && *(i+1) != '\r') |
|
12915
d3efd3201aec
[gaim-migrate @ 15268]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11557
diff
changeset
|
288 | i++; |
| 10295 | 289 | l[li++] = *(i++); |
|
12915
d3efd3201aec
[gaim-migrate @ 15268]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11557
diff
changeset
|
290 | } |
| 10295 | 291 | if (!sfile) { |
| 292 | l[li] = 0; | |
| 293 | sfile = g_build_filename(dirname, l, NULL); | |
| 294 | } else { | |
| 295 | GtkIMHtmlSmiley *smiley = g_new0(GtkIMHtmlSmiley, 1); | |
| 296 | l[li] = 0; | |
| 297 | smiley->file = sfile; | |
| 298 | smiley->smile = g_strdup(l); | |
| 299 | smiley->hidden = hidden; | |
|
16211
670c6b68f7c5
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <markdoliner@pidgin.im>
parents:
16195
diff
changeset
|
300 | list->smileys = g_slist_prepend(list->smileys, smiley); |
|
16194
ca4861bb467f
Fix a memory leak that occurs when a smiley theme lists a filename,
Mark Doliner <markdoliner@pidgin.im>
parents:
16123
diff
changeset
|
301 | have_used_sfile = TRUE; |
| 10295 | 302 | } |
| 303 | while (isspace(*i)) | |
| 304 | i++; | |
| 305 | ||
| 306 | } | |
|
16458
e0e45bccd8e2
Fix #273 (Emoticons appearing in reverse order).
Daniel Atallah <datallah@pidgin.im>
parents:
16263
diff
changeset
|
307 | |
|
e0e45bccd8e2
Fix #273 (Emoticons appearing in reverse order).
Daniel Atallah <datallah@pidgin.im>
parents:
16263
diff
changeset
|
308 | |
|
16194
ca4861bb467f
Fix a memory leak that occurs when a smiley theme lists a filename,
Mark Doliner <markdoliner@pidgin.im>
parents:
16123
diff
changeset
|
309 | if (!have_used_sfile) |
|
ca4861bb467f
Fix a memory leak that occurs when a smiley theme lists a filename,
Mark Doliner <markdoliner@pidgin.im>
parents:
16123
diff
changeset
|
310 | g_free(sfile); |
| 10295 | 311 | } |
| 312 | } | |
| 313 | ||
|
17535
5f2b75cc8b92
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17534
diff
changeset
|
314 | /* Reverse the Smiley list since it was built in reverse order for efficiency reasons */ |
|
5f2b75cc8b92
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17534
diff
changeset
|
315 | if (list != NULL) |
|
5f2b75cc8b92
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17534
diff
changeset
|
316 | list->smileys = g_slist_reverse(list->smileys); |
|
5f2b75cc8b92
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17534
diff
changeset
|
317 | |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
318 | g_free(dirname); |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
319 | fclose(f); |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
320 | |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
321 | if (!theme->name || !theme->desc || !theme->author) { |
| 15884 | 322 | purple_debug_error("gtkthemes", "Invalid file format, not loading smiley theme from '%s'\n", file); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
323 | |
|
18535
360f2b11f562
Eliminate some duplicate code.
Richard Laager <rlaager@pidgin.im>
parents:
18348
diff
changeset
|
324 | pidgin_themes_destroy_smiley_theme(theme); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
325 | return; |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
326 | } |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
327 | |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
328 | if (new_theme) { |
|
16212
50ef047fed38
Change another 'append' to 'prepend', since the ordering doesn't matter
Mark Doliner <markdoliner@pidgin.im>
parents:
16211
diff
changeset
|
329 | smiley_themes = g_slist_prepend(smiley_themes, theme); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
330 | } |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
331 | |
| 10295 | 332 | if (load) { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
333 | GList *cnv; |
| 10295 | 334 | |
|
16195
4e158cbe65cd
Pull out the same block of code from two places and put it into
Mark Doliner <markdoliner@pidgin.im>
parents:
16194
diff
changeset
|
335 | if (current_smiley_theme) |
|
17481
0187dfe85231
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17480
diff
changeset
|
336 | pidgin_themes_destroy_smiley_theme_smileys(current_smiley_theme); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
337 | current_smiley_theme = theme; |
|
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13134
diff
changeset
|
338 | |
| 15884 | 339 | for (cnv = purple_get_conversations(); cnv != NULL; cnv = cnv->next) { |
| 340 | PurpleConversation *conv = cnv->data; | |
| 10295 | 341 | |
|
15692
ecda27df58b9
Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents:
15577
diff
changeset
|
342 | if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
343 | pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); |
|
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
344 | pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->entry); |
| 10295 | 345 | } |
| 346 | } | |
| 347 | } | |
| 348 | } | |
| 349 | ||
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
350 | void pidgin_themes_smiley_theme_probe() |
| 10295 | 351 | { |
| 352 | GDir *dir; | |
| 353 | const gchar *file; | |
| 17521 | 354 | gchar *path, *test_path; |
| 10295 | 355 | int l; |
| 17521 | 356 | char* probedirs[3]; |
| 10295 | 357 | |
| 17521 | 358 | pidgin_smiley_themes_remove_non_existing(); |
| 359 | ||
| 15918 | 360 | probedirs[0] = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", NULL); |
| 15884 | 361 | probedirs[1] = g_build_filename(purple_user_dir(), "smileys", NULL); |
| 10295 | 362 | probedirs[2] = 0; |
| 363 | for (l=0; probedirs[l]; l++) { | |
| 364 | dir = g_dir_open(probedirs[l], 0, NULL); | |
| 365 | if (dir) { | |
| 366 | while ((file = g_dir_read_name(dir))) { | |
| 17521 | 367 | test_path = g_build_filename(probedirs[l], file, NULL); |
| 368 | if (g_file_test(test_path, G_FILE_TEST_IS_DIR)) { | |
| 369 | path = g_build_filename(probedirs[l], file, "theme", NULL); | |
| 10295 | 370 | |
| 17521 | 371 | /* Here we check to see that the theme has proper syntax. |
| 372 | * We set the second argument to FALSE so that it doesn't load | |
| 373 | * the theme yet. | |
| 374 | */ | |
| 375 | pidgin_themes_load_smiley_theme(path, FALSE); | |
| 376 | g_free(path); | |
| 377 | } | |
| 378 | g_free(test_path); | |
| 10295 | 379 | } |
| 380 | g_dir_close(dir); | |
| 381 | } else if (l == 1) { | |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10295
diff
changeset
|
382 | g_mkdir(probedirs[l], S_IRUSR | S_IWUSR | S_IXUSR); |
| 10295 | 383 | } |
| 384 | g_free(probedirs[l]); | |
| 385 | } | |
| 17521 | 386 | |
| 17522 | 387 | if (!current_smiley_theme && smiley_themes) { |
| 388 | struct smiley_theme *smile = smiley_themes->data; | |
| 389 | pidgin_themes_load_smiley_theme(smile->path, TRUE); | |
| 390 | } | |
| 10295 | 391 | } |
| 392 | ||
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
393 | GSList *pidgin_themes_get_proto_smileys(const char *id) { |
| 15884 | 394 | PurplePlugin *proto; |
| 10295 | 395 | struct smiley_list *list, *def; |
| 396 | ||
| 397 | if ((current_smiley_theme == NULL) || (current_smiley_theme->list == NULL)) | |
| 398 | return NULL; | |
| 399 | ||
| 400 | def = list = current_smiley_theme->list; | |
| 401 | ||
| 402 | if (id == NULL) | |
| 403 | return def->smileys; | |
| 404 | ||
| 15884 | 405 | proto = purple_find_prpl(id); |
| 10295 | 406 | |
| 407 | while (list) { | |
| 408 | if (!strcmp(list->sml, "default")) | |
| 409 | def = list; | |
| 410 | else if (proto && !strcmp(proto->info->name, list->sml)) | |
| 411 | break; | |
| 412 | ||
| 413 | list = list->next; | |
| 414 | } | |
| 415 | ||
| 416 | return list ? list->smileys : def->smileys; | |
| 417 | } | |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
418 | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
419 | void pidgin_themes_init() |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
420 | { |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
421 | GSList *l; |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
422 | const char *current_theme = |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15918
diff
changeset
|
423 | purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"); |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
424 | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
425 | pidgin_themes_smiley_theme_probe(); |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
426 | |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
427 | for (l = smiley_themes; l; l = l->next) { |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
428 | struct smiley_theme *smile = l->data; |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
429 | if (smile->name && strcmp(current_theme, smile->name) == 0) { |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
430 | pidgin_themes_load_smiley_theme(smile->path, TRUE); |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
431 | break; |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
432 | } |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
433 | } |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
434 | |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
435 | /* If we still don't have a smiley theme, choose the first one */ |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
436 | if (!current_smiley_theme && smiley_themes) { |
|
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
437 | struct smiley_theme *smile = smiley_themes->data; |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16212
diff
changeset
|
438 | pidgin_themes_load_smiley_theme(smile->path, TRUE); |
|
11557
7a20e7fb7915
[gaim-migrate @ 13819]
Daniel Atallah <datallah@pidgin.im>
parents:
11525
diff
changeset
|
439 | } |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
10589
diff
changeset
|
440 | } |