[Pkg-ROX-devel] Bug#273072: marked as done (rox-filer: 2.1 icon theme support backport)

Debian Bug Tracking System owner@bugs.debian.org
Sun, 30 Jan 2005 03:33:11 -0800


Your message dated Sun, 30 Jan 2005 06:17:10 -0500
with message-id <E1CvD4o-0003Zi-00@newraff.debian.org>
and subject line Bug#273072: fixed in rox 2.2.0-1
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 23 Sep 2004 18:07:07 +0000
>From mechanix@lucretia.debian.net Thu Sep 23 11:07:07 2004
Return-path: <mechanix@lucretia.debian.net>
Received: from smtp1.xs4all.be [195.144.64.135] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CAXzn-0005Gr-00; Thu, 23 Sep 2004 11:07:07 -0700
Received: from lucretia.hangar.be (195-144-080-152.dyn.adsl.xs4all.be [195.144.80.152])
	by smtp1.xs4all.be (8.12.10/8.12.10) with ESMTP id i8NI75Lg005065;
	Thu, 23 Sep 2004 20:07:05 +0200
Received: by lucretia.hangar.be (Postfix, from userid 1000)
	id 0847718112; Thu, 23 Sep 2004 20:07:04 +0200 (CEST)
Date: Thu, 23 Sep 2004 20:07:04 +0200
From: Filip Van Raemdonck <mechanix@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: rox-filer: 2.1 icon theme support backport
Message-ID: <20040923180704.GA928@lucretia.debian.net>
Mail-Followup-To: Debian Bug Tracking System <submit@bugs.debian.org>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY"
Content-Disposition: inline
X-Reportbug-Version: 2.99.3
X-Marks-The-Spot: xxxxxxxxxx
X-GPG-Fingerprint: 1024D/8E950E00 CAC1 0932 B6B9 8768 40DB  C6AA 1239 F709 8E95 0E00
X-Machine-info: Linux lucretia 2.4.27 i686
User-Agent: Mutt/1.5.6+20040818i
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 


--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: rox-filer
Tags: patch

Hi,

Attached is a patch I have sitting around for the 2.1 icon theme support,
backported to 2.0.1. The bits about options are left out for now. (which
means the theme _must_ be symlinked to, or installed in $icon_dir/ROX)

Just as in 2.1, this keeps the 2.0 icon support as default and only uses
icon themes if the old way cannot provide an icon.


Regards,

Filip

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.27
Locale: LANG=C, LC_CTYPE=nl_BE@euro

-- 
"Beer is God's way of telling us that he loves us and wants us to be happy."
	-- Benjamin Franklin

--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="005-fdicons.patch"

--- ROX-Filer/src/type.c.orig
+++ ROX-Filer/src/type.c
@@ -40,6 +40,8 @@
 # include <libgnomevfs/gnome-vfs-application-registry.h>
 #endif
 
+#include <gtk/gtkicontheme.h>
+
 #include "global.h"
 
 #include "string.h"
@@ -89,6 +91,7 @@
 static char *get_action_save_path(GtkWidget *dialog);
 static MIME_type *get_mime_type(const gchar *type_name, gboolean can_create);
 static gboolean remove_handler_with_confirm(const guchar *path);
+static void set_icon_theme(void);
 
 /* When working out the type for a file, this hash table is checked
  * first...
@@ -129,9 +132,13 @@
 
 static Option o_display_colour_types;
 
+static GtkIconTheme *icon_theme = NULL;
+
 void type_init(void)
 {
 	int		i;
+
+	icon_theme = gtk_icon_theme_new();
 	
 	extension_hash = g_hash_table_new(g_str_hash, g_str_equal);
 	type_hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -156,6 +163,8 @@
 				  opt_type_colours[i][1]);
 	alloc_type_colours();
 
+	set_icon_theme();
+
 	option_add_notify(alloc_type_colours);
 }
 
@@ -164,6 +173,7 @@
  */
 void reread_mime_files(void)
 {
+	gtk_icon_theme_rescan_if_needed(icon_theme);
 	load_mime_types();
 }
 
