Commit 9281506c authored by Cosimo Cecchi's avatar Cosimo Cecchi

autorun: move nautilus_launch_application_for_mount ()

Also add the parent window parameter to it, so that we get startup
notification.
parent 7c71b7f3
......@@ -29,27 +29,8 @@
#include <gtk/gtk.h>
#include "nautilus-autorun.h"
#include "nautilus-program-choosing.h"
void
nautilus_autorun_launch_for_mount (GMount *mount, GAppInfo *app_info)
{
GFile *root;
NautilusFile *file;
GList *files;
root = g_mount_get_root (mount);
file = nautilus_file_get (root);
g_object_unref (root);
files = g_list_append (NULL, file);
nautilus_launch_application (app_info,
files,
NULL); /* TODO: what to set here? */
g_object_unref (file);
g_list_free (files);
}
typedef struct {
NautilusAutorunGetContent callback;
gpointer user_data;
......
......@@ -47,6 +47,4 @@ void nautilus_autorun_get_x_content_types_for_mount_async (GMount *mount,
GCancellable *cancellable,
gpointer user_data);
void nautilus_autorun_launch_for_mount (GMount *mount, GAppInfo *app_info);
#endif /* NAUTILUS_AUTORUN_H */
......@@ -128,6 +128,27 @@ application_cannot_open_location (GAppInfo *application,
#endif
}
void
nautilus_launch_application_for_mount (GAppInfo *app_info,
GMount *mount,
GtkWindow *parent_window)
{
GFile *root;
NautilusFile *file;
GList *files;
root = g_mount_get_root (mount);
file = nautilus_file_get (root);
g_object_unref (root);
files = g_list_append (NULL, file);
nautilus_launch_application (app_info,
files,
parent_window);
g_list_free_full (files, (GDestroyNotify) nautilus_file_unref);
}
/**
* nautilus_launch_application:
*
......
......@@ -39,6 +39,9 @@ void nautilus_launch_application (GAppInfo
void nautilus_launch_application_by_uri (GAppInfo *application,
GList *uris,
GtkWindow *parent_window);
void nautilus_launch_application_for_mount (GAppInfo *app_info,
GMount *mount,
GtkWindow *parent_window);
void nautilus_launch_application_from_command (GdkScreen *screen,
const char *name,
const char *command_string,
......
......@@ -29,8 +29,8 @@
#include <string.h>
#include "nautilus-x-content-bar.h"
#include <libnautilus-private/nautilus-autorun.h>
#include <libnautilus-private/nautilus-icon-info.h>
#include <libnautilus-private/nautilus-program-choosing.h>
#define NAUTILUS_X_CONTENT_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAUTILUS_TYPE_X_CONTENT_BAR, NautilusXContentBarPrivate))
......@@ -256,7 +256,8 @@ button_clicked_callback (GtkWidget *button, NautilusXContentBar *bar)
default_app = g_app_info_get_default_for_type (bar->priv->x_content_type, FALSE);
if (default_app != NULL) {
nautilus_autorun_launch_for_mount (bar->priv->mount, default_app);
nautilus_launch_application_for_mount (default_app, bar->priv->mount,
GTK_WINDOW (gtk_widget_get_toplevel (button)));
g_object_unref (default_app);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment