[gnome-bluetooth/meego-1.0: 2/2] meego: fix browse logic
- From: Ross Burton <rburton src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/meego-1.0: 2/2] meego: fix browse logic
- Date: Mon, 26 Apr 2010 12:57:05 +0000 (UTC)
commit a399f956f26115c6061063c0f6b1467eeccdf20e
Author: Ross Burton <ross linux intel com>
Date: Mon Apr 26 10:30:39 2010 +0100
meego: fix browse logic
moblin/moblin-panel.c | 40 +++++++++++++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/moblin/moblin-panel.c b/moblin/moblin-panel.c
index a9bac9d..c566cbb 100644
--- a/moblin/moblin-panel.c
+++ b/moblin/moblin-panel.c
@@ -571,13 +571,35 @@ remove_clicked_cb (GtkCellRenderer *cell, const gchar *path, gpointer user_data)
}
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_message ("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_message ("Failed to open %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+ g_free (uri);
+}
+
+static void
browse_clicked (GtkCellRenderer *renderer, const gchar *path, gpointer user_data)
{
MoblinPanelPrivate *priv = MOBLIN_PANEL_GET_PRIVATE (user_data);
BluetoothChooser *chooser = BLUETOOTH_CHOOSER (priv->display);
const gchar *address = NULL;
GValue value = { 0, };
- gchar *cmd;
ensure_selection (chooser, path);
@@ -586,12 +608,16 @@ browse_clicked (GtkCellRenderer *renderer, const gchar *path, gpointer user_data
address = g_value_get_string (&value);
}
- if (address == NULL) {
- cmd = g_strdup_printf ("%s --no-default-window \"obex://[%s]\"",
- "nautilus", address);
- if (!g_spawn_command_line_async (cmd, NULL))
- g_printerr("Couldn't execute command: %s\n", cmd);
- g_free (cmd);
+ if (address) {
+ char *uri;
+ GFile *file;
+
+ uri = g_strdup_printf ("obex://[%s]/", address);
+ file = g_file_new_for_uri (uri);
+ g_free (uri);
+
+ g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE, NULL, NULL, mount_finish_cb, NULL);
+ g_object_unref (file);
}
g_value_unset (&value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]