Mercurial > pidgin
changeset 32084:d60517f63f99
partial work towards theme selection.
author | tdrhq@soc.pidgin.im |
---|---|
date | Mon, 10 Aug 2009 08:17:12 +0000 |
parents | ef8d9e44cc73 |
children | f989838b91ae |
files | pidgin/plugins/adiumthemes/webkit.c |
diffstat | 1 files changed, 62 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/plugins/adiumthemes/webkit.c Mon Aug 10 07:49:37 2009 +0000 +++ b/pidgin/plugins/adiumthemes/webkit.c Mon Aug 10 08:17:12 2009 +0000 @@ -587,6 +587,55 @@ */ } +static GList* +get_dir_dir_list (const char* dirname) +{ + GList *ret = NULL; + GDir *dir = g_dir_open (dirname, 0, NULL); + const char* subdir; + + if (!dir) return NULL; + while ((subdir = g_dir_read_name (dir))) { + ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); + } + + g_dir_close (dir); + return ret; +} + +/** + * Get me a list of all the available themes specified by their + * directories. I don't guarrantee that these are valid themes, just + * that they are in the directories for themes. + */ +static GList* +get_theme_directory_list () +{ + char *user_dir, *user_style_dir, *global_style_dir; + GList *list1, *list2; + + user_dir = g_strdup (purple_user_dir ()); + if (!g_path_is_absolute (user_dir)) { + char* cur = g_get_current_dir (); + g_free (user_dir); + user_dir = g_build_filename (cur, purple_user_dir(), NULL); + g_free (cur); + } + + user_style_dir = g_build_filename (user_dir, "styles", NULL); + global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); + + list1 = get_dir_dir_list (user_style_dir); + list2 = get_dir_dir_list (global_style_dir); + + g_free (global_style_dir); + g_free (user_style_dir); + g_free (user_dir); + + return g_list_concat (list1, list2); +} + + /** * Get each of the files corresponding to each variant. */ @@ -658,6 +707,9 @@ if (g_path_is_absolute (purple_user_dir())) cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); else { + + + char* cur = g_get_current_dir (); cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); g_free (cur); @@ -786,7 +838,7 @@ } static GtkWidget * -get_config_frame(PurplePlugin *plugin) +get_variant_config_frame() { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); GList *variants = get_variant_files(style); @@ -847,6 +899,15 @@ return combobox; } +static GtkWidget* +get_config_frame(PurplePlugin* plugin) +{ + GtkWidget *vbox = gtk_vbox_new (TRUE, 0); + + gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0); + return vbox; +} + PidginPluginUiInfo ui_info = { get_config_frame,