summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch')
-rw-r--r--meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch219
1 files changed, 0 insertions, 219 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch b/meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch
deleted file mode 100644
index bf3979f0d3..0000000000
--- a/meta/recipes-kernel/oprofile/oprofileui/migrate-from-gnomevfs-to-gio.patch
+++ /dev/null
@@ -1,219 +0,0 @@
1migrate from gnome-vfs to gio, as gnome-vfs is obsolete.
2
3Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
4
5Upstream-Status: Pending
6
7Index: git/src/main.c
8===================================================================
9--- git.orig/src/main.c 2011-06-21 10:35:31.000000000 +0800
10+++ git/src/main.c 2011-06-21 10:44:12.000000000 +0800
11@@ -44,7 +44,6 @@
12 #include <gtk/gtk.h>
13 #include <glade/glade.h>
14 #include <glib.h>
15-#include <libgnomevfs/gnome-vfs.h>
16 #include <gconf/gconf-client.h>
17 #include <glib/gi18n.h>
18
19@@ -1005,8 +1004,7 @@
20 /* Cleanup the old archive */
21 archive_full_cleanup ();
22
23- if (gnome_vfs_initialized())
24- gnome_vfs_shutdown ();
25+ g_type_init();
26
27 g_free(opui_config->host);
28 g_free(opui_config->opcontrol_params);
29Index: git/src/archive.c
30===================================================================
31--- git.orig/src/archive.c 2011-06-21 10:38:57.000000000 +0800
32+++ git/src/archive.c 2011-06-21 10:54:16.000000000 +0800
33@@ -45,7 +45,6 @@
34 #include <glade/glade.h>
35 #include <glib.h>
36 #include <glib/gstdio.h>
37-#include <libgnomevfs/gnome-vfs.h>
38
39 #include "oprofileui.h"
40 #include "response.h"
41@@ -86,56 +85,113 @@
42
43 if (ret < 0)
44 {
45- /* Use gnomevfs to copy the file as a fallback */
46- GnomeVFSURI *src_uri, *dst_uri;
47- GnomeVFSResult res;
48-
49- src_uri = gnome_vfs_uri_new (gnome_vfs_get_uri_from_local_path(src));
50- dst_uri = gnome_vfs_uri_new (gnome_vfs_get_uri_from_local_path(dest));
51- res = gnome_vfs_xfer_uri (src_uri, dst_uri,
52- GNOME_VFS_XFER_DEFAULT |
53- GNOME_VFS_XFER_NEW_UNIQUE_DIRECTORY,
54- GNOME_VFS_XFER_ERROR_MODE_ABORT,
55- GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
56- NULL, NULL);
57- if (res != GNOME_VFS_OK)
58+ /* Use gio to copy the file as a fallback */
59+ GFile *src_file, *dst_file;
60+ gboolean res;
61+ GError *error = NULL;
62+
63+ src_file = g_file_new_for_path (src);
64+ dst_file = g_file_new_for_path (dest);
65+
66+ res = g_file_copy(src_file, dst_file,
67+ G_FILE_COPY_NOFOLLOW_SYMLINKS |
68+ G_FILE_COPY_OVERWRITE,
69+ NULL,
70+ NULL,
71+ NULL,
72+ &error);
73+
74+ if (!res && error)
75 {
76- const gchar *err_string = gnome_vfs_result_to_string (res);
77+ printf ("GIO: error %s (%s to %s)\n", error->message, src, dest);
78
79- printf ("GNOME-VFS: error %s (%s to %s)\n", err_string, src, dest);
80+ g_error_free(error);
81 }
82+
83+ g_object_unref(src_file);
84+ g_object_unref(dst_file);
85+
86+ }
87+}
88+
89+#define IS_IO_ERROR(__error, KIND) (((__error)->domain == G_IO_ERROR && (__error)->code == G_IO_ERROR_ ## KIND))
90+
91+static gboolean
92+remove_target_recursively(GFile *file)
93+{
94+ GFileEnumerator *enumerator;
95+ GError *error = NULL;
96+ GFile *child;
97+ GFileInfo *info;
98+ gboolean stop = FALSE;
99+
100+ enumerator = g_file_enumerate_children(file,
101+ G_FILE_ATTRIBUTE_STANDARD_NAME,
102+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
103+ NULL,
104+ &error);
105+
106+ if (enumerator)
107+ {
108+ error = NULL;
109+
110+ while ( (info = g_file_enumerator_next_file(enumerator, NULL, &error))
111+ != NULL ) {
112+
113+ child = g_file_get_child(file, g_file_info_get_name(info));
114+ if (!remove_target_recursively(child))
115+ {
116+ stop = TRUE;
117+ break;
118+ }
119+ g_object_unref(child);
120+ g_object_unref(info);
121+ }
122+
123+ g_object_unref(enumerator);
124+ }
125+ else if (IS_IO_ERROR(error, NOT_DIRECTORY))
126+ {
127+ g_error_free(error);
128 }
129+ else
130+ {
131+ g_error_free(error);
132+ stop = TRUE;
133+ }
134+
135+ if (stop)
136+ return FALSE;
137+
138+ error = NULL;
139+ if (!g_file_delete(file, NULL, &error))
140+ {
141+ char *path = g_file_get_path(file);
142+ printf ("GIO: error %s when deleteing file %s.\n", error->message, path);
143+ g_free(path);
144+
145+ g_error_free(error);
146+ return FALSE;
147+ }
148+
149+ return TRUE;
150+
151 }
152
153 /* Delete the directory specified by path */
154 static void
155 archive_removedir(gchar *path)
156 {
157- GnomeVFSResult res;
158- GnomeVFSURI *src_uri;
159- GList uri_list;
160+ GFile *src_file;
161
162 if (path == NULL)
163 return;
164
165- gnome_vfs_init ();
166-
167- src_uri = gnome_vfs_uri_new (gnome_vfs_get_uri_from_local_path(path));
168-
169- uri_list.data = src_uri;
170- uri_list.next = NULL;
171- uri_list.prev = NULL;
172+ src_file = g_file_new_for_path (path);
173
174- res = gnome_vfs_xfer_delete_list (&uri_list,
175- GNOME_VFS_XFER_ERROR_MODE_ABORT,
176- GNOME_VFS_XFER_EMPTY_DIRECTORIES,
177- NULL, NULL);
178-
179- if (res != GNOME_VFS_OK)
180+ if (! remove_target_recursively(src_file))
181 {
182- const gchar *err_string = gnome_vfs_result_to_string (res);
183-
184- printf ("GNOME-VFS: error %s\n", err_string);
185+ printf ("GIO:remove %s failed", path);
186 }
187 }
188
189@@ -242,8 +298,6 @@
190 gchar **tmp;
191 int i;
192
193- gnome_vfs_init ();
194-
195 tmp = g_strsplit (reply->payload, "\n", 0);
196
197 for (i=0; i < g_strv_length (tmp); i++)
198@@ -436,8 +490,6 @@
199 {
200 gint counter;
201
202- gnome_vfs_init ();
203-
204 downloaded_files = g_slist_append (downloaded_files, g_strdup("/var/lib/oprofile/.converted"));
205
206 archive_save_window_show (g_slist_length (downloaded_files) +
207Index: git/configure.ac
208===================================================================
209--- git.orig/configure.ac 2011-06-21 10:49:40.000000000 +0800
210+++ git/configure.ac 2011-06-21 10:49:58.000000000 +0800
211@@ -29,7 +29,7 @@
212 AM_CONDITIONAL(ENABLE_SERVER, test x$enable_server = xyes)
213 AM_CONDITIONAL(ENABLE_CLIENT, test x$enable_client = xyes)
214
215-PKG_CHECK_MODULES(OPROFILEUI, [glib-2.0 libglade-2.0 gtk+-2.0 libxml-2.0 gnome-vfs-2.0 gconf-2.0])
216+PKG_CHECK_MODULES(OPROFILEUI, [glib-2.0 libglade-2.0 gtk+-2.0 libxml-2.0 gconf-2.0])
217 AC_SUBST(OPROFILEUI_CFLAGS)
218 AC_SUBST(OPROFILEUI_LIBS)
219