Move smileys and themes to XDG data directory.

Tue, 08 Oct 2019 21:37:33 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Tue, 08 Oct 2019 21:37:33 -0400
changeset 39955
0ab521bb0887
parent 39954
e843e8fab70c
child 39956
8f806e6d1348

Move smileys and themes to XDG data directory.

pidgin/gtkprefs.c file | annotate | diff | comparison | revisions
pidgin/gtksmiley-theme.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkprefs.c	Tue Oct 08 21:22:50 2019 -0400
+++ b/pidgin/gtkprefs.c	Tue Oct 08 21:37:33 2019 -0400
@@ -1245,9 +1245,9 @@
 	g_strchomp(path);
 
 	if ((is_smiley_theme = purple_strequal(info->type, "smiley")))
-		destdir = g_build_filename(purple_user_dir(), "smileys", NULL);
+		destdir = g_build_filename(purple_data_dir(), "smileys", NULL);
 	else
-		destdir = g_build_filename(purple_user_dir(), "themes", "temp", NULL);
+		destdir = g_build_filename(purple_data_dir(), "themes", "temp", NULL);
 
 	/* We'll check this just to make sure. This also lets us do something different on
 	 * other platforms, if need be */
@@ -1292,17 +1292,17 @@
 
 		if (PURPLE_IS_THEME(theme)) {
 			/* create the location for the theme */
-			gchar *theme_dest = g_build_filename(purple_user_dir(), "themes",
-						 purple_theme_get_name(theme),
-						 "purple", info->type, NULL);
+			gchar *theme_dest = g_build_filename(purple_data_dir(), "themes",
+			                                     purple_theme_get_name(theme),
+			                                     "purple", info->type, NULL);
 
 			if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
 				purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
 
 			g_free(theme_dest);
-			theme_dest = g_build_filename(purple_user_dir(), "themes",
-						 purple_theme_get_name(theme),
-						 "purple", info->type, NULL);
+			theme_dest = g_build_filename(purple_data_dir(), "themes",
+			                              purple_theme_get_name(theme),
+			                              "purple", info->type, NULL);
 
 			/* move the entire directory to new location */
 			if (g_rename(purple_theme_get_dir(theme), theme_dest)) {
@@ -1329,7 +1329,8 @@
 	} else { /* just a single file so copy it to a new temp directory and attempt to load it*/
 		gchar *temp_path, *temp_file;
 
-		temp_path = g_build_filename(purple_user_dir(), "themes", "temp", "sub_folder", NULL);
+		temp_path = g_build_filename(purple_data_dir(), "themes", "temp",
+		                             "sub_folder", NULL);
 
 		if (info->original_name != NULL) {
 			/* name was changed from the original (probably a dnd) change it back before loading */
@@ -1349,9 +1350,10 @@
 			theme = prefs_theme_find_theme(temp_path, info->type);
 
 			if (PURPLE_IS_THEME(theme)) {
-				gchar *theme_dest = g_build_filename(purple_user_dir(), "themes",
-							 purple_theme_get_name(theme),
-							 "purple", info->type, NULL);
+				gchar *theme_dest =
+				        g_build_filename(purple_data_dir(), "themes",
+				                         purple_theme_get_name(theme), "purple",
+				                         info->type, NULL);
 
 				if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
 					purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
--- a/pidgin/gtksmiley-theme.c	Tue Oct 08 21:22:50 2019 -0400
+++ b/pidgin/gtksmiley-theme.c	Tue Oct 08 21:37:33 2019 -0400
@@ -555,8 +555,8 @@
 	probe_dirs = g_new0(gchar*, 3);
 	probe_dirs[0] = g_build_filename(
 		PURPLE_DATADIR, "pixmaps", "pidgin", "emotes", NULL);
-	user_smileys_dir = probe_dirs[1] = g_build_filename(
-		purple_user_dir(), "smileys", NULL);
+	user_smileys_dir = probe_dirs[1] =
+	        g_build_filename(purple_data_dir(), "smileys", NULL);
 
 	if (!g_file_test(user_smileys_dir, G_FILE_TEST_IS_DIR)) {
 		if (g_mkdir(user_smileys_dir, S_IRUSR | S_IWUSR | S_IXUSR) == 0) {

mercurial