[gnome-bluetooth] Remove hard-coded use of nautilus
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Remove hard-coded use of nautilus
- Date: Thu, 7 Jan 2010 17:51:36 +0000 (UTC)
commit cdd930b3fc236fb50007a7e46ca48a4d3caf3fcd
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 7 17:49:23 2010 +0000
Remove hard-coded use of nautilus
And hope the user has a file manager installed anyway.
https://bugzilla.redhat.com/show_bug.cgi?id=553083
applet/main.c | 41 +++++++++++++++++++++++++++++++----------
1 files changed, 31 insertions(+), 10 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index 37b44a5..3261d03 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -103,9 +103,33 @@ select_device_changed(BluetoothChooser *sel,
GTK_RESPONSE_ACCEPT, address != NULL);
}
+static void
+mount_finish_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *error = NULL;
+ char *uri;
+
+ if (g_file_mount_enclosing_volume_finish (G_FILE (source_object),
+ res, &error) == FALSE) {
+ g_printerr ("Failed to mount OBEX volume: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ uri = g_file_get_uri (G_FILE (source_object));
+ if (gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, &error) == FALSE) {
+ g_printerr ("Failed to open %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+ g_free (uri);
+}
+
void browse_callback(GObject *widget, gpointer user_data)
{
- char *address, *cmd;
+ GFile *file;
+ char *address, *uri;
address = g_strdup (g_object_get_data (widget, "address"));
if (address == NULL) {
@@ -150,14 +174,14 @@ void browse_callback(GObject *widget, gpointer user_data)
return;
}
- cmd = g_strdup_printf("%s --no-default-window \"obex://[%s]\"",
- "nautilus", address);
+ uri = g_strdup_printf ("obex://[%s]/", address);
g_free (address);
- if (!g_spawn_command_line_async(cmd, NULL))
- g_printerr("Couldn't execute command: %s\n", cmd);
+ file = g_file_new_for_uri (uri);
+ g_free (uri);
- g_free (cmd);
+ g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE, NULL, NULL, mount_finish_cb, NULL);
+ g_object_unref (file);
}
void sendto_callback(GObject *widget, gpointer user_data)
@@ -401,10 +425,7 @@ update_menu_items (void)
if (enabled == FALSE)
return;
- object = gtk_builder_get_object (xml, "browse-device");
- gtk_action_set_sensitive (GTK_ACTION (object),
- program_available ("nautilus"));
-
+ gtk_action_set_sensitive (GTK_ACTION (object), TRUE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]