brasero r656 - in trunk: . src



Author: philippr
Date: Fri Feb 29 15:12:43 2008
New Revision: 656
URL: http://svn.gnome.org/viewvc/brasero?rev=656&view=rev

Log:
	Fix icon for mime types (work with glib2.15.6)

	* configure.in:
	* src/brasero-data-tree-model.c:
	(brasero_data_tree_model_get_value),
	(brasero_data_tree_model_init), (brasero_data_tree_model_finalize):
	* src/brasero-search-beagle.c: (brasero_search_add_hit_to_tree):


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/brasero-data-tree-model.c
   trunk/src/brasero-search-beagle.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Feb 29 15:12:43 2008
@@ -63,7 +63,7 @@
 AC_SYS_LARGEFILE
 
 dnl ********** GNOME2 ******************************
-GLIB_REQUIRED=2.15.5
+GLIB_REQUIRED=2.15.6
 GMODULE_REQUIRED=2.6.0
 GIO_REQUIRED=2.15.5
 GDK_REQUIRED=2.6.0

Modified: trunk/src/brasero-data-tree-model.c
==============================================================================
--- trunk/src/brasero-data-tree-model.c	(original)
+++ trunk/src/brasero-data-tree-model.c	Fri Feb 29 15:12:43 2008
@@ -49,6 +49,8 @@
 {
 	guint stamp;
 
+	GtkIconTheme *theme;
+
 	GSList *shown;
 
 	gint sort_column;
@@ -518,15 +520,28 @@
 			g_value_set_string (value, "media-cdrom");
 		}
 		else if (BRASERO_FILE_NODE_MIME (node)) {
-			const gchar * const *icon_string = NULL;
+			const gchar *icon_string = NULL;
 			GIcon *icon;
 
 			/* NOTE: implemented in glib 2.15.6 (not for windows though) */
 			icon = g_content_type_get_icon (BRASERO_FILE_NODE_MIME (node));
-			if (G_IS_THEMED_ICON (icon))
-				icon_string = g_themed_icon_get_names (G_THEMED_ICON (icon));
+			if (G_IS_THEMED_ICON (icon)) {
+				const gchar * const *names = NULL;
+
+				names = g_themed_icon_get_names (G_THEMED_ICON (icon));
+				if (names) {
+					gint i;
+
+					for (i = 0; names [i]; i++) {
+						if (gtk_icon_theme_has_icon (priv->theme, names [i])) {
+							icon_string = names [i];
+							break;
+						}
+					}
+				}
+			}
 
-			g_value_set_string (value, icon_string?icon_string [2]:NULL);
+			g_value_set_string (value, icon_string);
 			g_object_unref (icon);
 		}
 		else
@@ -1441,6 +1456,8 @@
 	do {
 		priv->stamp = g_random_int ();
 	} while (!priv->stamp);
+
+	priv->theme = gtk_icon_theme_get_default ();
 }
 
 static void
@@ -1449,6 +1466,12 @@
 	BraseroDataTreeModelPrivate *priv;
 
 	priv = BRASERO_DATA_TREE_MODEL_PRIVATE (object);
+
+	if (priv->theme) {
+		g_object_unref (priv->theme);
+		priv->theme = NULL;
+	}
+
 	if (priv->shown) {
 		g_slist_free (priv->shown);
 		priv->shown = NULL;

Modified: trunk/src/brasero-search-beagle.c
==============================================================================
--- trunk/src/brasero-search-beagle.c	(original)
+++ trunk/src/brasero-search-beagle.c	Fri Feb 29 15:12:43 2008
@@ -696,9 +696,9 @@
 	GSList *next;
 
 	gchar *name, *mime, *uri; 
-        const gchar * const *icon_string = NULL;
-	GIcon *icon;
+        const gchar *icon_string = NULL;
 	const gchar *description;
+	GIcon *icon;
 	gint score;
 	gint num;
 
@@ -742,8 +742,25 @@
 		description = gnome_vfs_mime_get_description (mime);
 
 		icon = g_content_type_get_icon (mime);
-		if (G_IS_THEMED_ICON (icon))
-		  icon_string = g_themed_icon_get_names (G_THEMED_ICON (icon));; 
+		icon_string = NULL;
+		if (G_IS_THEMED_ICON (icon)) {
+			const gchar * const *names = NULL;
+
+			names = g_themed_icon_get_names (G_THEMED_ICON (icon));
+			if (names) {
+				gint i;
+				GtkIconTheme *theme;
+
+				theme = gtk_icon_theme_get_default ();
+				for (i = 0; names [i]; i++) {
+					if (gtk_icon_theme_has_icon (theme, names [i])) {
+						icon_string = names [i];
+						break;
+					}
+				}
+				g_object_unref (theme);
+			}
+		}
 
 		score = (int) (beagle_hit_get_score (hit) * 100);
 
@@ -758,10 +775,9 @@
 				    -1);
 
 		/* add the mime type to the filter combo */
-		brasero_mime_filter_add_mime (BRASERO_MIME_FILTER (search->priv->filter),
-					      mime);
+		brasero_mime_filter_add_mime (BRASERO_MIME_FILTER (search->priv->filter), mime);
 
-		g_free (icon_string);
+		g_object_unref (icon);
 		g_free (name);
 		g_free (mime);
 		g_free (uri);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]