Re: [Nautilus-list] More merge
- From: Alex Larsson <alexl redhat com>
- To: Darin Adler <darin bentspoon com>
- Cc: Nautilus <nautilus-list lists eazel com>
- Subject: Re: [Nautilus-list] More merge
- Date: Mon, 10 Sep 2001 19:24:44 -0400 (EDT)
On Mon, 10 Sep 2001, Darin Adler wrote:
> > + /* Returning NULL from this function oddly enough keeps the current
> > + * mount list. Go figure.
> > + */
>
> I would normally deal with this by renaming get_mount_list and adding a
> comment at the top of the function rather than adding a comment down here.
Looking closer the return NULL doesn't actually work if there is also a
CDDA. I'm fixing this by keeping a list of the last parsed mtab.
> > + if (sb.st_mtime <= last_mtime) {
> > + return NULL;
> > + }
>
> Does this handle rollover of mtime? Does it need to? Can we just use ==
> instead of <=?
Well. It shouldn't rollover until 2037, but i changed it to == anyway. If
the clock does strange things this will help.
> > + /* Recurse to child widget (assumes we already chained up and
> > + * realized child widget)
> > + */
> > + if (GTK_IS_BIN (widget) &&
> > + GTK_BIN (widget)->child) {
> > + /* Ensure we're realized */
> > + gtk_widget_realize (GTK_BIN (widget)->child);
> > +
> > + set_window_background (GTK_BIN (widget)->child,
> > + already_have_root_bg, have_pixel,
> > + pixmap, pixel);
> > + }
>
> Comment doesn't match code here. Comment says we assume that the child is
> realized. Code calls gtk_widget_realize on the child rather than asserting
> it. And the caller calls this before chaining up the map call.
That comment is bogus. Removed it.
> > + /* FIXME the following FIXME is bogus, we aren't mapped yet. */
> > /* FIXME bugzilla.eazel.com 1253:
> > * Looking at the gnome_win_hints implementation,
> > * it looks like you can call these with an unmapped window,
>
> I'd prefer a fix to the FIXME, rather than a FIXME complaining about the
> FIXME.
I just removed it. It was clearly bogus.
> > - if (!position_good) {
> > - if (nautilus_file_is_local (file) && nautilus_file_is_in_desktop
> (file)) {
> > - uri = nautilus_file_get_uri (file);
> > - path = gnome_vfs_get_local_path_from_uri (uri);
> > -
> > - if (path != NULL) {
> > - res = gnome_metadata_get (path, "icon-position", &size,
> &buf);
> > - if (res == 0) {
> > - if (sscanf (buf, "%d%d", &position->x, &position->y) ==
> 2) {
> > - position_good = TRUE;
> > - }
> > - g_free (buf);
> > - }
> > - }
> > - g_free (path);
> > - g_free (uri);
> > - }
> > - }
> > -
>
> We should also remove the code that tries to set the icon-position metadata,
> then, and the includes to get at the metadata calls, too.
Yup.
New patch attached.
/ Alex
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4755
diff -u -p -r1.4755 ChangeLog
--- ChangeLog 2001/09/08 01:19:46 1.4755
+++ ChangeLog 2001/09/10 23:15:11
@@ -1,3 +1,42 @@
+2001-09-05 Alex Larsson <alexl redhat com>
+
+ Merge some stuff from the redhat-outstanding-patches branch
+
+ * eazel-logos/default.xml:
+ * icons/default.xml:
+ don't hardcode the title, title info, and
+ shadow colors; this prevented the auto-color-selection stuff
+ in nautilus-sidebar-title.c from working properly.
+ And the hardcoded values were the same thing the autoselector
+ would have chosen anyhow.
+
+ * libnautilus-private/nautilus-monitor.c:
+ Don't monitor files on read only volumes, they never change, and
+ will keep cdroms from being unmounted because fam has open file
+ descriptors on them.
+
+ * libnautilus-private/nautilus-thumbnails.c:
+ Always look for local thumbnails first.
+
+ * libnautilus-private/nautilus-volume-monitor.[ch]:
+ Add nautilus_volume_is_read_only() and
+ nautilus_volume_monitor_get_volume_for_path()
+
+ * src/nautilus-desktop-window.c:
+ (set_wmspec_desktop_hint): function to set _NET_WM_WINDOW_TYPE, to
+ avoid confusing kwin so badly, and also to go ahead and support
+ the Window Manager Hints Of The Future.
+ (set_gdk_window_background): only set root background to a pixel
+ if we retrieved a pixel property
+ (map): Set background of our child widgets in addition to our
+ own background. This gets rid of the last of the ugliness during
+ Nautilus startup, I believe.
+
+ * src/file-manager/fm-icon-view.c:
+ Don't read GMC position meta data -- it is never right for nautilus,
+ due to different size icons, additional icons, different placement
+ policies, so falling back to normal automatic placement works better.
+
2001-09-07 Darin Adler <darin bentspoon com>
* .cvsignore:
Index: eazel-logos/default.xml
===================================================================
RCS file: /cvs/gnome/nautilus/eazel-logos/default.xml,v
retrieving revision 1.1
diff -u -p -r1.1 default.xml
--- eazel-logos/default.xml 2001/02/27 18:47:13 1.1
+++ eazel-logos/default.xml 2001/09/10 23:15:12
@@ -4,9 +4,6 @@
<sidebar sidebar_background_tile_image="./side_bar_image.png"
sidebar_background_color="rgb:4747/4A4A/7C7C-rgb:2222/2323/3A3A:h"
- title_color="rgb:FFFF/FFFF/FFFF"
- title_info_color="rgb:FFFF/FFFF/FFFF"
- title_shadow_color="rgb:0000/0000/0000"
tab_piece_images="sidebar_tab_pieces" combine="true"
left_offset="0" shadow_offset="1" text_h_offset="-4" label_color="rgb:FFFF/FFFF/FFFF"
tab_font="-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*" />
Index: icons/default.xml
===================================================================
RCS file: /cvs/gnome/nautilus/icons/default.xml,v
retrieving revision 1.22
diff -u -p -r1.22 default.xml
--- icons/default.xml 2001/02/28 06:08:56 1.22
+++ icons/default.xml 2001/09/10 23:15:12
@@ -4,9 +4,6 @@
<sidebar sidebar_background_tile_image="./side_bar_image.png"
sidebar_background_color="rgb:4747/4A4A/7C7C-rgb:2222/2323/3A3A:h"
- title_color="rgb:FFFF/FFFF/FFFF"
- title_info_color="rgb:FFFF/FFFF/FFFF"
- title_shadow_color="rgb:0000/0000/0000"
tab_piece_images="sidebar_tab_pieces" combine="true"
left_offset="0" shadow_offset="1" text_h_offset="-4" label_color="rgb:FFFF/FFFF/FFFF"
tab_font="-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*" />
Index: libnautilus-private/nautilus-monitor.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-monitor.c,v
retrieving revision 1.13
diff -u -p -r1.13 nautilus-monitor.c
--- libnautilus-private/nautilus-monitor.c 2001/07/12 16:07:45 1.13
+++ libnautilus-private/nautilus-monitor.c 2001/09/10 23:15:12
@@ -31,6 +31,7 @@
#ifdef HAVE_LIBFAM
#include "nautilus-file-changes-queue.h"
+#include "nautilus-volume-monitor.h"
#include <fam.h>
#include <gdk/gdk.h>
#include <gmodule.h>
@@ -232,6 +233,17 @@ nautilus_monitor_active (void)
#endif
}
+static gboolean
+path_is_on_readonly_volume (const char *path)
+{
+ NautilusVolumeMonitor *volume_monitor;
+ NautilusVolume *volume;
+
+ volume_monitor = nautilus_volume_monitor_get ();
+ volume = nautilus_volume_monitor_get_volume_for_path (volume_monitor, path);
+ return (volume != NULL) && nautilus_volume_is_read_only (volume);
+}
+
NautilusMonitor *
nautilus_monitor_file (const char *uri)
{
@@ -251,7 +263,16 @@ nautilus_monitor_file (const char *uri)
if (path == NULL) {
return NULL;
}
-
+
+ /* Check to see if the file system is readonly. If so, don't monitor --
+ * there is no point, and we'll just keep the file system busy for
+ * no reason, preventing unmounting
+ */
+ if (path_is_on_readonly_volume (path)) {
+ g_free (path);
+ return NULL;
+ }
+
monitor = g_new0 (NautilusMonitor, 1);
FAMMonitorFile (connection, path, &monitor->request, NULL);
@@ -283,6 +304,15 @@ nautilus_monitor_directory (const char *
return NULL;
}
+ /* Check to see if the file system is readonly. If so, don't monitor --
+ * there is no point, and we'll just keep the file system busy for
+ * no reason, preventing unmounting
+ */
+ if (path_is_on_readonly_volume (path)) {
+ g_free (path);
+ return NULL;
+ }
+
monitor = g_new0 (NautilusMonitor, 1);
FAMMonitorDirectory (connection, path, &monitor->request, NULL);
Index: libnautilus-private/nautilus-thumbnails.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-thumbnails.c,v
retrieving revision 1.28
diff -u -p -r1.28 nautilus-thumbnails.c
--- libnautilus-private/nautilus-thumbnails.c 2001/08/06 17:36:34 1.28
+++ libnautilus-private/nautilus-thumbnails.c 2001/09/10 23:15:12
@@ -94,7 +94,7 @@ uri_is_local (const char *uri)
is_local = gnome_vfs_uri_is_local (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
- return is_local;
+ return is_local;
}
static gboolean
@@ -327,7 +327,7 @@ nautilus_get_thumbnail_uri (NautilusFile
file_uri = nautilus_file_get_uri (file);
- thumbnail_uri = make_thumbnail_uri (file_uri, FALSE, uri_is_local (file_uri), TRUE);
+ thumbnail_uri = make_thumbnail_uri (file_uri, FALSE, TRUE, TRUE);
/* if the thumbnail file already exists locally, simply return the uri */
Index: libnautilus-private/nautilus-volume-monitor.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-volume-monitor.c,v
retrieving revision 1.100
diff -u -p -r1.100 nautilus-volume-monitor.c
--- libnautilus-private/nautilus-volume-monitor.c 2001/09/08 01:18:01 1.100
+++ libnautilus-private/nautilus-volume-monitor.c 2001/09/10 23:15:12
@@ -157,7 +157,9 @@ struct NautilusVolume {
char *device_path;
char *mount_path;
char *volume_name;
-
+ dev_t device;
+
+ gboolean is_read_only;
gboolean is_removable;
gboolean is_audio_cd;
};
@@ -211,6 +213,7 @@ static GList * finish_creating_v
static NautilusVolume *copy_volume (const NautilusVolume *volume);
static void find_volumes (NautilusVolumeMonitor *monitor);
static void free_mount_list (GList *mount_list);
+static GList * copy_mount_list (GList *mount_list);
static GList * get_removable_volumes (NautilusVolumeMonitor *monitor);
static GHashTable * create_readable_mount_point_name_table (void);
static int get_cdrom_type (const char *vol_dev_path,
@@ -419,6 +422,13 @@ nautilus_volume_is_removable (const Naut
return volume->is_removable;
}
+gboolean
+nautilus_volume_is_read_only (const NautilusVolume *volume)
+{
+ return volume->is_read_only;
+}
+
+
/* nautilus_volume_monitor_get_removable_volumes
*
* Accessor. List and internal data is not to be freed.
@@ -430,7 +440,41 @@ nautilus_volume_monitor_get_removable_vo
return monitor->details->removable_volumes;
}
+/**
+ * nautilus_volume_monitor_get_volume_for_path:
+ * @path: a local filesystem path
+ *
+ * Find the volume in which @path resides.
+ *
+ * Return value: a NautilusVolume for @path, or %NULL if the operation
+ * fails, probably because stat() fails on @path.
+ *
+ **/
+NautilusVolume *
+nautilus_volume_monitor_get_volume_for_path (NautilusVolumeMonitor *monitor,
+ const char *path)
+{
+ struct stat statbuf;
+ dev_t device;
+ GList *p;
+ NautilusVolume *volume;
+ if (stat (path, &statbuf) != 0)
+ return NULL;
+
+ device = statbuf.st_dev;
+
+ for (p = monitor->details->mounts; p != NULL; p = p->next) {
+ volume = (NautilusVolume *) p->data;
+
+ if (volume->device == device) {
+ return volume;
+ }
+ }
+
+ return NULL;
+}
+
#if defined (HAVE_GETMNTINFO) || defined (HAVE_MNTENT_H) || defined (SOLARIS_MNT)
static gboolean
@@ -805,7 +849,24 @@ free_mount_list (GList *mount_list)
g_list_free (mount_list);
}
+static GList *
+copy_mount_list (GList *mount_list)
+{
+ GList *new_list = NULL;
+ GList *list = mount_list;
+ NautilusVolume *volume;
+
+ while (list) {
+ volume = list->data;
+ new_list = g_list_prepend (new_list, copy_volume (volume));
+
+ list = list->next;
+ }
+
+ return g_list_reverse (new_list);
+}
+
/* List returned, but not the data it contains, must be freed by caller */
static GList *
build_volume_list_delta (GList *list_one, GList *list_two)
@@ -876,18 +937,43 @@ get_mount_list (NautilusVolumeMonitor *m
#else /* !SOLARIS_MNT */
+static gboolean
+option_list_has_option (const char *optlist,
+ const char *option)
+{
+ gboolean retval = FALSE;
+ char **options;
+ int i;
+
+ options = g_strsplit (optlist, ",", -1);
+
+ for (i = 0; options[i]; i++) {
+ if (!strcmp (options[i], option)) {
+ retval = TRUE;
+ break;
+ }
+ }
+
+ g_strfreev (options);
+
+ return retval;
+}
+
static GList *
get_mount_list (NautilusVolumeMonitor *monitor)
{
GList *volumes;
NautilusVolume *volume;
+ static time_t last_mtime = 0;
static FILE *fh = NULL;
+ static GList *saved_list = NULL;
const char *file_name;
const char *separator;
char line[PATH_MAX * 3];
char device_name[sizeof (line)];
EelStringList *list;
char *device_path, *mount_path, *file_system_type_name;
+ struct stat sb;
volumes = NULL;
@@ -898,14 +984,29 @@ get_mount_list (NautilusVolumeMonitor *m
file_name = "/proc/mounts";
separator = " ";
}
+
+ /* /proc/mounts mtime never changes, so stat /etc/mtab.
+ * Isn't this lame?
+ */
+ if (stat ("/etc/mtab", &sb) < 0) {
+ g_warning ("Unable to stat %s: %s", file_name,
+ g_strerror (errno));
+ return NULL;
+ }
+ if (sb.st_mtime == last_mtime) {
+ return copy_mount_list (saved_list);
+ }
+
+ last_mtime = sb.st_mtime;
+
if (fh == NULL) {
fh = fopen (file_name, "r");
if (fh == NULL) {
g_warning ("Unable to open %s: %s", file_name, strerror (errno));
return NULL;
}
- } else {
+ } else {
rewind (fh);
}
@@ -927,8 +1028,12 @@ get_mount_list (NautilusVolumeMonitor *m
mount_path = eel_string_list_nth (list, 1);
file_system_type_name = eel_string_list_nth (list, 2);
volume = create_volume (device_path, mount_path);
+ if (eel_string_list_get_length (list) >= 4 &&
+ option_list_has_option (eel_string_list_nth (list, 3), MNTOPT_RO))
+ volume->is_read_only = TRUE;
volumes = finish_creating_volume_and_prepend
(monitor, volume, file_system_type_name, volumes);
+
g_free (device_path);
g_free (mount_path);
g_free (file_system_type_name);
@@ -936,8 +1041,11 @@ get_mount_list (NautilusVolumeMonitor *m
eel_string_list_free (list);
}
-
- return volumes;
+
+ free_mount_list (saved_list);
+ saved_list = volumes;
+
+ return copy_mount_list (volumes);
}
#endif /* !SOLARIS_MNT */
@@ -1508,7 +1616,8 @@ copy_volume (const NautilusVolume *volum
new_volume->device_path = g_strdup (volume->device_path);
new_volume->mount_path = g_strdup (volume->mount_path);
new_volume->volume_name = g_strdup (volume->volume_name);
-
+ new_volume->device = volume->device;
+
new_volume->is_removable = volume->is_removable;
new_volume->is_audio_cd = volume->is_audio_cd;
@@ -1563,6 +1672,7 @@ finish_creating_volume (NautilusVolumeMo
{
gboolean ok;
const char *name;
+ struct stat statbuf;
volume->file_system_type = g_hash_table_lookup
(monitor->details->file_system_table, file_system_type_name);
@@ -1581,6 +1691,10 @@ finish_creating_volume (NautilusVolumeMo
if (!ok) {
return FALSE;
+ }
+
+ if (stat (volume->mount_path, &statbuf) == 0) {
+ volume->device = statbuf.st_dev;
}
/* Identify device type */
Index: libnautilus-private/nautilus-volume-monitor.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-volume-monitor.h,v
retrieving revision 1.34
diff -u -p -r1.34 nautilus-volume-monitor.h
--- libnautilus-private/nautilus-volume-monitor.h 2001/08/15 21:03:59 1.34
+++ libnautilus-private/nautilus-volume-monitor.h 2001/09/10 23:15:12
@@ -87,11 +87,14 @@ char * nautilus_volume
void nautilus_volume_monitor_set_volume_name (NautilusVolumeMonitor *monitor,
const NautilusVolume *volume,
const char *volume_name);
+NautilusVolume *nautilus_volume_monitor_get_volume_for_path (NautilusVolumeMonitor *monitor,
+ const char *path);
/* Volume operations. */
char * nautilus_volume_get_name (const NautilusVolume *volume);
NautilusDeviceType nautilus_volume_get_device_type (const NautilusVolume *volume);
gboolean nautilus_volume_is_removable (const NautilusVolume *volume);
+gboolean nautilus_volume_is_read_only (const NautilusVolume *volume);
gboolean nautilus_volume_should_integrate_trash (const NautilusVolume *volume);
const char * nautilus_volume_get_mount_path (const NautilusVolume *volume);
char * nautilus_volume_get_target_uri (const NautilusVolume *volume);
Index: src/nautilus-desktop-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-desktop-window.c,v
retrieving revision 1.38
diff -u -p -r1.38 nautilus-desktop-window.c
--- src/nautilus-desktop-window.c 2001/07/10 23:55:17 1.38
+++ src/nautilus-desktop-window.c 2001/09/10 23:15:12
@@ -39,6 +39,7 @@
#include <libnautilus-private/nautilus-link.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
+#include <gtk/gtklayout.h>
struct NautilusDesktopWindowDetails {
GList *unref_list;
@@ -48,8 +49,12 @@ static void nautilus_desktop_window_init
static void nautilus_desktop_window_initialize (NautilusDesktopWindow *window);
static void destroy (GtkObject *object);
static void realize (GtkWidget *widget);
+static void map (GtkWidget *widget);
static void real_add_current_location_to_history_list (NautilusWindow *window);
+
+static void set_wmspec_desktop_hint (GdkWindow *window);
+
EEL_DEFINE_CLASS_BOILERPLATE (NautilusDesktopWindow, nautilus_desktop_window, NAUTILUS_TYPE_WINDOW)
static void
@@ -57,6 +62,7 @@ nautilus_desktop_window_initialize_class
{
GTK_OBJECT_CLASS (klass)->destroy = destroy;
GTK_WIDGET_CLASS (klass)->realize = realize;
+ GTK_WIDGET_CLASS (klass)->map = map;
NAUTILUS_WINDOW_CLASS (klass)->add_current_location_to_history_list
= real_add_current_location_to_history_list;
}
@@ -170,16 +176,114 @@ destroy (GtkObject *object)
}
static void
-realize (GtkWidget *widget)
+set_gdk_window_background (GdkWindow *window,
+ gboolean have_pixel,
+ Pixmap pixmap,
+ gulong pixel)
{
- NautilusDesktopWindow *window;
+ Window w;
+
+ w = GDK_WINDOW_XWINDOW (window);
+
+ if (pixmap != None) {
+ XSetWindowBackgroundPixmap (GDK_DISPLAY (), w,
+ pixmap);
+ } else if (have_pixel) {
+ XSetWindowBackground (GDK_DISPLAY (), w,
+ pixel);
+ } else {
+ XSetWindowBackgroundPixmap (GDK_DISPLAY (), w,
+ None);
+ }
+}
+
+static void
+set_window_background (GtkWidget *widget,
+ gboolean already_have_root_bg,
+ gboolean have_pixel,
+ Pixmap pixmap,
+ gulong pixel)
+{
GdkAtom type;
gulong nitems, bytes_after;
gint format;
guchar *data;
- gboolean have_set_background;
- Window w;
+
+ /* Set the background to show the root window to avoid a flash that
+ * would otherwise occur.
+ */
+
+ if (GTK_IS_WINDOW (widget)) {
+ gtk_widget_set_app_paintable (widget, TRUE);
+ }
+
+ if (!already_have_root_bg) {
+ have_pixel = FALSE;
+ already_have_root_bg = TRUE;
+
+ /* We want to do this round-trip-to-server work only
+ * for the first invocation, not on recursions
+ */
+
+ XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
+ gdk_atom_intern ("_XROOTPMAP_ID", FALSE),
+ 0L, 1L, False, XA_PIXMAP,
+ &type, &format, &nitems, &bytes_after,
+ &data);
+
+ if (type == XA_PIXMAP) {
+ if (format == 32 && nitems == 1 && bytes_after == 0) {
+ pixmap = *(Pixmap *) data;
+ }
+
+ XFree (data);
+ }
+ if (pixmap == None) {
+ XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
+ gdk_atom_intern ("_XROOTCOLOR_PIXEL", FALSE),
+ 0L, 1L, False, AnyPropertyType,
+ &type, &format, &nitems, &bytes_after,
+ &data);
+
+ if (type != None) {
+ if (format == 32 && nitems == 1 && bytes_after == 0) {
+ pixel = *(gulong *) data;
+ have_pixel = TRUE;
+ }
+
+ XFree (data);
+ }
+ }
+ }
+
+ set_gdk_window_background (widget->window,
+ have_pixel, pixmap, pixel);
+
+ if (GTK_IS_BIN (widget) &&
+ GTK_BIN (widget)->child) {
+ /* Ensure we're realized */
+ gtk_widget_realize (GTK_BIN (widget)->child);
+
+ set_window_background (GTK_BIN (widget)->child,
+ already_have_root_bg, have_pixel,
+ pixmap, pixel);
+ }
+
+ /* For both parent and child, if it's a layout then set on the
+ * bin window as well.
+ */
+ if (GTK_IS_LAYOUT (widget))
+ set_gdk_window_background (GTK_LAYOUT (widget)->bin_window,
+ have_pixel,
+ pixmap, pixel);
+}
+
+static void
+realize (GtkWidget *widget)
+{
+ NautilusDesktopWindow *window;
+
window = NAUTILUS_DESKTOP_WINDOW (widget);
/* Make sure we get keyboard events */
@@ -188,18 +292,15 @@ realize (GtkWidget *widget)
/* Do the work of realizing. */
EEL_CALL_PARENT (GTK_WIDGET_CLASS, realize, (widget));
-
- /* FIXME bugzilla.eazel.com 1253:
- * Looking at the gnome_win_hints implementation,
- * it looks like you can call these with an unmapped window,
- * but when I tried doing it in initialize it didn't work.
- * We'd like to set these earlier so the window doesn't show
- * up in front of everything before going to the back.
- */
+ /* This is the new way to set up the desktop window */
+ set_wmspec_desktop_hint (widget->window);
+
+ /* FIXME all this gnome_win_hints stuff is legacy cruft */
+
/* Put this window behind all the others. */
gnome_win_hints_set_layer (widget, WIN_LAYER_DESKTOP);
-
+
/* Make things like the task list ignore this window and make
* it clear that it it's at its full size.
*
@@ -232,56 +333,6 @@ realize (GtkWidget *widget)
gdk_screen_width (),
gdk_screen_height ());
- /* Set the background to show the root window to avoid a flash that
- * would otherwise occur.
- */
- have_set_background = FALSE;
-
- gtk_widget_set_app_paintable (widget, TRUE);
- w = GDK_WINDOW_XWINDOW (widget->window);
- XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
- gdk_atom_intern ("_XROOTPMAP_ID", FALSE),
- 0L, 1L, False, XA_PIXMAP,
- &type, &format, &nitems, &bytes_after,
- &data);
-
- if (type == XA_PIXMAP) {
- if (format == 32 && nitems == 1 && bytes_after == 0) {
- gdk_error_trap_push ();
- XSetWindowBackgroundPixmap (GDK_DISPLAY (), w,
- *(Pixmap *)data);
- gdk_flush ();
- if (!gdk_error_trap_pop ())
- have_set_background = TRUE;
- }
-
- XFree (data);
- }
-
- if (!have_set_background) {
- XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
- gdk_atom_intern ("_XROOTCOLOR_PIXEL", FALSE),
- 0L, 1L, False, AnyPropertyType,
- &type, &format, &nitems, &bytes_after,
- &data);
-
- if (type != None) {
- if (format == 32 && nitems == 1 && bytes_after == 0) {
- XSetWindowBackground (GDK_DISPLAY (), w,
- *(gulong *)data);
- have_set_background = TRUE;
- }
-
- XFree (data);
- }
- }
-
- if (!have_set_background) {
- XSetWindowBackgroundPixmap (GDK_DISPLAY (), w,
- None);
- }
-
-
/* Get rid of the things that window managers add to resize
* and otherwise manipulate the window.
*/
@@ -290,9 +341,40 @@ realize (GtkWidget *widget)
}
static void
+map (GtkWidget *widget)
+{
+ NautilusDesktopWindow *window;
+
+ window = NAUTILUS_DESKTOP_WINDOW (widget);
+
+ set_window_background (widget, FALSE, FALSE, None, 0);
+
+ /* Chain up to realize our children */
+ EEL_CALL_PARENT (GTK_WIDGET_CLASS, map, (widget));
+}
+
+static void
real_add_current_location_to_history_list (NautilusWindow *window)
{
/* Do nothing. The desktop window's location should not
* show up in the history list.
*/
+}
+
+static void
+set_wmspec_desktop_hint (GdkWindow *window)
+{
+ Atom atom;
+
+ atom = XInternAtom (gdk_display,
+ "_NET_WM_WINDOW_TYPE_DESKTOP",
+ False);
+
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (window),
+ XInternAtom (gdk_display,
+ "_NET_WM_WINDOW_TYPE",
+ False),
+ XA_ATOM, 32, PropModeReplace,
+ (guchar *)&atom, 1);
}
Index: src/file-manager/fm-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-view.c,v
retrieving revision 1.210
diff -u -p -r1.210 fm-icon-view.c
--- src/file-manager/fm-icon-view.c 2001/09/04 21:16:09 1.210
+++ src/file-manager/fm-icon-view.c 2001/09/10 23:15:13
@@ -47,7 +47,6 @@
#include <gtk/gtkwindow.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-config.h>
-#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-mime.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
@@ -283,9 +282,6 @@ get_stored_icon_position_callback (Nauti
char *position_string, *scale_string;
gboolean position_good, scale_good;
char *locale;
- char *path, *uri;
- int res, size;
- char *buf;
g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (NAUTILUS_IS_FILE (file));
@@ -310,25 +306,6 @@ get_stored_icon_position_callback (Nauti
/* If it is the desktop directory, maybe the gnome-libs metadata has information about it */
- if (!position_good) {
- if (nautilus_file_is_local (file) && nautilus_file_is_in_desktop (file)) {
- uri = nautilus_file_get_uri (file);
- path = gnome_vfs_get_local_path_from_uri (uri);
-
- if (path != NULL) {
- res = gnome_metadata_get (path, "icon-position", &size, &buf);
- if (res == 0) {
- if (sscanf (buf, "%d%d", &position->x, &position->y) == 2) {
- position_good = TRUE;
- }
- g_free (buf);
- }
- }
- g_free (path);
- g_free (uri);
- }
- }
-
/* Get the scale of the icon from the metadata. */
scale_string = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_ICON_SCALE, "1");
@@ -1850,8 +1827,6 @@ icon_position_changed_callback (Nautilus
char *position_string;
char *scale_string, *scale_string_x, *scale_string_y;
char *locale;
- char *uri, *path;
- char buf [128];
g_assert (FM_IS_ICON_VIEW (icon_view));
g_assert (container == get_icon_container (icon_view));
@@ -1886,19 +1861,6 @@ icon_position_changed_callback (Nautilus
(file, NAUTILUS_METADATA_KEY_ICON_POSITION,
NULL, position_string);
g_free (position_string);
-
- if (nautilus_file_is_local (file) && nautilus_file_is_in_desktop (file)) {
- uri = nautilus_file_get_uri (file);
- path = gnome_vfs_get_local_path_from_uri (uri);
-
- if (path != NULL) {
- g_snprintf (buf, sizeof (buf), "%d %d", position->x, position->y);
- gnome_metadata_set (path, "icon-position", strlen (buf) + 1, buf);
- }
-
- g_free (uri);
- g_free (path);
- }
}
/* FIXME bugzilla.eazel.com 662:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]