[nautilus-actions] Fix exports (get an URI instead of a path)
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix exports (get an URI instead of a path)
- Date: Fri, 18 Jun 2010 00:19:21 +0000 (UTC)
commit 68408806b9d7f5c049d91f8e7df0f3507266e22d
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jun 18 02:19:05 2010 +0200
Fix exports (get an URI instead of a path)
ChangeLog | 7 +++++++
src/io-xml/naxml-writer.c | 2 ++
src/nact/nact-clipboard.c | 11 ++++++-----
src/nact/nact-tree-model-dnd.c | 16 +++++++---------
4 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 71405e1..609a40a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-06-17 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-clipboard.c (export_objects):
+ Remove unused dest_folder parameter.
+
+ * src/nact/nact-tree-model-dnd.c
+ (nact_tree_model_dnd_imulti_drag_source_drag_data_get):
+ Get destination folder as an URI.
+
* src/nact/nact-iaction-tab.c:
Fix invalid cast of NAObjectMenu to NAObjectAction.
diff --git a/src/io-xml/naxml-writer.c b/src/io-xml/naxml-writer.c
index 2d6ac17..56c8391 100644
--- a/src/io-xml/naxml-writer.c
+++ b/src/io-xml/naxml-writer.c
@@ -761,6 +761,8 @@ output_xml_to_file( const gchar *xml, const gchar *filename, GSList **msg )
g_return_if_fail( xml );
g_return_if_fail( filename && g_utf8_strlen( filename, -1 ));
+ g_debug( "%s: filename=%s", thisfn, filename );
+
file = g_file_new_for_uri( filename );
stream = g_file_replace( file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error );
diff --git a/src/nact/nact-clipboard.c b/src/nact/nact-clipboard.c
index 1a61adc..76c18ed 100644
--- a/src/nact/nact-clipboard.c
+++ b/src/nact/nact-clipboard.c
@@ -114,7 +114,7 @@ static void instance_finalize( GObject *application );
static void get_from_dnd_clipboard_callback( GtkClipboard *clipboard, GtkSelectionData *selection_data, guint info, guchar *data );
static void clear_dnd_clipboard_callback( GtkClipboard *clipboard, NactClipboardDndData *data );
static gchar *export_rows( NactClipboard *clipboard, GList *rows, const gchar *dest_folder );
-static gchar *export_objects( NactClipboard *clipboard, GList *objects, const gchar *dest_folder );
+static gchar *export_objects( NactClipboard *clipboard, GList *objects );
static gchar *export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest_folder, GList **exported );
static void get_from_primary_clipboard_callback( GtkClipboard *gtk_clipboard, GtkSelectionData *selection_data, guint info, NactClipboard *clipboard );
@@ -270,7 +270,7 @@ nact_clipboard_new( BaseWindow *window )
* nact_clipboard_dnd_set:
* @clipboard: this #NactClipboard instance.
* @rows: the list of row references of dragged items.
- * @folder: the target folder if any (XDS protocol to outside).
+ * @folder: the URI of the target folder if any (XDS protocol to outside).
* @copy_data: %TRUE if data is to be copied, %FALSE else
* (only relevant when drag and drop occurs inside of the tree view).
*
@@ -427,6 +427,7 @@ nact_clipboard_dnd_drag_end( NactClipboard *clipboard )
g_debug( "%s: data=%p (NactClipboardDndData)", thisfn, ( void * ) data );
if( data->target == NACT_XCHANGE_FORMAT_XDS ){
+ g_debug( "%s: folder=%s", thisfn, data->folder );
export_rows( clipboard, data->rows, data->folder );
}
@@ -512,7 +513,7 @@ export_rows( NactClipboard *clipboard, GList *rows, const gchar *dest_folder )
}
static gchar *
-export_objects( NactClipboard *clipboard, GList *objects, const gchar *dest_folder )
+export_objects( NactClipboard *clipboard, GList *objects )
{
gchar *buffer;
GString *data;
@@ -526,7 +527,7 @@ export_objects( NactClipboard *clipboard, GList *objects, const gchar *dest_fold
for( iobj = objects ; iobj ; iobj = iobj->next ){
object = NA_OBJECT( iobj->data );
- buffer = export_row_object( clipboard, object, dest_folder, &exported );
+ buffer = export_row_object( clipboard, object, NULL, &exported );
if( buffer && strlen( buffer )){
data = g_string_append( data, buffer );
g_free( buffer );
@@ -774,7 +775,7 @@ get_from_primary_clipboard_callback( GtkClipboard *gtk_clipboard, GtkSelectionDa
user_data = clipboard->private->primary_data;
if( info == NACT_CLIPBOARD_FORMAT_TEXT_PLAIN ){
- buffer = export_objects( clipboard, user_data->items, NULL );
+ buffer = export_objects( clipboard, user_data->items );
gtk_selection_data_set( selection_data, selection_data->target, 8, ( const guchar * ) buffer, strlen( buffer ));
g_free( buffer );
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 8784598..a3699ef 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -276,7 +276,6 @@ nact_tree_model_dnd_imulti_drag_source_drag_data_get( EggTreeMultiDragSource *dr
gchar *dest_folder, *folder;
gboolean is_writable;
gboolean copy_data;
- NAGnomeVFSURI *vfs;
atom_name = gdk_atom_name( selection_data->target );
g_debug( "%s: drag_source=%p, context=%p, action=%d, selection_data=%p, rows=%p, atom=%s",
@@ -306,21 +305,20 @@ nact_tree_model_dnd_imulti_drag_source_drag_data_get( EggTreeMultiDragSource *dr
* e.g. file:///home/pierre/data/eclipse/nautilus-actions/trash/xds.txt
*/
folder = get_xds_atom_value( context );
- /* get the dest folder as a path
- */
- vfs = g_new0( NAGnomeVFSURI, 1 );
- na_gnome_vfs_uri_parse( vfs, folder );
- dest_folder = g_path_get_dirname( vfs->path );
- na_gnome_vfs_uri_free( vfs );
- g_free( folder );
+ dest_folder = g_path_get_dirname( folder );
+
/* check that target folder is writable
*/
- is_writable = na_core_utils_dir_is_writable_path( dest_folder );
+ is_writable = na_core_utils_dir_is_writable_uri( dest_folder );
+ g_debug( "%s: dest_folder=%s, is_writable=%s", thisfn, dest_folder, is_writable ? "True":"False" );
gtk_selection_data_set( selection_data, selection_data->target, 8, ( guchar * )( is_writable ? "S" : "F" ), 1 );
+
if( is_writable ){
nact_clipboard_dnd_set( model->private->clipboard, info, rows, dest_folder, TRUE );
}
+
g_free( dest_folder );
+ g_free( folder );
ret = is_writable;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]