gnome-panel r10788 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r10788 - trunk/gnome-panel
- Date: Sat, 9 Feb 2008 15:46:43 +0000 (GMT)
Author: vuntz
Date: Sat Feb 9 15:46:43 2008
New Revision: 10788
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=10788&view=rev
Log:
2008-02-09 Vincent Untz <vuntz gnome org>
Port menu.c to gio.
Based on patch by Diego Escalante Urrelo <diegoe gnome org>
Fix part of bug #509756.
* menu.c: (add_app_to_desktop): straight port
(drag_data_get_menu_cb): ditto
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/menu.c
Modified: trunk/gnome-panel/menu.c
==============================================================================
--- trunk/gnome-panel/menu.c (original)
+++ trunk/gnome-panel/menu.c Sat Feb 9 15:46:43 2008
@@ -27,11 +27,8 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gdk/gdkkeysyms.h>
-#include <libgnomevfs/gnome-vfs-result.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
#include <gconf/gconf-client.h>
#include "launcher.h"
@@ -618,20 +615,16 @@
add_app_to_desktop (GtkWidget *item,
GMenuTreeEntry *entry)
{
- GnomeVFSURI *vfs_source_uri;
- GnomeVFSURI *vfs_target_uri;
- GnomeVFSResult res;
- char *source_uri;
+ GFile *source;
+ GFile *target;
+ GError *error;
char *target_dir;
char *target_uri;
+ char *source_uri;
g_return_if_fail (entry != NULL);
- source_uri = g_filename_to_uri (gmenu_tree_entry_get_desktop_file_path (entry), NULL, NULL);
- g_return_if_fail (source_uri != NULL);
-
- vfs_source_uri = gnome_vfs_uri_new (source_uri);
- g_return_if_fail (vfs_source_uri != NULL);
+ source = g_file_new_for_path (gmenu_tree_entry_get_desktop_file_path (entry));
if (desktop_is_home_dir ()) {
target_dir = g_build_filename (g_get_home_dir (), NULL);
@@ -639,29 +632,27 @@
target_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
}
+ source_uri = g_file_get_uri (source);
target_uri = panel_make_unique_desktop_uri (target_dir, source_uri);
+ g_free (source_uri);
+ g_free (target_dir);
g_return_if_fail (target_uri != NULL);
- vfs_target_uri = gnome_vfs_uri_new (target_uri);
- g_return_if_fail (vfs_target_uri != NULL);
+ target = g_file_new_for_uri (target_uri);
+ g_free (target_uri);
- res = gnome_vfs_xfer_uri (vfs_source_uri, vfs_target_uri,
- GNOME_VFS_XFER_DEFAULT,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
- NULL, NULL);
+ error = NULL;
+ g_file_copy (source, target, G_FILE_COPY_NONE,
+ NULL, NULL, NULL, &error);
- if (res != GNOME_VFS_OK) {
+ g_object_unref (source);
+ g_object_unref (target);
+
+ if (error != NULL) {
g_warning ("Problem while copying launcher to desktop: %s",
- gnome_vfs_result_to_string (res));
+ error->message);
+ g_error_free (error);
}
-
- gnome_vfs_uri_unref (vfs_source_uri);
- gnome_vfs_uri_unref (vfs_target_uri);
-
- g_free (source_uri);
- g_free (target_dir);
- g_free (target_uri);
}
@@ -1106,9 +1097,12 @@
const char *path;
char *uri;
char *uri_list;
+ GFile *file;
path = gmenu_tree_entry_get_desktop_file_path (entry);
- uri = gnome_vfs_get_uri_from_local_path (path);
+ file = g_file_new_for_path (path);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
uri_list = g_strconcat (uri, "\r\n", NULL);
g_free (uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]