diff -up gnome-panel-2.22.1.2/gnome-panel/panel-menu-items.c.launch-with-gio gnome-panel-2.22.1.2/gnome-panel/panel-menu-items.c --- gnome-panel-2.22.1.2/gnome-panel/panel-menu-items.c.launch-with-gio 2008-04-20 23:54:37.000000000 -0400 +++ gnome-panel-2.22.1.2/gnome-panel/panel-menu-items.c 2008-04-20 23:54:37.000000000 -0400 @@ -41,6 +41,7 @@ #include #include +#include #include "menu.h" #include "panel-action-button.h" @@ -96,6 +97,51 @@ struct _PanelDesktopMenuItemPrivate { guint append_lock_logout : 1; }; +typedef struct { + GMountOperation *mount_op; + GdkScreen *screen; +} MountOperationHandle; + +static void +mount_async_callback (GObject *source_object, + GAsyncResult *result, + gpointer user_data) +{ + GError *error = NULL; + GFile *file; + MountOperationHandle *handle = user_data; + + file = G_FILE (source_object); + if (g_file_mount_enclosing_volume_finish (file, result, &error)) { + char *uri = g_file_get_uri (file); + // FIXME use an app launch context + g_app_info_launch_default_for_uri (uri, NULL, &error); + g_free (uri); + } + else { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED) && + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED)) { + char *primary, *escaped, *url; + url = g_file_get_uri (file); + escaped = g_markup_escape_text (url, -1); + g_free (url); + primary = g_strdup_printf (_("Could not open location '%s'"), + escaped); + g_free (escaped); + panel_error_dialog (NULL, handle->screen, + "cannot_show_url", TRUE, + primary, error->message); + g_free (primary); + } + g_error_free (error); + } + + if (handle->mount_op) + g_object_unref (handle->mount_op); + + g_free (handle); +} + static void activate_uri (GtkWidget *menuitem, const char *path) @@ -125,12 +171,28 @@ activate_uri (GtkWidget *menuitem, command = g_strdup_printf ("nautilus --no-desktop %s", url); gdk_spawn_command_line_on_screen (screen, command, &error); - } else + } else { + // FIXME use an app launch context g_app_info_launch_default_for_uri (url, NULL, &error); - //gnome_url_show_on_screen (url, screen, &error); + } if (error != NULL) { - if (error->code != GNOME_URL_ERROR_CANCELLED) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED)) { + MountOperationHandle *handle; + + handle = g_new (MountOperationHandle, 1); + file = g_file_new_for_uri (url); + + /* If it's not mounted, try to mount it ourselves */ + handle->mount_op = panel_mount_operation_new (NULL); + handle->screen = screen; + + g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE, handle->mount_op, + NULL, mount_async_callback, handle); + g_object_unref (file); + + } + else { char *primary; escaped = g_markup_escape_text (url, -1); primary = g_strdup_printf (_("Could not open location '%s'"), diff -up gnome-panel-2.22.1.2/gnome-panel/panel-mount-operation.c.launch-with-gio gnome-panel-2.22.1.2/gnome-panel/panel-mount-operation.c --- gnome-panel-2.22.1.2/gnome-panel/panel-mount-operation.c.launch-with-gio 2008-04-21 00:10:20.000000000 -0400 +++ gnome-panel-2.22.1.2/gnome-panel/panel-mount-operation.c 2008-04-21 00:13:35.000000000 -0400 @@ -102,6 +102,18 @@ password_dialog_button_clicked (GtkDialo anon = gnome_password_dialog_anon_selected (gpd); g_mount_operation_set_anonymous (op, anon); + switch (gnome_password_dialog_get_remember (gpd)) { + case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING: + g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_NEVER); + break; + case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION: + g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_FOR_SESSION); + break; + case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER: + g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_PERMANENTLY); + break; + } + g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED); } else { g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); @@ -136,6 +148,9 @@ ask_password (GMountOperation *op, flags & G_ASK_PASSWORD_NEED_DOMAIN); gnome_password_dialog_set_show_userpass_buttons (GNOME_PASSWORD_DIALOG (dialog), flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED); + gnome_password_dialog_set_show_remember (GNOME_PASSWORD_DIALOG (dialog), + flags & G_ASK_PASSWORD_SAVING_SUPPORTED); + if (default_domain) { gnome_password_dialog_set_domain (GNOME_PASSWORD_DIALOG (dialog), default_domain);