summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-04-12 14:18:43 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-04-12 16:25:52 +0200
commitdae84a2d14f8f61940b4a2fbd009dd653ed37003 (patch)
tree1407e9deea6bb60d8679cc12f02dacb0bbb5064d
parent15fdd59eae89d4de4fcfb5e9b9eb133a57bf74de (diff)
downloadnautilus-dae84a2d14f8f61940b4a2fbd009dd653ed37003.tar.gz
files-view: use target_uri for script vars
The code was doing basically that in a hidden way. Let's simplify it.
-rw-r--r--src/nautilus-desktop-canvas-view.c52
-rw-r--r--src/nautilus-files-view.c21
-rw-r--r--src/nautilus-files-view.h7
3 files changed, 6 insertions, 74 deletions
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index 5fe8f0a12..1a863828a 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -309,7 +309,6 @@ nautilus_desktop_canvas_view_class_init (NautilusDesktopCanvasViewClass *class)
vclass->end_loading = nautilus_desktop_canvas_view_end_loading;
vclass->get_backing_uri = real_get_backing_uri;
vclass->check_empty_states = real_check_empty_states;
- vclass->get_file_paths_or_uris_as_newline_delimited_string = real_get_file_paths_or_uris_as_newline_delimited_string;
g_type_class_add_private (class, sizeof (NautilusDesktopCanvasViewDetails));
}
@@ -606,57 +605,6 @@ real_get_backing_uri (NautilusFilesView *view)
return uri;
}
-static char *
-real_get_file_paths_or_uris_as_newline_delimited_string (NautilusFilesView *view,
- GList *selection,
- gboolean get_paths)
-{
- char *path;
- char *uri;
- char *result;
- NautilusDesktopLink *link;
- GString *expanding_string;
- GList *node;
- GFile *location;
-
- expanding_string = g_string_new ("");
- for (node = selection; node != NULL; node = node->next) {
- uri = NULL;
- if (NAUTILUS_IS_DESKTOP_ICON_FILE (node->data)) {
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (node->data));
- if (link != NULL) {
- location = nautilus_desktop_link_get_activation_location (link);
- uri = g_file_get_uri (location);
- g_object_unref (location);
- g_object_unref (G_OBJECT (link));
- }
- } else {
- uri = nautilus_file_get_uri (NAUTILUS_FILE (node->data));
- }
- if (uri == NULL) {
- continue;
- }
-
- if (get_paths) {
- path = g_filename_from_uri (uri, NULL, NULL);
- if (path != NULL) {
- g_string_append (expanding_string, path);
- g_free (path);
- g_string_append (expanding_string, "\n");
- }
- } else {
- g_string_append (expanding_string, uri);
- g_string_append (expanding_string, "\n");
- }
- g_free (uri);
- }
-
- result = expanding_string->str;
- g_string_free (expanding_string, FALSE);
-
- return result;
-}
-
static void
real_update_context_menus (NautilusFilesView *view)
{
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 1e6a2ae8d..455cbdadb 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -4445,17 +4445,9 @@ get_file_names_as_parameter_array (GList *selection,
}
static char*
-nautilus_files_view_get_file_paths_or_uris_as_newline_delimited_string (NautilusFilesView *view,
- GList *selection,
- gboolean get_paths)
-{
- return NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->get_file_paths_or_uris_as_newline_delimited_string (view, selection, get_paths);
-}
-
-static char *
-real_get_file_paths_or_uris_as_newline_delimited_string (NautilusFilesView *view,
- GList *selection,
- gboolean get_paths)
+get_file_paths_or_uris_as_newline_delimited_string (NautilusFilesView *view,
+ GList *selection,
+ gboolean get_paths)
{
char *path;
char *uri;
@@ -4465,7 +4457,7 @@ real_get_file_paths_or_uris_as_newline_delimited_string (NautilusFilesView *view
expanding_string = g_string_new ("");
for (node = selection; node != NULL; node = node->next) {
- uri = nautilus_file_get_uri (NAUTILUS_FILE (node->data));
+ uri = nautilus_file_get_target_uri (NAUTILUS_FILE (node->data));
if (uri == NULL) {
continue;
}
@@ -4494,14 +4486,14 @@ static char *
get_file_paths_as_newline_delimited_string (NautilusFilesView *view,
GList *selection)
{
- return nautilus_files_view_get_file_paths_or_uris_as_newline_delimited_string (view, selection, TRUE);
+ return get_file_paths_or_uris_as_newline_delimited_string (view, selection, TRUE);
}
static char *
get_file_uris_as_newline_delimited_string (NautilusFilesView *view,
GList *selection)
{
- return nautilus_files_view_get_file_paths_or_uris_as_newline_delimited_string (view, selection, FALSE);
+ return get_file_paths_or_uris_as_newline_delimited_string (view, selection, FALSE);
}
/* returns newly allocated strings for setting the environment variables */
@@ -7979,7 +7971,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
klass->update_context_menus = real_update_context_menus;
klass->update_actions_state = real_update_actions_state;
klass->check_empty_states = real_check_empty_states;
- klass->get_file_paths_or_uris_as_newline_delimited_string = real_get_file_paths_or_uris_as_newline_delimited_string;
copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
diff --git a/src/nautilus-files-view.h b/src/nautilus-files-view.h
index f775ab0a7..efb4dea7f 100644
--- a/src/nautilus-files-view.h
+++ b/src/nautilus-files-view.h
@@ -262,13 +262,6 @@ struct NautilusFilesViewClass {
/* Use this to show an optional visual feedback when the directory is empty.
* By default it shows a widget overlay on top of the view */
void (* check_empty_states) (NautilusFilesView *view);
-
- /* Use this when the scripts environment vars are being set, for selected files, etc.,
- * if the subclassed view has some special links that need conversion to
- * normal uris */
- char * (* get_file_paths_or_uris_as_newline_delimited_string) (NautilusFilesView *view,
- GList *selection,
- gboolean get_paths);
};
/* GObject support */