soc.2009.webkitmessageview: 214d3be4: partial work towards theme selection.

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:02:00 EDT 2009


-----------------------------------------------------------------
Revision: 214d3be4d0beb9a94eda74085e413521deff2f6f
Ancestor: 8ef014fc756bd904979ecffed1b0ff91e204724b
Author: tdrhq at soc.pidgin.im
Date: 2009-08-10T08:17:12
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/214d3be4d0beb9a94eda74085e413521deff2f6f

Modified files:
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

partial work towards theme selection.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	84ac5b9752fd1feb038d24be24208d331baf023d
+++ pidgin/plugins/adiumthemes/webkit.c	ebffda7c308938cf197928e9e92001c863dfe22d
@@ -587,7 +587,56 @@ webkit_on_conversation_hiding (PidginCon
 	 */
 }
 
+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.
  */
 static GList*
@@ -658,6 +707,9 @@ plugin_load(PurplePlugin *plugin)
 	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 *
 }
 
 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 @@ get_config_frame(PurplePlugin *plugin) 
 	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,


More information about the Commits mailing list