Commit a409c1bb authored by Mike Engber's avatar Mike Engber
Browse files

Hooked up the quit menu in the desktop context menu to quit Nautilus. Now,


	* libnautilus/nautilus-view-component.idl:
	* libnautilus/nautilus-view.c: (nautilus_view_quit_nautilus):
	* libnautilus/nautilus-view.h:
	* src/file-manager/fm-desktop-icon-view.c:
	(fm_desktop_icon_view_quit_menu_item_callback),
	(fm_desktop_icon_view_create_background_context_menu_items):
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_quit_nautilus):
	* src/file-manager/fm-directory-view.h:
	* src/nautilus-application.c: (nautilus_application_startup),
	(nautilus_application_destroy_window):
	* src/nautilus-application.h:
	* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
	* src/nautilus-view-frame-corba.c:
	(impl_Nautilus_ViewFrame_set_title),
	(impl_Nautilus_ViewFrame_quit_nautilus):
	* src/nautilus-view-frame-private.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_initialize_class),
	(nautilus_view_frame_set_title),
	(nautilus_view_frame_quit_nautilus):
	* src/nautilus-view-frame.h:
	* src/nautilus-window-manage-views.c:
	(nautilus_window_load_content_view):
	* src/nautilus-window.c: (nautilus_window_quit_nautilus_callback),
	(nautilus_window_connect_view):
	Hooked up the quit menu in the desktop context menu to quit Nautilus.
	Now, if Nautilus is managing the desktop no default window is created
	and Nautilus does not quit when the last window is closed - i.e. use
	the quit menu item instead. Bugs 1050 and 1051.
