diff options
author | Alexander Larsson <alexl@redhat.com> | 2007-12-07 12:52:23 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-12-07 12:52:23 +0000 |
commit | 3f48f21e3f7afccb8ec7faaf0055cd7ac11de3f4 (patch) | |
tree | 7a9e70bbf1b1918e875abe6eb85592f9bc9e768a /src/nautilus-places-sidebar.c | |
parent | f0c45c902156aa183eeb8402d3c3288344a713bb (diff) | |
download | nautilus-3f48f21e3f7afccb8ec7faaf0055cd7ac11de3f4.tar.gz |
Display errors on mount/unmount failure
2007-12-07 Alexander Larsson <alexl@redhat.com>
* src/nautilus-places-sidebar.c:
Display errors on mount/unmount failure
svn path=/trunk/; revision=13505
Diffstat (limited to 'src/nautilus-places-sidebar.c')
-rw-r--r-- | src/nautilus-places-sidebar.c | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c index d42034a98..9d6b40ad0 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -1156,6 +1156,31 @@ bookmarks_selection_changed_cb (GtkTreeSelection *selection, } static void +drive_mount_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error; + char *primary; + char *name; + + error = NULL; + if (!g_drive_mount_finish (G_DRIVE (source_object), + res, &error)) { + name = g_drive_get_name (G_DRIVE (source_object)); + primary = g_strdup_printf (_("Unable to mount %s"), name); + g_free (name); + eel_show_error_dialog (primary, + error->message, + NULL); + g_free (primary); + g_error_free (error); + } +} + + + +static void open_selected_bookmark (NautilusPlacesSidebar *sidebar, GtkTreeModel *model, GtkTreePath *path, @@ -1201,8 +1226,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar, GDrive *drive; gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_DRIVE, &drive, -1); if (drive != NULL) { - /* TODO-gio: Handle callbacks etc */ - g_drive_mount (drive, NULL, NULL, NULL, sidebar); + g_drive_mount (drive, NULL, NULL, drive_mount_cb, NULL); g_object_unref (drive); } } @@ -1317,8 +1341,7 @@ mount_shortcut_cb (GtkMenuItem *item, -1); if (drive != NULL) { - /* TODO-gio: Handle callbacks etc */ - g_drive_mount (drive, NULL, NULL, NULL, sidebar); + g_drive_mount (drive, NULL, NULL, drive_mount_cb, NULL); g_object_unref (drive); } } @@ -1356,6 +1379,29 @@ unmount_shortcut_cb (GtkMenuItem *item, } static void +drive_eject_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error; + char *primary; + char *name; + + error = NULL; + if (!g_drive_eject_finish (G_DRIVE (source_object), + res, &error)) { + name = g_drive_get_name (G_DRIVE (source_object)); + primary = g_strdup_printf (_("Unable to eject %s"), name); + g_free (name); + eel_show_error_dialog (primary, + error->message, + NULL); + g_free (primary); + g_error_free (error); + } +} + +static void eject_shortcut_cb (GtkMenuItem *item, NautilusPlacesSidebar *sidebar) { @@ -1380,8 +1426,7 @@ eject_shortcut_cb (GtkMenuItem *item, volume, TRUE); } else if (drive != NULL) { - /* TODO-gio: Handle callbacks etc */ - g_drive_eject (drive, NULL, NULL, sidebar); + g_drive_eject (drive, NULL, drive_eject_cb, NULL); } g_object_unref (volume); g_object_unref (drive); |