Mercurial > pidgin.yaz
annotate pidgin/gtkthemes.c @ 28694:c7aaad89a2f8
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Legacy servers don't send <stream:features>, so we need to notice when
we've finished the opening <stream:stream> tag and, if there was no
version, start authentication right then. This was causingon other valid
errors (like the server complaining it's not who we think it is) to be
replaced by a complaint "You require encryption...". Closes #10450.
This seems to work in all the cases I've tested (including with jabberd14).
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 06 Oct 2009 03:25:26 +0000 |
parents | 5b21007cf503 |
children | 8c8871afd063 c410e48a31c6 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15858 | 2 * Themes for Pidgin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15858 | 4 * Pidgin is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18376
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
15514 | 24 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "gtkconv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "gtkdialogs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "gtkimhtml.h" |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
34 #include "gtksmiley.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "gtkthemes.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 GSList *smiley_themes = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 struct smiley_theme *current_smiley_theme; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
40 static void pidgin_themes_destroy_smiley_theme_smileys(struct smiley_theme *theme); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
41 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
42 gboolean pidgin_themes_smileys_disabled() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 if (!current_smiley_theme) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 return strcmp(current_smiley_theme->name, "none") == 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
50 static void |
18376
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
51 pidgin_themes_destroy_smiley_theme(struct smiley_theme *theme) |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
52 { |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
53 pidgin_themes_destroy_smiley_theme_smileys(theme); |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
54 |
18376
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
55 g_free(theme->name); |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
56 g_free(theme->desc); |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
57 g_free(theme->author); |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
58 g_free(theme->icon); |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
59 g_free(theme->path); |
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
60 g_free(theme); |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
61 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
62 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
63 static void pidgin_themes_remove_theme_dir(const char *theme_dir_name) |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
64 { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
65 GString *str = NULL; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
66 const char *file_name = NULL; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
67 GDir *theme_dir = NULL; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
68 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
69 if ((theme_dir = g_dir_open(theme_dir_name, 0, NULL)) != NULL) { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
70 if ((str = g_string_new(theme_dir_name)) != NULL) { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
71 while ((file_name = g_dir_read_name(theme_dir)) != NULL) { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
72 g_string_printf(str, "%s%s%s", theme_dir_name, G_DIR_SEPARATOR_S, file_name); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
73 g_unlink(str->str); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
74 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
75 g_string_free(str, TRUE); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
76 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
77 g_dir_close(theme_dir); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
78 g_rmdir(theme_dir_name); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
79 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
80 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
81 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
82 void pidgin_themes_remove_smiley_theme(const char *file) |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
83 { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
84 char *theme_dir = NULL, *last_slash = NULL; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
85 g_return_if_fail(NULL != file); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24311
diff
changeset
|
86 |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
87 if (!g_file_test(file, G_FILE_TEST_EXISTS)) return; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
88 if ((theme_dir = g_strdup(file)) == NULL) return ; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
89 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
90 if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
91 GSList *iter = NULL; |
17484
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
92 struct smiley_theme *theme = NULL, *new_theme = NULL; |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
93 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
94 *last_slash = 0; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
95 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
96 /* Delete files on disk */ |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
97 pidgin_themes_remove_theme_dir(theme_dir); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
98 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
99 /* Find theme in themes list and remove it */ |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
100 for (iter = smiley_themes ; iter ; iter = iter->next) { |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
101 theme = ((struct smiley_theme *)(iter->data)); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
102 if (!strcmp(theme->path, file)) |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
103 break ; |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
104 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
105 if (iter) { |
17484
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
106 if (theme == current_smiley_theme) { |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
107 new_theme = ((struct smiley_theme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data)); |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
108 if (new_theme) |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
109 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme->name); |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
110 else |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
111 current_smiley_theme = NULL; |
7055885b1b70
Figured out how to keep reflecting current smiley theme after remove.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17483
diff
changeset
|
112 } |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
113 smiley_themes = g_slist_delete_link(smiley_themes, iter); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
114 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
115 /* Destroy theme structure */ |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
116 pidgin_themes_destroy_smiley_theme(theme); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
117 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
118 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
119 |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
120 g_free(theme_dir); |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
121 } |
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
122 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
123 static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 struct smiley_list *list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 if (!current_smiley_theme) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 gtk_imhtml_remove_smileys(GTK_IMHTML(imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 list = current_smiley_theme->list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 while (list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 char *sml = !strcmp(list->sml, "default") ? NULL : list->sml; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 GSList *icons = list->smileys; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 while (icons) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), sml, icons->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 icons = icons->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 } |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
138 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
139 if (custom == TRUE) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
140 icons = pidgin_smileys_get_all(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
141 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
142 while (icons) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
143 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), sml, icons->data); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
144 icons = icons->next; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
145 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
146 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
147 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 list = list->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
152 void pidgin_themes_smiley_themeize(GtkWidget *imhtml) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
153 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
154 _pidgin_themes_smiley_themeize(imhtml, FALSE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
155 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
156 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
157 void pidgin_themes_smiley_themeize_custom(GtkWidget *imhtml) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
158 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
159 _pidgin_themes_smiley_themeize(imhtml, TRUE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
160 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
161 |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
162 static void |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
163 pidgin_themes_destroy_smiley_theme_smileys(struct smiley_theme *theme) |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
164 { |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
165 GHashTable *already_freed; |
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
166 struct smiley_list *wer; |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
167 |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
168 already_freed = g_hash_table_new(g_direct_hash, g_direct_equal); |
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
169 for (wer = theme->list; wer != NULL; wer = theme->list) { |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
170 while (wer->smileys) { |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
171 GtkIMHtmlSmiley *uio = wer->smileys->data; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24311
diff
changeset
|
172 |
24311
9ea84135db24
Remove that hack involving GtkIMHtmlSmileys
Marcus Lundblad <ml@update.uu.se>
parents:
22889
diff
changeset
|
173 if (uio->imhtml) { |
9ea84135db24
Remove that hack involving GtkIMHtmlSmileys
Marcus Lundblad <ml@update.uu.se>
parents:
22889
diff
changeset
|
174 g_signal_handlers_disconnect_matched(uio->imhtml, G_SIGNAL_MATCH_DATA, |
9ea84135db24
Remove that hack involving GtkIMHtmlSmileys
Marcus Lundblad <ml@update.uu.se>
parents:
22889
diff
changeset
|
175 0, 0, NULL, NULL, uio); |
9ea84135db24
Remove that hack involving GtkIMHtmlSmileys
Marcus Lundblad <ml@update.uu.se>
parents:
22889
diff
changeset
|
176 } |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24311
diff
changeset
|
177 |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
178 if (uio->icon) |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
179 g_object_unref(uio->icon); |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
180 if (g_hash_table_lookup(already_freed, uio->file) == NULL) { |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
181 g_free(uio->file); |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
182 g_hash_table_insert(already_freed, uio->file, GINT_TO_POINTER(1)); |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
183 } |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
184 g_free(uio->smile); |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
185 g_free(uio); |
28138
deecc1d663c4
Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28136
diff
changeset
|
186 wer->smileys = g_slist_delete_link(wer->smileys, wer->smileys); |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
187 } |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
188 theme->list = wer->next; |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
189 g_free(wer->sml); |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
190 g_free(wer); |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
191 } |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
192 theme->list = NULL; |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
193 |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
194 g_hash_table_destroy(already_freed); |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
195 } |
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
196 |
17653 | 197 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
198 pidgin_smiley_themes_remove_non_existing(void) |
17653 | 199 { |
200 static struct smiley_theme *theme = NULL; | |
201 GSList *iter = NULL; | |
202 | |
203 if (!smiley_themes) return ; | |
204 | |
205 for (iter = smiley_themes ; iter ; iter = iter->next) { | |
206 theme = ((struct smiley_theme *)(iter->data)); | |
207 if (!g_file_test(theme->path, G_FILE_TEST_EXISTS)) { | |
208 if (theme == current_smiley_theme) | |
209 current_smiley_theme = ((struct smiley_theme *)(NULL == iter->next ? NULL : iter->next->data)); | |
18376
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
210 pidgin_themes_destroy_smiley_theme(theme); |
17653 | 211 iter->data = NULL; |
212 } | |
213 } | |
214 /* Remove all elements whose data is NULL */ | |
215 smiley_themes = g_slist_remove_all(smiley_themes, NULL); | |
216 | |
17654 | 217 if (!current_smiley_theme && smiley_themes) { |
218 struct smiley_theme *smile = g_slist_last(smiley_themes)->data; | |
219 pidgin_themes_load_smiley_theme(smile->path, TRUE); | |
220 } | |
17653 | 221 } |
222 | |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
223 void pidgin_themes_load_smiley_theme(const char *file, gboolean load) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 FILE *f = g_fopen(file, "r"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 char buf[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 char *i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 struct smiley_theme *theme=NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 struct smiley_list *list = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 GSList *lst = smiley_themes; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 char *dirname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 if (!f) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 while (lst) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 struct smiley_theme *thm = lst->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 if (!strcmp(thm->path, file)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 theme = thm; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 lst = lst->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 |
28139
5b21007cf503
Oops, fix loading smiley themes.
Paul Aurich <paul@darkrain42.org>
parents:
28138
diff
changeset
|
245 if (theme != NULL && theme == current_smiley_theme) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 /* Don't reload the theme if it is already loaded */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 fclose(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
28136
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
251 if (theme == NULL) { |
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
252 theme = g_new0(struct smiley_theme, 1); |
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
253 theme->path = g_strdup(file); |
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
254 smiley_themes = g_slist_prepend(smiley_themes, theme); |
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
255 } |
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
256 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 dirname = g_path_get_dirname(file); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 while (!feof(f)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 if (!fgets(buf, sizeof(buf), f)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 if (buf[0] == '#' || buf[0] == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 i = buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 while (isspace(*i)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 i++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 if (*i == '[' && strchr(i, ']') && load) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 struct smiley_list *child = g_new0(struct smiley_list, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 child->sml = g_strndup(i+1, strchr(i, ']') - i - 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 if (theme->list) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 list->next = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 theme->list = child; |
17666
fe5a89474e6d
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <stu@nosnilmot.com>
parents:
17476
diff
changeset
|
278 /* Reverse the Smiley list since it was built in reverse order for efficiency reasons */ |
fe5a89474e6d
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <stu@nosnilmot.com>
parents:
17476
diff
changeset
|
279 if (list != NULL) |
fe5a89474e6d
Reverse the smiley list only after reading the whole list of smileys in.
Stu Tomlinson <stu@nosnilmot.com>
parents:
17476
diff
changeset
|
280 list->smileys = g_slist_reverse(list->smileys); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 list = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 } else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 g_free(theme->name); |
17476
92821180bded
A somewhat-Warmenhoved patch from tfujiwara to allow for the smiley theme
Richard Laager <rlaager@wiktel.com>
parents:
16361
diff
changeset
|
285 theme->name = g_strdup(i + strlen("Name=")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 len = strlen(theme->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 theme->name[len-1] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 if(len > 2 && theme->name[len-2] == '\r') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 theme->name[len-2] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 } else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 g_free(theme->desc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 theme->desc = g_strdup(i + strlen("Description=")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 theme->desc[strlen(theme->desc)-1] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 } else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 g_free(theme->icon); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 theme->icon[strlen(theme->icon)-1] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 } else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 g_free(theme->author); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 theme->author = g_strdup(i + strlen("Author=")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 theme->author[strlen(theme->author)-1] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 } else if (load && list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 gboolean hidden = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 char *sfile = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 if (*i == '!' && *(i + 1) == ' ') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 hidden = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 i = i + 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 while (*i) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 char l[64]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 int li = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 while (!isspace(*i) && li < sizeof(l) - 1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 if (*i == '\\' && *(i+1) != '\0' && *(i+1) != '\n' && *(i+1) != '\r') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 i++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 l[li++] = *(i++); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 } |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
318 l[li] = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 if (!sfile) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 sfile = g_build_filename(dirname, l, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 } else { |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
322 GtkIMHtmlSmiley *smiley = gtk_imhtml_smiley_create(sfile, l, hidden, 0); |
16150
218818f96b93
Change a g_slist_append() to a g_slist_prepend() in one place, and
Mark Doliner <mark@kingant.net>
parents:
16133
diff
changeset
|
323 list->smileys = g_slist_prepend(list->smileys, smiley); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 while (isspace(*i)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 i++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 } |
16361
4d2201900a35
Fix #273 (Emoticons appearing in reverse order).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16202
diff
changeset
|
329 |
4d2201900a35
Fix #273 (Emoticons appearing in reverse order).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16202
diff
changeset
|
330 |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
331 g_free(sfile); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 |
17667
98f27c7f0ef5
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <stu@nosnilmot.com>
parents:
17666
diff
changeset
|
335 /* Reverse the Smiley list since it was built in reverse order for efficiency reasons */ |
98f27c7f0ef5
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <stu@nosnilmot.com>
parents:
17666
diff
changeset
|
336 if (list != NULL) |
98f27c7f0ef5
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <stu@nosnilmot.com>
parents:
17666
diff
changeset
|
337 list->smileys = g_slist_reverse(list->smileys); |
98f27c7f0ef5
We also need to reverse the last protocol's smiley list instead of only
Stu Tomlinson <stu@nosnilmot.com>
parents:
17666
diff
changeset
|
338 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 g_free(dirname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 fclose(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 if (!theme->name || !theme->desc || !theme->author) { |
15823 | 343 purple_debug_error("gtkthemes", "Invalid file format, not loading smiley theme from '%s'\n", file); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 |
28136
c91832e94473
Clarify load_smiley_theme a little. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
345 smiley_themes = g_slist_remove(smiley_themes, theme); |
18376
e56531865ea5
Eliminate some duplicate code.
Richard Laager <rlaager@wiktel.com>
parents:
18295
diff
changeset
|
346 pidgin_themes_destroy_smiley_theme(theme); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 if (load) { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
351 GList *cnv; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 |
16133
019092f88c43
Pull out the same block of code from two places and put it into
Mark Doliner <mark@kingant.net>
parents:
16132
diff
changeset
|
353 if (current_smiley_theme) |
17483
cf6b7aeae062
Need help reflecting selected smiley theme after remove
Gabriel Schulhof <nix@go-nix.ca>
parents:
17482
diff
changeset
|
354 pidgin_themes_destroy_smiley_theme_smileys(current_smiley_theme); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 current_smiley_theme = theme; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
15823 | 357 for (cnv = purple_get_conversations(); cnv != NULL; cnv = cnv->next) { |
358 PurpleConversation *conv = cnv->data; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
15632
a830f9756f23
Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15514
diff
changeset
|
360 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
361 /* We want to see our custom smileys on our entry if we write the shortcut */ |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
362 pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22007
diff
changeset
|
363 pidgin_themes_smiley_themeize_custom(PIDGIN_CONVERSATION(conv)->entry); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
369 void pidgin_themes_smiley_theme_probe() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 GDir *dir; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 const gchar *file; |
17653 | 373 gchar *path, *test_path; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 int l; |
17653 | 375 char* probedirs[3]; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 |
17653 | 377 pidgin_smiley_themes_remove_non_existing(); |
378 | |
15858 | 379 probedirs[0] = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", NULL); |
15823 | 380 probedirs[1] = g_build_filename(purple_user_dir(), "smileys", NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 probedirs[2] = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 for (l=0; probedirs[l]; l++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 dir = g_dir_open(probedirs[l], 0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 if (dir) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 while ((file = g_dir_read_name(dir))) { |
17653 | 386 test_path = g_build_filename(probedirs[l], file, NULL); |
387 if (g_file_test(test_path, G_FILE_TEST_IS_DIR)) { | |
388 path = g_build_filename(probedirs[l], file, "theme", NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 |
17653 | 390 /* Here we check to see that the theme has proper syntax. |
391 * We set the second argument to FALSE so that it doesn't load | |
392 * the theme yet. | |
393 */ | |
394 pidgin_themes_load_smiley_theme(path, FALSE); | |
395 g_free(path); | |
396 } | |
397 g_free(test_path); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 g_dir_close(dir); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 } else if (l == 1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_mkdir(probedirs[l], S_IRUSR | S_IWUSR | S_IXUSR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 g_free(probedirs[l]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 } |
17653 | 405 |
17654 | 406 if (!current_smiley_theme && smiley_themes) { |
407 struct smiley_theme *smile = smiley_themes->data; | |
408 pidgin_themes_load_smiley_theme(smile->path, TRUE); | |
409 } | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
412 GSList *pidgin_themes_get_proto_smileys(const char *id) { |
15823 | 413 PurplePlugin *proto; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 struct smiley_list *list, *def; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 if ((current_smiley_theme == NULL) || (current_smiley_theme->list == NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 def = list = current_smiley_theme->list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 if (id == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 return def->smileys; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 |
15823 | 424 proto = purple_find_prpl(id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 while (list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 if (!strcmp(list->sml, "default")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 def = list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 else if (proto && !strcmp(proto->info->name, list->sml)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 list = list->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 return list ? list->smileys : def->smileys; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
438 void pidgin_themes_init() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 GSList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 const char *current_theme = |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15858
diff
changeset
|
442 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
444 pidgin_themes_smiley_theme_probe(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 for (l = smiley_themes; l; l = l->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 struct smiley_theme *smile = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 if (smile->name && strcmp(current_theme, smile->name) == 0) { |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
449 pidgin_themes_load_smiley_theme(smile->path, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 /* If we still don't have a smiley theme, choose the first one */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 if (!current_smiley_theme && smiley_themes) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 struct smiley_theme *smile = smiley_themes->data; |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16151
diff
changeset
|
457 pidgin_themes_load_smiley_theme(smile->path, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 } |