Commit 91fc8d21 authored by Darin Adler's avatar Darin Adler

Another cut on the desktop. Way closer.

	* libnautilus-extensions/Makefile.am:
	* libnautilus-extensions/nautilus-generous-bin.h:
	* libnautilus-extensions/nautilus-generous-bin.c:
	Added a new class NautilusGenerousBin. This is a GtkBin
	subclass that gives its entire allocation to its child.
	Used both in the widgetry for desktop windows and as a
	base class for NautilusViewFrame for now.

	* libnautilus-extensions/nautilus-gnome-extensions.c:
	(turn_on_line_wrap_flag), (turn_on_line_wrap_flag_callback):
	Changed to use gtk_container_foreach instead of the old
	gtk_container_children, since I now understand that the
	latter is just a convenience cover for the former.

	* src/Makefile.am:
	* src/nautilus-window-state.c: [removed]
	* src/nautilus-window-state.h: [removed]
	The only function in here was a wonky one that did goto_uri
	of go_home depending on the parameter. Changed the callers
	and things got clearer anyway.

	* src/nautilus-application.h:
	* src/nautilus-application.c: (display_caveat),
	(nautilus_app_startup):
	* src/nautilus-main.c: (main):
	Changed rules about which windows are created on startup. This
	puts us into a slightly bad state because it's now easy to
	create a desktop window with no way to get rid of it.

	* src/nautilus-desktop-window.h:
	* src/nautilus-desktop-window.c:
	(nautilus_desktop_window_initialize_class),
	(nautilus_desktop_window_initialize), (destroy), (realize):
	A better cut at the desktop window creation that now mostly works.

	* src/nautilus-main.c: (main):
	Changed the "--desktop" option's name to "--manage-desktop".

	* src/nautilus-view-frame.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_initialize_class),
	(nautilus_view_frame_initialize),
	(nautilus_view_frame_destroy_client),
	(nautilus_view_frame_destroy),
	(nautilus_view_frame_construct_arg_set):
	Changed to use NautilusGenerousBin as base class. Also use the
	Nautilus boilerplate macros.

	* src/nautilus-window-manage-views.c:
	(nautilus_window_request_location_change):
	Use goto_uri instead of set_initial_state.

	* src/nautilus-window-private.h:
	* src/nautilus-window.h:
	* src/nautilus-window.c: (nautilus_window_go_home):
	Make go_home public and move the actual code needed to go to the
	home package into the function.

	* src/nautilus-window.c: (nautilus_window_constructed):
	Reduced the amount of hackery on behalf of the desktop window and
	used the NautilusGenerousBin class.
