Commit 96835d31 authored by Mike Engber's avatar Mike Engber

Changed desktop menu to offer close desktop instead of quit nautilus.


	* libnautilus/nautilus-view-component.idl:
	* libnautilus/nautilus-view.c:
	* libnautilus/nautilus-view.h:
	* src/file-manager/fm-desktop-icon-view.c:
	(fm_desktop_icon_view_close_desktop_menu_item_callback),
	(fm_desktop_icon_view_create_background_context_menu_items):
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_close_desktop):
	* src/file-manager/fm-directory-view.h:
	* src/nautilus-application.c: (nautilus_application_windows),
	(nautilus_application_startup),
	(nautilus_application_destroy_desktop_window),
	(nautilus_application_create_desktop_window),
	(nautilus_application_open_desktop),
	(nautilus_application_close_desktop),
	(nautilus_application_destroy_window),
	(nautilus_application_create_window):
	* src/nautilus-application.h:
	* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
	* src/nautilus-shell.c: (corba_manage_desktop):
	* src/nautilus-view-frame-corba.c:
	(impl_Nautilus_ViewFrame_set_title):
	* src/nautilus-view-frame-private.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_initialize_class),
	(nautilus_view_frame_set_title):
	* src/nautilus-view-frame.h:
	* src/nautilus-window-manage-views.c: (open_location):
	* src/nautilus-window.c: (nautilus_window_connect_view):
	Changed desktop menu to offer close desktop instead of
	quit nautilus. Also, changed the menu item's action to
	use a direct fn call instead of CORBA.
