After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 591867 - support .themepack file formats
support .themepack file formats
Status: RESOLVED WONTFIX
Product: gnome-control-center
Classification: Core
Component: Background
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on: 592848 593863
Blocks:
 
 
Reported: 2009-08-15 01:34 UTC by William Jon McCann
Modified: 2013-04-14 01:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
initial patch (21.86 KB, patch)
2009-09-02 00:37 UTC, William Jon McCann
none Details | Review
updated patch (21.90 KB, patch)
2009-09-02 01:02 UTC, William Jon McCann
needs-work Details | Review
updated patch (22.70 KB, patch)
2009-09-02 20:02 UTC, William Jon McCann
needs-work Details | Review

Description William Jon McCann 2009-08-15 01:34:49 UTC
It would be great to support .themepack file formats.  At least we should try to import the slideshow desktop backgrounds out of them.

http://blogs.msdn.com/e7/archive/2009/06/03/creating-saving-sharing-themes-in-windows-7.aspx

Also see https://bugs.freedesktop.org/show_bug.cgi?id=23314
Comment 2 William Jon McCann 2009-08-15 01:42:51 UTC
http://www.cabextract.org.uk/ seems to open the file nicely.
Comment 3 William Jon McCann 2009-09-02 00:37:28 UTC
Created attachment 142288 [details] [review]
initial patch
Comment 4 William Jon McCann 2009-09-02 01:02:39 UTC
Created attachment 142290 [details] [review]
updated patch

Fix leak.
Comment 5 Jens Granseuer 2009-09-02 18:54:44 UTC
+	res = g_key_file_load_from_data (kf, converted, strlen (converted), 0, &error);

converted can be NULL here. strlen doesn't like that.

+		g_warning ("File '%s' doesn't have a Slideshowgroup", filename);

Missing " ".

+	display_name = g_key_file_get_string (kf, "Theme", "DisplayName", NULL);
+	slideshow_path = g_key_file_get_string (kf, "Slideshow", "ImagesRootPath", NULL);
+	interval = g_key_file_get_integer (kf, "Slideshow", "Interval", NULL);
+	shuffle = g_key_file_get_boolean (kf, "Slideshow", "Shuffle", NULL);

Looks like all of these should be const.

+	if (!g_file_move (src_file, dest_file, G_FILE_COPY_NONE, NULL, NULL, NULL, &error)) {
+		g_warning ("Error while moving from `%s' to `%s': %s",
+			   slideshow_path, new_path, error->message);
+		g_error_free (error);
+		error = NULL;
+	}
+	g_object_unref (dest_file);
+	g_object_unref (src_file);
+	g_object_unref (base_file);
+	g_free (new_path);
+
+	write_backgrounds_xml (xml_path, interval / 1000.0, shuffle);
+	g_free (xml_path);
+
+	ret = TRUE;

This looks like the write and the TRUE return shouldn't happen if the move failed.

+			convert_windows_theme (parent, p);
+		}
+		g_free (p);
+	}
+
+	g_dir_close (d);
+	return TRUE;

Should *at least* return FALSE if all theme conversions fail.

+	gboolean res;
...
-			if (!g_file_move (src_file, new_file, G_FILE_COPY_NONE,
-					  NULL, NULL, NULL, &error)) {
+			res = g_file_move (src_file,
+					   new_file,
+					   G_FILE_COPY_NONE,
+					   NULL, NULL, NULL,
+					   &error);
+			if (! res) {

These changes look like unnecessary code churn. Please drop.
Comment 6 William Jon McCann 2009-09-02 20:02:45 UTC
Created attachment 142348 [details] [review]
updated patch

Thanks for the review.  This should fix for the comments and a few other leaks.  I'm not sure what you meant by "consts" though.
Comment 7 Jens Granseuer 2009-09-04 11:20:08 UTC
(In reply to comment #6)
>  I'm not sure what you meant by "consts" though.

Since you weren't freeing the strings I assumed g_key_file_get_string returned a const char *. Now that you do, it seems that assumption was inccorrect. ;-)

@@ -364,9 +748,13 @@ gnome_theme_install_real (GtkWindow *parent,
 	theme_source_dir = g_file_new_for_path (tmp_dir);
 	theme_dest_dir = g_file_new_for_path (target_dir);
 
-	if (!g_file_move (theme_source_dir, theme_dest_dir,
-			  G_FILE_COPY_OVERWRITE, NULL, NULL,
-			  NULL, &error)) {
+	if (! g_file_move (theme_source_dir,
+			   theme_dest_dir,
+			   G_FILE_COPY_OVERWRITE,
+			   NULL,
+			   NULL,
+			   NULL,
+			   &error)) {
 		gchar *str;

This hunk still looks unnecessary.

Also, I'm wondering about the blocking bugs you entered here. Why are those blocking this one?
Comment 8 Bastien Nocera 2011-02-12 03:18:19 UTC
Jon, do we still want to support those for GNOME 3?

I'm fine with trying to load those if installed in a special directory (but probably for GNOME 3.2).
Comment 9 Bastien Nocera 2011-09-21 17:45:47 UTC
This is a similar problem to the one in bug 595890.

A couple of notes on the code:
- what should be the interaction of clicking on themepack links?
- should we present a dialogue asking the user if they're sure about installing it?
- it should definitely use libarchive to unpack the archive rather than "do it by hand" with "7za" or cabextract.
- the themepack mime-type is upstream
Comment 10 Jasper St. Pierre (not reading bugmail) 2013-04-14 01:33:52 UTC
I'm going to assume we don't want this anymore. Feel free to reopen if we do.