Commit a0f70c0e authored by John Sullivan's avatar John Sullivan

Made "this application can only handle local files"

	dialog be parented on the NautilusWindow from whence
	it came.

	* libnautilus-extensions/nautilus-program-choosing.h:
	* libnautilus-extensions/nautilus-program-choosing.c:
	(nautilus_launch_application_parented): Removed this function
	(nautilus_launch_application): Made this function take a
	parent (can be NULL, but better not to be).

	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_launch_application): Remove "_parented"

	* src/nautilus-sidebar.c:
	(nautilus_sidebar_get_window): New helper function to get
	enclosing window.
	(command_button_callback),
	(nautilus_sidebar_chose_application_callback): Pass parent
	window to nautilus_launch_application.
parent c7ef4182
2000-10-17 John Sullivan <sullivan@eazel.com>
Made "this application can only handle local files"
dialog be parented on the NautilusWindow from whence
it came.
* libnautilus-extensions/nautilus-program-choosing.h:
* libnautilus-extensions/nautilus-program-choosing.c:
(nautilus_launch_application_parented): Removed this function
(nautilus_launch_application): Made this function take a
parent (can be NULL, but better not to be).
* src/file-manager/fm-directory-view.c:
(fm_directory_view_launch_application): Remove "_parented"
* src/nautilus-sidebar.c:
(nautilus_sidebar_get_window): New helper function to get
enclosing window.
(command_button_callback),
(nautilus_sidebar_chose_application_callback): Pass parent
window to nautilus_launch_application.
2000-10-17 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-window.c: (nautilus_window_constructed),
......
......@@ -220,20 +220,20 @@ nautilus_choose_application_for_file (NautilusFile *file,
}
/**
* nautilus_launch_application_parented:
* nautilus_launch_application:
*
* Fork off a process to launch an application with a given uri as
* a parameter. Provide a parent window for error dialogs.
*
* @application: The application to be launched.
* @uri: Passed as a parameter to the application.
* @parent: A window to use as the parent for any error dialogs.
* @parent_window: A window to use as the parent for any error dialogs.
*
*/
void
nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent)
nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent_window)
{
GnomeDialog *dialog;
char *command_string;
......@@ -260,7 +260,7 @@ nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
"\"%s\" is remote. If you want to open it "
"with %s, make a local copy first."),
application->name, uri, application->name);
dialog = nautilus_error_dialog (prompt, _("Can't open remote file"), parent);
dialog = nautilus_error_dialog (prompt, _("Can't open remote file"), parent_window);
g_free (prompt);
return;
}
......@@ -278,21 +278,6 @@ nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
g_free (command_string);
}
/**
* nautilus_launch_application:
*
* Fork off a process to launch an application with a given uri as
* a parameter.
*
* @application: The application to be launched.
* @uri: Passed as a parameter to the application.
*/
void
nautilus_launch_application (GnomeVFSMimeApplication *application, const char *uri)
{
nautilus_launch_application_parented (application, uri, NULL);
}
/**
* nautilus_launch_application_from_command:
*
......
......@@ -44,11 +44,9 @@ void nautilus_choose_component_for_file (NautilusFile
GtkWindow *parent_window,
NautilusComponentChoiceCallback callback,
gpointer callback_data);
void nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri);
void nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
void nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent);
GtkWindow *parent_window);
void nautilus_launch_application_from_command (const char *command_string,
const char *parameter);
......
......@@ -220,20 +220,20 @@ nautilus_choose_application_for_file (NautilusFile *file,
}
/**
* nautilus_launch_application_parented:
* nautilus_launch_application:
*
* Fork off a process to launch an application with a given uri as
* a parameter. Provide a parent window for error dialogs.
*
* @application: The application to be launched.
* @uri: Passed as a parameter to the application.
* @parent: A window to use as the parent for any error dialogs.
* @parent_window: A window to use as the parent for any error dialogs.
*
*/
void
nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent)
nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent_window)
{
GnomeDialog *dialog;
char *command_string;
......@@ -260,7 +260,7 @@ nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
"\"%s\" is remote. If you want to open it "
"with %s, make a local copy first."),
application->name, uri, application->name);
dialog = nautilus_error_dialog (prompt, _("Can't open remote file"), parent);
dialog = nautilus_error_dialog (prompt, _("Can't open remote file"), parent_window);
g_free (prompt);
return;
}
......@@ -278,21 +278,6 @@ nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
g_free (command_string);
}
/**
* nautilus_launch_application:
*
* Fork off a process to launch an application with a given uri as
* a parameter.
*
* @application: The application to be launched.
* @uri: Passed as a parameter to the application.
*/
void
nautilus_launch_application (GnomeVFSMimeApplication *application, const char *uri)
{
nautilus_launch_application_parented (application, uri, NULL);
}
/**
* nautilus_launch_application_from_command:
*
......
......@@ -44,11 +44,9 @@ void nautilus_choose_component_for_file (NautilusFile
GtkWindow *parent_window,
NautilusComponentChoiceCallback callback,
gpointer callback_data);
void nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri);
void nautilus_launch_application_parented (GnomeVFSMimeApplication *application,
void nautilus_launch_application (GnomeVFSMimeApplication *application,
const char *uri,
GtkWindow *parent);
GtkWindow *parent_window);
void nautilus_launch_application_from_command (const char *command_string,
const char *parameter);
......
......@@ -517,7 +517,7 @@ fm_directory_view_launch_application (GnomeVFSMimeApplication *application,
g_assert (uri != NULL);
g_assert (FM_IS_DIRECTORY_VIEW (directory_view));
nautilus_launch_application_parented
nautilus_launch_application
(application, uri, get_containing_window (directory_view));
}
......
......@@ -1078,6 +1078,16 @@ background_reset_callback (NautilusBackground *background, NautilusSidebar *side
"reset");
}
static GtkWindow *
nautilus_sidebar_get_window (NautilusSidebar *sidebar)
{
GtkWidget *result;
result = gtk_widget_get_ancestor (GTK_WIDGET (sidebar), GTK_TYPE_WINDOW);
return result == NULL ? NULL : GTK_WINDOW (result);
}
static void
command_button_callback (GtkWidget *button, char *id_str)
{
......@@ -1089,7 +1099,8 @@ command_button_callback (GtkWidget *button, char *id_str)
application = gnome_vfs_application_registry_get_mime_application (id_str);
if (application != NULL) {
nautilus_launch_application (application, sidebar->details->uri);
nautilus_launch_application (application, sidebar->details->uri,
nautilus_sidebar_get_window (sidebar));
gnome_vfs_mime_application_free (application);
}
......@@ -1120,12 +1131,15 @@ static void
nautilus_sidebar_chose_application_callback (GnomeVFSMimeApplication *application,
gpointer callback_data)
{
g_assert (NAUTILUS_IS_SIDEBAR (callback_data));
NautilusSidebar *sidebar;
sidebar = NAUTILUS_SIDEBAR (callback_data);
if (application != NULL) {
nautilus_launch_application
nautilus_launch_application
(application,
NAUTILUS_SIDEBAR (callback_data)->details->uri);
sidebar->details->uri,
nautilus_sidebar_get_window (sidebar));
}
}
......
......@@ -1078,6 +1078,16 @@ background_reset_callback (NautilusBackground *background, NautilusSidebar *side
"reset");
}
static GtkWindow *
nautilus_sidebar_get_window (NautilusSidebar *sidebar)
{
GtkWidget *result;
result = gtk_widget_get_ancestor (GTK_WIDGET (sidebar), GTK_TYPE_WINDOW);
return result == NULL ? NULL : GTK_WINDOW (result);
}
static void
command_button_callback (GtkWidget *button, char *id_str)
{
......@@ -1089,7 +1099,8 @@ command_button_callback (GtkWidget *button, char *id_str)
application = gnome_vfs_application_registry_get_mime_application (id_str);
if (application != NULL) {
nautilus_launch_application (application, sidebar->details->uri);
nautilus_launch_application (application, sidebar->details->uri,
nautilus_sidebar_get_window (sidebar));
gnome_vfs_mime_application_free (application);
}
......@@ -1120,12 +1131,15 @@ static void
nautilus_sidebar_chose_application_callback (GnomeVFSMimeApplication *application,
gpointer callback_data)
{
g_assert (NAUTILUS_IS_SIDEBAR (callback_data));
NautilusSidebar *sidebar;
sidebar = NAUTILUS_SIDEBAR (callback_data);
if (application != NULL) {
nautilus_launch_application
nautilus_launch_application
(application,
NAUTILUS_SIDEBAR (callback_data)->details->uri);
sidebar->details->uri,
nautilus_sidebar_get_window (sidebar));
}
}
......
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