parent a3c59407
2000-07-13 Michael Engber <engber@eazel.com>
* libnautilus/nautilus-view-component.idl:
* libnautilus/nautilus-view.c:
* libnautilus/nautilus-view.h:
* src/file-manager/fm-desktop-icon-view.c:
(fm_desktop_icon_view_close_desktop_menu_item_callback),
(fm_desktop_icon_view_create_background_context_menu_items):
* src/file-manager/fm-directory-view.c:
(fm_directory_view_close_desktop):
* src/file-manager/fm-directory-view.h:
* src/nautilus-application.c: (nautilus_application_windows),
(nautilus_application_startup),
(nautilus_application_destroy_desktop_window),
(nautilus_application_create_desktop_window),
(nautilus_application_open_desktop),
(nautilus_application_close_desktop),
(nautilus_application_destroy_window),
(nautilus_application_create_window):
* src/nautilus-application.h:
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
* src/nautilus-shell.c: (corba_manage_desktop):
* src/nautilus-view-frame-corba.c:
(impl_Nautilus_ViewFrame_set_title):
* src/nautilus-view-frame-private.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class),
(nautilus_view_frame_set_title):
* src/nautilus-view-frame.h:
* src/nautilus-window-manage-views.c: (open_location):
* src/nautilus-window.c: (nautilus_window_connect_view):
Changed desktop menu to offer close desktop instead of
quit nautilus. Also, changed the menu item's action to
use a direct fn call instead of CORBA.
2000-07-13 Gene Z. Ragan <gzr@eazel.com>
* components/history/nautilus-history-view.c: (install_icon),
......
......@@ -85,9 +85,6 @@ 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,19 +438,6 @@ 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,7 +83,6 @@ 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,
......
......@@ -57,9 +57,9 @@ fm_desktop_icon_view_initialize (FMDesktopIconView *desktop_icon_view)
}
static void
fm_desktop_icon_view_quit_menu_item_callback (GtkMenuItem *item, gpointer callback_data)
fm_desktop_icon_view_close_desktop_menu_item_callback (GtkMenuItem *item, gpointer callback_data)
{
fm_directory_view_quit_nautilus (FM_DIRECTORY_VIEW (callback_data));
fm_directory_view_close_desktop (FM_DIRECTORY_VIEW (callback_data));
}
static void
......@@ -75,10 +75,10 @@ fm_desktop_icon_view_create_background_context_menu_items (FMDirectoryView *view
create_background_context_menu_items,
(view, menu));
menu_item = gtk_menu_item_new_with_label (_("Quit Nautilus"));
menu_item = gtk_menu_item_new_with_label (_("Close Nautilus Desktop"));
gtk_signal_connect (GTK_OBJECT (menu_item),
"activate",
GTK_SIGNAL_FUNC (fm_desktop_icon_view_quit_menu_item_callback),
GTK_SIGNAL_FUNC (fm_desktop_icon_view_close_desktop_menu_item_callback),
view);
gtk_widget_show (menu_item);
gtk_menu_append (menu, menu_item);
......
......@@ -49,6 +49,8 @@
#include <libnautilus/nautilus-undo.h>
#include <libnautilus/nautilus-zoomable.h>
#include <src/nautilus-application.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-directory-background.h>
......@@ -3264,8 +3266,8 @@ fm_directory_view_get_context_menu_index(const char *menu_name)
}
void
fm_directory_view_quit_nautilus (FMDirectoryView *view)
fm_directory_view_close_desktop (FMDirectoryView *view)
{
g_assert (FM_IS_DIRECTORY_VIEW (view));
nautilus_view_quit_nautilus (view->details->nautilus_view);
nautilus_application_close_desktop ();
}
......@@ -266,7 +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);
void fm_directory_view_close_desktop (FMDirectoryView *view);
#endif /* FM_DIRECTORY_VIEW_H */
......@@ -132,6 +132,17 @@ create_factory (PortableServer_POA poa,
return bonobo_object_activate_servant (BONOBO_OBJECT (bonobo_object), servant);
}
/* Keeps track of the one and only desktop window. */
static NautilusDesktopWindow *nautilus_application_desktop;
/* Keeps track of all the nautilus windows. */
static GSList *nautilus_application_window_list;
GSList *nautilus_application_windows (void)
{
return nautilus_application_window_list;
}
static void
nautilus_application_initialize_class (NautilusApplicationClass *klass)
{
......@@ -401,22 +412,60 @@ nautilus_application_startup (NautilusApplication *application,
out:
CORBA_exception_free (&ev);
return application->windows != NULL || application->has_desktop;
return nautilus_application_window_list != NULL || nautilus_application_desktop != NULL;
}
static void
nautilus_application_destroy_window (GtkObject *obj, NautilusApplication *application)
nautilus_application_destroy_desktop_window (GtkObject *obj, NautilusApplication *application)
{
nautilus_application_desktop = NULL;
}
static NautilusDesktopWindow *
nautilus_application_create_desktop_window (NautilusApplication *application)
{
NautilusDesktopWindow *window;
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
window = nautilus_desktop_window_new (application);
gtk_signal_connect (GTK_OBJECT (window),
"destroy", nautilus_application_destroy_desktop_window,
application);
nautilus_application_desktop = window;
return window;
}
void
nautilus_application_open_desktop (NautilusApplication *application)
{
application->windows = g_slist_remove (application->windows, obj);
if (application->windows == NULL && !application->has_desktop) {
NautilusDesktopWindow *desktop_window;
if (nautilus_application_desktop == NULL) {
desktop_window = nautilus_application_create_desktop_window (application);
}
gtk_widget_show (GTK_WIDGET (desktop_window));
}
void
nautilus_application_close_desktop (void)
{
gtk_widget_destroy (GTK_WIDGET (nautilus_application_desktop));
if (nautilus_application_window_list == NULL) {
gtk_main_quit ();
}
}
void
nautilus_application_quit (void)
static void
nautilus_application_destroy_window (GtkObject *obj, NautilusApplication *application)
{
gtk_main_quit ();
nautilus_application_window_list = g_slist_remove (nautilus_application_window_list, obj);
if (nautilus_application_window_list == NULL && nautilus_application_desktop == NULL) {
gtk_main_quit ();
}
}
NautilusWindow *
......@@ -433,7 +482,7 @@ nautilus_application_create_window (NautilusApplication *application)
"destroy", nautilus_application_destroy_window,
application);
application->windows = g_slist_prepend (application->windows, window);
nautilus_application_window_list = g_slist_prepend (nautilus_application_window_list, window);
/* Do not yet show the window. It will be shown later on if it can
* successfully display its initial URI. Otherwise it will be destroyed
......
......@@ -40,8 +40,6 @@ typedef struct NautilusWindow NautilusWindow;
typedef struct {
BonoboObject parent;
GSList *windows;
gboolean has_desktop;
NautilusUndoManager *undo_manager;
} NautilusApplication;
......@@ -54,7 +52,15 @@ NautilusApplication *nautilus_application_new (void);
gboolean nautilus_application_startup (NautilusApplication *application,
gboolean manage_desktop,
const char *urls[]);
NautilusWindow * nautilus_application_create_window (NautilusApplication *application);
void nautilus_application_quit (void);
GSList *nautilus_application_windows (void);
NautilusWindow *nautilus_application_create_window (NautilusApplication *application);
void nautilus_application_open_desktop (NautilusApplication *application);
void nautilus_application_close_desktop (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NAUTILUS_APPLICATION_H */
......@@ -110,8 +110,6 @@ nautilus_desktop_window_new (NautilusApplication *application)
g_free (desktop_directory_path);
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));
......
......@@ -1095,13 +1095,6 @@ 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,
......@@ -1181,7 +1174,6 @@ 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);
......
......@@ -1095,13 +1095,6 @@ 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,
......@@ -1181,7 +1174,6 @@ 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);
......
......@@ -259,14 +259,11 @@ static void
corba_manage_desktop (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusShell *shell;
static NautilusDesktopWindow *desktop_window;
shell = NAUTILUS_SHELL (((BonoboObjectServant *) servant)->bonobo_object);
NautilusShell *shell;
NautilusApplication *application;
/* Create a desktop window. */
if (desktop_window == NULL) {
desktop_window = nautilus_desktop_window_new (shell->details->application);
}
gtk_widget_show (GTK_WIDGET (desktop_window));
shell = NAUTILUS_SHELL (((BonoboObjectServant *) servant)->bonobo_object);
application = NAUTILUS_APPLICATION (shell->details->application);
nautilus_application_open_desktop (application);
}
......@@ -1095,13 +1095,6 @@ 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,
......@@ -1181,7 +1174,6 @@ 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,8 +60,6 @@ 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 =
{
......@@ -76,7 +74,6 @@ POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv =
&impl_Nautilus_ViewFrame_report_load_complete,
&impl_Nautilus_ViewFrame_report_load_failed,
&impl_Nautilus_ViewFrame_set_title,
&impl_Nautilus_ViewFrame_quit_nautilus,
};
static PortableServer_ServantBase__epv base_epv;
......@@ -221,12 +218,3 @@ impl_Nautilus_ViewFrame_set_title (PortableServer_Servant servant,
nautilus_view_frame_set_title
(((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);
}
......@@ -65,6 +65,7 @@ void nautilus_view_frame_report_load_failed (NautilusViewFrame
void nautilus_view_frame_set_title (NautilusViewFrame *view,
const char *title);
void nautilus_view_frame_quit_nautilus (NautilusViewFrame *view);
void nautilus_view_frame_close_desktop (NautilusViewFrame *view);
/* Zoomable */
void nautilus_view_frame_zoom_level_changed (NautilusViewFrame *view,
......
......@@ -52,7 +52,6 @@ enum {
REPORT_LOAD_COMPLETE,
REPORT_LOAD_FAILED,
SET_TITLE,
QUIT_NAUTILUS,
ZOOM_LEVEL_CHANGED,
CLIENT_GONE,
GET_HISTORY_LIST,
......@@ -155,14 +154,6 @@ 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",
......@@ -724,13 +715,6 @@ 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,7 +98,6 @@ 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,
......
......@@ -665,7 +665,7 @@ open_location (NautilusWindow *window,
/* FIXME: This may be the desired bahavior, but the prefs UI still says open
* new window. How can we resolve this inconsistancy?
*/
for (element = window->application->windows; element != NULL; element = element->next) {
for (element = nautilus_application_windows (); element != NULL; element = element->next) {
traverse_window = element->data;
if (strcmp (traverse_window->location, location) == 0) {
gtk_widget_show_now (GTK_WIDGET (traverse_window));
......
......@@ -1095,13 +1095,6 @@ 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,
......@@ -1181,7 +1174,6 @@ 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