[gnome-panel] panel: Create better launchers for home/trash/computer/network on dnd



commit d01c8c37e290c3ffd47098e5781229d6c899ae4d
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Feb 1 01:29:12 2011 +0100

    panel: Create better launchers for home/trash/computer/network on dnd
    
    Instead of creating URI launchers with ugly name/comments, we can use
    the same mechanism as the one we use for x-nautilus-desktop drops.

 gnome-panel/panel.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index c0c5e8e..ff81910 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -620,10 +620,18 @@ drop_urilist (PanelWidget *panel,
 	      char        *urilist)
 {
 	char     **uris;
+	GFile     *home;
+	GFile     *trash;
+	GFile     *computer;
+	GFile     *network;
 	gboolean   success;
 	int        i;
 
 	uris = g_uri_list_extract_uris (urilist);
+	home = g_file_new_for_path (g_get_home_dir ());
+	trash = g_file_new_for_uri ("trash://");
+	computer = g_file_new_for_uri ("computer://");
+	network = g_file_new_for_uri ("network://");
 
 	success = TRUE;
 	for (i = 0; uris[i]; i++) {
@@ -655,6 +663,25 @@ drop_urilist (PanelWidget *panel,
 		}
 
 		file = g_file_new_for_uri (uri);
+
+		if (g_file_equal (home, file)) {
+			success = drop_nautilus_desktop_uri (panel, pos, "x-nautilus-desktop:///home");
+			g_object_unref (file);
+			continue;
+		} else if (g_file_equal (trash, file)) {
+			success = drop_nautilus_desktop_uri (panel, pos, "x-nautilus-desktop:///trash");
+			g_object_unref (file);
+			continue;
+		} else if (g_file_equal (computer, file)) {
+			success = drop_nautilus_desktop_uri (panel, pos, "x-nautilus-desktop:///computer");
+			g_object_unref (file);
+			continue;
+		} else if (g_file_equal (network, file)) {
+			success = drop_nautilus_desktop_uri (panel, pos, "x-nautilus-desktop:///network");
+			g_object_unref (file);
+			continue;
+		}
+
 		info = g_file_query_info (file,
 					  "standard::type,"
 					  "standard::content-type,"
@@ -711,6 +738,10 @@ drop_urilist (PanelWidget *panel,
 		g_object_unref (file);
 	}
 
+	g_object_unref (home);
+	g_object_unref (trash);
+	g_object_unref (computer);
+	g_object_unref (network);
 	g_strfreev (uris);
 
 	return success;



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