parent af430dfa
2000-07-11 Michael Engber <engber@eazel.com>
* libnautilus/nautilus-view-component.idl:
* libnautilus/nautilus-view.c: (nautilus_view_quit_nautilus):
* libnautilus/nautilus-view.h:
* src/file-manager/fm-desktop-icon-view.c:
(fm_desktop_icon_view_quit_menu_item_callback),
(fm_desktop_icon_view_create_background_context_menu_items):
* src/file-manager/fm-directory-view.c:
(fm_directory_view_quit_nautilus):
* src/file-manager/fm-directory-view.h:
* src/nautilus-application.c: (nautilus_application_startup),
(nautilus_application_destroy_window):
* src/nautilus-application.h:
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
* src/nautilus-view-frame-corba.c:
(impl_Nautilus_ViewFrame_set_title),
(impl_Nautilus_ViewFrame_quit_nautilus):
* src/nautilus-view-frame-private.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class),
(nautilus_view_frame_set_title),
(nautilus_view_frame_quit_nautilus):
* src/nautilus-view-frame.h:
* src/nautilus-window-manage-views.c:
(nautilus_window_load_content_view):
* src/nautilus-window.c: (nautilus_window_quit_nautilus_callback),
(nautilus_window_connect_view):
Hooked up the quit menu in the desktop context menu to quit Nautilus.
Now, if Nautilus is managing the desktop no default window is created
and Nautilus does not quit when the last window is closed - i.e. use
the quit menu item instead. Bugs 1050 and 1051.
2000-07-11 J Shane Culpepper <pepper@eazel.com>
* components/services/login/nautilus-view/nautilus-login-view.c:
......
......@@ -85,6 +85,9 @@ module Nautilus {
/* Called by a view component to change the title. */
oneway void set_title (in string new_title);
/* Called by a view component to quit nautilus */
oneway void quit_nautilus ();
};
typedef double ZoomLevel;
......
......@@ -438,6 +438,19 @@ nautilus_view_set_title (NautilusView *view,
view_frame_call_end (view_frame, &ev);
}
void
nautilus_view_quit_nautilus (NautilusView *view)
{
CORBA_Environment ev;
Nautilus_ViewFrame view_frame;
view_frame = view_frame_call_begin (view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
Nautilus_ViewFrame_quit_nautilus (view_frame, &ev);
}
view_frame_call_end (view_frame, &ev);
}
BonoboControl *
nautilus_view_get_bonobo_control (NautilusView *view)
{
......
......@@ -83,6 +83,7 @@ void nautilus_view_report_load_complete (NautilusView
void nautilus_view_report_load_failed (NautilusView *view);
void nautilus_view_set_title (NautilusView *view,
const char *title);
void nautilus_view_quit_nautilus (NautilusView *view);
/* Some utility functions useful for doing the CORBA work directly.
* Not needed by most components, but shared with the view frame code,
......
......@@ -59,9 +59,7 @@ fm_desktop_icon_view_initialize (FMDesktopIconView *desktop_icon_view)
static void
fm_desktop_icon_view_quit_menu_item_callback (GtkMenuItem *item, gpointer callback_data)
{
/* FIXME bugzilla.eazel.com 1050:
* need to define an interface to tell nautilus to quit, and call it here.
*/
fm_directory_view_quit_nautilus( FM_DIRECTORY_VIEW (callback_data));
}
static void
......@@ -81,7 +79,7 @@ fm_desktop_icon_view_create_background_context_menu_items (FMDirectoryView *view
gtk_signal_connect (GTK_OBJECT (menu_item),
"activate",
GTK_SIGNAL_FUNC (fm_desktop_icon_view_quit_menu_item_callback),
NULL);
view);
gtk_widget_show (menu_item);
gtk_menu_append (menu, menu_item);
}
......
......@@ -3262,3 +3262,10 @@ fm_directory_view_get_context_menu_index(const char *menu_name)
return -1;
}
}
void
fm_directory_view_quit_nautilus (FMDirectoryView *view)
{
g_assert (FM_IS_DIRECTORY_VIEW (view));
nautilus_view_quit_nautilus (view->details->nautilus_view);
}
......@@ -266,5 +266,7 @@ NautilusDirectory *fm_directory_view_get_model (FMDirectory
void fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view);
void fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view);
void fm_directory_view_update_menus (FMDirectoryView *view);
void fm_directory_view_quit_nautilus (FMDirectoryView *view);
#endif /* FM_DIRECTORY_VIEW_H */
......@@ -391,11 +391,7 @@ nautilus_application_startup (NautilusApplication *application,
CORBA_free (url_list);
}
/* FIXME bugzilla.eazel.com 1051: Change this logic back so it won't
* make a new window when asked to manage the desktop, once we have
* a way to get rid of the desktop.
*/
if (/* !manage_desktop && */ urls == NULL) {
if (!manage_desktop && urls == NULL) {
Nautilus_Shell_open_default_window (shell, &ev);
}
......@@ -405,16 +401,13 @@ nautilus_application_startup (NautilusApplication *application,
out:
CORBA_exception_free (&ev);
return application->windows != NULL;
return application->windows != NULL || application->has_desktop;
}
static void
nautilus_application_destroy_window (GtkObject *obj, NautilusApplication *application)
{
application->windows = g_slist_remove (application->windows, obj);
if (application->windows == NULL) {
nautilus_application_quit ();
}
}
void
......
......@@ -46,6 +46,7 @@ typedef struct NautilusWindow NautilusWindow;
typedef struct {
BonoboObject parent;
GSList *windows;
gboolean has_desktop;
NautilusUndoManager *undo_manager;
} NautilusApplication;
......
......@@ -111,6 +111,8 @@ nautilus_desktop_window_new (NautilusApplication *application)
nautilus_window_goto_uri (NAUTILUS_WINDOW (window), desktop_directory_uri);
g_free (desktop_directory_uri);
application->has_desktop = TRUE;
gtk_widget_show (GTK_WIDGET (window));
return window;
......
......@@ -1090,6 +1090,13 @@ nautilus_window_set_title_callback (NautilusViewFrame *view,
nautilus_window_set_title (window, title, view);
}
static void
nautilus_window_quit_nautilus_callback (NautilusViewFrame *view,
NautilusWindow *window)
{
nautilus_application_quit ();
}
static void
nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
double zoom_level,
......@@ -1167,6 +1174,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_complete);
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (quit_nautilus);
CONNECT (zoom_level_changed);
CONNECT (get_history_list);
......
......@@ -1090,6 +1090,13 @@ nautilus_window_set_title_callback (NautilusViewFrame *view,
nautilus_window_set_title (window, title, view);
}
static void
nautilus_window_quit_nautilus_callback (NautilusViewFrame *view,
NautilusWindow *window)
{
nautilus_application_quit ();
}
static void
nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
double zoom_level,
......@@ -1167,6 +1174,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_complete);
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (quit_nautilus);
CONNECT (zoom_level_changed);
CONNECT (get_history_list);
......
......@@ -1090,6 +1090,13 @@ nautilus_window_set_title_callback (NautilusViewFrame *view,
nautilus_window_set_title (window, title, view);
}
static void
nautilus_window_quit_nautilus_callback (NautilusViewFrame *view,
NautilusWindow *window)
{
nautilus_application_quit ();
}
static void
nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
double zoom_level,
......@@ -1167,6 +1174,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_complete);
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (quit_nautilus);
CONNECT (zoom_level_changed);
CONNECT (get_history_list);
......
......@@ -60,6 +60,8 @@ static void impl_Nautilus_ViewFrame_report_load_failed (PortableServer_
static void impl_Nautilus_ViewFrame_set_title (PortableServer_Servant servant,
const CORBA_char *title,
CORBA_Environment *ev);
static void impl_Nautilus_ViewFrame_quit_nautilus (PortableServer_Servant servant,
CORBA_Environment *ev);
POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv =
{
......@@ -73,7 +75,8 @@ POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv =
&impl_Nautilus_ViewFrame_report_load_progress,
&impl_Nautilus_ViewFrame_report_load_complete,
&impl_Nautilus_ViewFrame_report_load_failed,
&impl_Nautilus_ViewFrame_set_title
&impl_Nautilus_ViewFrame_set_title,
&impl_Nautilus_ViewFrame_quit_nautilus,
};
static PortableServer_ServantBase__epv base_epv;
......@@ -219,3 +222,11 @@ impl_Nautilus_ViewFrame_set_title (PortableServer_Servant servant,
(((impl_POA_Nautilus_ViewFrame *) servant)->view, title);
}
static void
impl_Nautilus_ViewFrame_quit_nautilus (PortableServer_Servant servant,
CORBA_Environment *ev)
{
nautilus_view_frame_quit_nautilus
(((impl_POA_Nautilus_ViewFrame *) servant)->view);
}
......@@ -64,6 +64,7 @@ void nautilus_view_frame_report_load_complete (NautilusViewFrame
void nautilus_view_frame_report_load_failed (NautilusViewFrame *view);
void nautilus_view_frame_set_title (NautilusViewFrame *view,
const char *title);
void nautilus_view_frame_quit_nautilus (NautilusViewFrame *view);
/* Zoomable */
void nautilus_view_frame_zoom_level_changed (NautilusViewFrame *view,
......
......@@ -55,6 +55,7 @@ enum {
REPORT_LOAD_COMPLETE,
REPORT_LOAD_FAILED,
SET_TITLE,
QUIT_NAUTILUS,
ZOOM_LEVEL_CHANGED,
CLIENT_GONE,
GET_HISTORY_LIST,
......@@ -157,6 +158,14 @@ nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass)
set_title),
gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
signals[QUIT_NAUTILUS] =
gtk_signal_new ("quit_nautilus",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusViewFrameClass,
quit_nautilus),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[ZOOM_LEVEL_CHANGED] =
gtk_signal_new ("zoom_level_changed",
......@@ -723,6 +732,13 @@ nautilus_view_frame_set_title (NautilusViewFrame *view,
gtk_signal_emit (GTK_OBJECT (view), signals[SET_TITLE], title);
}
void
nautilus_view_frame_quit_nautilus (NautilusViewFrame *view)
{
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
gtk_signal_emit (GTK_OBJECT (view), signals[QUIT_NAUTILUS]);
}
void
nautilus_view_frame_zoom_level_changed (NautilusViewFrame *view,
double level)
......
......@@ -98,6 +98,7 @@ typedef struct {
void (* report_load_failed) (NautilusViewFrame *view);
void (* set_title) (NautilusViewFrame *view,
const char *title);
void (* quit_nautilus) (NautilusViewFrame *view);
/* Part of Nautilus::ZoomableFrame CORBA interface. */
void (* zoom_level_changed) (NautilusViewFrame *view,
......
......@@ -727,12 +727,12 @@ nautilus_window_load_content_view (NautilusWindow *window,
*/
if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
/* We force the desktop to use a desktop_icon_view. It's simpler
* to do fix it here than trying to make it pick the right view
* in the first place.
* to fix it here than trying to make it pick the right view in
* the first place.
*/
iid = NAUTILUS_DESKTOP_ICON_VIEW_IID;
} else {
g_return_val_if_fail(id, NULL);
g_return_val_if_fail (id, NULL);
iid = id->iid;
}
......
......@@ -1090,6 +1090,13 @@ nautilus_window_set_title_callback (NautilusViewFrame *view,
nautilus_window_set_title (window, title, view);
}
static void
nautilus_window_quit_nautilus_callback (NautilusViewFrame *view,
NautilusWindow *window)
{
nautilus_application_quit ();
}
static void
nautilus_window_zoom_level_changed_callback (NautilusViewFrame *view,
double zoom_level,
......@@ -1167,6 +1174,7 @@ nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
CONNECT (report_load_complete);
CONNECT (report_load_failed);
CONNECT (set_title);
CONNECT (quit_nautilus);
CONNECT (zoom_level_changed);
CONNECT (get_history_list);
......
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