@@ -411,8 +421,8 @@
  */
 MaskedPixmap *type_to_icon(MIME_type *type)
 {
-	char	*path;
-	char	*type_name;
+	GdkPixbuf *full;
+	char	*type_name, *path;
 	time_t	now;
 
 	if (type == NULL)
@@ -435,8 +445,8 @@
 		type->image = NULL;
 	}
 
-	type_name = g_strconcat(type->media_type, "_",
-				type->subtype, ".png", NULL);
+	type_name = g_strconcat(type->media_type, "_", type->subtype,
+				".png", NULL);
 	path = choices_find_path_load(type_name, "MIME-icons");
 	if (!path)
 	{
@@ -452,6 +462,39 @@
 		g_free(path);
 	}
 
+	if (type->image)
+		goto out;
+
+	type_name = g_strconcat("mime-", type->media_type, ":",
+				type->subtype, NULL);
+	full = gtk_icon_theme_load_icon(icon_theme, type_name, HUGE_HEIGHT,
+						0, NULL);
+	g_free(type_name);
+	if (!full)
+	{
+		/* Ugly hack... try for a GNOME icon */
+		type_name = g_strconcat("gnome-mime-", type->media_type,
+				"-", type->subtype, NULL);
+		full = gtk_icon_theme_load_icon(icon_theme,
+						type_name,
+						HUGE_HEIGHT, 0, NULL);
+		g_free(type_name);
+	}
+	if (!full)
+	{
+		/* Try for a media type */
+		type_name = g_strconcat("mime-", type->media_type, NULL);
+		full = gtk_icon_theme_load_icon(icon_theme,
+						type_name,
+						HUGE_HEIGHT, 0, NULL);
+		g_free(type_name);
+	}
+	if (full)
+	{
+		type->image = masked_pixmap_new(full);
+		g_object_unref(full);
+	}
+
 	if (!type->image)
 	{
 		/* One ref from the type structure, one returned */
@@ -459,6 +502,7 @@
 		g_object_ref(im_unknown);
 	}
 
+out:
 	type->image_time = now;
 	
 	g_object_ref(type->image);
@@ -1367,3 +1411,57 @@
 
 	return type->comment;
 }
+
+static void set_icon_theme(void)
+{
+	GtkIconInfo *info;
+	char *icon_home;
+	const char *theme_name = NULL; /*o_icon_theme.value;*/
+
+	if (!theme_name || !*theme_name)
+		theme_name = "ROX";
+
+	while (1)
+	{
+		gtk_icon_theme_set_custom_theme(icon_theme, theme_name);
+		info = gtk_icon_theme_lookup_icon(icon_theme,
+				"mime-application:postscript",
+				ICON_HEIGHT, 0);
+		if (!info)
+		{
+			info = gtk_icon_theme_lookup_icon(icon_theme,
+					"gnome-mime-application-postscript",
+					ICON_HEIGHT, 0);
+		}
+		if (info)
+		{
+			gtk_icon_info_free(info);
+			return;
+		}
+
+		if (strcmp(theme_name, "ROX") == 0)
+			break;
+
+		delayed_error(_("Icon theme '%s' does not contain MIME icons. "
+				"Using ROX default theme instead."),
+				theme_name);
+		
+		theme_name = "ROX";
+	}
+
+	icon_home = g_build_filename(home_dir, ".icons", NULL);
+	if (!file_exists(icon_home))
+		mkdir(icon_home, 0755);
+	g_free(icon_home);	
+
+	icon_home = g_build_filename(home_dir, ".icons", "ROX", NULL);
+	if (symlink(make_path(app_dir, "ROX"), icon_home))
+		delayed_error(_("Failed to create symlink '%s':\n%s\n\n"
+		"(this may mean that the ROX theme already exists there, but "
+		"the 'mime-application:postscript' icon couldn't be loaded for "
+		"some reason)"), icon_home, g_strerror(errno));
+	g_free(icon_home);
+
+	gtk_icon_theme_rescan_if_needed(icon_theme);
+}
+

