[gnome-utils] [baobab] Cleanup open_file_with_application util



commit 927ea9641ef4a2d8a4331584e23cb09a4dd6955c
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Nov 6 00:43:16 2010 +0100

    [baobab] Cleanup open_file_with_application util

 baobab/src/baobab-utils.c |   69 +++++++++++++++++++++------------------------
 1 files changed, 32 insertions(+), 37 deletions(-)
---
diff --git a/baobab/src/baobab-utils.c b/baobab/src/baobab-utils.c
index 664c319..029862d 100644
--- a/baobab/src/baobab-utils.c
+++ b/baobab/src/baobab-utils.c
@@ -380,54 +380,49 @@ popupmenu_list (GtkTreePath *path, GdkEventButton *event, gboolean can_trash)
 void
 open_file_with_application (GFile *file)
 {
-	GAppInfo *application;
-	gchar *primary;
 	GFileInfo *info;
-	gchar *uri_scheme;
-	const char *content;
-	gboolean local = FALSE;
 
 	info = g_file_query_info (file,
 				  G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
 				  G_FILE_QUERY_INFO_NONE,
 				  NULL,
 				  NULL);
-	if (!info) return;
-	
-	uri_scheme = g_file_get_uri_scheme (file);
-	if (g_ascii_strcasecmp(uri_scheme,"file") == 0)  local = TRUE;
-	
-	content = g_file_info_get_content_type (info);
-	application = g_app_info_get_default_for_type (content, TRUE);
-
-	if (!application) {
-			primary = g_strdup_printf (_("Could not open folder \"%s\""), 
-			                           g_file_get_basename (file));
-			message (primary, 
-			         _("There is no installed viewer capable "
-				   "of displaying the folder."),
-				 GTK_MESSAGE_ERROR,
-				 baobab.window);
-			g_free (primary);
-	}
-	else {
-		GList *uris = NULL;
-		gchar *uri;
-
-		uri = g_file_get_uri (file);
-		uris = g_list_append (uris, uri);
-		g_app_info_launch_uris (application, uris, NULL, NULL);
+	if (info) {
+		GAppInfo *application;
+		const char *content;
+
+		content = g_file_info_get_content_type (info);
+		application = g_app_info_get_default_for_type (content, TRUE);
+
+		if (!application) {
+				gchar *primary;
+
+				primary = g_strdup_printf (_("Could not open folder \"%s\""), 
+					                   g_file_get_basename (file));
+				message (primary,
+					 _("There is no installed viewer capable "
+					   "of displaying the folder."),
+					 GTK_MESSAGE_ERROR,
+					 baobab.window);
+				g_free (primary);
+		}
+		else {
+			GList *uris = NULL;
+			gchar *uri;
 
-		g_list_free (uris);
-		g_free (uri);
-	}
+			uri = g_file_get_uri (file);
+			uris = g_list_append (uris, uri);
+			g_app_info_launch_uris (application, uris, NULL, NULL);
 
-	g_free (uri_scheme);
+			g_list_free (uris);
+			g_free (uri);
+		}
 
-	if (application)
-		g_object_unref (application);
+		if (application)
+			g_object_unref (application);
 
-	g_object_unref (info);
+		g_object_unref (info);
+	}
 }
 
 gboolean



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