Use gtk_selection_data_set_uris() instead of doing it by hand. (#514890,

2008-02-12  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkfilechooserdefault.c (recent_model_sort_drag_data_get):
        (recent_model_sort_drag_data_get):
        (search_model_sort_drag_data_get):
        * gtk/gtkfilesystemmodel.c (drag_source_drag_data_get):
        * gtk/gtkpathbar.c (button_drag_data_get_cb):
        Use gtk_selection_data_set_uris() instead of doing it
        by hand.  (#514890, Christian Persch)


svn path=/trunk/; revision=19524
This commit is contained in:
Matthias Clasen
2008-02-12 15:07:38 +00:00
committed by Matthias Clasen
parent 697a50929e
commit 6a80b177a0
4 changed files with 24 additions and 28 deletions

View File

@@ -1,3 +1,13 @@
2008-02-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (recent_model_sort_drag_data_get):
(recent_model_sort_drag_data_get):
(search_model_sort_drag_data_get):
* gtk/gtkfilesystemmodel.c (drag_source_drag_data_get):
* gtk/gtkpathbar.c (button_drag_data_get_cb):
Use gtk_selection_data_set_uris() instead of doing it
by hand. (#514890, Christian Persch)
2008-02-12 Michael Natterer <mitch@imendio.com>
* gtk/gtkstatusicon.c: #include "gtkmain.h" for

View File

@@ -11426,7 +11426,7 @@ recent_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
RecentModelSort *model;
GtkTreeIter iter, child_iter;
GtkFilePath *file_path;
gchar **uris;
gchar *uris[2];
model = RECENT_MODEL_SORT (drag_source);
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path))
@@ -11438,13 +11438,12 @@ recent_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
-1);
g_assert (file_path != NULL);
uris = g_new (gchar *, 2);
uris[0] = gtk_file_system_path_to_uri (model->impl->file_system, file_path);
uris[1] = NULL;
gtk_selection_data_set_uris (selection_data, uris);
g_strfreev (uris);
g_free (uris[0]);
return TRUE;
}
@@ -11512,7 +11511,7 @@ search_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
SearchModelSort *model;
GtkTreeIter iter, child_iter;
GtkFilePath *file_path;
gchar **uris;
gchar *uris[2];
model = SEARCH_MODEL_SORT (drag_source);
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path))
@@ -11524,13 +11523,12 @@ search_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
-1);
g_assert (file_path != NULL);
uris = g_new (gchar *, 2);
uris[0] = gtk_file_system_path_to_uri (model->impl->file_system, file_path);
uris[1] = NULL;
gtk_selection_data_set_uris (selection_data, uris);
g_strfreev (uris);
g_free (uris[0]);
return TRUE;
}

View File

@@ -566,8 +566,7 @@ drag_source_drag_data_get (GtkTreeDragSource *drag_source,
GtkFileSystemModel *model;
GtkTreeIter iter;
const GtkFilePath *file_path;
char *uri;
char *uris;
char *uris[2];
model = GTK_FILE_SYSTEM_MODEL (drag_source);
@@ -577,17 +576,12 @@ drag_source_drag_data_get (GtkTreeDragSource *drag_source,
file_path = _gtk_file_system_model_get_path (model, &iter);
g_assert (file_path != NULL);
uri = gtk_file_system_path_to_uri (model->file_system, file_path);
uris = g_strconcat (uri, "\r\n", NULL);
uris[0] = gtk_file_system_path_to_uri (model->file_system, file_path);
uris[1] = NULL;
gtk_selection_data_set (selection_data,
gdk_atom_intern_static_string ("text/uri-list"),
8,
(guchar *) uris,
strlen (uris) + 1);
gtk_selection_data_set_uris (selection_data, uris);
g_free (uri);
g_free (uris);
g_free (uris[0]);
return TRUE;
}

View File

@@ -1325,22 +1325,16 @@ button_drag_data_get_cb (GtkWidget *widget,
{
ButtonData *button_data;
GtkPathBar *path_bar;
char *uri;
char *uri_list;
char *uris[2];
button_data = data;
path_bar = GTK_PATH_BAR (widget->parent); /* the button's parent *is* the path bar */
uri = gtk_file_system_path_to_uri (path_bar->file_system, button_data->path);
uri_list = g_strconcat (uri, "\r\n", NULL);
g_free (uri);
uris[0] = gtk_file_system_path_to_uri (path_bar->file_system, button_data->path);
uris[1] = NULL;
gtk_selection_data_set (selection_data,
selection_data->target,
8,
(guchar *)uri_list,
strlen (uri_list));
g_free (uri_list);
gtk_selection_data_set_uris (selection_data, uris);
g_free (uris[0]);
}
static ButtonData *