--4Ckj6UjgE2iN1+kY--

---------------------------------------
Received: (at 273072-close) by bugs.debian.org; 30 Jan 2005 11:23:02 +0000
>From katie@ftp-master.debian.org Sun Jan 30 03:23:02 2005
Return-path: <katie@ftp-master.debian.org>
Received: from newraff.debian.org [208.185.25.31] (mail)
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CvDAU-0006Sj-00; Sun, 30 Jan 2005 03:23:02 -0800
Received: from katie by newraff.debian.org with local (Exim 3.35 1 (Debian))
	id 1CvD4o-0003Zi-00; Sun, 30 Jan 2005 06:17:10 -0500
From: Francesco Paolo Lovergine <frankie@debian.org>
To: 273072-close@bugs.debian.org
X-Katie: $Revision: 1.55 $
Subject: Bug#273072: fixed in rox 2.2.0-1
Message-Id: <E1CvD4o-0003Zi-00@newraff.debian.org>
Sender: Archive Administrator <katie@ftp-master.debian.org>
Date: Sun, 30 Jan 2005 06:17:10 -0500
Delivered-To: 273072-close@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Source: rox
Source-Version: 2.2.0-1

We believe that the bug you reported is fixed in the latest version of
rox, which is due to be installed in the Debian FTP archive:

rox-filer_2.2.0-1_i386.deb
  to pool/main/r/rox/rox-filer_2.2.0-1_i386.deb
rox_2.2.0-1.diff.gz
  to pool/main/r/rox/rox_2.2.0-1.diff.gz
rox_2.2.0-1.dsc
  to pool/main/r/rox/rox_2.2.0-1.dsc
rox_2.2.0.orig.tar.gz
  to pool/main/r/rox/rox_2.2.0.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 273072@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Francesco Paolo Lovergine <frankie@debian.org> (supplier of updated rox package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 30 Jan 2005 11:59:27 +0100
Source: rox
Binary: rox-filer
Architecture: source i386
Version: 2.2.0-1
Distribution: unstable
Urgency: low
Maintainer: The ROX-in-Debian Project Team <pkg-rox-devel@lists.alioth.debian.org>
Changed-By: Francesco Paolo Lovergine <frankie@debian.org>
Description: 
 rox-filer  - A simple graphical file manager for X11
Closes: 273072 274007 286162 289314
Changes: 
 rox (2.2.0-1) unstable; urgency=low
 .
   * New upstream release
     (closes: #273072)
   * Disabled current menu method to avoid breaking FHS. It needs a better knowledge of rox-filer inners.
     Maybe I'll re-introduce that later, if truly useful.
     Also added menu to suggested packages in control.
     (closes: #286162)
   * Removed additional debian images and sharutils dependency.
   * Rules file revised to meet current building system and files.
   * rox-filer binary renamed rox, the same for all other rox-filer refs.
     Leaving rox-filer symlink anyway.
     (closes: #274007)
   * Added mimeapps.dpatch and dnd.patch to manage mime apps for text and text-html a la debian way.
     (closes: #289314)
Files: 
 b3ed0610eabea7e02a9e0e8a0b13faac 1018 x11 optional rox_2.2.0-1.dsc
 0deefd9e7edd4e79cd0f18f423264ebb 2033724 x11 optional rox_2.2.0.orig.tar.gz
 1aaba6e45d71b84d523a37212403da63 9539 x11 optional rox_2.2.0-1.diff.gz
 3b82bcb8cc321ae852e5fce45093923d 1203244 x11 optional rox-filer_2.2.0-1_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB/L/VpFNRmenyx0cRAkIvAKDzueRyijWqrVOSnAEiJ4QI588dxwCg67Lb
tLRjRom6C8hzbzKobA7TeK4=
=amYz
-----END PGP SIGNATURE-----