[gnome-commander] Change of util function: convert uri strings to list of gfiles
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Change of util function: convert uri strings to list of gfiles
- Date: Fri, 27 Aug 2021 18:14:06 +0000 (UTC)
commit 89cb2825b768fb2e162e6db05b5a895e6c2917eb
Author: Uwe Scholz <u scholz83 gmx de>
Date: Fri Aug 13 17:59:10 2021 +0200
Change of util function: convert uri strings to list of gfiles
src/gnome-cmd-file-list.cc | 4 ++--
src/utils.cc | 21 ++++++++++++---------
src/utils.h | 2 +-
3 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index a5aa691a..d2a4b31c 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -3113,8 +3113,8 @@ static void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint
? gnome_cmd_dir_get_parent (to)
: gnome_cmd_dir_get_child (to, g_file_info_get_display_name(f->gFileInfo));
- // transform the drag data to a list with URIs
- GList *uri_list = strings_to_uris ((gchar *) selection_data->data);
+ // transform the drag data to a list with GFiles
+ GList *gFileGlist = uri_strings_to_gfiles ((gchar *) selection_data->data);
GdkModifierType mask;
diff --git a/src/utils.cc b/src/utils.cc
index 12d2c76b..b1e693ed 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -412,31 +412,34 @@ void clear_event_key (GdkEventKey *event)
/**
- * Transform a "\r\n" separated string into a GList with GnomeVFSURI's
+ * Transform a "\r\n" separated string into a GList with GFiles's
*/
-GList *strings_to_uris (gchar *data)
+GList *uri_strings_to_gfiles (gchar *data)
{
- GList *uri_list = NULL;
+ GList *gFileGList = NULL;
gchar **filenames = g_strsplit (data, "\r\n", STRINGS_TO_URIS_CHUNK);
for (gint i=0; filenames[i] != NULL; i++)
{
if (i == STRINGS_TO_URIS_CHUNK)
{
- uri_list = g_list_concat (uri_list, strings_to_uris (filenames[i]));
+ gFileGList = g_list_concat (gFileGList, uri_strings_to_gfiles (filenames[i]));
break;
}
gchar *fn = g_strdup (filenames[i]);
- GnomeVFSURI *uri = gnome_vfs_uri_new (fn);
- fix_uri (uri);
- if (uri)
- uri_list = g_list_append (uri_list, uri);
+ if (!fn || strcmp(fn, "") == 0)
+ {
+ g_free(fn);
+ continue;
+ }
+ auto gFile = g_file_new_for_uri(fn);
+ gFileGList = g_list_append (gFileGList, gFile);
g_free (fn);
}
g_strfreev (filenames);
- return uri_list;
+ return gFileGList;
}
GList *string_history_add (GList *in, const gchar *value, guint maxsize)
diff --git a/src/utils.h b/src/utils.h
index f516d23c..44941f83 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -184,7 +184,7 @@ inline gboolean state_is_ctrl_alt_shift (gint state)
return (state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK);
}
-GList *strings_to_uris (gchar *data);
+GList *uri_strings_to_gfiles (gchar *data);
gchar *create_nice_size_str (guint64 size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]