parent 0cc9cbd2
2000-05-31 Darin Adler <darin@eazel.com>
Another cut on the desktop. Way closer.
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-generous-bin.h:
* libnautilus-extensions/nautilus-generous-bin.c:
Added a new class NautilusGenerousBin. This is a GtkBin
subclass that gives its entire allocation to its child.
Used both in the widgetry for desktop windows and as a
base class for NautilusViewFrame for now.
* libnautilus-extensions/nautilus-gnome-extensions.c:
(turn_on_line_wrap_flag), (turn_on_line_wrap_flag_callback):
Changed to use gtk_container_foreach instead of the old
gtk_container_children, since I now understand that the
latter is just a convenience cover for the former.
* src/Makefile.am:
* src/nautilus-window-state.c: [removed]
* src/nautilus-window-state.h: [removed]
The only function in here was a wonky one that did goto_uri
of go_home depending on the parameter. Changed the callers
and things got clearer anyway.
* src/nautilus-application.h:
* src/nautilus-application.c: (display_caveat),
(nautilus_app_startup):
* src/nautilus-main.c: (main):
Changed rules about which windows are created on startup. This
puts us into a slightly bad state because it's now easy to
create a desktop window with no way to get rid of it.
* src/nautilus-desktop-window.h:
* src/nautilus-desktop-window.c:
(nautilus_desktop_window_initialize_class),
(nautilus_desktop_window_initialize), (destroy), (realize):
A better cut at the desktop window creation that now mostly works.
* src/nautilus-main.c: (main):
Changed the "--desktop" option's name to "--manage-desktop".
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class),
(nautilus_view_frame_initialize),
(nautilus_view_frame_destroy_client),
(nautilus_view_frame_destroy),
(nautilus_view_frame_construct_arg_set):
Changed to use NautilusGenerousBin as base class. Also use the
Nautilus boilerplate macros.
* src/nautilus-window-manage-views.c:
(nautilus_window_request_location_change):
Use goto_uri instead of set_initial_state.
* src/nautilus-window-private.h:
* src/nautilus-window.h:
* src/nautilus-window.c: (nautilus_window_go_home):
Make go_home public and move the actual code needed to go to the
home package into the function.
* src/nautilus-window.c: (nautilus_window_constructed):
Reduced the amount of hackery on behalf of the desktop window and
used the NautilusGenerousBin class.
2000-05-31 Ramiro Estrugo <ramiro@eazel.com>
* components/mozilla/nautilus-mozilla-content-view.c:
......@@ -214,8 +280,7 @@
* components/services/time/nautilus-view/Makefile.am:
* components/services/time/nautilus-view/main.c:
(sample_object_destroyed), (sample_make_object), (main):
*
components/services/time/nautilus-view/trilobite-eazel-time-view.c:
* components/services/time/nautilus-view/trilobite-eazel-time-view.c:
(set_status_text), (sync_button_pressed), (url_button_pressed),
(timediff_button_pressed), (update_time_display),
(trilobite_eazel_time_view_initialize_class),
......
......@@ -46,6 +46,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-file.h \
nautilus-gdk-extensions.h \
nautilus-gdk-pixbuf-extensions.h \
nautilus-generous-bin.h \
nautilus-glib-extensions.h \
nautilus-global-preferences.h \
nautilus-gnome-extensions.h \
......@@ -96,6 +97,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-file.c \
nautilus-gdk-extensions.c \
nautilus-gdk-pixbuf-extensions.c \
nautilus-generous-bin.c \
nautilus-glib-extensions.c \
nautilus-global-preferences.c \
nautilus-gnome-extensions.c \
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-generous-bin.c: Subclass of GtkVBox that clips off
items that don't fit, except the last one.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: John Sullivan <sullivan@eazel.com>,
*/
#include <config.h>
#include "nautilus-generous-bin.h"
#include "nautilus-gtk-macros.h"
static void nautilus_generous_bin_initialize_class (NautilusGenerousBinClass *class);
static void nautilus_generous_bin_initialize (NautilusGenerousBin *box);
static void nautilus_generous_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void nautilus_generous_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusGenerousBin, nautilus_generous_bin, GTK_TYPE_BIN)
static void
nautilus_generous_bin_initialize_class (NautilusGenerousBinClass *klass)
{
GTK_WIDGET_CLASS (klass)->size_request = nautilus_generous_bin_size_request;
GTK_WIDGET_CLASS (klass)->size_allocate = nautilus_generous_bin_size_allocate;
}
static void
nautilus_generous_bin_initialize (NautilusGenerousBin *bin)
{
}
static void
nautilus_generous_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkBin *bin;
GtkRequisition child_requisition;
bin = GTK_BIN (widget);
requisition->width = 0;
requisition->height = 0;
if (bin->child != NULL && GTK_WIDGET_VISIBLE (bin->child)) {
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
}
static void
nautilus_generous_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkBin *bin;
GtkAllocation child_allocation;
bin = GTK_BIN (widget);
widget->allocation = *allocation;
if (bin->child != NULL && GTK_WIDGET_VISIBLE (bin->child)) {
child_allocation = *allocation;
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-generous-bin.h: Subclass of GtkBin that gives all of its
allocation to its child.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#ifndef NAUTILUS_GENEROUS_BIN_H
#define NAUTILUS_GENEROUS_BIN_H
#include <gtk/gtkbin.h>
#define NAUTILUS_TYPE_GENEROUS_BIN (nautilus_generous_bin_get_type ())
#define NAUTILUS_GENEROUS_BIN(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_GENEROUS_BIN, NautilusGenerousBin))
#define NAUTILUS_GENEROUS_BIN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_GENEROUS_BIN, NautilusGenerousBinClass))
#define NAUTILUS_IS_GENEROUS_BIN(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_GENEROUS_BIN))
#define NAUTILUS_IS_GENEROUS_BIN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_GENEROUS_BIN))
typedef struct NautilusGenerousBin NautilusGenerousBin;
typedef struct NautilusGenerousBinClass NautilusGenerousBinClass;
struct NautilusGenerousBin {
GtkBin parent_slot;
};
struct NautilusGenerousBinClass {
GtkBinClass parent_slot;
};
GtkType nautilus_generous_bin_get_type (void);
#endif /* NAUTILUS_GENEROUS_BIN_H */
......@@ -33,6 +33,9 @@
#include <libgnomeui/gnome-messagebox.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-uidefs.h>
#include "nautilus-string.h"
static void turn_on_line_wrap_flag_callback (GtkWidget *widget, gpointer callback_data);
void
nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
......@@ -255,28 +258,31 @@ static void
turn_on_line_wrap_flag (GtkWidget *widget, const char *message)
{
char *text;
GList *children, *p;
/* Turn on the flag if we find a label with the message
* in it.
*/
if (GTK_IS_LABEL (widget)) {
gtk_label_get (GTK_LABEL (widget), &text);
if (strcmp (text, message) == 0) {
if (nautilus_strcmp (text, message) == 0) {
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
}
}
/* Recurse for children. */
if (GTK_IS_CONTAINER (widget)) {
children = gtk_container_children (GTK_CONTAINER (widget));
for (p = children; p != NULL; p = p->next) {
turn_on_line_wrap_flag (GTK_WIDGET (p->data), message);
}
g_list_free (children);
gtk_container_foreach (GTK_CONTAINER (widget),
turn_on_line_wrap_flag_callback,
(char *) message);
}
}
static void
turn_on_line_wrap_flag_callback (GtkWidget *widget, gpointer callback_data)
{
turn_on_line_wrap_flag (widget, callback_data);
}
/* Shamelessly stolen from gnome-dialog-util.c: */
static GtkWidget *
show_ok_box (const char *message,
......
......@@ -46,6 +46,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-file.h \
nautilus-gdk-extensions.h \
nautilus-gdk-pixbuf-extensions.h \
nautilus-generous-bin.h \
nautilus-glib-extensions.h \
nautilus-global-preferences.h \
nautilus-gnome-extensions.h \
......@@ -96,6 +97,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-file.c \
nautilus-gdk-extensions.c \
nautilus-gdk-pixbuf-extensions.c \
nautilus-generous-bin.c \
nautilus-glib-extensions.c \
nautilus-global-preferences.c \
nautilus-gnome-extensions.c \
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-generous-bin.c: Subclass of GtkVBox that clips off
items that don't fit, except the last one.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: John Sullivan <sullivan@eazel.com>,
*/
#include <config.h>
#include "nautilus-generous-bin.h"
#include "nautilus-gtk-macros.h"
static void nautilus_generous_bin_initialize_class (NautilusGenerousBinClass *class);
static void nautilus_generous_bin_initialize (NautilusGenerousBin *box);
static void nautilus_generous_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void nautilus_generous_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusGenerousBin, nautilus_generous_bin, GTK_TYPE_BIN)
static void
nautilus_generous_bin_initialize_class (NautilusGenerousBinClass *klass)
{
GTK_WIDGET_CLASS (klass)->size_request = nautilus_generous_bin_size_request;
GTK_WIDGET_CLASS (klass)->size_allocate = nautilus_generous_bin_size_allocate;
}
static void
nautilus_generous_bin_initialize (NautilusGenerousBin *bin)
{
}
static void
nautilus_generous_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkBin *bin;
GtkRequisition child_requisition;
bin = GTK_BIN (widget);
requisition->width = 0;
requisition->height = 0;
if (bin->child != NULL && GTK_WIDGET_VISIBLE (bin->child)) {
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
}
static void
nautilus_generous_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkBin *bin;
GtkAllocation child_allocation;
bin = GTK_BIN (widget);
widget->allocation = *allocation;
if (bin->child != NULL && GTK_WIDGET_VISIBLE (bin->child)) {
child_allocation = *allocation;
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-generous-bin.h: Subclass of GtkBin that gives all of its
allocation to its child.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#ifndef NAUTILUS_GENEROUS_BIN_H
#define NAUTILUS_GENEROUS_BIN_H
#include <gtk/gtkbin.h>
#define NAUTILUS_TYPE_GENEROUS_BIN (nautilus_generous_bin_get_type ())
#define NAUTILUS_GENEROUS_BIN(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_GENEROUS_BIN, NautilusGenerousBin))
#define NAUTILUS_GENEROUS_BIN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_GENEROUS_BIN, NautilusGenerousBinClass))
#define NAUTILUS_IS_GENEROUS_BIN(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_GENEROUS_BIN))
#define NAUTILUS_IS_GENEROUS_BIN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_GENEROUS_BIN))
typedef struct NautilusGenerousBin NautilusGenerousBin;
typedef struct NautilusGenerousBinClass NautilusGenerousBinClass;
struct NautilusGenerousBin {
GtkBin parent_slot;
};
struct NautilusGenerousBinClass {
GtkBinClass parent_slot;
};
GtkType nautilus_generous_bin_get_type (void);
#endif /* NAUTILUS_GENEROUS_BIN_H */
......@@ -33,6 +33,9 @@
#include <libgnomeui/gnome-messagebox.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-uidefs.h>
#include "nautilus-string.h"
static void turn_on_line_wrap_flag_callback (GtkWidget *widget, gpointer callback_data);
void
nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
......@@ -255,28 +258,31 @@ static void
turn_on_line_wrap_flag (GtkWidget *widget, const char *message)
{
char *text;
GList *children, *p;
/* Turn on the flag if we find a label with the message
* in it.
*/
if (GTK_IS_LABEL (widget)) {
gtk_label_get (GTK_LABEL (widget), &text);
if (strcmp (text, message) == 0) {
if (nautilus_strcmp (text, message) == 0) {
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
}
}
/* Recurse for children. */
if (GTK_IS_CONTAINER (widget)) {
children = gtk_container_children (GTK_CONTAINER (widget));
for (p = children; p != NULL; p = p->next) {
turn_on_line_wrap_flag (GTK_WIDGET (p->data), message);
}
g_list_free (children);
gtk_container_foreach (GTK_CONTAINER (widget),
turn_on_line_wrap_flag_callback,
(char *) message);
}
}
static void
turn_on_line_wrap_flag_callback (GtkWidget *widget, gpointer callback_data)
{
turn_on_line_wrap_flag (widget, callback_data);
}
/* Shamelessly stolen from gnome-dialog-util.c: */
static GtkWidget *
show_ok_box (const char *message,
......
......@@ -76,8 +76,6 @@ nautilus_SOURCES =\
nautilus-window-manage-views.c \
nautilus-window-manage-views.h \
nautilus-window-private.h \
nautilus-window-state.c \
nautilus-window-state.h \
nautilus-window.c \
nautilus-window.h \
$(NULL)
......
......@@ -27,7 +27,6 @@
#include <config.h>
#include "nautilus-application.h"
#include "nautilus-window-state.h"
#include <libnautilus/libnautilus.h>
#include <bonobo.h>
#include "file-manager/fm-icon-view.h"
......@@ -317,33 +316,54 @@ display_caveat (GtkWindow *parent_window)
gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent_window);
if (parent_window != NULL) {
gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent_window);
}
gtk_widget_show (GTK_WIDGET (dialog));
}
void
nautilus_app_startup (NautilusApp *app,
const char *initial_url,
gboolean handle_desktop)
gboolean manage_desktop,
const char *urls[])
{
const char **p;
NautilusWindow *window;
NautilusWindow *first_window;
if (handle_desktop) {
/* Set up the desktop. */
if (manage_desktop) {
gtk_widget_show (GTK_WIDGET (nautilus_desktop_window_new (app)));
}
/* Set default configuration */
window = nautilus_app_create_window (app);
bonobo_activate ();
nautilus_window_set_initial_state (window, initial_url);
/* Create the other windows. */
first_window = NULL;
if (urls != NULL) {
for (p = urls; *p != NULL; p++) {
window = nautilus_app_create_window (app);
nautilus_window_goto_uri (window, *p);
if (first_window == NULL) {
first_window = window;
}
}
}
if (!manage_desktop && first_window == NULL) {
first_window = nautilus_app_create_window (app);
nautilus_window_go_home (first_window);
}
/* Show the "not ready for prime time" dialog after this
/* Show the "not ready for prime time" dialog after the first
* window appears, so it's on top.
*/
/* FIXME: It's not on top of the other windows. */
if (g_getenv ("NAUTILUS_NO_CAVEAT_DIALOG") == NULL) {
gtk_signal_connect (GTK_OBJECT (window), "show",
display_caveat, window);
if (first_window == NULL) {
display_caveat (NULL);
} else {
gtk_signal_connect (GTK_OBJECT (first_window), "show",
display_caveat, first_window);
}
}
}
......@@ -368,8 +388,8 @@ nautilus_app_create_window (NautilusApp *app)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (gtk_object_new (nautilus_window_get_type(),
"app", BONOBO_OBJECT(app),
window = NAUTILUS_WINDOW (gtk_object_new (nautilus_window_get_type (),
"app", BONOBO_OBJECT (app),
"app_id", "nautilus", NULL));
gtk_signal_connect (GTK_OBJECT (window),
......
......@@ -51,8 +51,8 @@ typedef struct {
GtkType nautilus_app_get_type (void);
GtkObject * nautilus_app_new (void);
void nautilus_app_startup (NautilusApp *app,
const char *initial_url,
gboolean handle_desktop);
gboolean manage_desktop,
const char *urls[]);
NautilusWindow *nautilus_app_create_window (NautilusApp *app);
void nautilus_app_quit (void);
......@@ -60,4 +60,4 @@ void nautilus_app_quit (void);
}
#endif /* __cplusplus */
#endif /* NTL_APP_H */
#endif /* NAUTILUS_APPLICATION_H */
......@@ -26,11 +26,17 @@
#include "nautilus-desktop-window.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libgnomeui/gnome-winhints.h>
struct NautilusDesktopWindowDetails {
GList *unref_list;
};
static void nautilus_desktop_window_initialize_class (NautilusDesktopWindowClass *klass);
static void nautilus_desktop_window_initialize (NautilusDesktopWindow *window);
static void destroy (GtkObject *object);
static void realize (GtkWidget *widget);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusDesktopWindow, nautilus_desktop_window, NAUTILUS_TYPE_WINDOW)
......@@ -38,30 +44,39 @@ NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusDesktopWindow, nautilus_desktop_windo
static void
nautilus_desktop_window_initialize_class (NautilusDesktopWindowClass *klass)
{
GTK_OBJECT_CLASS (klass)->destroy = destroy;
GTK_WIDGET_CLASS (klass)->realize = realize;
}
static void
nautilus_desktop_window_initialize (NautilusDesktopWindow *window)
{
/* FIXME: Although Havoc had this in his code, it seems to
* have no effect for me. But the gdk_window_move_resize
* below does seem to work. Not sure if this should stay
* here or not.
window->details = g_new0 (NautilusDesktopWindowDetails, 1);
/* FIXME: Although Havoc had this call to set_default_size in
* his code, it seems to have no effect for me. But the
* gdk_window_move_resize below does seem to work. Not sure if
* this should stay or not.
*/
gtk_window_set_default_size (GTK_WINDOW (window),
gdk_screen_width (),
gdk_screen_height ());
/* These calls seem to have some effect, but it's not clear if
* they are the right thing to do.
*/
gtk_widget_set_uposition (GTK_WIDGET (window), 0, 0);
gtk_widget_set_usize (GTK_WIDGET (window),
gdk_screen_width (),
gdk_screen_height ());
/* Tell the window manager to never resize this. */
#if 0
/* Tell the window manager to never resize this. This is not
* known to have any specific beneficial effect with any
* particular window manager for the case of the desktop
* window, but it doesn't seem to do any harm.
*/
gtk_window_set_policy (GTK_WINDOW (window),
FALSE, FALSE, FALSE);
#endif
}
NautilusDesktopWindow *
......@@ -88,21 +103,65 @@ nautilus_desktop_window_new (NautilusApp *application)
return window;
}
static void
destroy (GtkObject *object)
{
NautilusDesktopWindow *window;
window = NAUTILUS_DESKTOP_WINDOW (object);
nautilus_gtk_object_list_free (window->details->unref_list);
g_free (window->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
static void
realize (GtkWidget *widget)
{
/* Hide unused pieces of the GnomeApp. */
gtk_widget_hide (GNOME_APP (widget)->menubar);
gtk_widget_hide (GNOME_APP (widget)->dock);
NautilusDesktopWindow *window;
GtkContainer *dock_as_container;
GList *children, *p;
GtkWidget *child;
window = NAUTILUS_DESKTOP_WINDOW (widget);
/* Hide unused pieces of the GnomeApp.
* We don't want a menu bar, toolbars, or status bar on the desktop.
* But we don't want to hide the client area!
*/
gtk_widget_hide (GNOME_APP (window)->menubar);
gtk_widget_hide (GNOME_APP (window)->statusbar);
dock_as_container = GTK_CONTAINER (GNOME_APP (window)->dock);
children = gtk_container_children (dock_as_container);
for (p = children; p != NULL; p = p->next) {
child = p->data;
if (child != gnome_dock_get_client_area (GNOME_DOCK (dock_as_container))) {
gtk_widget_ref (child);
window->details->unref_list = g_list_prepend
(window->details->unref_list, child);
gtk_container_remove (dock_as_container, child);
}
}
g_list_free (children);
/* Do the work of realizing. */
NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, realize, (widget));
/* Set some hints for the window manager. */
/* FIXME: Looking at the gnome_win_hints implementation,