Mercurial > pidgin.yaz
comparison pidgin/plugins/adiumthemes/webkit.c @ 32545:d60517f63f99
partial work towards theme selection.
author | tdrhq@soc.pidgin.im |
---|---|
date | Mon, 10 Aug 2009 08:17:12 +0000 |
parents | ef8d9e44cc73 |
children | f989838b91ae |
comparison
equal
deleted
inserted
replaced
32544:ef8d9e44cc73 | 32545:d60517f63f99 |
---|---|
585 * this anyway. (FIXME: have to catch a signal on the WebView | 585 * this anyway. (FIXME: have to catch a signal on the WebView |
586 * when the WebView closes.) | 586 * when the WebView closes.) |
587 */ | 587 */ |
588 } | 588 } |
589 | 589 |
590 static GList* | |
591 get_dir_dir_list (const char* dirname) | |
592 { | |
593 GList *ret = NULL; | |
594 GDir *dir = g_dir_open (dirname, 0, NULL); | |
595 const char* subdir; | |
596 | |
597 if (!dir) return NULL; | |
598 while ((subdir = g_dir_read_name (dir))) { | |
599 ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); | |
600 } | |
601 | |
602 g_dir_close (dir); | |
603 return ret; | |
604 } | |
605 | |
606 /** | |
607 * Get me a list of all the available themes specified by their | |
608 * directories. I don't guarrantee that these are valid themes, just | |
609 * that they are in the directories for themes. | |
610 */ | |
611 static GList* | |
612 get_theme_directory_list () | |
613 { | |
614 char *user_dir, *user_style_dir, *global_style_dir; | |
615 GList *list1, *list2; | |
616 | |
617 user_dir = g_strdup (purple_user_dir ()); | |
618 if (!g_path_is_absolute (user_dir)) { | |
619 char* cur = g_get_current_dir (); | |
620 g_free (user_dir); | |
621 user_dir = g_build_filename (cur, purple_user_dir(), NULL); | |
622 g_free (cur); | |
623 } | |
624 | |
625 user_style_dir = g_build_filename (user_dir, "styles", NULL); | |
626 global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); | |
627 | |
628 list1 = get_dir_dir_list (user_style_dir); | |
629 list2 = get_dir_dir_list (global_style_dir); | |
630 | |
631 g_free (global_style_dir); | |
632 g_free (user_style_dir); | |
633 g_free (user_dir); | |
634 | |
635 return g_list_concat (list1, list2); | |
636 } | |
637 | |
638 | |
590 /** | 639 /** |
591 * Get each of the files corresponding to each variant. | 640 * Get each of the files corresponding to each variant. |
592 */ | 641 */ |
593 static GList* | 642 static GList* |
594 get_variant_files(PidginMessageStyle *style) | 643 get_variant_files(PidginMessageStyle *style) |
656 PidginMessageStyle *_style; /* temp */ | 705 PidginMessageStyle *_style; /* temp */ |
657 | 706 |
658 if (g_path_is_absolute (purple_user_dir())) | 707 if (g_path_is_absolute (purple_user_dir())) |
659 cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); | 708 cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); |
660 else { | 709 else { |
710 | |
711 | |
712 | |
661 char* cur = g_get_current_dir (); | 713 char* cur = g_get_current_dir (); |
662 cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); | 714 cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); |
663 g_free (cur); | 715 g_free (cur); |
664 } | 716 } |
665 | 717 |
784 g_free (name_with_ext); | 836 g_free (name_with_ext); |
785 pidgin_message_style_unref (style); | 837 pidgin_message_style_unref (style); |
786 } | 838 } |
787 | 839 |
788 static GtkWidget * | 840 static GtkWidget * |
789 get_config_frame(PurplePlugin *plugin) | 841 get_variant_config_frame() |
790 { | 842 { |
791 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); | 843 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); |
792 GList *variants = get_variant_files(style); | 844 GList *variants = get_variant_files(style); |
793 GList *iter = variants; | 845 GList *iter = variants; |
794 char *curdir = NULL; | 846 char *curdir = NULL; |
845 | 897 |
846 g_free (css_path); | 898 g_free (css_path); |
847 return combobox; | 899 return combobox; |
848 } | 900 } |
849 | 901 |
902 static GtkWidget* | |
903 get_config_frame(PurplePlugin* plugin) | |
904 { | |
905 GtkWidget *vbox = gtk_vbox_new (TRUE, 0); | |
906 | |
907 gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0); | |
908 return vbox; | |
909 } | |
910 | |
850 PidginPluginUiInfo ui_info = | 911 PidginPluginUiInfo ui_info = |
851 { | 912 { |
852 get_config_frame, | 913 get_config_frame, |
853 0, /* page_num (Reserved) */ | 914 0, /* page_num (Reserved) */ |
854 | 915 |