comparison pidgin/gtkthemes.c @ 15501:d75099d2567e

gaim_gtk to pidgin. I hope
author Sean Egan <seanegan@gmail.com>
date Sat, 03 Feb 2007 07:23:11 +0000
parents 5fe8042783c1
children 535f002e7b0f
comparison
equal deleted inserted replaced
15500:45ecefd0ce3a 15501:d75099d2567e
34 #include "gtkthemes.h" 34 #include "gtkthemes.h"
35 35
36 GSList *smiley_themes = NULL; 36 GSList *smiley_themes = NULL;
37 struct smiley_theme *current_smiley_theme; 37 struct smiley_theme *current_smiley_theme;
38 38
39 gboolean gaim_gtkthemes_smileys_disabled() 39 gboolean pidginthemes_smileys_disabled()
40 { 40 {
41 if (!current_smiley_theme) 41 if (!current_smiley_theme)
42 return 1; 42 return 1;
43 43
44 return strcmp(current_smiley_theme->name, "none") == 0; 44 return strcmp(current_smiley_theme->name, "none") == 0;
45 } 45 }
46 46
47 void gaim_gtkthemes_smiley_themeize(GtkWidget *imhtml) 47 void pidginthemes_smiley_themeize(GtkWidget *imhtml)
48 { 48 {
49 struct smiley_list *list; 49 struct smiley_list *list;
50 if (!current_smiley_theme) 50 if (!current_smiley_theme)
51 return; 51 return;
52 52
61 } 61 }
62 list = list->next; 62 list = list->next;
63 } 63 }
64 } 64 }
65 65
66 void gaim_gtkthemes_load_smiley_theme(const char *file, gboolean load) 66 void pidginthemes_load_smiley_theme(const char *file, gboolean load)
67 { 67 {
68 FILE *f = g_fopen(file, "r"); 68 FILE *f = g_fopen(file, "r");
69 char buf[256]; 69 char buf[256];
70 char *i; 70 char *i;
71 struct smiley_theme *theme=NULL; 71 struct smiley_theme *theme=NULL;
247 247
248 for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { 248 for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
249 GaimConversation *conv = cnv->data; 249 GaimConversation *conv = cnv->data;
250 250
251 if (GAIM_IS_GTK_CONVERSATION(conv)) { 251 if (GAIM_IS_GTK_CONVERSATION(conv)) {
252 gaim_gtkthemes_smiley_themeize(GAIM_GTK_CONVERSATION(conv)->imhtml); 252 pidginthemes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml);
253 gaim_gtkthemes_smiley_themeize(GAIM_GTK_CONVERSATION(conv)->entry); 253 pidginthemes_smiley_themeize(PIDGIN_CONVERSATION(conv)->entry);
254 } 254 }
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 void gaim_gtkthemes_smiley_theme_probe() 259 void pidginthemes_smiley_theme_probe()
260 { 260 {
261 GDir *dir; 261 GDir *dir;
262 const gchar *file; 262 const gchar *file;
263 gchar *path; 263 gchar *path;
264 int l; 264 int l;
275 275
276 /* Here we check to see that the theme has proper syntax. 276 /* Here we check to see that the theme has proper syntax.
277 * We set the second argument to FALSE so that it doesn't load 277 * We set the second argument to FALSE so that it doesn't load
278 * the theme yet. 278 * the theme yet.
279 */ 279 */
280 gaim_gtkthemes_load_smiley_theme(path, FALSE); 280 pidginthemes_load_smiley_theme(path, FALSE);
281 g_free(path); 281 g_free(path);
282 } 282 }
283 g_dir_close(dir); 283 g_dir_close(dir);
284 } else if (l == 1) { 284 } else if (l == 1) {
285 g_mkdir(probedirs[l], S_IRUSR | S_IWUSR | S_IXUSR); 285 g_mkdir(probedirs[l], S_IRUSR | S_IWUSR | S_IXUSR);
286 } 286 }
287 g_free(probedirs[l]); 287 g_free(probedirs[l]);
288 } 288 }
289 } 289 }
290 290
291 GSList *gaim_gtkthemes_get_proto_smileys(const char *id) { 291 GSList *pidginthemes_get_proto_smileys(const char *id) {
292 GaimPlugin *proto; 292 GaimPlugin *proto;
293 struct smiley_list *list, *def; 293 struct smiley_list *list, *def;
294 294
295 if ((current_smiley_theme == NULL) || (current_smiley_theme->list == NULL)) 295 if ((current_smiley_theme == NULL) || (current_smiley_theme->list == NULL))
296 return NULL; 296 return NULL;
312 } 312 }
313 313
314 return list ? list->smileys : def->smileys; 314 return list ? list->smileys : def->smileys;
315 } 315 }
316 316
317 void gaim_gtkthemes_init() 317 void pidginthemes_init()
318 { 318 {
319 GSList *l; 319 GSList *l;
320 const char *current_theme = 320 const char *current_theme =
321 gaim_prefs_get_string("/gaim/gtk/smileys/theme"); 321 gaim_prefs_get_string("/gaim/gtk/smileys/theme");
322 322
323 gaim_gtkthemes_smiley_theme_probe(); 323 pidginthemes_smiley_theme_probe();
324 324
325 for (l = smiley_themes; l; l = l->next) { 325 for (l = smiley_themes; l; l = l->next) {
326 struct smiley_theme *smile = l->data; 326 struct smiley_theme *smile = l->data;
327 if (smile->name && strcmp(current_theme, smile->name) == 0) { 327 if (smile->name && strcmp(current_theme, smile->name) == 0) {
328 gaim_gtkthemes_load_smiley_theme(smile->path, TRUE); 328 pidginthemes_load_smiley_theme(smile->path, TRUE);
329 break; 329 break;
330 } 330 }
331 } 331 }
332 332
333 /* If we still don't have a smiley theme, choose the first one */ 333 /* If we still don't have a smiley theme, choose the first one */
334 if (!current_smiley_theme && smiley_themes) { 334 if (!current_smiley_theme && smiley_themes) {
335 struct smiley_theme *smile = smiley_themes->data; 335 struct smiley_theme *smile = smiley_themes->data;
336 gaim_gtkthemes_load_smiley_theme(smile->path, TRUE); 336 pidginthemes_load_smiley_theme(smile->path, TRUE);
337 } 337 }
338 338
339 } 339 }