[nautilus/origin/wip/desktop-split-nofonclicts: 12/26] files-view: use target_uri for script vars



commit dae84a2d14f8f61940b4a2fbd009dd653ed37003
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Apr 12 14:18:43 2016 +0200

    files-view: use target_uri for script vars
    
    The code was doing basically that in a hidden way. Let's simplify it.

 src/nautilus-desktop-canvas-view.c |   52 ------------------------------------
 src/nautilus-files-view.c          |   21 ++++----------
 src/nautilus-files-view.h          |    7 -----
 3 files changed, 6 insertions(+), 74 deletions(-)
---
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index 5fe8f0a..1a86382 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 1e6a2ae..455cbda 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 f775ab0..efb4dea 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 */


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