summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2000-04-14 15:16:44 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2000-04-14 15:16:44 +0000
commit09b3bf22bcc73939e5f0e82c4fd2c193be2428b1 (patch)
treea860daeed4bf01bf983cadb46fe18c6972ac9b72
parentdd08346bb81da58d03549b5f303e366b63aeee19 (diff)
downloadnautilus-09b3bf22bcc73939e5f0e82c4fd2c193be2428b1.tar.gz
Split libnautilus into two pieces.
libnautilus now only contains the view interfaces needed by nautilus components. These are the interfaces defined in nautilus-view-component.idl. libnautilus-extensions containes the remainder of the stuff. Also used the cvs repository munging opportunity to do some of the ntl-* renaming outlined in the RENAIMING file.
-rw-r--r--ChangeLog180
-rw-r--r--Makefile.am1
-rw-r--r--components/history/Makefile.am1
-rw-r--r--components/history/nautilus-history-view.c4
-rw-r--r--components/history/ntl-history-view.c4
-rw-r--r--components/html/Makefile.am1
-rw-r--r--components/html/ntl-web-browser.c2
-rw-r--r--components/music/Makefile.am1
-rw-r--r--components/music/nautilus-music-view.c16
-rw-r--r--components/music/nautilus-music-view.h2
-rw-r--r--components/notes/Makefile.am1
-rw-r--r--components/notes/nautilus-notes.c8
-rw-r--r--components/notes/ntl-notes.c8
-rw-r--r--components/rpmview/Makefile.am1
-rw-r--r--components/rpmview/nautilus-rpm-view.c14
-rw-r--r--components/rpmview/nautilus-rpm-view.h2
-rw-r--r--components/sample/Makefile.am1
-rw-r--r--components/sample/nautilus-sample-content-view.c2
-rw-r--r--components/sample/nautilus-sample-content-view.h2
-rw-r--r--components/services/startup/Makefile.am1
-rw-r--r--components/services/startup/eazel-register.c2
-rw-r--r--components/services/startup/nautilus-service-startup-view.c12
-rw-r--r--components/services/startup/nautilus-service-startup-view.h2
-rw-r--r--configure.in1
-rw-r--r--libnautilus-extensions/Makefile.am33
-rw-r--r--libnautilus-extensions/libnautilus-extensions.h (renamed from libnautilus-extensions/libnautilus.h)12
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.c2
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.h2
-rw-r--r--libnautilus-extensions/nautilus-icon-factory.h2
-rw-r--r--libnautilus-extensions/nautilus-preferences-box.c2
-rw-r--r--libnautilus-extensions/nautilus-preferences-dialog.c2
-rw-r--r--libnautilus-extensions/nautilus-preferences-group.c2
-rw-r--r--libnautilus-extensions/nautilus-preferences-item.c2
-rw-r--r--libnautilus-extensions/nautilus-preferences-pane.c2
-rw-r--r--libnautilus-extensions/nautilus-preferences.c2
-rw-r--r--libnautilus-extensions/nautilus-radio-button-group.c2
-rw-r--r--libnautilus-extensions/nautilus-zoomable.c491
-rw-r--r--libnautilus-extensions/nautilus-zoomable.h86
-rw-r--r--libnautilus-private/Makefile.am33
-rw-r--r--libnautilus-private/libnautilus-extensions.h (renamed from libnautilus-private/libnautilus.h)12
-rw-r--r--libnautilus-private/nautilus-global-preferences.c2
-rw-r--r--libnautilus-private/nautilus-global-preferences.h2
-rw-r--r--libnautilus-private/nautilus-icon-factory.h2
-rw-r--r--libnautilus-private/nautilus-preferences-box.c2
-rw-r--r--libnautilus-private/nautilus-preferences-dialog.c2
-rw-r--r--libnautilus-private/nautilus-preferences-group.c2
-rw-r--r--libnautilus-private/nautilus-preferences-item.c2
-rw-r--r--libnautilus-private/nautilus-preferences-pane.c2
-rw-r--r--libnautilus-private/nautilus-preferences.c2
-rw-r--r--libnautilus-private/nautilus-radio-button-group.c2
-rw-r--r--libnautilus-private/nautilus-zoomable.c491
-rw-r--r--libnautilus-private/nautilus-zoomable.h86
-rw-r--r--libnautilus/.cvsignore5
-rw-r--r--libnautilus/Makefile.am84
-rw-r--r--libnautilus/bonobo-stream-vfs.c395
-rw-r--r--libnautilus/bonobo-stream-vfs.h70
-rw-r--r--libnautilus/gtkscrollframe.c1224
-rw-r--r--libnautilus/gtkscrollframe.h94
-rw-r--r--libnautilus/libnautilus.h8
-rw-r--r--libnautilus/nautilus-alloc.h31
-rw-r--r--libnautilus/nautilus-background-canvas-group.c117
-rw-r--r--libnautilus/nautilus-background-canvas-group.h60
-rw-r--r--libnautilus/nautilus-background.c542
-rw-r--r--libnautilus/nautilus-background.h110
-rw-r--r--libnautilus/nautilus-bonobo-extensions.c55
-rw-r--r--libnautilus/nautilus-bonobo-extensions.h37
-rw-r--r--libnautilus/nautilus-bookmark.c344
-rw-r--r--libnautilus/nautilus-bookmark.h83
-rw-r--r--libnautilus/nautilus-content-view-frame.c6
-rw-r--r--libnautilus/nautilus-content-view-frame.h8
-rw-r--r--libnautilus/nautilus-debug.c85
-rw-r--r--libnautilus/nautilus-debug.h31
-rw-r--r--libnautilus/nautilus-default-file-icon.c607
-rw-r--r--libnautilus/nautilus-default-file-icon.h32
-rw-r--r--libnautilus/nautilus-directory-background.c179
-rw-r--r--libnautilus/nautilus-directory-background.h33
-rw-r--r--libnautilus/nautilus-directory-private.h104
-rw-r--r--libnautilus/nautilus-directory.c1693
-rw-r--r--libnautilus/nautilus-directory.h177
-rw-r--r--libnautilus/nautilus-file-private.h37
-rw-r--r--libnautilus/nautilus-file-utilities.c172
-rw-r--r--libnautilus/nautilus-file-utilities.h35
-rw-r--r--libnautilus/nautilus-file.c1663
-rw-r--r--libnautilus/nautilus-file.h172
-rw-r--r--libnautilus/nautilus-gdk-extensions.c617
-rw-r--r--libnautilus/nautilus-gdk-extensions.h101
-rw-r--r--libnautilus/nautilus-gdk-pixbuf-extensions.c317
-rw-r--r--libnautilus/nautilus-gdk-pixbuf-extensions.h59
-rw-r--r--libnautilus/nautilus-glib-extensions.c204
-rw-r--r--libnautilus/nautilus-glib-extensions.h53
-rw-r--r--libnautilus/nautilus-global-preferences.c382
-rw-r--r--libnautilus/nautilus-global-preferences.h68
-rw-r--r--libnautilus/nautilus-gnome-extensions.c180
-rw-r--r--libnautilus/nautilus-gnome-extensions.h77
-rw-r--r--libnautilus/nautilus-graphic-effects.c268
-rw-r--r--libnautilus/nautilus-graphic-effects.h48
-rw-r--r--libnautilus/nautilus-gtk-extensions.c422
-rw-r--r--libnautilus/nautilus-gtk-extensions.h118
-rw-r--r--libnautilus/nautilus-gtk-macros.h156
-rw-r--r--libnautilus/nautilus-icon-canvas-item.c1343
-rw-r--r--libnautilus/nautilus-icon-canvas-item.h87
-rw-r--r--libnautilus/nautilus-icon-container.c2884
-rw-r--r--libnautilus/nautilus-icon-container.h141
-rw-r--r--libnautilus/nautilus-icon-dnd.c1407
-rw-r--r--libnautilus/nautilus-icon-dnd.h87
-rw-r--r--libnautilus/nautilus-icon-factory.c1854
-rw-r--r--libnautilus/nautilus-icon-factory.h145
-rw-r--r--libnautilus/nautilus-icon-grid.c429
-rw-r--r--libnautilus/nautilus-icon-grid.h47
-rw-r--r--libnautilus/nautilus-icon-private.h179
-rw-r--r--libnautilus/nautilus-lib-self-check-functions.c37
-rw-r--r--libnautilus/nautilus-lib-self-check-functions.h54
-rw-r--r--libnautilus/nautilus-list-column-title.c862
-rw-r--r--libnautilus/nautilus-list-column-title.h73
-rw-r--r--libnautilus/nautilus-list.c2306
-rw-r--r--libnautilus/nautilus-list.h132
-rw-r--r--libnautilus/nautilus-meta-view-frame.c6
-rw-r--r--libnautilus/nautilus-meta-view-frame.h8
-rw-r--r--libnautilus/nautilus-metadata.h56
-rw-r--r--libnautilus/nautilus-mime-type.c127
-rw-r--r--libnautilus/nautilus-mime-type.h37
-rw-r--r--libnautilus/nautilus-self-checks.c137
-rw-r--r--libnautilus/nautilus-self-checks.h62
-rw-r--r--libnautilus/nautilus-string-list.c340
-rw-r--r--libnautilus/nautilus-string-list.h70
-rw-r--r--libnautilus/nautilus-string.c393
-rw-r--r--libnautilus/nautilus-string.h66
-rw-r--r--libnautilus/nautilus-view-frame-private.h4
-rw-r--r--libnautilus/nautilus-view-frame.c6
-rw-r--r--libnautilus/nautilus-view-frame.h8
-rw-r--r--libnautilus/nautilus-view.c6
-rw-r--r--libnautilus/nautilus-view.h8
-rw-r--r--libnautilus/nautilus-xml-extensions.c85
-rw-r--r--libnautilus/nautilus-xml-extensions.h41
-rw-r--r--libnautilus/nautilus-zoomable.c2
-rw-r--r--libnautilus/ntl-content-view-frame.c135
-rw-r--r--libnautilus/ntl-content-view-frame.h59
-rw-r--r--libnautilus/ntl-meta-view-frame.c180
-rw-r--r--libnautilus/ntl-meta-view-frame.h60
-rw-r--r--libnautilus/ntl-view-frame.c505
-rw-r--r--libnautilus/ntl-view-frame.h93
-rw-r--r--nautilus-widgets/nautilus-preferences-box.c2
-rw-r--r--nautilus-widgets/nautilus-preferences-dialog.c2
-rw-r--r--nautilus-widgets/nautilus-preferences-group.c2
-rw-r--r--nautilus-widgets/nautilus-preferences-item.c2
-rw-r--r--nautilus-widgets/nautilus-preferences-pane.c2
-rw-r--r--nautilus-widgets/nautilus-preferences.c2
-rw-r--r--nautilus-widgets/nautilus-radio-button-group.c2
-rw-r--r--po/ChangeLog5
-rw-r--r--po/POTFILES.in6
-rw-r--r--src/Makefile.am1
-rw-r--r--src/file-manager/fm-directory-view.c18
-rw-r--r--src/file-manager/fm-directory-view.h8
-rw-r--r--src/file-manager/fm-icon-text-window.c4
-rw-r--r--src/file-manager/fm-icon-view.c18
-rw-r--r--src/file-manager/fm-list-view.c10
-rw-r--r--src/file-manager/fm-properties-window.c6
-rw-r--r--src/file-manager/fm-properties-window.h2
-rw-r--r--src/nautilus-applicable-views.c8
-rw-r--r--src/nautilus-applicable-views.h2
-rw-r--r--src/nautilus-application.c2
-rw-r--r--src/nautilus-bookmark-list.c8
-rw-r--r--src/nautilus-bookmark-list.h2
-rw-r--r--src/nautilus-bookmarks-window.c2
-rw-r--r--src/nautilus-index-tabs.c2
-rw-r--r--src/nautilus-index-title.c12
-rw-r--r--src/nautilus-information-panel.c18
-rw-r--r--src/nautilus-location-bar.c6
-rw-r--r--src/nautilus-main.c6
-rw-r--r--src/nautilus-navigation-window-menus.c12
-rw-r--r--src/nautilus-navigation-window.c6
-rw-r--r--src/nautilus-navigation-window.h2
-rw-r--r--src/nautilus-object-window.c6
-rw-r--r--src/nautilus-object-window.h2
-rw-r--r--src/nautilus-sidebar-tabs.c2
-rw-r--r--src/nautilus-sidebar-title.c12
-rw-r--r--src/nautilus-sidebar.c18
-rw-r--r--src/nautilus-signaller.c2
-rw-r--r--src/nautilus-spatial-window.c6
-rw-r--r--src/nautilus-spatial-window.h2
-rw-r--r--src/nautilus-view-frame-bonobo-embeddable.c2
-rw-r--r--src/nautilus-view-frame.c2
-rw-r--r--src/nautilus-window-manage-views.c6
-rw-r--r--src/nautilus-window-menus.c12
-rw-r--r--src/nautilus-window-state.c4
-rw-r--r--src/nautilus-window-toolbars.c4
-rw-r--r--src/nautilus-window.c6
-rw-r--r--src/nautilus-window.h2
-rw-r--r--src/nautilus-zoom-control.c4
-rw-r--r--src/ntl-app.c2
-rw-r--r--src/ntl-index-panel.c18
-rw-r--r--src/ntl-main.c6
-rw-r--r--src/ntl-meta-view.c2
-rw-r--r--src/ntl-uri-map.c8
-rw-r--r--src/ntl-uri-map.h2
-rw-r--r--src/ntl-view-bonobo-subdoc.c2
-rw-r--r--src/ntl-view.c2
-rw-r--r--src/ntl-window-msgs.c6
-rw-r--r--src/ntl-window-state.c4
-rw-r--r--src/ntl-window.c6
-rw-r--r--src/ntl-window.h2
201 files changed, 487 insertions, 27322 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d7d1f74e..f9cce74f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,183 @@
+2000-04-14 Ramiro Estrugo <ramiro@eazel.com>
+
+ Split libnautilus into two pieces.
+
+ libnautilus now only contains the view interfaces needed by nautilus
+ components.
+
+ These are the interfaces defined in nautilus-view-component.idl.
+
+ libnautilus-extensions containes the remainder of the stuff.
+
+ Also used the cvs repository munging opportunity to do some of the
+ ntl-* renaming outlined in the RENAIMING file.
+
+ * libnautilus/bonobo-stream-vfs.c
+ libnautilus/bonobo-stream-vfs.h,
+ libnautilus/gtkscrollframe.c,
+ libnautilus/gtkscrollframe.h,
+ libnautilus/nautilus-alloc.h,
+ libnautilus/nautilus-background-canvas-group.c,
+ libnautilus/nautilus-background-canvas-group.h,
+ libnautilus/nautilus-background.c,
+ libnautilus/nautilus-background.h,
+ libnautilus/nautilus-bonobo-extensions.c,
+ libnautilus/nautilus-bonobo-extensions.h,
+ libnautilus/nautilus-bookmark.c,
+ libnautilus/nautilus-bookmark.h,
+ libnautilus/nautilus-debug.c,
+ libnautilus/nautilus-debug.h,
+ libnautilus/nautilus-default-file-icon.c,
+ libnautilus/nautilus-default-file-icon.h,
+ libnautilus/nautilus-directory-background.c,
+ libnautilus/nautilus-directory-background.h,
+ libnautilus/nautilus-directory-private.h,
+ libnautilus/nautilus-directory.c,
+ libnautilus/nautilus-directory.h,
+ libnautilus/nautilus-file-private.h,
+ libnautilus/nautilus-file-utilities.c,
+ libnautilus/nautilus-file-utilities.h,
+ libnautilus/nautilus-file.c,
+ libnautilus/nautilus-file.h,
+ libnautilus/nautilus-gdk-extensions.c,
+ libnautilus/nautilus-gdk-extensions.h,
+ libnautilus/nautilus-gdk-pixbuf-extensions.c,
+ libnautilus/nautilus-gdk-pixbuf-extensions.h,
+ libnautilus/nautilus-glib-extensions.c,
+ libnautilus/nautilus-glib-extensions.h,
+ libnautilus/nautilus-global-preferences.c,
+ libnautilus/nautilus-global-preferences.h,
+ libnautilus/nautilus-gnome-extensions.c,
+ libnautilus/nautilus-gnome-extensions.h,
+ libnautilus/nautilus-graphic-effects.c,
+ libnautilus/nautilus-graphic-effects.h,
+ libnautilus/nautilus-gtk-extensions.c,
+ libnautilus/nautilus-gtk-extensions.h,
+ libnautilus/nautilus-gtk-macros.h,
+ libnautilus/nautilus-icon-canvas-item.c,
+ libnautilus/nautilus-icon-canvas-item.h,
+ libnautilus/nautilus-icon-container.c,
+ libnautilus/nautilus-icon-container.h,
+ libnautilus/nautilus-icon-dnd.c,
+ libnautilus/nautilus-icon-dnd.h,
+ libnautilus/nautilus-icon-factory.c,
+ libnautilus/nautilus-icon-factory.h,
+ libnautilus/nautilus-icon-grid.c,
+ libnautilus/nautilus-icon-grid.h,
+ libnautilus/nautilus-icon-private.h,
+ libnautilus/nautilus-lib-self-check-functions.c,
+ libnautilus/nautilus-lib-self-check-functions.h,
+ libnautilus/nautilus-list-column-title.c,
+ libnautilus/nautilus-list-column-title.h,
+ libnautilus/nautilus-list.c,
+ libnautilus/nautilus-list.h,
+ libnautilus/nautilus-metadata.h,
+ libnautilus/nautilus-mime-type.c,
+ libnautilus/nautilus-mime-type.h,
+ libnautilus/nautilus-self-checks.c,
+ libnautilus/nautilus-self-checks.h,
+ libnautilus/nautilus-string-list.c,
+ libnautilus/nautilus-string-list.h,
+ libnautilus/nautilus-string.c,
+ libnautilus/nautilus-string.h,
+ libnautilus/nautilus-xml-extensions.c,
+ libnautilus/nautilus-xml-extensions.h: moved to
+ libnautilus-extensions.
+
+ libnautilus/ntl-content-view-frame.c,
+ libnautilus/ntl-content-view-frame.h,
+ libnautilus/ntl-meta-view-frame.c,
+ libnautilus/ntl-meta-view-frame.h,
+ libnautilus/ntl-view-frame.c,
+ libnautilus/ntl-view-frame.h: moved to
+ libnautilus-extensions and renamed from "ntl-*" to "nautilus-*"
+
+ * Makefile.am,
+ configure.in: added libnautilus-extensions to the build.
+
+ * libnautilus/.cvsignore,
+ libnautilus/Makefile.am,
+ libnautilus/libnautilus.h,
+ libnautilus/nautilus-content-view-frame.c,
+ libnautilus/nautilus-content-view-frame.h,
+ libnautilus/nautilus-meta-view-frame.c,
+ libnautilus/nautilus-meta-view-frame.h,
+ libnautilus/nautilus-view-frame-private.h,
+ libnautilus/nautilus-view-frame.c,
+ libnautilus/nautilus-view-frame.h,
+ libnautilus/nautilus-zoomable.c: Updated for libnautilus ->
+ libnautilus-extensions changes.
+
+ * libnautilus-extensions/Makefile.am,
+ libnautilus-extensions/nautilus-global-preferences.c,
+ libnautilus-extensions/nautilus-global-preferences.h,
+ libnautilus-extensions/nautilus-icon-factory.h: Updated for libnautilus ->
+ libnautilus-extensions changes.
+
+ * nautilus-widgets/nautilus-preferences-box.c,
+ nautilus-widgets/nautilus-preferences-dialog.c,
+ nautilus-widgets/nautilus-preferences-group.c,
+ nautilus-widgets/nautilus-preferences-item.c,
+ nautilus-widgets/nautilus-preferences-pane.c,
+ nautilus-widgets/nautilus-preferences.c,
+ nautilus-widgets/nautilus-radio-button-group.c: Updated for libnautilus ->
+ libnautilus-extensions changes.
+
+ * src/Makefile.am,
+ src/nautilus-bookmark-list.c,
+ src/nautilus-bookmark-list.h,
+ src/nautilus-bookmarks-window.c,
+ src/nautilus-index-tabs.c,
+ src/nautilus-index-title.c,
+ src/nautilus-location-bar.c,
+ src/nautilus-signaller.c,
+ src/nautilus-window-menus.c,
+ src/nautilus-window-toolbars.c,
+ src/nautilus-zoom-control.c,
+ src/ntl-app.c,
+ src/ntl-index-panel.c,
+ src/ntl-main.c,
+ src/ntl-meta-view.c,
+ src/ntl-uri-map.c,
+ src/ntl-uri-map.h,
+ src/ntl-view-bonobo-subdoc.c,
+ src/ntl-view.c,
+ src/ntl-window-msgs.c,
+ src/ntl-window-state.c,
+ src/ntl-window.c,
+ src/ntl-window.h: Updated for libnautilus ->
+ libnautilus-extensions changes.
+
+ * src/file-manager/fm-directory-view.c,
+ src/file-manager/fm-directory-view.h,
+ src/file-manager/fm-icon-text-window.c,
+ src/file-manager/fm-icon-view.c,
+ src/file-manager/fm-list-view.c,
+ src/file-manager/fm-properties-window.c,
+ src/file-manager/fm-properties-window.h: Updated for libnautilus ->
+ libnautilus-extensions changes.
+
+ * components/history/Makefile.am,
+ components/history/ntl-history-view.c,
+ components/html/Makefile.am,
+ components/html/ntl-web-browser.c,
+ components/music/Makefile.am,
+ components/music/nautilus-music-view.c,
+ components/music/nautilus-music-view.h,
+ components/notes/Makefile.am,
+ components/notes/ntl-notes.c,
+ components/rpmview/Makefile.am,
+ components/rpmview/nautilus-rpm-view.c,
+ components/rpmview/nautilus-rpm-view.h,
+ components/sample/Makefile.am,
+ components/sample/nautilus-sample-content-view.c,
+ components/sample/nautilus-sample-content-view.h,
+ components/services/startup/Makefile.am,
+ components/services/startup/eazel-register.c,
+ components/services/startup/nautilus-service-startup-view.c,
+ components/services/startup/nautilus-service-startup-view.h:
+ Updated components for libnautilus -> libnautilus-extensions changes.
+
2000-04-14 Fatih Demir <kabalak@gmx.net>
* configure.in : Added tr to ALL_LINGUAS .
diff --git a/Makefile.am b/Makefile.am
index bbd7cfb73..1bcb8ba40 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,7 @@ NULL=
SUBDIRS =\
librsvg \
libnautilus \
+ libnautilus-extensions \
nautilus-widgets \
src \
components \
diff --git a/components/history/Makefile.am b/components/history/Makefile.am
index f1959f325..e995c1017 100644
--- a/components/history/Makefile.am
+++ b/components/history/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOMEUI_CFLAGS) $(BONOBO_CFLAGS) $(
LDADD=\
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS)
diff --git a/components/history/nautilus-history-view.c b/components/history/nautilus-history-view.c
index fb5c9f51e..f7cfc01e9 100644
--- a/components/history/nautilus-history-view.c
+++ b/components/history/nautilus-history-view.c
@@ -28,8 +28,8 @@
#include "config.h"
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-bookmark.h>
-#include <libnautilus/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <libgnorba/gnorba.h>
diff --git a/components/history/ntl-history-view.c b/components/history/ntl-history-view.c
index fb5c9f51e..f7cfc01e9 100644
--- a/components/history/ntl-history-view.c
+++ b/components/history/ntl-history-view.c
@@ -28,8 +28,8 @@
#include "config.h"
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-bookmark.h>
-#include <libnautilus/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <libgnorba/gnorba.h>
diff --git a/components/html/Makefile.am b/components/html/Makefile.am
index 26b491a55..4a97a80b3 100644
--- a/components/html/Makefile.am
+++ b/components/html/Makefile.am
@@ -31,6 +31,7 @@ ntl_web_browser_SOURCES = \
ntl_web_browser_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(GTKHTML_LIBS) \
$(BONOBO_LIBS) \
diff --git a/components/html/ntl-web-browser.c b/components/html/ntl-web-browser.c
index 6b0019d9b..eeb02a3a4 100644
--- a/components/html/ntl-web-browser.c
+++ b/components/html/ntl-web-browser.c
@@ -26,7 +26,7 @@
#include <gtkhtml/gtkhtml.h>
#include <libgnorba/gnorba.h>
#include <libgnomevfs/gnome-vfs.h>
-#include <libnautilus/nautilus-debug.h>
+#include <libnautilus-extensions/nautilus-debug.h>
typedef struct {
NautilusViewFrame *view_frame;
diff --git a/components/music/Makefile.am b/components/music/Makefile.am
index f1308f18e..27035541e 100644
--- a/components/music/Makefile.am
+++ b/components/music/Makefile.am
@@ -25,6 +25,7 @@ nautilus_music_view_SOURCES = \
nautilus_music_view_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS) \
diff --git a/components/music/nautilus-music-view.c b/components/music/nautilus-music-view.c
index 01b4181a8..50ace4f01 100644
--- a/components/music/nautilus-music-view.c
+++ b/components/music/nautilus-music-view.c
@@ -32,14 +32,14 @@
#include <dirent.h>
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-directory-background.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-directory-background.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
diff --git a/components/music/nautilus-music-view.h b/components/music/nautilus-music-view.h
index 85bb7f637..1e2d427ca 100644
--- a/components/music/nautilus-music-view.h
+++ b/components/music/nautilus-music-view.h
@@ -25,7 +25,7 @@
#ifndef NAUTILUS_MUSIC_VIEW_H
#define NAUTILUS_MUSIC_VIEW_H
-#include <libnautilus/ntl-content-view-frame.h>
+#include <libnautilus/nautilus-content-view-frame.h>
#include <gtk/gtkeventbox.h>
diff --git a/components/notes/Makefile.am b/components/notes/Makefile.am
index 4d0e16009..ed3927104 100644
--- a/components/notes/Makefile.am
+++ b/components/notes/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOMEUI_CFLAGS) $(BONOBO_CFLAGS) $(
LDADD=\
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS)
diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c
index 17710262a..5f1ef5f28 100644
--- a/components/notes/nautilus-notes.c
+++ b/components/notes/nautilus-notes.c
@@ -28,15 +28,15 @@
#include <config.h>
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
#include <gnome.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnorba/gnorba.h>
#include <limits.h>
#include <ctype.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-debug.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-debug.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
diff --git a/components/notes/ntl-notes.c b/components/notes/ntl-notes.c
index 17710262a..5f1ef5f28 100644
--- a/components/notes/ntl-notes.c
+++ b/components/notes/ntl-notes.c
@@ -28,15 +28,15 @@
#include <config.h>
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
#include <gnome.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnorba/gnorba.h>
#include <limits.h>
#include <ctype.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-debug.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-debug.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
diff --git a/components/rpmview/Makefile.am b/components/rpmview/Makefile.am
index 48becb179..5f9be5904 100644
--- a/components/rpmview/Makefile.am
+++ b/components/rpmview/Makefile.am
@@ -26,6 +26,7 @@ nautilus_rpm_view_SOURCES = \
nautilus_rpm_view_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS) \
diff --git a/components/rpmview/nautilus-rpm-view.c b/components/rpmview/nautilus-rpm-view.c
index d30e35d4d..c1695db1f 100644
--- a/components/rpmview/nautilus-rpm-view.c
+++ b/components/rpmview/nautilus-rpm-view.c
@@ -35,13 +35,13 @@
#include <rpm/rpmlib.h>
#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
diff --git a/components/rpmview/nautilus-rpm-view.h b/components/rpmview/nautilus-rpm-view.h
index c686aa623..2340fbf82 100644
--- a/components/rpmview/nautilus-rpm-view.h
+++ b/components/rpmview/nautilus-rpm-view.h
@@ -25,7 +25,7 @@
#ifndef NAUTILUS_RPM_VIEW_H
#define NAUTILUS_RPM_VIEW_H
-#include <libnautilus/ntl-content-view-frame.h>
+#include <libnautilus/nautilus-content-view-frame.h>
#include <gtk/gtkeventbox.h>
diff --git a/components/sample/Makefile.am b/components/sample/Makefile.am
index 82efb0c27..1e55371f3 100644
--- a/components/sample/Makefile.am
+++ b/components/sample/Makefile.am
@@ -24,6 +24,7 @@ nautilus_sample_content_view_SOURCES = \
nautilus_sample_content_view_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS) \
diff --git a/components/sample/nautilus-sample-content-view.c b/components/sample/nautilus-sample-content-view.c
index acbeefffa..c1429a34b 100644
--- a/components/sample/nautilus-sample-content-view.c
+++ b/components/sample/nautilus-sample-content-view.c
@@ -35,7 +35,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-stock.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* A NautilusContentViewFrame's private information. */
struct NautilusSampleContentViewDetails {
diff --git a/components/sample/nautilus-sample-content-view.h b/components/sample/nautilus-sample-content-view.h
index d6c1a5f67..ecc6b3b03 100644
--- a/components/sample/nautilus-sample-content-view.h
+++ b/components/sample/nautilus-sample-content-view.h
@@ -29,7 +29,7 @@
#ifndef NAUTILUS_SAMPLE_CONTENT_VIEW_H
#define NAUTILUS_SAMPLE_CONTENT_VIEW_H
-#include <libnautilus/ntl-content-view-frame.h>
+#include <libnautilus/nautilus-content-view-frame.h>
#include <gtk/gtklabel.h>
typedef struct NautilusSampleContentView NautilusSampleContentView;
diff --git a/components/services/startup/Makefile.am b/components/services/startup/Makefile.am
index c68f3fbef..3fcb45d82 100644
--- a/components/services/startup/Makefile.am
+++ b/components/services/startup/Makefile.am
@@ -28,6 +28,7 @@ nautilus_service_startup_view_SOURCES = \
nautilus_service_startup_view_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
+ $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNOMEUI_LIBS) \
diff --git a/components/services/startup/eazel-register.c b/components/services/startup/eazel-register.c
index 3f394f392..ca5aa6233 100644
--- a/components/services/startup/eazel-register.c
+++ b/components/services/startup/eazel-register.c
@@ -34,7 +34,7 @@
#include <gnome-xml/entities.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/tree.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "eazel-register.h"
void add_package_info(xmlDoc* configuration_metafile);
diff --git a/components/services/startup/nautilus-service-startup-view.c b/components/services/startup/nautilus-service-startup-view.c
index 1acfbaa6e..185fe2b43 100644
--- a/components/services/startup/nautilus-service-startup-view.c
+++ b/components/services/startup/nautilus-service-startup-view.c
@@ -34,12 +34,12 @@
#include <unistd.h>
#include <gnome-xml/tree.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include <stdio.h>
diff --git a/components/services/startup/nautilus-service-startup-view.h b/components/services/startup/nautilus-service-startup-view.h
index a10bb0a49..6177d0dae 100644
--- a/components/services/startup/nautilus-service-startup-view.h
+++ b/components/services/startup/nautilus-service-startup-view.h
@@ -28,7 +28,7 @@
#ifndef NAUTILUS_SERVICE_STARTUP_VIEW_H
#define NAUTILUS_SERVICE_STARTUP_VIEW_H
-#include <libnautilus/ntl-content-view-frame.h>
+#include <libnautilus/nautilus-content-view-frame.h>
#include <gtk/gtk.h>
typedef struct _NautilusServicesContentView NautilusServicesContentView;
diff --git a/configure.in b/configure.in
index 692777c0c..774354cd9 100644
--- a/configure.in
+++ b/configure.in
@@ -154,6 +154,7 @@ data/top/Makefile
idl/Makefile
librsvg/Makefile
libnautilus/Makefile
+libnautilus-extensions/Makefile
nautilus-widgets/Makefile
src/Makefile
src/file-manager/Makefile
diff --git a/libnautilus-extensions/Makefile.am b/libnautilus-extensions/Makefile.am
index 262c3f544..7c597995b 100644
--- a/libnautilus-extensions/Makefile.am
+++ b/libnautilus-extensions/Makefile.am
@@ -1,6 +1,6 @@
NULL=
-lib_LTLIBRARIES=libnautilus.la
+lib_LTLIBRARIES=libnautilus-extensions.la
INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
$(GNOME_CFLAGS) \
@@ -12,7 +12,7 @@ INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
$(WERROR) \
-D_REENTRANT
-libnautilus_la_LDFLAGS=\
+libnautilus_extensions_la_LDFLAGS=\
$(GNOME_LIBS) \
$(GNORBA_LIBS) \
$(BONOBO_LIBS) \
@@ -21,15 +21,14 @@ libnautilus_la_LDFLAGS=\
$(XML_LIBS) \
$(LIBPNG)
-nautilus_view_component_idl_sources=nautilus-view-component-stubs.c nautilus-view-component-skels.c nautilus-view-component.h nautilus-view-component-common.c
fsextension_idl_sources=fsextension-stubs.c fsextension-skels.c fsextension-common.c fsextension.h
-BUILT_SOURCES=$(nautilus_view_component_idl_sources)
+BUILT_SOURCES=$(fsextension_idl_sources)
-libnautilusincludedir=$(includedir)/libnautilus
-libnautilusinclude_HEADERS= \
+libnautilus_extensionsincludedir=$(includedir)/libnautilus
+libnautilus_extensionsinclude_HEADERS= \
bonobo-stream-vfs.h \
gtkscrollframe.h \
- libnautilus.h \
+ libnautilus-extensions.h \
nautilus-alloc.h \
nautilus-background.h \
nautilus-bonobo-extensions.h \
@@ -56,14 +55,9 @@ libnautilusinclude_HEADERS= \
nautilus-string-list.h \
nautilus-string.h \
nautilus-xml-extensions.h \
- nautilus-zoomable.h \
- nautilus-view-component.h \
- ntl-content-view-frame.h \
- ntl-meta-view-frame.h \
- ntl-view-frame.h \
$(NULL)
-libnautilus_la_SOURCES=$(nautilus_view_component_idl_sources) \
+libnautilus_extensions_la_SOURCES = \
bonobo-stream-vfs.c \
gtkscrollframe.c \
nautilus-background-canvas-group.c \
@@ -97,24 +91,15 @@ libnautilus_la_SOURCES=$(nautilus_view_component_idl_sources) \
nautilus-string-list.c \
nautilus-string.c \
nautilus-xml-extensions.c \
- nautilus-zoomable.c \
- ntl-content-view-frame.c \
- ntl-meta-view-frame.c \
- ntl-view-frame.c \
$(fsextension_idl_sources) \
$(NULL)
-$(nautilus_view_component_idl_sources): nautilus_view_component_idl_stamp
$(fsextension_idl_sources): fsextension_idl_stamp
-nautilus_view_component_idl_stamp: nautilus-view-component.idl
- orbit-idl `gnome-config --cflags idl` nautilus-view-component.idl
- touch nautilus_view_component_idl_stamp
-
fsextension_idl_stamp: $(top_srcdir)/idl/fsextension.idl
orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/fsextension.idl
touch fsextension_idl_stamp
-CLEANFILES=nautilus_view_component_idl_stamp fsextension_idl_stamp
+CLEANFILES = fsextension_idl_stamp
-EXTRA_DIST = nautilus-view-component.idl
+#EXTRA_DIST =
diff --git a/libnautilus-extensions/libnautilus.h b/libnautilus-extensions/libnautilus-extensions.h
index 332d2d414..468f30eb2 100644
--- a/libnautilus-extensions/libnautilus.h
+++ b/libnautilus-extensions/libnautilus-extensions.h
@@ -24,17 +24,13 @@
*
*/
-/* libnautilus.h: Main library header file */
+/* libnautilus-extensions.h: Main library header file */
-#ifndef LIBNAUTILUS_H
-#define LIBNAUTILUS_H
+#ifndef LIBNAUTILUS_EXTENSIONS_H
+#define LIBNAUTILUS_EXTENSIONS_H
#include <bonobo.h>
-#include <libnautilus/nautilus.h>
#include <libnautilus/nautilus-alloc.h>
#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/ntl-view-frame.h>
-#include <libnautilus/ntl-meta-view-frame.h>
-#include <libnautilus/ntl-content-view-frame.h>
-#endif /* LIBNAUTILUS_H */
+#endif /* LIBNAUTILUS_EXTENSIONS_H */
diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c
index d4e531796..67bbbcf16 100644
--- a/libnautilus-extensions/nautilus-global-preferences.c
+++ b/libnautilus-extensions/nautilus-global-preferences.c
@@ -28,7 +28,7 @@
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
/*
* Constants
diff --git a/libnautilus-extensions/nautilus-global-preferences.h b/libnautilus-extensions/nautilus-global-preferences.h
index 72855b7d6..9befb4c3d 100644
--- a/libnautilus-extensions/nautilus-global-preferences.h
+++ b/libnautilus-extensions/nautilus-global-preferences.h
@@ -27,7 +27,7 @@
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
-#include <libnautilus/nautilus-string-list.h>
+#include <libnautilus-extensions/nautilus-string-list.h>
BEGIN_GNOME_DECLS
diff --git a/libnautilus-extensions/nautilus-icon-factory.h b/libnautilus-extensions/nautilus-icon-factory.h
index aa421ffe3..8df218903 100644
--- a/libnautilus-extensions/nautilus-icon-factory.h
+++ b/libnautilus-extensions/nautilus-icon-factory.h
@@ -27,7 +27,7 @@
#define NAUTILUS_ICON_FACTORY_H
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-file.h>
#include <gtk/gtkobject.h>
#include <libart_lgpl/art_rect.h>
diff --git a/libnautilus-extensions/nautilus-preferences-box.c b/libnautilus-extensions/nautilus-preferences-box.c
index 9d1132aa7..49947584d 100644
--- a/libnautilus-extensions/nautilus-preferences-box.c
+++ b/libnautilus-extensions/nautilus-preferences-box.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-box.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkclist.h>
diff --git a/libnautilus-extensions/nautilus-preferences-dialog.c b/libnautilus-extensions/nautilus-preferences-dialog.c
index 1d701f3fb..e82f3e466 100644
--- a/libnautilus-extensions/nautilus-preferences-dialog.c
+++ b/libnautilus-extensions/nautilus-preferences-dialog.c
@@ -23,7 +23,7 @@
*/
#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* #include "caption-table.h" */
diff --git a/libnautilus-extensions/nautilus-preferences-group.c b/libnautilus-extensions/nautilus-preferences-group.c
index 831783543..134321078 100644
--- a/libnautilus-extensions/nautilus-preferences-group.c
+++ b/libnautilus-extensions/nautilus-preferences-group.c
@@ -27,7 +27,7 @@
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* Signals */
typedef enum
diff --git a/libnautilus-extensions/nautilus-preferences-item.c b/libnautilus-extensions/nautilus-preferences-item.c
index 6ee5ac027..b53b56246 100644
--- a/libnautilus-extensions/nautilus-preferences-item.c
+++ b/libnautilus-extensions/nautilus-preferences-item.c
@@ -24,7 +24,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
diff --git a/libnautilus-extensions/nautilus-preferences-pane.c b/libnautilus-extensions/nautilus-preferences-pane.c
index f2fe5f4ef..63f457aac 100644
--- a/libnautilus-extensions/nautilus-preferences-pane.c
+++ b/libnautilus-extensions/nautilus-preferences-pane.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-pane.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
diff --git a/libnautilus-extensions/nautilus-preferences.c b/libnautilus-extensions/nautilus-preferences.c
index 7729ecf22..b2fba5aef 100644
--- a/libnautilus-extensions/nautilus-preferences.c
+++ b/libnautilus-extensions/nautilus-preferences.c
@@ -26,7 +26,7 @@
#include "nautilus-preferences.h"
#include <libgnome/gnome-config.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const char PREFERENCES_GLOBAL_DOMAIN[] = "Nautilus::Global";
diff --git a/libnautilus-extensions/nautilus-radio-button-group.c b/libnautilus-extensions/nautilus-radio-button-group.c
index 509afe7de..38a9030b9 100644
--- a/libnautilus-extensions/nautilus-radio-button-group.c
+++ b/libnautilus-extensions/nautilus-radio-button-group.c
@@ -26,7 +26,7 @@
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const gint RADIO_BUTTON_GROUP_INVALID = -1;
diff --git a/libnautilus-extensions/nautilus-zoomable.c b/libnautilus-extensions/nautilus-zoomable.c
deleted file mode 100644
index 33e8706ad..000000000
--- a/libnautilus-extensions/nautilus-zoomable.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-zoomable.c: FIXME */
-
-#include <config.h>
-#include "nautilus-zoomable.h"
-
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <gtk/gtksignal.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-control.h>
-
-NautilusZoomable *foo;
-
-struct _NautilusZoomablePrivate {
- BonoboObject *control;
-
- gdouble zoom_level;
- gdouble min_zoom_level;
- gdouble max_zoom_level;
- gboolean is_continuous;
-
- Nautilus_ZoomableFrame zoomable_frame;
-};
-
-enum {
- SET_ZOOM_LEVEL,
- ZOOM_IN,
- ZOOM_OUT,
- ZOOM_TO_FIT,
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_BONOBO_CONTROL,
- ARG_MIN_ZOOM_LEVEL,
- ARG_MAX_ZOOM_LEVEL,
- ARG_IS_CONTINUOUS
-};
-
-static guint nautilus_zoomable_signals[LAST_SIGNAL];
-
-typedef struct {
- POA_Nautilus_View servant;
- gpointer bonobo_object;
-
- NautilusZoomable *gtk_object;
-} impl_POA_Nautilus_Zoomable;
-
-
-void nautilus_zoomable_real_set_bonobo_control (NautilusZoomable *view,
- BonoboObject *bonobo_control);
-
-static CORBA_double impl_Nautilus_Zoomable__get_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable__set_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- const CORBA_double zoom_level,
- CORBA_Environment *ev);
-static CORBA_double impl_Nautilus_Zoomable__get_min_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static CORBA_double impl_Nautilus_Zoomable__get_max_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static CORBA_boolean impl_Nautilus_Zoomable__get_is_continuous (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_in (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_out (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_to_fit (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-
-
-POA_Nautilus_Zoomable__epv libnautilus_Nautilus_Zoomable_epv =
-{
- NULL, /* _private */
- (gpointer) &impl_Nautilus_Zoomable__get_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__set_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_min_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_max_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_is_continuous,
- (gpointer) &impl_Nautilus_Zoomable_zoom_in,
- (gpointer) &impl_Nautilus_Zoomable_zoom_out,
- (gpointer) &impl_Nautilus_Zoomable_zoom_to_fit
-};
-
-static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
-
-static POA_Nautilus_Zoomable__vepv impl_Nautilus_Zoomable_vepv =
-{
- &base_epv,
- NULL,
- &libnautilus_Nautilus_Zoomable_epv
-};
-
-static CORBA_double
-impl_Nautilus_Zoomable__get_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->zoom_level;
-}
-
-static void
-impl_Nautilus_Zoomable__set_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- const CORBA_double zoom_level,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[SET_ZOOM_LEVEL], zoom_level);
-
-}
-
-static CORBA_double
-impl_Nautilus_Zoomable__get_min_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->min_zoom_level;
-}
-static CORBA_double
-impl_Nautilus_Zoomable__get_max_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->max_zoom_level;
-}
-
-static CORBA_boolean
-impl_Nautilus_Zoomable__get_is_continuous (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->is_continuous;
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_in (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_IN]);
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_out (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_OUT]);
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_to_fit (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_TO_FIT]);
-}
-
-static void
-impl_Nautilus_Zoomable__destroy(BonoboObject *obj, impl_POA_Nautilus_Zoomable *servant)
-{
- PortableServer_ObjectId *objid;
- CORBA_Environment ev;
- void (*servant_destroy_func) (PortableServer_Servant servant, CORBA_Environment *ev);
-
- CORBA_exception_init(&ev);
-
- servant_destroy_func = NAUTILUS_ZOOMABLE_CLASS (GTK_OBJECT (servant->gtk_object)->klass)->servant_destroy_func;
- objid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), objid, &ev);
- CORBA_free (objid);
- obj->servant = NULL;
-
- servant_destroy_func ((PortableServer_Servant) servant, &ev);
- g_free (servant);
- CORBA_exception_free(&ev);
-}
-
-static Nautilus_Zoomable
-impl_Nautilus_Zoomable__create(NautilusZoomable *zoomable, CORBA_Environment * ev)
-{
- Nautilus_Zoomable retval;
- impl_POA_Nautilus_Zoomable *servant;
- void (*servant_init_func) (PortableServer_Servant servant, CORBA_Environment *ev);
-
- NautilusZoomableClass *zoomable_class = NAUTILUS_ZOOMABLE_CLASS (GTK_OBJECT(zoomable)->klass);
-
- servant_init_func = zoomable_class->servant_init_func;
- servant = g_new0 (impl_POA_Nautilus_Zoomable, 1);
- servant->servant.vepv = zoomable_class->vepv;
- if (!servant->servant.vepv->Bonobo_Unknown_epv)
- servant->servant.vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
- servant_init_func ((PortableServer_Servant) servant, ev);
-
- servant->gtk_object = zoomable;
-
- retval = bonobo_object_activate_servant (BONOBO_OBJECT (zoomable), servant);
-
- gtk_signal_connect (GTK_OBJECT (zoomable), "destroy", GTK_SIGNAL_FUNC (impl_Nautilus_Zoomable__destroy), servant);
-
- return retval;
-}
-
-
-typedef gboolean (*GtkSignal_NONE__DOUBLE) (GtkObject * object,
- gdouble arg1,
- gpointer user_data);
-
-static void
-gtk_marshal_NONE__DOUBLE (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__DOUBLE rfunc;
- rfunc = (GtkSignal_NONE__DOUBLE) func;
- (*rfunc) (object,
- GTK_VALUE_DOUBLE (args[0]), func_data);
-}
-
-
-static void nautilus_zoomable_initialize_class (NautilusZoomableClass *klass);
-static void nautilus_zoomable_initialize (NautilusZoomable *zoomable);
-static void nautilus_zoomable_destroy (NautilusZoomable *view);
-static void nautilus_zoomable_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void nautilus_zoomable_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE(NautilusZoomable, nautilus_zoomable, BONOBO_OBJECT_TYPE)
-
-
-
-static void
-nautilus_zoomable_initialize_class (NautilusZoomableClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
- object_class->destroy = (void (*)(GtkObject*))nautilus_zoomable_destroy;
- object_class->set_arg = nautilus_zoomable_set_arg;
- object_class->get_arg = nautilus_zoomable_get_arg;
-
- parent_class = gtk_type_class (gtk_type_parent (object_class->type));
-
- klass->servant_init_func = POA_Nautilus_Zoomable__init;
- klass->servant_destroy_func = POA_Nautilus_Zoomable__fini;
- klass->vepv = &impl_Nautilus_Zoomable_vepv;
-
- nautilus_zoomable_signals[SET_ZOOM_LEVEL] =
- gtk_signal_new("set_zoom_level",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, set_zoom_level),
- gtk_marshal_NONE__DOUBLE,
- GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
- nautilus_zoomable_signals[ZOOM_IN] =
- gtk_signal_new("zoom_in",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_in),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- nautilus_zoomable_signals[ZOOM_OUT] =
- gtk_signal_new("zoom_out",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_out),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- nautilus_zoomable_signals[ZOOM_TO_FIT] =
- gtk_signal_new("zoom_to_fit",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_to_fit),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- gtk_object_class_add_signals (object_class, nautilus_zoomable_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("NautilusZoomable::bonobo_control",
- GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_BONOBO_CONTROL);
- gtk_object_add_arg_type ("NautilusZoomable::min_zoom_level",
- GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_MIN_ZOOM_LEVEL);
- gtk_object_add_arg_type ("NautilusZoomable::max_zoom_level",
- GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_MAX_ZOOM_LEVEL);
- gtk_object_add_arg_type ("NautilusZoomable::is_continuous",
- GTK_TYPE_BOOL,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_IS_CONTINUOUS);
-}
-
-static void
-nautilus_zoomable_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- NautilusZoomable *zoomable;
-
- zoomable = NAUTILUS_ZOOMABLE (object);
-
- switch(arg_id) {
- case ARG_BONOBO_CONTROL:
- nautilus_zoomable_real_set_bonobo_control (zoomable,
- (BonoboObject *) GTK_VALUE_OBJECT (*arg));
- case ARG_MIN_ZOOM_LEVEL:
- zoomable->private->min_zoom_level = GTK_VALUE_DOUBLE (*arg);
- case ARG_MAX_ZOOM_LEVEL:
- zoomable->private->max_zoom_level = GTK_VALUE_DOUBLE (*arg);
- case ARG_IS_CONTINUOUS:
- zoomable->private->is_continuous = GTK_VALUE_BOOL (*arg);
- }
-}
-
-static void
-nautilus_zoomable_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- NautilusZoomable *view;
-
- view = NAUTILUS_ZOOMABLE (object);
-
- switch(arg_id) {
- case ARG_BONOBO_CONTROL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (nautilus_zoomable_get_bonobo_control (NAUTILUS_ZOOMABLE (object)));
- case ARG_MIN_ZOOM_LEVEL:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->min_zoom_level;
- case ARG_MAX_ZOOM_LEVEL:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->max_zoom_level;
- case ARG_IS_CONTINUOUS:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->is_continuous;
- }
-}
-
-static void
-nautilus_zoomable_initialize (NautilusZoomable *zoomable)
-{
- CORBA_Environment ev;
- CORBA_exception_init(&ev);
-
- zoomable->private = g_new0 (NautilusZoomablePrivate, 1);
-
- bonobo_object_construct (BONOBO_OBJECT (zoomable), impl_Nautilus_Zoomable__create (zoomable, &ev));
-
- CORBA_exception_free(&ev);
-}
-
-NautilusZoomable *
-nautilus_zoomable_new (GtkWidget *widget,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous)
-{
- BonoboObject *control;
-
- control = BONOBO_OBJECT (bonobo_control_new (widget));
-
- return nautilus_zoomable_new_from_bonobo_control (control,
- min_zoom_level,
- max_zoom_level,
- is_continuous);
-}
-
-NautilusZoomable *
-nautilus_zoomable_new_from_bonobo_control (BonoboObject *bonobo_control,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous)
-{
- NautilusZoomable *zoomable;
-
- zoomable = NAUTILUS_ZOOMABLE (gtk_object_new (NAUTILUS_TYPE_ZOOMABLE,
- "bonobo_control", bonobo_control,
- "min_zoom_level", min_zoom_level,
- "max_zoom_level", max_zoom_level,
- "is_continuous", is_continuous,
- NULL));
-
- return zoomable;
-}
-
-static void
-nautilus_zoomable_destroy (NautilusZoomable *view)
-{
- g_free (view->private);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
-}
-
-static gboolean
-nautilus_zoomable_ensure_zoomable_frame (NautilusZoomable *view)
-{
- CORBA_Environment ev;
-
- g_assert (view != NULL);
- g_assert (NAUTILUS_IS_ZOOMABLE (view));
-
- CORBA_exception_init (&ev);
-
- if (CORBA_Object_is_nil (view->private->zoomable_frame, &ev))
- view->private->zoomable_frame = Bonobo_Unknown_query_interface
- (bonobo_control_get_control_frame
- (BONOBO_CONTROL (nautilus_zoomable_get_bonobo_control (view))),
- "IDL:Nautilus/ZoomableFrame:1.0", &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- view->private->zoomable_frame = CORBA_OBJECT_NIL;
-
- if (CORBA_Object_is_nil (view->private->zoomable_frame, &ev)) {
- CORBA_exception_free (&ev);
- return FALSE;
- } else {
- CORBA_exception_free (&ev);
- return TRUE;
- }
-}
-
-void
-nautilus_zoomable_set_zoom_level (NautilusZoomable *view,
- gdouble zoom_level)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_ZOOMABLE (view));
-
- CORBA_exception_init (&ev);
-
- view->private->zoom_level = zoom_level;
-
- if (nautilus_zoomable_ensure_zoomable_frame (view)) {
- Nautilus_ZoomableFrame_notify_zoom_level (view->private->zoomable_frame, zoom_level, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->zoomable_frame, &ev);
- view->private->zoomable_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free (&ev);
-}
-
-BonoboObject *
-nautilus_zoomable_get_bonobo_control (NautilusZoomable *view)
-{
- return view->private->control;
-}
-
-void
-nautilus_zoomable_real_set_bonobo_control (NautilusZoomable *view,
- BonoboObject *bonobo_control)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init(&ev);
-
- /* FIXME: what if this fails? Create a new control, or bomb somehow? */
- view->private->control = bonobo_object_query_local_interface (bonobo_control, "IDL:Bonobo/Control:1.0");
-
- /* We don't need the extra ref the above creates. */
- bonobo_object_unref (view->private->control);
-
- bonobo_object_add_interface (BONOBO_OBJECT (view), view->private->control);
-
- CORBA_exception_free(&ev);
-}
diff --git a/libnautilus-extensions/nautilus-zoomable.h b/libnautilus-extensions/nautilus-zoomable.h
deleted file mode 100644
index 7c20f222e..000000000
--- a/libnautilus-extensions/nautilus-zoomable.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-zoomable.h: Object for implementing the Zoomable CORBA interface. */
-
-#ifndef NAUTILUS_ZOOMABLE_H
-#define NAUTILUS_ZOOMABLE_H
-
-#include <libnautilus/nautilus.h>
-#include <bonobo/bonobo-object.h>
-#include <gtk/gtkwidget.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define NAUTILUS_TYPE_ZOOMABLE (nautilus_zoomable_get_type ())
-#define NAUTILUS_ZOOMABLE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ZOOMABLE, NautilusZoomable))
-#define NAUTILUS_ZOOMABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ZOOMABLE, NautilusZoomableClass))
-#define NAUTILUS_IS_ZOOMABLE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ZOOMABLE))
-#define NAUTILUS_IS_ZOOMABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_ZOOMABLE))
-
-typedef struct _NautilusZoomable NautilusZoomable;
-typedef struct _NautilusZoomableClass NautilusZoomableClass;
-
-struct _NautilusZoomableClass
-{
- BonoboObjectClass parent_spot;
-
- void (*set_zoom_level) (NautilusZoomable *view,
- gdouble zoom_level);
- void (*zoom_in) (NautilusZoomable *view);
- void (*zoom_out) (NautilusZoomable *view);
- void (*zoom_to_fit) (NautilusZoomable *view);
-
- gpointer servant_init_func, servant_destroy_func, vepv;
-};
-
-typedef struct _NautilusZoomablePrivate NautilusZoomablePrivate;
-
-struct _NautilusZoomable
-{
- BonoboObject parent;
- NautilusZoomablePrivate *private;
-};
-
-GtkType nautilus_zoomable_get_type (void);
-NautilusZoomable *nautilus_zoomable_new (GtkWidget *widget,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous);
-NautilusZoomable *nautilus_zoomable_new_from_bonobo_control (BonoboObject *bonobo_control,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous);
-void nautilus_zoomable_set_zoom_level (NautilusZoomable *view,
- gdouble zoom_level);
-BonoboObject *nautilus_zoomable_get_bonobo_control (NautilusZoomable *view);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index 262c3f544..7c597995b 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -1,6 +1,6 @@
NULL=
-lib_LTLIBRARIES=libnautilus.la
+lib_LTLIBRARIES=libnautilus-extensions.la
INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
$(GNOME_CFLAGS) \
@@ -12,7 +12,7 @@ INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
$(WERROR) \
-D_REENTRANT
-libnautilus_la_LDFLAGS=\
+libnautilus_extensions_la_LDFLAGS=\
$(GNOME_LIBS) \
$(GNORBA_LIBS) \
$(BONOBO_LIBS) \
@@ -21,15 +21,14 @@ libnautilus_la_LDFLAGS=\
$(XML_LIBS) \
$(LIBPNG)
-nautilus_view_component_idl_sources=nautilus-view-component-stubs.c nautilus-view-component-skels.c nautilus-view-component.h nautilus-view-component-common.c
fsextension_idl_sources=fsextension-stubs.c fsextension-skels.c fsextension-common.c fsextension.h
-BUILT_SOURCES=$(nautilus_view_component_idl_sources)
+BUILT_SOURCES=$(fsextension_idl_sources)
-libnautilusincludedir=$(includedir)/libnautilus
-libnautilusinclude_HEADERS= \
+libnautilus_extensionsincludedir=$(includedir)/libnautilus
+libnautilus_extensionsinclude_HEADERS= \
bonobo-stream-vfs.h \
gtkscrollframe.h \
- libnautilus.h \
+ libnautilus-extensions.h \
nautilus-alloc.h \
nautilus-background.h \
nautilus-bonobo-extensions.h \
@@ -56,14 +55,9 @@ libnautilusinclude_HEADERS= \
nautilus-string-list.h \
nautilus-string.h \
nautilus-xml-extensions.h \
- nautilus-zoomable.h \
- nautilus-view-component.h \
- ntl-content-view-frame.h \
- ntl-meta-view-frame.h \
- ntl-view-frame.h \
$(NULL)
-libnautilus_la_SOURCES=$(nautilus_view_component_idl_sources) \
+libnautilus_extensions_la_SOURCES = \
bonobo-stream-vfs.c \
gtkscrollframe.c \
nautilus-background-canvas-group.c \
@@ -97,24 +91,15 @@ libnautilus_la_SOURCES=$(nautilus_view_component_idl_sources) \
nautilus-string-list.c \
nautilus-string.c \
nautilus-xml-extensions.c \
- nautilus-zoomable.c \
- ntl-content-view-frame.c \
- ntl-meta-view-frame.c \
- ntl-view-frame.c \
$(fsextension_idl_sources) \
$(NULL)
-$(nautilus_view_component_idl_sources): nautilus_view_component_idl_stamp
$(fsextension_idl_sources): fsextension_idl_stamp
-nautilus_view_component_idl_stamp: nautilus-view-component.idl
- orbit-idl `gnome-config --cflags idl` nautilus-view-component.idl
- touch nautilus_view_component_idl_stamp
-
fsextension_idl_stamp: $(top_srcdir)/idl/fsextension.idl
orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/fsextension.idl
touch fsextension_idl_stamp
-CLEANFILES=nautilus_view_component_idl_stamp fsextension_idl_stamp
+CLEANFILES = fsextension_idl_stamp
-EXTRA_DIST = nautilus-view-component.idl
+#EXTRA_DIST =
diff --git a/libnautilus-private/libnautilus.h b/libnautilus-private/libnautilus-extensions.h
index 332d2d414..468f30eb2 100644
--- a/libnautilus-private/libnautilus.h
+++ b/libnautilus-private/libnautilus-extensions.h
@@ -24,17 +24,13 @@
*
*/
-/* libnautilus.h: Main library header file */
+/* libnautilus-extensions.h: Main library header file */
-#ifndef LIBNAUTILUS_H
-#define LIBNAUTILUS_H
+#ifndef LIBNAUTILUS_EXTENSIONS_H
+#define LIBNAUTILUS_EXTENSIONS_H
#include <bonobo.h>
-#include <libnautilus/nautilus.h>
#include <libnautilus/nautilus-alloc.h>
#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/ntl-view-frame.h>
-#include <libnautilus/ntl-meta-view-frame.h>
-#include <libnautilus/ntl-content-view-frame.h>
-#endif /* LIBNAUTILUS_H */
+#endif /* LIBNAUTILUS_EXTENSIONS_H */
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index d4e531796..67bbbcf16 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -28,7 +28,7 @@
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
/*
* Constants
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 72855b7d6..9befb4c3d 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -27,7 +27,7 @@
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
-#include <libnautilus/nautilus-string-list.h>
+#include <libnautilus-extensions/nautilus-string-list.h>
BEGIN_GNOME_DECLS
diff --git a/libnautilus-private/nautilus-icon-factory.h b/libnautilus-private/nautilus-icon-factory.h
index aa421ffe3..8df218903 100644
--- a/libnautilus-private/nautilus-icon-factory.h
+++ b/libnautilus-private/nautilus-icon-factory.h
@@ -27,7 +27,7 @@
#define NAUTILUS_ICON_FACTORY_H
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-file.h>
#include <gtk/gtkobject.h>
#include <libart_lgpl/art_rect.h>
diff --git a/libnautilus-private/nautilus-preferences-box.c b/libnautilus-private/nautilus-preferences-box.c
index 9d1132aa7..49947584d 100644
--- a/libnautilus-private/nautilus-preferences-box.c
+++ b/libnautilus-private/nautilus-preferences-box.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-box.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkclist.h>
diff --git a/libnautilus-private/nautilus-preferences-dialog.c b/libnautilus-private/nautilus-preferences-dialog.c
index 1d701f3fb..e82f3e466 100644
--- a/libnautilus-private/nautilus-preferences-dialog.c
+++ b/libnautilus-private/nautilus-preferences-dialog.c
@@ -23,7 +23,7 @@
*/
#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* #include "caption-table.h" */
diff --git a/libnautilus-private/nautilus-preferences-group.c b/libnautilus-private/nautilus-preferences-group.c
index 831783543..134321078 100644
--- a/libnautilus-private/nautilus-preferences-group.c
+++ b/libnautilus-private/nautilus-preferences-group.c
@@ -27,7 +27,7 @@
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* Signals */
typedef enum
diff --git a/libnautilus-private/nautilus-preferences-item.c b/libnautilus-private/nautilus-preferences-item.c
index 6ee5ac027..b53b56246 100644
--- a/libnautilus-private/nautilus-preferences-item.c
+++ b/libnautilus-private/nautilus-preferences-item.c
@@ -24,7 +24,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
diff --git a/libnautilus-private/nautilus-preferences-pane.c b/libnautilus-private/nautilus-preferences-pane.c
index f2fe5f4ef..63f457aac 100644
--- a/libnautilus-private/nautilus-preferences-pane.c
+++ b/libnautilus-private/nautilus-preferences-pane.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-pane.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
diff --git a/libnautilus-private/nautilus-preferences.c b/libnautilus-private/nautilus-preferences.c
index 7729ecf22..b2fba5aef 100644
--- a/libnautilus-private/nautilus-preferences.c
+++ b/libnautilus-private/nautilus-preferences.c
@@ -26,7 +26,7 @@
#include "nautilus-preferences.h"
#include <libgnome/gnome-config.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const char PREFERENCES_GLOBAL_DOMAIN[] = "Nautilus::Global";
diff --git a/libnautilus-private/nautilus-radio-button-group.c b/libnautilus-private/nautilus-radio-button-group.c
index 509afe7de..38a9030b9 100644
--- a/libnautilus-private/nautilus-radio-button-group.c
+++ b/libnautilus-private/nautilus-radio-button-group.c
@@ -26,7 +26,7 @@
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const gint RADIO_BUTTON_GROUP_INVALID = -1;
diff --git a/libnautilus-private/nautilus-zoomable.c b/libnautilus-private/nautilus-zoomable.c
deleted file mode 100644
index 33e8706ad..000000000
--- a/libnautilus-private/nautilus-zoomable.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-zoomable.c: FIXME */
-
-#include <config.h>
-#include "nautilus-zoomable.h"
-
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <gtk/gtksignal.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-control.h>
-
-NautilusZoomable *foo;
-
-struct _NautilusZoomablePrivate {
- BonoboObject *control;
-
- gdouble zoom_level;
- gdouble min_zoom_level;
- gdouble max_zoom_level;
- gboolean is_continuous;
-
- Nautilus_ZoomableFrame zoomable_frame;
-};
-
-enum {
- SET_ZOOM_LEVEL,
- ZOOM_IN,
- ZOOM_OUT,
- ZOOM_TO_FIT,
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_BONOBO_CONTROL,
- ARG_MIN_ZOOM_LEVEL,
- ARG_MAX_ZOOM_LEVEL,
- ARG_IS_CONTINUOUS
-};
-
-static guint nautilus_zoomable_signals[LAST_SIGNAL];
-
-typedef struct {
- POA_Nautilus_View servant;
- gpointer bonobo_object;
-
- NautilusZoomable *gtk_object;
-} impl_POA_Nautilus_Zoomable;
-
-
-void nautilus_zoomable_real_set_bonobo_control (NautilusZoomable *view,
- BonoboObject *bonobo_control);
-
-static CORBA_double impl_Nautilus_Zoomable__get_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable__set_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- const CORBA_double zoom_level,
- CORBA_Environment *ev);
-static CORBA_double impl_Nautilus_Zoomable__get_min_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static CORBA_double impl_Nautilus_Zoomable__get_max_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static CORBA_boolean impl_Nautilus_Zoomable__get_is_continuous (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_in (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_out (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-static void impl_Nautilus_Zoomable_zoom_to_fit (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev);
-
-
-POA_Nautilus_Zoomable__epv libnautilus_Nautilus_Zoomable_epv =
-{
- NULL, /* _private */
- (gpointer) &impl_Nautilus_Zoomable__get_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__set_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_min_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_max_zoom_level,
- (gpointer) &impl_Nautilus_Zoomable__get_is_continuous,
- (gpointer) &impl_Nautilus_Zoomable_zoom_in,
- (gpointer) &impl_Nautilus_Zoomable_zoom_out,
- (gpointer) &impl_Nautilus_Zoomable_zoom_to_fit
-};
-
-static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
-
-static POA_Nautilus_Zoomable__vepv impl_Nautilus_Zoomable_vepv =
-{
- &base_epv,
- NULL,
- &libnautilus_Nautilus_Zoomable_epv
-};
-
-static CORBA_double
-impl_Nautilus_Zoomable__get_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->zoom_level;
-}
-
-static void
-impl_Nautilus_Zoomable__set_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- const CORBA_double zoom_level,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[SET_ZOOM_LEVEL], zoom_level);
-
-}
-
-static CORBA_double
-impl_Nautilus_Zoomable__get_min_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->min_zoom_level;
-}
-static CORBA_double
-impl_Nautilus_Zoomable__get_max_zoom_level (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->max_zoom_level;
-}
-
-static CORBA_boolean
-impl_Nautilus_Zoomable__get_is_continuous (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- return servant->gtk_object->private->is_continuous;
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_in (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_IN]);
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_out (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_OUT]);
-}
-
-static void
-impl_Nautilus_Zoomable_zoom_to_fit (impl_POA_Nautilus_Zoomable *servant,
- CORBA_Environment *ev)
-{
- gtk_signal_emit (GTK_OBJECT (servant->gtk_object), nautilus_zoomable_signals[ZOOM_TO_FIT]);
-}
-
-static void
-impl_Nautilus_Zoomable__destroy(BonoboObject *obj, impl_POA_Nautilus_Zoomable *servant)
-{
- PortableServer_ObjectId *objid;
- CORBA_Environment ev;
- void (*servant_destroy_func) (PortableServer_Servant servant, CORBA_Environment *ev);
-
- CORBA_exception_init(&ev);
-
- servant_destroy_func = NAUTILUS_ZOOMABLE_CLASS (GTK_OBJECT (servant->gtk_object)->klass)->servant_destroy_func;
- objid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), objid, &ev);
- CORBA_free (objid);
- obj->servant = NULL;
-
- servant_destroy_func ((PortableServer_Servant) servant, &ev);
- g_free (servant);
- CORBA_exception_free(&ev);
-}
-
-static Nautilus_Zoomable
-impl_Nautilus_Zoomable__create(NautilusZoomable *zoomable, CORBA_Environment * ev)
-{
- Nautilus_Zoomable retval;
- impl_POA_Nautilus_Zoomable *servant;
- void (*servant_init_func) (PortableServer_Servant servant, CORBA_Environment *ev);
-
- NautilusZoomableClass *zoomable_class = NAUTILUS_ZOOMABLE_CLASS (GTK_OBJECT(zoomable)->klass);
-
- servant_init_func = zoomable_class->servant_init_func;
- servant = g_new0 (impl_POA_Nautilus_Zoomable, 1);
- servant->servant.vepv = zoomable_class->vepv;
- if (!servant->servant.vepv->Bonobo_Unknown_epv)
- servant->servant.vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
- servant_init_func ((PortableServer_Servant) servant, ev);
-
- servant->gtk_object = zoomable;
-
- retval = bonobo_object_activate_servant (BONOBO_OBJECT (zoomable), servant);
-
- gtk_signal_connect (GTK_OBJECT (zoomable), "destroy", GTK_SIGNAL_FUNC (impl_Nautilus_Zoomable__destroy), servant);
-
- return retval;
-}
-
-
-typedef gboolean (*GtkSignal_NONE__DOUBLE) (GtkObject * object,
- gdouble arg1,
- gpointer user_data);
-
-static void
-gtk_marshal_NONE__DOUBLE (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__DOUBLE rfunc;
- rfunc = (GtkSignal_NONE__DOUBLE) func;
- (*rfunc) (object,
- GTK_VALUE_DOUBLE (args[0]), func_data);
-}
-
-
-static void nautilus_zoomable_initialize_class (NautilusZoomableClass *klass);
-static void nautilus_zoomable_initialize (NautilusZoomable *zoomable);
-static void nautilus_zoomable_destroy (NautilusZoomable *view);
-static void nautilus_zoomable_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void nautilus_zoomable_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE(NautilusZoomable, nautilus_zoomable, BONOBO_OBJECT_TYPE)
-
-
-
-static void
-nautilus_zoomable_initialize_class (NautilusZoomableClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
- object_class->destroy = (void (*)(GtkObject*))nautilus_zoomable_destroy;
- object_class->set_arg = nautilus_zoomable_set_arg;
- object_class->get_arg = nautilus_zoomable_get_arg;
-
- parent_class = gtk_type_class (gtk_type_parent (object_class->type));
-
- klass->servant_init_func = POA_Nautilus_Zoomable__init;
- klass->servant_destroy_func = POA_Nautilus_Zoomable__fini;
- klass->vepv = &impl_Nautilus_Zoomable_vepv;
-
- nautilus_zoomable_signals[SET_ZOOM_LEVEL] =
- gtk_signal_new("set_zoom_level",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, set_zoom_level),
- gtk_marshal_NONE__DOUBLE,
- GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
- nautilus_zoomable_signals[ZOOM_IN] =
- gtk_signal_new("zoom_in",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_in),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- nautilus_zoomable_signals[ZOOM_OUT] =
- gtk_signal_new("zoom_out",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_out),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- nautilus_zoomable_signals[ZOOM_TO_FIT] =
- gtk_signal_new("zoom_to_fit",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusZoomableClass, zoom_to_fit),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- gtk_object_class_add_signals (object_class, nautilus_zoomable_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("NautilusZoomable::bonobo_control",
- GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_BONOBO_CONTROL);
- gtk_object_add_arg_type ("NautilusZoomable::min_zoom_level",
- GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_MIN_ZOOM_LEVEL);
- gtk_object_add_arg_type ("NautilusZoomable::max_zoom_level",
- GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_MAX_ZOOM_LEVEL);
- gtk_object_add_arg_type ("NautilusZoomable::is_continuous",
- GTK_TYPE_BOOL,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_IS_CONTINUOUS);
-}
-
-static void
-nautilus_zoomable_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- NautilusZoomable *zoomable;
-
- zoomable = NAUTILUS_ZOOMABLE (object);
-
- switch(arg_id) {
- case ARG_BONOBO_CONTROL:
- nautilus_zoomable_real_set_bonobo_control (zoomable,
- (BonoboObject *) GTK_VALUE_OBJECT (*arg));
- case ARG_MIN_ZOOM_LEVEL:
- zoomable->private->min_zoom_level = GTK_VALUE_DOUBLE (*arg);
- case ARG_MAX_ZOOM_LEVEL:
- zoomable->private->max_zoom_level = GTK_VALUE_DOUBLE (*arg);
- case ARG_IS_CONTINUOUS:
- zoomable->private->is_continuous = GTK_VALUE_BOOL (*arg);
- }
-}
-
-static void
-nautilus_zoomable_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- NautilusZoomable *view;
-
- view = NAUTILUS_ZOOMABLE (object);
-
- switch(arg_id) {
- case ARG_BONOBO_CONTROL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (nautilus_zoomable_get_bonobo_control (NAUTILUS_ZOOMABLE (object)));
- case ARG_MIN_ZOOM_LEVEL:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->min_zoom_level;
- case ARG_MAX_ZOOM_LEVEL:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->max_zoom_level;
- case ARG_IS_CONTINUOUS:
- GTK_VALUE_DOUBLE (*arg) = NAUTILUS_ZOOMABLE (object)->private->is_continuous;
- }
-}
-
-static void
-nautilus_zoomable_initialize (NautilusZoomable *zoomable)
-{
- CORBA_Environment ev;
- CORBA_exception_init(&ev);
-
- zoomable->private = g_new0 (NautilusZoomablePrivate, 1);
-
- bonobo_object_construct (BONOBO_OBJECT (zoomable), impl_Nautilus_Zoomable__create (zoomable, &ev));
-
- CORBA_exception_free(&ev);
-}
-
-NautilusZoomable *
-nautilus_zoomable_new (GtkWidget *widget,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous)
-{
- BonoboObject *control;
-
- control = BONOBO_OBJECT (bonobo_control_new (widget));
-
- return nautilus_zoomable_new_from_bonobo_control (control,
- min_zoom_level,
- max_zoom_level,
- is_continuous);
-}
-
-NautilusZoomable *
-nautilus_zoomable_new_from_bonobo_control (BonoboObject *bonobo_control,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous)
-{
- NautilusZoomable *zoomable;
-
- zoomable = NAUTILUS_ZOOMABLE (gtk_object_new (NAUTILUS_TYPE_ZOOMABLE,
- "bonobo_control", bonobo_control,
- "min_zoom_level", min_zoom_level,
- "max_zoom_level", max_zoom_level,
- "is_continuous", is_continuous,
- NULL));
-
- return zoomable;
-}
-
-static void
-nautilus_zoomable_destroy (NautilusZoomable *view)
-{
- g_free (view->private);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
-}
-
-static gboolean
-nautilus_zoomable_ensure_zoomable_frame (NautilusZoomable *view)
-{
- CORBA_Environment ev;
-
- g_assert (view != NULL);
- g_assert (NAUTILUS_IS_ZOOMABLE (view));
-
- CORBA_exception_init (&ev);
-
- if (CORBA_Object_is_nil (view->private->zoomable_frame, &ev))
- view->private->zoomable_frame = Bonobo_Unknown_query_interface
- (bonobo_control_get_control_frame
- (BONOBO_CONTROL (nautilus_zoomable_get_bonobo_control (view))),
- "IDL:Nautilus/ZoomableFrame:1.0", &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- view->private->zoomable_frame = CORBA_OBJECT_NIL;
-
- if (CORBA_Object_is_nil (view->private->zoomable_frame, &ev)) {
- CORBA_exception_free (&ev);
- return FALSE;
- } else {
- CORBA_exception_free (&ev);
- return TRUE;
- }
-}
-
-void
-nautilus_zoomable_set_zoom_level (NautilusZoomable *view,
- gdouble zoom_level)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_ZOOMABLE (view));
-
- CORBA_exception_init (&ev);
-
- view->private->zoom_level = zoom_level;
-
- if (nautilus_zoomable_ensure_zoomable_frame (view)) {
- Nautilus_ZoomableFrame_notify_zoom_level (view->private->zoomable_frame, zoom_level, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->zoomable_frame, &ev);
- view->private->zoomable_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free (&ev);
-}
-
-BonoboObject *
-nautilus_zoomable_get_bonobo_control (NautilusZoomable *view)
-{
- return view->private->control;
-}
-
-void
-nautilus_zoomable_real_set_bonobo_control (NautilusZoomable *view,
- BonoboObject *bonobo_control)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init(&ev);
-
- /* FIXME: what if this fails? Create a new control, or bomb somehow? */
- view->private->control = bonobo_object_query_local_interface (bonobo_control, "IDL:Bonobo/Control:1.0");
-
- /* We don't need the extra ref the above creates. */
- bonobo_object_unref (view->private->control);
-
- bonobo_object_add_interface (BONOBO_OBJECT (view), view->private->control);
-
- CORBA_exception_free(&ev);
-}
diff --git a/libnautilus-private/nautilus-zoomable.h b/libnautilus-private/nautilus-zoomable.h
deleted file mode 100644
index 7c20f222e..000000000
--- a/libnautilus-private/nautilus-zoomable.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-zoomable.h: Object for implementing the Zoomable CORBA interface. */
-
-#ifndef NAUTILUS_ZOOMABLE_H
-#define NAUTILUS_ZOOMABLE_H
-
-#include <libnautilus/nautilus.h>
-#include <bonobo/bonobo-object.h>
-#include <gtk/gtkwidget.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define NAUTILUS_TYPE_ZOOMABLE (nautilus_zoomable_get_type ())
-#define NAUTILUS_ZOOMABLE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ZOOMABLE, NautilusZoomable))
-#define NAUTILUS_ZOOMABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ZOOMABLE, NautilusZoomableClass))
-#define NAUTILUS_IS_ZOOMABLE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ZOOMABLE))
-#define NAUTILUS_IS_ZOOMABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_ZOOMABLE))
-
-typedef struct _NautilusZoomable NautilusZoomable;
-typedef struct _NautilusZoomableClass NautilusZoomableClass;
-
-struct _NautilusZoomableClass
-{
- BonoboObjectClass parent_spot;
-
- void (*set_zoom_level) (NautilusZoomable *view,
- gdouble zoom_level);
- void (*zoom_in) (NautilusZoomable *view);
- void (*zoom_out) (NautilusZoomable *view);
- void (*zoom_to_fit) (NautilusZoomable *view);
-
- gpointer servant_init_func, servant_destroy_func, vepv;
-};
-
-typedef struct _NautilusZoomablePrivate NautilusZoomablePrivate;
-
-struct _NautilusZoomable
-{
- BonoboObject parent;
- NautilusZoomablePrivate *private;
-};
-
-GtkType nautilus_zoomable_get_type (void);
-NautilusZoomable *nautilus_zoomable_new (GtkWidget *widget,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous);
-NautilusZoomable *nautilus_zoomable_new_from_bonobo_control (BonoboObject *bonobo_control,
- gdouble min_zoom_level,
- gdouble max_zoom_level,
- gboolean is_continuous);
-void nautilus_zoomable_set_zoom_level (NautilusZoomable *view,
- gdouble zoom_level);
-BonoboObject *nautilus_zoomable_get_bonobo_control (NautilusZoomable *view);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/libnautilus/.cvsignore b/libnautilus/.cvsignore
index 143a40611..32a732164 100644
--- a/libnautilus/.cvsignore
+++ b/libnautilus/.cvsignore
@@ -3,11 +3,6 @@
*.lo
Makefile
Makefile.in
-fsextension-common.c
-fsextension.h
-fsextension_idl_stamp
-fsextension-skels.c
-fsextension-stubs.c
libnautilus.la
nautilus-view-component-stubs.c
nautilus-view-component-skels.c
diff --git a/libnautilus/Makefile.am b/libnautilus/Makefile.am
index 262c3f544..85eab0b3b 100644
--- a/libnautilus/Makefile.am
+++ b/libnautilus/Makefile.am
@@ -22,99 +22,31 @@ libnautilus_la_LDFLAGS=\
$(LIBPNG)
nautilus_view_component_idl_sources=nautilus-view-component-stubs.c nautilus-view-component-skels.c nautilus-view-component.h nautilus-view-component-common.c
-fsextension_idl_sources=fsextension-stubs.c fsextension-skels.c fsextension-common.c fsextension.h
BUILT_SOURCES=$(nautilus_view_component_idl_sources)
libnautilusincludedir=$(includedir)/libnautilus
+
libnautilusinclude_HEADERS= \
- bonobo-stream-vfs.h \
- gtkscrollframe.h \
libnautilus.h \
- nautilus-alloc.h \
- nautilus-background.h \
- nautilus-bonobo-extensions.h \
- nautilus-bookmark.h \
- nautilus-debug.h \
- nautilus-directory.h \
- nautilus-directory-background.h \
- nautilus-file-utilities.h \
- nautilus-file.h \
- nautilus-gdk-extensions.h \
- nautilus-gdk-pixbuf-extensions.h \
- nautilus-glib-extensions.h \
- nautilus-global-preferences.h \
- nautilus-gnome-extensions.h \
- nautilus-graphic-effects.h \
- nautilus-gtk-extensions.h \
- nautilus-icon-container.h \
- nautilus-icon-factory.h \
- nautilus-list-column-title.h \
- nautilus-list.h \
- nautilus-metadata.h \
- nautilus-mime-type.h \
- nautilus-self-checks.h \
- nautilus-string-list.h \
- nautilus-string.h \
- nautilus-xml-extensions.h \
- nautilus-zoomable.h \
nautilus-view-component.h \
- ntl-content-view-frame.h \
- ntl-meta-view-frame.h \
- ntl-view-frame.h \
+ nautilus-content-view-frame.h \
+ nautilus-meta-view-frame.h \
+ nautilus-view-frame.h \
$(NULL)
libnautilus_la_SOURCES=$(nautilus_view_component_idl_sources) \
- bonobo-stream-vfs.c \
- gtkscrollframe.c \
- nautilus-background-canvas-group.c \
- nautilus-background.c \
- nautilus-bonobo-extensions.c \
- nautilus-bookmark.c \
- nautilus-debug.c \
- nautilus-default-file-icon.c \
- nautilus-default-file-icon.h \
- nautilus-directory.c \
- nautilus-directory-background.c \
- nautilus-file-utilities.c \
- nautilus-file.c \
- nautilus-gdk-extensions.c \
- nautilus-gdk-pixbuf-extensions.c \
- nautilus-glib-extensions.c \
- nautilus-global-preferences.c \
- nautilus-gnome-extensions.c \
- nautilus-graphic-effects.c \
- nautilus-gtk-extensions.c \
- nautilus-icon-canvas-item.c \
- nautilus-icon-container.c \
- nautilus-icon-dnd.c \
- nautilus-icon-factory.c \
- nautilus-icon-grid.c \
- nautilus-lib-self-check-functions.c \
- nautilus-list-column-title.c \
- nautilus-list.c \
- nautilus-mime-type.c \
- nautilus-self-checks.c \
- nautilus-string-list.c \
- nautilus-string.c \
- nautilus-xml-extensions.c \
nautilus-zoomable.c \
- ntl-content-view-frame.c \
- ntl-meta-view-frame.c \
- ntl-view-frame.c \
- $(fsextension_idl_sources) \
+ nautilus-content-view-frame.c \
+ nautilus-meta-view-frame.c \
+ nautilus-view-frame.c \
$(NULL)
$(nautilus_view_component_idl_sources): nautilus_view_component_idl_stamp
-$(fsextension_idl_sources): fsextension_idl_stamp
nautilus_view_component_idl_stamp: nautilus-view-component.idl
orbit-idl `gnome-config --cflags idl` nautilus-view-component.idl
touch nautilus_view_component_idl_stamp
-fsextension_idl_stamp: $(top_srcdir)/idl/fsextension.idl
- orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/fsextension.idl
- touch fsextension_idl_stamp
-
-CLEANFILES=nautilus_view_component_idl_stamp fsextension_idl_stamp
+CLEANFILES=nautilus_view_component_idl_stamp
EXTRA_DIST = nautilus-view-component.idl
diff --git a/libnautilus/bonobo-stream-vfs.c b/libnautilus/bonobo-stream-vfs.c
deleted file mode 100644
index a1fda664b..000000000
--- a/libnautilus/bonobo-stream-vfs.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>, based on bonobo-stream-fs.c by Miguel de Icaza.
- * bonobo-stream-vfs.c: Gnome VFS-based Stream implementation
- */
-#include <config.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <gnome.h>
-#include "bonobo-stream-vfs.h"
-#include <errno.h>
-
-static BonoboStreamClass *bonobo_stream_vfs_parent_class;
-
-static CORBA_long
-vfs_write (BonoboStream *stream, const Bonobo_Stream_iobuf *buffer,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- GnomeVFSResult res;
- GnomeVFSFileSize written = 0;
-
- res = gnome_vfs_write(sfs->fd, buffer->_buffer, buffer->_length, &written);
-
- if (res != GNOME_VFS_OK) {
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Storage_NameExists, NULL);
- return 0;
- }
-
- return written;
-}
-
-static CORBA_long
-vfs_read (BonoboStream *stream, CORBA_long count,
- Bonobo_Stream_iobuf ** buffer,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- CORBA_octet *data;
- GnomeVFSResult res;
- GnomeVFSFileSize nread = 0;
-
- *buffer = Bonobo_Stream_iobuf__alloc ();
- CORBA_sequence_set_release (*buffer, TRUE);
- data = CORBA_sequence_CORBA_octet_allocbuf (count);
-
- res = gnome_vfs_read(sfs->fd, data, count, &nread);
-
- if (res == GNOME_VFS_OK){
- (*buffer)->_buffer = data;
- (*buffer)->_length = nread;
- } else
- CORBA_free (data);
- sfs->got_eof = (res == GNOME_VFS_ERROR_EOF);
-
- return nread;
-}
-
-static CORBA_long
-vfs_seek (BonoboStream *stream,
- CORBA_long ofvfset, Bonobo_Stream_SeekType whence,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- GnomeVFSSeekPosition gwhence;
- GnomeVFSFileSize pos;
- GnomeVFSResult res;
-
- switch(whence)
- {
- case Bonobo_Stream_SEEK_CUR:
- gwhence = GNOME_VFS_SEEK_CURRENT;
- break;
- case Bonobo_Stream_SEEK_END:
- gwhence = GNOME_VFS_SEEK_END;
- break;
- default:
- gwhence = GNOME_VFS_SEEK_START;
- break;
- }
-
- res = gnome_vfs_seek(sfs->fd, gwhence, ofvfset);
- if(res != GNOME_VFS_OK)
- {
- pos = -1;
- goto out;
- }
-
- res = gnome_vfs_tell(sfs->fd, &pos);
- if(res != GNOME_VFS_OK)
- {
- pos = -1;
- goto out;
- }
-
- out:
- sfs->got_eof = (res == GNOME_VFS_ERROR_EOF);
- return pos;
-}
-
-static void
-vfs_truncate (BonoboStream *stream,
- const CORBA_long new_size,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- gnome_vfs_truncate_handle(sfs->fd, new_size);
-}
-
-static void
-vfs_copy_to (BonoboStream *stream,
- const CORBA_char *dest,
- const CORBA_long bytes,
- CORBA_long *read_bytes,
- CORBA_long *written_bytes,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- CORBA_octet *data;
- CORBA_unsigned_long more = bytes;
- GnomeVFSHandle *fd_out;
- GnomeVFSResult res;
- GnomeVFSFileSize rsize, wsize;
-
-#define READ_CHUNK_SIZE 65536
-
- data = CORBA_sequence_CORBA_octet_allocbuf (READ_CHUNK_SIZE);
-
- *read_bytes = 0;
- *written_bytes = 0;
-
- res = gnome_vfs_create(&fd_out, dest, GNOME_VFS_OPEN_WRITE, FALSE, 0666);
- if(res != GNOME_VFS_OK)
- return;
-
- do {
- res = gnome_vfs_read(sfs->fd, data, MIN(READ_CHUNK_SIZE, more), &rsize);
-
- sfs->got_eof = (res == GNOME_VFS_ERROR_EOF);
-
- if (res == GNOME_VFS_OK) {
- *read_bytes += rsize;
- more -= rsize;
- res = gnome_vfs_write(fd_out, data, rsize, &wsize);
- if (res == GNOME_VFS_OK)
- *written_bytes += wsize;
- else
- break;
- } else
- rsize = 0;
- } while(more > 0 && rsize > 0);
-
- gnome_vfs_close(fd_out);
-}
-
-static void
-vfs_commit (BonoboStream *stream,
- CORBA_Environment *ev)
-{
- g_warning ("Commit NI");
-}
-
-static void
-vfs_close (BonoboStream *stream,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
-
- if (gnome_vfs_close (sfs->fd) != GNOME_VFS_OK)
- g_warning ("Close failed");
-
- sfs->fd = NULL;
- sfs->got_eof = FALSE;
-}
-
-static CORBA_boolean
-vfs_eos (BonoboStream *stream,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
-
- return sfs->got_eof;
-}
-
-static CORBA_long
-vfs_length (BonoboStream *stream,
- CORBA_Environment *ev)
-{
- BonoboStreamVFS *sfs = BONOBO_STREAM_VFS (stream);
- GnomeVFSFileInfo fi;
- CORBA_long retval;
-
- gnome_vfs_file_info_init(&fi);
- if(gnome_vfs_get_file_info_from_handle(sfs->fd, &fi, GNOME_VFS_FILE_INFO_DEFAULT, NULL) != GNOME_VFS_OK)
- return 0;
- retval = fi.size;
- gnome_vfs_file_info_clear(&fi);
-
- return retval;
-}
-
-
-static void
-bonobo_stream_vfs_class_init (BonoboStreamVFSClass *klass)
-{
- BonoboStreamClass *sclass = BONOBO_STREAM_CLASS (klass);
-
- bonobo_stream_vfs_parent_class = gtk_type_class (bonobo_stream_get_type ());
-
- sclass->write = vfs_write;
- sclass->read = vfs_read;
- sclass->seek = vfs_seek;
- sclass->truncate = vfs_truncate;
- sclass->copy_to = vfs_copy_to;
- sclass->commit = vfs_commit;
- sclass->close = vfs_close;
- sclass->eos = vfs_eos;
- sclass->length = vfs_length;
-}
-
-/**
- * bonobo_stream_vfs_get_type:
- *
- * Returns the GtkType for the BonoboStreamVFS class.
- */
-GtkType
-bonobo_stream_vfs_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "IDL:GNOME/StreamVFS:1.0",
- sizeof (BonoboStreamVFS),
- sizeof (BonoboStreamVFSClass),
- (GtkClassInitFunc) bonobo_stream_vfs_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_stream_get_type (), &info);
- }
-
- return type;
-}
-
-/**
- * bonobo_stream_vfs_construct:
- * @stream: The BonoboStreamVFS object to initialize.
- * @corba_stream: The CORBA server which implements the BonoboStreamVFS service.
- *
- * This function initializes an object of type BonoboStreamVFS using the
- * provided CORBA server @corba_stream.
- *
- * Returns the constructed BonoboStreamVFS @stream.
- */
-BonoboStream *
-bonobo_stream_vfs_construct (BonoboStreamVFS *stream,
- Bonobo_Stream corba_stream)
-{
- g_return_val_if_fail (stream != NULL, NULL);
- g_return_val_if_fail (BONOBO_IS_STREAM (stream), NULL);
- g_return_val_if_fail (corba_stream != CORBA_OBJECT_NIL, NULL);
-
- bonobo_object_construct (BONOBO_OBJECT (stream), corba_stream);
-
- return BONOBO_STREAM (stream);
-}
-
-static Bonobo_Stream
-create_bonobo_stream_vfs (BonoboObject *object)
-{
- POA_Bonobo_Stream *servant;
- CORBA_Environment ev;
-
- servant = (POA_Bonobo_Stream *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &bonobo_stream_vepv;
-
- CORBA_exception_init (&ev);
-
- POA_Bonobo_Stream__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_free (servant);
- CORBA_exception_free (&ev);
- return CORBA_OBJECT_NIL;
- }
-
- CORBA_exception_free (&ev);
- return (Bonobo_Stream) bonobo_object_activate_servant (object, servant);
-}
-
-static BonoboStream *
-bonobo_stream_create (GnomeVFSHandle *fd)
-{
- BonoboStreamVFS *stream_vfs;
- Bonobo_Stream corba_stream;
-
- stream_vfs = gtk_type_new (bonobo_stream_vfs_get_type ());
- if (stream_vfs == NULL)
- return NULL;
-
- stream_vfs->fd = fd;
-
- corba_stream = create_bonobo_stream_vfs (
- BONOBO_OBJECT (stream_vfs));
-
- if (corba_stream == CORBA_OBJECT_NIL){
- gtk_object_destroy (GTK_OBJECT (stream_vfs));
- return NULL;
- }
-
- return bonobo_stream_vfs_construct (stream_vfs, corba_stream);
-}
-
-
-/**
- * bonobo_stream_vfs_open:
- * @uri: The path to the file to be opened.
- * @mode: The mode with which the file should be opened.
- *
- * Creates a new BonoboStream object for the filename specified by
- * @path.
- */
-BonoboStream *
-bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode)
-{
- GnomeVFSHandle *fd = NULL;
- GnomeVFSResult res;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- if (mode == Bonobo_Storage_READ)
- res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ);
- else if (mode == Bonobo_Storage_WRITE)
- res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE);
-
- if(fd && res == GNOME_VFS_OK)
- return bonobo_stream_create (fd);
- else
- return NULL;
-}
-
-/**
- * bonobo_stream_vfs_create:
- * @uri: The path to the file to be opened.
- *
- * Creates a new BonoboStreamVFS object which is bound to the file
- * specified by @path.
- *
- * When data is read out of or written into the returned BonoboStream
- * object, the read() and write() operations are mapped to the
- * corresponding operations on the specified file.
- *
- * Returns: the constructed BonoboStream object which is bound to the specified file.
- */
-BonoboStream *
-bonobo_stream_vfs_create (const char *uri)
-{
- GnomeVFSHandle *fd = NULL;
- GnomeVFSResult res;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- res = gnome_vfs_create(&fd, uri, GNOME_VFS_OPEN_READ|GNOME_VFS_OPEN_WRITE, FALSE, 0666);
-
- if(fd && res == GNOME_VFS_OK)
- return bonobo_stream_create (fd);
- else
- return NULL;
-}
-
-
-
diff --git a/libnautilus/bonobo-stream-vfs.h b/libnautilus/bonobo-stream-vfs.h
deleted file mode 100644
index 7e00aa239..000000000
--- a/libnautilus/bonobo-stream-vfs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>, based on bonobo-stream-fs.h by Miguel de Icaza.
- * bonobo-stream-vfs.h: Gnome VFS-based Stream interface
- */
-#ifndef _BONOBO_STREAM_VFS_H_
-#define _BONOBO_STREAM_VFS_H_
-
-#include <bonobo/bonobo-stream.h>
-#include <libgnomevfs/gnome-vfs.h>
-
-BEGIN_GNOME_DECLS
-
-struct _BonoboStreamVFS;
-typedef struct _BonoboStreamVFS BonoboStreamVFS;
-
-#ifndef _BONOBO_STORAGE_VFS_H_
-struct _BonoboStorageVFS;
-typedef struct _BonoboStorageVFS BonoboStorageVFS;
-#endif
-
-#define BONOBO_STREAM_VFS_TYPE (bonobo_stream_vfs_get_type ())
-#define BONOBO_STREAM_VFS(o) (GTK_CHECK_CAST ((o), BONOBO_STREAM_VFS_TYPE, BonoboStreamVFS))
-#define BONOBO_STREAM_VFS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_STREAM_VFS_TYPE, BonoboStreamVFSClass))
-#define BONOBO_IS_STREAM_VFS(o) (GTK_CHECK_TYPE ((o), BONOBO_STREAM_VFS_TYPE))
-#define BONOBO_IS_STREAM_VFS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_STREAM_VFS_TYPE))
-
-typedef struct _BonoboStreamVFSPrivate BonoboStreamVFSPrivate;
-
-struct _BonoboStreamVFS {
- BonoboStream stream;
-
- GnomeVFSURI *uri;
- GnomeVFSHandle *fd;
- gboolean got_eof;
-
- BonoboStreamVFSPrivate *priv;
-};
-
-typedef struct {
- BonoboStreamClass parent_class;
-} BonoboStreamVFSClass;
-
-GtkType bonobo_stream_vfs_get_type (void);
-BonoboStream *bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode);
-BonoboStream *bonobo_stream_vfs_create (const char *uri);
-BonoboStream *bonobo_stream_vfs_construct (BonoboStreamVFS *stream,
- Bonobo_Stream corba_stream);
-
-END_GNOME_DECLS
-
-#endif /* _BONOBO_STREAM_VFS_H_ */
diff --git a/libnautilus/gtkscrollframe.c b/libnautilus/gtkscrollframe.c
deleted file mode 100644
index 938c388c2..000000000
--- a/libnautilus/gtkscrollframe.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This 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.
- *
- * This 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 this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999, 2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <config.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkviewport.h>
-#include "gtkscrollframe.h"
-
-
-/* scrolled window policy and size requisition handling:
- *
- * gtk size requisition works as follows:
- * a widget upon size-request reports the width and height that it finds
- * to be best suited to display its contents, including children.
- * the width and/or height reported from a widget upon size requisition
- * may be overidden by the user by specifying a width and/or height
- * other than 0 through gtk_widget_set_usize().
- *
- * a scrolled window needs (for imlementing all three policy types) to
- * request its width and height based on two different rationales.
- * 1) the user wants the scrolled window to just fit into the space
- * that it gets allocated for a specifc dimension.
- * 1.1) this does not apply if the user specified a concrete value
- * value for that specific dimension by either specifying usize for the
- * scrolled window or for its child.
- * 2) the user wants the scrolled window to take as much space up as
- * is desired by the child for a specifc dimension (i.e. POLICY_NEVER).
- *
- * also, kinda obvious:
- * 3) a user would certainly not have choosen a scrolled window as a container
- * for the child, if the resulting allocation takes up more space than the
- * child would have allocated without the scrolled window.
- *
- * conclusions:
- * A) from 1) follows: the scrolled window shouldn't request more space for a
- * specifc dimension than is required at minimum.
- * B) from 1.1) follows: the requisition may be overidden by usize of the scrolled
- * window (done automatically) or by usize of the child (needs to be checked).
- * C) from 2) follows: for POLICY_NEVER, the scrolled window simply reports the
- * child's dimension.
- * D) from 3) follows: the scrolled window child's minimum width and minimum height
- * under A) at least correspond to the space taken up by its scrollbars.
- */
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_HADJUSTMENT,
- ARG_VADJUSTMENT,
- ARG_HSCROLLBAR_POLICY,
- ARG_VSCROLLBAR_POLICY,
- ARG_FRAME_PLACEMENT,
- ARG_SHADOW_TYPE,
- ARG_SCROLLBAR_SPACING
-};
-
-/* Private part of the GtkScrollFrame structure */
-typedef struct {
- /* Horizontal and vertical scrollbars */
- GtkWidget *hsb;
- GtkWidget *vsb;
-
- /* Space between scrollbars and frame */
- guint sb_spacing;
-
- /* Allocation for frame */
- guint frame_x;
- guint frame_y;
- guint frame_w;
- guint frame_h;
-
- /* Scrollbar policy */
- guint hsb_policy : 2;
- guint vsb_policy : 2;
-
- /* Whether scrollbars are visible */
- guint hsb_visible : 1;
- guint vsb_visible : 1;
-
- /* Placement of frame wrt scrollbars */
- guint frame_placement : 2;
-
- /* Shadow type for frame */
- guint shadow_type : 3;
-} ScrollFramePrivate;
-
-
-static void gtk_scroll_frame_class_init (GtkScrollFrameClass *class);
-static void gtk_scroll_frame_init (GtkScrollFrame *sf);
-static void gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void gtk_scroll_frame_destroy (GtkObject *object);
-static void gtk_scroll_frame_finalize (GtkObject *object);
-
-static void gtk_scroll_frame_map (GtkWidget *widget);
-static void gtk_scroll_frame_unmap (GtkWidget *widget);
-static void gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area);
-static void gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition);
-static void gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static gint gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event);
-
-static void gtk_scroll_frame_add (GtkContainer *container, GtkWidget *widget);
-static void gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *widget);
-static void gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals,
- GtkCallback callback, gpointer callback_data);
-
-static GtkBinClass *parent_class;
-
-
-/**
- * gtk_scroll_frame_get_type:
- * @void:
- *
- * Registers the &GtkScrollFrame class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GtkScrollFrame class.
- **/
-GtkType
-gtk_scroll_frame_get_type (void)
-{
- static GtkType scroll_frame_type = 0;
-
- if (!scroll_frame_type) {
- static const GtkTypeInfo scroll_frame_info = {
- "GtkScrollFrame",
- sizeof (GtkScrollFrame),
- sizeof (GtkScrollFrameClass),
- (GtkClassInitFunc) gtk_scroll_frame_class_init,
- (GtkObjectInitFunc) gtk_scroll_frame_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- scroll_frame_type = gtk_type_unique (GTK_TYPE_BIN, &scroll_frame_info);
- }
-
- return scroll_frame_type;
-}
-
-/* Class initialization function for the scroll frame widget */
-static void
-gtk_scroll_frame_class_init (GtkScrollFrameClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (GTK_TYPE_BIN);
-
- gtk_object_add_arg_type ("GtkScrollFrame::hadjustment",
- GTK_TYPE_ADJUSTMENT,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
- ARG_HADJUSTMENT);
- gtk_object_add_arg_type ("GtkScrollFrame::vadjustment",
- GTK_TYPE_ADJUSTMENT,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
- ARG_VADJUSTMENT);
- gtk_object_add_arg_type ("GtkScrollFrame::hscrollbar_policy",
- GTK_TYPE_POLICY_TYPE,
- GTK_ARG_READWRITE,
- ARG_HSCROLLBAR_POLICY);
- gtk_object_add_arg_type ("GtkScrollFrame::vscrollbar_policy",
- GTK_TYPE_POLICY_TYPE,
- GTK_ARG_READWRITE,
- ARG_VSCROLLBAR_POLICY);
- gtk_object_add_arg_type ("GtkScrollFrame::frame_placement",
- GTK_TYPE_CORNER_TYPE,
- GTK_ARG_READWRITE,
- ARG_FRAME_PLACEMENT);
- gtk_object_add_arg_type ("GtkScrollFrame::shadow_type",
- GTK_TYPE_SHADOW_TYPE,
- GTK_ARG_READWRITE,
- ARG_SHADOW_TYPE);
- gtk_object_add_arg_type ("GtkScrollFrame::scrollbar_spacing",
- GTK_TYPE_UINT,
- GTK_ARG_READWRITE,
- ARG_SCROLLBAR_SPACING);
-
- object_class->set_arg = gtk_scroll_frame_set_arg;
- object_class->get_arg = gtk_scroll_frame_get_arg;
- object_class->destroy = gtk_scroll_frame_destroy;
- object_class->finalize = gtk_scroll_frame_finalize;
-
- widget_class->map = gtk_scroll_frame_map;
- widget_class->unmap = gtk_scroll_frame_unmap;
- widget_class->draw = gtk_scroll_frame_draw;
- widget_class->size_request = gtk_scroll_frame_size_request;
- widget_class->size_allocate = gtk_scroll_frame_size_allocate;
- widget_class->expose_event = gtk_scroll_frame_expose;
-
- container_class->add = gtk_scroll_frame_add;
- container_class->remove = gtk_scroll_frame_remove;
- container_class->forall = gtk_scroll_frame_forall;
-}
-
-/* Object initialization function for the scroll frame widget */
-static void
-gtk_scroll_frame_init (GtkScrollFrame *sf)
-{
- ScrollFramePrivate *priv;
-
- priv = g_new0 (ScrollFramePrivate, 1);
- sf->priv = priv;
-
- GTK_WIDGET_SET_FLAGS (sf, GTK_NO_WINDOW);
-
- gtk_container_set_resize_mode (GTK_CONTAINER (sf), GTK_RESIZE_QUEUE);
-
- priv->sb_spacing = 3;
- priv->hsb_policy = GTK_POLICY_ALWAYS;
- priv->vsb_policy = GTK_POLICY_ALWAYS;
- priv->frame_placement = GTK_CORNER_TOP_LEFT;
- priv->shadow_type = GTK_SHADOW_NONE;
-}
-
-/* Set_arg handler for the scroll frame widget */
-static void
-gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- sf = GTK_SCROLL_FRAME (object);
- priv = sf->priv;
-
- switch (arg_id) {
- case ARG_HADJUSTMENT:
- gtk_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_VADJUSTMENT:
- gtk_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_HSCROLLBAR_POLICY:
- gtk_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), priv->vsb_policy);
- break;
-
- case ARG_VSCROLLBAR_POLICY:
- gtk_scroll_frame_set_policy (sf, priv->hsb_policy, GTK_VALUE_ENUM (*arg));
- break;
-
- case ARG_FRAME_PLACEMENT:
- gtk_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg));
- break;
-
- case ARG_SHADOW_TYPE:
- gtk_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg));
- break;
-
- case ARG_SCROLLBAR_SPACING:
- gtk_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg));
- break;
-
- default:
- break;
- }
-}
-
-/* Get_arg handler for the scroll frame widget */
-static void
-gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- sf = GTK_SCROLL_FRAME (object);
- priv = sf->priv;
-
- switch (arg_id) {
- case ARG_HADJUSTMENT:
- GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_hadjustment (sf);
- break;
-
- case ARG_VADJUSTMENT:
- GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_vadjustment (sf);
- break;
-
- case ARG_HSCROLLBAR_POLICY:
- GTK_VALUE_ENUM (*arg) = priv->hsb_policy;
- break;
-
- case ARG_VSCROLLBAR_POLICY:
- GTK_VALUE_ENUM (*arg) = priv->vsb_policy;
- break;
-
- case ARG_FRAME_PLACEMENT:
- GTK_VALUE_ENUM (*arg) = priv->frame_placement;
- break;
-
- case ARG_SHADOW_TYPE:
- GTK_VALUE_ENUM (*arg) = priv->shadow_type;
- break;
-
- case ARG_SCROLLBAR_SPACING:
- GTK_VALUE_UINT (*arg) = priv->sb_spacing;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/* Destroy handler for the scroll frame widget */
-static void
-gtk_scroll_frame_destroy (GtkObject *object)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (object));
-
- sf = GTK_SCROLL_FRAME (object);
- priv = sf->priv;
-
- gtk_widget_unparent (priv->hsb);
- gtk_widget_unparent (priv->vsb);
- gtk_widget_destroy (priv->hsb);
- gtk_widget_destroy (priv->vsb);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* Finalize handler for the scroll frame widget */
-static void
-gtk_scroll_frame_finalize (GtkObject *object)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- sf = GTK_SCROLL_FRAME (object);
- priv = sf->priv;
-
- gtk_widget_unref (priv->hsb);
- gtk_widget_unref (priv->vsb);
-
- g_free (priv);
-
- if (GTK_OBJECT_CLASS (parent_class)->finalize)
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Map handler for the scroll frame widget */
-static void
-gtk_scroll_frame_map (GtkWidget *widget)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (widget));
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
-
- /* chain parent class handler to map self and child */
- if (GTK_WIDGET_CLASS (parent_class)->map)
- (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
-
- if (GTK_WIDGET_VISIBLE (priv->hsb) && !GTK_WIDGET_MAPPED (priv->hsb))
- gtk_widget_map (priv->hsb);
-
- if (GTK_WIDGET_VISIBLE (priv->vsb) && !GTK_WIDGET_MAPPED (priv->vsb))
- gtk_widget_map (priv->vsb);
-}
-
-/* Unmap handler for the scroll frame widget */
-static void
-gtk_scroll_frame_unmap (GtkWidget *widget)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (widget));
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
-
- /* chain parent class handler to unmap self and child */
- if (GTK_WIDGET_CLASS (parent_class)->unmap)
- (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
-
- if (GTK_WIDGET_MAPPED (priv->hsb))
- gtk_widget_unmap (priv->hsb);
-
- if (GTK_WIDGET_MAPPED (priv->vsb))
- gtk_widget_unmap (priv->vsb);
-}
-
-/* Draws the shadow of a scroll frame widget */
-static void
-draw_shadow (GtkScrollFrame *sf, GdkRectangle *area)
-{
- ScrollFramePrivate *priv;
-
- g_assert (area != NULL);
-
- priv = sf->priv;
-
- gtk_paint_shadow (GTK_WIDGET (sf)->style,
- GTK_WIDGET (sf)->window,
- GTK_STATE_NORMAL, priv->shadow_type,
- area, GTK_WIDGET (sf),
- "scroll_frame",
- priv->frame_x, priv->frame_y,
- priv->frame_w, priv->frame_h);
-}
-
-/* Draw handler for the scroll frame widget */
-static void
-gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (widget));
- g_return_if_fail (area != NULL);
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
- bin = GTK_BIN (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- draw_shadow (sf, area);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)
- && gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
-
- if (GTK_WIDGET_VISIBLE (priv->hsb)
- && gtk_widget_intersect (priv->hsb, area, &child_area))
- gtk_widget_draw (priv->hsb, &child_area);
-
- if (GTK_WIDGET_VISIBLE (priv->vsb)
- && gtk_widget_intersect (priv->vsb, area, &child_area))
- gtk_widget_draw (priv->vsb, &child_area);
-}
-
-/* Forall handler for the scroll frame widget */
-static void
-gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals,
- GtkCallback callback, gpointer callback_data)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (container));
- g_return_if_fail (callback != NULL);
-
- sf = GTK_SCROLL_FRAME (container);
- priv = sf->priv;
-
- if (GTK_CONTAINER_CLASS (parent_class)->forall)
- (* GTK_CONTAINER_CLASS (parent_class)->forall) (
- container, include_internals,
- callback, callback_data);
-
- if (include_internals) {
- if (priv->vsb)
- (* callback) (priv->vsb, callback_data);
-
- if (priv->hsb)
- (* callback) (priv->hsb, callback_data);
- }
-}
-
-/* Size_request handler for the scroll frame widget */
-static void
-gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
- GtkBin *bin;
- gint extra_width;
- gint extra_height;
- GtkRequisition hsb_requisition;
- GtkRequisition vsb_requisition;
- GtkRequisition child_requisition;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (widget));
- g_return_if_fail (requisition != NULL);
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
- bin = GTK_BIN (widget);
-
- extra_width = 0;
- extra_height = 0;
-
- requisition->width = GTK_CONTAINER (widget)->border_width * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (priv->shadow_type != GTK_SHADOW_NONE) {
- requisition->width += 2 * widget->style->klass->xthickness;
- requisition->height += 2 * widget->style->klass->ythickness;
- }
-
- gtk_widget_size_request (priv->hsb, &hsb_requisition);
- gtk_widget_size_request (priv->vsb, &vsb_requisition);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- static guint quark_aux_info;
-
- if (!quark_aux_info)
- quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
-
- gtk_widget_size_request (bin->child, &child_requisition);
-
- if (priv->hsb_policy == GTK_POLICY_NEVER)
- requisition->width += child_requisition.width;
- else {
- GtkWidgetAuxInfo *aux_info;
-
- aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child),
- quark_aux_info);
- if (aux_info && aux_info->width > 0) {
- requisition->width += aux_info->width;
- extra_width = -1;
- } else
- requisition->width += vsb_requisition.width;
- }
-
- if (priv->vsb_policy == GTK_POLICY_NEVER)
- requisition->height += child_requisition.height;
- else {
- GtkWidgetAuxInfo *aux_info;
-
- aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child),
- quark_aux_info);
- if (aux_info && aux_info->height > 0) {
- requisition->height += aux_info->height;
- extra_height = -1;
- } else
- requisition->height += hsb_requisition.height;
- }
- }
-
- if (priv->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->hsb)) {
- requisition->width = MAX (requisition->width, hsb_requisition.width);
- if (!extra_height || GTK_WIDGET_VISIBLE (priv->hsb))
- extra_height = priv->sb_spacing + hsb_requisition.height;
- }
-
- if (priv->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->vsb)) {
- requisition->height = MAX (requisition->height, vsb_requisition.height);
- if (!extra_width || GTK_WIDGET_VISIBLE (priv->vsb))
- extra_width = priv->sb_spacing + vsb_requisition.width;
- }
-
- requisition->width += MAX (0, extra_width);
- requisition->height += MAX (0, extra_height);
-}
-
-/* Computes the relative allocation for the scroll frame widget */
-static void
-compute_relative_allocation (GtkWidget *widget, GtkAllocation *allocation)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_assert (widget != NULL);
- g_assert (GTK_IS_SCROLL_FRAME (widget));
- g_assert (allocation != NULL);
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
-
- allocation->x = GTK_CONTAINER (widget)->border_width;
- allocation->y = GTK_CONTAINER (widget)->border_width;
- allocation->width = MAX (1, (gint) widget->allocation.width - allocation->x * 2);
- allocation->height = MAX (1, (gint) widget->allocation.height - allocation->y * 2);
-
- if (priv->vsb_visible) {
- GtkRequisition vsb_requisition;
- gint possible_new_width;
-
- gtk_widget_get_child_requisition (priv->vsb, &vsb_requisition);
-
- if (priv->frame_placement == GTK_CORNER_TOP_RIGHT
- || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT)
- allocation->x += vsb_requisition.width + priv->sb_spacing;
-
- possible_new_width = ((gint) allocation->width
- - ((gint) vsb_requisition.width + priv->sb_spacing));
- allocation->width = MAX (0, possible_new_width);
- }
-
- if (priv->hsb_visible) {
- GtkRequisition hsb_requisition;
- gint possible_new_height;
-
- gtk_widget_get_child_requisition (priv->hsb, &hsb_requisition);
-
- if (priv->frame_placement == GTK_CORNER_BOTTOM_LEFT
- || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT)
- allocation->y += hsb_requisition.height + priv->sb_spacing;
-
- possible_new_height =
- ( ((gint)allocation->height)
- - ((gint)hsb_requisition.height) + ((gint)priv->sb_spacing));
- allocation->height = MAX (0, possible_new_height);
- }
-}
-
-/* Size_allocate handler for the scroll frame widget */
-static void
-gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
- GtkBin *bin;
- GtkAllocation relative_allocation;
- GtkAllocation child_allocation;
- gint xthickness, ythickness;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (widget));
- g_return_if_fail (allocation != NULL);
-
- sf = GTK_SCROLL_FRAME (widget);
- priv = sf->priv;
- bin = GTK_BIN (widget);
-
- widget->allocation = *allocation;
-
- if (priv->hsb_policy == GTK_POLICY_ALWAYS)
- priv->hsb_visible = TRUE;
- else if (priv->hsb_policy == GTK_POLICY_NEVER)
- priv->hsb_visible = FALSE;
-
- if (priv->vsb_policy == GTK_POLICY_ALWAYS)
- priv->vsb_visible = TRUE;
- else if (priv->vsb_policy == GTK_POLICY_NEVER)
- priv->vsb_visible = FALSE;
-
- if (priv->shadow_type == GTK_SHADOW_NONE) {
- xthickness = 0;
- ythickness = 0;
- } else {
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
- }
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- gboolean previous_hvis;
- gboolean previous_vvis;
- guint count = 0;
-
- do {
- gint16 possible_new_size;
-
- compute_relative_allocation (widget, &relative_allocation);
-
- priv->frame_x = relative_allocation.x + allocation->x;
- priv->frame_y = relative_allocation.y + allocation->y;
- priv->frame_w = relative_allocation.width;
- priv->frame_h = relative_allocation.height;
-
- child_allocation.x = priv->frame_x + xthickness;
- child_allocation.y = priv->frame_y + ythickness;
- possible_new_size = priv->frame_w - 2 * xthickness;
- child_allocation.width = MAX(1, possible_new_size);
- possible_new_size = priv->frame_h - 2 * ythickness;
- child_allocation.height = MAX(1, possible_new_size);
-
- previous_hvis = priv->hsb_visible;
- previous_vvis = priv->vsb_visible;
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
-
- /* If, after the first iteration, the hscrollbar and the
- * vscrollbar flip visiblity, then we need both.
- */
- if (count
- && previous_hvis != priv->hsb_visible
- && previous_vvis != priv->vsb_visible) {
- priv->hsb_visible = TRUE;
- priv->vsb_visible = TRUE;
-
- /* a new resize is already queued at this point,
- * so we will immediatedly get reinvoked
- */
- return;
- }
-
- count++;
- } while (previous_hvis != priv->hsb_visible
- || previous_vvis != priv->vsb_visible);
- } else
- compute_relative_allocation (widget, &relative_allocation);
-
- if (priv->hsb_visible) {
- GtkRequisition hscrollbar_requisition;
-
- gtk_widget_get_child_requisition (priv->hsb, &hscrollbar_requisition);
-
- if (!GTK_WIDGET_VISIBLE (priv->hsb))
- gtk_widget_show (priv->hsb);
-
- child_allocation.x = relative_allocation.x;
- if (priv->frame_placement == GTK_CORNER_TOP_LEFT
- || priv->frame_placement == GTK_CORNER_TOP_RIGHT)
- child_allocation.y = (relative_allocation.y
-#if 0
- + relative_allocation.height
- + priv->sb_spacing);
-#else
- + relative_allocation.height);
-#endif
- else
- child_allocation.y = GTK_CONTAINER (sf)->border_width;
-
- child_allocation.width = relative_allocation.width;
- child_allocation.height = hscrollbar_requisition.height;
- child_allocation.x += allocation->x;
- child_allocation.y += allocation->y;
-
- gtk_widget_size_allocate (priv->hsb, &child_allocation);
- } else if (GTK_WIDGET_VISIBLE (priv->hsb))
- gtk_widget_hide (priv->hsb);
-
- if (priv->vsb_visible) {
- GtkRequisition vscrollbar_requisition;
-
- if (!GTK_WIDGET_VISIBLE (priv->vsb))
- gtk_widget_show (priv->vsb);
-
- gtk_widget_get_child_requisition (priv->vsb, &vscrollbar_requisition);
-
- if (priv->frame_placement == GTK_CORNER_TOP_LEFT
- || priv->frame_placement == GTK_CORNER_BOTTOM_LEFT)
- child_allocation.x = (relative_allocation.x
- + relative_allocation.width
- + priv->sb_spacing);
- else
- child_allocation.x = GTK_CONTAINER (sf)->border_width;
-
- child_allocation.y = relative_allocation.y;
- child_allocation.width = vscrollbar_requisition.width;
- child_allocation.height = relative_allocation.height;
- child_allocation.x += allocation->x;
- child_allocation.y += allocation->y;
-
- gtk_widget_size_allocate (priv->vsb, &child_allocation);
- } else if (GTK_WIDGET_VISIBLE (priv->vsb))
- gtk_widget_hide (priv->vsb);
-}
-
-/* Expose handler for the scroll frame widget */
-static gint
-gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GtkScrollFrame *sf;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SCROLL_FRAME (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- sf = GTK_SCROLL_FRAME (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- draw_shadow (sf, &event->area);
-
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
-
- return FALSE;
-}
-
-/* Add handler for the scroll frame widget */
-static void
-gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
- GtkBin *bin;
-
- sf = GTK_SCROLL_FRAME (container);
- priv = sf->priv;
- bin = GTK_BIN (container);
- g_return_if_fail (bin->child == NULL);
-
- bin->child = child;
- gtk_widget_set_parent (child, GTK_WIDGET (bin));
-
- /* this is a temporary message */
- if (!gtk_widget_set_scroll_adjustments (child,
- gtk_range_get_adjustment (GTK_RANGE (priv->hsb)),
- gtk_range_get_adjustment (GTK_RANGE (priv->vsb))))
- g_warning ("gtk_scroll_frame_add(): cannot add non scrollable widget "
- "use gtk_scroll_frame_add_with_viewport() instead");
-
- if (GTK_WIDGET_REALIZED (child->parent))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child)) {
- if (GTK_WIDGET_MAPPED (child->parent))
- gtk_widget_map (child);
-
- gtk_widget_queue_resize (child);
- }
-}
-
-/* Remove method for the scroll frame widget */
-static void
-gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (container));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_BIN (container)->child == child);
-
- gtk_widget_set_scroll_adjustments (child, NULL, NULL);
-
- /* chain parent class handler to remove child */
- if (GTK_CONTAINER_CLASS (parent_class)->remove)
- (* GTK_CONTAINER_CLASS (parent_class)->remove) (container, child);
-}
-
-/**
- * gtk_scroll_frame_new:
- * @hadj: If non-NULL, the adjustment to use for horizontal scrolling.
- * @vadj: If non-NULL, the adjustment to use for vertical scrolling.
- *
- * Creates a new scroll frame widget.
- *
- * Return value: The newly-created scroll frame widget.
- **/
-GtkWidget *
-gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj)
-{
- if (hadj)
- g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL);
-
- if (vadj)
- g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL);
-
- return gtk_widget_new (GTK_TYPE_SCROLL_FRAME,
- "hadjustment", hadj,
- "vadjustment", vadj,
- NULL);
-}
-
-/* Callback used when one of the scroll frame widget's adjustments changes */
-static void
-adjustment_changed (GtkAdjustment *adj, gpointer data)
-{
- GtkScrollFrame *sf;
- ScrollFramePrivate *priv;
-
- g_return_if_fail (adj != NULL);
- g_return_if_fail (GTK_IS_ADJUSTMENT (adj));
- g_return_if_fail (data != NULL);
-
- sf = GTK_SCROLL_FRAME (data);
- priv = sf->priv;
-
- if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->hsb))) {
- if (priv->hsb_policy == GTK_POLICY_AUTOMATIC) {
- gboolean visible;
-
- visible = priv->hsb_visible;
- priv->hsb_visible = (adj->upper - adj->lower > adj->page_size);
- if (priv->hsb_visible != visible)
- gtk_widget_queue_resize (GTK_WIDGET (sf));
- }
- } else if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->vsb))) {
- if (priv->vsb_policy == GTK_POLICY_AUTOMATIC) {
- gboolean visible;
-
- visible = priv->vsb_visible;
- priv->vsb_visible = (adj->upper - adj->lower > adj->page_size);
- if (priv->vsb_visible != visible)
- gtk_widget_queue_resize (GTK_WIDGET (sf));
- }
- }
-}
-
-/**
- * gtk_scroll_frame_set_hadjustment:
- * @sf: A scroll frame widget.
- * @adj: An adjustment.
- *
- * Sets the adjustment to be used for horizontal scrolling in a scroll frame
- * widget.
- **/
-void
-gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
-
- priv = sf->priv;
-
- if (adj)
- g_return_if_fail (GTK_IS_ADJUSTMENT (adj));
- else
- adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL));
-
- if (!priv->hsb) {
- gtk_widget_push_composite_child ();
- priv->hsb = gtk_hscrollbar_new (adj);
- gtk_widget_set_composite_name (priv->hsb, "hscrollbar");
- gtk_widget_pop_composite_child ();
-
- gtk_widget_set_parent (priv->hsb, GTK_WIDGET (sf));
- gtk_widget_ref (priv->hsb);
- gtk_widget_show (priv->hsb);
- } else {
- GtkAdjustment *old_adj;
-
- old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb));
- if (old_adj == adj)
- return;
-
- gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj),
- GTK_SIGNAL_FUNC (adjustment_changed),
- sf);
- gtk_range_set_adjustment (GTK_RANGE (priv->hsb), adj);
- }
-
- adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb));
- gtk_signal_connect (GTK_OBJECT (adj),
- "changed",
- GTK_SIGNAL_FUNC (adjustment_changed),
- sf);
- adjustment_changed (adj, sf);
-
- if (GTK_BIN (sf)->child)
- gtk_widget_set_scroll_adjustments (
- GTK_BIN (sf)->child,
- gtk_range_get_adjustment (GTK_RANGE (priv->hsb)),
- gtk_range_get_adjustment (GTK_RANGE (priv->vsb)));
-}
-
-/**
- * gtk_scroll_frame_set_vadjustment:
- * @sf: A scroll frame widget.
- * @adj: An adjustment.
- *
- * Sets the adjustment to be used for vertical scrolling in a scroll frame
- * widget.
- **/
-void
-gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
-
- priv = sf->priv;
-
- if (adj)
- g_return_if_fail (GTK_IS_ADJUSTMENT (adj));
- else
- adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL));
-
- if (!priv->vsb) {
- gtk_widget_push_composite_child ();
- priv->vsb = gtk_vscrollbar_new (adj);
- gtk_widget_set_composite_name (priv->vsb, "vscrollbar");
- gtk_widget_pop_composite_child ();
-
- gtk_widget_set_parent (priv->vsb, GTK_WIDGET (sf));
- gtk_widget_ref (priv->vsb);
- gtk_widget_show (priv->vsb);
- } else {
- GtkAdjustment *old_adj;
-
- old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb));
- if (old_adj == adj)
- return;
-
- gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj),
- GTK_SIGNAL_FUNC (adjustment_changed),
- sf);
- gtk_range_set_adjustment (GTK_RANGE (priv->vsb), adj);
- }
-
- adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb));
- gtk_signal_connect (GTK_OBJECT (adj),
- "changed",
- GTK_SIGNAL_FUNC (adjustment_changed),
- sf);
- adjustment_changed (adj, sf);
-
- if (GTK_BIN (sf)->child)
- gtk_widget_set_scroll_adjustments (
- GTK_BIN (sf)->child,
- gtk_range_get_adjustment (GTK_RANGE (priv->hsb)),
- gtk_range_get_adjustment (GTK_RANGE (priv->vsb)));
-}
-
-/**
- * gtk_scroll_frame_get_hadjustment:
- * @sf: A scroll frame widget.
- *
- * Queries the horizontal adjustment of a scroll frame widget.
- *
- * Return value: The horizontal adjustment of the scroll frame, or NULL if none.
- **/
-GtkAdjustment *
-gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf)
-{
- ScrollFramePrivate *priv;
-
- g_return_val_if_fail (sf != NULL, NULL);
- g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL);
-
- priv = sf->priv;
-
- return priv->hsb ? gtk_range_get_adjustment (GTK_RANGE (priv->hsb)) : NULL;
-}
-
-/**
- * gtk_scroll_frame_get_vadjustment:
- * @sf: A scroll frame widget.
- *
- * Queries the vertical adjustment of a scroll frame widget.
- *
- * Return value: The vertical adjustment of the scroll frame, or NULL if none.
- **/
-GtkAdjustment *
-gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf)
-{
- ScrollFramePrivate *priv;
-
- g_return_val_if_fail (sf != NULL, NULL);
- g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL);
-
- priv = sf->priv;
-
- return priv->vsb ? gtk_range_get_adjustment (GTK_RANGE (priv->vsb)) : NULL;
-}
-
-/**
- * gtk_scroll_frame_set_policy:
- * @sf: A scroll frame widget.
- * @hsb_policy: Policy for the horizontal scrollbar.
- * @vsb_policy: Policy for the vertical scrollbar.
- *
- * Sets the scrollbar policies of a scroll frame widget. These determine when
- * the scrollbars are to be shown or hidden.
- **/
-void
-gtk_scroll_frame_set_policy (GtkScrollFrame *sf,
- GtkPolicyType hsb_policy,
- GtkPolicyType vsb_policy)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
-
- priv = sf->priv;
-
- if (priv->hsb_policy == hsb_policy && priv->vsb_policy == vsb_policy)
- return;
-
- priv->hsb_policy = hsb_policy;
- priv->vsb_policy = vsb_policy;
-
- gtk_widget_queue_resize (GTK_WIDGET (sf));
-}
-
-/**
- * gtk_scroll_frame_set_placement:
- * @sf: A scroll frame widget.
- * @frame_placement: Placement for the frame.
- *
- * Sets the placement of a scroll frame widget's frame with respect to its
- * scrollbars.
- **/
-void
-gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
-
- priv = sf->priv;
-
- if (priv->frame_placement == frame_placement)
- return;
-
- priv->frame_placement = frame_placement;
- gtk_widget_queue_resize (GTK_WIDGET (sf));
-}
-
-/**
- * gtk_scroll_frame_set_shadow_type:
- * @sf: A scroll frame widget.
- * @shadow_type: A shadow type.
- *
- * Sets the shadow type of a scroll frame widget. You can use this when you
- * insert a child that does not paint a frame on its own.
- **/
-void
-gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
- g_return_if_fail (shadow_type <= GTK_SHADOW_ETCHED_OUT);
-
- priv = sf->priv;
-
- if (priv->shadow_type == shadow_type)
- return;
-
- priv->shadow_type = shadow_type;
- gtk_widget_queue_resize (GTK_WIDGET (sf));
-}
-
-/**
- * gtk_scroll_frame_set_scrollbar_spacing:
- * @sf: A scroll frame widget.
- * @spacing: Desired spacing in pixels.
- *
- * Sets the spacing between the frame and the scrollbars of a scroll frame
- * widget.
- **/
-void
-gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing)
-{
- ScrollFramePrivate *priv;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
-
- priv = sf->priv;
-
- if (priv->sb_spacing == spacing)
- return;
-
- priv->sb_spacing = spacing;
- gtk_widget_queue_resize (GTK_WIDGET (sf));
-}
-
-/**
- * gtk_scroll_frame_add_with_viewport:
- * @sf: A scroll frame widget.
- * @child: A widget.
- *
- * Creates a &GtkViewport and puts the specified child inside it, thus allowing
- * the viewport to be scrolled by the scroll frame widget. This is meant to be
- * used only when a child does not support the scrolling interface.
- **/
-void
-gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child)
-{
- ScrollFramePrivate *priv;
- GtkBin *bin;
- GtkWidget *viewport;
-
- g_return_if_fail (sf != NULL);
- g_return_if_fail (GTK_IS_SCROLL_FRAME (sf));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
-
- priv = sf->priv;
- bin = GTK_BIN (sf);
-
- if (bin->child != NULL) {
- g_return_if_fail (GTK_IS_VIEWPORT (bin->child));
- g_return_if_fail (GTK_BIN (bin->child)->child == NULL);
-
- viewport = bin->child;
- } else {
- viewport = gtk_viewport_new (gtk_scroll_frame_get_hadjustment (sf),
- gtk_scroll_frame_get_vadjustment (sf));
- gtk_container_add (GTK_CONTAINER (sf), viewport);
- }
-
- gtk_widget_show (viewport);
- gtk_container_add (GTK_CONTAINER (viewport), child);
-}
diff --git a/libnautilus/gtkscrollframe.h b/libnautilus/gtkscrollframe.h
deleted file mode 100644
index 749417a8b..000000000
--- a/libnautilus/gtkscrollframe.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This 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.
- *
- * This 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 this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999, 2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_SCROLL_FRAME_H__
-#define __GTK_SCROLL_FRAME_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ())
-#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \
- GTK_TYPE_SCROLL_FRAME, GtkScrollFrame))
-#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
- GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass))
-#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \
- GTK_TYPE_SCROLL_FRAME))
-#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
- GTK_TYPE_SCROLL_FRAME))
-
-
-typedef struct _GtkScrollFrame GtkScrollFrame;
-typedef struct _GtkScrollFrameClass GtkScrollFrameClass;
-
-struct _GtkScrollFrame
-{
- GtkBin bin;
-
- /* Private data */
- gpointer priv;
-};
-
-struct _GtkScrollFrameClass
-{
- GtkBinClass parent_class;
-};
-
-
-GtkType gtk_scroll_frame_get_type (void);
-GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj);
-
-void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
-void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
-
-GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf);
-GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf);
-
-void gtk_scroll_frame_set_policy (GtkScrollFrame *sf,
- GtkPolicyType hsb_policy,
- GtkPolicyType vsb_policy);
-
-void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement);
-void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type);
-void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing);
-
-void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SCROLL_FRAME_H__ */
diff --git a/libnautilus/libnautilus.h b/libnautilus/libnautilus.h
index ef67db201..5706048d3 100644
--- a/libnautilus/libnautilus.h
+++ b/libnautilus/libnautilus.h
@@ -31,10 +31,8 @@
#include <bonobo.h>
#include <libnautilus/nautilus-view-component.h>
-#include <libnautilus/nautilus-alloc.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/ntl-view-frame.h>
-#include <libnautilus/ntl-meta-view-frame.h>
-#include <libnautilus/ntl-content-view-frame.h>
+#include <libnautilus/nautilus-view-frame.h>
+#include <libnautilus/nautilus-meta-view-frame.h>
+#include <libnautilus/nautilus-content-view-frame.h>
#endif /* LIBNAUTILUS_H */
diff --git a/libnautilus/nautilus-alloc.h b/libnautilus/nautilus-alloc.h
deleted file mode 100644
index c98eb9f66..000000000
--- a/libnautilus/nautilus-alloc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- Nautilus extensions to things like malloc and alloca.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifndef g_alloca
-#define g_alloca alloca
-#endif
diff --git a/libnautilus/nautilus-background-canvas-group.c b/libnautilus/nautilus-background-canvas-group.c
deleted file mode 100644
index 06cb28b8e..000000000
--- a/libnautilus/nautilus-background-canvas-group.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-background.c: Object for the background of a widget.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-background-canvas-group.h"
-
-#include <libgnomeui/gnome-canvas.h>
-#include "nautilus-background.h"
-#include "nautilus-gtk-macros.h"
-
-static void nautilus_background_canvas_group_initialize_class (gpointer klass);
-static void nautilus_background_canvas_group_initialize (gpointer object, gpointer klass);
-static void nautilus_background_canvas_group_destroy (GtkObject *object);
-static void nautilus_background_canvas_group_finalize (GtkObject *object);
-static void nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackgroundCanvasGroup, nautilus_background_canvas_group, GNOME_TYPE_CANVAS_GROUP)
-
-static void
-nautilus_background_canvas_group_initialize_class (gpointer klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *canvas_item_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- canvas_item_class = GNOME_CANVAS_ITEM_CLASS (klass);
-
- object_class->destroy = nautilus_background_canvas_group_destroy;
- object_class->finalize = nautilus_background_canvas_group_finalize;
-
- canvas_item_class->draw = nautilus_background_canvas_group_draw;
-}
-
-static void
-nautilus_background_canvas_group_initialize (gpointer object, gpointer klass)
-{
-}
-
-static void
-nautilus_background_canvas_group_destroy (GtkObject *object)
-{
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static void
-nautilus_background_canvas_group_finalize (GtkObject *object)
-{
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int drawable_corner_x, int drawable_corner_y,
- int drawable_width, int drawable_height)
-{
- NautilusBackground *background;
-
- /* Draw the background. */
- background = nautilus_get_widget_background(GTK_WIDGET (item->canvas));
- if (background != NULL) {
- GdkGC *gc;
- GdkRectangle rectangle;
-
- /* Create a new gc each time.
- If this is a speed problem, we can create one and keep it around,
- but it's a bit more complicated to ensure that it's always compatible
- with whatever drawable is passed in.
- */
- gc = gdk_gc_new (drawable);
-
- /* The rectangle is the size of the entire viewed area of the canvas.
- The corner is determined by the current scroll position of the
- GtkLayout, and the size is determined by the current size of the widget.
- Since 0,0 is the corner of the drawable, we need to offset the rectangle
- so it's relative to the drawable's coordinates.
- */
- rectangle.x = GTK_LAYOUT (item->canvas)->xoffset - drawable_corner_x;
- rectangle.y = GTK_LAYOUT (item->canvas)->yoffset - drawable_corner_y;
- rectangle.width = GTK_WIDGET (item->canvas)->allocation.width;
- rectangle.height = GTK_WIDGET (item->canvas)->allocation.height;
-
- nautilus_background_draw (background, drawable, gc, &rectangle,
- -drawable_corner_x, -drawable_corner_y);
-
- gdk_gc_unref (gc);
- }
-
- /* Call through to the GnomeCanvasGroup implementation, which will draw all
- the canvas items.
- */
- NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, draw,
- (item, drawable,
- drawable_corner_x, drawable_corner_y,
- drawable_width, drawable_height));
-}
diff --git a/libnautilus/nautilus-background-canvas-group.h b/libnautilus/nautilus-background-canvas-group.h
deleted file mode 100644
index 7360cfd1f..000000000
--- a/libnautilus/nautilus-background-canvas-group.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-background-canvas-group.h: Class used internally by
- NautilusBackground to add a background to a canvas.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_BACKGROUND_CANVAS_GROUP_H
-#define NAUTILUS_BACKGROUND_CANVAS_GROUP_H
-
-#include "nautilus-background.h"
-#include <libgnomeui/gnome-canvas.h>
-
-/* A NautilusBackgroundCanvasGroup is used internally by NautilusBackground to change
- the color of a canvas. The reason we have to change the class of a canvas group is
- that the cleanest way to hook into the code that erases the canvas is to be the
- root canvas group. But the canvas class creates the root object and doesn't allow
- it to be destroyed, so we change the class of the root object in place.
-
- A future version of GnomeCanvas may allow a nicer way of hooking in to the code
- that draws the background, and then we can get rid of this class.
-
- This class is private to NautilusBackground.
-*/
-
-typedef GnomeCanvasGroup NautilusBackgroundCanvasGroup;
-typedef GnomeCanvasGroupClass NautilusBackgroundCanvasGroupClass;
-
-#define NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP \
- (nautilus_background_canvas_group_get_type ())
-#define NAUTILUS_BACKGROUND_CANVAS_GROUP(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP, NautilusBackgroundCanvasGroup))
-#define NAUTILUS_BACKGROUND_CANVAS_GROUP_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP, NautilusBackgroundCanvasGroupClass))
-#define NAUTILUS_IS_BACKGROUND_CANVAS_GROUP(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP))
-#define NAUTILUS_IS_BACKGROUND_CANVAS_GROUP_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP))
-
-GtkType nautilus_background_canvas_group_get_type (void);
-
-#endif /* NAUTILUS_BACKGROUND_CANVAS_GROUP_H */
diff --git a/libnautilus/nautilus-background.c b/libnautilus/nautilus-background.c
deleted file mode 100644
index 484f245f7..000000000
--- a/libnautilus/nautilus-background.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-background.c: Object for the background of a widget.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-background.h"
-
-#include <gtk/gtksignal.h>
-#include "nautilus-gdk-extensions.h"
-#include "nautilus-gdk-pixbuf-extensions.h"
-#include "nautilus-background-canvas-group.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-string.h"
-
-static void nautilus_background_initialize_class (gpointer klass);
-static void nautilus_background_initialize (gpointer object,
- gpointer klass);
-static void nautilus_background_destroy (GtkObject *object);
-static void nautilus_background_draw_flat_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- char *detail,
- int x,
- int y,
- int width,
- int height);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackground, nautilus_background, GTK_TYPE_OBJECT)
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-struct NautilusBackgroundDetails
-{
- char *color;
- char *tile_image_uri;
- GdkPixbuf *tile_image;
- NautilusPixbufLoadHandle *load_tile_image_handle;
-};
-
-static void
-nautilus_background_initialize_class (gpointer klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_FIRST | GTK_RUN_NO_RECURSE,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusBackgroundClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE,
- 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-
- object_class->destroy = nautilus_background_destroy;
-}
-
-static void
-nautilus_background_initialize (gpointer object, gpointer klass)
-{
- NautilusBackground *background;
-
- background = NAUTILUS_BACKGROUND(object);
-
- background->details = g_new0 (NautilusBackgroundDetails, 1);
-}
-
-static void
-nautilus_background_destroy (GtkObject *object)
-{
- NautilusBackground *background;
-
- background = NAUTILUS_BACKGROUND (object);
-
- nautilus_cancel_gdk_pixbuf_load (background->details->load_tile_image_handle);
-
- g_free (background->details->color);
- g_free (background->details->tile_image_uri);
- if (background->details->tile_image != NULL) {
- gdk_pixbuf_unref (background->details->tile_image);
- }
- g_free (background->details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-NautilusBackground *
-nautilus_background_new (void)
-{
- return NAUTILUS_BACKGROUND (gtk_type_new (NAUTILUS_TYPE_BACKGROUND));
-}
-
-void
-nautilus_background_draw (NautilusBackground *background,
- GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- int origin_x,
- int origin_y)
-{
- char *start_color_spec, *end_color_spec;
- guint32 start_rgb, end_rgb;
- gboolean horizontal_gradient;
-
- if (background->details->tile_image != NULL) {
- nautilus_gdk_pixbuf_render_to_drawable_tiled (background->details->tile_image,
- drawable,
- gc,
- rectangle,
- GDK_RGB_DITHER_NORMAL,
- origin_x, origin_y);
- } else {
- start_color_spec = nautilus_gradient_get_start_color_spec (background->details->color);
- end_color_spec = nautilus_gradient_get_end_color_spec (background->details->color);
- horizontal_gradient = nautilus_gradient_is_horizontal (background->details->color);
-
- start_rgb = nautilus_parse_rgb_with_white_default (start_color_spec);
- end_rgb = nautilus_parse_rgb_with_white_default (end_color_spec);
-
- g_free (start_color_spec);
- g_free (end_color_spec);
-
- nautilus_fill_rectangle_with_gradient (drawable,
- gc,
- rectangle,
- start_rgb,
- end_rgb,
- horizontal_gradient);
- }
-}
-
-char *
-nautilus_background_get_color (NautilusBackground *background)
-{
- g_return_val_if_fail (NAUTILUS_IS_BACKGROUND (background), NULL);
-
- return g_strdup (background->details->color);
-}
-
-char *
-nautilus_background_get_tile_image_uri (NautilusBackground *background)
-{
- g_return_val_if_fail (NAUTILUS_IS_BACKGROUND (background), NULL);
-
- return g_strdup (background->details->tile_image_uri);
-}
-
-void
-nautilus_background_set_color (NautilusBackground *background,
- const char *color)
-{
- g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
-
- if (nautilus_strcmp (background->details->color, color) == 0) {
- return;
- }
-
- g_free (background->details->color);
- background->details->color = g_strdup (color);
-
- gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]);
-}
-
-static void
-load_image_callback (GnomeVFSResult error,
- GdkPixbuf *pixbuf,
- gpointer callback_data)
-{
- NautilusBackground *background;
-
- background = NAUTILUS_BACKGROUND (callback_data);
-
- g_assert (background->details->tile_image == NULL);
- g_assert (background->details->load_tile_image_handle != NULL);
-
- background->details->load_tile_image_handle = NULL;
-
- /* Just ignore errors. */
- if (pixbuf == NULL) {
- return;
- }
-
- gdk_pixbuf_ref (pixbuf);
- background->details->tile_image = pixbuf;
-
- gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]);
-}
-
-static void
-start_loading_tile_image (NautilusBackground *background)
-{
- if (background->details->tile_image_uri == NULL) {
- return;
- }
-
- background->details->load_tile_image_handle =
- nautilus_gdk_pixbuf_load_async (background->details->tile_image_uri,
- load_image_callback,
- background);
-}
-
-void
-nautilus_background_set_tile_image_uri (NautilusBackground *background,
- const char *image_uri)
-{
- g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
-
- if (nautilus_strcmp (background->details->tile_image_uri, image_uri) == 0) {
- return;
- }
-
- nautilus_cancel_gdk_pixbuf_load (background->details->load_tile_image_handle);
- background->details->load_tile_image_handle = NULL;
-
- g_free (background->details->tile_image_uri);
- if (background->details->tile_image != NULL) {
- gdk_pixbuf_unref (background->details->tile_image);
- background->details->tile_image = NULL;
- }
- background->details->tile_image_uri = g_strdup (image_uri);
- start_loading_tile_image (background);
-
- gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]);
-}
-
-static GtkStyleClass *
-nautilus_gtk_style_get_default_class (void)
-{
- static GtkStyleClass *default_class;
- GtkStyle *style;
-
- if (default_class == NULL) {
- style = gtk_style_new ();
- default_class = style->klass;
- gtk_style_unref (style);
- }
-
- return default_class;
-}
-
-static void
-nautilus_gdk_window_update_sizes (GdkWindow *window, int *width, int *height)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (width != NULL);
- g_return_if_fail (height != NULL);
-
- if (*width == -1 && *height == -1) {
- gdk_window_get_size (window, width, height);
- } else if (*width == -1) {
- gdk_window_get_size (window, width, NULL);
- } else if (*height == -1) {
- gdk_window_get_size (window, NULL, height);
- }
-}
-
-static void
-nautilus_background_draw_flat_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- char *detail,
- int x,
- int y,
- int width,
- int height)
-{
- gboolean call_parent;
- NautilusBackground *background;
- GdkGC *gc;
- GdkRectangle rectangle;
-
- call_parent = TRUE;
-
- background = NULL;
- if (state_type == GTK_STATE_NORMAL) {
- background = nautilus_get_widget_background (widget);
- if (background != NULL) {
- if (nautilus_gradient_is_gradient (background->details->color)) {
- call_parent = FALSE;
- }
- }
- }
-
- if (call_parent) {
- (* nautilus_gtk_style_get_default_class()->draw_flat_box)
- (style, window, state_type, shadow_type, area, widget,
- detail, x, y, width, height);
- return;
- }
-
- gc = gdk_gc_new (window);
-
- nautilus_gdk_window_update_sizes (window, &width, &height);
-
- rectangle.x = x;
- rectangle.y = y;
- rectangle.width = width;
- rectangle.height = height;
-
- nautilus_background_draw (background, window, gc,
- &rectangle, 0, 0);
-
- gdk_gc_unref (gc);
-}
-
-static GtkStyleClass *
-nautilus_background_get_gtk_style_class (void)
-{
- static GtkStyleClass *klass;
-
- if (klass == NULL) {
- static GtkStyleClass klass_storage;
-
- klass = &klass_storage;
- *klass = *nautilus_gtk_style_get_default_class ();
-
- klass->draw_flat_box = nautilus_background_draw_flat_box;
- }
-
- return klass;
-}
-
-static void
-nautilus_background_set_widget_style (NautilusBackground *background,
- GtkWidget *widget)
-{
- GtkStyle *style;
- char *start_color_spec;
- GdkColor color;
-
- g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- style = gtk_widget_get_style (widget);
-
- /* Make a copy of the style. */
- style = gtk_style_copy (style);
-
- /* Give it the special class that allows it to draw gradients. */
- style->klass = nautilus_background_get_gtk_style_class ();
-
- /* Set up the colors in the style. */
- start_color_spec = nautilus_gradient_get_start_color_spec (background->details->color);
- nautilus_gdk_color_parse_with_white_default (start_color_spec, &color);
- g_free (start_color_spec);
- style->bg[GTK_STATE_NORMAL] = color;
- style->base[GTK_STATE_NORMAL] = color;
- style->bg[GTK_STATE_ACTIVE] = color;
- style->base[GTK_STATE_ACTIVE] = color;
-
- /* Put the style in the widget. */
- gtk_widget_set_style (widget, style);
- gtk_style_unref (style);
-}
-
-static void
-nautilus_background_set_up_canvas (GtkWidget *widget)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- /* Attach ourselves to a canvas in a way that will work.
- Changing the style is not sufficient.
-
- Since there's no signal to override in GnomeCanvas to control
- drawing the background, we change the class of the canvas root.
- This gives us a chance to draw the background before any of the
- objects draw themselves, and has no effect on the bounds or
- anything related to scrolling.
-
- We settled on this after less-than-thrilling results using a
- canvas item as the background. The canvas item contributed to
- the bounds of the canvas and had to constantly be resized.
- */
- if (GNOME_IS_CANVAS (widget)) {
- g_assert (GTK_OBJECT (GNOME_CANVAS (widget)->root)->klass
- == gtk_type_class (GNOME_TYPE_CANVAS_GROUP)
- || GTK_OBJECT (GNOME_CANVAS (widget)->root)->klass
- == gtk_type_class (NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP));
-
- GTK_OBJECT (GNOME_CANVAS (widget)->root)->klass =
- gtk_type_class (NAUTILUS_TYPE_BACKGROUND_CANVAS_GROUP);
- }
-}
-
-static void
-nautilus_widget_background_changed (GtkWidget *widget, NautilusBackground *background)
-{
- nautilus_background_set_widget_style (background, widget);
- nautilus_background_set_up_canvas (widget);
-
- gtk_widget_queue_clear (widget);
-}
-
-/* Gets the background attached to a widget.
-
- If the widget doesn't already have a NautilusBackground object,
- this will create one. To change the widget's background, you can
- just call nautilus_background methods on the widget.
-
- Later, we might want a call to find out if we already have a background,
- or a way to share the same background among multiple widgets; both would
- be straightforward.
-*/
-NautilusBackground *
-nautilus_get_widget_background (GtkWidget *widget)
-{
- gpointer data;
- NautilusBackground *background;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- /* Check for an existing background. */
- data = gtk_object_get_data (GTK_OBJECT (widget), "nautilus_background");
- if (data != NULL) {
- g_assert (NAUTILUS_IS_BACKGROUND (data));
- return data;
- }
-
- /* Store the background in the widget's data. */
- background = nautilus_background_new ();
- gtk_object_set_data_full (GTK_OBJECT (widget), "nautilus_background",
- background, (GtkDestroyNotify) gtk_object_unref);
- gtk_object_ref (GTK_OBJECT (background));
- gtk_object_sink (GTK_OBJECT (background));
-
- /* Arrange to get the signal whenever the background changes. */
- gtk_signal_connect_object_while_alive (GTK_OBJECT (background), "changed",
- nautilus_widget_background_changed,
- GTK_OBJECT (widget));
- nautilus_widget_background_changed (widget, background);
-
- return background;
-}
-
-void
-nautilus_background_receive_dropped_color (NautilusBackground *background,
- GtkWidget *widget,
- int drop_location_x,
- int drop_location_y,
- const GtkSelectionData *selection_data)
-{
- guint16 *channels;
- char *color_spec;
- char *new_gradient_spec;
- int left_border, right_border, top_border, bottom_border;
-
- g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (selection_data != NULL);
-
- /* Convert the selection data into a color spec. */
- if (selection_data->length != 8 || selection_data->format != 16) {
- g_warning ("received invalid color data");
- return;
- }
- channels = (guint16 *) selection_data->data;
- color_spec = g_strdup_printf ("rgb:%04hX/%04hX/%04hX", channels[0], channels[1], channels[2]);
-
- /* Figure out if the color was dropped close enough to an edge to create a gradient.
- For the moment, this is hard-wired, but later the widget will have to have some
- say in where the borders are.
- */
- left_border = 32;
- right_border = widget->allocation.width - 32;
- top_border = 32;
- bottom_border = widget->allocation.height - 32;
- if (drop_location_x < left_border && drop_location_x <= right_border) {
- new_gradient_spec = nautilus_gradient_set_left_color_spec (background->details->color, color_spec);
- } else if (drop_location_x >= left_border && drop_location_x > right_border) {
- new_gradient_spec = nautilus_gradient_set_right_color_spec (background->details->color, color_spec);
- } else if (drop_location_y < top_border && drop_location_y <= bottom_border) {
- new_gradient_spec = nautilus_gradient_set_top_color_spec (background->details->color, color_spec);
- } else if (drop_location_y >= top_border && drop_location_y > bottom_border) {
- new_gradient_spec = nautilus_gradient_set_bottom_color_spec (background->details->color, color_spec);
- } else {
- new_gradient_spec = g_strdup (color_spec);
- }
-
- g_free (color_spec);
-
- nautilus_background_set_color (background, new_gradient_spec);
- nautilus_background_set_tile_image_uri (background, NULL);
-
- g_free (new_gradient_spec);
-}
-
-/* self check code */
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-void
-nautilus_self_check_background (void)
-{
- NautilusBackground *background;
-
- background = nautilus_background_new ();
-
- nautilus_background_set_color (background, NULL);
- nautilus_background_set_color (background, "");
- nautilus_background_set_color (background, "red");
- nautilus_background_set_color (background, "red-blue");
- nautilus_background_set_color (background, "red-blue:h");
-
- gtk_object_unref (GTK_OBJECT (background));
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-background.h b/libnautilus/nautilus-background.h
deleted file mode 100644
index 45690c12d..000000000
--- a/libnautilus/nautilus-background.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-background.h: Object for the background of a widget.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_BACKGROUND_H
-#define NAUTILUS_BACKGROUND_H
-
-/* Windows for Nautilus can contain backgrounds that are either tiled
- with an image, a solid color, or a color gradient. This class manages
- the process of loading the image if necessary and parsing the string
- that specifies either a color or color gradient.
-
- The color or gradient is always present, even if there's a tiled image
- on top of it. This is used when the tiled image can't be loaded for
- some reason (or just has not been loaded yet).
-
- The NautilusBackground object is easier to modify than a GtkStyle.
- You can just call nautilus_get_window_background and modify the
- returned background directly, unlike a style, which must be copied,
- modified and then set.
-*/
-
-#include <gdk/gdktypes.h>
-#include <gtk/gtkwidget.h>
-
-typedef struct NautilusBackground NautilusBackground;
-typedef struct NautilusBackgroundClass NautilusBackgroundClass;
-
-#define NAUTILUS_TYPE_BACKGROUND \
- (nautilus_background_get_type ())
-#define NAUTILUS_BACKGROUND(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_BACKGROUND, NautilusBackground))
-#define NAUTILUS_BACKGROUND_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_BACKGROUND, NautilusBackgroundClass))
-#define NAUTILUS_IS_BACKGROUND(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_BACKGROUND))
-#define NAUTILUS_IS_BACKGROUND_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_BACKGROUND))
-
-GtkType nautilus_background_get_type (void);
-NautilusBackground *nautilus_background_new (void);
-
-/* Calls to change a background. */
-void nautilus_background_set_color (NautilusBackground *background,
- const char *color_or_gradient);
-void nautilus_background_set_tile_image_uri (NautilusBackground *background,
- const char *image_uri);
-
-/* Calls to interrogate the current state of a background. */
-char * nautilus_background_get_color (NautilusBackground *background);
-char * nautilus_background_get_tile_image_uri (NautilusBackground *background);
-
-/* Explicitly fills a rectangle with a background. */
-void nautilus_background_draw (NautilusBackground *background,
- GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- int origin_x,
- int origin_y);
-
-/* Handles a dragged color being dropped on a widget to change the background color. */
-void nautilus_background_receive_dropped_color (NautilusBackground *background,
- GtkWidget *widget,
- int drop_location_x,
- int drop_location_y,
- const GtkSelectionData *dropped_color);
-
-/* Gets or creates a background so that it's attached to a widget. */
-NautilusBackground *nautilus_get_widget_background (GtkWidget *widget);
-
-typedef struct NautilusBackgroundDetails NautilusBackgroundDetails;
-
-struct NautilusBackground
-{
- GtkObject object;
- NautilusBackgroundDetails *details;
-};
-
-struct NautilusBackgroundClass
-{
- GtkObjectClass parent_class;
-
- /* This signal is emitted when the background image is
- finished loading. This allows a window to draw with a
- color background if the image takes a lot time to load.
- */
- void (* changed) (NautilusBackground *);
-};
-
-#endif /* NAUTILUS_BACKGROUND_H */
diff --git a/libnautilus/nautilus-bonobo-extensions.c b/libnautilus/nautilus-bonobo-extensions.c
deleted file mode 100644
index 2fbfb2051..000000000
--- a/libnautilus/nautilus-bonobo-extensions.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bonobo-extensions.c - implementation of new functions that conceptually
- belong in bonobo. Perhaps some of these will be
- actually rolled into bonobo someday.
-
- 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 "nautilus-bonobo-extensions.h"
-
-
-/**
- * nautilus_bonobo_ui_handler_menu_toggle_appearance
- *
- * Changes a toggleable bonobo menu item's apparent state
- * without invoking its callback.
- *
- * @uih: The BonoboUIHandler for this menu item.
- * @path: The standard bonobo-style path specifier for this menu item.
- * @new_value: TRUE if item should appear checked (on), FALSE otherwise.
- */
-void
-nautilus_bonobo_ui_handler_menu_set_toggle_appearance (BonoboUIHandler *uih,
- const char *path,
- gboolean new_value)
-{
- BonoboUIHandlerCallbackFunc saved_callback;
- gpointer saved_callback_data;
-
- /* Temporarily clear out callback and data so when we
- * set the toggle state the callback isn't called.
- */
- bonobo_ui_handler_menu_get_callback (uih, path, &saved_callback, &saved_callback_data);
- bonobo_ui_handler_menu_set_callback (uih, path, NULL, NULL);
- bonobo_ui_handler_menu_set_toggle_state (uih, path, new_value);
- bonobo_ui_handler_menu_set_callback (uih, path, saved_callback, saved_callback_data);
-}
diff --git a/libnautilus/nautilus-bonobo-extensions.h b/libnautilus/nautilus-bonobo-extensions.h
deleted file mode 100644
index bc67623f0..000000000
--- a/libnautilus/nautilus-bonobo-extensions.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bonobo-extensions.h - interface for new functions that conceptually
- belong in bonobo. Perhaps some of these will be
- actually rolled into bonobo someday.
-
- 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>
-*/
-
-#ifndef NAUTILUS_BONOBO_EXTENSIONS_H
-#define NAUTILUS_BONOBO_EXTENSIONS_H
-
-#include <bonobo/bonobo-ui-handler.h>
-
-void nautilus_bonobo_ui_handler_menu_set_toggle_appearance (BonoboUIHandler *uih,
- const char *path,
- gboolean new_value);
-
-
-#endif /* NAUTILUS_BONOBO_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-bookmark.c b/libnautilus/nautilus-bookmark.c
deleted file mode 100644
index b05fffaff..000000000
--- a/libnautilus/nautilus-bookmark.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bookmark.c - implementation of individual bookmarks.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-bookmark.h"
-
-#include <gtk/gtkaccellabel.h>
-#include <libgnomeui/gtkpixmapmenuitem.h>
-
-#include "nautilus-icon-factory.h"
-#include "nautilus-string.h"
-#include "nautilus-gtk-macros.h"
-
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-
-struct _NautilusBookmarkDetails
-{
- char *name;
- char *uri;
-};
-
-
-
-static void nautilus_bookmark_initialize_class (NautilusBookmarkClass *class);
-static void nautilus_bookmark_initialize (NautilusBookmark *bookmark);
-static GtkWidget *create_pixmap_widget_for_bookmark (const NautilusBookmark *bookmark);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBookmark, nautilus_bookmark, GTK_TYPE_OBJECT)
-
-/* GtkObject methods. */
-
-static void
-nautilus_bookmark_destroy (GtkObject *object)
-{
- NautilusBookmark *bookmark;
-
- g_assert (NAUTILUS_IS_BOOKMARK (object));
-
- bookmark = NAUTILUS_BOOKMARK(object);
-
- g_free (bookmark->details->name);
- g_free (bookmark->details->uri);
- g_free (bookmark->details);
-
- /* Chain up */
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-/* Initialization. */
-
-static void
-nautilus_bookmark_initialize_class (NautilusBookmarkClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (class);
-
- object_class->destroy = nautilus_bookmark_destroy;
-}
-
-static void
-nautilus_bookmark_initialize (NautilusBookmark *bookmark)
-{
- bookmark->details = g_new0 (NautilusBookmarkDetails, 1);
-}
-
-
-/**
- * nautilus_bookmark_compare_with:
- *
- * Check whether two bookmarks are considered identical.
- * @a: first NautilusBookmark*.
- * @b: second NautilusBookmark*.
- *
- * Return value: 0 if @a and @b have same name and uri, 1 otherwise
- * (GCompareFunc style)
- **/
-int
-nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b)
-{
- NautilusBookmark *bookmark_a;
- NautilusBookmark *bookmark_b;
-
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (a), 1);
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (b), 1);
-
- bookmark_a = NAUTILUS_BOOKMARK (a);
- bookmark_b = NAUTILUS_BOOKMARK (b);
-
- if (strcmp (nautilus_bookmark_get_name(bookmark_a),
- nautilus_bookmark_get_name(bookmark_b)) != 0) {
- return 1;
- }
-
- if (strcmp (nautilus_bookmark_get_uri(bookmark_a),
- nautilus_bookmark_get_uri(bookmark_b)) != 0) {
- return 1;
- }
-
- return 0;
-}
-
-NautilusBookmark *
-nautilus_bookmark_copy (const NautilusBookmark *bookmark)
-{
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (bookmark), NULL);
-
- return nautilus_bookmark_new_with_name(
- nautilus_bookmark_get_uri (bookmark),
- nautilus_bookmark_get_name (bookmark));
-}
-
-const char *
-nautilus_bookmark_get_name (const NautilusBookmark *bookmark)
-{
- g_return_val_if_fail(NAUTILUS_IS_BOOKMARK (bookmark), NULL);
-
- return bookmark->details->name;
-}
-
-gboolean
-nautilus_bookmark_get_pixmap_and_mask (const NautilusBookmark *bookmark,
- guint icon_size,
- GdkPixmap **pixmap_return,
- GdkBitmap **mask_return)
-{
- NautilusFile *file;
- GdkPixbuf *pixbuf;
-
- file = nautilus_file_get (nautilus_bookmark_get_uri (bookmark));
-
- /* FIXME bug 461: This might be a bookmark that points to nothing, or
- * maybe its uri cannot be converted to a NautilusFile for some
- * other reason. It should get some sort of generic icon, but for
- * now it gets none.
- */
- if (file == NULL) {
- return FALSE;
- }
-
- pixbuf = nautilus_icon_factory_get_pixbuf_for_file (file, icon_size);
- nautilus_file_unref (file);
-
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, pixmap_return, mask_return, 100);
- gdk_pixbuf_unref (pixbuf);
-
- return TRUE;
-}
-
-
-gboolean
-nautilus_bookmark_get_pixbuf(const NautilusBookmark *bookmark,
- guint icon_size,
- GdkPixbuf **pixbuf_return)
-{
- NautilusFile *file;
-
- file = nautilus_file_get (nautilus_bookmark_get_uri (bookmark));
-
- /* FIXME bug 461: This might be a bookmark that points to nothing, or
- * maybe its uri cannot be converted to a NautilusFile for some
- * other reason. It should get some sort of generic icon, but for
- * now it gets none.
- */
- if (file == NULL) {
- return FALSE;
- }
-
- *pixbuf_return = nautilus_icon_factory_get_pixbuf_for_file (file, icon_size);
- nautilus_file_unref (file);
-
- return TRUE;
-}
-
-const char *
-nautilus_bookmark_get_uri (const NautilusBookmark *bookmark)
-{
- g_return_val_if_fail(NAUTILUS_IS_BOOKMARK (bookmark), NULL);
-
- return bookmark->details->uri;
-}
-
-
-/**
- * nautilus_bookmark_set_name:
- *
- * Change the user-displayed name of a bookmark.
- * @new_name: The new user-displayed name for this bookmark, mustn't be NULL.
- *
- **/
-void
-nautilus_bookmark_set_name (NautilusBookmark *bookmark, const char *new_name)
-{
- g_return_if_fail(NAUTILUS_IS_BOOKMARK (bookmark));
- g_return_if_fail (new_name != NULL);
-
- g_free (bookmark->details->name);
- bookmark->details->name = g_strdup (new_name);
-}
-
-/**
- * nautilus_bookmark_new_with_name:
- *
- * Create a new NautilusBookmark from a text uri and a display name.
- * @uri: Any uri, even a malformed or non-existent one.
- * @name: A string to display to the user as the bookmark's name.
- *
- * Return value: A newly allocated NautilusBookmark.
- *
- **/
-NautilusBookmark *
-nautilus_bookmark_new_with_name (const char *uri, const char *name)
-{
- NautilusBookmark *new_bookmark;
-
- new_bookmark = gtk_type_new (NAUTILUS_TYPE_BOOKMARK);
-
- new_bookmark->details->name = g_strdup (name);
- new_bookmark->details->uri = g_strdup (uri);
-
- return new_bookmark;
-}
-
-/**
- * nautilus_bookmark_new:
- *
- * Create a new NautilusBookmark from just a text uri.
- * @uri: Any uri, even a malformed or non-existent one.
- *
- * Return value: A newly allocated NautilusBookmark, whose display
- * name is chosen using default rules based on the uri.
- *
- **/
-NautilusBookmark *
-nautilus_bookmark_new (const char *uri)
-{
- /* Use default rules to determine the displayed name */
-
- NautilusBookmark *result;
- GnomeVFSURI *vfs_uri;
-
- result = NULL;
-
- /* For now, the only default rule is to use the file/directory name
- * rather than the whole path. */
- /* FIXME bug 1000: This needs to do better (use just file names for file:// urls,
- * use page names for http://, etc.)
- */
-
- vfs_uri = gnome_vfs_uri_new (uri);
- if (vfs_uri != NULL) {
- if (strcmp (vfs_uri->method_string, "file") == 0) {
- char *short_name;
-
- short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- result = nautilus_bookmark_new_with_name (uri, short_name);
- g_free (short_name);
- }
-
- gnome_vfs_uri_unref (vfs_uri);
- }
-
- if (result == NULL) {
- result = nautilus_bookmark_new_with_name (uri, uri);
- }
-
- return result;
-}
-
-static GtkWidget *
-create_pixmap_widget_for_bookmark (const NautilusBookmark *bookmark)
-{
- GdkPixmap *gdk_pixmap;
- GdkBitmap *mask;
-
- if (!nautilus_bookmark_get_pixmap_and_mask (bookmark,
- NAUTILUS_ICON_SIZE_SMALLER,
- &gdk_pixmap,
- &mask)) {
- return NULL;
- }
-
- return gtk_pixmap_new (gdk_pixmap, mask);
-}
-
-/**
- * nautilus_bookmark_menu_item_new:
- *
- * Return a menu item representing a bookmark.
- * @bookmark: The bookmark the menu item represents.
- * Return value: A newly-created bookmark, not yet shown.
- **/
-GtkWidget *
-nautilus_bookmark_menu_item_new (const NautilusBookmark *bookmark)
-{
- GtkWidget *menu_item;
- GtkWidget *pixmap_widget;
- GtkWidget *accel_label;
-
- /* Could check gnome_preferences_get_menus_have_icons here, but these
- * are more important than stock menu icons, since they're connected to
- * user data. For now let's not let them be turn-offable and see if
- * anyone objects strenuously.
- */
- menu_item = gtk_pixmap_menu_item_new ();
-
- pixmap_widget = create_pixmap_widget_for_bookmark (bookmark);
- if (pixmap_widget != NULL) {
- gtk_widget_show (pixmap_widget);
- gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_item), pixmap_widget);
- }
-
- accel_label = gtk_accel_label_new (nautilus_bookmark_get_name (bookmark));
- gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (menu_item), accel_label);
- gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), menu_item);
- gtk_widget_show (accel_label);
-
- return menu_item;
-}
diff --git a/libnautilus/nautilus-bookmark.h b/libnautilus/nautilus-bookmark.h
deleted file mode 100644
index bf0345aea..000000000
--- a/libnautilus/nautilus-bookmark.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bookmark.h - interface for individual bookmarks.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#ifndef NAUTILUS_BOOKMARK_H
-#define NAUTILUS_BOOKMARK_H
-
-#include <gtk/gtkwidget.h>
-#include <gdk/gdktypes.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-typedef struct _NautilusBookmark NautilusBookmark;
-
-#define NAUTILUS_TYPE_BOOKMARK \
- (nautilus_bookmark_get_type ())
-#define NAUTILUS_BOOKMARK(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_BOOKMARK, NautilusBookmark))
-#define NAUTILUS_BOOKMARK_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_BOOKMARK, NautilusBookmarkClass))
-#define NAUTILUS_IS_BOOKMARK(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_BOOKMARK))
-#define NAUTILUS_IS_BOOKMARK_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_BOOKMARK))
-
-typedef struct _NautilusBookmarkDetails NautilusBookmarkDetails;
-
-struct _NautilusBookmark {
- GtkObject object;
- NautilusBookmarkDetails *details;
-};
-
-struct _NautilusBookmarkClass {
- GtkObjectClass parent_class;
-};
-
-typedef struct _NautilusBookmarkClass NautilusBookmarkClass;
-
-
-
-GtkType nautilus_bookmark_get_type (void);
-NautilusBookmark *nautilus_bookmark_new_with_name (const char *uri,
- const char *name);
-NautilusBookmark *nautilus_bookmark_new (const char *uri);
-NautilusBookmark *nautilus_bookmark_copy (const NautilusBookmark *bookmark);
-const char * nautilus_bookmark_get_name (const NautilusBookmark *bookmark);
-const char * nautilus_bookmark_get_uri (const NautilusBookmark *bookmark);
-void nautilus_bookmark_set_name (NautilusBookmark *bookmark,
- const char *new_name);
-int nautilus_bookmark_compare_with (gconstpointer a,
- gconstpointer b);
-
-/* Helper functions for displaying bookmarks */
-gboolean nautilus_bookmark_get_pixmap_and_mask (const NautilusBookmark *bookmark,
- guint icon_size,
- GdkPixmap **pixmap_return,
- GdkBitmap **mask_return);
-gboolean nautilus_bookmark_get_pixbuf(const NautilusBookmark *bookmark,
- guint icon_size,
- GdkPixbuf **pixbuf_return);
-GtkWidget * nautilus_bookmark_menu_item_new (const NautilusBookmark *bookmark);
-
-
-#endif /* NAUTILUS_BOOKMARK_H */
diff --git a/libnautilus/nautilus-content-view-frame.c b/libnautilus/nautilus-content-view-frame.c
index d878cba1e..9e7633207 100644
--- a/libnautilus/nautilus-content-view-frame.c
+++ b/libnautilus/nautilus-content-view-frame.c
@@ -24,13 +24,13 @@
*
*/
-/* ntl-content-view-frame.c: Implementation for object that
+/* nautilus-content-view-frame.c: Implementation for object that
represents the frame a nautilus content view plugs into. */
#include <config.h>
-#include "ntl-content-view-frame.h"
+#include "nautilus-content-view-frame.h"
#include "nautilus-view-frame-private.h"
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <bonobo/bonobo-control.h>
diff --git a/libnautilus/nautilus-content-view-frame.h b/libnautilus/nautilus-content-view-frame.h
index a945a1a60..043ac5222 100644
--- a/libnautilus/nautilus-content-view-frame.h
+++ b/libnautilus/nautilus-content-view-frame.h
@@ -24,13 +24,13 @@
*
*/
-/* ntl-content-view-frame.h: Interface for object that represents a
+/* nautilus-content-view-frame.h: Interface for object that represents a
the frame a nautilus content view plugs into. */
-#ifndef NTL_CONTENT_VIEW_FRAME_H
-#define NTL_CONTENT_VIEW_FRAME_H
+#ifndef NAUTILUS_CONTENT_VIEW_FRAME_H
+#define NAUTILUS_CONTENT_VIEW_FRAME_H
-#include <libnautilus/ntl-view-frame.h>
+#include <libnautilus/nautilus-view-frame.h>
#define NAUTILUS_TYPE_CONTENT_VIEW_FRAME (nautilus_content_view_frame_get_type ())
#define NAUTILUS_CONTENT_VIEW_FRAME(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CONTENT_VIEW_FRAME, NautilusContentViewFrame))
diff --git a/libnautilus/nautilus-debug.c b/libnautilus/nautilus-debug.c
deleted file mode 100644
index 6b7f64f9b..000000000
--- a/libnautilus/nautilus-debug.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-debug.c: Nautilus debugging aids.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-debug.h"
-
-#include <glib.h>
-#include <signal.h>
-
-/* Raise a SIGINT signal to get the attention of the debugger.
- When not running under the debugger, we don't want to stop,
- so we ignore the signal for just the moment that we raise it.
-*/
-void
-nautilus_stop_in_debugger (void)
-{
- void (* saved_handler) (int);
-
- saved_handler = signal (SIGINT, SIG_IGN);
- raise (SIGINT);
- signal (SIGINT, saved_handler);
-}
-
-/* Stop in the debugger after running the default log handler.
- This makes certain kinds of messages stop in the debugger
- without making them fatal.
-*/
-static void
-nautilus_stop_after_default_log_handler (const char *domain,
- GLogLevelFlags level,
- const char *message,
- gpointer data)
-{
- g_log_default_handler (domain, level, message, data);
- nautilus_stop_in_debugger ();
-}
-
-static void
-nautilus_set_stop_after_default_log_handler (const char *domain)
-{
- g_log_set_handler (domain, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
- nautilus_stop_after_default_log_handler, NULL);
-}
-
-void
-nautilus_make_warnings_and_criticals_stop_in_debugger (const char *first_domain, ...)
-{
- va_list domains;
- const char *domain;
-
- nautilus_set_stop_after_default_log_handler (first_domain);
-
- va_start (domains, first_domain);
-
- for (;;) {
- domain = va_arg (domains, const char *);
- if (domain == NULL) {
- break;
- }
- nautilus_set_stop_after_default_log_handler (domain);
- }
-
- va_end (domains);
-}
diff --git a/libnautilus/nautilus-debug.h b/libnautilus/nautilus-debug.h
deleted file mode 100644
index acb1539b3..000000000
--- a/libnautilus/nautilus-debug.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-debug.h: Nautilus debugging aids.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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_DEBUG_H
-#define NAUTILUS_DEBUG_H
-
-void nautilus_stop_in_debugger (void);
-void nautilus_make_warnings_and_criticals_stop_in_debugger (const char *first_domain, ...);
-
-#endif /* NAUTILUS_DEBUG_H */
diff --git a/libnautilus/nautilus-default-file-icon.c b/libnautilus/nautilus-default-file-icon.c
deleted file mode 100644
index dd103781c..000000000
--- a/libnautilus/nautilus-default-file-icon.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- Default file icon used by the icon factory.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-default-file-icon.h"
-
-const int nautilus_default_file_icon_width = 48;
-const int nautilus_default_file_icon_height = 48;
-const unsigned char nautilus_default_file_icon[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x8c, 0x8c, 0x8c, 0xff,
- 0x8c, 0x8c, 0x8c, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x8c, 0x8c, 0x8c, 0xff, 0xaa, 0xaa, 0xaa, 0xff, 0xa7, 0xa7, 0xa6, 0xff,
- 0x99, 0x99, 0x99, 0xff, 0x12, 0x12, 0x12, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x02, 0x02, 0x02, 0xff, 0x26, 0x26, 0x26, 0xff, 0x96, 0x96, 0x96, 0xff,
- 0xb5, 0xb5, 0xb5, 0xff, 0xb2, 0xb2, 0xb2, 0xff, 0xb1, 0xb1, 0xb0, 0xff, 0xaf, 0xaf, 0xae, 0xff,
- 0xae, 0xae, 0xad, 0xff, 0x4d, 0x4d, 0x4c, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x16, 0x16, 0x16, 0xff, 0x16, 0x16, 0x16, 0xff, 0x6b, 0x6b, 0x6b, 0xff, 0x9f, 0x9f, 0x9f, 0xff,
- 0xb9, 0xb9, 0xb8, 0xff, 0xb8, 0xb8, 0xb7, 0xff, 0xb8, 0xb8, 0xb7, 0xff, 0xb6, 0xb6, 0xb5, 0xff,
- 0xb4, 0xb4, 0xb4, 0xff, 0xb2, 0xb2, 0xb2, 0xff, 0xb0, 0xb0, 0xb0, 0xff, 0xaf, 0xaf, 0xaf, 0xff,
- 0xad, 0xad, 0xac, 0xff, 0x98, 0x98, 0x97, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0x9d, 0x9d, 0x9d, 0xff, 0xaa, 0xaa, 0xa9, 0xff,
- 0xac, 0xac, 0xab, 0xff, 0xb0, 0xb0, 0xaf, 0xff, 0xb8, 0xb8, 0xb8, 0xff, 0xb8, 0xb8, 0xb8, 0xff,
- 0xb8, 0xb8, 0xb8, 0xff, 0xb7, 0xb7, 0xb7, 0xff, 0xb6, 0xb6, 0xb6, 0xff, 0xb5, 0xb5, 0xb4, 0xff,
- 0xb4, 0xb4, 0xb3, 0xff, 0xb2, 0xb2, 0xb1, 0xff, 0xb1, 0xb1, 0xb0, 0xff, 0xaf, 0xaf, 0xae, 0xff,
- 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xad, 0xff, 0x25, 0x25, 0x25, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0xd3, 0xd3, 0xd3, 0xff, 0x7a, 0x7a, 0x7a, 0xff, 0x87, 0x87, 0x87, 0xff,
- 0x9f, 0x9f, 0x9f, 0xff, 0xa8, 0xa8, 0xa7, 0xff, 0xb1, 0xb1, 0xb0, 0xff, 0xb4, 0xb4, 0xb3, 0xff,
- 0xb5, 0xb5, 0xb5, 0xff, 0xb4, 0xb4, 0xb4, 0xff, 0xb4, 0xb4, 0xb4, 0xff, 0xb3, 0xb3, 0xb3, 0xff,
- 0xb2, 0xb2, 0xb2, 0xff, 0xb1, 0xb1, 0xb1, 0xff, 0xb0, 0xb0, 0xaf, 0xff, 0xae, 0xae, 0xad, 0xff,
- 0xae, 0xae, 0xad, 0xff, 0xad, 0xad, 0xac, 0xff, 0x87, 0x87, 0x86, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0xd5, 0xd5, 0xd5, 0xff, 0xe1, 0xe1, 0xe0, 0xff, 0x7f, 0x7f, 0x7f, 0xff, 0x6b, 0x6b, 0x6b, 0xff,
- 0x80, 0x80, 0x80, 0xff, 0x9f, 0x9f, 0x9f, 0xff, 0xab, 0xab, 0xab, 0xff, 0xb0, 0xb0, 0xb0, 0xff,
- 0xb2, 0xb2, 0xb1, 0xff, 0xb3, 0xb3, 0xb2, 0xff, 0xb1, 0xb1, 0xb0, 0xff, 0xb2, 0xb2, 0xb1, 0xff,
- 0xaf, 0xaf, 0xaf, 0xff, 0xb0, 0xb0, 0xb0, 0xff, 0xae, 0xae, 0xae, 0xff, 0xad, 0xad, 0xad, 0xff,
- 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xac, 0xff, 0xad, 0xad, 0xac, 0xff, 0x13, 0x13, 0x13, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xa0, 0xa0, 0xa0, 0xff,
- 0xdd, 0xdd, 0xdd, 0xff, 0xdb, 0xdb, 0xdb, 0xff, 0xcb, 0xcb, 0xcb, 0xff, 0x5a, 0x5a, 0x59, 0xff,
- 0x78, 0x78, 0x78, 0xff, 0x99, 0x99, 0x98, 0xff, 0xa4, 0xa4, 0xa4, 0xff, 0xac, 0xac, 0xac, 0xff,
- 0xaf, 0xaf, 0xaf, 0xff, 0xaf, 0xaf, 0xaf, 0xff, 0xaf, 0xaf, 0xaf, 0xff, 0xaf, 0xaf, 0xae, 0xff,
- 0xaf, 0xaf, 0xae, 0xff, 0xae, 0xae, 0xae, 0xff, 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xad, 0xff,
- 0xad, 0xad, 0xad, 0xff, 0xac, 0xac, 0xac, 0xff, 0xad, 0xad, 0xad, 0xff, 0x86, 0x86, 0x86, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x19, 0x19, 0xff, 0xd4, 0xd4, 0xd4, 0xff,
- 0xdf, 0xdf, 0xdf, 0xff, 0xdd, 0xdd, 0xdd, 0xff, 0xd3, 0xd3, 0xd3, 0xff, 0x52, 0x52, 0x52, 0xff,
- 0x72, 0x72, 0x72, 0xff, 0x90, 0x90, 0x90, 0xff, 0x9d, 0x9d, 0x9c, 0xff, 0xa6, 0xa6, 0xa5, 0xff,
- 0xac, 0xac, 0xac, 0xff, 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xad, 0xff,
- 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xad, 0xff, 0xad, 0xad, 0xac, 0xff, 0xad, 0xad, 0xac, 0xff,
- 0xac, 0xac, 0xab, 0xff, 0xad, 0xad, 0xac, 0xff, 0xad, 0xad, 0xac, 0xff, 0xad, 0xad, 0xad, 0xff,
- 0x13, 0x13, 0x13, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xab, 0xab, 0xab, 0xff, 0xe4, 0xe4, 0xe4, 0xff,
- 0xa7, 0xa7, 0xa6, 0xff, 0x62, 0x62, 0x61, 0xff, 0x4d, 0x4d, 0x4d, 0xff, 0x5d, 0x5d, 0x5d, 0xff,
- 0x6f, 0x6f, 0x6f, 0xff, 0x8d, 0x8d, 0x8d, 0xff, 0x98, 0x98, 0x98, 0xff, 0x9e, 0x9e, 0x9e, 0xff,
- 0xa5, 0xa5, 0xa5, 0xff, 0xac, 0xac, 0xab, 0xff, 0xac, 0xac, 0xac, 0xff, 0xae, 0xae, 0xad, 0xff,
- 0xae, 0xae, 0xae, 0xff, 0xad, 0xad, 0xad, 0xff, 0xac, 0xac, 0xac, 0xff, 0xab, 0xab, 0xab, 0xff,
- 0xac, 0xac, 0xac, 0xff, 0xad, 0xad, 0xac, 0xff, 0xae, 0xae, 0xad, 0xff, 0xaf, 0xaf, 0xae, 0xff,
- 0x87, 0x87, 0x86, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x64, 0x64, 0x64, 0xff, 0x5c, 0x5c, 0x5c, 0xff,
- 0x53, 0x53, 0x53, 0xff, 0x52, 0x52, 0x52, 0xff, 0x61, 0x61, 0x61, 0xff, 0x70, 0x70, 0x70, 0xff,
- 0x74, 0x74, 0x74, 0xff, 0x8f, 0x8f, 0x8f, 0xff, 0x99, 0x99, 0x99, 0xff, 0x9d, 0x9d, 0x9d, 0xff,
- 0xa7, 0xa7, 0xa7, 0xff, 0xac, 0xac, 0xac, 0xff, 0xac, 0xac, 0xac, 0xff, 0xaf, 0xaf, 0xae, 0xff,
- 0xaf, 0xaf, 0xaf, 0xff, 0xaf, 0xaf, 0xae, 0xff, 0xae, 0xae, 0xad, 0xff, 0xac, 0xac, 0xac, 0xff,
- 0xac, 0xac, 0xac, 0xff, 0xad, 0xad, 0xad, 0xff, 0xaf, 0xaf, 0xaf, 0xff, 0xb0, 0xb0, 0xb0, 0xff,
- 0xb1, 0xb1, 0xb1, 0xff, 0x14, 0x14, 0x14, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x42, 0x42, 0x42, 0xff, 0x7f, 0x7f, 0x7f, 0xff,
- 0x77, 0x77, 0x77, 0xff, 0x77, 0x77, 0x77, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff,
- 0x8b, 0x8b, 0x8b, 0xff, 0x92, 0x92, 0x92, 0xff, 0x9e, 0x9e, 0x9d, 0xff, 0xa4, 0xa4, 0xa3, 0xff,
- 0xad, 0xad, 0xac, 0xff, 0xb0, 0xb0, 0xb0, 0xff, 0xb1, 0xb1, 0xb1, 0xff, 0xb2, 0xb2, 0xb2, 0xff,
- 0xb3, 0xb3, 0xb3, 0xff, 0xb2, 0xb2, 0xb2, 0xff, 0xb0, 0xb0, 0xaf, 0xff, 0xae, 0xae, 0xad, 0xff,
- 0xaf, 0xaf, 0xae, 0xff, 0xb0, 0xb0, 0xaf, 0xff, 0xb1, 0xb1, 0xb1, 0xff, 0xb2, 0xb2, 0xb2, 0xff,
- 0xb3, 0xb3, 0xb3, 0xff, 0x88, 0x88, 0x88, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x1a, 0x1a, 0xff, 0x8e, 0x8e, 0x8e, 0xff,
- 0x98, 0x98, 0x97, 0xff, 0x82, 0x82, 0x81, 0xff, 0x8f, 0x8f, 0x8f, 0xff, 0x7f, 0x7f, 0x7f, 0xff,
- 0x94, 0x94, 0x94, 0xff, 0x9c, 0x9c, 0x9c, 0xff, 0xa7, 0xa7, 0xa7, 0xff, 0xaf, 0xaf, 0xaf, 0xff,
- 0xb1, 0xb1, 0xb1, 0xff, 0xb4, 0xb4, 0xb3, 0xff, 0xb6, 0xb6, 0xb5, 0xff, 0xb5, 0xb5, 0xb4, 0xff,
- 0xb5, 0xb5, 0xb5, 0xff, 0xb4, 0xb4, 0xb4, 0xff, 0xb4, 0xb4, 0xb4, 0xff, 0xb2, 0xb2, 0xb2, 0xff,
- 0xb2, 0xb2, 0xb2, 0xff, 0xb4, 0xb4, 0xb3, 0xff, 0xb5, 0xb5, 0xb4, 0xff, 0xb5, 0xb5, 0xb4, 0xff,
- 0xb6, 0xb6, 0xb5, 0xff, 0xb7, 0xb7, 0xb6, 0xff, 0x27, 0x27, 0x27, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0xff, 0xb1, 0xb1, 0xb1, 0xff,
- 0xa8, 0xa8, 0xa8, 0xff, 0xa2, 0xa2, 0xa2, 0xff, 0x9f, 0x9f, 0x9f, 0xff, 0xa2, 0xa2, 0xa1, 0xff,
- 0xa6, 0xa6, 0xa5, 0xff, 0xaa, 0xaa, 0xaa, 0xff, 0xaf, 0xaf, 0xaf, 0xff, 0xb2, 0xb2, 0xb2, 0xff,
- 0xb6, 0xb6, 0xb6, 0xff, 0xb9, 0xb9, 0xb9, 0xff, 0xba, 0xba, 0xba, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
- 0xbb, 0xbb, 0xba, 0xff, 0xba, 0xba, 0xb9, 0xff, 0xba, 0xba, 0xb9, 0xff, 0xb8, 0xb8, 0xb8, 0xff,
- 0xb8, 0xb8, 0xb8, 0xff, 0xb8, 0xb8, 0xb8, 0xff, 0xb8, 0xb8, 0xb8, 0xff, 0xb9, 0xb9, 0xb9, 0xff,
- 0xb9, 0xb9, 0xb8, 0xff, 0xb9, 0xb9, 0xb8, 0xff, 0x8f, 0x8f, 0x8e, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbc, 0xbc, 0xbc, 0xff,
- 0xb6, 0xb6, 0xb6, 0xff, 0xb4, 0xb4, 0xb4, 0xff, 0xb1, 0xb1, 0xb1, 0xff, 0xb1, 0xb1, 0xb1, 0xff,
- 0xb0, 0xb0, 0xb0, 0xff, 0xb2, 0xb2, 0xb2, 0xff, 0xb6, 0xb6, 0xb5, 0xff, 0xba, 0xba, 0xb9, 0xff,
- 0xbf, 0xbf, 0xbf, 0xff, 0xbe, 0xbe, 0xbe, 0xff, 0xbf, 0xbf, 0xbf, 0xff, 0xc0, 0xc0, 0xc0, 0xff,
- 0xc0, 0xc0, 0xc0, 0xff, 0xbf, 0xbf, 0xbf, 0xff, 0xbf, 0xbf, 0xbf, 0xff, 0xbd, 0xbd, 0xbc, 0xff,
- 0xbd, 0xbd, 0xbc, 0xff, 0xbd, 0xbd, 0xbc, 0xff, 0xbc, 0xbc, 0xbc, 0xff, 0xbc, 0xbc, 0xbc, 0xff,
- 0xbc, 0xbc, 0xbc, 0xff, 0xbb, 0xbb, 0xbb, 0xff, 0xbb, 0xbb, 0xbb, 0xff, 0x29, 0x29, 0x29, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
- 0xc2, 0xc2, 0xc2, 0xff, 0xbf, 0xbf, 0xbe, 0xff, 0xbb, 0xbb, 0xbb, 0xff, 0xb9, 0xb9, 0xb9, 0xff,
- 0xb8, 0xb8, 0xb8, 0xff, 0xb9, 0xb9, 0xb9, 0xff, 0xbe, 0xbe, 0xbe, 0xff, 0xc3, 0xc3, 0xc3, 0xff,
- 0xc4, 0xc4, 0xc4, 0xff, 0xc6, 0xc6, 0xc5, 0xff, 0xc8, 0xc8, 0xc7, 0xff, 0xc7, 0xc7, 0xc6, 0xff,
- 0xc6, 0xc6, 0xc6, 0xff, 0xc5, 0xc5, 0xc5, 0xff, 0xc4, 0xc4, 0xc4, 0xff, 0xc3, 0xc3, 0xc3, 0xff,
- 0xc2, 0xc2, 0xc2, 0xff, 0xc2, 0xc2, 0xc2, 0xff, 0xc2, 0xc2, 0xc1, 0xff, 0xc0, 0xc0, 0xbf, 0xff,
- 0xc0, 0xc0, 0xbf, 0xff, 0xbf, 0xbf, 0xbf, 0xff, 0xbd, 0xbd, 0xbd, 0xff, 0xa8, 0xa8, 0xa8, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xae, 0xae, 0xae, 0xff,
- 0xcd, 0xcd, 0xcd, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc5, 0xc5, 0xc5, 0xff, 0xc4, 0xc4, 0xc4, 0xff,
- 0xc2, 0xc2, 0xc1, 0xff, 0xc0, 0xc0, 0xc0, 0xff, 0xc6, 0xc6, 0xc6, 0xff, 0xc9, 0xc9, 0xc9, 0xff,
- 0xca, 0xca, 0xca, 0xff, 0xcc, 0xcc, 0xcc, 0xff, 0xcc, 0xcc, 0xcc, 0xff, 0xcd, 0xcd, 0xcd, 0xff,
- 0xcc, 0xcc, 0xcb, 0xff, 0xcb, 0xcb, 0xca, 0xff, 0xca, 0xca, 0xc9, 0xff, 0xc8, 0xc8, 0xc8, 0xff,
- 0xc7, 0xc7, 0xc7, 0xff, 0xc6, 0xc6, 0xc6, 0xff, 0xc5, 0xc5, 0xc5, 0xff, 0xc4, 0xc4, 0xc4, 0xff,
- 0xc4, 0xc4, 0xc4, 0xff, 0xc2, 0xc2, 0xc1, 0xff, 0xc1, 0xc1, 0xc0, 0xff, 0xc0, 0xc0, 0xbf, 0xff,
- 0x7d, 0x7d, 0x7c, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x50, 0x50, 0x50, 0xff,
- 0xd8, 0xd8, 0xd8, 0xff, 0xd4, 0xd4, 0xd4, 0xff, 0xd0, 0xd0, 0xd0, 0xff, 0xcd, 0xcd, 0xcd, 0xff,
- 0xce, 0xce, 0xce, 0xff, 0xce, 0xce, 0xce, 0xff, 0xd0, 0xd0, 0xd0, 0xff, 0xd1, 0xd1, 0xd0, 0xff,
- 0xd2, 0xd2, 0xd2, 0xff, 0xd2, 0xd2, 0xd2, 0xff, 0xd2, 0xd2, 0xd2, 0xff, 0xd1, 0xd1, 0xd1, 0xff,
- 0xd1, 0xd1, 0xd1, 0xff, 0xd0, 0xd0, 0xd0, 0xff, 0xd0, 0xd0, 0xd0, 0xff, 0xce, 0xce, 0xcd, 0xff,
- 0xcd, 0xcd, 0xcc, 0xff, 0xcc, 0xcc, 0xcb, 0xff, 0xc9, 0xc9, 0xc9, 0xff, 0xc8, 0xc8, 0xc8, 0xff,
- 0xc6, 0xc6, 0xc6, 0xff, 0xc5, 0xc5, 0xc5, 0xff, 0xc4, 0xc4, 0xc4, 0xff, 0xc3, 0xc3, 0xc2, 0xff,
- 0xc2, 0xc2, 0xc1, 0xff, 0x15, 0x15, 0x14, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0xe3, 0xe3, 0xe3, 0xff, 0xe0, 0xe0, 0xdf, 0xff, 0xdb, 0xdb, 0xdb, 0xff, 0xd8, 0xd8, 0xd8, 0xff,
- 0xd8, 0xd8, 0xd8, 0xff, 0xd8, 0xd8, 0xd8, 0xff, 0xd7, 0xd7, 0xd7, 0xff, 0xd8, 0xd8, 0xd8, 0xff,
- 0xd9, 0xd9, 0xd9, 0xff, 0xd9, 0xd9, 0xd8, 0xff, 0xd8, 0xd8, 0xd7, 0xff, 0xd7, 0xd7, 0xd7, 0xff,
- 0xd6, 0xd6, 0xd6, 0xff, 0xd4, 0xd4, 0xd4, 0xff, 0xd4, 0xd4, 0xd4, 0xff, 0xd2, 0xd2, 0xd2, 0xff,
- 0xd0, 0xd0, 0xd0, 0xff, 0xce, 0xce, 0xce, 0xff, 0xcd, 0xcd, 0xcc, 0xff, 0xcc, 0xcc, 0xcb, 0xff,
- 0xca, 0xca, 0xc9, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc7, 0xc7, 0xc7, 0xff, 0xc6, 0xc6, 0xc6, 0xff,
- 0xc4, 0xc4, 0xc4, 0xff, 0x9e, 0x9e, 0x9e, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0xdd, 0xdd, 0xdd, 0xff, 0xe8, 0xe8, 0xe8, 0xff, 0xe6, 0xe6, 0xe6, 0xff, 0xe3, 0xe3, 0xe3, 0xff,
- 0xe1, 0xe1, 0xe0, 0xff, 0xdf, 0xdf, 0xdf, 0xff, 0xde, 0xde, 0xde, 0xff, 0xdd, 0xdd, 0xdd, 0xff,
- 0xdd, 0xdd, 0xdd, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0xdc, 0xdc, 0xdc, 0xff,
- 0xdb, 0xdb, 0xda, 0xff, 0xdb, 0xdb, 0xda, 0xff, 0xd9, 0xd9, 0xd8, 0xff, 0xd6, 0xd6, 0xd6, 0xff,
- 0xd4, 0xd4, 0xd4, 0xff, 0xd2, 0xd2, 0xd2, 0xff, 0xd1, 0xd1, 0xd1, 0xff, 0xcf, 0xcf, 0xcf, 0xff,
- 0xce, 0xce, 0xce, 0xff, 0xcc, 0xcc, 0xcb, 0xff, 0xcb, 0xcb, 0xca, 0xff, 0xc9, 0xc9, 0xc8, 0xff,
- 0xc6, 0xc6, 0xc6, 0xff, 0xc4, 0xc4, 0xc4, 0xff, 0x2a, 0x2a, 0x2a, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0xc9, 0xc9, 0xc9, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xec, 0xec, 0xec, 0xff, 0xe9, 0xe9, 0xe9, 0xff,
- 0xe6, 0xe6, 0xe6, 0xff, 0xe4, 0xe4, 0xe4, 0xff, 0xe3, 0xe3, 0xe3, 0xff, 0xe2, 0xe2, 0xe1, 0xff,
- 0xe0, 0xe0, 0xe0, 0xff, 0xe0, 0xe0, 0xe0, 0xff, 0xe0, 0xe0, 0xe0, 0xff, 0xdf, 0xdf, 0xdf, 0xff,
- 0xdf, 0xdf, 0xdf, 0xff, 0xde, 0xde, 0xde, 0xff, 0xdd, 0xdd, 0xdd, 0xff, 0xdb, 0xdb, 0xda, 0xff,
- 0xd9, 0xd9, 0xd8, 0xff, 0xd7, 0xd7, 0xd6, 0xff, 0xd4, 0xd4, 0xd4, 0xff, 0xd2, 0xd2, 0xd2, 0xff,
- 0xd1, 0xd1, 0xd1, 0xff, 0xcf, 0xcf, 0xcf, 0xff, 0xcd, 0xcd, 0xcd, 0xff, 0xcb, 0xcb, 0xcb, 0xff,
- 0xc9, 0xc9, 0xc8, 0xff, 0xc7, 0xc7, 0xc6, 0xff, 0xae, 0xae, 0xad, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x7b, 0x7b, 0x7b, 0xff, 0xf4, 0xf4, 0xf4, 0xff, 0xf1, 0xf1, 0xf1, 0xff, 0xee, 0xee, 0xee, 0xff,
- 0xeb, 0xeb, 0xeb, 0xff, 0xe9, 0xe9, 0xe9, 0xff, 0xe7, 0xe7, 0xe7, 0xff, 0xe6, 0xe6, 0xe6, 0xff,
- 0xe5, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe4, 0xe4, 0xe3, 0xff, 0xe3, 0xe3, 0xe3, 0xff,
- 0xe2, 0xe2, 0xe2, 0xff, 0xe1, 0xe1, 0xe1, 0xff, 0xe0, 0xe0, 0xe0, 0xff, 0xde, 0xde, 0xde, 0xff,
- 0xdc, 0xdc, 0xdc, 0xff, 0xda, 0xda, 0xda, 0xff, 0xd8, 0xd8, 0xd7, 0xff, 0xd6, 0xd6, 0xd5, 0xff,
- 0xd4, 0xd4, 0xd3, 0xff, 0xd1, 0xd1, 0xd1, 0xff, 0xcf, 0xcf, 0xcf, 0xff, 0xcd, 0xcd, 0xcd, 0xff,
- 0xcb, 0xcb, 0xcb, 0xff, 0xc9, 0xc9, 0xc9, 0xff, 0xc7, 0xc7, 0xc7, 0xff, 0xa0, 0xa0, 0x9f, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1c, 0x1c, 0x1c, 0xff, 0xf9, 0xf9, 0xf9, 0xff, 0xf6, 0xf6, 0xf6, 0xff, 0xf3, 0xf3, 0xf3, 0xff,
- 0xf1, 0xf1, 0xf0, 0xff, 0xed, 0xed, 0xed, 0xff, 0xec, 0xec, 0xec, 0xff, 0xea, 0xea, 0xea, 0xff,
- 0xe9, 0xe9, 0xe9, 0xff, 0xe8, 0xe8, 0xe8, 0xff, 0xe7, 0xe7, 0xe7, 0xff, 0xe7, 0xe7, 0xe7, 0xff,
- 0xe6, 0xe6, 0xe6, 0xff, 0xe5, 0xe5, 0xe4, 0xff, 0xe2, 0xe2, 0xe2, 0xff, 0xe0, 0xe0, 0xe0, 0xff,
- 0xde, 0xde, 0xde, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0xda, 0xda, 0xda, 0xff, 0xd8, 0xd8, 0xd8, 0xff,
- 0xd6, 0xd6, 0xd6, 0xff, 0xd4, 0xd4, 0xd3, 0xff, 0xd2, 0xd2, 0xd1, 0xff, 0xd0, 0xd0, 0xcf, 0xff,
- 0xcd, 0xcd, 0xcd, 0xff, 0xcb, 0xcb, 0xcb, 0xff, 0xc4, 0xc4, 0xc4, 0xff, 0x90, 0x90, 0x90, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0xdb, 0xdb, 0xdb, 0xff, 0xfa, 0xfa, 0xfa, 0xff, 0xf7, 0xf7, 0xf7, 0xff,
- 0xf5, 0xf5, 0xf5, 0xff, 0xf3, 0xf3, 0xf3, 0xff, 0xf1, 0xf1, 0xf1, 0xff, 0xef, 0xef, 0xee, 0xff,
- 0xed, 0xed, 0xed, 0xff, 0xec, 0xec, 0xec, 0xff, 0xeb, 0xeb, 0xeb, 0xff, 0xea, 0xea, 0xea, 0xff,
- 0xe8, 0xe8, 0xe8, 0xff, 0xe7, 0xe7, 0xe7, 0xff, 0xe5, 0xe5, 0xe5, 0xff, 0xe3, 0xe3, 0xe3, 0xff,
- 0xe1, 0xe1, 0xe0, 0xff, 0xdf, 0xdf, 0xde, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0xda, 0xda, 0xda, 0xff,
- 0xd8, 0xd8, 0xd8, 0xff, 0xd6, 0xd6, 0xd6, 0xff, 0xd4, 0xd4, 0xd4, 0xff, 0xd2, 0xd2, 0xd2, 0xff,
- 0xd0, 0xd0, 0xcf, 0xff, 0x92, 0x92, 0x92, 0xff, 0x16, 0x16, 0x16, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0xba, 0xba, 0xba, 0xff, 0xfc, 0xfc, 0xfc, 0xff, 0xfb, 0xfb, 0xfb, 0xff,
- 0xf9, 0xf9, 0xf9, 0xff, 0xf7, 0xf7, 0xf7, 0xff, 0xf5, 0xf5, 0xf5, 0xff, 0xf3, 0xf3, 0xf3, 0xff,
- 0xf2, 0xf2, 0xf2, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xef, 0xef, 0xee, 0xff, 0xed, 0xed, 0xed, 0xff,
- 0xeb, 0xeb, 0xeb, 0xff, 0xe9, 0xe9, 0xe9, 0xff, 0xe7, 0xe7, 0xe7, 0xff, 0xe5, 0xe5, 0xe5, 0xff,
- 0xe3, 0xe3, 0xe3, 0xff, 0xe1, 0xe1, 0xe1, 0xff, 0xdf, 0xdf, 0xdf, 0xff, 0xdd, 0xdd, 0xdc, 0xff,
- 0xdb, 0xdb, 0xda, 0xff, 0xd8, 0xd8, 0xd8, 0xff, 0xd6, 0xd6, 0xd6, 0xff, 0xad, 0xad, 0xad, 0xff,
- 0x17, 0x17, 0x17, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xfd, 0xfd, 0xfd, 0xff,
- 0xfd, 0xfd, 0xfd, 0xff, 0xfa, 0xfa, 0xfa, 0xff, 0xf8, 0xf8, 0xf8, 0xff, 0xf6, 0xf6, 0xf6, 0xff,
- 0xf5, 0xf5, 0xf5, 0xff, 0xf3, 0xf3, 0xf3, 0xff, 0xf2, 0xf2, 0xf2, 0xff, 0xf0, 0xf0, 0xf0, 0xff,
- 0xee, 0xee, 0xee, 0xff, 0xec, 0xec, 0xeb, 0xff, 0xe9, 0xe9, 0xe9, 0xff, 0xe7, 0xe7, 0xe7, 0xff,
- 0xe5, 0xe5, 0xe5, 0xff, 0xe3, 0xe3, 0xe3, 0xff, 0xe1, 0xe1, 0xe1, 0xff, 0xdf, 0xdf, 0xdf, 0xff,
- 0xdd, 0xdd, 0xdd, 0xff, 0xb0, 0xb0, 0xaf, 0xff, 0x17, 0x17, 0x17, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfe, 0xfe, 0xfe, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xfc, 0xfc, 0xfc, 0xff, 0xfb, 0xfb, 0xfa, 0xff,
- 0xf8, 0xf8, 0xf8, 0xff, 0xf6, 0xf6, 0xf6, 0xff, 0xf4, 0xf4, 0xf4, 0xff, 0xf2, 0xf2, 0xf2, 0xff,
- 0xf0, 0xf0, 0xf0, 0xff, 0xee, 0xee, 0xee, 0xff, 0xec, 0xec, 0xec, 0xff, 0xea, 0xea, 0xea, 0xff,
- 0xe8, 0xe8, 0xe7, 0xff, 0xe6, 0xe6, 0xe5, 0xff, 0xd5, 0xd5, 0xd5, 0xff, 0xa3, 0xa3, 0xa3, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbe, 0xbe, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfd, 0xfd, 0xff,
- 0xfb, 0xfb, 0xfb, 0xff, 0xf9, 0xf9, 0xf9, 0xff, 0xf7, 0xf7, 0xf6, 0xff, 0xf4, 0xf4, 0xf4, 0xff,
- 0xf2, 0xf2, 0xf2, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xee, 0xee, 0xee, 0xff, 0xec, 0xec, 0xec, 0xff,
- 0xc6, 0xc6, 0xc6, 0xff, 0x96, 0x96, 0x96, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7d, 0x7d, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfd, 0xfd, 0xfd, 0xff, 0xfb, 0xfb, 0xfb, 0xff, 0xf9, 0xf9, 0xf9, 0xff, 0xf7, 0xf7, 0xf7, 0xff,
- 0xf5, 0xf5, 0xf5, 0xff, 0xf3, 0xf3, 0xf2, 0xff, 0xa0, 0xa0, 0xa0, 0xff, 0x34, 0x34, 0x34, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfd, 0xfd, 0xff, 0xfb, 0xfb, 0xfb, 0xff, 0xcf, 0xcf, 0xcf, 0xff,
- 0x8f, 0x8f, 0x8f, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbe, 0xbe, 0xbe, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xe2, 0xe2, 0xe2, 0xff, 0xa7, 0xa7, 0xa7, 0xff, 0x37, 0x37, 0x37, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xe2, 0xe2, 0xe2, 0xff, 0xbb, 0xbb, 0xbb, 0xff, 0x7d, 0x7d, 0x7d, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
diff --git a/libnautilus/nautilus-default-file-icon.h b/libnautilus/nautilus-default-file-icon.h
deleted file mode 100644
index c35e909e0..000000000
--- a/libnautilus/nautilus-default-file-icon.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- Default file icon used by the icon factory.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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_DEFAULT_FILE_ICON_H
-#define NAUTILUS_DEFAULT_FILE_ICON_H
-
-extern const int nautilus_default_file_icon_width;
-extern const int nautilus_default_file_icon_height;
-extern const unsigned char nautilus_default_file_icon[];
-
-#endif /* NAUTILUS_DEFAULT_FILE_ICON_H */
diff --git a/libnautilus/nautilus-directory-background.c b/libnautilus/nautilus-directory-background.c
deleted file mode 100644
index 8cb19374f..000000000
--- a/libnautilus/nautilus-directory-background.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- nautilus-directory-background.c: Helper for the background of a widget
- that is viewing a particular directory.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-directory-background.h"
-
-#include <gtk/gtksignal.h>
-#include "nautilus-background.h"
-#include "nautilus-metadata.h"
-
-#define DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/FFFF"
-
-static void background_changed_callback (NautilusBackground *background,
- NautilusDirectory *directory);
-static void directory_changed_callback (NautilusDirectory *directory,
- NautilusBackground *background);
-
-static void
-background_changed_callback (NautilusBackground *background,
- NautilusDirectory *directory)
-{
- char *color, *image;
-
- g_assert (NAUTILUS_IS_BACKGROUND (background));
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (gtk_object_get_data (GTK_OBJECT (background), "nautilus_background_directory")
- == directory);
-
- /* Block the other handler while we are writing metadata so it doesn't
- * try to change the background.
- */
- gtk_signal_handler_block_by_func (GTK_OBJECT (directory),
- directory_changed_callback,
- background);
-
- /* Update metadata based on color. */
- color = nautilus_background_get_color (background);
- nautilus_directory_set_metadata (directory,
- NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR,
- DEFAULT_BACKGROUND_COLOR,
- color);
- g_free (color);
-
- /* Update metadata based on tile image. */
- image = nautilus_background_get_tile_image_uri (background);
- nautilus_directory_set_metadata (directory,
- NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE,
- NULL,
- image);
- g_free (image);
-
- /* Unblock the handler. */
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (directory),
- directory_changed_callback,
- background);
-}
-
-static void
-directory_changed_callback (NautilusDirectory *directory,
- NautilusBackground *background)
-{
- char *color, *image;
-
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (NAUTILUS_IS_BACKGROUND (background));
- g_assert (gtk_object_get_data (GTK_OBJECT (background), "nautilus_background_directory")
- == directory);
-
- /* Block the other handler while we are responding to changes
- * in the metadata so it doesn't try to change the metadata.
- */
- gtk_signal_handler_block_by_func (GTK_OBJECT (background),
- background_changed_callback,
- directory);
-
- /* Update color based on metadata. */
- color = nautilus_directory_get_metadata (directory,
- NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR,
- DEFAULT_BACKGROUND_COLOR);
- nautilus_background_set_color (background, color);
- g_free (color);
-
- /* Update tile image based on metadata. */
- image = nautilus_directory_get_metadata (directory,
- NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE,
- NULL);
- nautilus_background_set_tile_image_uri (background, image);
- g_free (image);
-
- /* Unblock the handler. */
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (background),
- background_changed_callback,
- directory);
-}
-
-void
-nautilus_connect_background_to_directory_metadata (GtkWidget *widget,
- NautilusDirectory *directory)
-{
- NautilusBackground *background;
- gpointer old_directory;
-
- /* Get at the background object we'll be connecting. */
- background = nautilus_get_widget_background (widget);
-
- /* Check if it is already connected. */
- old_directory = gtk_object_get_data (GTK_OBJECT (background),
- "nautilus_background_directory");
- if (old_directory == directory) {
- return;
- }
-
- /* Disconnect old signal handlers. */
- if (old_directory != NULL) {
- g_assert (NAUTILUS_IS_DIRECTORY (old_directory));
- gtk_signal_disconnect_by_func (GTK_OBJECT (background),
- GTK_SIGNAL_FUNC (background_changed_callback),
- old_directory);
- gtk_signal_disconnect_by_func (GTK_OBJECT (old_directory),
- GTK_SIGNAL_FUNC (directory_changed_callback),
- background);
- }
-
- /* Attach the new directory. */
- nautilus_directory_ref (directory);
- gtk_object_set_data_full (GTK_OBJECT (background),
- "nautilus_background_directory",
- directory,
- (GtkDestroyNotify) nautilus_directory_unref);
-
- /* Connect new signal handlers. */
- if (directory != NULL) {
- gtk_signal_connect (GTK_OBJECT (background),
- "changed",
- GTK_SIGNAL_FUNC (background_changed_callback),
- directory);
- gtk_signal_connect (GTK_OBJECT (directory),
- "metadata_changed",
- GTK_SIGNAL_FUNC (directory_changed_callback),
- background);
- }
-
- /* Update the background based on the directory metadata. */
- directory_changed_callback (directory, background);
-}
-
-void
-nautilus_connect_background_to_directory_metadata_by_uri (GtkWidget *widget,
- const char *uri)
-{
- NautilusDirectory *directory;
-
- directory = nautilus_directory_get (uri);
- nautilus_connect_background_to_directory_metadata (widget, directory);
- nautilus_directory_unref (directory);
-}
diff --git a/libnautilus/nautilus-directory-background.h b/libnautilus/nautilus-directory-background.h
deleted file mode 100644
index b2a47e83b..000000000
--- a/libnautilus/nautilus-directory-background.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- nautilus-directory-background.h: Helper for the background of a widget
- that is viewing a particular directory.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <gtk/gtkwidget.h>
-#include "nautilus-directory.h"
-
-void nautilus_connect_background_to_directory_metadata (GtkWidget *widget,
- NautilusDirectory *directory);
-void nautilus_connect_background_to_directory_metadata_by_uri (GtkWidget *widget,
- const char *uri);
diff --git a/libnautilus/nautilus-directory-private.h b/libnautilus/nautilus-directory-private.h
deleted file mode 100644
index 4a613edf7..000000000
--- a/libnautilus/nautilus-directory-private.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.c: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include "nautilus-directory.h"
-
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-
-#include <tree.h>
-
-#include "nautilus-file.h"
-
-#define METADATA_NODE_NAME_FOR_FILE_NAME "NAME"
-
-typedef struct MetafileReadState MetafileReadState;
-typedef struct MetafileWriteState MetafileWriteState;
-
-struct NautilusDirectoryDetails
-{
- char *uri_text;
- GnomeVFSURI *uri;
- GnomeVFSURI *metafile_uri;
- GnomeVFSURI *alternate_metafile_uri;
-
- GList *files;
-
- xmlDoc *metafile;
-
- gboolean metafile_read;
- gboolean use_alternate_metafile;
- MetafileReadState *read_state;
-
- guint write_metafile_idle_id;
- MetafileWriteState *write_state;
-
- /* These list are going to be pretty short. If we think they
- * are going to get big, we can use hash tables instead.
- */
- GList *metafile_callbacks;
- GList *monitors;
- GList *file_monitors;
-
- gboolean directory_loaded;
- GnomeVFSAsyncHandle *directory_load_in_progress;
- GnomeVFSDirectoryListPosition directory_load_list_last_handled;
- GList *pending_file_info;
- guint dequeue_pending_idle_id;
-};
-
-typedef struct {
- NautilusFile *file;
- union {
- NautilusDirectoryCallback directory;
- NautilusFileCallback file;
- } callback;
- gpointer callback_data;
-} QueuedCallback;
-
-NautilusFile *nautilus_directory_find_file (NautilusDirectory *directory,
- const char *file_name);
-char * nautilus_directory_get_file_metadata (NautilusDirectory *directory,
- const char *file_name,
- const char *key,
- const char *default_metadata);
-gboolean nautilus_directory_set_file_metadata (NautilusDirectory *directory,
- const char *file_name,
- const char *key,
- const char *default_metadata,
- const char *metadata);
-xmlNode * nautilus_directory_get_file_metadata_node (NautilusDirectory *directory,
- const char *file_name,
- gboolean create);
-void nautilus_directory_files_changed (NautilusDirectory *directory,
- GList *changed_files);
-void nautilus_directory_request_write_metafile (NautilusDirectory *directory);
-void nautilus_directory_cancel_callback_internal (NautilusDirectory *directory,
- const QueuedCallback *callback);
-void nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
- const QueuedCallback *callback);
-
-/* debugging functions */
-int nautilus_directory_number_outstanding (void);
diff --git a/libnautilus/nautilus-directory.c b/libnautilus/nautilus-directory.c
deleted file mode 100644
index dbdc944ff..000000000
--- a/libnautilus/nautilus-directory.c
+++ /dev/null
@@ -1,1693 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.c: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-directory-private.h"
-
-#include <stdlib.h>
-
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmain.h>
-
-#include <parser.h>
-#include <xmlmemory.h>
-
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-string.h"
-#include "nautilus-xml-extensions.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-file-private.h"
-
-#define METAFILE_NAME ".nautilus-metafile.xml"
-#define METAFILE_PERMISSIONS (GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE \
- | GNOME_VFS_PERM_GROUP_READ | GNOME_VFS_PERM_GROUP_WRITE \
- | GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_OTHER_WRITE)
-
-#define NAUTILUS_DIRECTORY_NAME ".nautilus"
-#define METAFILES_DIRECTORY_NAME "metafiles"
-#define METAFILES_DIRECTORY_PERMISSIONS (GNOME_VFS_PERM_USER_ALL \
- | GNOME_VFS_PERM_GROUP_ALL \
- | GNOME_VFS_PERM_OTHER_ALL)
-#define METAFILE_SUFFIX ".xml"
-
-#define METAFILE_XML_VERSION "1.0"
-
-#define DIRECTORY_LOAD_ITEMS_PER_CALLBACK 1
-
-enum
-{
- FILES_ADDED,
- FILES_CHANGED,
- METADATA_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-struct MetafileReadState {
- GnomeVFSAsyncHandle *handle;
- gpointer buffer;
- size_t bytes_read;
-};
-
-struct MetafileWriteState {
- GnomeVFSAsyncHandle *handle;
- xmlChar *buffer;
- int size;
- gboolean write_again;
-};
-
-#define READ_CHUNK_SIZE (4 * 1024)
-
-static int compare_file_with_name (gconstpointer a,
- gconstpointer b);
-static int compare_queued_callbacks (gconstpointer a,
- gconstpointer b);
-static GnomeVFSURI * construct_alternate_metafile_uri (GnomeVFSURI *uri);
-static xmlNode * create_metafile_root (NautilusDirectory *directory);
-static gboolean dequeue_pending_idle_callback (gpointer callback_data);
-static char * escape_slashes (const char *path);
-static char * get_metadata_from_node (xmlNode *node,
- const char *key,
- const char *default_metadata);
-static void metafile_close_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void metafile_read_cancel (NautilusDirectory *directory);
-static void metafile_read_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_read_complete (NautilusDirectory *directory);
-static void metafile_read_done (NautilusDirectory *directory);
-static void metafile_read_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void metafile_read_some (NautilusDirectory *directory);
-static void metafile_read_start (NautilusDirectory *directory);
-static void metafile_write (NautilusDirectory *directory);
-static void metafile_write_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gconstpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_write_complete (NautilusDirectory *directory);
-static gboolean metafile_write_idle_callback (gpointer callback_data);
-static void metafile_write_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void metafile_write_start (NautilusDirectory *directory);
-static void nautilus_directory_destroy (GtkObject *object);
-static void nautilus_directory_initialize (gpointer object,
- gpointer klass);
-static void nautilus_directory_initialize_class (gpointer klass);
-static void nautilus_directory_load_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- GnomeVFSDirectoryList *list,
- guint entries_read,
- gpointer callback_data);
-static void nautilus_directory_load_done (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void nautilus_directory_load_one (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-static GnomeVFSResult nautilus_make_directory_and_parents (GnomeVFSURI *uri,
- guint permissions);
-static NautilusDirectory * nautilus_directory_new (const char *uri);
-static void nautilus_directory_request_read_metafile (NautilusDirectory *directory);
-static GnomeVFSDirectoryListPosition nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position);
-static void nautilus_gnome_vfs_file_info_list_free (GList *list);
-static void nautilus_gnome_vfs_file_info_list_unref (GList *list);
-static void schedule_dequeue_pending (NautilusDirectory *directory);
-static void stop_monitoring_files (NautilusDirectory *directory);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusDirectory, nautilus_directory, GTK_TYPE_OBJECT)
-
-static GHashTable* directory_objects;
-
-static void
-nautilus_directory_initialize_class (gpointer klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_directory_destroy;
-
- signals[FILES_ADDED] =
- gtk_signal_new ("files_added",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusDirectoryClass, files_added),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
- signals[FILES_CHANGED] =
- gtk_signal_new ("files_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusDirectoryClass, files_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
- signals[METADATA_CHANGED] =
- gtk_signal_new ("metadata_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusDirectoryClass, metadata_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-nautilus_directory_initialize (gpointer object, gpointer klass)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY(object);
-
- directory->details = g_new0 (NautilusDirectoryDetails, 1);
-}
-
-static void
-nautilus_gnome_vfs_file_info_list_unref (GList *list)
-{
- g_list_foreach (list, (GFunc) gnome_vfs_file_info_unref, NULL);
-}
-
-static void
-nautilus_gnome_vfs_file_info_list_free (GList *list)
-{
- nautilus_gnome_vfs_file_info_list_unref (list);
- g_list_free (list);
-}
-
-void
-nautilus_directory_ref (NautilusDirectory *directory)
-{
- if (directory == NULL) {
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
-
- gtk_object_ref (GTK_OBJECT (directory));
-}
-
-void
-nautilus_directory_unref (NautilusDirectory *directory)
-{
- if (directory == NULL) {
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
-
- gtk_object_unref (GTK_OBJECT (directory));
-}
-
-static void
-nautilus_directory_destroy (GtkObject *object)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY (object);
-
- g_assert (directory->details->write_state == NULL);
- metafile_read_cancel (directory);
-
- if (directory->details->file_monitors != NULL) {
- g_warning ("destroying a NautilusDirectory while it's being monitored");
- stop_monitoring_files (directory);
- g_list_free (directory->details->file_monitors);
- }
-
- g_hash_table_remove (directory_objects, directory->details->uri_text);
-
- if (directory->details->dequeue_pending_idle_id != 0) {
- gtk_idle_remove (directory->details->dequeue_pending_idle_id);
- }
-
- g_free (directory->details->uri_text);
- if (directory->details->uri != NULL) {
- gnome_vfs_uri_unref (directory->details->uri);
- }
- if (directory->details->metafile_uri != NULL) {
- gnome_vfs_uri_unref (directory->details->metafile_uri);
- }
- if (directory->details->alternate_metafile_uri != NULL) {
- gnome_vfs_uri_unref (directory->details->alternate_metafile_uri);
- }
- g_assert (directory->details->files == NULL);
- xmlFreeDoc (directory->details->metafile);
- g_assert (directory->details->directory_load_in_progress == NULL);
- g_assert (directory->details->dequeue_pending_idle_id == 0);
- nautilus_gnome_vfs_file_info_list_unref (directory->details->pending_file_info);
- g_assert (directory->details->write_metafile_idle_id == 0);
-
- g_free (directory->details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-/**
- * nautilus_directory_get:
- * @uri: URI of directory to get.
- *
- * Get a directory given a uri.
- * Creates the appropriate subclass given the uri mappings.
- * Returns a referenced object, not a floating one. Unref when finished.
- * If two windows are viewing the same uri, the directory object is shared.
- */
-NautilusDirectory *
-nautilus_directory_get (const char *uri)
-{
- char *canonical_uri, *with_slashes;
- size_t length;
- NautilusDirectory *directory;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- /* FIXME: This currently ignores the issue of two uris that are not identical but point
- * to the same data except for the specific case of trailing '/' characters.
- */
- canonical_uri = nautilus_str_strip_trailing_chr (uri, '/');
- if (strcmp (canonical_uri, uri) != 0) {
- /* If some trailing '/' were stripped, there's the possibility,
- * that we stripped away all the '/' from a uri that has only
- * '/' characters. If you change this code, check to make sure
- * that "file:///" still works as a URI.
- */
- length = strlen (canonical_uri);
- if (length == 0 || canonical_uri[length - 1] == ':') {
- with_slashes = g_strconcat (canonical_uri, "///", NULL);
- g_free (canonical_uri);
- canonical_uri = with_slashes;
- }
- }
-
- /* Create the hash table first time through. */
- if (directory_objects == NULL) {
- directory_objects = g_hash_table_new (g_str_hash, g_str_equal);
- }
-
- /* If the object is already in the hash table, look it up. */
- directory = g_hash_table_lookup (directory_objects,
- canonical_uri);
- if (directory != NULL) {
- nautilus_directory_ref (directory);
- } else {
- /* Create a new directory object instead. */
- directory = nautilus_directory_new (canonical_uri);
- if (directory == NULL) {
- return NULL;
- }
-
- g_assert (strcmp (directory->details->uri_text, canonical_uri) == 0);
-
- /* Put it in the hash table. */
- nautilus_directory_ref (directory);
- gtk_object_sink (GTK_OBJECT (directory));
- g_hash_table_insert (directory_objects,
- directory->details->uri_text,
- directory);
- }
-
- g_free (canonical_uri);
-
- return directory;
-}
-
-char *
-nautilus_directory_get_uri (NautilusDirectory *directory)
-{
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
-
- return g_strdup (directory->details->uri_text);
-}
-
-static void
-metafile_read_done (NautilusDirectory *directory)
-{
- GList *p;
- QueuedCallback *callback;
-
- /* Tell the callers that were waiting for metadata that it's here.
- */
- for (p = directory->details->metafile_callbacks; p != NULL; p = p->next) {
- callback = p->data;
-
- if (callback->file != NULL) {
- g_assert (callback->file->details->directory == directory);
- (* callback->callback.file) (callback->file,
- callback->callback_data);
- nautilus_file_unref (callback->file);
- } else {
- (* callback->callback.directory) (directory,
- callback->callback_data);
- }
- }
- nautilus_g_list_free_deep (directory->details->metafile_callbacks);
- directory->details->metafile_callbacks = NULL;
-}
-
-static void
-metafile_read_cancel (NautilusDirectory *directory)
-{
- if (directory->details->read_state == NULL) {
- return;
- }
-
- gnome_vfs_async_cancel (directory->details->read_state->handle);
- g_free (directory->details->read_state);
- directory->details->read_state = NULL;
-}
-
-static void
-metafile_read_failed (NautilusDirectory *directory,
- GnomeVFSResult result)
-{
- g_free (directory->details->read_state->buffer);
-
- if (directory->details->use_alternate_metafile) {
- directory->details->read_state->buffer = NULL;
- directory->details->read_state->bytes_read = 0;
-
- directory->details->use_alternate_metafile = FALSE;
- metafile_read_start (directory);
- return;
- }
-
- g_free (directory->details->read_state);
-
- directory->details->metafile_read = TRUE;
- directory->details->read_state = NULL;
-
- /* Let the callers that were waiting for the metafile know. */
- metafile_read_done (directory);
-}
-
-static void
-metafile_read_complete (NautilusDirectory *directory)
-{
- char *buffer;
- int size;
-
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (directory->details->metafile == NULL);
-
- /* The gnome-xml parser requires a zero-terminated array.
- * Also, we don't want to allocate an empty buffer
- * because it would be NULL and gnome-xml won't parse
- * NULL properly.
- */
- size = directory->details->read_state->bytes_read;
- buffer = g_realloc (directory->details->read_state->buffer, size + 1);
- buffer[size] = '\0';
- directory->details->metafile = xmlParseMemory (buffer, size);
- g_free (buffer);
-
- g_free (directory->details->read_state);
-
- directory->details->metafile_read = TRUE;
- directory->details->read_state = NULL;
-
- /* Tell that the directory metadata has changed. */
- gtk_signal_emit (GTK_OBJECT (directory),
- signals[METADATA_CHANGED]);
-
- /* Say that all the files have changed.
- * We could optimize this to only mention files that
- * have metadata, but this is a fine rough cut for now.
- */
- nautilus_directory_files_changed (directory,
- directory->details->files);
-
- /* Let the callers that were waiting for the metafile know. */
- metafile_read_done (directory);
-}
-
-static void
-metafile_close_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- /* Do nothing. */
-}
-
-static void
-metafile_read_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data)
-{
- NautilusDirectory *directory;
-
- g_assert (bytes_requested == READ_CHUNK_SIZE);
-
- directory = NAUTILUS_DIRECTORY (callback_data);
- g_assert (directory->details->read_state->handle == handle);
- g_assert ((char *) directory->details->read_state->buffer
- + directory->details->read_state->bytes_read == buffer);
-
- if (result != GNOME_VFS_OK
- && result != GNOME_VFS_ERROR_EOF) {
- metafile_read_failed (directory, result);
- return;
- }
-
- directory->details->read_state->bytes_read += bytes_read;
-
- /* FIXME: Is the call allowed to return fewer bytes than I requested
- * when I'm not at the end of the file? If so, then I need to fix this
- * check. I don't want to stop until the end of the file.
- */
- if (bytes_read == bytes_requested && result == GNOME_VFS_OK) {
- metafile_read_some (directory);
- return;
- }
-
- gnome_vfs_async_close (directory->details->read_state->handle,
- metafile_close_callback,
- directory);
-
- metafile_read_complete (directory);
-}
-
-static void
-metafile_read_some (NautilusDirectory *directory)
-{
- directory->details->read_state->buffer = g_realloc
- (directory->details->read_state->buffer,
- directory->details->read_state->bytes_read + READ_CHUNK_SIZE);
-
- gnome_vfs_async_read (directory->details->read_state->handle,
- (char *) directory->details->read_state->buffer
- + directory->details->read_state->bytes_read,
- READ_CHUNK_SIZE,
- metafile_read_callback,
- directory);
-}
-
-static void
-metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
- g_assert (directory->details->read_state->handle == handle);
-
- if (result != GNOME_VFS_OK) {
- metafile_read_failed (directory, result);
- return;
- }
-
- metafile_read_some (directory);
-}
-
-static void
-metafile_read_start (NautilusDirectory *directory)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
-
- gnome_vfs_async_open_uri (&directory->details->read_state->handle,
- directory->details->use_alternate_metafile
- ? directory->details->alternate_metafile_uri
- : directory->details->metafile_uri,
- GNOME_VFS_OPEN_READ,
- metafile_read_open_callback,
- directory);
-}
-
-static void
-nautilus_directory_request_read_metafile (NautilusDirectory *directory)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
-
- if (directory->details->metafile_read
- || directory->details->read_state != NULL) {
- return;
- }
-
- g_assert (directory->details->metafile == NULL);
-
- directory->details->read_state = g_new0 (MetafileReadState, 1);
- directory->details->use_alternate_metafile = TRUE;
- metafile_read_start (directory);
-}
-
-static void
-metafile_write_done (NautilusDirectory *directory)
-{
- if (directory->details->write_state->write_again) {
- metafile_write_start (directory);
- return;
- }
-
- xmlFree (directory->details->write_state->buffer);
- g_free (directory->details->write_state);
- directory->details->write_state = NULL;
- nautilus_directory_unref (directory);
-}
-
-static void
-metafile_write_failed (NautilusDirectory *directory,
- GnomeVFSResult result)
-{
- if (!directory->details->use_alternate_metafile) {
- directory->details->use_alternate_metafile = TRUE;
- metafile_write_start (directory);
- return;
- }
-
- metafile_write_done (directory);
-}
-
-static void
-metafile_write_complete (NautilusDirectory *directory)
-{
- metafile_write_done (directory);
-}
-
-static void
-metafile_write_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gconstpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
- g_assert (directory->details->write_state->handle == handle);
- g_assert (directory->details->write_state->buffer == buffer);
- g_assert (directory->details->write_state->size == bytes_requested);
-
- if (result != GNOME_VFS_OK) {
- metafile_write_failed (directory, result);
- return;
- }
-
- gnome_vfs_async_close (directory->details->write_state->handle,
- metafile_close_callback,
- directory);
-
- metafile_write_complete (directory);
-}
-
-static void
-metafile_write_create_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
- g_assert (directory->details->write_state->handle == handle);
-
- if (result != GNOME_VFS_OK) {
- metafile_write_failed (directory, result);
- return;
- }
-
- gnome_vfs_async_write (directory->details->write_state->handle,
- directory->details->write_state->buffer,
- directory->details->write_state->size,
- metafile_write_callback,
- directory);
-}
-
-static void
-metafile_write_start (NautilusDirectory *directory)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
-
- directory->details->write_state->write_again = FALSE;
-
- /* Open the file. */
- gnome_vfs_async_create_uri (&directory->details->write_state->handle,
- directory->details->use_alternate_metafile
- ? directory->details->alternate_metafile_uri
- : directory->details->metafile_uri,
- GNOME_VFS_OPEN_WRITE,
- FALSE,
- METAFILE_PERMISSIONS,
- metafile_write_create_callback,
- directory);
-}
-
-static void
-metafile_write (NautilusDirectory *directory)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
-
- nautilus_directory_ref (directory);
-
- /* If we are already writing, then just remember to do it again. */
- if (directory->details->write_state != NULL) {
- nautilus_directory_unref (directory);
- directory->details->write_state->write_again = TRUE;
- return;
- }
-
- /* Don't write anything if there's nothing to write.
- * At some point, we might want to change this to actually delete
- * the metafile in this case.
- */
- if (directory->details->metafile == NULL) {
- nautilus_directory_unref (directory);
- return;
- }
-
- /* Create the write state. */
- directory->details->write_state = g_new0 (MetafileWriteState, 1);
- xmlDocDumpMemory (directory->details->metafile,
- &directory->details->write_state->buffer,
- &directory->details->write_state->size);
-
- metafile_write_start (directory);
-}
-
-static gboolean
-metafile_write_idle_callback (gpointer callback_data)
-{
- NautilusDirectory *directory;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
-
- directory->details->write_metafile_idle_id = 0;
- metafile_write (directory);
-
- nautilus_directory_unref (directory);
-
- return FALSE;
-}
-
-void
-nautilus_directory_request_write_metafile (NautilusDirectory *directory)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
-
- /* Set up an idle task that will write the metafile. */
- if (directory->details->write_metafile_idle_id == 0) {
- nautilus_directory_ref (directory);
- directory->details->write_metafile_idle_id =
- gtk_idle_add (metafile_write_idle_callback,
- directory);
- }
-}
-
-/* To use a directory name as a file name, we need to escape any slashes.
- This means that "/" is replaced by "%2F" and "%" is replaced by "%25".
- Later we might share the escaping code with some more generic escaping
- function, but this should do for now.
-*/
-static char *
-escape_slashes (const char *path)
-{
- char c;
- const char *in;
- guint length;
- char *result;
- char *out;
-
- /* Figure out how long the result needs to be. */
- in = path;
- length = 0;
- while ((c = *in++) != '\0')
- switch (c) {
- case '/':
- case '%':
- length += 3;
- break;
- default:
- length += 1;
- }
-
- /* Create the result string. */
- result = g_malloc (length + 1);
- in = path;
- out = result;
- while ((c = *in++) != '\0')
- switch (c) {
- case '/':
- *out++ = '%';
- *out++ = '2';
- *out++ = 'F';
- break;
- case '%':
- *out++ = '%';
- *out++ = '2';
- *out++ = '5';
- break;
- default:
- *out++ = c;
- }
- g_assert (out == result + length);
- *out = '\0';
-
- return result;
-}
-
-static GnomeVFSResult
-nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions)
-{
- GnomeVFSResult result;
- GnomeVFSURI *parent_uri;
-
- /* Make the directory, and return right away unless there's
- a possible problem with the parent.
- */
- result = gnome_vfs_make_directory_for_uri (uri, permissions);
- if (result != GNOME_VFS_ERROR_NOTFOUND) {
- return result;
- }
-
- /* If we can't get a parent, we are done. */
- parent_uri = gnome_vfs_uri_get_parent (uri);
- if (parent_uri == NULL) {
- return result;
- }
-
- /* If we can get a parent, use a recursive call to create
- the parent and its parents.
- */
- result = nautilus_make_directory_and_parents (parent_uri, permissions);
- gnome_vfs_uri_unref (parent_uri);
- if (result != GNOME_VFS_OK) {
- return result;
- }
-
- /* A second try at making the directory after the parents
- have all been created.
- */
- result = gnome_vfs_make_directory_for_uri (uri, permissions);
- return result;
-}
-
-static GnomeVFSURI *
-construct_alternate_metafile_uri (GnomeVFSURI *uri)
-{
- GnomeVFSResult result;
- GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
- char *uri_as_string, *escaped_uri, *file_name;
-
- /* Ensure that the metafiles directory exists. */
- home_uri = gnome_vfs_uri_new (g_get_home_dir ());
- nautilus_directory_uri = gnome_vfs_uri_append_path (home_uri, NAUTILUS_DIRECTORY_NAME);
- gnome_vfs_uri_unref (home_uri);
- metafiles_directory_uri = gnome_vfs_uri_append_path (nautilus_directory_uri, METAFILES_DIRECTORY_NAME);
- gnome_vfs_uri_unref (nautilus_directory_uri);
- result = nautilus_make_directory_and_parents (metafiles_directory_uri, METAFILES_DIRECTORY_PERMISSIONS);
- if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_FILEEXISTS) {
- gnome_vfs_uri_unref (metafiles_directory_uri);
- return NULL;
- }
-
- /* Construct a file name from the URI. */
- uri_as_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- escaped_uri = escape_slashes (uri_as_string);
- g_free (uri_as_string);
- file_name = g_strconcat (escaped_uri, ".xml", NULL);
- g_free (escaped_uri);
-
- /* Construct a URI for something in the "metafiles" directory. */
- alternate_uri = gnome_vfs_uri_append_path (metafiles_directory_uri, file_name);
- gnome_vfs_uri_unref (metafiles_directory_uri);
- g_free (file_name);
-
- return alternate_uri;
-}
-
-static NautilusDirectory *
-nautilus_directory_new (const char* uri)
-{
- NautilusDirectory *directory;
- GnomeVFSURI *vfs_uri;
- GnomeVFSURI *metafile_uri;
- GnomeVFSURI *alternate_metafile_uri;
-
- vfs_uri = gnome_vfs_uri_new (uri);
- if (vfs_uri == NULL) {
- return NULL;
- }
-
- metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME);
- alternate_metafile_uri = construct_alternate_metafile_uri (vfs_uri);
-
- directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY);
-
- directory->details->uri_text = g_strdup(uri);
- directory->details->uri = vfs_uri;
- directory->details->metafile_uri = metafile_uri;
- directory->details->alternate_metafile_uri = alternate_metafile_uri;
-
- return directory;
-}
-
-void
-nautilus_directory_file_monitor_add (NautilusDirectory *directory,
- gpointer client,
- GList *attributes,
- GList *metadata_keys,
- NautilusFileListCallback callback,
- gpointer callback_data)
-{
- gboolean first_file_monitor;
-
- g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
- g_return_if_fail (callback != NULL);
-
- first_file_monitor = directory->details->file_monitors == NULL;
- directory->details->file_monitors =
- g_list_prepend (directory->details->file_monitors, client);
-
- nautilus_file_list_ref (directory->details->files);
-
- if (directory->details->files != NULL) {
- (* callback) (directory,
- directory->details->files,
- callback_data);
- }
-
- if (!first_file_monitor) {
- nautilus_file_list_unref (directory->details->files);
- return;
- }
-
- if (directory->details->directory_loaded) {
- return;
- }
-
- g_assert (directory->details->directory_load_in_progress == NULL);
-
- g_assert (directory->details->uri->text != NULL);
- directory->details->directory_load_list_last_handled
- = GNOME_VFS_DIRECTORY_LIST_POSITION_NONE;
- gnome_vfs_async_load_directory_uri
- (&directory->details->directory_load_in_progress, /* handle */
- directory->details->uri, /* uri */
- (GNOME_VFS_FILE_INFO_GETMIMETYPE /* options */
- | GNOME_VFS_FILE_INFO_FASTMIMETYPE
- | GNOME_VFS_FILE_INFO_FOLLOWLINKS),
- NULL, /* meta_keys */
- NULL, /* sort_rules */
- FALSE, /* reverse_order */
- GNOME_VFS_DIRECTORY_FILTER_NONE, /* filter_type */
- (GNOME_VFS_DIRECTORY_FILTER_NOSELFDIR /* filter_options */
- | GNOME_VFS_DIRECTORY_FILTER_NOPARENTDIR),
- NULL, /* filter_pattern */
- DIRECTORY_LOAD_ITEMS_PER_CALLBACK, /* items_per_notification */
- nautilus_directory_load_callback, /* callback */
- directory);
-}
-
-static gboolean
-dequeue_pending_idle_callback (gpointer callback_data)
-{
- NautilusDirectory *directory;
- GList *pending_file_info;
- GList *p;
- NautilusFile *file;
- GList *pending_files;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
-
- directory->details->dequeue_pending_idle_id = 0;
-
- pending_file_info = directory->details->pending_file_info;
- directory->details->pending_file_info = NULL;
-
- /* Don't emit a signal if there are no new files. */
- if (pending_file_info == NULL) {
- return FALSE;
- }
-
- /* If we stopped monitoring, then throw away these. */
- if (directory->details->file_monitors == NULL) {
- nautilus_gnome_vfs_file_info_list_free (pending_file_info);
- return FALSE;
- }
-
- /* Build a list of NautilusFile objects. */
- pending_files = NULL;
- for (p = pending_file_info; p != NULL; p = p->next) {
- /* FIXME: The file could already be in the files list
- * if someone did a nautilus_file_get already on it.
- */
- file = nautilus_file_new (directory, p->data);
- pending_files = g_list_prepend (pending_files, file);
- }
- nautilus_gnome_vfs_file_info_list_free (pending_file_info);
-
- /* Tell the objects that are monitoring about these new files. */
- g_assert (pending_files != NULL);
- gtk_signal_emit (GTK_OBJECT (directory),
- signals[FILES_ADDED],
- pending_files);
-
- /* Remember them for later. */
- directory->details->files = g_list_concat
- (directory->details->files, pending_files);
-
- return FALSE;
-}
-
-static void
-schedule_dequeue_pending (NautilusDirectory *directory)
-{
- if (directory->details->dequeue_pending_idle_id == 0) {
- directory->details->dequeue_pending_idle_id
- = gtk_idle_add (dequeue_pending_idle_callback, directory);
- }
-}
-
-static void
-nautilus_directory_load_one (NautilusDirectory *directory,
- GnomeVFSFileInfo *info)
-{
- gnome_vfs_file_info_ref (info);
- directory->details->pending_file_info
- = g_list_prepend (directory->details->pending_file_info, info);
- schedule_dequeue_pending (directory);
-}
-
-static void
-nautilus_directory_load_done (NautilusDirectory *directory,
- GnomeVFSResult result)
-{
- if (directory->details->directory_load_in_progress != NULL) {
- gnome_vfs_async_cancel (directory->details->directory_load_in_progress);
- directory->details->directory_load_in_progress = NULL;
- }
- directory->details->directory_loaded = TRUE;
- schedule_dequeue_pending (directory);
-}
-
-static GnomeVFSDirectoryListPosition
-nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position)
-{
- if (position != GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
- return gnome_vfs_directory_list_position_next (position);
- }
- if (list == NULL) {
- return GNOME_VFS_DIRECTORY_LIST_POSITION_NONE;
- }
- return gnome_vfs_directory_list_get_first_position (list);
-}
-
-static void
-nautilus_directory_load_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- GnomeVFSDirectoryList *list,
- guint entries_read,
- gpointer callback_data)
-{
- NautilusDirectory *directory;
- GnomeVFSDirectoryListPosition last_handled, p;
-
- directory = NAUTILUS_DIRECTORY (callback_data);
-
- g_assert (directory->details->directory_load_in_progress == handle);
-
- /* Move items from the list onto our pending queue.
- * We can't do this in the most straightforward way, becuse the position
- * for a gnome_vfs_directory_list does not have a way of representing one
- * past the end. So we must keep a position to the last item we handled
- * rather than keeping a position past the last item we handled.
- */
- last_handled = directory->details->directory_load_list_last_handled;
- p = last_handled;
- while ((p = nautilus_gnome_vfs_directory_list_get_next_position (list, p))
- != GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
- nautilus_directory_load_one
- (directory, gnome_vfs_directory_list_get (list, p));
- last_handled = p;
- }
- directory->details->directory_load_list_last_handled = last_handled;
-
- if (result != GNOME_VFS_OK) {
- nautilus_directory_load_done (directory, result);
- }
-}
-
-static void
-stop_monitoring_files (NautilusDirectory *directory)
-{
- if (directory->details->directory_load_in_progress != NULL) {
- gnome_vfs_async_cancel (directory->details->directory_load_in_progress);
- directory->details->directory_load_in_progress = NULL;
- }
-
- nautilus_file_list_unref (directory->details->files);
-}
-
-void
-nautilus_directory_file_monitor_remove (NautilusDirectory *directory,
- gpointer client)
-{
- g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
- g_return_if_fail (g_list_find (directory->details->file_monitors, client) != NULL);
-
- directory->details->file_monitors =
- g_list_remove (directory->details->file_monitors, client);
- if (directory->details->file_monitors == NULL) {
- stop_monitoring_files (directory);
- }
-}
-
-gboolean
-nautilus_directory_are_all_files_seen (NautilusDirectory *directory)
-{
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
-
- return directory->details->directory_loaded;
-}
-
-static char *
-get_metadata_from_node (xmlNode *node,
- const char *key,
- const char *default_metadata)
-{
- xmlChar *property;
- char *result;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (key[0] != '\0', NULL);
-
- property = xmlGetProp (node, key);
- if (property == NULL) {
- result = g_strdup (default_metadata);
- } else {
- result = g_strdup (property);
- }
- xmlFree (property);
-
- return result;
-}
-
-static xmlNode *
-create_metafile_root (NautilusDirectory *directory)
-{
- xmlNode *root;
-
- if (directory->details->metafile == NULL) {
- directory->details->metafile = xmlNewDoc (METAFILE_XML_VERSION);
- }
- root = xmlDocGetRootElement (directory->details->metafile);
- if (root == NULL) {
- root = xmlNewDocNode (directory->details->metafile, NULL, "DIRECTORY", NULL);
- xmlDocSetRootElement (directory->details->metafile, root);
- }
-
- return root;
-}
-
-char *
-nautilus_directory_get_metadata (NautilusDirectory *directory,
- const char *key,
- const char *default_metadata)
-{
- /* It's legal to call this on a NULL directory. */
- if (directory == NULL) {
- return g_strdup (default_metadata);
- }
-
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
-
- nautilus_directory_request_read_metafile (directory);
-
- /* The root itself represents the directory. */
- return get_metadata_from_node
- (xmlDocGetRootElement (directory->details->metafile),
- key, default_metadata);
-}
-
-void
-nautilus_directory_set_metadata (NautilusDirectory *directory,
- const char *key,
- const char *default_metadata,
- const char *metadata)
-{
- char *old_metadata;
- gboolean old_metadata_matches;
- xmlNode *root;
- const char *value;
- xmlAttr *property_node;
-
- g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
- g_return_if_fail (key != NULL);
- g_return_if_fail (key[0] != '\0');
-
- /* If the data in the metafile is already correct, do nothing. */
- old_metadata = nautilus_directory_get_metadata (directory, key, default_metadata);
- old_metadata_matches = nautilus_strcmp (old_metadata, metadata) == 0;
- g_free (old_metadata);
- if (old_metadata_matches) {
- return;
- }
-
- /* Data that matches the default is represented in the tree by
- the lack of an attribute.
- */
- if (nautilus_strcmp (default_metadata, metadata) == 0) {
- value = NULL;
- } else {
- value = metadata;
- }
-
- /* Get at the tree. */
- root = create_metafile_root (directory);
-
- /* Add or remove an attribute node. */
- property_node = xmlSetProp (root, key, value);
- if (value == NULL) {
- xmlRemoveProp (property_node);
- }
-
- /* Since we changed the tree, arrange for it to be written. */
- nautilus_directory_request_write_metafile (directory);
- gtk_signal_emit (GTK_OBJECT (directory),
- signals[METADATA_CHANGED]);
-}
-
-gboolean
-nautilus_directory_get_boolean_metadata (NautilusDirectory *directory,
- const char *key,
- gboolean default_metadata)
-{
- char *result_as_string;
- gboolean result;
-
- result_as_string = nautilus_directory_get_metadata
- (directory,
- key,
- default_metadata ? "TRUE" : "FALSE");
-
- /* FIXME: Allow "true" and "false"? */
- if (strcmp (result_as_string, "TRUE") == 0) {
- result = TRUE;
- } else if (strcmp (result_as_string, "FALSE") == 0) {
- result = FALSE;
- } else {
- if (result_as_string != NULL) {
- g_warning ("boolean metadata with value other than TRUE or FALSE");
- }
- result = default_metadata;
- }
-
- g_free (result_as_string);
- return result;
-
-}
-
-void
-nautilus_directory_set_boolean_metadata (NautilusDirectory *directory,
- const char *key,
- gboolean default_metadata,
- gboolean metadata)
-{
- nautilus_directory_set_metadata (directory,
- key,
- default_metadata ? "TRUE" : "FALSE",
- metadata ? "TRUE" : "FALSE");
-}
-
-int
-nautilus_directory_get_integer_metadata (NautilusDirectory *directory,
- const char *key,
- int default_metadata)
-{
- char *result_as_string;
- char *default_as_string;
- int result;
-
- default_as_string = g_strdup_printf ("%d", default_metadata);
- result_as_string = nautilus_directory_get_metadata
- (directory, key, default_as_string);
-
- /* Handle oddball case of non-existent directory */
- if (result_as_string == NULL) {
- result = default_metadata;
- } else {
- result = atoi (result_as_string);
- g_free (result_as_string);
- }
-
- g_free (default_as_string);
- return result;
-
-}
-
-void
-nautilus_directory_set_integer_metadata (NautilusDirectory *directory,
- const char *key,
- int default_metadata,
- int metadata)
-{
- char *value_as_string;
- char *default_as_string;
-
- value_as_string = g_strdup_printf ("%d", metadata);
- default_as_string = g_strdup_printf ("%d", default_metadata);
-
- nautilus_directory_set_metadata (directory,
- key,
- default_as_string,
- value_as_string);
-
- g_free (value_as_string);
- g_free (default_as_string);
-}
-
-xmlNode *
-nautilus_directory_get_file_metadata_node (NautilusDirectory *directory,
- const char *file_name,
- gboolean create)
-{
- xmlNode *root, *child;
-
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
-
- /* The root itself represents the directory.
- * The children represent the files.
- * FIXME: This linear search may not be fast enough.
- * Eventually, we'll have a pointer from the NautilusFile right to
- * the corresponding XML node, or we won't have the XML tree
- * in memory at all.
- */
- child = nautilus_xml_get_root_child_by_name_and_property
- (directory->details->metafile,
- "FILE", METADATA_NODE_NAME_FOR_FILE_NAME, file_name);
- if (child != NULL) {
- return child;
- }
-
- /* Create if necessary. */
- if (create) {
- root = create_metafile_root (directory);
- child = xmlNewChild (root, NULL, "FILE", NULL);
- xmlSetProp (child, METADATA_NODE_NAME_FOR_FILE_NAME, file_name);
- return child;
- }
-
- return NULL;
-}
-
-static int
-compare_queued_callbacks (gconstpointer a, gconstpointer b)
-{
- const QueuedCallback *callback_a, *callback_b;
-
- callback_a = a;
- callback_b = b;
- if (callback_a->file < callback_b->file) {
- return -1;
- }
- if (callback_a->file > callback_b->file) {
- return 1;
- }
- if (callback_a->file == NULL) {
- if (callback_a->callback.directory < callback_b->callback.directory) {
- return -1;
- }
- if (callback_a->callback.directory > callback_b->callback.directory) {
- return 1;
- }
- } else {
- if (callback_a->callback.file < callback_b->callback.file) {
- return -1;
- }
- if (callback_a->callback.file > callback_b->callback.file) {
- return 1;
- }
- }
- if (callback_a->callback_data < callback_b->callback_data) {
- return -1;
- }
- if (callback_a->callback_data > callback_b->callback_data) {
- return 1;
- }
- return 0;
-}
-
-void
-nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
- const QueuedCallback *callback)
-{
- g_assert (directory == NULL || NAUTILUS_IS_DIRECTORY (directory));
- g_assert (callback != NULL);
- g_assert (callback->file == NULL || callback->file->details->directory == directory);
-
- /* Call back right away if it's already ready. */
- if (directory == NULL || directory->details->metafile_read) {
- if (callback->file != NULL) {
- (* callback->callback.file) (callback->file,
- callback->callback_data);
- } else {
- (* callback->callback.directory) (directory,
- callback->callback_data);
- }
- return;
- }
-
- /* Add the new callback to the list unless it's already in there. */
- if (g_list_find_custom (directory->details->metafile_callbacks,
- (QueuedCallback *) callback,
- compare_queued_callbacks) == NULL) {
- nautilus_file_ref (callback->file);
- directory->details->metafile_callbacks = g_list_prepend
- (directory->details->metafile_callbacks,
- g_memdup (callback,
- sizeof (*callback)));
- }
-
- /* Start reading the metafile. */
- nautilus_directory_request_read_metafile (directory);
-}
-
-void
-nautilus_directory_call_when_ready (NautilusDirectory *directory,
- GList *directory_metadata_keys,
- GList *file_metadata_keys,
- NautilusDirectoryCallback callback,
- gpointer callback_data)
-{
- QueuedCallback new_callback;
-
- g_return_if_fail (directory == NULL || NAUTILUS_IS_DIRECTORY (directory));
- g_return_if_fail (directory_metadata_keys != NULL || file_metadata_keys != NULL);
- g_return_if_fail (callback != NULL);
-
- new_callback.file = NULL;
- new_callback.callback.directory = callback;
- new_callback.callback_data = callback_data;
-
- nautilus_directory_call_when_ready_internal (directory, &new_callback);
-}
-
-void
-nautilus_directory_cancel_callback_internal (NautilusDirectory *directory,
- const QueuedCallback *callback)
-{
- GList *p;
-
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (callback != NULL);
-
- /* Remove queued callback from the list. */
- p = g_list_find_custom (directory->details->metafile_callbacks,
- (QueuedCallback *) callback,
- compare_queued_callbacks);
- if (p != NULL) {
- nautilus_file_unref (callback->file);
- g_free (p->data);
- directory->details->metafile_callbacks = g_list_remove_link
- (directory->details->metafile_callbacks, p);
- }
-}
-
-void
-nautilus_directory_cancel_callback (NautilusDirectory *directory,
- NautilusDirectoryCallback callback,
- gpointer callback_data)
-{
- QueuedCallback old_callback;
-
- g_return_if_fail (callback != NULL);
-
- if (directory == NULL) {
- return;
- }
-
- /* NULL is OK here for non-vfs protocols */
- g_return_if_fail (!directory || NAUTILUS_IS_DIRECTORY (directory));
-
- old_callback.file = NULL;
- old_callback.callback.directory = callback;
- old_callback.callback_data = callback_data;
-
- nautilus_directory_cancel_callback_internal (directory, &old_callback);
-}
-
-char *
-nautilus_directory_get_file_metadata (NautilusDirectory *directory,
- const char *file_name,
- const char *key,
- const char *default_metadata)
-{
- nautilus_directory_request_read_metafile (directory);
-
- return get_metadata_from_node
- (nautilus_directory_get_file_metadata_node (directory, file_name, FALSE),
- key, default_metadata);
-}
-
-gboolean
-nautilus_directory_set_file_metadata (NautilusDirectory *directory,
- const char *file_name,
- const char *key,
- const char *default_metadata,
- const char *metadata)
-{
- char *old_metadata;
- gboolean old_metadata_matches;
- xmlNode *child;
- const char *value;
- xmlAttr *property_node;
-
- g_return_val_if_fail (strcmp (key, METADATA_NODE_NAME_FOR_FILE_NAME) != 0, FALSE);
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
- g_return_val_if_fail (key[0] != '\0', FALSE);
-
- /* If the data in the metafile is already correct, do nothing. */
- old_metadata = nautilus_directory_get_file_metadata
- (directory, file_name, key, default_metadata);
- old_metadata_matches = nautilus_strcmp (old_metadata, metadata) == 0;
- g_free (old_metadata);
- if (old_metadata_matches) {
- return FALSE;
- }
-
- /* Data that matches the default is represented in the tree by
- the lack of an attribute.
- */
- if (nautilus_strcmp (default_metadata, metadata) == 0) {
- value = NULL;
- } else {
- value = metadata;
- }
-
- /* Get or create the node. */
- child = nautilus_directory_get_file_metadata_node (directory,
- file_name,
- value != NULL);
- /* Add or remove an attribute node. */
- if (child != NULL) {
- property_node = xmlSetProp (child, key, value);
- if (value == NULL) {
- xmlRemoveProp (property_node);
- }
- }
-
- /* Since we changed the tree, arrange for it to be written. */
- nautilus_directory_request_write_metafile (directory);
-
- return TRUE;
-}
-
-static int
-compare_file_with_name (gconstpointer a, gconstpointer b)
-{
- return strcmp (NAUTILUS_FILE (a)->details->info->name,
- (const char *) b);
-}
-
-NautilusFile *
-nautilus_directory_find_file (NautilusDirectory *directory, const char *name)
-{
- GList *list_entry;
-
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- list_entry = g_list_find_custom (directory->details->files,
- (gpointer) name,
- compare_file_with_name);
-
- return list_entry == NULL ? NULL : list_entry->data;
-}
-
-void
-nautilus_directory_files_changed (NautilusDirectory *directory,
- GList *changed_files)
-{
- GList *p;
-
- for (p = changed_files; p != NULL; p = p->next) {
- nautilus_file_emit_changed (p->data);
- }
- gtk_signal_emit (GTK_OBJECT (directory),
- signals[FILES_CHANGED],
- changed_files);
-}
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static int data_dummy;
-static guint file_count;
-static gboolean got_metadata_flag;
-
-static void
-get_files_callback (NautilusDirectory *directory, GList *files, gpointer callback_data)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (files != NULL);
- g_assert (callback_data == &data_dummy);
-
- file_count += g_list_length (files);
-}
-
-static void
-got_metadata_callback (NautilusDirectory *directory, gpointer callback_data)
-{
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (callback_data == &data_dummy);
-
- got_metadata_flag = TRUE;
-}
-
-/* Return the number of extant NautilusDirectories */
-int
-nautilus_directory_number_outstanding (void)
-{
- return g_hash_table_size (directory_objects);
-}
-
-void
-nautilus_self_check_directory (void)
-{
- NautilusDirectory *directory;
- GList *list;
-
- list = g_list_prepend (NULL, "TEST");
-
- directory = nautilus_directory_get ("file:///etc");
-
- NAUTILUS_CHECK_INTEGER_RESULT (g_hash_table_size (directory_objects), 1);
-
- file_count = 0;
- nautilus_directory_file_monitor_add (directory, &file_count,
- NULL, NULL,
- get_files_callback, &data_dummy);
-
- got_metadata_flag = FALSE;
- nautilus_directory_call_when_ready (directory, list, NULL,
- got_metadata_callback, &data_dummy);
-
- while (!got_metadata_flag) {
- gtk_main_iteration ();
- }
-
- nautilus_directory_set_metadata (directory, "TEST", "default", "value");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_directory_get_metadata (directory, "TEST", "default"), "value");
-
- nautilus_directory_set_boolean_metadata (directory, "TEST_BOOLEAN", TRUE, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get_boolean_metadata (directory, "TEST_BOOLEAN", TRUE), TRUE);
- nautilus_directory_set_boolean_metadata (directory, "TEST_BOOLEAN", TRUE, FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get_boolean_metadata (directory, "TEST_BOOLEAN", TRUE), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get_boolean_metadata (NULL, "TEST_BOOLEAN", TRUE), TRUE);
-
- nautilus_directory_set_integer_metadata (directory, "TEST_INTEGER", 0, 17);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_get_integer_metadata (directory, "TEST_INTEGER", 0), 17);
- nautilus_directory_set_integer_metadata (directory, "TEST_INTEGER", 0, -1);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_get_integer_metadata (directory, "TEST_INTEGER", 0), -1);
- nautilus_directory_set_integer_metadata (directory, "TEST_INTEGER", 42, 42);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_get_integer_metadata (directory, "TEST_INTEGER", 42), 42);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_get_integer_metadata (NULL, "TEST_INTEGER", 42), 42);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_get_integer_metadata (directory, "NONEXISTENT_KEY", 42), 42);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get ("file:///etc") == directory, TRUE);
- nautilus_directory_unref (directory);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get ("file:///etc/") == directory, TRUE);
- nautilus_directory_unref (directory);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_directory_get ("file:///etc////") == directory, TRUE);
- nautilus_directory_unref (directory);
-
- nautilus_directory_file_monitor_remove (directory, &file_count);
-
- nautilus_directory_unref (directory);
-
- while (g_hash_table_size (directory_objects) != 0) {
- gtk_main_iteration ();
- }
-
- NAUTILUS_CHECK_INTEGER_RESULT (g_hash_table_size (directory_objects), 0);
-
- directory = nautilus_directory_get ("file:///etc");
-
- got_metadata_flag = FALSE;
- nautilus_directory_call_when_ready (directory, list, NULL,
- got_metadata_callback, &data_dummy);
-
- while (!got_metadata_flag) {
- gtk_main_iteration ();
- }
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (directory->details->metafile != NULL, TRUE);
-
- NAUTILUS_CHECK_INTEGER_RESULT (g_hash_table_size (directory_objects), 1);
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_directory_get_metadata (directory, "TEST", "default"), "value");
-
- nautilus_directory_unref (directory);
-
- /* escape_slashes */
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes (""), "");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("/"), "%2F");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("%"), "%25");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("a/a"), "a%2Fa");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("a%a"), "a%25a");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("%25"), "%2525");
- NAUTILUS_CHECK_STRING_RESULT (escape_slashes ("%2F"), "%252F");
-
- g_list_free (list);
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-directory.h b/libnautilus/nautilus-directory.h
deleted file mode 100644
index 41b72f0ac..000000000
--- a/libnautilus/nautilus-directory.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.h: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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_DIRECTORY_H
-#define NAUTILUS_DIRECTORY_H
-
-#include <gtk/gtkobject.h>
-
-/* NautilusDirectory is a class that manages the model for a directory,
- real or virtual, for Nautilus, mainly the file-manager component. The directory is
- responsible for managing both real data and cached metadata. On top of
- the file system independence provided by gnome-vfs, the directory
- object also provides:
-
- 1) A synchronization framework, which notifies via signals as the
- set of known files changes.
- 2) An abstract interface for getting attributes and performing
- operations on files.
- 3) An interface that folds together the cached information that's
- kept in the metafile with "trustworthy" versions of the same
- information available from other means.
-*/
-
-typedef struct NautilusDirectory NautilusDirectory;
-typedef struct NautilusDirectoryClass NautilusDirectoryClass;
-
-#define NAUTILUS_TYPE_DIRECTORY \
- (nautilus_directory_get_type ())
-#define NAUTILUS_DIRECTORY(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_DIRECTORY, NautilusDirectory))
-#define NAUTILUS_DIRECTORY_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DIRECTORY, NautilusDirectoryClass))
-#define NAUTILUS_IS_DIRECTORY(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_DIRECTORY))
-#define NAUTILUS_IS_DIRECTORY_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DIRECTORY))
-
-typedef void (*NautilusDirectoryCallback) (NautilusDirectory *directory,
- gpointer callback_data);
-typedef void (*NautilusFileListCallback) (NautilusDirectory *directory,
- GList *files,
- gpointer callback_data);
-
-/* Basic GtkObject requirements. */
-GtkType nautilus_directory_get_type (void);
-
-/* Get a directory given a uri.
- * Creates the appropriate subclass given the uri mappings.
- * Returns a referenced object, not a floating one. Unref when finished.
- * If two windows are viewing the same uri, the directory object is shared.
- */
-NautilusDirectory *nautilus_directory_get (const char *uri);
-
-/* Convenience functions, since we do a lot of ref'ing and unref'ing. */
-void nautilus_directory_ref (NautilusDirectory *directory);
-void nautilus_directory_unref (NautilusDirectory *directory);
-
-/* Access to a URI. */
-char * nautilus_directory_get_uri (NautilusDirectory *directory);
-
-/* Waiting for data that's read asynchronously.
- * This interface currently works only for metadata, but could be expanded
- * to other attributes as well.
- */
-void nautilus_directory_call_when_ready (NautilusDirectory *directory,
- GList *directory_metadata_keys,
- GList *file_metadata_keys,
- NautilusDirectoryCallback callback,
- gpointer callback_data);
-void nautilus_directory_cancel_callback (NautilusDirectory *directory,
- NautilusDirectoryCallback callback,
- gpointer callback_data);
-/* Getting and setting metadata. */
-char * nautilus_directory_get_metadata (NautilusDirectory *directory,
- const char *key,
- const char *default_metadata);
-void nautilus_directory_set_metadata (NautilusDirectory *directory,
- const char *key,
- const char *default_metadata,
- const char *metadata);
-
-/* Covers for common data types. */
-gboolean nautilus_directory_get_boolean_metadata (NautilusDirectory *directory,
- const char *key,
- gboolean default_metadata);
-void nautilus_directory_set_boolean_metadata (NautilusDirectory *directory,
- const char *key,
- gboolean default_metadata,
- gboolean metadata);
-int nautilus_directory_get_integer_metadata (NautilusDirectory *directory,
- const char *key,
- int default_metadata);
-void nautilus_directory_set_integer_metadata (NautilusDirectory *directory,
- const char *key,
- int default_metadata,
- int metadata);
-
-/* Monitor the files in a directory. */
-void nautilus_directory_file_monitor_add (NautilusDirectory *directory,
- gpointer client,
- GList *attributes,
- GList *metadata_keys,
- NautilusFileListCallback initial_files_callback,
- gpointer callback_data);
-void nautilus_directory_file_monitor_remove (NautilusDirectory *directory,
- gpointer client);
-
-/* Return true if the directory has information about all the files.
- * This will be false until the directory has been read at least once.
- */
-gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory);
-
-/* Return true if the directory metadata has been loaded.
- * Until this is true, get_metadata calls will return defaults.
- * (We could have another way to indicate "don't know".)
- */
-gboolean nautilus_directory_metadata_loaded (NautilusDirectory *directory);
-
-typedef struct NautilusDirectoryDetails NautilusDirectoryDetails;
-
-struct NautilusDirectory
-{
- GtkObject object;
- NautilusDirectoryDetails *details;
-};
-
-struct NautilusDirectoryClass
-{
- GtkObjectClass parent_class;
-
- /*** Notification signals for clients to connect to. ***/
-
- /* The files_added signal is emitted as the directory model
- * discovers new files.
- */
- void (* files_added) (NautilusDirectory *directory,
- GList *added_files);
-
- /* The files_changed signal is emitted as changes occur to
- * existing files that are noticed by the synchronization framework,
- * including when an old file has been deleted. When an old file
- * has been deleted, this is the last chance to forget about these
- * file objects, which are about to be unref'd. Use a call to
- * nautilus_file_is_gone () to test for this case.
- */
- void (* files_changed) (NautilusDirectory *directory,
- GList *changed_files);
-
- /* The metadata_changed signal is emitted when changes to the metadata
- * for the directory itself are made. Changes to file metadata just
- * result in calls to files_changed.
- */
- void (* metadata_changed) (NautilusDirectory *directory);
-};
-
-#endif /* NAUTILUS_DIRECTORY_H */
diff --git a/libnautilus/nautilus-file-private.h b/libnautilus/nautilus-file-private.h
deleted file mode 100644
index 169555359..000000000
--- a/libnautilus/nautilus-file-private.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-directory.c: Nautilus directory model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include "nautilus-file.h"
-#include "nautilus-directory.h"
-
-struct NautilusFileDetails
-{
- NautilusDirectory *directory;
- GnomeVFSFileInfo *info;
- gboolean is_gone;
-};
-
-NautilusFile *nautilus_file_new (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-void nautilus_file_emit_changed (NautilusFile *file);
diff --git a/libnautilus/nautilus-file-utilities.c b/libnautilus/nautilus-file-utilities.c
deleted file mode 100644
index a6983dc01..000000000
--- a/libnautilus/nautilus-file-utilities.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-file-utilities..c - implementation of file manipulation routines.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#include "nautilus-file-utilities.h"
-
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-
-const char* const nautilus_user_directory_name = ".nautilus";
-const char* const nautilus_user_top_directory_name = "top";
-const unsigned default_nautilus_directory_mode = 0755;
-
-
-
-/**
- * nautilus_make_path:
- *
- * Make a path name from a base path and name. The base path
- * can end with or without a separator character.
- *
- * Return value: the combined path name.
- **/
-char *
-nautilus_make_path(const char *path, const char* name)
-{
- gboolean insert_separator;
- gint path_length;
- char *result;
-
- path_length = strlen (path);
- insert_separator = path_length > 0 &&
- name[0] != '\0' > 0 &&
- path[path_length - 1] != G_DIR_SEPARATOR;
-
- if (insert_separator) {
- result = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL);
- } else {
- result = g_strconcat(path, name, NULL);
- }
-
- return result;
-}
-
-
-
-/**
- * nautilus_user_directory:
- *
- * Get the path for the directory containing nautilus settings.
- *
- * Return value: the directory path.
- **/
-const char *
-nautilus_user_directory()
-{
- static char *user_directory;
-
- if (user_directory == NULL)
- {
- user_directory = nautilus_make_path (g_get_home_dir(),
- nautilus_user_directory_name);
-
- if (!g_file_exists (user_directory))
- {
- mkdir (user_directory, default_nautilus_directory_mode);
- }
-
- }
-
- if (!g_file_test (user_directory, G_FILE_TEST_ISDIR))
- {
- /* Bad news, directory still isn't there.
- * FIXME: Report this to user somehow.
- */
- g_assert_not_reached();
- }
-
- return user_directory;
-}
-
-/**
- * nautilus_user_top_directory:
- *
- * Get the path for the user's top directory.
- * Usually ~/.nautilus/top
- *
- * Return value: the directory path.
- **/
-const char *
-nautilus_user_top_directory (void)
-{
- static char *user_top_directory;
-
- if (user_top_directory == NULL)
- {
- const char * user_directory;
-
- user_directory = nautilus_user_directory ();
-
- g_assert (user_directory != NULL);
-
- user_top_directory = nautilus_make_path (user_directory,
- nautilus_user_top_directory_name);
-
- if (!g_file_exists (user_top_directory))
- {
- /* FIXME: Hack the prefix for now */
- const char *gnome_prefix = "/gnome";
-
- GString *src;
- GString *dst;
- GString *command;
-
-
- src = g_string_new (gnome_prefix);
- g_string_append (src, "/share/nautilus/top");
-
- dst = g_string_new (user_top_directory);
-
- command = g_string_new ("cp -R ");
- g_string_append (command, src->str);
- g_string_append (command, " ");
- g_string_append (command, dst->str);
-
- if (system (command->str) != 0)
- {
- g_warning ("could not execute '%s'. Make sure you typed 'make install'",
- command->str);
- }
-
- g_string_free (src, TRUE);
- g_string_free (dst, TRUE);
- g_string_free (command, TRUE);
- }
-
- }
-
- if (!g_file_test (user_top_directory, G_FILE_TEST_ISDIR))
- {
- /* Bad news, directory still isn't there.
- * FIXME: Report this to user somehow.
- */
- g_assert_not_reached();
-
- }
-
- return user_top_directory;
-}
diff --git a/libnautilus/nautilus-file-utilities.h b/libnautilus/nautilus-file-utilities.h
deleted file mode 100644
index 4b4dcfac8..000000000
--- a/libnautilus/nautilus-file-utilities.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-file-utilities.h - interface for file manipulation routines.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#ifndef NAUTILUS_FILE_UTILITIES_H
-#define NAUTILUS_FILE_UTILITIES_H
-
-#include <glib.h>
-
-char * nautilus_make_path (const char *path,
- const char *name);
-const char *nautilus_user_directory (void);
-const char *nautilus_user_top_directory (void);
-
-#endif /* NAUTILUS_FILE_UTILITIES_H */
diff --git a/libnautilus/nautilus-file.c b/libnautilus/nautilus-file.c
deleted file mode 100644
index b7b2a8d39..000000000
--- a/libnautilus/nautilus-file.c
+++ /dev/null
@@ -1,1663 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-file.c: Nautilus file model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-#include "nautilus-file-private.h"
-
-#include <grp.h>
-#include <pwd.h>
-
-#include <gtk/gtksignal.h>
-
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-mime-info.h>
-#include <libgnome/gnome-mime.h>
-
-#include <stdlib.h>
-#include <xmlmemory.h>
-
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gtk-extensions.h"
-#include "nautilus-xml-extensions.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-string.h"
-#include "nautilus-directory-private.h"
-#include "nautilus-gtk-macros.h"
-
-typedef enum {
- NAUTILUS_DATE_TYPE_MODIFIED,
- NAUTILUS_DATE_TYPE_CHANGED,
- NAUTILUS_DATE_TYPE_ACCESSED
-} NautilusDateType;
-
-#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-/* FIXME: This hack needs to die eventually. See comments with function */
-static int get_directory_item_count_hack (NautilusFile *file,
- gboolean ignore_invisible_items);
-static void nautilus_file_initialize_class (NautilusFileClass *klass);
-static void nautilus_file_initialize (NautilusFile *file);
-static void destroy (GtkObject *object);
-static int nautilus_file_compare_by_emblems (NautilusFile *file_1,
- NautilusFile *file_2);
-static int nautilus_file_compare_by_type (NautilusFile *file_1,
- NautilusFile *file_2);
-static int nautilus_file_compare_for_sort_internal (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type,
- gboolean reversed);
-static char *nautilus_file_get_date_as_string (NautilusFile *file,
- NautilusDateType date_type);
-static char *nautilus_file_get_owner_as_string (NautilusFile *file);
-static char *nautilus_file_get_group_as_string (NautilusFile *file);
-static char *nautilus_file_get_permissions_as_string (NautilusFile *file);
-static char *nautilus_file_get_size_as_string (NautilusFile *file);
-static char *nautilus_file_get_type_as_string (NautilusFile *file);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusFile, nautilus_file, GTK_TYPE_OBJECT)
-
-static void
-nautilus_file_initialize_class (NautilusFileClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = destroy;
-
- signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusFileClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-nautilus_file_initialize (NautilusFile *file)
-{
- file->details = g_new0 (NautilusFileDetails, 1);
-}
-
-NautilusFile *
-nautilus_file_new (NautilusDirectory *directory, GnomeVFSFileInfo *info)
-{
- NautilusFile *file;
-
- g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
- g_return_val_if_fail (info != NULL, NULL);
-
- file = gtk_type_new (NAUTILUS_TYPE_FILE);
-
- nautilus_file_ref (file);
- gtk_object_sink (GTK_OBJECT (file));
-
- gnome_vfs_file_info_ref (info);
- nautilus_directory_ref (directory);
-
- file->details->directory = directory;
- file->details->info = info;
-
- return file;
-}
-
-/**
- * nautilus_file_get:
- * @uri: URI of file to get.
- *
- * Get a file given a uri.
- * Returns a referenced object. Unref when finished.
- * If two windows are viewing the same uri, the file object is shared.
- */
-NautilusFile *
-nautilus_file_get (const char *uri)
-{
- GnomeVFSResult result;
- GnomeVFSFileInfo *file_info;
- GnomeVFSURI *vfs_uri, *directory_vfs_uri;
- char *directory_uri;
- NautilusDirectory *directory;
- NautilusFile *file;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- /* Get info on the file. */
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info (uri, file_info,
- GNOME_VFS_FILE_INFO_GETMIMETYPE
- | GNOME_VFS_FILE_INFO_FASTMIMETYPE
- | GNOME_VFS_FILE_INFO_FOLLOWLINKS, NULL);
- if (result != GNOME_VFS_OK) {
- return NULL;
- }
-
- /* Make VFS version of URI. */
- vfs_uri = gnome_vfs_uri_new (uri);
- if (vfs_uri == NULL) {
- return NULL;
- }
-
- /* Make VFS version of directory URI. */
- directory_vfs_uri = gnome_vfs_uri_get_parent (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
- if (directory_vfs_uri == NULL) {
- return NULL;
- }
-
- /* Make text version of directory URI. */
- directory_uri = gnome_vfs_uri_to_string (directory_vfs_uri,
- GNOME_VFS_URI_HIDE_NONE);
- gnome_vfs_uri_unref (directory_vfs_uri);
-
- /* Get object that represents the directory. */
- directory = nautilus_directory_get (directory_uri);
- g_free (directory_uri);
- if (directory == NULL) {
- return NULL;
- }
-
- file = nautilus_directory_find_file (directory, file_info->name);
- if (file != NULL) {
- nautilus_file_ref (file);
- } else {
- file = nautilus_file_new (directory, file_info);
- directory->details->files =
- g_list_append (directory->details->files, file);
- }
-
- gnome_vfs_file_info_unref (file_info);
- nautilus_directory_unref (directory);
-
- return file;
-}
-
-static void
-destroy (GtkObject *object)
-{
- NautilusFile *file;
-
- file = NAUTILUS_FILE (object);
-
- if (file->details->is_gone) {
- g_assert (g_list_find (file->details->directory->details->files, file) == NULL);
- } else {
- g_assert (g_list_find (file->details->directory->details->files, file) != NULL);
- file->details->directory->details->files
- = g_list_remove (file->details->directory->details->files, file);
- }
-
- nautilus_directory_unref (file->details->directory);
-}
-
-void
-nautilus_file_ref (NautilusFile *file)
-{
- if (file == NULL) {
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- gtk_object_ref (GTK_OBJECT (file));
-}
-
-void
-nautilus_file_unref (NautilusFile *file)
-{
- if (file == NULL) {
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- gtk_object_unref (GTK_OBJECT (file));
-}
-
-static NautilusFile *
-get_file_for_parent_directory (NautilusFile *file)
-{
- char *parent_uri;
- NautilusFile *result;
-
- g_assert (NAUTILUS_IS_FILE (file));
-
- if (file->details->directory == NULL) {
- return NULL;
- }
-
- parent_uri = nautilus_directory_get_uri (file->details->directory);
- result = nautilus_file_get (parent_uri);
- g_free (parent_uri);
-
- return result;
-}
-
-/**
- * nautilus_file_can_rename:
- *
- * Check whether the user is allowed to change the name of the file.
- *
- * @file: The file to check.
- *
- * Return value: FALSE if the user is definitely not allowed to change
- * the name of the file. If the user is allowed to change the name, or
- * the code can't tell whether the user is allowed to change the name,
- * returns TRUE (so rename failures must always be handled).
- */
-gboolean
-nautilus_file_can_rename (NautilusFile *file)
-{
- NautilusFile *parent;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
- parent = get_file_for_parent_directory (file);
-
- if (parent == NULL) {
- /*
- * No parent directory for some reason (at root level?).
- * Can't tell whether this file is renameable, so return TRUE.
- */
- return TRUE;
- }
-
- if ((parent->details->info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS) == 0){
- /*
- * Parent's permissions field is not valid.
- * Can't tell whether this file is renameable, so return TRUE.
- */
- return TRUE;
- }
-
- /* Trust the write permissions of the parent directory. */
- return (file->details->info->permissions & GNOME_VFS_PERM_USER_WRITE) != 0;
-}
-
-GnomeVFSResult
-nautilus_file_rename (NautilusFile *file, const char *new_name)
-{
- GnomeVFSURI *new_uri;
- char *old_uri_text;
- char *new_uri_text;
- GnomeVFSResult result;
- xmlNode *file_node;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), GNOME_VFS_ERROR_BADPARAMS);
- g_return_val_if_fail (!nautilus_file_is_gone (file), GNOME_VFS_ERROR_BADPARAMS);
- g_return_val_if_fail (nautilus_strlen (new_name) > 0, GNOME_VFS_ERROR_BADPARAMS);
-
- /*
- * Test the name-hasn't-changed case explicitly, for two reasons.
- * (1) gnome_vfs_move returns an error if new & old are same.
- * (2) We don't want to send file-changed signal if nothing changed.
- */
- if (strcmp (new_name, file->details->info->name) == 0) {
- return GNOME_VFS_OK;
- }
-
- old_uri_text = nautilus_file_get_uri (file);
-
- new_uri = gnome_vfs_uri_append_path (file->details->directory->details->uri,
- new_name);
- new_uri_text = gnome_vfs_uri_to_string (new_uri, GNOME_VFS_URI_HIDE_NONE);
- gnome_vfs_uri_unref (new_uri);
-
- /* FIXME: Should handle possibility of slow asynch call here. */
- result = gnome_vfs_move (old_uri_text, new_uri_text, FALSE);
- if (result == GNOME_VFS_OK) {
- file_node = nautilus_directory_get_file_metadata_node
- (file->details->directory,
- file->details->info->name,
- FALSE);
-
- if (file_node != NULL) {
- xmlSetProp (file_node, METADATA_NODE_NAME_FOR_FILE_NAME, new_name);
- nautilus_directory_request_write_metafile (file->details->directory);
- }
-
- /* FIXME: Make sure this does something sensible with incoming names containing
- * path separators.
- */
- g_free (file->details->info->name);
- file->details->info->name = g_strdup (new_name);
-
- nautilus_file_changed (file);
- }
-
- g_free (old_uri_text);
- g_free (new_uri_text);
-
- return result;
-}
-
-gboolean
-nautilus_file_matches_uri (NautilusFile *file, const char *uri_string)
-{
- GnomeVFSURI *match_uri;
- GnomeVFSURI *file_uri;
- gboolean result;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
- g_return_val_if_fail (uri_string != NULL, FALSE);
-
- match_uri = gnome_vfs_uri_new (uri_string);
- if (match_uri == NULL)
- return FALSE;
-
- result = FALSE;
- file_uri = gnome_vfs_uri_append_path (file->details->directory->details->uri,
- file->details->info->name);
-
- if (match_uri != NULL) {
- result = gnome_vfs_uri_equal (file_uri, match_uri);
- }
-
- gnome_vfs_uri_unref (file_uri);
- gnome_vfs_uri_unref (match_uri);
-
- return result;
-}
-
-static int
-nautilus_file_compare_by_size_with_directories (NautilusFile *file_1, NautilusFile *file_2)
-{
- gboolean is_directory_1;
- gboolean is_directory_2;
- int item_count_1;
- int item_count_2;
-
- is_directory_1 = nautilus_file_is_directory (file_1);
- is_directory_2 = nautilus_file_is_directory (file_2);
-
- if (is_directory_1 && !is_directory_2) {
- return -1;
- }
-
- if (is_directory_2 && !is_directory_1) {
- return +1;
- }
-
- if (!is_directory_1 && !is_directory_2) {
- return 0;
- }
-
- /* Both are directories, compare by item count. */
- /* FIXME: get_directory_item_count_hack is slow, and calling
- * it for every pairwise comparison here is nasty. Need to
- * change this to (not-yet-existent) architecture where the
- * item count can be calculated once in a deferred way, and
- * then stored or cached.
- */
- item_count_1 = get_directory_item_count_hack (file_1, FALSE);
- item_count_2 = get_directory_item_count_hack (file_2, FALSE);
-
- if (item_count_1 < item_count_2) {
- return -1;
- }
-
- if (item_count_2 < item_count_1) {
- return +1;
- }
-
- return 0;
-}
-
-/**
- * compare_emblem_names
- *
- * Compare two emblem names by canonical order. Canonical order
- * is alphabetical, except the symbolic link name goes first. NULL
- * is allowed, and goes last.
- * @name_1: The first emblem name.
- * @name_2: The second emblem name.
- *
- * Return value: 0 if names are equal, -1 if @name_1 should be
- * first, +1 if @name_2 should be first.
- */
-static int
-compare_emblem_names (const char *name_1, const char *name_2)
-{
- int strcmp_result;
-
- strcmp_result = nautilus_strcmp (name_1, name_2);
-
- if (strcmp_result == 0) {
- return 0;
- }
-
- if (nautilus_strcmp (name_1, EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
- return -1;
- }
-
- if (nautilus_strcmp (name_2, EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
- return +1;
- }
-
- return strcmp_result;
-}
-
-static int
-nautilus_file_compare_by_emblems (NautilusFile *file_1, NautilusFile *file_2)
-{
- GList *emblem_names_1;
- GList *emblem_names_2;
- GList *p1;
- GList *p2;
- int compare_result;
-
- compare_result = 0;
-
- emblem_names_1 = nautilus_file_get_emblem_names (file_1);
- emblem_names_2 = nautilus_file_get_emblem_names (file_2);
-
- p1 = emblem_names_1;
- p2 = emblem_names_2;
- while (p1 != NULL && p2 != NULL) {
- compare_result = compare_emblem_names (p1->data, p2->data);
- if (compare_result != 0) {
- break;
- }
-
- p1 = p1->next;
- p2 = p2->next;
- }
-
- if (compare_result == 0) {
- /* One or both is now NULL. */
- if (p1 != NULL || p2 != NULL) {
- compare_result = p2 == NULL ? -1 : +1;
- }
- }
-
- nautilus_g_list_free_deep (emblem_names_1);
- nautilus_g_list_free_deep (emblem_names_2);
-
- return compare_result;
-}
-
-static int
-nautilus_file_compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
-{
- gboolean is_directory_1;
- gboolean is_directory_2;
- char *type_string_1;
- char *type_string_2;
- int result;
-
- /* Directories go first. Then, if mime types are identical,
- * don't bother getting strings (for speed). This assumes
- * that the string is dependent entirely on the mime type,
- * which is true now but might not be later.
- */
- is_directory_1 = nautilus_file_is_directory (file_1);
- is_directory_2 = nautilus_file_is_directory (file_2);
-
- if (is_directory_1 && is_directory_2) {
- return 0;
- }
-
- if (is_directory_1) {
- return -1;
- }
-
- if (is_directory_2) {
- return +1;
- }
-
- if (nautilus_strcmp (file_1->details->info->mime_type,
- file_2->details->info->mime_type) == 0) {
- return 0;
- }
-
- type_string_1 = nautilus_file_get_type_as_string (file_1);
- type_string_2 = nautilus_file_get_type_as_string (file_2);
-
- result = nautilus_strcmp (type_string_1, type_string_2);
-
- g_free (type_string_1);
- g_free (type_string_2);
-
- return result;
-}
-
-static int
-nautilus_file_compare_for_sort_internal (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type,
- gboolean reversed)
-{
- GnomeVFSDirectorySortRule rules[3];
- int compare;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file_1), 0);
- g_return_val_if_fail (NAUTILUS_IS_FILE (file_2), 0);
-
- switch (sort_type) {
- case NAUTILUS_FILE_SORT_BY_NAME:
- /* Note: This used to put directories first. I
- * thought that was counterintuitive and removed it,
- * but I can imagine discussing this further.
- * John Sullivan <sullivan@eazel.com>
- */
- rules[0] = GNOME_VFS_DIRECTORY_SORT_BYNAME_IGNORECASE;
- rules[1] = GNOME_VFS_DIRECTORY_SORT_NONE;
- break;
- case NAUTILUS_FILE_SORT_BY_SIZE:
- /* Compare directory sizes ourselves, then if necessary
- * use GnomeVFS to compare file sizes.
- */
- compare = nautilus_file_compare_by_size_with_directories (file_1, file_2);
- if (compare != 0) {
- return compare;
- }
- rules[0] = GNOME_VFS_DIRECTORY_SORT_BYSIZE;
- rules[1] = GNOME_VFS_DIRECTORY_SORT_BYNAME_IGNORECASE;
- rules[2] = GNOME_VFS_DIRECTORY_SORT_NONE;
- break;
- case NAUTILUS_FILE_SORT_BY_TYPE:
- /* GnomeVFS doesn't know about our special text for certain
- * mime types, so we handle the mime-type sorting ourselves.
- */
- compare = nautilus_file_compare_by_type (file_1, file_2);
- if (compare != 0) {
- return compare;
- }
- rules[0] = GNOME_VFS_DIRECTORY_SORT_BYNAME_IGNORECASE;
- rules[1] = GNOME_VFS_DIRECTORY_SORT_NONE;
- break;
- case NAUTILUS_FILE_SORT_BY_MTIME:
- rules[0] = GNOME_VFS_DIRECTORY_SORT_BYMTIME;
- rules[1] = GNOME_VFS_DIRECTORY_SORT_BYNAME_IGNORECASE;
- rules[2] = GNOME_VFS_DIRECTORY_SORT_NONE;
- break;
- case NAUTILUS_FILE_SORT_BY_EMBLEMS:
- /*
- * GnomeVFS doesn't know squat about our emblems, so
- * we handle comparing them here, before falling back
- * to tie-breakers.
- */
- compare = nautilus_file_compare_by_emblems (file_1, file_2);
- if (compare != 0) {
- return compare;
- }
- rules[0] = GNOME_VFS_DIRECTORY_SORT_BYNAME_IGNORECASE;
- rules[1] = GNOME_VFS_DIRECTORY_SORT_NONE;
- break;
- default:
- g_return_val_if_fail (FALSE, 0);
- }
-
- if (reversed) {
- return gnome_vfs_file_info_compare_for_sort_reversed (file_1->details->info,
- file_2->details->info,
- rules);
- } else {
- return gnome_vfs_file_info_compare_for_sort (file_1->details->info,
- file_2->details->info,
- rules);
- }
-}
-
-/**
- * nautilus_file_compare_for_sort:
- * @file_1: A file object
- * @file_2: Another file object
- * @sort_type: Sort criterion
- *
- * Return value: int < 0 if @file_1 should come before file_2 in a smallest-to-largest
- * sorted list; int > 0 if @file_2 should come before file_1 in a smallest-to-largest
- * sorted list; 0 if @file_1 and @file_2 are equal for this sort criterion. Note
- * that each named sort type may actually break ties several ways, with the name
- * of the sort criterion being the primary but not only differentiator.
- **/
-int
-nautilus_file_compare_for_sort (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type)
-{
- return nautilus_file_compare_for_sort_internal (file_1, file_2, sort_type, FALSE);
-}
-
-/**
- * nautilus_file_compare_for_sort_reversed:
- * @file_1: A file object
- * @file_2: Another file object
- * @sort_type: Sort criterion
- *
- * Return value: The opposite of nautilus_file_compare_for_sort: int > 0 if @file_1
- * should come before file_2 in a smallest-to-largest sorted list; int < 0 if @file_2
- * should come before file_1 in a smallest-to-largest sorted list; 0 if @file_1
- * and @file_2 are equal for this sort criterion. Note that each named sort type
- * may actually break ties several ways, with the name of the sort criterion
- * being the primary but not only differentiator.
- **/
-int
-nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type)
-{
- return nautilus_file_compare_for_sort_internal (file_1, file_2, sort_type, TRUE);
-}
-
-char *
-nautilus_file_get_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- return nautilus_directory_get_file_metadata (file->details->directory,
- file->details->info->name,
- key,
- default_metadata);
-}
-
-void
-nautilus_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata,
- const char *metadata)
-{
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- nautilus_directory_set_file_metadata (file->details->directory,
- file->details->info->name,
- key,
- default_metadata,
- metadata);
- nautilus_file_changed (file);
-}
-
-char *
-nautilus_file_get_name (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- return g_strdup (file->details->info->name);
-}
-
-char *
-nautilus_file_get_uri (NautilusFile *file)
-{
- GnomeVFSURI *uri;
- char *uri_text;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- uri = gnome_vfs_uri_append_path (file->details->directory->details->uri,
- file->details->info->name);
- uri_text = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- gnome_vfs_uri_unref (uri);
- return uri_text;
-}
-
-/**
- * nautilus_file_get_date_as_string:
- *
- * Get a user-displayable string representing a file modification date.
- * The caller is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_date_as_string (NautilusFile *file, NautilusDateType date_type)
-{
- struct tm *file_time;
- const char *format;
- GDate *today;
- GDate *file_date;
- guint32 file_date_age;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- switch (date_type)
- {
- case NAUTILUS_DATE_TYPE_CHANGED:
- file_time = localtime(&file->details->info->ctime);
- break;
- case NAUTILUS_DATE_TYPE_ACCESSED:
- file_time = localtime(&file->details->info->atime);
- break;
- case NAUTILUS_DATE_TYPE_MODIFIED:
- file_time = localtime(&file->details->info->mtime);
- break;
- default:
- g_assert_not_reached ();
- }
- file_date = nautilus_g_date_new_tm (file_time);
-
- today = g_date_new ();
- g_date_set_time (today, time (NULL));
-
- /* Overflow results in a large number; fine for our purposes. */
- file_date_age = g_date_julian (today) - g_date_julian (file_date);
-
- g_date_free (file_date);
- g_date_free (today);
-
- /* Format varies depending on how old the date is. This minimizes
- * the length (and thus clutter & complication) of typical dates
- * while providing sufficient detail for recent dates to make
- * them maximally understandable at a glance. Keep all format
- * strings separate rather than combining bits & pieces for
- * internationalization's sake.
- */
-
- if (file_date_age == 0) {
- /* today, use special word */
- format = _("today %-I:%M %p");
- } else if (file_date_age == 1) {
- /* yesterday, use special word */
- format = _("yesterday %-I:%M %p");
- } else if (file_date_age < 7) {
- /* current week, include day of week */
- format = _("%A %-m/%-d/%y %-I:%M %p");
- } else {
- format = _("%-m/%-d/%y %-I:%M %p");
- }
-
- return nautilus_strdup_strftime (format, file_time);
-}
-
-/**
- * nautilus_file_get_directory_item_count
- *
- * Get the number of items in a directory.
- * @file: NautilusFile representing a directory. It is an error to
- * call this function on a file that is not a directory.
- * @ignore_invisible_items: TRUE if invisible items should not be
- * included in count.
- *
- * Returns: item count for this directory.
- *
- **/
-guint
-nautilus_file_get_directory_item_count (NautilusFile *file,
- gboolean ignore_invisible_items)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), 0);
- g_return_val_if_fail (nautilus_file_is_directory (file), 0);
-
- return get_directory_item_count_hack (file, ignore_invisible_items);
-}
-
-/**
- * nautilus_file_get_size
- *
- * Get the file size.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Size in bytes.
- *
- **/
-GnomeVFSFileSize
-nautilus_file_get_size (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), 0);
-
- return file->details->info->size;
-}
-
-/**
- * nautilus_file_get_permissions_as_string:
- *
- * Get a user-displayable string representing a file's permissions. The caller
- * is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_permissions_as_string (NautilusFile *file)
-{
- GnomeVFSFilePermissions permissions;
- gboolean is_directory;
- gboolean is_link;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- permissions = file->details->info->permissions;
- is_directory = nautilus_file_is_directory (file);
- is_link = GNOME_VFS_FILE_INFO_SYMLINK(file->details->info);
-
- return g_strdup_printf ("%c%c%c%c%c%c%c%c%c%c",
- is_link ? 'l' : is_directory ? 'd' : '-',
- permissions & GNOME_VFS_PERM_USER_READ ? 'r' : '-',
- permissions & GNOME_VFS_PERM_USER_WRITE ? 'w' : '-',
- permissions & GNOME_VFS_PERM_USER_EXEC ? 'x' : '-',
- permissions & GNOME_VFS_PERM_GROUP_READ ? 'r' : '-',
- permissions & GNOME_VFS_PERM_GROUP_WRITE ? 'w' : '-',
- permissions & GNOME_VFS_PERM_GROUP_EXEC ? 'x' : '-',
- permissions & GNOME_VFS_PERM_OTHER_READ ? 'r' : '-',
- permissions & GNOME_VFS_PERM_OTHER_WRITE ? 'w' : '-',
- permissions & GNOME_VFS_PERM_OTHER_EXEC ? 'x' : '-');
-}
-
-/**
- * nautilus_file_get_owner_as_string:
- *
- * Get a user-displayable string representing a file's owner. The caller
- * is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_owner_as_string (NautilusFile *file)
-{
- struct passwd *password_info;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- /* FIXME: Can we trust the uid in the file info? Might
- * there be garbage there? What will it do for non-local files?
- */
- /* No need to free result of getpwuid */
- password_info = getpwuid (file->details->info->uid);
-
- if (password_info == NULL) {
- return g_strdup (_("unknown owner"));
- }
-
- return g_strdup (password_info->pw_name);
-}
-
-/**
- * nautilus_file_get_group_as_string:
- *
- * Get a user-displayable string representing a file's group. The caller
- * is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_group_as_string (NautilusFile *file)
-{
- struct group *group_info;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- /* FIXME: Can we trust the gid in the file info? Might
- * there be garbage there? What will it do for non-local files?
- */
- /* No need to free result of getgrgid */
- group_info = getgrgid (file->details->info->gid);
-
- if (group_info == NULL) {
- return g_strdup (_("unknown group"));
- }
-
- return g_strdup (group_info->gr_name);
-}
-
-/**
- * nautilus_file_get_mime_type_as_string_attribute:
- *
- * Get a user-displayable string representing a file's MIME type.
- * This string will be displayed in file manager views and thus
- * will not be blank even if the MIME type is unknown. The caller
- * is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_mime_type_as_string_attribute (NautilusFile *file)
-{
- const char *mime_string;
-
- mime_string = nautilus_file_get_mime_type (file);
- if (nautilus_strlen (mime_string) > 0) {
- return g_strdup (mime_string);
- }
-
- return g_strdup ("unknown MIME type");
-}
-
-/* This #include is part of the following hack, and should be removed with it */
-#include <dirent.h>
-
-static int
-get_directory_item_count_hack (NautilusFile *file, gboolean ignore_invisible_items)
-{
- /* Code borrowed from Gnomad and hacked into here for now */
-
- char * uri;
- char * path;
- DIR* directory;
- int count;
- struct dirent * entry;
-
- g_assert (nautilus_file_is_directory (file));
-
- uri = nautilus_file_get_uri (file);
- if (nautilus_str_has_prefix (uri, "file://")) {
- path = uri + 7;
- } else {
- path = uri;
- }
-
- directory = opendir (path);
-
- g_free (uri);
-
- if (!directory) {
- return 0;
- }
-
- count = 0;
-
- while ((entry = readdir(directory)) != NULL) {
- // Only count invisible items if requested.
- if (!ignore_invisible_items || entry->d_name[0] != '.') {
- count += 1;
- }
- }
-
- closedir(directory);
-
- /* This way of getting the count includes . and .., so we subtract those out */
- if (!ignore_invisible_items) {
- count -= 2;
- }
-
- return count;
-}
-
-/**
- * nautilus_file_get_size_as_string:
- *
- * Get a user-displayable string representing a file size. The caller
- * is responsible for g_free-ing this string. The string is an item
- * count for directories.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_size_as_string (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- if (nautilus_file_is_directory (file)) {
- /* FIXME: Since computing the item count is slow, we
- * want to do it in a deferred way. However, that
- * architecture doesn't exist yet, so we're hacking
- * it in for now.
- */
- int item_count;
-
- item_count = get_directory_item_count_hack (file, FALSE);
- if (item_count == 0) {
- return g_strdup (_("0 items"));
- } else if (item_count == 1) {
- return g_strdup (_("1 item"));
- } else {
- return g_strdup_printf (_("%d items"), item_count);
- }
- }
-
- return gnome_vfs_file_size_to_string (file->details->info->size);
-}
-
-/**
- * nautilus_file_get_string_attribute:
- *
- * Get a user-displayable string from a named attribute. Use g_free to
- * free this string.
- *
- * @file: NautilusFile representing the file in question.
- * @attribute_name: The name of the desired attribute. The currently supported
- * set includes "name", "type", "mime_type", "size", "date_modified", "date_changed",
- * "date_accessed", "owner", "group", "permissions".
- *
- * Returns: Newly allocated string ready to display to the user, or NULL
- * if @attribute_name is not supported.
- *
- **/
-char *
-nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_name)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- /* FIXME: Use hash table and switch statement or function pointers for speed? */
-
- if (strcmp (attribute_name, "name") == 0) {
- return nautilus_file_get_name (file);
- }
-
- if (strcmp (attribute_name, "type") == 0) {
- return nautilus_file_get_type_as_string (file);
- }
-
- if (strcmp (attribute_name, "mime_type") == 0) {
- return nautilus_file_get_mime_type_as_string_attribute (file);
- }
-
- if (strcmp (attribute_name, "size") == 0) {
- return nautilus_file_get_size_as_string (file);
- }
-
- if (strcmp (attribute_name, "date_modified") == 0) {
- return nautilus_file_get_date_as_string (file,
- NAUTILUS_DATE_TYPE_MODIFIED);
- }
-
- if (strcmp (attribute_name, "date_changed") == 0) {
- return nautilus_file_get_date_as_string (file,
- NAUTILUS_DATE_TYPE_CHANGED);
- }
-
- if (strcmp (attribute_name, "date_accessed") == 0) {
- return nautilus_file_get_date_as_string (file,
- NAUTILUS_DATE_TYPE_ACCESSED);
- }
-
- if (strcmp (attribute_name, "permissions") == 0) {
- return nautilus_file_get_permissions_as_string (file);
- }
-
- if (strcmp (attribute_name, "owner") == 0) {
- return nautilus_file_get_owner_as_string (file);
- }
-
- if (strcmp (attribute_name, "group") == 0) {
- return nautilus_file_get_group_as_string (file);
- }
-
- return NULL;
-}
-
-/**
- * nautilus_file_get_type_as_string:
- *
- * Get a user-displayable string representing a file type. The caller
- * is responsible for g_free-ing this string.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: Newly allocated string ready to display to the user.
- *
- **/
-static char *
-nautilus_file_get_type_as_string (NautilusFile *file)
-{
- const char *mime_type;
- const char *description;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- mime_type = (file->details->info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) != 0 ?
- file->details->info->mime_type :
- NULL;
-
- if (nautilus_strlen (mime_type) == 0) {
- /* No mime type, anything else interesting we can say about this? */
- if (nautilus_file_is_executable (file)) {
- return g_strdup (_("program"));
- }
-
- return g_strdup (_("unknown type"));
- }
-
- description = gnome_mime_description (mime_type);
- if (nautilus_strlen (description) > 0) {
- return g_strdup (description);
- }
-
- /* We want to update nautilus/data/nautilus.keys to include
- * English (& localizable) versions of every mime type anyone ever sees.
- */
- g_warning ("No description found for mime type \"%s\" (file is \"%s\"), tell sullivan@eazel.com",
- mime_type,
- file->details->info->name);
- return g_strdup (mime_type);
-}
-
-/**
- * nautilus_file_get_file_type
- *
- * Return this file's type.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: The type.
- *
- **/
-GnomeVFSFileType
-nautilus_file_get_file_type (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), GNOME_VFS_FILE_TYPE_UNKNOWN);
-
- return file->details->info->type;
-}
-
-/**
- * nautilus_file_get_mime_type
- *
- * Return this file's mime type.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: The mime type.
- *
- **/
-const char *
-nautilus_file_get_mime_type (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- return file->details->info->mime_type;
-}
-
-/**
- * nautilus_file_get_emblem_names
- *
- * Return the list of names of emblems that this file should display,
- * in canonical order.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: A list of emblem names.
- *
- **/
-GList *
-nautilus_file_get_emblem_names (NautilusFile *file)
-{
- GList *names;
-
- names = nautilus_file_get_keywords (file);
- if (nautilus_file_is_symbolic_link (file)) {
- names = g_list_prepend
- (names, g_strdup (EMBLEM_NAME_SYMBOLIC_LINK));
- }
-
- return names;
-}
-
-static GList *
-sort_keyword_list_and_remove_duplicates (GList *keywords)
-{
- GList *p;
- GList *duplicate_link;
-
- keywords = g_list_sort (keywords, (GCompareFunc) compare_emblem_names);
-
- if (keywords != NULL) {
- p = keywords;
- while (p->next != NULL) {
- if (nautilus_strcmp (p->data, p->next->data) == 0) {
- duplicate_link = p->next;
- keywords = g_list_remove_link (keywords, duplicate_link);
- nautilus_g_list_free_deep (duplicate_link);
- } else {
- p = p->next;
- }
- }
- }
-
- return keywords;
-}
-
-/**
- * nautilus_file_get_keywords
- *
- * Return this file's keywords.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: A list of keywords.
- *
- **/
-GList *
-nautilus_file_get_keywords (NautilusFile *file)
-{
- GList *keywords;
- xmlNode *file_node, *child;
- xmlChar *property;
-
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
-
- keywords = NULL;
-
- /* Put all the keywords into a list. */
- file_node = nautilus_directory_get_file_metadata_node (file->details->directory,
- file->details->info->name,
- FALSE);
- for (child = nautilus_xml_get_children (file_node);
- child != NULL;
- child = child->next) {
- if (strcmp (child->name, "KEYWORD") == 0) {
- property = xmlGetProp (child, "NAME");
- if (property != NULL) {
- keywords = g_list_prepend (keywords,
- g_strdup (property));
- xmlFree (property);
- }
- }
- }
-
- /*
- * Reverse even though we're about to sort; that way
- * most of the time it will already be sorted.
- */
- keywords = g_list_reverse (keywords);
-
- return sort_keyword_list_and_remove_duplicates (keywords);
-}
-
-/**
- * nautilus_file_set_keywords
- *
- * Change this file's keywords.
- * @file: NautilusFile representing the file in question.
- * @keywords: New set of keywords (a GList of strings).
- *
- **/
-void
-nautilus_file_set_keywords (NautilusFile *file, GList *keywords)
-{
- xmlNode *file_node, *child, *next;
- GList *canonical_keywords, *p;
- gboolean need_write;
- xmlChar *property;
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- /* Put all the keywords into a list. */
- file_node = nautilus_directory_get_file_metadata_node (file->details->directory,
- file->details->info->name,
- keywords != NULL);
- need_write = FALSE;
- if (file_node == NULL) {
- g_assert (keywords == NULL);
- } else {
- canonical_keywords = sort_keyword_list_and_remove_duplicates
- (g_list_copy (keywords));
-
- p = canonical_keywords;
-
- /* Remove any nodes except the ones we expect. */
- for (child = nautilus_xml_get_children (file_node);
- child != NULL;
- child = next) {
-
- next = child->next;
- if (strcmp (child->name, "KEYWORD") == 0) {
- property = xmlGetProp (child, "NAME");
- if (property != NULL && p != NULL
- && strcmp (property, (char *) p->data) == 0) {
- p = p->next;
- } else {
- xmlUnlinkNode (child);
- xmlFreeNode (child);
- need_write = TRUE;
- }
- xmlFree (property);
- }
- }
-
- /* Add any additional nodes needed. */
- for (; p != NULL; p = p->next) {
- child = xmlNewChild (file_node, NULL, "KEYWORD", NULL);
- xmlSetProp (child, "NAME", p->data);
- need_write = TRUE;
- }
-
- g_list_free (canonical_keywords);
- }
-
- if (need_write) {
- /* Since we changed the tree, arrange for it to be written. */
- nautilus_directory_request_write_metafile (file->details->directory);
- nautilus_file_changed (file);
- }
-}
-
-/**
- * nautilus_file_is_symbolic_link
- *
- * Check if this file is a symbolic link.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: True if the file is a symbolic link.
- *
- **/
-gboolean
-nautilus_file_is_symbolic_link (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
- return GNOME_VFS_FILE_INFO_SYMLINK (file->details->info);
-}
-
-/**
- * nautilus_file_is_directory
- *
- * Check if this file is a directory.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: TRUE if @file is a directory.
- *
- **/
-gboolean
-nautilus_file_is_directory (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
- return nautilus_file_get_file_type (file) == GNOME_VFS_FILE_TYPE_DIRECTORY;
-}
-
-/**
- * nautilus_file_is_executable
- *
- * Check if this file is executable at all.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: TRUE if any of the execute bits are set. FALSE if
- * not, or if the permissions are unknown.
- *
- **/
-gboolean
-nautilus_file_is_executable (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
- if ((file->details->info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS) == 0){
- /*
- * Permissions field is not valid.
- * Can't tell whether this file is executable, so return FALSE.
- */
- return FALSE;
- }
-
- return (file->details->info->permissions & (GNOME_VFS_PERM_USER_EXEC
- | GNOME_VFS_PERM_GROUP_EXEC
- | GNOME_VFS_PERM_OTHER_EXEC)) != 0;
-}
-
-/**
- * nautilus_file_delete
- *
- * Delete this file.
- * @file: NautilusFile representing the file in question.
- **/
-void
-nautilus_file_delete (NautilusFile *file)
-{
- char *text_uri;
- GnomeVFSResult result;
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- /* Deleting a file that's already gone is easy. */
- if (file->details->is_gone) {
- return;
- }
-
- /* Do the actual deletion. */
- text_uri = nautilus_file_get_uri (file);
- if (nautilus_file_is_directory (file)) {
- result = gnome_vfs_remove_directory (text_uri);
- } else {
- result = gnome_vfs_unlink (text_uri);
- }
- g_free (text_uri);
-
- /* Mark the file gone. */
- if (result == GNOME_VFS_OK || result == GNOME_VFS_ERROR_NOTFOUND) {
- file->details->is_gone = TRUE;
-
- /* Let the directory know it's gone. */
- g_assert (g_list_find (file->details->directory->details->files, file) != NULL);
- file->details->directory->details->files
- = g_list_remove (file->details->directory->details->files, file);
-
- /* Send out a signal. */
- nautilus_file_changed (file);
- }
-}
-
-/**
- * nautilus_file_changed
- *
- * Notify the user that this file has changed.
- * @file: NautilusFile representing the file in question.
- **/
-void
-nautilus_file_changed (NautilusFile *file)
-{
- GList *changed_files;
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- changed_files = g_list_prepend (NULL, file);
- nautilus_directory_files_changed (file->details->directory, changed_files);
- g_list_free (changed_files);
-}
-
-/**
- * nautilus_file_emit_changed
- *
- * Emit a file changed signal.
- * This can only be called by the directory, since the directory
- * also has to emit a files_changed signal.
- *
- * @file: NautilusFile representing the file in question.
- **/
-void
-nautilus_file_emit_changed (NautilusFile *file)
-{
- g_assert (NAUTILUS_IS_FILE (file));
-
- /* Send out a signal. */
- gtk_signal_emit (GTK_OBJECT (file),
- signals[CHANGED],
- file);
-}
-
-/**
- * nautilus_file_is_gone
- *
- * Check if a file has already been deleted.
- * @file: NautilusFile representing the file in question.
- *
- * Returns: TRUE if the file is already gone.
- **/
-gboolean
-nautilus_file_is_gone (NautilusFile *file)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
- return file->details->is_gone;
-}
-
-void
-nautilus_file_call_when_ready (NautilusFile *file,
- GList *file_metadata_keys,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- QueuedCallback new_callback;
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
- g_return_if_fail (file_metadata_keys != NULL);
- g_return_if_fail (callback != NULL);
-
- new_callback.file = file;
- new_callback.callback.file = callback;
- new_callback.callback_data = callback_data;
-
- nautilus_directory_call_when_ready_internal (file->details->directory,
- &new_callback);
-}
-
-void
-nautilus_file_cancel_callback (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- QueuedCallback old_callback;
-
- g_return_if_fail (callback != NULL);
-
- if (file == NULL) {
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
-
- old_callback.file = file;
- old_callback.callback.file = callback;
- old_callback.callback_data = callback_data;
-
- nautilus_directory_cancel_callback_internal (file->details->directory,
- &old_callback);
-}
-
-/**
- * nautilus_file_list_ref
- *
- * Ref all the files in a list.
- * @list: GList of files.
- **/
-void
-nautilus_file_list_ref (GList *list)
-{
- nautilus_gtk_object_list_ref (list);
-}
-
-/**
- * nautilus_file_list_unref
- *
- * Unref all the files in a list.
- * @list: GList of files.
- **/
-void
-nautilus_file_list_unref (GList *list)
-{
- nautilus_gtk_object_list_unref (list);
-}
-
-/**
- * nautilus_file_list_free
- *
- * Free a list of files after unrefing them.
- * @list: GList of files.
- **/
-void
-nautilus_file_list_free (GList *list)
-{
- nautilus_gtk_object_list_free (list);
-}
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-void
-nautilus_self_check_file (void)
-{
- NautilusFile *file_1;
- NautilusFile *file_2;
- GList *list;
-
- /* refcount checks */
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_number_outstanding (), 0);
-
- file_1 = nautilus_file_get ("file:///home/");
-
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_1)->ref_count, 1);
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_1->details->directory)->ref_count, 1);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_number_outstanding (), 1);
-
- nautilus_file_unref (file_1);
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_number_outstanding (), 0);
-
- file_1 = nautilus_file_get ("file:///etc");
- file_2 = nautilus_file_get ("file:///usr");
-
- list = NULL;
- list = g_list_append (list, file_1);
- list = g_list_append (list, file_2);
-
- nautilus_file_list_ref (list);
-
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_1)->ref_count, 2);
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_2)->ref_count, 2);
-
- nautilus_file_list_unref (list);
-
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_1)->ref_count, 1);
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_2)->ref_count, 1);
-
- nautilus_file_list_free (list);
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_directory_number_outstanding (), 0);
-
-
- /* name checks */
- file_1 = nautilus_file_get ("file:///home/");
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_file_get_name (file_1), "home");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_file_get ("file:///home/") == file_1, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_file_get ("file:///home") == file_1, TRUE);
-
- nautilus_file_unref (file_1);
- nautilus_file_unref (file_1);
-
- file_1 = nautilus_file_get ("file:///home");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_file_get_name (file_1), "home");
- nautilus_file_unref (file_1);
-
- /* sorting */
- file_1 = nautilus_file_get ("file:///etc");
- file_2 = nautilus_file_get ("file:///usr");
-
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_1)->ref_count, 1);
- NAUTILUS_CHECK_INTEGER_RESULT (GTK_OBJECT (file_2)->ref_count, 1);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_file_compare_for_sort (file_1, file_2, NAUTILUS_FILE_SORT_BY_NAME) < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_file_compare_for_sort_reversed (file_1, file_2, NAUTILUS_FILE_SORT_BY_NAME) > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_file_compare_for_sort (file_1, file_1, NAUTILUS_FILE_SORT_BY_NAME) == 0, TRUE);
-
- nautilus_file_unref (file_1);
- nautilus_file_unref (file_2);
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-file.h b/libnautilus/nautilus-file.h
deleted file mode 100644
index dcb7dd4e8..000000000
--- a/libnautilus/nautilus-file.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-file.h: Nautilus file model.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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_FILE_H
-#define NAUTILUS_FILE_H
-
-#include <gtk/gtkobject.h>
-#include <libgnomevfs/gnome-vfs-types.h>
-
-/* NautilusFile is an object used to represent a single element of a
- * NautilusDirectory. It's lightweight and relies on NautilusDirectory
- * to do most of the work.
- */
-
-typedef struct NautilusFile NautilusFile;
-typedef struct NautilusFileClass NautilusFileClass;
-
-#define NAUTILUS_TYPE_FILE \
- (nautilus_file_get_type ())
-#define NAUTILUS_FILE(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_FILE, NautilusFile))
-#define NAUTILUS_FILE_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_FILE, NautilusFileClass))
-#define NAUTILUS_IS_FILE(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_FILE))
-#define NAUTILUS_IS_FILE_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_FILE))
-
-typedef enum {
- NAUTILUS_FILE_SORT_NONE,
- NAUTILUS_FILE_SORT_BY_NAME,
- NAUTILUS_FILE_SORT_BY_SIZE,
- NAUTILUS_FILE_SORT_BY_TYPE,
- NAUTILUS_FILE_SORT_BY_MTIME,
- NAUTILUS_FILE_SORT_BY_EMBLEMS
-} NautilusFileSortType;
-
-typedef void (*NautilusFileCallback) (NautilusFile *file,
- gpointer callback_data);
-
-/* GtkObject requirements. */
-GtkType nautilus_file_get_type (void);
-
-/* Getting at a single file. */
-NautilusFile * nautilus_file_get (const char *uri);
-
-/* Basic operations on file objects. */
-void nautilus_file_ref (NautilusFile *file);
-void nautilus_file_unref (NautilusFile *file);
-void nautilus_file_delete (NautilusFile *file);
-
-/* Monitor the file. */
-void nautilus_file_monitor_add (NautilusFile *file,
- gpointer client,
- GList *attributes,
- GList *metadata_keys);
-void nautilus_file_monitor_remove (NautilusFile *file,
- gpointer client);
-
-/* Waiting for data that's read asynchronously.
- * This interface currently works only for metadata, but could be expanded
- * to other attributes as well.
- */
-void nautilus_file_call_when_ready (NautilusFile *file,
- GList *metadata_keys,
- NautilusFileCallback callback,
- gpointer callback_data);
-void nautilus_file_cancel_callback (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data);
-
-/* Basic attributes for file objects. */
-char * nautilus_file_get_name (NautilusFile *file);
-char * nautilus_file_get_uri (NautilusFile *file);
-GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
-GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
-const char * nautilus_file_get_mime_type (NautilusFile *file);
-gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
-gboolean nautilus_file_is_executable (NautilusFile *file);
-gboolean nautilus_file_is_directory (NautilusFile *file);
-guint nautilus_file_get_directory_item_count (NautilusFile *file,
- gboolean ignore_invisible_items);
-GList * nautilus_file_get_keywords (NautilusFile *file);
-void nautilus_file_set_keywords (NautilusFile *file,
- GList *keywords);
-GList * nautilus_file_get_emblem_names (NautilusFile *file);
-
-/* Basic operations for file objects. */
-gboolean nautilus_file_can_rename (NautilusFile *file);
-GnomeVFSResult nautilus_file_rename (NautilusFile *file,
- const char *new_name);
-
-/* Return true if this file has already been deleted.
- This object will be unref'd after sending the files_removed signal,
- but it could hang around longer if someone ref'd it.
-*/
-gboolean nautilus_file_is_gone (NautilusFile *file);
-
-/* Simple getting and setting top-level metadata. */
-char * nautilus_file_get_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata);
-void nautilus_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata,
- const char *metadata);
-
-/* Attributes for file objects as user-displayable strings. */
-char * nautilus_file_get_string_attribute (NautilusFile *file,
- const char *attribute_name);
-
-/* Matching with another URI*/
-gboolean nautilus_file_matches_uri (NautilusFile *file,
- const char *uri);
-
-/* Comparing two file objects for sorting */
-int nautilus_file_compare_for_sort (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-
-/* Change notification hack.
- * This is called when code modifies the file and it needs to trigger
- * a notification. Eventually this should become private, but for now
- * it needs to be used for code like the thumbnail generation.
- */
-void nautilus_file_changed (NautilusFile *file);
-
-/* Convenience functions for dealing with a list of NautilusFile objects that each have a ref. */
-void nautilus_file_list_ref (GList *file_list);
-void nautilus_file_list_unref (GList *file_list);
-void nautilus_file_list_free (GList *file_list);
-
-typedef struct NautilusFileDetails NautilusFileDetails;
-
-struct NautilusFile
-{
- GtkObject object;
- NautilusFileDetails *details;
-};
-
-struct NautilusFileClass
-{
- GtkObjectClass parent_class;
-
- void (* changed) (NautilusFile *file);
-};
-
-#endif /* NAUTILUS_FILE_H */
diff --git a/libnautilus/nautilus-gdk-extensions.c b/libnautilus/nautilus-gdk-extensions.c
deleted file mode 100644
index 527ed7411..000000000
--- a/libnautilus/nautilus-gdk-extensions.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gdk-extensions.c: Graphics routines to augment what's in gdk.
-
- Copyright (C) 1999, 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-gdk-extensions.h"
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-string.h"
-
-#define GRADIENT_BAND_SIZE 4
-
-/**
- * nautilus_fill_rectangle:
- * @drawable: Target to draw into.
- * @gc: Graphics context (mainly for clip).
- * @rectangle: Rectangle to fill.
- *
- * Fill the rectangle with the foreground color.
- * Convenient when you have a GdkRectangle structure.
- */
-void
-nautilus_fill_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle)
-{
- gdk_draw_rectangle (drawable, gc, TRUE,
- rectangle->x, rectangle->y,
- rectangle->width, rectangle->height);
-}
-
-/**
- * nautilus_fill_rectangle_with_color:
- * @drawable: Target to draw into.
- * @gc: Graphics context (mainly for clip).
- * @rectangle: Rectangle to fill.
- * @color: Color to fill with.
- *
- * Fill the rectangle with a color.
- * Convenient when you have a GdkRectangle structure.
- */
-void
-nautilus_fill_rectangle_with_color (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- guint32 rgb)
-{
- GdkGCValues saved_values;
-
- gdk_gc_get_values (gc, &saved_values);
- gdk_rgb_gc_set_foreground (gc, rgb);
- nautilus_fill_rectangle (drawable, gc, rectangle);
- gdk_gc_set_foreground (gc, &saved_values.foreground);
-}
-
-/**
- * nautilus_fill_rectangle_with_gradient:
- * @drawable: Target to draw into.
- * @gc: Graphics context (mainly for clip).
- * @rectangle: Rectangle to draw gradient in.
- * @start_color: Color for the left or top; pixel value does not matter.
- * @end_color: Color for the right or bottom; pixel value does not matter.
- * @horizontal: TRUE if the color changes from left to right. FALSE if from top to bottom.
- *
- * Fill the rectangle with a gradient.
- * The color changes from start_color to end_color.
- * This effect works best on true color displays.
- */
-void
-nautilus_fill_rectangle_with_gradient (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- guint32 start_rgb,
- guint32 end_rgb,
- gboolean horizontal)
-{
- GdkRectangle band_box;
- gint16 *position;
- guint16 *size;
- gint num_bands;
- guint16 last_band_size;
- gdouble multiplier;
- gint band;
- guint32 band_rgb;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (rectangle != NULL);
- g_return_if_fail (horizontal == FALSE || horizontal == TRUE);
-
- /* Set up the band box so we can access it the same way for horizontal or vertical. */
- band_box = *rectangle;
- position = horizontal ? &band_box.x : &band_box.y;
- size = horizontal ? &band_box.width : &band_box.height;
-
- /* Figure out how many bands we will need. */
- num_bands = (*size + GRADIENT_BAND_SIZE - 1) / GRADIENT_BAND_SIZE;
- last_band_size = GRADIENT_BAND_SIZE - (GRADIENT_BAND_SIZE * num_bands - *size);
-
- /* Change the band box to be the size of a single band. */
- *size = GRADIENT_BAND_SIZE;
-
- /* Set up a multiplier to use to interpolate the colors as we go. */
- multiplier = num_bands <= 1 ? 0.0 : 1.0 / (num_bands - 1);
-
- /* Fill each band with a separate nautilus_draw_rectangle call. */
- for (band = 0; band < num_bands; band++) {
- /* Compute a new color value for each band. */
- band_rgb = nautilus_interpolate_color (band * multiplier, start_rgb, end_rgb);
-
- /* Last band may need to be a bit smaller to avoid writing outside the box.
- * This is more efficient than changing and restoring the clip.
- */
- if (band == num_bands - 1) {
- *size = last_band_size;
- }
-
- nautilus_fill_rectangle_with_color (drawable, gc, &band_box, band_rgb);
- *position += *size;
- }
-}
-
-/**
- * nautilus_rectangle_contains:
- * @rectangle: Rectangle possibly containing a point.
- * @x: X coordinate of a point.
- * @y: Y coordinate of a point.
- *
- * Retun TRUE if point is contained inside a rectangle
- */
-gboolean
-nautilus_rectangle_contains (const GdkRectangle *rectangle,
- int x,
- int y)
-{
- g_return_val_if_fail (rectangle != NULL, FALSE);
- return rectangle->x <= x && rectangle->x + rectangle->width >= x
- && rectangle->y <= y && rectangle->y + rectangle->height >= y;
-}
-
-/**
- * nautilus_rectangle_inset:
- * @rectangle: Rectangle we are insetting.
- * @x: Horizontal ammount to inset by.
- * @y: Vertical ammount to inset by.
- *
- * Inset a rectangle by a given horizontal and vertical ammount.
- * Pass in negative inset values to grow the rectangle, positive to
- * shrink it.
- */
-void
-nautilus_rectangle_inset (GdkRectangle *rectangle,
- int x,
- int y)
-{
- g_return_if_fail (rectangle != NULL);
-
- rectangle->x += x;
- rectangle->width -= 2 * x;
- rectangle->y += y;
- rectangle->height -= 2 * y;
-}
-
-/**
- * nautilus_interpolate_color:
- * @ratio: Place on line between colors to interpolate.
- * @start_color: Color for one end.
- * @end_color: Color for the other end
- * @interpolated_color: Result.
- *
- * Compute a color between @start_color and @end_color in color space.
- * Currently, the color space used is RGB, but a future version could
- * instead do the interpolation in the best color space for expressing
- * human perception.
- */
-guint32
-nautilus_interpolate_color (gdouble ratio,
- guint32 start_rgb,
- guint32 end_rgb)
-{
- guchar red, green, blue;
-
- g_return_val_if_fail (ratio >= 0.0, 0);
- g_return_val_if_fail (ratio <= 1.0, 0);
-
- red = ((start_rgb >> 16) & 0xFF) * (1.0 - ratio) + ((end_rgb >> 16) & 0xFF) * ratio;
- green = ((start_rgb >> 8) & 0xFF) * (1.0 - ratio) + ((end_rgb >> 8) & 0xFF) * ratio;
- blue = (start_rgb & 0xFF) * (1.0 - ratio) + (end_rgb & 0xFF) * ratio;
- return (((red << 8) | green) << 8) | blue;
-}
-
-/**
- * nautilus_gradient_new
- * @start_color: Color for the top or left.
- * @end_color: Color for the bottom or right.
- * @is_horizontal: Direction of the gradient.
- *
- * Create a string that combines the start and end colors along
- * with the direction of the gradient in a standard format.
- */
-char *
-nautilus_gradient_new (const char *start_color,
- const char *end_color,
- gboolean is_horizontal)
-{
- g_return_val_if_fail (is_horizontal == FALSE || is_horizontal == TRUE, NULL);
-
- /* Handle the special case where the start and end colors are identical.
- Handle the special case where the end color is an empty string.
- */
- if (nautilus_strcmp(start_color, end_color) == 0 || end_color == NULL || end_color[0] == '\0') {
- return g_strdup (start_color);
- }
-
- /* Handle the special case where the start color is an empty string. */
- if (start_color == NULL || start_color[0] == '\0') {
- return g_strdup (end_color);
- }
-
- /* Handle the general case. */
- return g_strconcat (start_color, "-", end_color, is_horizontal ? ":h" : NULL, NULL);
-}
-
-/**
- * nautilus_gradient_is_gradient
- * @gradient_spec: A gradient spec. string.
- *
- * Return true if the spec. specifies a gradient instead of a solid color.
- */
-gboolean
-nautilus_gradient_is_gradient (const char *gradient_spec)
-{
- return nautilus_strchr (gradient_spec, '-') != NULL;
-}
-
-/**
- * nautilus_gradient_is_horizontal
- * @gradient_spec: A gradient spec. string.
- *
- * Return true if the spec. specifies a horizontal gradient.
- */
-gboolean
-nautilus_gradient_is_horizontal (const char *gradient_spec)
-{
- size_t length;
-
- length = nautilus_strlen (gradient_spec);
- return length >= 2 && gradient_spec[length - 2] == ':' && gradient_spec[length - 1] == 'h';
-}
-
-static char *
-nautilus_gradient_strip_trailing_direction_if_any (const char *gradient_spec)
-{
- size_t length;
-
- length = nautilus_strlen (gradient_spec);
- if (length >= 2 && gradient_spec[length - 2] == ':'
- && (gradient_spec[length - 1] == 'v' || gradient_spec[length - 1] == 'h')) {
- length -= 2;
- }
-
- return g_strndup (gradient_spec, length);
-}
-
-/**
- * nautilus_gradient_get_start_color_spec
- * @gradient_spec: A gradient spec. string.
- *
- * Return the start color.
- * This may be the entire gradient_spec if it's a solid color.
- */
-char *
-nautilus_gradient_get_start_color_spec (const char *gradient_spec)
-{
- const char *separator;
-
- separator = nautilus_strchr (gradient_spec, '-');
- if (separator == NULL) {
- return nautilus_gradient_strip_trailing_direction_if_any (gradient_spec);
- }
-
- return g_strndup (gradient_spec, separator - gradient_spec);
-}
-
-/**
- * nautilus_gradient_get_end_color_spec
- * @gradient_spec: A gradient spec. string.
- *
- * Return the end color.
- * This may be the entire gradient_spec if it's a solid color.
- */
-char *
-nautilus_gradient_get_end_color_spec (const char *gradient_spec)
-{
- const char *separator;
-
- separator = nautilus_strchr (gradient_spec, '-');
- return nautilus_gradient_strip_trailing_direction_if_any
- (separator != NULL ? separator + 1 : gradient_spec);
-}
-
-/* Do the work shared by all the set_color_spec functions below. */
-static char *
-nautilus_gradient_set_edge_color (const char *gradient_spec,
- const char *edge_color,
- gboolean is_horizontal,
- gboolean change_end)
-{
- char *opposite_color;
- char *result;
-
- g_return_val_if_fail (edge_color != NULL, g_strdup (gradient_spec));
-
- /* Get the color from the existing gradient spec. for the opposite
- edge. This will parse away all the stuff we don't want from the
- old gradient spec.
- */
- opposite_color = change_end
- ? nautilus_gradient_get_start_color_spec (gradient_spec)
- : nautilus_gradient_get_end_color_spec (gradient_spec);
-
- /* Create a new gradient spec. The nautilus_gradient_new function handles
- some special cases, so we don't have to bother with them here.
- */
- result = nautilus_gradient_new (change_end ? opposite_color : edge_color,
- change_end ? edge_color : opposite_color,
- is_horizontal);
-
- g_free (opposite_color);
-
- return result;
-}
-
-/**
- * nautilus_gradient_set_left_color_spec
- * @gradient_spec: A gradient spec. string.
- * @left_color: Color spec. to replace left color with.
- *
- * Changes the left color to what's passed in.
- * This creates a horizontal gradient.
- */
-char *
-nautilus_gradient_set_left_color_spec (const char *gradient_spec,
- const char *left_color)
-{
- return nautilus_gradient_set_edge_color (gradient_spec, left_color, TRUE, FALSE);
-}
-
-/**
- * nautilus_gradient_set_top_color_spec
- * @gradient_spec: A gradient spec. string.
- * @top_color: Color spec. to replace top color with.
- *
- * Changes the top color to what's passed in.
- * This creates a vertical gradient.
- */
-char *
-nautilus_gradient_set_top_color_spec (const char *gradient_spec,
- const char *top_color)
-{
- return nautilus_gradient_set_edge_color (gradient_spec, top_color, FALSE, FALSE);
-}
-
-/**
- * nautilus_gradient_set_right_color_spec
- * @gradient_spec: A gradient spec. string.
- * @right_color: Color spec. to replace right color with.
- *
- * Changes the right color to what's passed in.
- * This creates a horizontal gradient.
- */
-char *
-nautilus_gradient_set_right_color_spec (const char *gradient_spec,
- const char *right_color)
-{
- return nautilus_gradient_set_edge_color (gradient_spec, right_color, TRUE, TRUE);
-}
-
-/**
- * nautilus_gradient_set_bottom_color_spec
- * @gradient_spec: A gradient spec. string.
- * @bottom_color: Color spec. to replace bottom color with.
- *
- * Changes the bottom color to what's passed in.
- * This creates a vertical gradient.
- */
-char *
-nautilus_gradient_set_bottom_color_spec (const char *gradient_spec,
- const char *bottom_color)
-{
- return nautilus_gradient_set_edge_color (gradient_spec, bottom_color, FALSE, TRUE);
-}
-
-/**
- * nautilus_gdk_color_parse_with_white_default
- * @color_spec: A color spec.
- * @color: Pointer to place to put resulting color.
- *
- * The same as gdk_color_parse, except sets the color to white if
- * the spec. can't be parsed instead of returning a boolean flag.
- */
-void
-nautilus_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *color)
-{
- if (color_spec == NULL || !gdk_color_parse (color_spec, color)) {
- color->red = 0xFFFF;
- color->green = 0xFFFF;
- color->blue = 0xFFFF;
- }
-}
-
-/**
- * nautilus_parse_rgb_with_white_default
- * @color_spec: A color spec.
- * Returns: An rgb value.
- *
- * The same as gdk_color_parse, except sets the color to white if
- * the spec. can't be parsed instead of returning a boolean flag
- * and returns a guint32 rgb value instead of a GdkColor.
- */
-guint32
-nautilus_parse_rgb_with_white_default (const char *color_spec)
-{
- GdkColor color;
-
- if (color_spec == NULL || !gdk_color_parse (color_spec, &color)) {
- return NAUTILUS_RGB_COLOR_WHITE;
- }
- return ((color.red << 8) & NAUTILUS_RGB_COLOR_RED)
- | (color.green & NAUTILUS_RGB_COLOR_GREEN)
- | ((color.blue >> 8) & NAUTILUS_RGB_COLOR_BLUE);
-}
-
-/**
- * nautilus_gdk_font_equal
- * @font_a_null_allowed: A font or NULL.
- * @font_b_null_allowed: A font or NULL.
- *
- * Calls gdk_font_equal, unless one of the fonts is NULL.
- */
-gboolean
-nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
- GdkFont *font_b_null_allowed)
-{
- if (font_a_null_allowed == NULL) {
- return font_b_null_allowed == NULL;
- }
- if (font_b_null_allowed == NULL) {
- return FALSE;
- }
- return gdk_font_equal (font_a_null_allowed, font_b_null_allowed);
-}
-
-/**
- * nautilus_stipple_bitmap:
- *
- * Get pointer to singleton 50% stippled bitmap.
- * This is a global object; do not free.
- */
-GdkBitmap *
-nautilus_stipple_bitmap ()
-{
- static GdkBitmap *stipple = NULL;
-
- if (stipple == NULL) {
- char stipple_bits[] = { 0x02, 0x01 };
- stipple = gdk_bitmap_create_from_data (NULL, stipple_bits, 2, 2);
- }
-
- return stipple;
-}
-
-#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static char *
-nautilus_gdk_color_as_hex_string (GdkColor color)
-{
- return g_strdup_printf("rgb:%04hX/%04hX/%04hX",
- color.red, color.green, color.blue);
-}
-
-static char *
-nautilus_self_check_parse (const char *color_spec)
-{
- GdkColor color;
-
- nautilus_gdk_color_parse_with_white_default (color_spec, &color);
- return nautilus_gdk_color_as_hex_string (color);
-}
-
-void
-nautilus_self_check_gdk_extensions (void)
-{
- /* nautilus_interpolate_color */
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_interpolate_color (0.0, 0, 0), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_interpolate_color (0.0, 0, 0xFFFFFF), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_interpolate_color (0.5, 0, 0xFFFFFF), 0x7F7F7F);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_interpolate_color (1.0, 0, 0xFFFFFF), 0xFFFFFF);
-
- /* nautilus_fill_rectangle */
- /* Make a GdkImage and fill it, maybe? */
-
- /* nautilus_fill_rectangle_with_color */
-
- /* nautilus_fill_rectangle_with_gradient */
-
- /* nautilus_gradient_new */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_new ("", "", FALSE), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_new ("a", "b", FALSE), "a-b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_new ("a", "b", TRUE), "a-b:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_new ("a", "a", FALSE), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_new ("a", "a", TRUE), "a");
-
- /* nautilus_gradient_is_gradient */
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_gradient_is_gradient (""), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_gradient_is_gradient ("-"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_gradient_is_gradient ("a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_gradient_is_gradient ("a-b"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_gradient_is_gradient ("a-b:h"), TRUE);
-
- /* nautilus_gradient_get_start_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec (""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("-"), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a-b"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a-"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("-b"), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a:h"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a:v"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a:c"), "a:c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a:-b"), "a:");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_start_color_spec ("a:-b:v"), "a:");
-
- /* nautilus_gradient_get_end_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec (""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("-"), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a-b"), "b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a-"), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("-b"), "b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a:h"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a:v"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a:c"), "a:c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a:-b"), "b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_get_end_color_spec ("a:-b:v"), "b");
-
- /* nautilus_gradient_set_left_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("", ""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a", ""), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a", "b"), "b-a:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a-c:v", "b"), "b-c:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a-c:v", "c"), "c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_left_color_spec ("a:-b:v", "d"), "d-b:h");
-
- /* nautilus_gradient_set_top_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("", ""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a", ""), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a", "b"), "b-a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a-c:v", "b"), "b-c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a-c:v", "c"), "c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_top_color_spec ("a:-b:h", "d"), "d-b");
-
- /* nautilus_gradient_set_right_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("", ""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a", ""), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a", "b"), "a-b:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a-c:v", "b"), "a-b:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a-c:v", "c"), "a-c:h");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_right_color_spec ("a:-b:v", "d"), "a:-d:h");
-
- /* nautilus_gradient_set_bottom_color_spec */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("", ""), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a", ""), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a", "a"), "a");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a", "b"), "a-b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a-c:v", "b"), "a-b");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a-c:v", "c"), "a-c");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_gradient_set_bottom_color_spec ("a:-b:h", "d"), "a:-d");
-
- /* nautilus_gdk_color_parse_with_white_default */
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_parse (""), "rgb:FFFF/FFFF/FFFF");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_parse ("a"), "rgb:FFFF/FFFF/FFFF");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_parse ("white"), "rgb:FFFF/FFFF/FFFF");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_parse ("black"), "rgb:0000/0000/0000");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_parse ("rgb:0123/4567/89AB"), "rgb:0123/4567/89AB");
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-gdk-extensions.h b/libnautilus/nautilus-gdk-extensions.h
deleted file mode 100644
index 464c5482a..000000000
--- a/libnautilus/nautilus-gdk-extensions.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gdk-extensions.h: Graphics routines to augment what's in gdk.
-
- Copyright (C) 1999, 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_GDK_EXTENSIONS_H
-#define NAUTILUS_GDK_EXTENSIONS_H
-
-#include <gdk/gdktypes.h>
-
-#define NAUTILUS_RGB_COLOR_RED 0xFF0000
-#define NAUTILUS_RGB_COLOR_GREEN 0x00FF00
-#define NAUTILUS_RGB_COLOR_BLUE 0x0000FF
-#define NAUTILUS_RGB_COLOR_WHITE 0xFFFFFF
-#define NAUTILUS_RGB_COLOR_BLACK 0x000000
-
-/* A gradient spec. is a string that contains a specifier for either a
- color or a gradient. If the string has a "-" in it, then it's a gradient.
- The gradient is vertical by default and the spec. can end with ":v" to indicate that.
- If the gradient ends with ":h", the gradient is horizontal.
-*/
-char * nautilus_gradient_new (const char *start_color,
- const char *end_color,
- gboolean is_horizontal);
-gboolean nautilus_gradient_is_gradient (const char *gradient_spec);
-char * nautilus_gradient_get_start_color_spec (const char *gradient_spec);
-char * nautilus_gradient_get_end_color_spec (const char *gradient_spec);
-gboolean nautilus_gradient_is_horizontal (const char *gradient_spec);
-char * nautilus_gradient_set_left_color_spec (const char *gradient_spec,
- const char *left_color);
-char * nautilus_gradient_set_top_color_spec (const char *gradient_spec,
- const char *top_color);
-char * nautilus_gradient_set_right_color_spec (const char *gradient_spec,
- const char *right_color);
-char * nautilus_gradient_set_bottom_color_spec (const char *gradient_spec,
- const char *bottom_color);
-
-/* A version of parse_color that substitutes a default color instead of returning
- a boolean to indicate it cannot be parsed.
-*/
-void nautilus_gdk_coolor_parse_with_default (const char *color_spec,
- const GdkColor *default_color,
- GdkColor *parsed_color);
-void nautilus_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *parsed_color);
-guint32 nautilus_parse_rgb_with_default (const char *color_spec,
- guint32 default_rgb);
-guint32 nautilus_parse_rgb_with_white_default (const char *color_spec);
-
-/* Fill routines that take GdkRectangle parameters instead of four integers. */
-void nautilus_fill_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle);
-void nautilus_fill_rectangle_with_color (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- guint32 rgb);
-void nautilus_fill_rectangle_with_gradient (GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rectangle,
- guint32 start_rgb,
- guint32 end_rgb,
- gboolean horizontal_gradient);
-/* A routine to get a 50% gray stippled bitmap for use in some types of highlighting. */
-GdkBitmap *nautilus_stipple_bitmap (void);
-
-/* Misc GdkRectangle helper functions */
-gboolean nautilus_rectangle_contains (const GdkRectangle *rectangle,
- int x,
- int y);
-void nautilus_rectangle_inset (GdkRectangle *rectangle,
- int x,
- int y);
-
-/* A basic operation we use for drawing gradients is interpolating two colors.*/
-guint32 nautilus_interpolate_color (gdouble ratio,
- guint32 start_rgb,
- guint32 end_rgb);
-gboolean nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
- GdkFont *font_b_null_allowed);
-
-#endif /* NAUTILUS_GDK_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-gdk-pixbuf-extensions.c b/libnautilus/nautilus-gdk-pixbuf-extensions.c
deleted file mode 100644
index 4c449e2ad..000000000
--- a/libnautilus/nautilus-gdk-pixbuf-extensions.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gdk-pixbuf-extensions.c: Routines to augment what's in gdk-pixbuf.
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-gdk-pixbuf-extensions.h"
-
-#include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-async-ops.h>
-
-#define LOAD_BUFFER_SIZE 4096
-
-struct NautilusPixbufLoadHandle {
- GnomeVFSAsyncHandle *vfs_handle;
- NautilusPixbufLoadCallback callback;
- gpointer callback_data;
- GdkPixbufLoader *loader;
- char buffer[LOAD_BUFFER_SIZE];
-};
-
-static void file_opened_callback (GnomeVFSAsyncHandle *vfs_handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void file_read_callback (GnomeVFSAsyncHandle *vfs_handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void file_closed_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void load_done (NautilusPixbufLoadHandle *handle,
- GnomeVFSResult result,
- GdkPixbuf *pixbuf);
-
-/**
- * nautilus_gdk_pixbuf_list_ref
- * @pixbuf_list: A list of GdkPixbuf objects.
- *
- * Refs all the pixbufs.
- **/
-void
-nautilus_gdk_pixbuf_list_ref (GList *pixbuf_list)
-{
- g_list_foreach (pixbuf_list, (GFunc) gdk_pixbuf_ref, NULL);
-}
-
-/**
- * nautilus_gdk_pixbuf_list_free
- * @pixbuf_list: A list of GdkPixbuf objects.
- *
- * Unrefs all the pixbufs, then frees the list.
- **/
-void
-nautilus_gdk_pixbuf_list_free (GList *pixbuf_list)
-{
- g_list_foreach (pixbuf_list, (GFunc) gdk_pixbuf_unref, NULL);
- g_list_free (pixbuf_list);
-}
-
-GdkPixbuf *
-nautilus_gdk_pixbuf_load (const char *uri)
-{
- GnomeVFSResult result;
- GnomeVFSHandle *handle;
- char buffer[LOAD_BUFFER_SIZE];
- GnomeVFSFileSize bytes_read;
- GdkPixbufLoader *loader;
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- result = gnome_vfs_open (&handle,
- uri,
- GNOME_VFS_OPEN_READ);
- if (result != GNOME_VFS_OK) {
- return NULL;
- }
-
- loader = gdk_pixbuf_loader_new ();
- while (1) {
- result = gnome_vfs_read (handle,
- buffer,
- sizeof (buffer),
- &bytes_read);
- if (result != GNOME_VFS_OK) {
- break;
- }
- if (bytes_read == 0) {
- break;
- }
- if (!gdk_pixbuf_loader_write (loader,
- buffer,
- bytes_read)) {
- result = GNOME_VFS_ERROR_WRONGFORMAT;
- break;
- }
- }
-
- if (result != GNOME_VFS_OK) {
- gtk_object_unref (GTK_OBJECT (loader));
- gnome_vfs_close (handle);
- return NULL;
- }
-
- gnome_vfs_close (handle);
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- if (pixbuf != NULL) {
- gdk_pixbuf_ref (pixbuf);
- }
- gtk_object_unref (GTK_OBJECT (loader));
-
- return pixbuf;
-}
-
-NautilusPixbufLoadHandle *
-nautilus_gdk_pixbuf_load_async (const char *uri,
- NautilusPixbufLoadCallback callback,
- gpointer callback_data)
-{
- NautilusPixbufLoadHandle *handle;
-
- handle = g_new0 (NautilusPixbufLoadHandle, 1);
- handle->callback = callback;
- handle->callback_data = callback_data;
-
- gnome_vfs_async_open (&handle->vfs_handle,
- uri,
- GNOME_VFS_OPEN_READ,
- file_opened_callback,
- handle);
-
- return handle;
-}
-
-static void
-file_opened_callback (GnomeVFSAsyncHandle *vfs_handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusPixbufLoadHandle *handle;
-
- handle = callback_data;
- g_assert (handle->vfs_handle == vfs_handle);
-
- if (result != GNOME_VFS_OK) {
- load_done (handle, result, NULL);
- return;
- }
-
- handle->loader = gdk_pixbuf_loader_new ();
-
- gnome_vfs_async_read (handle->vfs_handle,
- handle->buffer,
- sizeof (handle->buffer),
- file_read_callback,
- handle);
-}
-
-static void
-file_read_callback (GnomeVFSAsyncHandle *vfs_handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data)
-{
- NautilusPixbufLoadHandle *handle;
- GdkPixbuf *pixbuf;
-
- handle = callback_data;
- g_assert (handle->vfs_handle == vfs_handle);
- g_assert (handle->buffer == buffer);
-
- if (result == GNOME_VFS_OK && bytes_read != 0) {
- if (!gdk_pixbuf_loader_write (handle->loader,
- buffer,
- bytes_read)) {
- result = GNOME_VFS_ERROR_WRONGFORMAT;
- }
- gnome_vfs_async_read (handle->vfs_handle,
- handle->buffer,
- sizeof (handle->buffer),
- file_read_callback,
- handle);
- return;
- }
-
- if (result != GNOME_VFS_OK) {
- pixbuf = NULL;
- } else {
- pixbuf = gdk_pixbuf_loader_get_pixbuf (handle->loader);
- }
-
- load_done (handle, result, pixbuf);
-}
-
-static void
-file_closed_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- g_assert (callback_data == NULL);
-}
-
-static void
-free_pixbuf_load_handle (NautilusPixbufLoadHandle *handle)
-{
- if (handle->loader != NULL) {
- gtk_object_unref (GTK_OBJECT (handle->loader));
- }
- g_free (handle);
-}
-
-static void
-load_done (NautilusPixbufLoadHandle *handle,
- GnomeVFSResult result,
- GdkPixbuf *pixbuf)
-{
- if (handle->vfs_handle != NULL) {
- gnome_vfs_async_close (handle->vfs_handle, file_closed_callback, NULL);
- }
- (* handle->callback) (result, pixbuf, handle->callback_data);
- free_pixbuf_load_handle (handle);
-}
-
-void
-nautilus_cancel_gdk_pixbuf_load (NautilusPixbufLoadHandle *handle)
-{
- if (handle == NULL) {
- return;
- }
- if (handle->vfs_handle != NULL) {
- gnome_vfs_async_cancel (handle->vfs_handle);
- }
- free_pixbuf_load_handle (handle);
-}
-
-void
-nautilus_gdk_pixbuf_render_to_drawable_tiled (GdkPixbuf *pixbuf,
- GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *rect,
- GdkRgbDither dither,
- int x_dither,
- int y_dither)
-{
- int x, y;
- int start_x, start_y;
- int end_x, end_y;
- int tile_x, tile_y;
- int blit_x, blit_y;
- int tile_width, tile_height;
- int blit_width, blit_height;
- int tile_offset_x, tile_offset_y;
-
- tile_width = gdk_pixbuf_get_width (pixbuf);
- tile_height = gdk_pixbuf_get_height (pixbuf);
-
- tile_offset_x = (rect->x - x_dither) % tile_width;
- if (tile_offset_x < 0) {
- tile_offset_x += tile_width;
- }
- g_assert (tile_offset_x >= 0 && tile_offset_x < tile_width);
-
- tile_offset_y = (rect->y - y_dither) % tile_height;
- if (tile_offset_y < 0) {
- tile_offset_y += tile_height;
- }
- g_assert (tile_offset_y >= 0 && tile_offset_y < tile_height);
-
- start_x = rect->x - tile_offset_x;
- start_y = rect->y - tile_offset_y;
-
- end_x = rect->x + rect->width;
- end_y = rect->y + rect->height;
-
- for (x = start_x; x < end_x; x += tile_width) {
- blit_x = MAX (x, rect->x);
- tile_x = blit_x - x;
- blit_width = MIN (tile_width, end_x - x) - tile_x;
-
- for (y = start_y; y < end_y; y += tile_height) {
- blit_y = MAX (y, rect->y);
- tile_y = blit_y - y;
- blit_height = MIN (tile_height, end_y - y) - tile_y;
-
- gdk_pixbuf_render_to_drawable (pixbuf, drawable, gc,
- tile_x, tile_y,
- blit_x, blit_y, blit_width, blit_height,
- dither, x_dither, y_dither);
- }
- }
-}
diff --git a/libnautilus/nautilus-gdk-pixbuf-extensions.h b/libnautilus/nautilus-gdk-pixbuf-extensions.h
deleted file mode 100644
index 6019e5048..000000000
--- a/libnautilus/nautilus-gdk-pixbuf-extensions.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gdk-pixbuf-extensions.h: Routines to augment what's in gdk-pixbuf.
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_GDK_PIXBUF_EXTENSIONS_H
-#define NAUTILUS_GDK_PIXBUF_EXTENSIONS_H
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomevfs/gnome-vfs-types.h>
-
-typedef struct NautilusPixbufLoadHandle NautilusPixbufLoadHandle;
-typedef void (* NautilusPixbufLoadCallback) (GnomeVFSResult error,
- GdkPixbuf *pixbuf,
- gpointer callback_data);
-
-/* Convenience functions for lists of GdkPixbuf objects. */
-void nautilus_gdk_pixbuf_list_ref (GList *pixbuf_list);
-void nautilus_gdk_pixbuf_list_unref (GList *pixbuf_list);
-void nautilus_gdk_pixbuf_list_free (GList *pixbuf_list);
-
-/* Loading a GdkPixbuf with a URI. */
-GdkPixbuf * nautilus_gdk_pixbuf_load (const char *uri);
-
-/* Same thing async. */
-NautilusPixbufLoadHandle *nautilus_gdk_pixbuf_load_async (const char *uri,
- NautilusPixbufLoadCallback callback,
- gpointer callback_data);
-void nautilus_cancel_gdk_pixbuf_load (NautilusPixbufLoadHandle *handle);
-
-/* Draw a GdkPixbuf tiled. */
-void nautilus_gdk_pixbuf_render_to_drawable_tiled (GdkPixbuf *pixbuf,
- GdkDrawable *drawable,
- GdkGC *gc,
- const GdkRectangle *destination_rectangle,
- GdkRgbDither dither,
- int x_dither,
- int y_dither);
-
-#endif /* NAUTILUS_GDK_PIXBUF_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-glib-extensions.c b/libnautilus/nautilus-glib-extensions.c
deleted file mode 100644
index f06a081d0..000000000
--- a/libnautilus/nautilus-glib-extensions.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-glib-extensions.c - implementation of new functions that conceptually
- belong in glib. Perhaps some of these will be
- actually rolled into glib someday.
-
- 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#include "nautilus-glib-extensions.h"
-
-#include "nautilus-lib-self-check-functions.h"
-
-
-/**
- * nautilus_g_date_new_tm:
- *
- * Get a new GDate * for the date represented by a tm struct.
- * The caller is responsible for g_free-ing the result.
- * @time_pieces: Pointer to a tm struct representing the date to be converted.
- *
- * Returns: Newly allocated date.
- *
- **/
-GDate *
-nautilus_g_date_new_tm (struct tm *time_pieces)
-{
- /* tm uses 0-based months; GDate uses 1-based months.
- * tm_year needs 1900 added to get the full year.
- */
- return g_date_new_dmy (time_pieces->tm_mday,
- time_pieces->tm_mon + 1,
- time_pieces->tm_year + 1900);
-}
-
-/**
- * nautilus_strdup_strftime:
- *
- * Cover for standard date-and-time-formatting routine strftime that returns
- * a newly-allocated string of the correct size. The caller is responsible
- * for g_free-ing the returned string.
- * @format: format string to pass to strftime. See strftime documentation
- * for details.
- * @time_pieces: date/time, in struct format.
- *
- * Return value: Newly allocated string containing the formatted time.
- **/
-char *
-nautilus_strdup_strftime (const char *format, struct tm *time_pieces)
-{
- char *result;
- size_t string_length;
-
- string_length = strftime (NULL, G_MAXINT, format, time_pieces);
- result = g_malloc (string_length + 1);
- strftime (result, string_length + 1, format, time_pieces);
-
- return result;
-}
-
-/**
- * nautilus_g_list_equal
- *
- * Compares two lists to see if they are equal.
- * @list_a: First list.
- * @list_b: Second list.
- *
- * Return value: TRUE if the lists are the same length with the same elements.
- **/
-gboolean
-nautilus_g_list_equal (GList *list_a, GList *list_b)
-{
- GList *p, *q;
-
- for (p = list_a, q = list_b; p != NULL && q != NULL; p = p->next, q = q->next) {
- if (p->data != q->data) {
- return FALSE;
- }
- }
- return p == NULL && q == NULL;
-}
-
-/**
- * nautilus_g_list_free_deep
- *
- * Frees the elements of a list and then the list.
- * @list: List of elements that can be freed with g_free.
- **/
-void
-nautilus_g_list_free_deep (GList *list)
-{
- g_list_foreach (list, (GFunc) g_free, NULL);
- g_list_free (list);
-}
-
-/**
- * nautilus_g_strv_find
- *
- * Get index of string in array of strings.
- *
- * @strv: NULL-terminated array of strings.
- * @find_me: string to search for.
- *
- * Return value: index of array entry in @strv that
- * matches @find_me, or -1 if no matching entry.
- */
-int
-nautilus_g_strv_find (char **strv, const char *find_me)
-{
- int index;
-
- g_return_val_if_fail (find_me != NULL, -1);
-
- for (index = 0; strv[index] != NULL; ++index) {
- if (strcmp (strv[index], find_me) == 0) {
- return index;
- }
- }
-
- return -1;
-}
-
-/**
- * nautilus_g_list_safe_for_each
- *
- * A version of g_list_foreach that works if the passed function
- * deletes the current element.
- *
- * @list: List to iterate.
- * @function: Function to call on each element.
- * @user_data: Data to pass to function.
- */
-void
-nautilus_g_list_safe_for_each (GList *list, GFunc function, gpointer user_data)
-{
- GList *p, *next;
-
- for (p = list; p != NULL; p = next) {
- next = p->next;
- (* function) (p->data, user_data);
- }
-}
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static void
-check_tm_to_g_date (time_t time)
-{
- struct tm *before_conversion;
- struct tm after_conversion;
- GDate *date;
-
- before_conversion = localtime (&time);
- date = nautilus_g_date_new_tm (before_conversion);
-
- g_date_to_struct_tm (date, &after_conversion);
-
- g_date_free (date);
-
- NAUTILUS_CHECK_INTEGER_RESULT (after_conversion.tm_mday,
- before_conversion->tm_mday);
- NAUTILUS_CHECK_INTEGER_RESULT (after_conversion.tm_mon,
- before_conversion->tm_mon);
- NAUTILUS_CHECK_INTEGER_RESULT (after_conversion.tm_year,
- before_conversion->tm_year);
-}
-
-void
-nautilus_self_check_glib_extensions (void)
-{
- char **strv;
-
- check_tm_to_g_date (0); /* lower limit */
- check_tm_to_g_date ((time_t) -1); /* upper limit */
- check_tm_to_g_date (time (NULL)); /* current time */
-
- strv = g_strsplit ("zero|one|two|three|four", "|", 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, "zero"), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, "one"), 1);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, "four"), 4);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, "five"), -1);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, ""), -1);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_g_strv_find (strv, "o"), -1);
- g_strfreev (strv);
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-glib-extensions.h b/libnautilus/nautilus-glib-extensions.h
deleted file mode 100644
index f087cbeb8..000000000
--- a/libnautilus/nautilus-glib-extensions.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-glib-extensions.h - interface for new functions that conceptually
- belong in glib. Perhaps some of these will be
- actually rolled into glib someday.
-
- 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#ifndef NAUTILUS_GLIB_EXTENSIONS_H
-#define NAUTILUS_GLIB_EXTENSIONS_H
-
-#include <time.h>
-#include <glib.h>
-
-/* Use this until we can switch to G_N_ELEMENTS. */
-#define NAUTILUS_N_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))
-
-/* Date & time functions. */
-GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
-char * nautilus_strdup_strftime (const char *format,
- struct tm *time_pieces);
-
-/* List functions. */
-gboolean nautilus_g_list_equal (GList *list_a,
- GList *list_b);
-void nautilus_g_list_free_deep (GList *list);
-void nautilus_g_list_safe_for_each (GList *list,
- GFunc function,
- gpointer user_data);
-
-/* NULL terminated string arrays (strv). */
-int nautilus_g_strv_find (char **strv,
- const char *find_me);
-
-#endif /* NAUTILUS_GLIB_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-global-preferences.c b/libnautilus/nautilus-global-preferences.c
deleted file mode 100644
index d4e531796..000000000
--- a/libnautilus/nautilus-global-preferences.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-prefs-dialog.c - Implementation for preferences dialog.
-
- Copyright (C) 1999, 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.
-
- Authors: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-global-preferences.h"
-
-#include <nautilus-widgets/nautilus-preferences-group.h>
-#include <nautilus-widgets/nautilus-preferences-item.h>
-#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-
-/*
- * Constants
- */
-#define GLOBAL_PREFERENCES_DIALOG_TITLE _("Nautilus Preferences")
-
-/* Private stuff */
-static GtkWidget *global_preferences_create_dialog (void);
-static GtkWidget *global_preferences_create_enum_group (GtkWidget *pane,
- const char *group_title,
- const char *pref_name);
-static GtkWidget *global_preferences_create_check_group (GtkWidget *pane,
- const char *group_title,
- const char * const pref_names[],
- guint num_prefs);
-static GtkWidget *global_preferences_get_dialog (void);
-static void global_preferences_register_for_ui (void);
-static void global_preferences_register_static (NautilusPreferences *prefs);
-static void global_preferences_register_dynamic (NautilusPreferences *prefs);
-
-static const char * const global_preferences_window_option_pref_names[] =
-{
- NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
- NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING
-};
-
-static const char * const global_preferences_meta_view_names[] =
-{
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH
-};
-
-static const char * const global_preferences_user_level_names[] =
-{
- "novice",
- "intermediate",
- "hacker"
-};
-
-static const char * const global_preferences_user_level_descriptions[] =
-{
- "Novice",
- "Intermediate",
- "Hacker"
-};
-
-static const gint global_preferences_user_level_values[] =
-{
- NAUTILUS_USER_LEVEL_NOVICE,
- NAUTILUS_USER_LEVEL_INTERMEDIATE,
- NAUTILUS_USER_LEVEL_HACKER
-};
-
-static const NautilusPreferencesEnumData global_preferences_user_level_data =
-{
- global_preferences_user_level_names,
- global_preferences_user_level_descriptions,
- global_preferences_user_level_values,
- NAUTILUS_N_ELEMENTS (global_preferences_user_level_names)
-};
-
-static const NautilusPreferencesInfo global_preferences_static_info[] =
-{
- {
- NAUTILUS_PREFERENCES_USER_LEVEL,
- "User Level",
- NAUTILUS_PREFERENCE_ENUM,
- (gconstpointer) NAUTILUS_USER_LEVEL_HACKER,
- (gpointer) &global_preferences_user_level_data
- },
- {
- NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
- "Create new window for each new page",
- NAUTILUS_PREFERENCE_BOOLEAN,
- FALSE,
- NULL
- },
- {
- NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING,
- "Do not open more than one window with the same page",
- NAUTILUS_PREFERENCE_BOOLEAN,
- FALSE,
- NULL
- },
-};
-
-/*
- * Private stuff
- */
-static GtkWidget *
-global_preferences_create_dialog (void)
-{
- GtkWidget *panes[3];
- GtkWidget *prefs_dialog;
- NautilusPreferencesBox *prefs_box;
-
- global_preferences_register_for_ui ();
-
- prefs_dialog = nautilus_preferences_dialog_new (GLOBAL_PREFERENCES_DIALOG_TITLE);
-
- prefs_box = NAUTILUS_PREFERENCES_BOX (nautilus_preferences_dialog_get_prefs_box (NAUTILUS_PREFERENCES_DIALOG (prefs_dialog)));
-
- panes[0] = nautilus_preferences_box_add_pane (prefs_box,
- "User Level",
- "User Level Something");
-
- global_preferences_create_enum_group (panes[0],
- "User Level",
- NAUTILUS_PREFERENCES_USER_LEVEL);
-
- panes[1] = nautilus_preferences_box_add_pane (prefs_box,
- "Window Options",
- "Window Options Something");
-
- global_preferences_create_check_group (panes[1],
- "Basic window options",
- global_preferences_window_option_pref_names,
- NAUTILUS_N_ELEMENTS (global_preferences_window_option_pref_names));
-
- panes[2] = nautilus_preferences_box_add_pane (prefs_box,
- "Meta Views",
- "Meta Views Something");
-
- global_preferences_create_check_group (panes[2],
- "Meta Views",
- global_preferences_meta_view_names,
- NAUTILUS_N_ELEMENTS (global_preferences_meta_view_names));
-
- return prefs_dialog;
-}
-
-static GtkWidget *
-global_preferences_create_check_group (GtkWidget *pane,
- const char *group_title,
- const char * const pref_names[],
- guint num_prefs)
-{
- GtkWidget *group;
- guint i;
-
- group = nautilus_preferences_group_new (group_title);
-
- for (i = 0; i < num_prefs; i++)
- {
- GtkWidget *item;
-
- item = nautilus_preferences_item_new (GTK_OBJECT (nautilus_preferences_get_global_preferences ()),
- pref_names[i],
- NAUTILUS_PREFERENCE_BOOLEAN);
-
- nautilus_preferences_group_add (NAUTILUS_PREFERENCES_GROUP (group),
- item);
-
- gtk_widget_show (item);
- }
-
- nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (pane), group);
-
- gtk_widget_show (group);
-
- return group;
-}
-
-static GtkWidget *
-global_preferences_create_enum_group (GtkWidget *pane,
- const char *group_title,
- const char *pref_name)
-{
- GtkWidget *group;
- GtkWidget *item;
-
- group = nautilus_preferences_group_new (group_title);
-
- item = nautilus_preferences_item_new (GTK_OBJECT (nautilus_preferences_get_global_preferences ()),
- pref_name,
- NAUTILUS_PREFERENCE_ENUM);
-
-
- nautilus_preferences_group_add (NAUTILUS_PREFERENCES_GROUP (group), item);
-
- gtk_widget_show (item);
-
- nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (pane), group);
-
- gtk_widget_show (group);
-
- return group;
-}
-
-static void
-global_preferences_register_static (NautilusPreferences *prefs)
-{
- guint i;
-
- g_assert (prefs != NULL);
-
- /* Register the static prefs */
- for (i = 0; i < NAUTILUS_N_ELEMENTS (global_preferences_static_info); i++) {
- nautilus_preferences_set_info (prefs,
- global_preferences_static_info[i].name,
- global_preferences_static_info[i].description,
- global_preferences_static_info[i].type,
- global_preferences_static_info[i].default_value,
- global_preferences_static_info[i].data);
- }
-}
-
-/*
- * Presummably, the following would be registered
- * only if the component was present. Once we
- * have smarter activation, that will be case.
- *
- * For now turn on all the ones we know about.
- */
-
-const NautilusStringList *
-nautilus_global_preferences_get_meta_view_iids (void)
-{
- static NautilusStringList * meta_view_names = NULL;
-
- if (!meta_view_names)
- {
- meta_view_names = nautilus_string_list_new ();
-
- nautilus_string_list_insert (meta_view_names, "ntl_notes_view");
- nautilus_string_list_insert (meta_view_names, "hyperbola_navigation_tree");
- nautilus_string_list_insert (meta_view_names, "hyperbola_navigation_index");
- nautilus_string_list_insert (meta_view_names, "hyperbola_navigation_search");
- nautilus_string_list_insert (meta_view_names, "ntl_history_view");
- nautilus_string_list_insert (meta_view_names, "ntl_websearch_view");
- }
-
- return meta_view_names;
-}
-
-static void
-global_preferences_register_dynamic (NautilusPreferences *prefs)
-{
- g_assert (prefs != NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY,
- "History View",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) TRUE,
- NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH,
- "Web Search View",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) TRUE,
- NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS,
- "Annotations",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) TRUE,
- NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS,
- "Help Contents",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) TRUE,
- NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX,
- "Help Index",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) FALSE,
- NULL);
-
- nautilus_preferences_set_info (prefs,
- NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH,
- "Help Search",
- NAUTILUS_PREFERENCE_BOOLEAN,
- (gconstpointer) FALSE,
- NULL);
-}
-
-static GtkWidget *
-global_preferences_get_dialog (void)
-{
- static GtkWidget * global_prefs_dialog = NULL;
-
- NautilusPreferences * global_prefs = nautilus_preferences_get_global_preferences ();
-
- if (!global_prefs)
- {
- g_warning ("something went terribly wrong with implicit prefs initialization");
-
- return NULL;
- }
-
- if (!global_prefs_dialog)
- {
- global_prefs_dialog = global_preferences_create_dialog ();
- }
-
- return global_prefs_dialog;
-}
-
-static void
-global_preferences_register_for_ui (void)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- initialized = TRUE;
-
- global_preferences_register_static (nautilus_preferences_get_global_preferences ());
- global_preferences_register_dynamic (nautilus_preferences_get_global_preferences ());
- }
-}
-
-/*
- * Public functions
- */
-void
-nautilus_global_preferences_show_dialog (void)
-{
- GtkWidget * global_prefs_dialog = global_preferences_get_dialog ();
-
- gtk_widget_show (global_prefs_dialog);
-}
-
-void
-nautilus_global_preferences_shutdown (void)
-{
- GtkWidget * global_prefs_dialog;
- GtkObject * global_prefs;
-
- return;
-
- global_prefs_dialog = global_preferences_get_dialog ();
-
- global_prefs = GTK_OBJECT (nautilus_preferences_get_global_preferences ());
-
- gtk_widget_unref (global_prefs_dialog);
-
- gtk_object_unref (global_prefs);
-}
-
diff --git a/libnautilus/nautilus-global-preferences.h b/libnautilus/nautilus-global-preferences.h
deleted file mode 100644
index 72855b7d6..000000000
--- a/libnautilus/nautilus-global-preferences.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-global-prefs.h - Nautilus main preferences api.
-
- Copyright (C) 1999, 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.
-
- Authors: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#ifndef NAUTILUS_PREFS_GLOBAL_H
-#define NAUTILUS_PREFS_GLOBAL_H
-
-#include <gnome.h>
-#include <nautilus-widgets/nautilus-preferences.h>
-#include <libnautilus/nautilus-string-list.h>
-
-BEGIN_GNOME_DECLS
-
-/* User level */
-#define NAUTILUS_PREFERENCES_USER_LEVEL "/nautilus/preferences/user_level"
-
-/* Window options */
-#define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "/nautilus/preferences/window_always_new"
-#define NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING "/nautilus/preferences/window_search_existing"
-
-/* Wellknown meta views */
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS "/nautilus/metaviews/ntl_notes_view"
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS "/nautilus/metaviews/hyperbola_navigation_tree"
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX "/nautilus/metaviews/hyperbola_navigation_index"
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH "/nautilus/metaviews/hyperbola_navigation_search"
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY "/nautilus/metaviews/ntl_history_view"
-#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH "/nautilus/metaviews/ntl_websearch_view"
-
-/* Preferences not (currently?) displayed in dialog */
-#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES "/nautilus/icon_view/text_attribute_names"
-#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
-
-enum
-{
- NAUTILUS_USER_LEVEL_NOVICE,
- NAUTILUS_USER_LEVEL_INTERMEDIATE,
- NAUTILUS_USER_LEVEL_HACKER
-};
-
-void nautilus_global_preferences_shutdown (void);
-void nautilus_global_preferences_show_dialog (void);
-const NautilusStringList *nautilus_global_preferences_get_meta_view_iids (void);
-
-BEGIN_GNOME_DECLS
-
-#endif /* NAUTILUS_PREFS_GLOBAL_H */
-
-
diff --git a/libnautilus/nautilus-gnome-extensions.c b/libnautilus/nautilus-gnome-extensions.c
deleted file mode 100644
index 6fdbc82eb..000000000
--- a/libnautilus/nautilus-gnome-extensions.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gnome-extensions.c - implementation of new functions that operate on
- gnome classes. Perhaps some of these should be
- rolled into gnome someday.
-
- Copyright (C) 1999, 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-gnome-extensions.h"
-
-void
-nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rect,
- ArtIRect *window_rect)
-{
- double x0, y0, x1, y1;
-
- g_return_if_fail (GNOME_IS_CANVAS (canvas));
- g_return_if_fail (world_rect != NULL);
- g_return_if_fail (window_rect != NULL);
-
- gnome_canvas_world_to_window (canvas,
- world_rect->x0,
- world_rect->y0,
- &x0, &y0);
- gnome_canvas_world_to_window (canvas,
- world_rect->x1,
- world_rect->y1,
- &x1, &y1);
-
- window_rect->x0 = x0;
- window_rect->y0 = y0;
- window_rect->x1 = x1;
- window_rect->y1 = y1;
-}
-
-void
-nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rect,
- ArtIRect *canvas_rect)
-{
- g_return_if_fail (GNOME_IS_CANVAS (canvas));
- g_return_if_fail (world_rect != NULL);
- g_return_if_fail (canvas_rect != NULL);
-
- gnome_canvas_w2c (canvas,
- world_rect->x0,
- world_rect->y0,
- &canvas_rect->x0,
- &canvas_rect->y0);
- gnome_canvas_w2c (canvas,
- world_rect->x1,
- world_rect->y1,
- &canvas_rect->x1,
- &canvas_rect->y1);
-}
-
-gboolean
-nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
- const ArtIRect *inner_rect)
-{
- g_return_val_if_fail (outer_rect != NULL, FALSE);
- g_return_val_if_fail (inner_rect != NULL, FALSE);
-
- return outer_rect->x0 <= inner_rect->x0
- && outer_rect->y0 <= inner_rect->y0
- && outer_rect->x1 >= inner_rect->x1
- && outer_rect->y1 >= inner_rect->y1;
-}
-
-gboolean
-nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
- const ArtIRect *rect_b)
-{
- ArtIRect intersection;
-
- g_return_val_if_fail (rect_a != NULL, FALSE);
- g_return_val_if_fail (rect_b != NULL, FALSE);
-
- art_irect_intersect (&intersection, rect_a, rect_b);
- return !art_irect_empty (&intersection);
-}
-
-gboolean
-nautilus_art_irect_equal (const ArtIRect *rect_a,
- const ArtIRect *rect_b)
-{
- g_return_val_if_fail (rect_a != NULL, FALSE);
- g_return_val_if_fail (rect_b != NULL, FALSE);
-
- return rect_a->x0 == rect_b->x0
- && rect_a->y0 == rect_b->y0
- && rect_a->x1 == rect_b->x1
- && rect_a->y1 == rect_b->y1;
-}
-
-gboolean
-nautilus_art_drect_equal (const ArtDRect *rect_a,
- const ArtDRect *rect_b)
-{
- g_return_val_if_fail (rect_a != NULL, FALSE);
- g_return_val_if_fail (rect_b != NULL, FALSE);
-
- return rect_a->x0 == rect_b->x0
- && rect_a->y0 == rect_b->y0
- && rect_a->x1 == rect_b->x1
- && rect_a->y1 == rect_b->y1;
-}
-
-void
-nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
- ArtIRect *bounds)
-{
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
- g_return_if_fail (bounds != NULL);
-
- bounds->x0 = item->x1;
- bounds->y0 = item->y1;
- bounds->x1 = item->x2;
- bounds->y1 = item->y2;
-}
-
-void
-nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item)
-{
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_request_redraw (item->canvas,
- item->x1, item->y1,
- item->x2, item->y2);
-}
-
-void
-nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
- const ArtIRect *canvas_rectangle)
-{
- g_return_if_fail (GNOME_IS_CANVAS (canvas));
-
- gnome_canvas_request_redraw (canvas,
- canvas_rectangle->x0, canvas_rectangle->y0,
- canvas_rectangle->x1, canvas_rectangle->y1);
-}
-
-void
-nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
- ArtDRect *world_bounds)
-{
- gnome_canvas_item_get_bounds (item,
- &world_bounds->x0,
- &world_bounds->y0,
- &world_bounds->x1,
- &world_bounds->y1);
- if (item->parent != NULL) {
- gnome_canvas_item_i2w (item->parent,
- &world_bounds->x0,
- &world_bounds->y0);
- gnome_canvas_item_i2w (item->parent,
- &world_bounds->x1,
- &world_bounds->y1);
- }
-}
diff --git a/libnautilus/nautilus-gnome-extensions.h b/libnautilus/nautilus-gnome-extensions.h
deleted file mode 100644
index 2ef76100c..000000000
--- a/libnautilus/nautilus-gnome-extensions.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gmp,e-extensions.h - interface for new functions that operate on
- gnome classes. Perhaps some of these should be
- rolled into gnome someday.
-
- Copyright (C) 1999, 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_GNOME_EXTENSIONS_H
-#define NAUTILUS_GNOME_EXTENSIONS_H
-
-#include <libgnomeui/gnome-canvas.h>
-
-typedef struct {
- int x;
- int y;
-} NautilusArtIPoint;
-
-/* This is more handy than gnome_canvas_item_get_bounds because it
- * always returns the bounds * in world coordinates and it returns
- * them in a single rectangle.
- */
-void nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
- ArtDRect *world_bounds);
-
-/* This returns the current canvas bounds as computed by update.
- * It's not as "up to date" as get_bounds, which is accurate even
- * before an update happens.
- */
-void nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
- ArtIRect *canvas_bounds);
-
-/* Convenience functions for doing things with whole rectangles. */
-void nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *canvas_rectangle);
-void nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *window_rectangle);
-void nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
- const ArtIRect *canvas_rectangle);
-
-/* Requests the entire object be redrawn.
- * Normally, you use request_update when calling from outside the canvas item
- * code. This is for within canvas item code.
- */
-void nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item);
-
-/* More functions for ArtIRect and ArtDRect. */
-gboolean nautilus_art_irect_equal (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_drect_equal (const ArtDRect *rect_a,
- const ArtDRect *rect_b);
-gboolean nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
- const ArtIRect *inner_rect);
-
-#endif /* NAUTILUS_GNOME_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-graphic-effects.c b/libnautilus/nautilus-graphic-effects.c
deleted file mode 100644
index 7424e523f..000000000
--- a/libnautilus/nautilus-graphic-effects.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* Nautilus - pixbuf manipulation routines for graphical effects.
- *
- * Copyright (C) 2000 Eazel, Inc
- *
- * Author: Andy Hertzfeld <andy@eazel.com>
- *
- * This 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.
- *
- * This 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 this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* This file contains pixbuf manipulation routines used for graphical effects like pre-lighting
- and selection hilighting */
-
-#include <config.h>
-#include "nautilus-graphic-effects.h"
-
-/* shared utility to create a new pixbuf from the passed-in one */
-
-static GdkPixbuf *
-create_new_pixbuf (GdkPixbuf *src)
-{
- g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 3)
- || (gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 4), NULL);
-
- return gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
- gdk_pixbuf_get_has_alpha (src),
- gdk_pixbuf_get_bits_per_sample (src),
- gdk_pixbuf_get_width (src),
- gdk_pixbuf_get_height (src));
-}
-
-/* utility routine to bump the level of a color component with pinning */
-
-static guchar
-lighten_component (guchar cur_value)
-{
- int new_value = cur_value;
- new_value += 24 + (new_value >> 3);
- if (new_value > 255) {
- new_value = 255;
- }
- return (guchar) new_value;
-}
-
-GdkPixbuf *
-nautilus_create_spotlight_pixbuf (GdkPixbuf* src)
-{
- GdkPixbuf *dest;
- int i, j;
- int width, height, has_alpha, src_row_stride, dst_row_stride;
- guchar *target_pixels, *original_pixels;
- guchar *pixsrc, *pixdest;
-
- g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 3)
- || (gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 4), NULL);
- g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
-
- dest = create_new_pixbuf (src);
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- dst_row_stride = gdk_pixbuf_get_rowstride (dest);
- src_row_stride = gdk_pixbuf_get_rowstride (src);
- target_pixels = gdk_pixbuf_get_pixels (dest);
- original_pixels = gdk_pixbuf_get_pixels (src);
-
- for (i = 0; i < height; i++) {
- pixdest = target_pixels + i * dst_row_stride;
- pixsrc = original_pixels + i * src_row_stride;
- for (j = 0; j < width; j++) {
- *pixdest++ = lighten_component (*pixsrc++);
- *pixdest++ = lighten_component (*pixsrc++);
- *pixdest++ = lighten_component (*pixsrc++);
- if (has_alpha) {
- *pixdest++ = *pixsrc++;
- }
- }
- }
- return dest;
-}
-
-
-/* the following routine was stolen from the panel to darken a pixbuf, by manipulating the saturation */
-
-/* saturation is 0-255, darken is 0-255 */
-
-GdkPixbuf *
-nautilus_create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
-{
- gint i, j;
- gint width, height, src_row_stride, dest_row_stride;
- gboolean has_alpha;
- guchar *target_pixels, *original_pixels;
- guchar *pixsrc, *pixdest;
- guchar intensity;
- guchar alpha;
- guchar negalpha;
- guchar r, g, b;
- GdkPixbuf *dest;
-
- g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 3)
- || (gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 4), NULL);
- g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
-
- dest = create_new_pixbuf (src);
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- dest_row_stride = gdk_pixbuf_get_rowstride (dest);
- src_row_stride = gdk_pixbuf_get_rowstride (src);
- target_pixels = gdk_pixbuf_get_pixels (dest);
- original_pixels = gdk_pixbuf_get_pixels (src);
-
- for (i = 0; i < height; i++) {
- pixdest = target_pixels + i * dest_row_stride;
- pixsrc = original_pixels + i * src_row_stride;
- for (j = 0; j < width; j++) {
- r = *pixsrc++;
- g = *pixsrc++;
- b = *pixsrc++;
- intensity = (r * 77 + g * 150 + b * 28) >> 8;
- negalpha = ((255 - saturation) * darken) >> 8;
- alpha = (saturation * darken) >> 8;
- *pixdest++ = (negalpha * intensity + alpha * r) >> 8;
- *pixdest++ = (negalpha * intensity + alpha * g) >> 8;
- *pixdest++ = (negalpha * intensity + alpha * b) >> 8;
- if (has_alpha) {
- *pixdest++ = *pixsrc++;
- }
- }
- }
- return dest;
-}
-
-/* this routine colorizes the passed-in pixbuf by multiplying each pixel with the passed in color */
-
-GdkPixbuf *
-nautilus_create_colorized_pixbuf (GdkPixbuf *src,
- int red_value,
- int green_value,
- int blue_value)
-{
- int i, j;
- int width, height, has_alpha, src_row_stride, dst_row_stride;
- guchar *target_pixels;
- guchar *original_pixels;
- guchar *pixsrc;
- guchar *pixdest;
- GdkPixbuf *dest;
-
- g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 3)
- || (gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 4), NULL);
- g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
-
- dest = create_new_pixbuf (src);
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- src_row_stride = gdk_pixbuf_get_rowstride (src);
- dst_row_stride = gdk_pixbuf_get_rowstride (dest);
- target_pixels = gdk_pixbuf_get_pixels (dest);
- original_pixels = gdk_pixbuf_get_pixels (src);
-
- for (i = 0; i < height; i++) {
- pixdest = target_pixels + i*dst_row_stride;
- pixsrc = original_pixels + i*src_row_stride;
- for (j = 0; j < width; j++) {
- *pixdest++ = (*pixsrc++ * red_value) >> 8;
- *pixdest++ = (*pixsrc++ * green_value) >> 8;
- *pixdest++ = (*pixsrc++ * blue_value) >> 8;
- if (has_alpha) {
- *pixdest++ = *pixsrc++;
- }
- }
- }
- return dest;
-}
-
-/* this routine takes the source pixbuf and returns a new one that's semi-transparent, by
- clearing every other pixel's alpha value in a checkerboard grip. We have to do the
- checkerboard instead of reducing the alpha since it will be turned into an alpha-less
- gdkpixmap and mask for the actual dragging */
-
-GdkPixbuf *
-nautilus_make_semi_transparent (GdkPixbuf *src)
-{
- gint i, j, temp_alpha;
- gint width, height, has_alpha, src_row_stride, dst_row_stride;
- guchar *target_pixels, *original_pixels;
- guchar *pixsrc, *pixdest;
- guchar alpha_value;
- GdkPixbuf *dest_pixbuf;
- guchar start_alpha_value;
-
- g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 3)
- || (gdk_pixbuf_get_has_alpha (src)
- && gdk_pixbuf_get_n_channels (src) == 4), NULL);
- g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
-
- dest_pixbuf = create_new_pixbuf (src);
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- src_row_stride = gdk_pixbuf_get_rowstride (src);
- dst_row_stride = gdk_pixbuf_get_rowstride (dest_pixbuf);
-
- /* set up pointers to the actual pixels */
- target_pixels = gdk_pixbuf_get_pixels (dest_pixbuf);
- original_pixels = gdk_pixbuf_get_pixels (src);
-
- /* loop through the pixels to do the actual work, copying from the source to the destination */
- start_alpha_value = ~0;
- for (i = 0; i < height; i++) {
- pixdest = target_pixels + i * dst_row_stride;
- pixsrc = original_pixels + i * src_row_stride;
- alpha_value = start_alpha_value;
- for (j = 0; j < width; j++) {
- *pixdest++ = *pixsrc++; /* red */
- *pixdest++ = *pixsrc++; /* green */
- *pixdest++ = *pixsrc++; /* blue */
-
- if (has_alpha) {
- temp_alpha = *pixsrc++;
- } else {
- temp_alpha = ~0;
- }
- *pixdest++ = temp_alpha & alpha_value;
-
- alpha_value = ~alpha_value;
- }
-
- start_alpha_value = ~start_alpha_value;
- }
-
- return dest_pixbuf;
-}
diff --git a/libnautilus/nautilus-graphic-effects.h b/libnautilus/nautilus-graphic-effects.h
deleted file mode 100644
index bae25a193..000000000
--- a/libnautilus/nautilus-graphic-effects.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-graphic-effects.h: Pixmap manipulation routines for graphical effects.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Andy Hertzfeld <andy@eazel.com>
- */
-
-#ifndef NAUTILUS_GRAPHIC_EFFECTS_H
-#define NAUTILUS_GRAPHIC_EFFECTS_H
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/* return a lightened pixbuf for pre-lighting */
-GdkPixbuf *nautilus_create_spotlight_pixbuf (GdkPixbuf *source_pixbuf);
-
-/* return a darkened pixbuf for selection hiliting */
-GdkPixbuf *nautilus_create_darkened_pixbuf (GdkPixbuf *source_pixbuf,
- int saturation,
- int darken);
-
-/* return a pixbuf colorized with the color specified by the parameters */
-GdkPixbuf* nautilus_create_colorized_pixbuf (GdkPixbuf *source_pixbuf,
- int red_value,
- int green_value,
- int blue_value);
-
-/* return a semi-transparent pixbuf from the source pixbuf using a checkboard
- stipple in the alpha channel (so it can be converted to an alpha-less pixmap) */
-GdkPixbuf *nautilus_make_semi_transparent (GdkPixbuf *source_pixbuf);
-
-#endif /* NAUTILUS_GRAPHIC_EFFECTS_H */
diff --git a/libnautilus/nautilus-gtk-extensions.c b/libnautilus/nautilus-gtk-extensions.c
deleted file mode 100644
index b89404644..000000000
--- a/libnautilus/nautilus-gtk-extensions.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gtk-extensions.c - implementation of new functions that operate on
- gtk classes. Perhaps some of these should be
- rolled into gtk someday.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-gtk-extensions.h"
-
-#include <gtk/gtkselection.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-geometry.h>
-#include "nautilus-glib-extensions.h"
-
-/**
- * nautilus_gtk_signal_connect_free_data:
- *
- * Attach a function pointer and user data to a signal, and free
- * the user data when the signal is disconnected.
- * @object: the object which emits the signal. For example, a button in the button press signal.
- * @name: the name of the signal.
- * @func: function pointer to attach to the signal.
- * @data: the user data associated with the function. g_free() will be called on
- * this user data when the signal is disconnected.
- **/
-guint nautilus_gtk_signal_connect_free_data (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer data)
-{
- return gtk_signal_connect_full (object,
- name,
- func,
- NULL, /* marshal */
- data,
- (GtkDestroyNotify)g_free,
- FALSE, /* is this an object signal? */
- FALSE); /* invoke func after signal? */
-}
-
-/**
- * nautilus_gtk_window_hide_retain_geometry:
- *
- * Hide a GtkWindow such that when reopened it will be in the same
- * place it is now.
- * @window: The GtkWindow to be hidden.
- **/
-static void
-nautilus_gtk_window_hide_retain_geometry (GtkWindow *window) {
- gchar *geometry_string;
- int left, top, width, height;
-
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- /* Save and restore position to keep it in same position when next shown. */
-
- geometry_string = gnome_geometry_string (GTK_WIDGET (window)->window);
-
- gtk_widget_hide (GTK_WIDGET (window));
-
- if (gnome_parse_geometry (geometry_string, &left, &top, &width, &height))
- {
- gtk_window_set_default_size (window, width, height);
- gtk_widget_set_uposition (GTK_WIDGET (window), left, top);
- }
-
- g_free (geometry_string);
-}
-
-/**
- * nautilus_gtk_window_present:
- *
- * Presents to the user a window that may be hidden, iconified, or buried.
- * @window: The GtkWindow to be presented to the user.
- **/
-void
-nautilus_gtk_window_present (GtkWindow *window) {
- g_assert (GTK_IS_WINDOW (window));
-
- /* Hide first if already showing, so it will reappear on top.
- * This works with iconified windows as well.
- */
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (window)))
- {
- nautilus_gtk_window_hide_retain_geometry (window);
- }
-
- gtk_widget_show (GTK_WIDGET (window));
-}
-
-/**
- * nautilus_gtk_selection_data_copy_deep:
- *
- * Copies a GtkSelectionData, and copies the data too.
- * @data: The GtkSelectionData to be copied.
- **/
-GtkSelectionData *
-nautilus_gtk_selection_data_copy_deep (const GtkSelectionData *data)
-{
- GtkSelectionData *copy;
-
- copy = g_new0 (GtkSelectionData, 1);
- gtk_selection_data_set (copy, data->type, data->format, data->data, data->length);
-
- return copy;
-}
-
-/**
- * nautilus_gtk_selection_data_free_deep:
- *
- * Frees a GtkSelectionData, and frees the data too.
- * @data: The GtkSelectionData to be freed.
- **/
-void
-nautilus_gtk_selection_data_free_deep (GtkSelectionData *data)
-{
- g_free (data->data);
- gtk_selection_data_free (data);
-}
-
-/**
- * nautilus_gtk_signal_connect_free_data:
- *
- * Function to displace the popup menu some, otherwise the first item
- * gets selected right away.
- * This function gets called by gtk_menu_popup ().
- *
- * @menu: the popup menu.
- * @x: x coord where gtk want to place the menu
- * @y: y coord where gtk want to place the menu
- * @user_data: something
- **/
-static void
-nautilus_popup_menu_position_func (GtkMenu *menu,
- int *x,
- int *y,
- gpointer user_data)
-{
- GdkPoint *offset;
-
- g_assert (x != NULL);
- g_assert (y != NULL);
-
- offset = (GdkPoint*) user_data;
-
- g_assert (offset != NULL);
-
- /*
- * XXX: Check for screen boundaries. Also, the cast from
- * gint16 might cause problems. Unfortunately, GdkPoint
- * uses gint16.
- */
- *x += (int) offset->x;
- *y += (int) offset->y;
-}
-
-/**
- * nautilus_pop_up_context_menu:
- *
- * Pop up a context menu under the mouse. This assumes that
- * a mouse down event just occurred, with the 3rd button pressed.
- * (Context menus only appear with the 3rd mouse button, by UI
- * convention.) The menu is sunk after use, so it will be destroyed
- * unless the caller first ref'ed it.
- *
- * This function is more of a helper function than a gtk extension,
- * so perhaps it belongs in a different file.
- *
- * @menu: The menu to pop up under the mouse.
- * @offset_x: Number of pixels to displace the popup menu vertically
- * @offset_y: Number of pixels to displace the popup menu horizontally
- **/
-void
-nautilus_pop_up_context_menu (GtkMenu *menu,
- gint16 offset_x,
- gint16 offset_y)
-{
- GdkPoint offset;
-
- g_return_if_fail (GTK_IS_MENU (menu));
-
- offset.x = offset_x;
- offset.y = offset_y;
-
- /* We pass current time here instead of extracting it from
- * the event, for API simplicity. This does not seem to make
- * any practical difference. See man XGrabPointer for details.
- */
- gtk_menu_popup (menu, /* menu */
- NULL, /* parent_menu_shell */
- NULL, /* parent_menu_item */
- nautilus_popup_menu_position_func, /* func */
- (gpointer) &offset, /* data */
- 3, /* button */
- GDK_CURRENT_TIME); /* activate_time */
-
- gtk_object_sink (GTK_OBJECT(menu));
-}
-
-
-void
-nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, int, int, double, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_DOUBLE (args[3]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_NONE__POINTER_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, gpointer, int, int, int, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, gpointer, gpointer, int, int, int, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, int, int, double, double, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_DOUBLE (args[3]),
- GTK_VALUE_DOUBLE (args[4]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, double, gpointer)) func)
- (object,
- GTK_VALUE_DOUBLE (args[0]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_STRING__NONE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- * GTK_RETLOC_POINTER (args[0]) =
- (* (char * (*)(GtkObject *, gpointer)) func)
- (object,
- func_data);
-}
-
-void
-nautilus_gtk_marshal_POINTER__POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- * GTK_RETLOC_POINTER (args[1]) =
- (* (gpointer (*)(GtkObject *, gpointer, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- * GTK_RETLOC_INT (args[2]) =
- (* (int (*)(GtkObject *, gpointer, gpointer, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_POINTER__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- * GTK_RETLOC_POINTER (args[2]) =
- (* (gpointer (*)(GtkObject *, gpointer, gpointer, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-void
-nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- * GTK_RETLOC_POINTER (args[3]) =
- (* (gpointer (*)(GtkObject *, gpointer, gpointer, gpointer, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-gboolean
-nautilus_point_in_allocation (const GtkAllocation *allocation,
- int x, int y)
-{
- g_return_val_if_fail (allocation != NULL, FALSE);
- return x >= allocation->x
- && y >= allocation->y
- && x < allocation->x + allocation->width
- && y < allocation->y + allocation->height;
-}
-
-gboolean
-nautilus_point_in_widget (GtkWidget *widget,
- int x, int y)
-{
- if (widget == NULL) {
- return FALSE;
- }
- g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- return nautilus_point_in_allocation (&widget->allocation, x, y);
-}
-
-/**
- * nautilus_gtk_object_list_ref
- *
- * Ref all the files in a list.
- * @list: GList of files.
- **/
-void
-nautilus_gtk_object_list_ref (GList *list)
-{
- g_list_foreach (list, (GFunc) gtk_object_ref, NULL);
-}
-
-/**
- * nautilus_gtk_object_list_unref
- *
- * Unref all the files in a list.
- * @list: GList of files.
- **/
-void
-nautilus_gtk_object_list_unref (GList *list)
-{
- nautilus_g_list_safe_for_each (list, (GFunc) gtk_object_unref, NULL);
-}
-
-/**
- * nautilus_gtk_object_list_free
- *
- * Free a list of files after unrefing them.
- * @list: GList of files.
- **/
-void
-nautilus_gtk_object_list_free (GList *list)
-{
- nautilus_gtk_object_list_unref (list);
- g_list_free (list);
-}
diff --git a/libnautilus/nautilus-gtk-extensions.h b/libnautilus/nautilus-gtk-extensions.h
deleted file mode 100644
index 61f1f5187..000000000
--- a/libnautilus/nautilus-gtk-extensions.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-gtk-extensions.h - interface for new functions that operate on
- gtk classes. Perhaps some of these should be
- rolled into gtk someday.
-
- Copyright (C) 1999, 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.
-
- Authors: John Sullivan <sullivan@eazel.com>
-*/
-
-#ifndef NAUTILUS_GTK_EXTENSIONS_H
-#define NAUTILUS_GTK_EXTENSIONS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtktypeutils.h>
-#include <gtk/gtkobject.h>
-
-#define nautilus_gtk_marshal_NONE__BOXED_BOXED gtk_marshal_NONE__POINTER_POINTER
-#define nautilus_gtk_marshal_STRING__POINTER nautilus_gtk_marshal_POINTER__POINTER
-#define nautilus_gtk_marshal_STRING__POINTER_POINTER nautilus_gtk_marshal_POINTER__POINTER_POINTER
-#define nautilus_gtk_marshal_STRING__POINTER_STRING nautilus_gtk_marshal_POINTER__POINTER_POINTER
-#define nautilus_gtk_marshal_STRING__POINTER_POINTER_POINTER nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER
-#define nautilus_gtk_marshal_STRING__POINTER_POINTER_STRING nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER
-#define nautilus_gtk_marshal_INT__POINTER_STRING nautilus_gtk_marshal_INT__POINTER_POINTER
-
-#define NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT 2
-
-/* signals */
-guint nautilus_gtk_signal_connect_free_data (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer data);
-
-/* list of GtkObject */
-void nautilus_gtk_object_list_ref (GList *list);
-void nautilus_gtk_object_list_unref (GList *list);
-void nautilus_gtk_object_list_free (GList *list);
-
-/* GtkWidget */
-gboolean nautilus_point_in_allocation (const GtkAllocation *allocation,
- int x,
- int y);
-gboolean nautilus_point_in_widget (GtkWidget *widget,
- int x,
- int y);
-
-/* GtkWindow */
-void nautilus_gtk_window_present (GtkWindow *window);
-
-/* selection data */
-GtkSelectionData *nautilus_gtk_selection_data_copy_deep (const GtkSelectionData *selection_data);
-void nautilus_gtk_selection_data_free_deep (GtkSelectionData *selection_data);
-
-/* GtkMenu */
-void nautilus_pop_up_context_menu (GtkMenu *menu,
- gint16 offset_x,
- gint16 offset_y);
-
-/* marshals */
-void nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_STRING__NONE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_NONE__POINTER_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_POINTER__POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_POINTER__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#endif /* NAUTILUS_GTK_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-gtk-macros.h b/libnautilus/nautilus-gtk-macros.h
deleted file mode 100644
index 863e1a11b..000000000
--- a/libnautilus/nautilus-gtk-macros.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-gtk-macros.h: Macros to reduce boilerplate when using GTK.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Darin Adler <darin@eazel.com>
- Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#ifndef NAUTILUS_GTK_MACROS_H
-#define NAUTILUS_GTK_MACROS_H
-
-/* Define a parent_class global and a get_type function for a GTK class.
- Since this is boilerplate, it's better not to repeat it over and over again.
- Called like this:
-
- NAUTILUS_DEFINE_CLASS_BOILERPLATE(NautilusBookmark, nautilus_bookmark, GTK_TYPE_OBJECT)
-
- The parent_class_type parameter is guaranteed to be evaluated only once
- so it can be an expression, even an expression that contains a function call.
-*/
-
-#define NAUTILUS_DEFINE_CLASS_BOILERPLATE(class_name, class_name_in_function_format, parent_class_type) \
-\
-static gpointer parent_class; \
-\
-GtkType \
-class_name_in_function_format##_get_type (void) \
-{ \
- GtkType parent_type; \
- static GtkType type; \
- \
- if (type == 0) { \
- static GtkTypeInfo info = { \
- #class_name, \
- sizeof (class_name), \
- sizeof (class_name##Class), \
- (GtkClassInitFunc)class_name_in_function_format##_initialize_class, \
- (GtkObjectInitFunc)class_name_in_function_format##_initialize, \
- NULL, \
- NULL, \
- NULL \
- }; \
- \
- parent_type = (parent_class_type); \
- type = gtk_type_unique (parent_type, &info); \
- parent_class = gtk_type_class (parent_type); \
- } \
- \
- return type; \
-}
-
-/* Call a parent class version of a signal.
- Nice because it documents what it's doing and there is less chance for
- a typo. Depends on the parent class pointer having the conventional
- name "parent_class".
-*/
-
-#define NAUTILUS_CALL_PARENT_CLASS(parent_class_cast_macro, signal, parameters) \
-\
-(parent_class_cast_macro (parent_class)->signal == NULL) \
- ? 0 \
- : ((* parent_class_cast_macro (parent_class)->signal) parameters)
-
-
-
-#ifndef G_DISABLE_ASSERT
-
-/* Define a signal that is not implemented by this class but must be
- * implemented by subclasses. This macro should be used inside the
- * class initialization function. The companion macro NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL
- * must be used earlier in the file. Called like this:
- *
- * NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL (klass,
- * fm_directory_view,
- * clear);
- */
-#define NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(class_pointer, class_name_in_function_format, signal) \
-\
-* (void (**)(void)) & (class_pointer)->signal = class_name_in_function_format##_unimplemented_##signal
-
-/* Provide a debug-only implementation of a signal that must be implemented
- * by subclasses. The debug-only implementation fires a warning if it is called.
- * This macro should be placed as if it were a function, earlier in the file
- * than the class initialization function. Called like this:
- *
- * NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, clear);
- */
-#define NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(class_name_in_function_format, signal) \
-\
-static void \
-class_name_in_function_format##_unimplemented_##signal (void) \
-{ \
- g_warning ("failed to override signal " #class_name_in_function_format "->" #signal); \
-}
-
-#else
-
-#define NAUTILUS_DEFINE_MUST_OVERRIDE_SIGNAL(class_cast_macro, class_pointer, class_name_in_function_format, signal)
-#define NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(class_name_in_function_format, signal)
-
-#endif /* G_DISABLE_ASSERT */
-
-
-/*
- * Access the class for a given object
- */
-#define NAUTILUS_KLASS(obj) \
-(GTK_OBJECT (obj)->klass)
-
-/*
- * Invoke a method for a given object
- */
-#define NAUTILUS_INVOKE_METHOD(obj, gtk_type, structure, method) \
-(*(GTK_CHECK_CLASS_CAST ((NAUTILUS_KLASS (obj)), gtk_type, structure)) -> method)
-
-/*
- * Access a method.
- */
-#define NAUTILUS_ACCESS_METHOD(obj, gtk_type, structure, method) \
-((GTK_CHECK_CLASS_CAST ((NAUTILUS_KLASS (obj)), gtk_type, structure)) -> method)
-
-/*
- * Assert the non-nullness of a method for a given object
- */
-#ifndef G_DISABLE_ASSERT
-#define NAUTILUS_ASSERT_METHOD(obj, gtk_type, structure, method) \
-g_assert (((GTK_CHECK_CLASS_CAST ((NAUTILUS_KLASS (obj)), gtk_type, structure)) -> method) != NULL)
-#else
-#define NAUTILUS_ASSERT_METHOD(obj, gtk_type, structure, method)
-#endif
-
-/*
- * Invoke a method if it aint null.
- */
-#define NAUTILUS_INVOKE_METHOD_IF(obj, gtk_type, structure, method) \
-if (NAUTILUS_ACCESS_METHOD (obj, gtk_type, structure, method)) \
- NAUTILUS_INVOKE_METHOD (obj, gtk_type, structure, method)
-
-#endif /* NAUTILUS_GTK_MACROS_H */
diff --git a/libnautilus/nautilus-icon-canvas-item.c b/libnautilus/nautilus-icon-canvas-item.c
deleted file mode 100644
index f11460b02..000000000
--- a/libnautilus/nautilus-icon-canvas-item.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* Nautilus - Icon canvas item class for icon container.
- *
- * Copyright (C) 2000 Eazel, Inc
- *
- * Author: Andy Hertzfeld <andy@eazel.com>
- *
- * This 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.
- *
- * This 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 this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include "nautilus-icon-canvas-item.h"
-
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-icon-text.h>
-#include "nautilus-icon-private.h"
-#include "nautilus-string.h"
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gdk-extensions.h"
-#include "nautilus-gdk-pixbuf-extensions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-gnome-extensions.h"
-#include "nautilus-graphic-effects.h"
-
-#define STRETCH_HANDLE_THICKNESS 5
-#define EMBLEM_SPACING 2
-#define MAX_TEXT_WIDTH 80
-
-/* Private part of the NautilusIconCanvasItem structure. */
-struct NautilusIconCanvasItemDetails {
- /* The image, text, font. */
- GdkPixbuf *pixbuf;
- GList *emblem_pixbufs;
- char *text;
- GdkFont *font;
- ArtIRect embedded_text_rect;
- char *embedded_text_file_URI;
-
- /* Size of the text at current font. */
- int text_width;
- int text_height;
-
- /* Highlight state. */
- guint is_highlighted_for_selection : 1;
- guint is_highlighted_as_keyboard_focus: 1;
- guint is_highlighted_for_drop : 1;
- guint show_stretch_handles : 1;
- guint is_prelit : 1;
-};
-
-/* Object argument IDs. */
-enum {
- ARG_0,
- ARG_TEXT,
- ARG_FONT,
- ARG_HIGHLIGHTED_FOR_SELECTION,
- ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS,
- ARG_HIGHLIGHTED_FOR_DROP,
- ARG_TEXT_SOURCE,
- ARG_MODIFIER
-};
-
-typedef enum {
- RIGHT_SIDE,
- BOTTOM_SIDE,
- LEFT_SIDE,
- TOP_SIDE
-} RectangleSide;
-
-typedef struct {
- NautilusIconCanvasItem *icon_item;
- ArtIRect icon_rect;
- RectangleSide side;
- int position;
- GList *emblem;
-} EmblemLayout;
-
-enum {
- BOUNDS_CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL];
-
-static GdkFont *embedded_text_font;
-
-/* GtkObject */
-static void nautilus_icon_canvas_item_initialize_class (NautilusIconCanvasItemClass *class);
-static void nautilus_icon_canvas_item_initialize (NautilusIconCanvasItem *item);
-static void nautilus_icon_canvas_item_destroy (GtkObject *object);
-static int nautilus_icon_canvas_item_event (GnomeCanvasItem *item,
- GdkEvent *event);
-static void nautilus_icon_canvas_item_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void nautilus_icon_canvas_item_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-/* GnomeCanvasItem */
-static void nautilus_icon_canvas_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path,
- int flags);
-static void nautilus_icon_canvas_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
- int x,
- int y,
- int width,
- int height);
-static double nautilus_icon_canvas_item_point (GnomeCanvasItem *item,
- double x,
- double y,
- int cx,
- int cy,
- GnomeCanvasItem **actual_item);
-static void nautilus_icon_canvas_item_bounds (GnomeCanvasItem *item,
- double *x1,
- double *y1,
- double *x2,
- double *y2);
-
-/* private */
-static void draw_or_measure_label_text (NautilusIconCanvasItem *item,
- GdkDrawable *drawable,
- int icon_left,
- int icon_bottom);
-static void draw_label_text (NautilusIconCanvasItem *item,
- GdkDrawable *drawable,
- int icon_left,
- int icon_bottom);
-static void measure_label_text (NautilusIconCanvasItem *item);
-static void get_icon_canvas_rectangle (NautilusIconCanvasItem *item,
- ArtIRect *rect);
-static void emblem_layout_reset (EmblemLayout *layout,
- NautilusIconCanvasItem *icon_item,
- const ArtIRect *icon_rect);
-static gboolean emblem_layout_next (EmblemLayout *layout,
- GdkPixbuf **emblem_pixbuf,
- ArtIRect *emblem_rect);
-static void draw_pixbuf (GdkPixbuf *pixbuf,
- GdkDrawable *drawable,
- int x,
- int y);
-static gboolean hit_test_stretch_handle (NautilusIconCanvasItem *item,
- const ArtIRect *canvas_rect);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconCanvasItem, nautilus_icon_canvas_item, GNOME_TYPE_CANVAS_ITEM)
-
-/* Class initialization function for the icon canvas item. */
-static void
-nautilus_icon_canvas_item_initialize_class (NautilusIconCanvasItemClass *class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- item_class = GNOME_CANVAS_ITEM_CLASS (class);
-
- gtk_object_add_arg_type ("NautilusIconCanvasItem::text",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT);
- gtk_object_add_arg_type ("NautilusIconCanvasItem::font",
- GTK_TYPE_BOXED, GTK_ARG_READWRITE, ARG_FONT);
- gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_for_selection",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_FOR_SELECTION);
- gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_as_keyboard_focus",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS);
- gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_for_drop",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_FOR_DROP);
- gtk_object_add_arg_type ("NautilusIconCanvasItem::text_source",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT_SOURCE);
-
- object_class->destroy = nautilus_icon_canvas_item_destroy;
- object_class->set_arg = nautilus_icon_canvas_item_set_arg;
- object_class->get_arg = nautilus_icon_canvas_item_get_arg;
-
- signals[BOUNDS_CHANGED]
- = gtk_signal_new ("bounds_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconCanvasItemClass,
- bounds_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-
- item_class->update = nautilus_icon_canvas_item_update;
- item_class->draw = nautilus_icon_canvas_item_draw;
- item_class->point = nautilus_icon_canvas_item_point;
- item_class->bounds = nautilus_icon_canvas_item_bounds;
- item_class->event = nautilus_icon_canvas_item_event;
-
- /* FIXME: the font shouldn't be hard-wired like this */
- embedded_text_font = gdk_font_load("-bitstream-charter-medium-r-normal-*-9-*-*-*-*-*-*-*");
-}
-
-/* Object initialization function for the icon item. */
-static void
-nautilus_icon_canvas_item_initialize (NautilusIconCanvasItem *icon_item)
-{
- NautilusIconCanvasItemDetails *details;
-
- details = g_new0 (NautilusIconCanvasItemDetails, 1);
-
- icon_item->details = details;
-}
-
-/* Destroy handler for the icon canvas item. */
-static void
-nautilus_icon_canvas_item_destroy (GtkObject *object)
-{
- GnomeCanvasItem *item;
- NautilusIconCanvasItem *icon_item;
- NautilusIconCanvasItemDetails *details;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (object));
-
- item = GNOME_CANVAS_ITEM (object);
- icon_item = (NAUTILUS_ICON_CANVAS_ITEM (object));
- details = icon_item->details;
-
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-
- if (details->pixbuf != NULL) {
- gdk_pixbuf_unref (details->pixbuf);
- }
- nautilus_gdk_pixbuf_list_free (details->emblem_pixbufs);
- g_free (details->text);
- if (details->font != NULL) {
- gdk_font_unref (details->font);
- }
-
- g_free (details->embedded_text_file_URI);
-
- g_free (details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-/* Currently we require pixbufs in this format (for hit testing).
- * Perhaps gdk-pixbuf will be changed so it can do the hit testing
- * and we won't have this requirement any more.
- */
-static gboolean
-pixbuf_is_acceptable (GdkPixbuf *pixbuf)
-{
- return gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB
- && ((!gdk_pixbuf_get_has_alpha (pixbuf)
- && gdk_pixbuf_get_n_channels (pixbuf) == 3)
- || (gdk_pixbuf_get_has_alpha (pixbuf)
- && gdk_pixbuf_get_n_channels (pixbuf) == 4))
- && gdk_pixbuf_get_bits_per_sample (pixbuf) == 8;
-}
-
-/* Set_arg handler for the icon item. */
-static void
-nautilus_icon_canvas_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- NautilusIconCanvasItemDetails *details;
- GdkFont *font;
-
- details = NAUTILUS_ICON_CANVAS_ITEM (object)->details;
-
- switch (arg_id) {
-
- case ARG_TEXT:
- if (nautilus_strcmp (details->text, GTK_VALUE_STRING (*arg)) == 0) {
- return;
- }
-
- g_free (details->text);
- details->text = g_strdup (GTK_VALUE_STRING (*arg));
- break;
-
- case ARG_FONT:
- font = GTK_VALUE_BOXED (*arg);
- if (nautilus_gdk_font_equal (font, details->font)) {
- return;
- }
-
- if (font != NULL) {
- gdk_font_ref (font);
- }
- if (details->font != NULL) {
- gdk_font_unref (details->font);
- }
- details->font = font;
- break;
-
- case ARG_HIGHLIGHTED_FOR_SELECTION:
- if (!details->is_highlighted_for_selection == !GTK_VALUE_BOOL (*arg)) {
- return;
- }
- details->is_highlighted_for_selection = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS:
- if (!details->is_highlighted_as_keyboard_focus == !GTK_VALUE_BOOL (*arg)) {
- return;
- }
- details->is_highlighted_as_keyboard_focus = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_HIGHLIGHTED_FOR_DROP:
- if (!details->is_highlighted_for_drop == !GTK_VALUE_BOOL (*arg)) {
- return;
- }
- details->is_highlighted_for_drop = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TEXT_SOURCE:
- if (nautilus_strcmp (details->embedded_text_file_URI, GTK_VALUE_STRING (*arg)) == 0) {
- return;
- }
-
- g_free (details->embedded_text_file_URI);
- details->embedded_text_file_URI = g_strdup (GTK_VALUE_STRING (*arg));
- break;
-
- default:
- g_warning ("nautilus_icons_view_item_item_set_arg on unknown argument");
- return;
- }
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (object));
-}
-
-/* Get_arg handler for the icon item */
-static void
-nautilus_icon_canvas_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- NautilusIconCanvasItemDetails *details;
-
- details = NAUTILUS_ICON_CANVAS_ITEM (object)->details;
-
- switch (arg_id) {
-
- case ARG_TEXT:
- GTK_VALUE_STRING (*arg) = g_strdup (details->text);
- break;
-
- case ARG_FONT:
- GTK_VALUE_BOXED (*arg) = details->font;
- break;
-
- case ARG_HIGHLIGHTED_FOR_SELECTION:
- GTK_VALUE_BOOL (*arg) = details->is_highlighted_for_selection;
- break;
-
- case ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS:
- GTK_VALUE_BOOL (*arg) = details->is_highlighted_as_keyboard_focus;
- break;
-
- case ARG_HIGHLIGHTED_FOR_DROP:
- GTK_VALUE_BOOL (*arg) = details->is_highlighted_for_drop;
- break;
-
- case ARG_TEXT_SOURCE:
- GTK_VALUE_STRING (*arg) = g_strdup (details->embedded_text_file_URI);
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GdkPixbuf *
-nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
- ArtIRect *embedded_text_rect)
-{
- NautilusIconCanvasItemDetails *details;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), NULL);
-
- details = item->details;
-
- if (embedded_text_rect != NULL) {
- *embedded_text_rect = details->embedded_text_rect;
- }
- return details->pixbuf;
-}
-
-void
-nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
- GdkPixbuf *image,
- const ArtIRect *embedded_text_rect)
-{
- NautilusIconCanvasItemDetails *details;
- ArtIRect empty_rect;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
- g_return_if_fail (image == NULL || pixbuf_is_acceptable (image));
-
- details = item->details;
-
- if (embedded_text_rect == NULL) {
- memset (&empty_rect, 0, sizeof (empty_rect));
- embedded_text_rect = &empty_rect;
- }
-
- if (details->pixbuf == image
- && memcmp (embedded_text_rect,
- &details->embedded_text_rect,
- sizeof (ArtIRect)) == 0) {
- return;
- }
-
- if (image != NULL) {
- gdk_pixbuf_ref (image);
- }
- if (details->pixbuf != NULL) {
- gdk_pixbuf_unref (details->pixbuf);
- }
-
- details->pixbuf = image;
- details->embedded_text_rect = *embedded_text_rect;
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item));
-}
-
-void
-nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
- GList *emblem_pixbufs)
-{
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
-
- g_assert (item->details->emblem_pixbufs != emblem_pixbufs || emblem_pixbufs == NULL);
-
- /* The case where the emblems are identical is fairly common,
- * so lets take the time to check for it.
- */
- if (nautilus_g_list_equal (item->details->emblem_pixbufs, emblem_pixbufs)) {
- return;
- }
-
- /* Check if they are acceptable. */
- for (p = emblem_pixbufs; p != NULL; p = p->next) {
- g_return_if_fail (pixbuf_is_acceptable (p->data));
- }
-
- /* Take in the new list of emblems. */
- nautilus_gdk_pixbuf_list_ref (emblem_pixbufs);
- nautilus_gdk_pixbuf_list_free (item->details->emblem_pixbufs);
- item->details->emblem_pixbufs = g_list_copy (emblem_pixbufs);
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item));
-}
-
-/* Recomputes the bounding box of a icon canvas item.
- * This is a generic implementation that could be used for any canvas item
- * class, it has no assumptions about how the item is used.
- */
-static void
-recompute_bounding_box (NautilusIconCanvasItem *icon_item)
-{
- /* The bounds stored in the item is the same as what get_bounds
- * returns, except it's in canvas coordinates instead of the item's
- * parent's coordinates.
- */
-
- GnomeCanvasItem *item;
- ArtPoint top_left, bottom_right;
- double i2c[6];
-
- item = GNOME_CANVAS_ITEM (icon_item);
-
- gnome_canvas_item_get_bounds (item,
- &top_left.x, &top_left.y,
- &bottom_right.x, &bottom_right.y);
-
- gnome_canvas_item_i2c_affine (item->parent, i2c);
-
- art_affine_point (&top_left, &top_left, i2c);
- art_affine_point (&bottom_right, &bottom_right, i2c);
-
- item->x1 = top_left.x;
- item->y1 = top_left.y;
- item->x2 = bottom_right.x;
- item->y2 = bottom_right.y;
-}
-
-void
-nautilus_icon_canvas_item_update_bounds (NautilusIconCanvasItem *item)
-{
- ArtIRect before, after;
-
- /* Compute new bounds. */
- nautilus_gnome_canvas_item_get_current_canvas_bounds
- (GNOME_CANVAS_ITEM (item), &before);
- recompute_bounding_box (item);
- nautilus_gnome_canvas_item_get_current_canvas_bounds
- (GNOME_CANVAS_ITEM (item), &after);
-
- /* If the bounds didn't change, we are done. */
- if (nautilus_art_irect_equal (&before, &after)) {
- return;
- }
-
- /* Send out the bounds_changed signal and queue a redraw. */
- nautilus_gnome_canvas_request_redraw_rectangle
- (GNOME_CANVAS_ITEM (item)->canvas, &before);
- gtk_signal_emit (GTK_OBJECT (item),
- signals[BOUNDS_CHANGED]);
- nautilus_gnome_canvas_item_request_redraw
- (GNOME_CANVAS_ITEM (item));
-}
-
-/* Update handler for the icon canvas item. */
-static void
-nautilus_icon_canvas_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path,
- int flags)
-{
- nautilus_icon_canvas_item_update_bounds (NAUTILUS_ICON_CANVAS_ITEM (item));
- nautilus_gnome_canvas_item_request_redraw (item);
- NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, update, (item, affine, clip_path, flags));
-}
-
-/* Rendering */
-
-/* routine to underline the text in a gnome_icon_text structure */
-
-static void
-gnome_icon_underline_text (GnomeIconTextInfo *text_info, GdkDrawable *drawable, GdkGC *gc, gint x, gint y)
-{
- GList *item;
- gint text_width;
- GnomeIconTextInfoRow *row;
- int xpos;
-
- y += text_info->font->ascent;
-
- for (item = text_info->rows; item; item = item->next) {
- if (item->data) {
- row = item->data;
- xpos = (text_info->width - row->width) / 2;
- text_width = gdk_text_width_wc(text_info->font, row->text_wc, row->text_length);
- gdk_draw_line(drawable, gc, x + xpos, y + 1, x + xpos + text_width, y + 1);
-
- y += text_info->baseline_skip;
- } else
- y += text_info->baseline_skip / 2;
- }
-}
-
-/* Draw the text in a box, using gnomelib routines. */
-static void
-draw_or_measure_label_text (NautilusIconCanvasItem *item,
- GdkDrawable *drawable,
- int icon_left,
- int icon_bottom)
-{
- NautilusIconCanvasItemDetails *details;
- int width_so_far, height_so_far;
- GdkGC* gc;
- int max_text_width;
- int icon_width, text_left, box_left;
- GnomeIconTextInfo *icon_text_info;
- char **pieces;
- const char *text_piece;
- int i;
-
- details = item->details;
-
- if (details->font == NULL || details->text == NULL || details->text[0] == '\0') {
- details->text_height = 0;
- details->text_width = 0;
- return;
- }
-
- width_so_far = 0;
- height_so_far = 0;
-
- if (drawable != NULL) {
- icon_width = details->pixbuf == NULL ? 0 : gdk_pixbuf_get_width (details->pixbuf);
- gc = gdk_gc_new (GNOME_CANVAS_ITEM (item)->canvas->layout.bin_window);
- }
-
- max_text_width = floor (MAX_TEXT_WIDTH * GNOME_CANVAS_ITEM (item)->canvas->pixels_per_unit);
-
- pieces = g_strsplit (details->text, "\n", 0);
- for (i = 0; (text_piece = pieces[i]) != NULL; i++) {
- /* Replace empty string with space for measurement and drawing.
- * This makes empty lines appear, instead of being collapsed out.
- */
- if (text_piece[0] == '\0') {
- text_piece = " ";
- }
-
- icon_text_info = gnome_icon_layout_text
- (details->font, text_piece, " -_,;.?/&", max_text_width, TRUE);
-
- if (drawable != NULL) {
- text_left = icon_left + (icon_width - icon_text_info->width) / 2;
- gnome_icon_paint_text (icon_text_info, drawable, gc,
- text_left, icon_bottom + height_so_far, GTK_JUSTIFY_CENTER);
-
- /* if it's selected, embolden the text by drawing again offset by one pixel */
- if (details->is_highlighted_for_selection || details->is_highlighted_for_drop)
- gnome_icon_paint_text (icon_text_info, drawable, gc,
- text_left + 1, icon_bottom + height_so_far, GTK_JUSTIFY_CENTER);
- /* if it's prelit, underline the text */
- if (details->is_prelit)
- gnome_icon_underline_text (icon_text_info, drawable, gc, text_left + 1, icon_bottom + height_so_far);
- }
-
- width_so_far = MAX (width_so_far, icon_text_info->width);
- height_so_far += icon_text_info->height;
-
- gnome_icon_text_info_free (icon_text_info);
- }
- g_strfreev (pieces);
-
- height_so_far += 2; /* extra slop for nicer highlighting */
-
- if (drawable != NULL) {
-
- /* Current calculations should match what we measured before drawing.
- * This assumes that we will always make a separate call to measure
- * before the call to draw. We might later decide to use this function
- * differently and change these asserts.
- */
- g_assert (height_so_far == details->text_height);
- g_assert (width_so_far == details->text_width);
-
- box_left = icon_left + (icon_width - width_so_far) / 2;
-
- /* indicate keyboard selection by framing the text with a gray-stippled rectangle */
- if (details->is_highlighted_as_keyboard_focus) {
- gdk_gc_set_stipple (gc, nautilus_stipple_bitmap ());
- gdk_gc_set_fill (gc, GDK_STIPPLED);
- gdk_draw_rectangle (drawable, gc, FALSE,
- box_left, icon_bottom - 2,
- width_so_far, 2 + height_so_far);
- }
-
- gdk_gc_unref (gc);
- }
- else
- {
- /* If measuring, remember the width & height. */
- details->text_width = width_so_far;
- details->text_height = height_so_far;
- }
-}
-
-static void
-measure_label_text (NautilusIconCanvasItem *item)
-{
- draw_or_measure_label_text (item, NULL, 0, 0);
-}
-
-static void
-draw_label_text (NautilusIconCanvasItem *item, GdkDrawable *drawable,
- int icon_left, int icon_bottom)
-{
- draw_or_measure_label_text (item, drawable, icon_left, icon_bottom);
-}
-
-/* utility routine to draw the mini-text inside text files */
-/* FIXME: We should cache the text in the object instead
- * of reading each time we draw, so we can work well over the network.
- */
-/* FIXME: The text reading does not belong here at all, but rather in the caller. */
-
-static void
-nautilus_art_irect_to_gdk_rectangle (GdkRectangle *destination,
- const ArtIRect *source)
-{
- destination->x = source->x0;
- destination->y = source->y0;
- destination->width = source->x1 - source->x0;
- destination->height = source->y1 - source->y0;
-}
-
-static void
-draw_embedded_text (GnomeCanvasItem* item,
- GdkDrawable *drawable,
- const ArtIRect *icon_rect)
-{
- FILE *text_file;
- char *file_name;
- GdkRectangle clip_rect;
- NautilusIconCanvasItem *icon_item;
- NautilusIconCanvasItemDetails *details;
- char line_buffer[256];
- int cur_y;
- GdkGC *gc;
- ArtIRect text_rect;
-
- icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
- details = icon_item->details;
-
- /* Draw the first few lines of the text file until we fill up the icon */
- /* FIXME: need to use gnome_vfs to read the file */
-
- file_name = details->embedded_text_file_URI;
- if (file_name == NULL) {
- return;
- }
-
- text_rect.x0 = icon_rect->x0 + details->embedded_text_rect.x0;
- text_rect.y0 = icon_rect->y0 + details->embedded_text_rect.y0;
- text_rect.x1 = icon_rect->x0 + details->embedded_text_rect.x1;
- text_rect.y1 = icon_rect->y0 + details->embedded_text_rect.y1;
- art_irect_intersect (&text_rect, &text_rect, icon_rect);
-
- if (art_irect_empty (&text_rect)) {
- return;
- }
-
- if (nautilus_str_has_prefix (file_name, "file://")) {
- file_name += 7;
- }
- text_file = fopen(file_name, "r");
- if (text_file == NULL) {
- return;
- }
-
- gc = gdk_gc_new (drawable);
-
- /* clip to the text bounds */
- nautilus_art_irect_to_gdk_rectangle (&clip_rect, &text_rect);
- gdk_gc_set_clip_rectangle (gc, &clip_rect);
-
- cur_y = text_rect.y0 + embedded_text_font->ascent;
- while (fgets (line_buffer, sizeof (line_buffer), text_file)) {
- if (cur_y + embedded_text_font->descent > text_rect.y1) {
- break;
- }
- gdk_draw_string (drawable,
- embedded_text_font,
- gc,
- text_rect.x0,
- cur_y,
- line_buffer);
- cur_y += embedded_text_font->descent + embedded_text_font->ascent;
- }
-
- gdk_gc_unref(gc);
-
- fclose (text_file);
-}
-
-static void
-draw_stretch_handles (NautilusIconCanvasItem *item, GdkDrawable *drawable,
- const ArtIRect *rect)
-{
- GdkGC *gc;
-
- if (!item->details->show_stretch_handles) {
- return;
- }
-
- gc = gdk_gc_new (drawable);
-
- gdk_draw_rectangle (drawable, gc, TRUE,
- rect->x0,
- rect->y0,
- STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS);
- gdk_draw_rectangle (drawable, gc, TRUE,
- rect->x1 - STRETCH_HANDLE_THICKNESS,
- rect->y0,
- STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS);
- gdk_draw_rectangle (drawable, gc, TRUE,
- rect->x0,
- rect->y1 - STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS);
- gdk_draw_rectangle (drawable, gc, TRUE,
- rect->x1 - STRETCH_HANDLE_THICKNESS,
- rect->y1 - STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS,
- STRETCH_HANDLE_THICKNESS);
-
- gdk_gc_set_stipple (gc, nautilus_stipple_bitmap ());
- gdk_gc_set_fill (gc, GDK_STIPPLED);
- gdk_draw_rectangle (drawable, gc, FALSE,
- rect->x0 + (STRETCH_HANDLE_THICKNESS - 1) / 2,
- rect->y0 + (STRETCH_HANDLE_THICKNESS - 1) / 2,
- rect->x1 - rect->x0 - (STRETCH_HANDLE_THICKNESS - 1) - 1,
- rect->y1 - rect->y0 - (STRETCH_HANDLE_THICKNESS - 1) - 1);
-
- gdk_gc_unref (gc);
-}
-
-static void
-emblem_layout_reset (EmblemLayout *layout, NautilusIconCanvasItem *icon_item, const ArtIRect *icon_rect)
-{
- layout->icon_item = icon_item;
- layout->icon_rect = *icon_rect;
- layout->side = RIGHT_SIDE;
- layout->position = 0;
- layout->emblem = icon_item->details->emblem_pixbufs;
-}
-
-static gboolean
-emblem_layout_next (EmblemLayout *layout,
- GdkPixbuf **emblem_pixbuf,
- ArtIRect *emblem_rect)
-{
- GdkPixbuf *pixbuf;
- int width, height, x, y;
-
- /* Check if we have layed out all of the pixbufs. */
- if (layout->emblem == NULL) {
- return FALSE;
- }
-
- /* Get the pixbuf. */
- pixbuf = layout->emblem->data;
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- /* Advance to the next emblem. */
- layout->emblem = layout->emblem->next;
-
- for (;;) {
-
- /* Find the side to lay out along. */
- switch (layout->side) {
- case RIGHT_SIDE:
- x = layout->icon_rect.x1;
- y = layout->icon_rect.y0;
- break;
- case BOTTOM_SIDE:
- x = layout->icon_rect.x1;
- y = layout->icon_rect.y1;
- break;
- case LEFT_SIDE:
- x = layout->icon_rect.x0;
- y = layout->icon_rect.y1;
- break;
- case TOP_SIDE:
- x = layout->icon_rect.x0;
- y = layout->icon_rect.y0;
- break;
- }
- if (layout->position != 0) {
- switch (layout->side) {
- case RIGHT_SIDE:
- y += layout->position + height / 2;
- break;
- case BOTTOM_SIDE:
- x -= layout->position + width / 2;
- break;
- case LEFT_SIDE:
- y -= layout->position + height / 2;
- break;
- case TOP_SIDE:
- x += layout->position + width / 2;
- break;
- }
- }
-
- /* Check to see if emblem fits in current side. */
- if (x >= layout->icon_rect.x0 && x <= layout->icon_rect.x1
- && y >= layout->icon_rect.y0 && y <= layout->icon_rect.y1) {
-
- /* It fits. */
-
- /* Advance along the side. */
- switch (layout->side) {
- case RIGHT_SIDE:
- case LEFT_SIDE:
- layout->position += height + EMBLEM_SPACING;
- break;
- case BOTTOM_SIDE:
- case TOP_SIDE:
- layout->position += width + EMBLEM_SPACING;
- break;
- }
-
- /* Return the rectangle and pixbuf. */
- *emblem_pixbuf = pixbuf;
- emblem_rect->x0 = x - width / 2;
- emblem_rect->y0 = y - height / 2;
- emblem_rect->x1 = emblem_rect->x0 + width;
- emblem_rect->y1 = emblem_rect->y0 + height;
-
- return TRUE;
- }
-
- /* It doesn't fit, so move to the next side. */
- switch (layout->side) {
- case RIGHT_SIDE:
- layout->side = BOTTOM_SIDE;
- break;
- case BOTTOM_SIDE:
- layout->side = LEFT_SIDE;
- break;
- case LEFT_SIDE:
- layout->side = TOP_SIDE;
- break;
- case TOP_SIDE:
- default:
- return FALSE;
- }
- layout->position = 0;
- }
-}
-
-static void
-draw_pixbuf (GdkPixbuf *pixbuf, GdkDrawable *drawable, int x, int y)
-{
- /* FIXME: Dither would be better if we passed dither values. */
- gdk_pixbuf_render_to_drawable_alpha (pixbuf, drawable, 0, 0, x, y,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- GDK_PIXBUF_ALPHA_BILEVEL, 128, GDK_RGB_DITHER_MAX,
- 0, 0);
-
-}
-
-/* Draw the icon item. */
-static void
-nautilus_icon_canvas_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height)
-{
- NautilusIconCanvasItem *icon_item;
- NautilusIconCanvasItemDetails *details;
- ArtIRect icon_rect, emblem_rect;
- EmblemLayout emblem_layout;
- GdkPixbuf *emblem_pixbuf, *temp_pixbuf, *old_pixbuf;
-
- icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
- details = icon_item->details;
-
- /* Draw the pixbuf. */
- if (details->pixbuf == NULL) {
- return;
- }
-
- /* Compute icon rectangle in drawable coordinates. */
- get_icon_canvas_rectangle (icon_item, &icon_rect);
- icon_rect.x0 -= x;
- icon_rect.y0 -= y;
- icon_rect.x1 -= x;
- icon_rect.y1 -= y;
-
- /* if the pre-lit or selection flag is set, make a pre-lit or darkened pixbuf and draw that instead */
-
- temp_pixbuf = details->pixbuf;
-
- if (details->is_prelit) {
- temp_pixbuf = nautilus_create_spotlight_pixbuf (details->pixbuf);
- }
-
- if (details->is_highlighted_for_selection || details->is_highlighted_for_drop) {
- old_pixbuf = temp_pixbuf;
- temp_pixbuf = nautilus_create_darkened_pixbuf (temp_pixbuf,
- 0.8 * 255,
- 0.8 * 255);
- if (old_pixbuf != details->pixbuf) {
- gdk_pixbuf_unref (old_pixbuf);
- }
- }
-
- draw_pixbuf (temp_pixbuf, drawable, icon_rect.x0, icon_rect.y0);
- if (temp_pixbuf != details->pixbuf) {
- gdk_pixbuf_unref (temp_pixbuf);
- }
-
- /* Draw the emblem pixbufs. */
- emblem_layout_reset (&emblem_layout, icon_item, &icon_rect);
- while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect)) {
- draw_pixbuf (emblem_pixbuf, drawable, emblem_rect.x0, emblem_rect.y0);
- }
-
- /* Draw stretching handles (if necessary). */
- draw_stretch_handles (icon_item, drawable, &icon_rect);
-
- /* Draw embedded text (if necessary) */
- draw_embedded_text (item, drawable, &icon_rect);
-
- /* Draw the label text. */
- draw_label_text (icon_item, drawable, icon_rect.x0, icon_rect.y1);
-}
-
-/* handle events */
-
-static int
-nautilus_icon_canvas_item_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- NautilusIconCanvasItem *icon_item;
-
- icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- if (!icon_item->details->is_prelit) {
- icon_item->details->is_prelit = TRUE;
- gnome_canvas_item_request_update (item);
- }
- return TRUE;
-
- case GDK_LEAVE_NOTIFY:
- if (icon_item->details->is_prelit
- || icon_item->details->is_highlighted_for_drop) {
- /* When leaving, turn of the prelight state and the
- * higlighted for drop. The latter gets turned on
- * by the drag&drop motion callback.
- */
- icon_item->details->is_prelit = FALSE;
- icon_item->details->is_highlighted_for_drop = FALSE;
- gnome_canvas_item_request_update (item);
- }
- return TRUE;
-
- default:
- /* Don't eat up other events; icon container might use them. */
- return FALSE;
- }
-}
-
-static void
-compute_text_rectangle (NautilusIconCanvasItem *item, const ArtIRect *icon_rect, ArtIRect *text_rect)
-{
- /* Compute text rectangle. */
- text_rect->x0 = (icon_rect->x0 + icon_rect->x1) / 2 - item->details->text_width / 2;
- text_rect->y0 = icon_rect->y1;
- text_rect->x1 = text_rect->x0 + item->details->text_width;
- text_rect->y1 = text_rect->y0 + item->details->text_height;
-}
-
-static gboolean
-hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIRect *probe_rect)
-{
- ArtIRect relative_rect, pixbuf_rect;
- int x, y;
- guint8 *pixel;
-
- /* You can get here without a pixbuf in some strange cases. */
- if (pixbuf == NULL) {
- return FALSE;
- }
-
- /* Check to see if it's within the rectangle at all. */
- relative_rect.x0 = probe_rect->x0 - pixbuf_location->x0;
- relative_rect.y0 = probe_rect->y0 - pixbuf_location->y0;
- relative_rect.x1 = probe_rect->x1 - pixbuf_location->x0;
- relative_rect.y1 = probe_rect->y1 - pixbuf_location->y0;
- pixbuf_rect.x0 = 0;
- pixbuf_rect.y0 = 0;
- pixbuf_rect.x1 = gdk_pixbuf_get_width (pixbuf);
- pixbuf_rect.y1 = gdk_pixbuf_get_height (pixbuf);
- art_irect_intersect (&relative_rect, &relative_rect, &pixbuf_rect);
- if (art_irect_empty (&relative_rect)) {
- return FALSE;
- }
-
- /* If there's no alpha channel, it's opaque and we have a hit. */
- if (!gdk_pixbuf_get_has_alpha (pixbuf)) {
- return TRUE;
- }
- g_assert (gdk_pixbuf_get_n_channels (pixbuf) == 4);
-
- /* Check the alpha channel of the pixel to see if we have a hit. */
- for (x = relative_rect.x0; x < relative_rect.x1; x++) {
- for (y = relative_rect.y0; y < relative_rect.y1; y++) {
- pixel = gdk_pixbuf_get_pixels (pixbuf)
- + y * gdk_pixbuf_get_rowstride (pixbuf)
- + x * 4;
- if (pixel[3] >= 128) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-static gboolean
-hit_test (NautilusIconCanvasItem *icon_item, const ArtIRect *canvas_rect)
-{
- NautilusIconCanvasItemDetails *details;
- ArtIRect icon_rect, text_rect, emblem_rect;
- EmblemLayout emblem_layout;
- GdkPixbuf *emblem_pixbuf;
-
- details = icon_item->details;
-
- /* Check for hits in the stretch handles. */
- if (hit_test_stretch_handle (icon_item, canvas_rect)) {
- return TRUE;
- }
-
- /* Check for hit in the icon. */
- get_icon_canvas_rectangle (icon_item, &icon_rect);
- if (hit_test_pixbuf (details->pixbuf, &icon_rect, canvas_rect)) {
- return TRUE;
- }
-
- /* Check for hit in the text. */
- compute_text_rectangle (icon_item, &icon_rect, &text_rect);
- if (nautilus_art_irect_hits_irect (&text_rect, canvas_rect)) {
- return TRUE;
- }
-
- /* Check for hit in the emblem pixbufs. */
- emblem_layout_reset (&emblem_layout, icon_item, &icon_rect);
- while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect)) {
- if (hit_test_pixbuf (emblem_pixbuf, &emblem_rect, canvas_rect)) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* Point handler for the icon canvas item. */
-static double
-nautilus_icon_canvas_item_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- ArtIRect canvas_rect;
-
- *actual_item = item;
- canvas_rect.x0 = cx;
- canvas_rect.y0 = cy;
- canvas_rect.x1 = cx + 1;
- canvas_rect.y1 = cy + 1;
- if (hit_test (NAUTILUS_ICON_CANVAS_ITEM (item), &canvas_rect)) {
- return 0.0;
- } else {
- /* This value means not hit.
- * It's kind of arbitrary. Can we do better?
- */
- return item->canvas->pixels_per_unit * 2 + 10;
- }
-}
-
-/* Bounds handler for the icon canvas item. */
-static void
-nautilus_icon_canvas_item_bounds (GnomeCanvasItem *item,
- double *x1, double *y1, double *x2, double *y2)
-{
- NautilusIconCanvasItem *icon_item;
- NautilusIconCanvasItemDetails *details;
- ArtIRect icon_rect, text_rect, total_rect, emblem_rect;
- double pixels_per_unit;
- EmblemLayout emblem_layout;
- GdkPixbuf *emblem_pixbuf;
-
- g_assert (x1 != NULL);
- g_assert (y1 != NULL);
- g_assert (x2 != NULL);
- g_assert (y2 != NULL);
-
- icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
- details = icon_item->details;
-
- measure_label_text (icon_item);
-
- /* Compute icon rectangle. */
- icon_rect.x0 = 0;
- icon_rect.y0 = 0;
- if (details->pixbuf == NULL) {
- icon_rect.x1 = 0;
- icon_rect.y1 = 0;
- } else {
- icon_rect.x1 = gdk_pixbuf_get_width (details->pixbuf);
- icon_rect.y1 = gdk_pixbuf_get_height (details->pixbuf);
- }
-
- /* Compute text rectangle. */
- compute_text_rectangle (icon_item, &icon_rect, &text_rect);
-
- /* Compute total rectangle, adding in emblem rectangles. */
- art_irect_union (&total_rect, &icon_rect, &text_rect);
- emblem_layout_reset (&emblem_layout, icon_item, &icon_rect);
- while (emblem_layout_next (&emblem_layout, &emblem_pixbuf, &emblem_rect)) {
- art_irect_union (&total_rect, &total_rect, &emblem_rect);
- }
-
- /* Add 2 pixels slop to each side. */
- total_rect.x0 -= 2;
- total_rect.x1 += 2;
- total_rect.y0 -= 2;
- total_rect.y1 += 2;
-
- /* Return the result. */
- pixels_per_unit = item->canvas->pixels_per_unit;
- *x1 = total_rect.x0 / pixels_per_unit;
- *y1 = total_rect.y0 / pixels_per_unit;
- *x2 = total_rect.x1 / pixels_per_unit;
- *y2 = total_rect.y1 / pixels_per_unit;
-}
-
-/* Get the rectangle of the icon only, in world coordinates. */
-void
-nautilus_icon_canvas_item_get_icon_rectangle (NautilusIconCanvasItem *item,
- ArtDRect *rect)
-{
- double i2w[6];
- ArtPoint art_point;
- double pixels_per_unit;
- GdkPixbuf *pixbuf;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
- g_return_if_fail (rect != NULL);
-
- gnome_canvas_item_i2w_affine (GNOME_CANVAS_ITEM (item), i2w);
-
- art_point.x = 0;
- art_point.y = 0;
- art_affine_point (&art_point, &art_point, i2w);
-
- rect->x0 = art_point.x;
- rect->y0 = art_point.y;
-
- pixbuf = item->details->pixbuf;
- pixels_per_unit = GNOME_CANVAS_ITEM (item)->canvas->pixels_per_unit;
-
- rect->x1 = rect->x0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_width (pixbuf)) / pixels_per_unit;
- rect->y1 = rect->y0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_height (pixbuf)) / pixels_per_unit;
-}
-
-/* Get the rectangle of the icon only, in canvas coordinates. */
-void
-get_icon_canvas_rectangle (NautilusIconCanvasItem *item,
- ArtIRect *rect)
-{
- double i2c[6];
- ArtPoint art_point;
- GdkPixbuf *pixbuf;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
- g_return_if_fail (rect != NULL);
-
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (item), i2c);
-
- art_point.x = 0;
- art_point.y = 0;
- art_affine_point (&art_point, &art_point, i2c);
-
- rect->x0 = floor (art_point.x);
- rect->y0 = floor (art_point.y);
-
- pixbuf = item->details->pixbuf;
-
- rect->x1 = rect->x0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_width (pixbuf));
- rect->y1 = rect->y0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_height (pixbuf));
-}
-
-void
-nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
- gboolean show_stretch_handles)
-{
- g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
- g_return_if_fail (show_stretch_handles == FALSE || show_stretch_handles == TRUE);
-
- if (!item->details->show_stretch_handles == !show_stretch_handles) {
- return;
- }
-
- item->details->show_stretch_handles = show_stretch_handles;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item));
-}
-
-/* Check if one of the stretch handles was hit. */
-static gboolean
-hit_test_stretch_handle (NautilusIconCanvasItem *item,
- const ArtIRect *probe_canvas_rect)
-{
- ArtIRect icon_rect;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), FALSE);
-
- /* Make sure there are handles to hit. */
- if (!item->details->show_stretch_handles) {
- return FALSE;
- }
-
- /* Quick check to see if the rect hits the icon at all. */
- get_icon_canvas_rectangle (item, &icon_rect);
- if (!nautilus_art_irect_hits_irect (probe_canvas_rect, &icon_rect)) {
- return FALSE;
- }
-
- /* Check for hits in the stretch handles. */
- return (probe_canvas_rect->x0 < icon_rect.x0 + STRETCH_HANDLE_THICKNESS
- || probe_canvas_rect->x1 >= icon_rect.x1 - STRETCH_HANDLE_THICKNESS)
- && (probe_canvas_rect->y0 < icon_rect.y0 + STRETCH_HANDLE_THICKNESS
- || probe_canvas_rect->y1 >= icon_rect.y1 - STRETCH_HANDLE_THICKNESS);
-}
-
-gboolean
-nautilus_icon_canvas_item_hit_test_stretch_handles (NautilusIconCanvasItem *item,
- const ArtPoint *world_point)
-{
- ArtIRect canvas_rect;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), FALSE);
- g_return_val_if_fail (world_point != NULL, FALSE);
-
- gnome_canvas_w2c (GNOME_CANVAS_ITEM (item)->canvas,
- world_point->x,
- world_point->y,
- &canvas_rect.x0,
- &canvas_rect.y0);
- canvas_rect.x1 = canvas_rect.x0 + 1;
- canvas_rect.y1 = canvas_rect.y0 + 1;
- return hit_test_stretch_handle (item, &canvas_rect);
-}
-
-gboolean
-nautilus_icon_canvas_item_hit_test_rectangle (NautilusIconCanvasItem *item,
- const ArtDRect *world_rect)
-{
- ArtIRect canvas_rect;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), FALSE);
- g_return_val_if_fail (world_rect != NULL, FALSE);
-
- nautilus_gnome_canvas_world_to_canvas_rectangle
- (GNOME_CANVAS_ITEM (item)->canvas, world_rect, &canvas_rect);
- return hit_test (item, &canvas_rect);
-}
diff --git a/libnautilus/nautilus-icon-canvas-item.h b/libnautilus/nautilus-icon-canvas-item.h
deleted file mode 100644
index 2bf6627d5..000000000
--- a/libnautilus/nautilus-icon-canvas-item.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* Nautilus - Icon canvas item class for icon container.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Andy Hertzfeld <andy@eazel.com>
- *
- * This 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.
- *
- * This 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 this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef NAUTILUS_ICON_CANVAS_ITEM_H
-#define NAUTILUS_ICON_CANVAS_ITEM_H
-
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-BEGIN_GNOME_DECLS
-
-#define NAUTILUS_TYPE_ICON_CANVAS_ITEM \
- (nautilus_icon_canvas_item_get_type ())
-#define NAUTILUS_ICON_CANVAS_ITEM(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ICON_CANVAS_ITEM, NautilusIconCanvasItem))
-#define NAUTILUS_ICON_CANVAS_ITEM_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ICON_CANVAS_ITEM, NautilusIconCanvasItemClass))
-#define NAUTILUS_IS_ICON_CANVAS_ITEM(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ICON_CANVAS_ITEM))
-#define NAUTILUS_IS_ICON_CANVAS_ITEM_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ICON_CANVAS_ITEM))
-
-typedef struct NautilusIconCanvasItem NautilusIconCanvasItem;
-typedef struct NautilusIconCanvasItemClass NautilusIconCanvasItemClass;
-typedef struct NautilusIconCanvasItemDetails NautilusIconCanvasItemDetails;
-
-struct NautilusIconCanvasItem {
- GnomeCanvasItem item;
- NautilusIconCanvasItemDetails *details;
- gpointer user_data;
-};
-
-struct NautilusIconCanvasItemClass {
- GnomeCanvasItemClass parent_class;
-
- void (* bounds_changed) (NautilusIconCanvasItem *item,
- const ArtDRect *old_world_bounds);
-};
-
-/* GtkObject */
-GtkType nautilus_icon_canvas_item_get_type (void);
-
-/* attributes */
-void nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
- GdkPixbuf *image,
- const ArtIRect *embedded_text_rectangle);
-GdkPixbuf *nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
- ArtIRect *embedded_text_rectangle);
-void nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
- GList *emblem_pixbufs);
-void nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
- gboolean show_stretch_handles);
-
-/* geometry and hit testing */
-gboolean nautilus_icon_canvas_item_hit_test_rectangle (NautilusIconCanvasItem *item,
- const ArtDRect *world_rectangle);
-gboolean nautilus_icon_canvas_item_hit_test_stretch_handles (NautilusIconCanvasItem *item,
- const ArtPoint *world_point);
-void nautilus_icon_canvas_item_get_icon_rectangle (NautilusIconCanvasItem *item,
- ArtDRect *world_rectangle);
-void nautilus_icon_canvas_item_update_bounds (NautilusIconCanvasItem *item);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/libnautilus/nautilus-icon-container.c b/libnautilus/nautilus-icon-container.c
deleted file mode 100644
index 1294d45e2..000000000
--- a/libnautilus/nautilus-icon-container.c
+++ /dev/null
@@ -1,2884 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* nautilus-icon-container.c - Icon container widget.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>, Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-icon-container.h"
-
-#include <math.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gdk-pixbuf-extensions.h"
-#include "nautilus-gtk-extensions.h"
-#include "nautilus-gnome-extensions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-lib-self-check-functions.h"
-
-#include "nautilus-icon-grid.h"
-#include "nautilus-icon-private.h"
-
-/* Interval for updating the rubberband selection, in milliseconds. */
-#define RUBBERBAND_TIMEOUT_INTERVAL 10
-
-/* Timeout for making the icon currently selected for keyboard operation
- * visible. FIXME: This *must* be higher than the double-click time in GDK,
- * but there is no way to access its value from outside.
- */
-#define KEYBOARD_ICON_REVEAL_TIMEOUT 300
-
-/* Maximum amount of milliseconds the mouse button is allowed to stay down
- * and still be considered a click.
- */
-#define MAX_CLICK_TIME 1500
-
-/* Distance you have to move before it becomes a drag. */
-#define SNAP_RESISTANCE 2 /* GMC has this set to 3, but it's too much for my (Ettore's?) taste. */
-
-/* Button assignments. */
-#define DRAG_BUTTON 1
-#define RUBBERBAND_BUTTON 1
-#define CONTEXTUAL_MENU_BUTTON 3
-
-/* Maximum size (multiplier) allowed for icons at the time
- * they are installed - the user can still stretch them further.
- */
-#define MAXIMUM_INITIAL_ICON_SIZE 2
-
-static void activate_selected_items (NautilusIconContainer *container);
-static void nautilus_icon_container_initialize_class (NautilusIconContainerClass *class);
-static void nautilus_icon_container_initialize (NautilusIconContainer *container);
-static void compute_stretch (StretchState *start,
- StretchState *current);
-static NautilusIcon *get_first_selected_icon (NautilusIconContainer *container);
-static NautilusIcon *get_nth_selected_icon (NautilusIconContainer *container,
- int index);
-static gboolean has_multiple_selection (NautilusIconContainer *container);
-static void icon_destroy (NautilusIconContainer *container,
- NautilusIcon *icon);
-static guint icon_get_actual_size (NautilusIcon *icon);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconContainer, nautilus_icon_container, GNOME_TYPE_CANVAS)
-
-
-
-/* The NautilusIconContainer signals. */
-enum {
- ACTIVATE,
- BUTTON_PRESS,
- CONTEXT_CLICK_BACKGROUND,
- CONTEXT_CLICK_SELECTION,
- GET_ICON_IMAGES,
- GET_ICON_PROPERTY,
- GET_ICON_TEXT,
- GET_ICON_URI,
- ICON_CHANGED,
- SELECTION_CHANGED,
- MOVE_COPY_ITEMS,
- GET_CONTAINER_URI,
- CAN_ACCEPT_ITEM,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL];
-
-/* Bitmap for stippled selection rectangles. */
-static GdkBitmap *stipple;
-static char stipple_bits[] = { 0x02, 0x01 };
-
-
-/* Functions dealing with NautilusIcons. */
-
-static void
-icon_free (NautilusIcon *icon)
-{
- gtk_object_destroy (GTK_OBJECT (icon->item));
- g_free (icon);
-}
-
-static NautilusIcon *
-icon_new (NautilusIconContainer *container,
- NautilusIconData *data)
-{
- NautilusIcon *icon;
- GnomeCanvas *canvas;
- guint max_size, actual_size;
-
- canvas = GNOME_CANVAS (container);
-
- icon = g_new0 (NautilusIcon, 1);
-
- icon->scale_x = 1.0;
- icon->scale_y = 1.0;
-
- icon->data = data;
-
- icon->item = NAUTILUS_ICON_CANVAS_ITEM
- (gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
- nautilus_icon_canvas_item_get_type (),
- NULL));
- icon->item->user_data = icon;
-
- nautilus_icon_container_update_icon (container, icon);
-
- /* Enforce a maximum size for new icons by reducing the scale factor as necessary.
- * FIXME: This needs to be done again later when the image changes, so it's not
- * sufficient to just have this check here. Also, this should not be done by
- * changing the scale factor because we don't want a persistent change to that.
- * I think that the best way to implement this is probably to put something in
- * the icon factory that enforces this rule.
- */
- max_size = nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
- * MAXIMUM_INITIAL_ICON_SIZE;
- actual_size = icon_get_actual_size (icon);
- if (actual_size > max_size) {
- icon->scale_x = max_size / (double) actual_size;
- icon->scale_y = icon->scale_x;
- nautilus_icon_container_update_icon (container, icon);
- }
-
- return icon;
-}
-
-static void
-icon_set_position (NautilusIcon *icon,
- double x, double y)
-{
- if (icon->x == x && icon->y == y)
- return;
-
- gnome_canvas_item_move (GNOME_CANVAS_ITEM (icon->item),
- x - icon->x,
- y - icon->y);
-
- icon->x = x;
- icon->y = y;
-}
-
-/* icon_get_size and icon_set_size are used by the stretching user interface,
- * which currently stretches in a way that keeps the aspect ratio. Later we
- * might have a stretching interface that stretches Y separate from X and
- * we will change this around.
- */
-
-static void
-icon_get_size (NautilusIconContainer *container,
- NautilusIcon *icon,
- guint *size_x, guint *size_y)
-{
- if (size_x != NULL) {
- *size_x = MAX (nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
- * icon->scale_x, NAUTILUS_ICON_SIZE_SMALLEST);
- }
- if (size_y != NULL) {
- *size_y = MAX (nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
- * icon->scale_y, NAUTILUS_ICON_SIZE_SMALLEST);
- }
-}
-
-static void
-icon_set_size (NautilusIconContainer *container,
- NautilusIcon *icon,
- guint icon_size)
-{
- guint old_size_x, old_size_y;
- double scale;
-
- icon_get_size (container, icon, &old_size_x, &old_size_y);
- if (icon_size == old_size_x && icon_size == old_size_y) {
- return;
- }
-
- scale = (double) icon_size /
- nautilus_get_icon_size_for_zoom_level
- (container->details->zoom_level);
- nautilus_icon_container_move_icon (container, icon,
- icon->x, icon->y,
- scale, scale,
- FALSE);
-}
-
-/* return the size in pixels of the largest dimension of the pixmap associated with the icon */
-static guint
-icon_get_actual_size (NautilusIcon *icon)
-{
- GdkPixbuf *pixbuf;
- guint max_size;
-
- pixbuf = nautilus_icon_canvas_item_get_image (icon->item, NULL);
- max_size = gdk_pixbuf_get_width (pixbuf);
- if (gdk_pixbuf_get_height (pixbuf) > max_size) {
- max_size = gdk_pixbuf_get_height (pixbuf);
- }
-
- return max_size;
-}
-
-static void
-icon_raise (NautilusIcon *icon)
-{
- gnome_canvas_item_raise_to_top (GNOME_CANVAS_ITEM (icon->item));
-}
-
-static void
-icon_show (NautilusIcon *icon)
-{
- gnome_canvas_item_show (GNOME_CANVAS_ITEM (icon->item));
-}
-
-static void
-icon_toggle_selected (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- icon->is_selected = !icon->is_selected;
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (icon->item),
- "highlighted_for_selection", (gboolean) icon->is_selected,
- NULL);
-
- /* If the icon is deselected, then get rid of the stretch handles.
- * No harm in doing the same if the item is newly selected.
- */
- if (icon == container->details->stretch_icon) {
- container->details->stretch_icon = NULL;
- nautilus_icon_canvas_item_set_show_stretch_handles (icon->item, FALSE);
- }
-}
-
-/* Select an icon. Return TRUE if selection has changed. */
-static gboolean
-icon_set_selected (NautilusIconContainer *container,
- NautilusIcon *icon,
- gboolean select)
-{
- /* Since is_selected is a bit field, we have to do the ! business
- * to be sure we have either a 1 or a 0. Similarly, the caller
- * might pass a value other than 1 or 0 so we have to pass do the
- * same thing there.
- */
- if (!select == !icon->is_selected) {
- return FALSE;
- }
-
- icon_toggle_selected (container, icon);
- g_assert (!select == !icon->is_selected);
- return TRUE;
-}
-
-static void
-icon_get_bounding_box (NautilusIcon *icon,
- int *x1_return, int *y1_return,
- int *x2_return, int *y2_return)
-{
- double x1, y1, x2, y2;
-
- gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (icon->item),
- &x1, &y1, &x2, &y2);
-
- *x1_return = x1;
- *y1_return = y1;
- *x2_return = x2;
- *y2_return = y2;
-}
-
-
-
-/* Utility functions for NautilusIconContainer. */
-
-static void
-scroll (NautilusIconContainer *container,
- int delta_x, int delta_y)
-{
- GtkAdjustment *hadj, *vadj;
-
- hadj = GTK_LAYOUT (container)->hadjustment;
- vadj = GTK_LAYOUT (container)->vadjustment;
-
- gtk_adjustment_set_value (hadj, hadj->value + delta_x);
- gtk_adjustment_set_value (vadj, vadj->value + delta_y);
-}
-
-static void
-reveal_icon (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIconContainerDetails *details;
- GtkAllocation *allocation;
- GtkAdjustment *hadj, *vadj;
- int x1, y1, x2, y2;
-
- details = container->details;
- allocation = &GTK_WIDGET (container)->allocation;
-
- hadj = GTK_LAYOUT (container)->hadjustment;
- vadj = GTK_LAYOUT (container)->vadjustment;
-
- icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
-
- if (y1 < vadj->value) {
- gtk_adjustment_set_value (vadj, y1);
- } else if (y2 > vadj->value + allocation->height) {
- gtk_adjustment_set_value (vadj, y2 - allocation->height);
- }
-
- if (x1 < hadj->value) {
- gtk_adjustment_set_value (hadj, x1);
- } else if (x2 > hadj->value + allocation->width) {
- gtk_adjustment_set_value (hadj, x2 - allocation->width);
- }
-}
-
-static gboolean
-keyboard_icon_reveal_timeout_callback (gpointer data)
-{
- NautilusIconContainer *container;
- NautilusIcon *icon;
-
- GDK_THREADS_ENTER ();
-
- container = NAUTILUS_ICON_CONTAINER (data);
- icon = container->details->keyboard_icon_to_reveal;
-
- g_assert (icon != NULL);
-
- /* Only reveal the icon if it's still the keyboard focus
- * or if it's still selected.
- * FIXME: Need to unschedule this if the user scrolls explicitly.
- */
- if (icon == container->details->keyboard_focus
- || icon->is_selected) {
- reveal_icon (container, icon);
- }
- container->details->keyboard_icon_reveal_timer_id = 0;
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
-static void
-unschedule_keyboard_icon_reveal (NautilusIconContainer *container)
-{
- NautilusIconContainerDetails *details;
-
- details = container->details;
-
- if (details->keyboard_icon_reveal_timer_id != 0) {
- gtk_timeout_remove (details->keyboard_icon_reveal_timer_id);
- }
-}
-
-static void
-schedule_keyboard_icon_reveal (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIconContainerDetails *details;
-
- details = container->details;
-
- unschedule_keyboard_icon_reveal (container);
-
- details->keyboard_icon_to_reveal = icon;
- details->keyboard_icon_reveal_timer_id
- = gtk_timeout_add (KEYBOARD_ICON_REVEAL_TIMEOUT,
- keyboard_icon_reveal_timeout_callback,
- container);
-}
-
-static void
-clear_keyboard_focus (NautilusIconContainer *container)
-{
- if (container->details->keyboard_focus != NULL) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (container->details->keyboard_focus->item),
- "highlighted_as_keyboard_focus", 0,
- NULL);
- }
-
- container->details->keyboard_focus = NULL;
-}
-
-/* Set `icon' as the icon currently selected for keyboard operations. */
-static void
-set_keyboard_focus (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- g_assert (icon != NULL);
-
- if (icon == container->details->keyboard_focus) {
- return;
- }
-
- clear_keyboard_focus (container);
-
- container->details->keyboard_focus = icon;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (container->details->keyboard_focus->item),
- "highlighted_as_keyboard_focus", 1,
- NULL);
-}
-
-
-
-/* Idle operation handler. */
-
-static void
-nautilus_gnome_canvas_item_request_update_deep (GnomeCanvasItem *item)
-{
- GList *p;
-
- gnome_canvas_item_request_update (item);
- if (GNOME_IS_CANVAS_GROUP (item)) {
- for (p = GNOME_CANVAS_GROUP (item)->item_list; p != NULL; p = p->next) {
- nautilus_gnome_canvas_item_request_update_deep (p->data);
- }
- }
-}
-
-static void
-nautilus_gnome_canvas_request_update_all (GnomeCanvas *canvas)
-{
- nautilus_gnome_canvas_item_request_update_deep (canvas->root);
-}
-
-/* gnome_canvas_set_scroll_region doesn't do an update, even though it should.
- * The update is in there with an #if 0 around it, with no explanation fo
- * why it's commented out. For now, work around this by requesting an update
- * explicitly.
- */
-static void
-nautilus_gnome_canvas_set_scroll_region (GnomeCanvas *canvas,
- double x1, double y1,
- double x2, double y2)
-{
- double old_x1, old_y1, old_x2, old_y2;
-
- gnome_canvas_get_scroll_region (canvas, &old_x1, &old_y1, &old_x2, &old_y2);
- if (old_x1 == x1 && old_y1 == y1 && old_x2 == x2 && old_y2 == y2) {
- return;
- }
-
- gnome_canvas_set_scroll_region (canvas, x1, y1, x2, y2);
- nautilus_gnome_canvas_request_update_all (canvas);
- gnome_canvas_item_request_update (canvas->root);
-}
-
-static void
-set_scroll_region (NautilusIconContainer *container)
-{
- double x1, y1, x2, y2;
- double content_width, content_height;
- double scroll_width, scroll_height;
- int step_increment;
- GtkAllocation *allocation;
- GtkAdjustment *vadj, *hadj;
-
- gnome_canvas_item_get_bounds (GNOME_CANVAS (container)->root,
- &x1, &y1, &x2, &y2);
-
- content_width = x2 - x1;
- content_height = y2 - y1;
-
- allocation = &GTK_WIDGET (container)->allocation;
-
- scroll_width = MAX (content_width, allocation->width);
- scroll_height = MAX (content_height, allocation->height);
-
- /* FIXME: Why are we subtracting one from each dimension? */
- nautilus_gnome_canvas_set_scroll_region (GNOME_CANVAS (container),
- x1, y1,
- x1 + scroll_width - 1,
- y1 + scroll_height - 1);
-
- hadj = GTK_LAYOUT (container)->hadjustment;
- vadj = GTK_LAYOUT (container)->vadjustment;
-
- if (content_width <= allocation->width) {
- gtk_adjustment_set_value (hadj, x1);
- }
- if (content_height <= allocation->height) {
- gtk_adjustment_set_value (vadj, y1);
- }
-
- step_increment = nautilus_get_icon_size_for_zoom_level
- (container->details->zoom_level) / 4;
-
- if (hadj->step_increment != step_increment) {
- hadj->step_increment = step_increment;
- gtk_adjustment_changed (hadj);
- }
- if (vadj->step_increment != step_increment) {
- vadj->step_increment = step_increment;
- gtk_adjustment_changed (vadj);
- }
-}
-
-static gboolean
-idle_handler (gpointer data)
-{
- NautilusIconContainer *container;
- NautilusIconContainerDetails *details;
-
- GDK_THREADS_ENTER ();
-
- container = NAUTILUS_ICON_CONTAINER (data);
- details = container->details;
-
- set_scroll_region (container);
-
- details->idle_id = 0;
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
-static void
-request_idle (NautilusIconContainer *container)
-{
- if (container->details->idle_id != 0) {
- return;
- }
-
- container->details->idle_id = gtk_idle_add (idle_handler, container);
-}
-
-
-/* Container-level icon handling functions. */
-
-static gboolean
-button_event_modifies_selection (GdkEventButton *event)
-{
- return (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
-}
-
-static gboolean
-select_one_unselect_others (NautilusIconContainer *container,
- NautilusIcon *icon_to_select)
-{
- NautilusIconContainerDetails *details;
- GList *p;
- gboolean selection_changed;
-
- details = container->details;
- selection_changed = FALSE;
-
- for (p = details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
-
- selection_changed |= icon_set_selected (container, icon, icon == icon_to_select);
- }
-
- return selection_changed;
-}
-
-static gboolean
-unselect_all (NautilusIconContainer *container)
-{
- return select_one_unselect_others (container, NULL);
-}
-
-void
-nautilus_icon_container_move_icon (NautilusIconContainer *container,
- NautilusIcon *icon,
- int x, int y,
- double scale_x, double scale_y,
- gboolean raise)
-{
- NautilusIconContainerDetails *details;
- gboolean emit_signal;
-
- details = container->details;
-
- emit_signal = FALSE;
-
- if (x != icon->x || y != icon->y) {
- icon_set_position (icon, x, y);
- emit_signal = TRUE;
- }
-
- if (scale_x != icon->scale_x || scale_y != icon->scale_y) {
- icon->scale_x = scale_x;
- icon->scale_y = scale_y;
- nautilus_icon_container_update_icon (container, icon);
- emit_signal = TRUE;
- }
-
- if (emit_signal) {
- gtk_signal_emit (GTK_OBJECT (container), signals[ICON_CHANGED],
- icon->data, x, y, scale_x, scale_y);
- }
-
- if (raise) {
- icon_raise (icon);
- }
-}
-
-
-/* Implementation of rubberband selection. */
-
-static void
-rubberband_select (NautilusIconContainer *container,
- const ArtDRect *previous_rect,
- const ArtDRect *current_rect)
-{
- ArtDRect both_rects;
- GList *icons, *p;
- gboolean selection_changed;
- NautilusIcon *icon;
- gboolean is_in;
-
- /* As an optimization, ask the grid which icons intersect the rectangles. */
- art_drect_union (&both_rects, previous_rect, current_rect);
- icons = nautilus_icon_grid_get_intersecting_icons (container->details->grid,
- &both_rects);
-
- selection_changed = FALSE;
-
- for (p = icons; p != NULL; p = p->next) {
- icon = p->data;
-
- is_in = nautilus_icon_canvas_item_hit_test_rectangle
- (icon->item, current_rect);
- if (icon_set_selected (container, icon,
- is_in ^ icon->was_selected_before_rubberband)) {
- selection_changed = TRUE;
- }
- }
-
- g_list_free (icons);
-
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-static int
-rubberband_timeout_callback (gpointer data)
-{
- NautilusIconContainer *container;
- GtkWidget *widget;
- NautilusIconRubberbandInfo *band_info;
- int x, y;
- double x1, y1, x2, y2;
- double world_x, world_y;
- int x_scroll, y_scroll;
- ArtDRect selection_rect;
-
- GDK_THREADS_ENTER ();
-
- widget = GTK_WIDGET (data);
- container = NAUTILUS_ICON_CONTAINER (data);
- band_info = &container->details->rubberband_info;
-
- g_assert (band_info->timer_id != 0);
- g_assert (GNOME_IS_CANVAS_RECT (band_info->selection_rectangle));
-
- gdk_window_get_pointer (widget->window, &x, &y, NULL);
-
- if (x < 0) {
- x_scroll = x;
- x = 0;
- } else if (x >= widget->allocation.width) {
- x_scroll = x - widget->allocation.width + 1;
- x = widget->allocation.width - 1;
- } else {
- x_scroll = 0;
- }
-
- if (y < 0) {
- y_scroll = y;
- y = 0;
- } else if (y >= widget->allocation.height) {
- y_scroll = y - widget->allocation.height + 1;
- y = widget->allocation.height - 1;
- } else {
- y_scroll = 0;
- }
-
- if (y_scroll == 0 && x_scroll == 0
- && band_info->prev_x == x && band_info->prev_y == y) {
- GDK_THREADS_LEAVE ();
- return TRUE;
- }
-
- scroll (container, x_scroll, y_scroll);
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- x, y, &world_x, &world_y);
-
- if (world_x < band_info->start_x) {
- x1 = world_x;
- x2 = band_info->start_x;
- } else {
- x1 = band_info->start_x;
- x2 = world_x;
- }
-
- if (world_y < band_info->start_y) {
- y1 = world_y;
- y2 = band_info->start_y;
- } else {
- y1 = band_info->start_y;
- y2 = world_y;
- }
-
- gnome_canvas_item_set (band_info->selection_rectangle,
- "x1", x1,
- "y1", y1,
- "x2", x2,
- "y2", y2,
- NULL);
-
- selection_rect.x0 = x1;
- selection_rect.y0 = y1;
- selection_rect.x1 = x2;
- selection_rect.y1 = y2;
-
- rubberband_select (container,
- &band_info->prev_rect,
- &selection_rect);
-
- band_info->prev_x = x;
- band_info->prev_y = y;
-
- band_info->prev_rect = selection_rect;
-
- GDK_THREADS_LEAVE ();
-
- return TRUE;
-}
-
-static void
-start_rubberbanding (NautilusIconContainer *container,
- GdkEventButton *event)
-{
- NautilusIconContainerDetails *details;
- NautilusIconRubberbandInfo *band_info;
- GList *p;
-
- details = container->details;
- band_info = &details->rubberband_info;
-
- for (p = details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
- icon->was_selected_before_rubberband = icon->is_selected;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- event->x, event->y,
- &band_info->start_x, &band_info->start_y);
-
- band_info->selection_rectangle
- = gnome_canvas_item_new (gnome_canvas_root
- (GNOME_CANVAS (container)),
- gnome_canvas_rect_get_type (),
- "x1", band_info->start_x,
- "y1", band_info->start_y,
- "x2", band_info->start_x,
- "y2", band_info->start_y,
- "fill_color", "lightblue",
- "fill_stipple", stipple,
- "outline_color", "lightblue",
- "width_pixels", 1,
- NULL);
-
- band_info->prev_x = event->x;
- band_info->prev_y = event->y;
-
- band_info->active = TRUE;
-
- if (band_info->timer_id == 0) {
- band_info->timer_id = gtk_timeout_add (RUBBERBAND_TIMEOUT_INTERVAL,
- rubberband_timeout_callback,
- container);
- }
-
- gnome_canvas_item_grab (band_info->selection_rectangle,
- (GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL, event->time);
-}
-
-static void
-stop_rubberbanding (NautilusIconContainer *container,
- GdkEventButton *event)
-{
- NautilusIconRubberbandInfo *band_info;
-
- band_info = &container->details->rubberband_info;
-
- g_assert (band_info->timer_id != 0);
- gtk_timeout_remove (band_info->timer_id);
- band_info->timer_id = 0;
-
- band_info->active = FALSE;
-
- gnome_canvas_item_ungrab (band_info->selection_rectangle, event->time);
- gtk_object_destroy (GTK_OBJECT (band_info->selection_rectangle));
- band_info->selection_rectangle = NULL;
-}
-
-
-
-/* Keyboard navigation. */
-
-typedef gboolean (* IsBetterIconFunction) (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate);
-
-static NautilusIcon *
-find_best_icon (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- IsBetterIconFunction function)
-{
- GList *p;
- NautilusIcon *best, *candidate;
-
- best = NULL;
- for (p = container->details->icons; p != NULL; p = p->next) {
- candidate = p->data;
-
- if (candidate != start_icon) {
- if ((* function) (container, start_icon, best, candidate)) {
- best = candidate;
- }
- }
- }
- return best;
-}
-
-static NautilusIcon *
-find_best_selected_icon (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- IsBetterIconFunction function)
-{
- GList *p;
- NautilusIcon *best, *candidate;
-
- best = NULL;
- for (p = container->details->icons; p != NULL; p = p->next) {
- candidate = p->data;
-
- if (candidate != start_icon && candidate->is_selected) {
- if ((* function) (container, start_icon, best, candidate)) {
- best = candidate;
- }
- }
- }
- return best;
-}
-
-static int
-compare_icons_by_uri (NautilusIconContainer *container,
- NautilusIcon *icon_a,
- NautilusIcon *icon_b)
-{
- char *uri_a, *uri_b;
- int result;
-
- g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
- g_assert (icon_a != NULL);
- g_assert (icon_b != NULL);
- g_assert (icon_a != icon_b);
-
- uri_a = nautilus_icon_container_get_icon_uri (container, icon_a);
- uri_b = nautilus_icon_container_get_icon_uri (container, icon_b);
- result = strcmp (uri_a, uri_b);
- g_assert (result != 0);
- g_free (uri_a);
- g_free (uri_b);
-
- return result;
-}
-
-static int
-compare_icons_horizontal_first (NautilusIconContainer *container,
- NautilusIcon *icon_a,
- NautilusIcon *icon_b)
-{
- if (icon_a->x < icon_b->x) {
- return -1;
- }
- if (icon_a->x > icon_b->x) {
- return 1;
- }
- if (icon_a->y < icon_b->y) {
- return -1;
- }
- if (icon_a->y > icon_b->y) {
- return 1;
- }
- return compare_icons_by_uri (container, icon_a, icon_b);
-}
-
-static int
-compare_icons_vertical_first (NautilusIconContainer *container,
- NautilusIcon *icon_a,
- NautilusIcon *icon_b)
-{
- if (icon_a->y < icon_b->y) {
- return -1;
- }
- if (icon_a->y > icon_b->y) {
- return 1;
- }
- if (icon_a->x < icon_b->x) {
- return -1;
- }
- if (icon_a->x > icon_b->x) {
- return 1;
- }
- return compare_icons_by_uri (container, icon_a, icon_b);
-}
-
-static gboolean
-leftmost_in_top_row (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- if (best_so_far == NULL) {
- return TRUE;
- }
- return compare_icons_vertical_first (container, best_so_far, candidate) > 0;
-}
-
-static gboolean
-rightmost_in_bottom_row (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- if (best_so_far == NULL) {
- return TRUE;
- }
- return compare_icons_vertical_first (container, best_so_far, candidate) < 0;
-}
-
-static int
-compare_with_start_row (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- ArtIRect bounds;
-
- nautilus_gnome_canvas_item_get_current_canvas_bounds (GNOME_CANVAS_ITEM (icon->item),
- &bounds);
- if (container->details->arrow_key_start < bounds.y0) {
- return -1;
- }
- if (container->details->arrow_key_start > bounds.y1) {
- return 1;
- }
- return 0;
-}
-
-static int
-compare_with_start_column (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- ArtIRect bounds;
-
- nautilus_gnome_canvas_item_get_current_canvas_bounds (GNOME_CANVAS_ITEM (icon->item),
- &bounds);
- if (container->details->arrow_key_start < bounds.x0) {
- return -1;
- }
- if (container->details->arrow_key_start > bounds.x1) {
- return 1;
- }
- return 0;
-}
-
-static gboolean
-same_row_right_side_leftmost (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- /* Candidates not on the start row do not qualify. */
- if (compare_with_start_row (container, candidate) != 0) {
- return FALSE;
- }
-
- /* Candidates that are farther right lose out. */
- if (best_so_far != NULL) {
- if (compare_icons_horizontal_first (container,
- best_so_far,
- candidate) < 0) {
- return FALSE;
- }
- }
-
- /* Candidate to the left of the start do not qualify. */
- if (compare_icons_horizontal_first (container,
- candidate,
- start_icon) <= 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-same_row_left_side_rightmost (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- /* Candidates not on the start row do not qualify. */
- if (compare_with_start_row (container, candidate) != 0) {
- return FALSE;
- }
-
- /* Candidates that are farther left lose out. */
- if (best_so_far != NULL) {
- if (compare_icons_horizontal_first (container,
- best_so_far,
- candidate) > 0) {
- return FALSE;
- }
- }
-
- /* Candidate to the right of the start do not qualify. */
- if (compare_icons_horizontal_first (container,
- candidate,
- start_icon) >= 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-same_column_above_lowest (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- /* Candidates not on the start column do not qualify. */
- if (compare_with_start_column (container, candidate) != 0) {
- return FALSE;
- }
-
- /* Candidates that are higher lose out. */
- if (best_so_far != NULL) {
- if (compare_icons_vertical_first (container,
- best_so_far,
- candidate) > 0) {
- return FALSE;
- }
- }
-
- /* Candidates below the start do not qualify. */
- if (compare_icons_vertical_first (container,
- candidate,
- start_icon) >= 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-same_column_below_highest (NautilusIconContainer *container,
- NautilusIcon *start_icon,
- NautilusIcon *best_so_far,
- NautilusIcon *candidate)
-{
- /* Candidates not on the start column do not qualify. */
- if (compare_with_start_column (container, candidate) != 0) {
- return FALSE;
- }
-
- /* Candidates that are lower lose out. */
- if (best_so_far != NULL) {
- if (compare_icons_vertical_first (container,
- best_so_far,
- candidate) < 0) {
- return FALSE;
- }
- }
-
- /* Candidate above the start do not qualify. */
- if (compare_icons_vertical_first (container,
- candidate,
- start_icon) <= 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-keyboard_move_to (NautilusIconContainer *container,
- NautilusIcon *icon,
- GdkEventKey *event)
-{
- if (icon == NULL) {
- return;
- }
-
- if ((event->state & GDK_CONTROL_MASK) != 0) {
- /* Move the keyboard focus. */
- set_keyboard_focus (container, icon);
- } else {
- /* Select icons and get rid of the special keyboard focus. */
- clear_keyboard_focus (container);
- if (select_one_unselect_others (container, icon)) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
- }
- schedule_keyboard_icon_reveal (container, icon);
-}
-
-static void
-keyboard_home (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Home selects the first icon.
- * Control-Home sets the keyboard focus to the first icon.
- */
- container->details->arrow_key_axis = AXIS_NONE;
- keyboard_move_to (container,
- find_best_icon (container,
- NULL,
- leftmost_in_top_row),
- event);
-}
-
-static void
-keyboard_end (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* End selects the last icon.
- * Control-End sets the keyboard focus to the last icon.
- */
- container->details->arrow_key_axis = AXIS_NONE;
- keyboard_move_to (container,
- find_best_icon (container,
- NULL,
- rightmost_in_bottom_row),
- event);
-}
-
-static void
-record_arrow_key_start (NautilusIconContainer *container,
- NautilusIcon *icon,
- Axis arrow_key_axis)
-{
- ArtDRect world_rect;
-
- if (container->details->arrow_key_axis == arrow_key_axis) {
- return;
- }
-
- nautilus_icon_canvas_item_get_icon_rectangle (icon->item,
- &world_rect);
- gnome_canvas_w2c (GNOME_CANVAS (container),
- (world_rect.x0 + world_rect.x1) / 2,
- (world_rect.y0 + world_rect.y1) / 2,
- arrow_key_axis == AXIS_VERTICAL ? &container->details->arrow_key_start : NULL,
- arrow_key_axis == AXIS_HORIZONTAL ? &container->details->arrow_key_start : NULL);
- container->details->arrow_key_axis = arrow_key_axis;
-}
-
-static void
-keyboard_arrow_key (NautilusIconContainer *container,
- GdkEventKey *event,
- Axis axis,
- IsBetterIconFunction better_start,
- IsBetterIconFunction better_destination)
-{
- NautilusIcon *icon;
-
- /* Chose the icon to start with.
- * If we have a keyboard focus, start with it.
- * Otherwise, use the single selected icon.
- * If there's multiple selection, use the icon farthest toward the end.
- */
- icon = container->details->keyboard_focus;
- if (icon == NULL) {
- if (has_multiple_selection (container)) {
- icon = find_best_selected_icon (container,
- NULL,
- better_start);
- } else {
- icon = get_first_selected_icon (container);
- }
- }
-
- /* If there's no icon, select the icon farthest toward the end.
- * If there is an icon, select the next icon based on the arrow direction.
- */
- if (icon == NULL) {
- container->details->arrow_key_axis = AXIS_NONE;
- icon = find_best_icon (container,
- NULL,
- better_start);
- } else {
- record_arrow_key_start (container, icon, axis);
- icon = find_best_icon (container,
- icon,
- better_destination);
- }
-
- keyboard_move_to (container, icon, event);
-}
-
-static void
-keyboard_right (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Right selects the next icon in the same row.
- * Control-Right sets the keyboard focus to the next icon in the same row.
- */
- keyboard_arrow_key (container,
- event,
- AXIS_HORIZONTAL,
- rightmost_in_bottom_row,
- same_row_right_side_leftmost);
-}
-
-static void
-keyboard_left (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Left selects the next icon in the same row.
- * Control-Left sets the keyboard focus to the next icon in the same row.
- */
- keyboard_arrow_key (container,
- event,
- AXIS_HORIZONTAL,
- leftmost_in_top_row,
- same_row_left_side_rightmost);
-}
-
-static void
-keyboard_down (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Down selects the next icon in the same column.
- * Control-Down sets the keyboard focus to the next icon in the same column.
- */
- keyboard_arrow_key (container,
- event,
- AXIS_VERTICAL,
- rightmost_in_bottom_row,
- same_column_below_highest);
-}
-
-static void
-keyboard_up (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Up selects the next icon in the same column.
- * Control-Up sets the keyboard focus to the next icon in the same column.
- */
- keyboard_arrow_key (container,
- event,
- AXIS_VERTICAL,
- leftmost_in_top_row,
- same_column_above_lowest);
-}
-
-static void
-keyboard_space (NautilusIconContainer *container,
- GdkEventKey *event)
-{
- /* Control-space toggles the selection state of the current icon. */
- if (container->details->keyboard_focus != NULL &&
- (event->state & GDK_CONTROL_MASK) != 0) {
- icon_toggle_selected (container, container->details->keyboard_focus);
- gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]);
- }
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- NautilusIconContainer *container;
- int i;
-
- container = NAUTILUS_ICON_CONTAINER (object);
-
- nautilus_icon_dnd_fini (container);
- nautilus_icon_container_clear (container);
-
- nautilus_icon_grid_destroy (container->details->grid);
- unschedule_keyboard_icon_reveal (container);
-
- if (container->details->rubberband_info.timer_id != 0) {
- gtk_timeout_remove (container->details->rubberband_info.timer_id);
- }
- if (container->details->rubberband_info.selection_rectangle != NULL) {
- gtk_object_destroy (GTK_OBJECT (container->details->rubberband_info.selection_rectangle));
- }
-
- if (container->details->idle_id != 0) {
- gtk_idle_remove (container->details->idle_id);
- }
- for (i = 0; i < NAUTILUS_N_ELEMENTS (container->details->label_font); i++) {
- if (container->details->label_font[i] != NULL)
- gdk_font_unref (container->details->label_font[i]);
- }
-
- g_free (container->details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-
-/* GtkWidget methods. */
-
-static void
-size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- requisition->width = 1;
- requisition->height = 1;
-}
-
-static void
-size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- NautilusIconContainer *container;
- NautilusIconGrid *grid;
- double world_width;
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, size_allocate, (widget, allocation));
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- grid = container->details->grid;
-
- gnome_canvas_c2w (GNOME_CANVAS (container),
- allocation->width, 0,
- &world_width, NULL);
-
- nautilus_icon_grid_set_visible_width (grid, world_width);
-
- set_scroll_region (container);
-}
-
-static void
-realize (GtkWidget *widget)
-{
- GtkStyle *style;
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, realize, (widget));
-
- style = gtk_style_copy (gtk_widget_get_style (widget));
- style->bg[GTK_STATE_NORMAL] = style->base[GTK_STATE_NORMAL];
- gtk_widget_set_style (widget, style);
-
- gdk_window_set_background (GTK_LAYOUT (widget)->bin_window,
- & widget->style->bg [GTK_STATE_NORMAL]);
-}
-
-static gboolean
-button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- NautilusIconContainer *container;
- gboolean selection_changed;
- gboolean return_value;
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- container->details->button_down_time = event->time;
-
- /* Forget about the old keyboard selection now that we've started mousing. */
- clear_keyboard_focus (container);
-
- /* Forget about where we began with the arrow keys now that we're mousing. */
- container->details->arrow_key_axis = AXIS_NONE;
-
- /* Invoke the canvas event handler and see if an item picks up the event. */
- if (NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, button_press_event, (widget, event))) {
- return TRUE;
- }
-
- /* An item didn't take the press, so it's a background press.
- * We ignore double clicks on the desktop for now.
- */
- if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
- return TRUE;
- }
-
- /* Button 1 does rubber banding. */
- if (event->button == RUBBERBAND_BUTTON) {
- if (! button_event_modifies_selection (event)) {
- selection_changed = unselect_all (container);
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
- }
-
- start_rubberbanding (container, event);
- return TRUE;
- }
-
- /* Button 3 does a contextual menu. */
- if (event->button == CONTEXTUAL_MENU_BUTTON) {
- gtk_signal_emit (GTK_OBJECT (widget),
- signals[CONTEXT_CLICK_BACKGROUND]);
- return TRUE;
- }
-
- /* Otherwise, we emit a button_press message. */
- gtk_signal_emit (GTK_OBJECT (widget),
- signals[BUTTON_PRESS], event,
- &return_value);
- return return_value;
-}
-
-static void
-nautilus_icon_container_almost_drag (NautilusIconContainer *container,
- GdkEventButton *event)
-{
- NautilusIconContainerDetails *details;
-
- details = container->details;
-
- if (!button_event_modifies_selection (event)) {
- gboolean selection_changed;
-
- selection_changed
- = select_one_unselect_others (container,
- details->drag_icon);
-
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
- }
-
- if (details->drag_icon != NULL) {
- int elapsed_time;
-
- /* If single-click mode, activate the icon, unless modifying
- * the selection or pressing for a very long time.
- */
- elapsed_time = event->time - details->button_down_time;
- if (details->single_click_mode
- && elapsed_time < MAX_CLICK_TIME
- && ! button_event_modifies_selection (event)) {
-
- /* FIXME: This should activate all selected icons, not just one */
- gtk_signal_emit (GTK_OBJECT (container),
- signals[ACTIVATE],
- details->drag_icon->data);
- }
- }
-}
-
-static gboolean
-start_stretching (NautilusIconContainer *container)
-{
- NautilusIconContainerDetails *details;
- NautilusIcon *icon;
- ArtPoint world_point;
-
- details = container->details;
- icon = details->stretch_icon;
-
- /* Check if we hit the stretch handles. */
- world_point.x = details->drag_x;
- world_point.y = details->drag_y;
- if (!nautilus_icon_canvas_item_hit_test_stretch_handles
- (icon->item, &world_point)) {
- return FALSE;
- }
-
- /* Set up the dragging. */
- details->drag_action = DRAG_ACTION_STRETCH;
- gnome_canvas_w2c (GNOME_CANVAS (container),
- details->drag_x,
- details->drag_y,
- &details->stretch_start.pointer_x,
- &details->stretch_start.pointer_y);
- gnome_canvas_w2c (GNOME_CANVAS (container),
- icon->x, icon->y,
- &details->stretch_start.icon_x,
- &details->stretch_start.icon_y);
- icon_get_size (container, icon,
- &details->stretch_start.icon_size, NULL);
-
- gnome_canvas_item_grab (GNOME_CANVAS_ITEM (icon->item),
- (GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- GDK_CURRENT_TIME);
-
- return TRUE;
-}
-
-static void
-continue_stretching (NautilusIconContainer *container,
- int window_x, int window_y)
-{
- NautilusIconContainerDetails *details;
- NautilusIcon *icon;
- double world_x, world_y;
- StretchState stretch_state;
-
- details = container->details;
- icon = details->stretch_icon;
-
- if (icon == NULL) {
- return;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- window_x, window_y,
- &world_x, &world_y);
- gnome_canvas_w2c (GNOME_CANVAS (container),
- world_x, world_y,
- &stretch_state.pointer_x, &stretch_state.pointer_y);
-
- compute_stretch (&details->stretch_start,
- &stretch_state);
-
- gnome_canvas_c2w (GNOME_CANVAS (container),
- stretch_state.icon_x, stretch_state.icon_y,
- &world_x, &world_y);
-
- icon_set_position (icon, world_x, world_y);
- icon_set_size (container, icon, stretch_state.icon_size);
-}
-
-static void
-ungrab_stretch_icon (NautilusIconContainer *container)
-{
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (container->details->stretch_icon->item),
- GDK_CURRENT_TIME);
-}
-
-static void
-end_stretching (NautilusIconContainer *container,
- int window_x, int window_y)
-{
- continue_stretching (container, window_x, window_y);
- ungrab_stretch_icon (container);
-}
-
-static gboolean
-button_release_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- NautilusIconContainer *container;
- NautilusIconContainerDetails *details;
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- details = container->details;
-
- if (event->button == RUBBERBAND_BUTTON && details->rubberband_info.active) {
- stop_rubberbanding (container, event);
- return TRUE;
- }
-
- if (event->button == details->drag_button) {
- details->drag_button = 0;
-
- switch (details->drag_action) {
- case DRAG_ACTION_MOVE_OR_COPY:
- if (!details->drag_started)
- nautilus_icon_container_almost_drag (container, event);
- else
- nautilus_icon_dnd_end_drag (container);
- break;
- case DRAG_ACTION_STRETCH:
- end_stretching (container, event->x, event->y);
- break;
- }
-
- return TRUE;
- }
-
- return NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, button_release_event, (widget, event));
-}
-
-static int
-motion_notify_event (GtkWidget *widget,
- GdkEventMotion *motion)
-{
- NautilusIconContainer *container;
- NautilusIconContainerDetails *details;
- double world_x, world_y;
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- details = container->details;
-
- if (details->drag_button != 0) {
- switch (details->drag_action) {
- case DRAG_ACTION_MOVE_OR_COPY:
- if (details->drag_started) {
- break;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- motion->x, motion->y,
- &world_x, &world_y);
-
- if (abs (details->drag_x - world_x) >= SNAP_RESISTANCE
- || abs (details->drag_y - world_y) >= SNAP_RESISTANCE) {
- details->drag_started = TRUE;
-
- /* KLUDGE ALERT: Poke the starting values into the motion
- * structure so that dragging behaves as expected.
- */
- motion->x = details->drag_x;
- motion->y = details->drag_y;
-
- /* drag action passed in here gets updated in
- * nautilus_icon_dnd_update_drop_action
- */
- nautilus_icon_dnd_begin_drag (container,
- GDK_ACTION_MOVE,
- details->drag_button,
- motion);
- }
- break;
- case DRAG_ACTION_STRETCH:
- continue_stretching (container, motion->x, motion->y);
- break;
- }
- }
-
- return NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, motion_notify_event, (widget, motion));
-}
-
-static int
-key_press_event (GtkWidget *widget,
- GdkEventKey *event)
-{
- NautilusIconContainer *container;
-
- /* allow the drag state update the drag action if modifiers changed */
- nautilus_icon_dnd_update_drop_action (widget);
-
- if (NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, key_press_event, (widget, event))) {
- return TRUE;
- }
-
- container = NAUTILUS_ICON_CONTAINER (widget);
-
- switch (event->keyval) {
- case GDK_Home:
- keyboard_home (container, event);
- break;
- case GDK_End:
- keyboard_end (container, event);
- break;
- case GDK_Left:
- keyboard_left (container, event);
- break;
- case GDK_Up:
- keyboard_up (container, event);
- break;
- case GDK_Right:
- keyboard_right (container, event);
- break;
- case GDK_Down:
- keyboard_down (container, event);
- break;
- case GDK_space:
- keyboard_space (container, event);
- break;
- case GDK_Return:
- activate_selected_items (container);
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* Initialization. */
-
-static void
-nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- /* NautilusIconContainer class. */
-
- class->button_press = NULL;
-
- /* GtkObject class. */
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- /* Signals. */
-
- signals[SELECTION_CHANGED]
- = gtk_signal_new ("selection_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- signals[BUTTON_PRESS]
- = gtk_signal_new ("button_press",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- button_press),
- gtk_marshal_BOOL__POINTER,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- signals[ACTIVATE]
- = gtk_signal_new ("activate",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- activate),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- signals[CONTEXT_CLICK_SELECTION]
- = gtk_signal_new ("context_click_selection",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- context_click_selection),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- signals[CONTEXT_CLICK_BACKGROUND]
- = gtk_signal_new ("context_click_background",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- context_click_background),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- signals[ICON_CHANGED]
- = gtk_signal_new ("icon_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- icon_changed),
- nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE,
- GTK_TYPE_NONE, 5,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_DOUBLE,
- GTK_TYPE_DOUBLE);
- signals[GET_ICON_IMAGES]
- = gtk_signal_new ("get_icon_images",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- get_icon_images),
- nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER,
- GTK_TYPE_POINTER, 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- signals[GET_ICON_TEXT]
- = gtk_signal_new ("get_icon_text",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- get_icon_text),
- nautilus_gtk_marshal_STRING__POINTER,
- GTK_TYPE_STRING, 1,
- GTK_TYPE_POINTER);
- signals[GET_ICON_URI]
- = gtk_signal_new ("get_icon_uri",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- get_icon_uri),
- nautilus_gtk_marshal_STRING__POINTER,
- GTK_TYPE_STRING, 1,
- GTK_TYPE_POINTER);
- signals[GET_ICON_PROPERTY]
- = gtk_signal_new ("get_icon_property",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- get_icon_property),
- nautilus_gtk_marshal_STRING__POINTER_STRING,
- GTK_TYPE_STRING, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_STRING);
- signals[MOVE_COPY_ITEMS]
- = gtk_signal_new ("move_copy_items",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- move_copy_items),
- nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER_INT_INT_INT,
- GTK_TYPE_NONE, 6,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_INT);
- signals[GET_CONTAINER_URI]
- = gtk_signal_new ("get_container_uri",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- get_container_uri),
- nautilus_gtk_marshal_STRING__NONE,
- GTK_TYPE_STRING, 0);
- signals[CAN_ACCEPT_ITEM]
- = gtk_signal_new ("can_accept_item",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
- can_accept_item),
- nautilus_gtk_marshal_INT__POINTER_STRING,
- GTK_TYPE_INT, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_STRING);
-
-
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-
- /* GtkWidget class. */
-
- widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_request = size_request;
- widget_class->size_allocate = size_allocate;
- widget_class->realize = realize;
- widget_class->button_press_event = button_press_event;
- widget_class->button_release_event = button_release_event;
- widget_class->motion_notify_event = motion_notify_event;
- widget_class->key_press_event = key_press_event;
-
- /* Initialize the stipple bitmap. */
-
- stipple = gdk_bitmap_create_from_data (NULL, stipple_bits, 2, 2);
-}
-
-static GdkFont *
-load_font (const char *name)
-{
- GdkFont *font;
-
- /* FIXME: Eventually we need a runtime check, but an assert is better than nothing. */
- font = gdk_font_load (name);
- g_assert (font != NULL);
- return font;
-}
-
-static void
-nautilus_icon_container_initialize (NautilusIconContainer *container)
-{
- NautilusIconContainerDetails *details;
-
- details = g_new0 (NautilusIconContainerDetails, 1);
-
- details->grid = nautilus_icon_grid_new ();
-
- details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
-
- /* font table - this isn't exactly proportional, but it looks better than computed */
- /* FIXME: read font from metadata and/or preferences */
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = load_font ("-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = load_font ("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = load_font ("-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
- details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
-
- /* FIXME: Read this from preferences. */
- details->single_click_mode = TRUE;
-
- container->details = details;
-
- /* Set up DnD. */
- nautilus_icon_dnd_init (container, stipple);
-
- /* Request update. */
- request_idle (container);
-
- /* Make sure that we find out if the theme changes. */
- gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (),
- "icons_changed",
- nautilus_icon_container_request_update_all,
- GTK_OBJECT (container));
-}
-
-
-/* NautilusIcon event handling. */
-
-/* Conceptually, pressing button 1 together with CTRL or SHIFT toggles
- * selection of a single icon without affecting the other icons;
- * without CTRL or SHIFT, it selects a single icon and un-selects all
- * the other icons. But in this latter case, the de-selection should
- * only happen when the button is released if the icon is already
- * selected, because the user might select multiple icons and drag all
- * of them by doing a simple click-drag.
-*/
-static gboolean
-handle_icon_button_press (NautilusIconContainer *container,
- NautilusIcon *icon,
- GdkEventButton *event)
-{
- NautilusIconContainerDetails *details;
-
- if (event->button != DRAG_BUTTON && event->button != CONTEXTUAL_MENU_BUTTON) {
- return TRUE;
- }
-
- details = container->details;
-
- if (event->button == DRAG_BUTTON) {
- details->drag_button = event->button;
- details->drag_icon = icon;
- details->drag_x = event->x;
- details->drag_y = event->y;
- details->drag_action = DRAG_ACTION_MOVE_OR_COPY;
- details->drag_started = FALSE;
-
- /* Check to see if this is a click on the stretch handles.
- * If so, it won't modify the selection.
- */
- if (icon == container->details->stretch_icon) {
- if (start_stretching (container)) {
- return TRUE;
- }
- }
- }
-
- /* Modify the selection as appropriate. Selection is modified
- * the same way for contextual menu as it would be without.
- */
- if (button_event_modifies_selection (event)) {
- icon_toggle_selected (container, icon);
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- } else if (! icon->is_selected) {
- unselect_all (container);
- icon_set_selected (container, icon, TRUE);
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-
- if (event->button == CONTEXTUAL_MENU_BUTTON) {
- /* FIXME this means you cannot drag with right click.
- * If we decide we want right drags, we will have to
- * set up a timeout and emit this signal if the
- * timeout expires without movement.
- */
-
- details->drag_button = 0;
-
- /* Context menu applies to all selected items. The only
- * odd case is if this click deselected the icon under
- * the mouse, but at least the behavior is consistent.
- */
- gtk_signal_emit (GTK_OBJECT (container),
- signals[CONTEXT_CLICK_SELECTION]);
-
- return TRUE;
- } else if (event->type == GDK_2BUTTON_PRESS) {
- /* Double clicking does not trigger a D&D action. */
- details->drag_button = 0;
-
- /* FIXME: This should activate all selected icons, not just one */
- gtk_signal_emit (GTK_OBJECT (container),
- signals[ACTIVATE],
- icon->data);
- }
-
- return TRUE;
-}
-
-static int
-item_event_callback (GnomeCanvasItem *item,
- GdkEvent *event,
- gpointer data)
-{
- NautilusIconContainer *container;
- NautilusIconContainerDetails *details;
- NautilusIcon *icon;
-
- container = NAUTILUS_ICON_CONTAINER (data);
- details = container->details;
-
- icon = NAUTILUS_ICON_CANVAS_ITEM (item)->user_data;
- g_return_val_if_fail (icon != NULL, FALSE);
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- if (details->drag_button != 0) {
- /* Drag motion callback will take care of the
- * necessary update -- don't let the signal reach
- * the canvas item and cause a prelight.
- * We let the GDK_LEAVE_NOTIFY fly through here to
- * cause the "can_accept_drop" state to get turned off
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
- }
- return FALSE;
-
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- if (handle_icon_button_press (container, icon, &event->button)) {
- /* Stop the event from being passed along further. Returning
- * TRUE ain't enough.
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
- }
- return FALSE;
- default:
- return FALSE;
- }
-}
-
-GtkWidget *
-nautilus_icon_container_new (void)
-{
- GtkWidget *new;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- new = gtk_type_new (nautilus_icon_container_get_type ());
-
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- return new;
-}
-
-/* clear all of the icons in the container */
-
-void
-nautilus_icon_container_clear (NautilusIconContainer *container)
-{
- NautilusIconContainerDetails *details;
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- details = container->details;
-
- clear_keyboard_focus (container);
- details->stretch_icon = NULL;
-
- for (p = details->icons; p != NULL; p = p->next) {
- icon_free (p->data);
- }
- g_list_free (details->icons);
- details->icons = NULL;
-
- nautilus_icon_grid_clear (details->grid);
-}
-
-/* utility routine to remove a single icon from the container */
-
-static void
-icon_destroy (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIconContainerDetails *details;
- gboolean was_selected;
-
- details = container->details;
-
- details->icons = g_list_remove (details->icons, icon);
-
- was_selected = icon->is_selected;
-
- if (details->keyboard_focus == icon) {
- clear_keyboard_focus (container);
- }
- if (details->keyboard_icon_to_reveal == icon) {
- unschedule_keyboard_icon_reveal (container);
- }
- if (details->drop_target == icon) {
- details->drop_target = NULL;
- }
-
- nautilus_icon_grid_remove (details->grid, icon);
-
- icon_free (icon);
-
- if (was_selected) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-/* activate any selected items in the container */
-static void
-activate_selected_items (NautilusIconContainer *container)
-{
- NautilusIcon *icon;
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->is_selected) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[ACTIVATE],
- icon->data);
- }
- }
-}
-
-static void
-bounds_changed_callback (NautilusIconCanvasItem *item,
- const ArtDRect *old_bounds,
- NautilusIconContainer *container)
-{
- NautilusIcon *icon;
-
- g_assert (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
- g_assert (old_bounds != NULL);
- g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
-
- icon = item->user_data;
- g_assert (icon != NULL);
-
- nautilus_icon_grid_remove (container->details->grid, icon);
- nautilus_icon_grid_add (container->details->grid, icon);
-}
-
-static void
-set_up_icon_in_container (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIconContainerDetails *details;
-
- details = container->details;
-
- details->icons = g_list_prepend (details->icons, icon);
-
- nautilus_icon_canvas_item_update_bounds (icon->item);
- nautilus_icon_grid_add (details->grid, icon);
-
- icon_show (icon);
-
- gtk_signal_connect (GTK_OBJECT (icon->item), "event",
- GTK_SIGNAL_FUNC (item_event_callback), container);
- gtk_signal_connect (GTK_OBJECT (icon->item), "bounds_changed",
- GTK_SIGNAL_FUNC (bounds_changed_callback), container);
-}
-
-void
-nautilus_icon_container_update_icon (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIconContainerDetails *details;
- NautilusScalableIcon *scalable_icon;
- guint icon_size_x, icon_size_y;
- GdkPixbuf *pixbuf, *emblem_pixbuf;
- ArtIRect text_rect;
- GList *emblem_icons, *emblem_pixbufs, *p;
- char *label;
- char *contents_as_text;
- GdkFont *font;
-
- if (icon == NULL) {
- return;
- }
-
- details = container->details;
-
- /* Get the icons. */
- scalable_icon = NULL;
- gtk_signal_emit (GTK_OBJECT (container),
- signals[GET_ICON_IMAGES],
- icon->data,
- &emblem_icons,
- (icon == details->drop_target) ? "accept" : "",
- &scalable_icon);
- g_assert (scalable_icon != NULL);
-
- /* Get the corresponding pixbufs for this size. */
- icon_get_size (container, icon, &icon_size_x, &icon_size_y);
- pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
- (scalable_icon, icon_size_x, icon_size_y, &text_rect);
- emblem_pixbufs = NULL;
- for (p = emblem_icons; p != NULL; p = p->next) {
- emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
- (p->data, icon_size_x, icon_size_y, NULL);
- if (emblem_pixbuf != NULL) {
- emblem_pixbufs = g_list_prepend
- (emblem_pixbufs, emblem_pixbuf);
- }
- }
- emblem_pixbufs = g_list_reverse (emblem_pixbufs);
-
- /* Let the icons go. */
- nautilus_scalable_icon_unref (scalable_icon);
- nautilus_scalable_icon_list_free (emblem_icons);
-
- label = NULL;
- gtk_signal_emit (GTK_OBJECT (container),
- signals[GET_ICON_TEXT],
- icon->data,
- &label);
-
- font = details->label_font[details->zoom_level];
-
- /* Choose to show mini-text based on this icon's requested size,
- * not zoom level, since icon may be stretched big or small.
- */
- contents_as_text = NULL;
- if (!art_irect_empty (&text_rect)
- && icon_size_x >= NAUTILUS_ICON_SIZE_STANDARD
- && icon_size_y >= NAUTILUS_ICON_SIZE_STANDARD) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[GET_ICON_PROPERTY],
- icon->data,
- "contents_as_text",
- &contents_as_text);
- }
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (icon->item),
- "text", label,
- "font", font,
- "text_source", contents_as_text,
- "highlighted_for_drop", icon == details->drop_target,
- NULL);
- nautilus_icon_canvas_item_set_image (icon->item, pixbuf, &text_rect);
- nautilus_icon_canvas_item_set_emblems (icon->item, emblem_pixbufs);
-
- /* Let the pixbufs go. */
- gdk_pixbuf_unref (pixbuf);
- nautilus_gdk_pixbuf_list_free (emblem_pixbufs);
-
- g_free (label);
- g_free (contents_as_text);
-}
-
-void
-nautilus_icon_container_add (NautilusIconContainer *container,
- NautilusIconData *data,
- int x, int y,
- double scale_x, double scale_y)
-{
- NautilusIconContainerDetails *details;
- NautilusIcon *new_icon;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
- g_return_if_fail (data != NULL);
-
- details = container->details;
-
- new_icon = icon_new (container, data);
- icon_set_position (new_icon, x, y);
- new_icon->scale_x = scale_x;
- new_icon->scale_y = scale_y;
-
- set_up_icon_in_container (container, new_icon);
-
- request_idle (container);
-
- nautilus_icon_container_update_icon (container, new_icon);
-}
-
-/**
- * nautilus_icon_container_add_auto:
- * @container: A NautilusIconContainer
- * @data: Icon data.
- *
- * Add @image with caption @text and data @data to @container, in the first
- * empty spot available.
- **/
-void
-nautilus_icon_container_add_auto (NautilusIconContainer *container,
- NautilusIconData *data)
-{
- NautilusIcon *new_icon;
- ArtPoint position;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
- g_return_if_fail (data != NULL);
-
- new_icon = icon_new (container, data);
-
- nautilus_icon_grid_get_position (container->details->grid,
- new_icon,
- &position);
-
- icon_set_position (new_icon, position.x, position.y);
-
- set_up_icon_in_container (container, new_icon);
-
- request_idle (container);
-}
-
-/**
- * nautilus_icon_container_remove:
- * @container: A NautilusIconContainer.
- * @data: Icon data.
- *
- * Remove the icon with this data.
- **/
-gboolean
-nautilus_icon_container_remove (NautilusIconContainer *container,
- NautilusIconData *data)
-{
- NautilusIcon *icon;
- GList *p;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->data == data) {
- icon_destroy (container, icon);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nautilus_icon_container_request_update:
- * @container: A NautilusIconContainer.
- * @data: Icon data.
- *
- * Update the icon with this data.
- **/
-void
-nautilus_icon_container_request_update (NautilusIconContainer *container,
- NautilusIconData *data)
-{
- NautilusIcon *icon;
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
- g_return_if_fail (data != NULL);
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->data == data) {
- nautilus_icon_container_update_icon (container, icon);
- return;
- }
- }
-}
-
-/* zooming */
-
-int
-nautilus_icon_container_get_zoom_level(NautilusIconContainer *container)
-{
- return container->details->zoom_level;
-}
-
-void
-nautilus_icon_container_set_zoom_level(NautilusIconContainer *container, int new_level)
-{
- NautilusIconContainerDetails *details;
- int pinned_level;
- double pixels_per_unit;
-
- details = container->details;
-
- pinned_level = new_level;
- if (pinned_level < NAUTILUS_ZOOM_LEVEL_SMALLEST) {
- pinned_level = NAUTILUS_ZOOM_LEVEL_SMALLEST;
- } else if (pinned_level > NAUTILUS_ZOOM_LEVEL_LARGEST) {
- pinned_level = NAUTILUS_ZOOM_LEVEL_LARGEST;
- }
-
- if (pinned_level == details->zoom_level) {
- return;
- }
-
- details->zoom_level = pinned_level;
-
- pixels_per_unit = (double) nautilus_get_icon_size_for_zoom_level (pinned_level)
- / NAUTILUS_ICON_SIZE_STANDARD;
- gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (container), pixels_per_unit);
-
- nautilus_icon_container_request_update_all (container);
-}
-
-/**
- * nautilus_icon_container_request_update_all:
- * For each icon, synchronizes the displayed information (image, text) with the
- * information from the model.
- *
- * @container: An icon container.
- **/
-void
-nautilus_icon_container_request_update_all (NautilusIconContainer *container)
-{
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- nautilus_icon_container_update_icon (container, p->data);
- }
-}
-
-
-
-/**
- * nautilus_icon_container_get_selection:
- * @container: An icon container.
- *
- * Get a list of the icons currently selected in @container.
- *
- * Return value: A GList of the programmer-specified data associated to each
- * selected icon, or NULL if no icon is selected. The caller is expected to
- * free the list when it is not needed anymore.
- **/
-GList *
-nautilus_icon_container_get_selection (NautilusIconContainer *container)
-{
- GList *list, *p;
-
- g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE);
-
- list = NULL;
- for (p = container->details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
- if (icon->is_selected) {
- list = g_list_prepend (list, icon->data);
- }
- }
-
- return list;
-}
-
-/**
- * nautilus_icon_container_select_all:
- * @container: An icon container widget.
- *
- * Select all the icons in @container at once.
- **/
-void
-nautilus_icon_container_select_all (NautilusIconContainer *container)
-{
- gboolean selection_changed;
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- selection_changed = FALSE;
- for (p = container->details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
- selection_changed |= icon_set_selected (container, icon, TRUE);
- }
-
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-/**
- * nautilus_icon_container_set_selection:
- * @container: An icon container widget.
- *
- * Set the selection to exactly the icons in @container which have
- * programmer data matching one of the items in @selection.
- **/
-
-void
-nautilus_icon_container_set_selection (NautilusIconContainer *container, GList *selection)
-{
- gboolean selection_changed;
- GList *p;
- gboolean select_this;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- selection_changed = FALSE;
-
- /* FIXME: Selecting n items in an m-element container is an
- O(m*n) task using this algorithm, making it quadratic if
- you select them all with this method, which actually
- happens if you select all in list view and switch to icon
- view. We should build a hash table from the list first;
- then we can get O(m+n) performance. */
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
-
- select_this = (NULL != g_list_find (selection, icon->data));
-
- selection_changed |= icon_set_selected (container, icon, select_this);
- }
-
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-
-/**
- * nautilus_icon_container_select_list_unselect_others:
- * @container: An icon container widget.
- * @list: A list of BonoboContainerIcons.
- *
- * Select only the icons in the list, deselect all others.
- **/
-void
-nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *container,
- GList *icons)
-{
- gboolean selection_changed;
- GList *p;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- /* To avoid an N^2 algorithm, we could put the icons into a hash
- table, but this should be OK for now.
- */
-
- selection_changed = FALSE;
- for (p = container->details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
- selection_changed |= icon_set_selected
- (container, icon, g_list_find (icons, icon) != NULL);
- }
-
- if (selection_changed) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-/**
- * nautilus_icon_container_unselect_all:
- * @container: An icon container widget.
- *
- * Deselect all the icons in @container.
- **/
-void
-nautilus_icon_container_unselect_all (NautilusIconContainer *container)
-{
- if (unselect_all (container)) {
- gtk_signal_emit (GTK_OBJECT (container),
- signals[SELECTION_CHANGED]);
- }
-}
-
-/**
- * nautilus_icon_container_get_icon_by_uri:
- * @container: An icon container widget.
- * @uri: The uri of an icon to find.
- *
- * Locate an icon, given the URI. The URI must match exactly.
- * Later we may have to have some way of figuring out if the
- * URI specifies the same object that does not require an exact match.
- **/
-NautilusIcon *
-nautilus_icon_container_get_icon_by_uri (NautilusIconContainer *container,
- const char *uri)
-{
- NautilusIconContainerDetails *details;
- GList *p;
-
- /* Eventually, we must avoid searching the entire icon list,
- but it's OK for now.
- A hash table mapping uri to icon is one possibility.
- */
-
- details = container->details;
-
- for (p = details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
- char *icon_uri;
- gboolean is_match;
-
- icon = p->data;
-
- icon_uri = nautilus_icon_container_get_icon_uri
- (container, icon);
- is_match = strcmp (uri, icon_uri) == 0;
- g_free (icon_uri);
-
- if (is_match) {
- return icon;
- }
- }
-
- return NULL;
-}
-
-static NautilusIcon *
-get_nth_selected_icon (NautilusIconContainer *container, int index)
-{
- GList *p;
- NautilusIcon *icon;
- int selection_count;
-
- g_return_val_if_fail (index > 0, NULL);
-
- /* Find the nth selected icon. */
- selection_count = 0;
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->is_selected) {
- if (++selection_count == index) {
- return icon;
- }
- }
- }
- return NULL;
-}
-
-static NautilusIcon *
-get_first_selected_icon (NautilusIconContainer *container)
-{
- return get_nth_selected_icon (container, 1);
-}
-
-#if 0
-
-static gboolean
-has_selection (NautilusIconContainer *container)
-{
- return get_first_selected_icon (container) != NULL;
-}
-
-#endif
-
-static gboolean
-has_multiple_selection (NautilusIconContainer *container)
-{
- return get_nth_selected_icon (container, 2) != NULL;
-}
-
-/**
- * nautilus_icon_container_show_stretch_handles:
- * @container: An icon container widget.
- *
- * Makes stretch handles visible on the first selected icon.
- **/
-void
-nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container)
-{
- NautilusIconContainerDetails *details;
- NautilusIcon *icon;
-
- icon = get_first_selected_icon (container);
- if (icon == NULL) {
- return;
- }
-
- /* Check if it already has stretch handles. */
- details = container->details;
- if (details->stretch_icon == icon) {
- return;
- }
-
- /* Get rid of the existing stretch handles and put them on the new icon. */
- if (details->stretch_icon != NULL) {
- nautilus_icon_canvas_item_set_show_stretch_handles
- (details->stretch_icon->item, FALSE);
- ungrab_stretch_icon (container);
- }
- nautilus_icon_canvas_item_set_show_stretch_handles (icon->item, TRUE);
- details->stretch_icon = icon;
-}
-
-/**
- * nautilus_icon_container_has_stretch_handles
- * @container: An icon container widget.
- *
- * Returns true if the first selected item has stretch handles.
- **/
-gboolean
-nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container)
-{
- NautilusIcon *icon;
-
- icon = get_first_selected_icon (container);
- if (icon == NULL) {
- return FALSE;
- }
-
- return icon == container->details->stretch_icon;
-}
-
-/**
- * nautilus_icon_container_is_stretched
- * @container: An icon container widget.
- *
- * Returns true if the any selected item is stretched to a size other than 1.0.
- **/
-gboolean
-nautilus_icon_container_is_stretched (NautilusIconContainer *container)
-{
- GList *p;
- NautilusIcon *icon;
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->is_selected && (icon->scale_x != 1.0 || icon->scale_y != 1.0)) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nautilus_icon_container_unstretch
- * @container: An icon container widget.
- *
- * Gets rid of any icon stretching.
- **/
-void
-nautilus_icon_container_unstretch (NautilusIconContainer *container)
-{
- GList *p;
- NautilusIcon *icon;
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
- if (icon->is_selected) {
- nautilus_icon_container_move_icon (container, icon,
- icon->x, icon->y,
- 1.0, 1.0,
- FALSE);
- }
- }
-}
-
-static void
-compute_stretch (StretchState *start,
- StretchState *current)
-{
- gboolean right, bottom;
- int x_stretch, y_stretch;
-
- /* Figure out which handle we are dragging. */
- right = start->pointer_x > start->icon_x + start->icon_size / 2;
- bottom = start->pointer_y > start->icon_y + start->icon_size / 2;
-
- /* Figure out how big we should stretch. */
- x_stretch = start->pointer_x - current->pointer_x;
- y_stretch = start->pointer_y - current->pointer_y;
- if (right) {
- x_stretch = - x_stretch;
- }
- if (bottom) {
- y_stretch = - y_stretch;
- }
- current->icon_size = MAX ((int)start->icon_size + MIN (x_stretch, y_stretch),
- (int)NAUTILUS_ICON_SIZE_SMALLEST);
-
- /* Figure out where the corner of the icon should be. */
- current->icon_x = start->icon_x;
- if (!right) {
- current->icon_x += start->icon_size - current->icon_size;
- }
- current->icon_y = start->icon_y;
- if (!bottom) {
- current->icon_y += start->icon_size - current->icon_size;
- }
-}
-
-char *
-nautilus_icon_container_get_icon_uri (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- char *uri;
-
- uri = NULL;
- gtk_signal_emit (GTK_OBJECT (container),
- signals[GET_ICON_URI],
- icon->data,
- &uri);
- return uri;
-}
-
-#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static char *
-nautilus_self_check_compute_stretch (int icon_x, int icon_y, int icon_size,
- int start_pointer_x, int start_pointer_y,
- int end_pointer_x, int end_pointer_y)
-{
- StretchState start, current;
-
- start.icon_x = icon_x;
- start.icon_y = icon_y;
- start.icon_size = icon_size;
- start.pointer_x = start_pointer_x;
- start.pointer_y = start_pointer_y;
- current.pointer_x = end_pointer_x;
- current.pointer_y = end_pointer_y;
-
- compute_stretch (&start, &current);
-
- return g_strdup_printf ("%d,%d:%d",
- current.icon_x,
- current.icon_y,
- current.icon_size);
-}
-
-void
-nautilus_self_check_icon_container (void)
-{
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_compute_stretch (0, 0, 12, 0, 0, 0, 0), "0,0:12");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_compute_stretch (0, 0, 12, 12, 12, 13, 13), "0,0:13");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_compute_stretch (0, 0, 12, 12, 12, 13, 12), "0,0:12");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_self_check_compute_stretch (100, 100, 64, 105, 105, 40, 40), "35,35:129");
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-icon-container.h b/libnautilus/nautilus-icon-container.h
deleted file mode 100644
index 82add1554..000000000
--- a/libnautilus/nautilus-icon-container.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gnome-icon-container.h - Icon container widget.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>, Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_ICON_CONTAINER_H
-#define NAUTILUS_ICON_CONTAINER_H
-
-#include <libgnomeui/gnome-canvas.h>
-#include "nautilus-icon-factory.h"
-
-typedef struct NautilusIconContainer NautilusIconContainer;
-typedef struct NautilusIconContainerClass NautilusIconContainerClass;
-typedef struct NautilusIconContainerDetails NautilusIconContainerDetails;
-
-typedef struct NautilusIconData NautilusIconData;
-
-#define NAUTILUS_ICON_CONTAINER(obj) \
- GTK_CHECK_CAST (obj, nautilus_icon_container_get_type (), NautilusIconContainer)
-#define NAUTILUS_ICON_CONTAINER_CLASS(k) \
- GTK_CHECK_CLASS_CAST (k, nautilus_icon_container_get_type (), NautilusIconListView)
-#define NAUTILUS_IS_ICON_CONTAINER(obj) \
- GTK_CHECK_TYPE (obj, nautilus_icon_container_get_type ())
-
-#define NAUTILUS_ICON_CONTAINER_ICON_DATA(pointer) \
- ((NautilusIconData *) (pointer))
-
-struct NautilusIconContainer {
- GnomeCanvas canvas;
- NautilusIconContainerDetails *details;
-};
-
-struct NautilusIconContainerClass {
- GnomeCanvasClass parent_class;
-
- int (* button_press) (NautilusIconContainer *container,
- GdkEventButton *event);
- void (* activate) (NautilusIconContainer *container,
- NautilusIconData *data);
-
- void (* context_click_selection) (NautilusIconContainer *container);
- void (* context_click_background) (NautilusIconContainer *container);
-
- void (* selection_changed) (NautilusIconContainer *container);
-
- void (* icon_changed) (NautilusIconContainer *container,
- NautilusIconData *data,
- int x, int y,
- double scale_x, double scale_y);
-
- char * (* get_container_uri) (NautilusIconContainer *container);
- gboolean (* can_accept_item) (NautilusIconContainer *container,
- const NautilusIconData *target_uri,
- const char *item_uri);
-
- /* Connect to these signals to supply information about icons.
- * They are called as needed after the icons are inserted.
- */
- NautilusScalableIcon * (* get_icon_images) (NautilusIconContainer *container,
- NautilusIconData *data,
- GList **emblem_images,
- const char *modifier);
- char * (* get_icon_text) (NautilusIconContainer *container,
- NautilusIconData *data);
- char * (* get_icon_uri) (NautilusIconContainer *container,
- NautilusIconData *data);
- char * (* get_icon_property) (NautilusIconContainer *container,
- NautilusIconData *data,
- const char *property_name);
- void (* move_copy_items) (NautilusIconContainer *container,
- const GList *item_uris,
- const GdkPoint *relative_item_points,
- const char *target_uri,
- int copy_action,
- int x,
- int y);
-};
-
-/* GtkObject */
-guint nautilus_icon_container_get_type (void);
-GtkWidget *nautilus_icon_container_new (void);
-
-/* adding, removing, and managing icons */
-void nautilus_icon_container_clear (NautilusIconContainer *view);
-void nautilus_icon_container_add (NautilusIconContainer *view,
- NautilusIconData *data,
- int x,
- int y,
- double scale_x,
- double scale_y);
-void nautilus_icon_container_add_auto (NautilusIconContainer *view,
- NautilusIconData *data);
-gboolean nautilus_icon_container_remove (NautilusIconContainer *view,
- NautilusIconData *data);
-void nautilus_icon_container_request_update (NautilusIconContainer *view,
- NautilusIconData *data);
-void nautilus_icon_container_request_update_all (NautilusIconContainer *container);
-
-/* operations on all icons */
-void nautilus_icon_container_relayout (NautilusIconContainer *view);
-void nautilus_icon_container_line_up (NautilusIconContainer *view);
-void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
-void nautilus_icon_container_select_all (NautilusIconContainer *view);
-
-/* operations on the selection */
-GList *nautilus_icon_container_get_selection (NautilusIconContainer *view);
-void nautilus_icon_container_set_selection (NautilusIconContainer *view, GList *selection);
-gboolean nautilus_icon_container_has_stretch_handles (NautilusIconContainer *container);
-gboolean nautilus_icon_container_is_stretched (NautilusIconContainer *container);
-void nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container);
-void nautilus_icon_container_unstretch (NautilusIconContainer *container);
-
-
-/* options */
-int nautilus_icon_container_get_zoom_level (NautilusIconContainer *view);
-void nautilus_icon_container_set_zoom_level (NautilusIconContainer *view,
- int new_zoom_level);
-void nautilus_icon_container_enable_linger_selection (NautilusIconContainer *view,
- gboolean enable);
-
-
-#endif
diff --git a/libnautilus/nautilus-icon-dnd.c b/libnautilus/nautilus-icon-dnd.c
deleted file mode 100644
index 66d08fcfe..000000000
--- a/libnautilus/nautilus-icon-dnd.c
+++ /dev/null
@@ -1,1407 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-icon-dnd.c - Drag & drop handling for the icon container widget.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>,
- Darin Adler <darin@eazel.com>,
- Andy Hertzfeld <andy@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-icon-dnd.h"
-
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gtk-extensions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-gnome-extensions.h"
-#include "nautilus-background.h"
-#include "nautilus-graphic-effects.h"
-
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "nautilus-icon-private.h"
-
-static int nautilus_icon_drag_key_callback (GtkWidget *widget,
- GdkEventKey *event,
- gpointer data);
-static gboolean drag_drop_callback (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint32 time,
- gpointer data);
-static void nautilus_icon_dnd_update_drop_target (NautilusIconContainer *container,
- GdkDragContext *context,
- int x,
- int y);
-static gboolean drag_motion_callback (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint32 time);
-
-
-typedef struct {
- char *uri;
- gboolean got_icon_position;
- int icon_x, icon_y;
- int icon_width, icon_height;
-} DndSelectionItem;
-
-static GtkTargetEntry drag_types [] = {
- { NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
- { NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
- { NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL }
-};
-
-static GtkTargetEntry drop_types [] = {
- { NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
- { NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
- { NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
- { NAUTILUS_ICON_DND_COLOR_TYPE, 0, NAUTILUS_ICON_DND_COLOR }
-};
-
-static GnomeCanvasItem *
-create_selection_shadow (NautilusIconContainer *container,
- GList *list)
-{
- GnomeCanvasGroup *group;
- GnomeCanvas *canvas;
- GdkBitmap *stipple;
- int max_x, max_y;
- int min_x, min_y;
- GList *p;
- double pixels_per_unit;
-
- if (list == NULL) {
- return NULL;
- }
-
- /* if we're only dragging a single item, don't worry about the shadow */
- if (list->next == NULL) {
- return NULL;
- }
-
- stipple = container->details->dnd_info->stipple;
- g_return_val_if_fail (stipple != NULL, NULL);
-
- canvas = GNOME_CANVAS (container);
-
- /* Creating a big set of rectangles in the canvas can be expensive, so
- we try to be smart and only create the maximum number of rectangles
- that we will need, in the vertical/horizontal directions. */
-
- /* FIXME: Does this work properly if the window is scrolled? */
- max_x = GTK_WIDGET (container)->allocation.width;
- min_x = -max_x;
-
- max_y = GTK_WIDGET (container)->allocation.height;
- min_y = -max_y;
-
- /* Create a group, so that it's easier to move all the items around at
- once. */
- group = GNOME_CANVAS_GROUP
- (gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
- gnome_canvas_group_get_type (),
- NULL));
-
- pixels_per_unit = canvas->pixels_per_unit;
- for (p = list; p != NULL; p = p->next) {
- DndSelectionItem *item;
- int x1, y1, x2, y2;
-
- item = p->data;
-
- if (!item->got_icon_position) {
- continue;
- }
-
- x1 = item->icon_x;
- y1 = item->icon_y;
- x2 = x1 + item->icon_width;
- y2 = y1 + item->icon_height;
-
- if (x2 >= min_x && x1 <= max_x && y2 >= min_y && y1 <= max_y)
- gnome_canvas_item_new
- (group,
- gnome_canvas_rect_get_type (),
- "x1", (double) x1 / pixels_per_unit,
- "y1", (double) y1 / pixels_per_unit,
- "x2", (double) x2 / pixels_per_unit,
- "y2", (double) y2 / pixels_per_unit,
- "outline_color", "black",
- "outline_stipple", stipple,
- "width_pixels", 1,
- NULL);
- }
-
- return GNOME_CANVAS_ITEM (group);
-}
-
-/* Set the affine instead of the x and y position.
- * Simple, and setting x and y was broken at one point.
- */
-static void
-set_shadow_position (GnomeCanvasItem *shadow,
- double x, double y)
-{
- double affine[6];
-
- affine[0] = 1.0;
- affine[1] = 0.0;
- affine[2] = 0.0;
- affine[3] = 1.0;
- affine[4] = x;
- affine[5] = y;
-
- gnome_canvas_item_affine_absolute (shadow, affine);
-}
-
-
-
-/* Functions to deal with DndSelectionItems. */
-
-static DndSelectionItem *
-dnd_selection_item_new (void)
-{
- DndSelectionItem *new;
-
- new = g_new0 (DndSelectionItem, 1);
-
- return new;
-}
-
-static void
-dnd_selection_item_destroy (DndSelectionItem *item)
-{
- g_free (item->uri);
- g_free (item);
-}
-
-static void
-destroy_selection_list (GList *list)
-{
- GList *p;
-
- if (list == NULL)
- return;
-
- for (p = list; p != NULL; p = p->next)
- dnd_selection_item_destroy (p->data);
-
- g_list_free (list);
-}
-
-/* Source-side handling of the drag. */
-
-/* Encode a "special/x-gnome-icon-list" selection.
- Along with the URIs of the dragged files, this encodes
- the location and size of each icon relative to the cursor.
-*/
-static void
-set_gnome_icon_list_selection (NautilusIconContainer *container,
- GtkSelectionData *selection_data)
-{
- NautilusIconContainerDetails *details;
- GList *p;
- GString *data;
-
- details = container->details;
-
- data = g_string_new (NULL);
- for (p = details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
- ArtDRect world_rect;
- ArtIRect window_rect;
- char *uri;
- char *s;
-
- icon = p->data;
- if (!icon->is_selected) {
- continue;
- }
-
- nautilus_icon_canvas_item_get_icon_rectangle
- (icon->item, &world_rect);
- nautilus_gnome_canvas_world_to_window_rectangle
- (GNOME_CANVAS (container), &world_rect, &window_rect);
-
- uri = nautilus_icon_container_get_icon_uri (container, icon);
-
- if (uri == NULL) {
- g_warning ("no URI for one of the dragged items");
- } else {
- s = g_strdup_printf ("%s\r%d:%d:%hu:%hu\r\n",
- uri,
- (int) (window_rect.x0 - details->dnd_info->start_x),
- (int) (window_rect.y0 - details->dnd_info->start_y),
- window_rect.x1 - window_rect.x0,
- window_rect.y1 - window_rect.y0);
-
- g_free (uri);
-
- g_string_append (data, s);
- g_free (s);
- }
- }
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8, data->str, data->len);
-
- g_string_free (data, TRUE);
-}
-
-/* Encode a "text/uri-list" selection. */
-static void
-set_uri_list_selection (NautilusIconContainer *container,
- GtkSelectionData *selection_data)
-{
- NautilusIconContainerDetails *details;
- GList *p;
- char *uri;
- GString *data;
-
- details = container->details;
-
- data = g_string_new (NULL);
-
- for (p = details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
-
- icon = p->data;
- if (!icon->is_selected)
- continue;
-
- uri = nautilus_icon_container_get_icon_uri (container, icon);
- g_string_append (data, uri);
- g_free (uri);
-
- g_string_append (data, "\r\n");
- }
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8, data->str, data->len);
-
- g_string_free (data, TRUE);
-}
-
-static void
-drag_data_get_callback (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint32 time,
- gpointer data)
-{
- NautilusIconContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (widget));
- g_return_if_fail (context != NULL);
-
- container = NAUTILUS_ICON_CONTAINER (widget);
-
- switch (info) {
- case NAUTILUS_ICON_DND_GNOME_ICON_LIST:
- set_gnome_icon_list_selection (container, selection_data);
- break;
- case NAUTILUS_ICON_DND_URI_LIST:
- set_uri_list_selection (container, selection_data);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-/* Target-side handling of the drag. */
-
-static void
-get_gnome_icon_list_selection (NautilusIconContainer *container,
- GtkSelectionData *data)
-{
- NautilusIconDndInfo *dnd_info;
- const guchar *p, *oldp;
- int size;
-
- dnd_info = container->details->dnd_info;
-
- oldp = data->data;
- size = data->length;
-
- while (size > 0) {
- DndSelectionItem *item;
- guint len;
-
- /* The list is in the form:
-
- name\rx:y:width:height\r\n
-
- The geometry information after the first \r is optional. */
-
- /* 1: Decode name. */
-
- p = memchr (oldp, '\r', size);
- if (p == NULL) {
- break;
- }
-
- item = dnd_selection_item_new ();
-
- len = p - oldp;
-
- item->uri = g_malloc (len + 1);
- memcpy (item->uri, oldp, len);
- item->uri[len] = 0;
-
- p++;
- if (*p == '\n' || *p == '\0') {
- dnd_info->selection_list
- = g_list_prepend (dnd_info->selection_list,
- item);
- if (p == 0) {
- g_warning ("Invalid special/x-gnome-icon-list data received: "
- "missing newline character.");
- break;
- } else {
- oldp = p + 1;
- continue;
- }
- }
-
- size -= p - oldp;
- oldp = p;
-
- /* 2: Decode geometry information. */
-
- item->got_icon_position = sscanf (p, "%d:%d:%d:%d%*s",
- &item->icon_x, &item->icon_y,
- &item->icon_width, &item->icon_height) == 4;
- if (!item->got_icon_position) {
- g_warning ("Invalid special/x-gnome-icon-list data received: "
- "invalid icon position specification.");
- }
-
- dnd_info->selection_list
- = g_list_prepend (dnd_info->selection_list, item);
-
- p = memchr (p, '\r', size);
- if (p == NULL || p[1] != '\n') {
- g_warning ("Invalid special/x-gnome-icon-list data received: "
- "missing newline character.");
- if (p == NULL) {
- break;
- }
- } else {
- p += 2;
- }
-
- size -= p - oldp;
- oldp = p;
- }
-}
-
-static void
-nautilus_icon_container_position_shadow (NautilusIconContainer *container,
- int x, int y)
-{
- GnomeCanvasItem *shadow;
- double world_x, world_y;
-
- shadow = container->details->dnd_info->shadow;
- if (shadow == NULL) {
- return;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- x, y, &world_x, &world_y);
- set_shadow_position (shadow, world_x, world_y);
- gnome_canvas_item_show (shadow);
-}
-
-static void
-nautilus_icon_container_dropped_icon_feedback (GtkWidget *widget,
- GtkSelectionData *data,
- int x, int y)
-{
- NautilusIconContainer *container;
- NautilusIconDndInfo *dnd_info;
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- dnd_info = container->details->dnd_info;
-
- /* Delete old selection list if any. */
- if (dnd_info->selection_list != NULL) {
- destroy_selection_list (dnd_info->selection_list);
- dnd_info->selection_list = NULL;
- }
-
- /* Delete old shadow if any. */
- if (dnd_info->shadow != NULL) {
- gtk_object_destroy (GTK_OBJECT (dnd_info->shadow));
- }
-
- /* Build the selection list and the shadow. */
- get_gnome_icon_list_selection (container, data);
- dnd_info->shadow = create_selection_shadow (container, dnd_info->selection_list);
- nautilus_icon_container_position_shadow (container, x, y);
-}
-
-static void
-drag_data_received_callback (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- GtkSelectionData *data,
- guint info,
- guint32 time,
- gpointer user_data)
-{
- NautilusIconDndInfo *dnd_info;
-
- dnd_info = NAUTILUS_ICON_CONTAINER (widget)->details->dnd_info;
-
- dnd_info->got_data_type = TRUE;
- dnd_info->data_type = info;
-
- switch (info) {
- case NAUTILUS_ICON_DND_GNOME_ICON_LIST:
- nautilus_icon_container_dropped_icon_feedback (widget, data, x, y);
- break;
- case NAUTILUS_ICON_DND_COLOR:
- /* Save the data so we can do the actual work on drop. */
- dnd_info->selection_data = nautilus_gtk_selection_data_copy_deep (data);
- break;
- default:
- break;
- }
-}
-
-static void
-nautilus_icon_container_ensure_drag_data (NautilusIconContainer *container,
- GdkDragContext *context,
- guint32 time)
-{
- NautilusIconDndInfo *dnd_info;
-
- dnd_info = container->details->dnd_info;
-
- if (!dnd_info->got_data_type) {
- gtk_drag_get_data (GTK_WIDGET (container), context,
- GPOINTER_TO_INT (context->targets->data),
- time);
- }
-}
-
-static void
-drag_end_callback (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
-{
- NautilusIconContainer *container;
- NautilusIconDndInfo *dnd_info;
-
- container = NAUTILUS_ICON_CONTAINER (widget);
- dnd_info = container->details->dnd_info;
-
- destroy_selection_list (dnd_info->selection_list);
- dnd_info->selection_list = NULL;
-}
-
-static NautilusIcon *
-nautilus_icon_container_item_at (NautilusIconContainer *container,
- int x, int y)
-{
- GList *p;
- ArtDRect point;
-
- /* hit test a single pixel rectangle */
- point.x0 = x;
- point.y0 = y;
- point.x1 = x + 1;
- point.y1 = y + 1;
-
- for (p = container->details->icons; p != NULL; p = p->next) {
- NautilusIcon *icon;
- icon = p->data;
- if (nautilus_icon_canvas_item_hit_test_rectangle
- (icon->item, &point)) {
- return icon;
- }
- }
-
- return NULL;
-}
-
-static char *
-get_container_uri (const NautilusIconContainer *container)
-{
- char *uri;
-
- /* get the URI associated with the container */
- uri = NULL;
- gtk_signal_emit_by_name (GTK_OBJECT (container),
- "get_container_uri",
- &uri);
- return uri;
-}
-
-static gboolean
-uri_is_parent (const GnomeVFSURI *parent, const GnomeVFSURI *item)
-{
- /* FIXME:
- * consider making this a gnome-vfs call
- */
-
- gboolean result;
- GnomeVFSURI *item_parent_uri;
-
- item_parent_uri = gnome_vfs_uri_get_parent (item);
-
- if (item_parent_uri == NULL)
- return FALSE;
-
- result = gnome_vfs_uri_equal (item_parent_uri, parent);
- gnome_vfs_uri_unref (item_parent_uri);
-
- return result;
-}
-
-static gboolean
-nautilus_icon_container_selection_items_local (const NautilusIconContainer *container,
- const GList *items)
-{
- /* check if the first item on the list has the container as a parent
- * we should really test each item but that would be slow for large selections
- * and currently dropped items can only be from the same container
- */
- char *container_uri_string;
- GnomeVFSURI *container_uri;
- GnomeVFSURI *item_uri;
- gboolean result;
-
- /* must have at least one item */
- g_assert (items);
-
- result = FALSE;
-
- /* get the URI associated with the container */
- container_uri_string = get_container_uri (container);
- g_assert (container_uri_string);
- container_uri = gnome_vfs_uri_new (container_uri_string);
-
- /* get the parent URI of the first item in the selection */
- item_uri = gnome_vfs_uri_new (((DndSelectionItem *)items->data)->uri);
- result = uri_is_parent (container_uri, item_uri);
-
- gnome_vfs_uri_unref (item_uri);
- gnome_vfs_uri_unref (container_uri);
- g_free (container_uri_string);
-
- return result;
-}
-
-static gboolean
-nautilus_icon_canvas_item_can_accept_item (NautilusIconContainer *container,
- const NautilusIcon *drop_target_item,
- const char *item_uri)
-{
- gboolean result;
-
- gtk_signal_emit_by_name (GTK_OBJECT (container),
- "can_accept_item",
- drop_target_item->data,
- item_uri,
- &result);
- return result;
-}
-
-static gboolean
-nautilus_icon_canvas_item_can_accept_items (NautilusIconContainer *container,
- const NautilusIcon *drop_target_item,
- const GList *items)
-{
- int max;
-
- /* Iterate through selection checking if item will get accepted by the
- * drop target. If more than 100 items selected, return an over-optimisic
- * result
- */
- for (max = 100; items != NULL && max >=0 ; items = items->next, max--) {
- if (!nautilus_icon_canvas_item_can_accept_item (container, drop_target_item,
- ((DndSelectionItem *)items->data)->uri)) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-receive_dropped_tile_image (NautilusIconContainer *container)
-{
- GList *list;
-
- /* We only accept the image if it's the only thing dragged. */
- list = container->details->dnd_info->selection_list;
- g_assert (list != NULL);
- if (list->next != NULL) {
- return;
- }
-
- nautilus_background_set_tile_image_uri
- (nautilus_get_widget_background (GTK_WIDGET (container)),
- ((DndSelectionItem *) list->data)->uri);
-}
-
-static void
-nautilus_icon_container_receive_dropped_icons (NautilusIconContainer *container,
- GdkDragContext *context,
- int x, int y)
-{
- GList *p;
- NautilusIcon *drop_target_icon;
- gboolean local_move_only;
- DndSelectionItem *item;
- NautilusIcon *icon;
- GList *source_uris;
- char *target_uri;
- double world_x, world_y;
- GdkPoint *source_item_locations;
- int index;
- int count;
- GdkModifierType modifiers;
-
- if (container->details->dnd_info->selection_list == NULL) {
- return;
- }
-
- /* If the shift key is down, then this is a drag that customizes
- * the background tile image.
- */
- gdk_window_get_pointer (GTK_WIDGET (container)->window,
- NULL, NULL, &modifiers);
- if ((modifiers & GDK_SHIFT_MASK) != 0) {
- receive_dropped_tile_image (container);
- return;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- x, y, &world_x, &world_y);
-
- /* find the item we hit with our drop, if any */
- drop_target_icon = nautilus_icon_container_item_at (container, world_x, world_y);
- if (drop_target_icon != NULL && !nautilus_icon_canvas_item_can_accept_items
- (container, drop_target_icon, container->details->dnd_info->selection_list)) {
- /* the item we dropped our selection on cannot accept the items,
- * do the same thing as if we just dropped the items on the canvas
- */
- drop_target_icon = NULL;
- }
-
- local_move_only = FALSE;
- if (drop_target_icon == NULL && context->action == GDK_ACTION_MOVE) {
- /* we can just move the icon positions if the move ended up in
- * the item's parent container
- */
- local_move_only = nautilus_icon_container_selection_items_local
- (container, container->details->dnd_info->selection_list);
- }
-
- if (local_move_only) {
- GList *icons_to_select;
-
- icons_to_select = NULL;
-
- /* handle the simple case -- just change item locations */
- for (p = container->details->dnd_info->selection_list; p != NULL; p = p->next) {
- item = p->data;
- icon = nautilus_icon_container_get_icon_by_uri
- (container, item->uri);
-
- if (item->got_icon_position) {
-
- nautilus_icon_container_move_icon
- (container, icon,
- world_x + item->icon_x, world_y + item->icon_y,
- icon->scale_x, icon->scale_y,
- TRUE);
-
- }
- icons_to_select = g_list_prepend (icons_to_select, icon);
- }
- if (icons_to_select != NULL) {
- nautilus_icon_container_select_list_unselect_others (container,
- icons_to_select);
- g_list_free (icons_to_select);
- }
- } else {
- source_uris = NULL;
- target_uri = NULL;
- source_item_locations = NULL;
-
- /* get the URI of either the item or the container we hit */
- if (drop_target_icon != NULL) {
- target_uri = nautilus_icon_container_get_icon_uri
- (container, drop_target_icon);
- } else {
- target_uri = get_container_uri (container);
-
- }
-
- count = 0;
- for (p = container->details->dnd_info->selection_list; p != NULL; p = p->next) {
- /* do a shallow copy of all the uri strings of the copied files */
- source_uris = g_list_append (source_uris, ((DndSelectionItem *)p->data)->uri);
- /* count the number of items as we go */
- count++;
- }
-
- if (drop_target_icon != NULL) {
- /* drop onto a container, pass allong the item points to allow placing
- * the items in their same relative positions in the new container
- */
- source_item_locations = g_new (GdkPoint, count);
- for (index = 0, p = container->details->dnd_info->selection_list; p != NULL;
- index++, p = p->next) {
- /* FIXME:
- * subtract the original click coordinates from each point here
- */
- source_item_locations[index].x = ((DndSelectionItem *)p->data)->icon_x;
- source_item_locations[index].y = ((DndSelectionItem *)p->data)->icon_y;
- }
- }
-
- if (source_uris != NULL) {
- /* start the copy */
- gtk_signal_emit_by_name (GTK_OBJECT (container), "move_copy_items",
- source_uris,
- source_item_locations,
- target_uri,
- context->action,
- x, y);
- g_list_free (source_uris);
- g_free (source_item_locations);
- }
- g_free (target_uri);
- }
-
- destroy_selection_list (container->details->dnd_info->selection_list);
- container->details->dnd_info->selection_list = NULL;
-}
-
-static void
-set_drop_target (NautilusIconContainer *container,
- NautilusIcon *icon)
-{
- NautilusIcon *old_icon;
-
- /* Check if current drop target changed, update icon drop higlight if needed. */
- old_icon = container->details->drop_target;
- if (icon == old_icon) {
- return;
- }
-
- /* Remember the new drop target for the next round. */
- container->details->drop_target = icon;
- nautilus_icon_container_update_icon (container, old_icon);
- nautilus_icon_container_update_icon (container, icon);
-}
-
-static void
-nautilus_icon_dnd_update_drop_target (NautilusIconContainer *container,
- GdkDragContext *context,
- int x, int y)
-{
- NautilusIcon *icon;
- double world_x, world_y;
-
- g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
- if (container->details->dnd_info->selection_list == NULL) {
- return;
- }
-
- gnome_canvas_window_to_world (GNOME_CANVAS (container),
- x, y, &world_x, &world_y);
-
- /* Find the item we hit with our drop, if any. */
- icon = nautilus_icon_container_item_at (container, world_x, world_y);
-
- /* Find if target icon accepts our drop. */
- if (icon != NULL && !nautilus_icon_canvas_item_can_accept_items
- (container, icon, container->details->dnd_info->selection_list)) {
- icon = NULL;
- }
-
- set_drop_target (container, icon);
-}
-
-static void
-nautilus_icon_container_free_drag_data (NautilusIconContainer *container)
-{
- NautilusIconDndInfo *dnd_info;
-
- dnd_info = container->details->dnd_info;
-
- dnd_info->got_data_type = FALSE;
-
- if (dnd_info->shadow != NULL) {
- gtk_object_destroy (GTK_OBJECT (dnd_info->shadow));
- dnd_info->shadow = NULL;
- }
-
- if (dnd_info->selection_data != NULL) {
- nautilus_gtk_selection_data_free_deep (dnd_info->selection_data);
- dnd_info->selection_data = NULL;
- }
-}
-
-static void
-drag_leave_callback (GtkWidget *widget,
- GdkDragContext *context,
- guint32 time,
- gpointer data)
-{
- NautilusIconDndInfo *dnd_info;
-
- dnd_info = NAUTILUS_ICON_CONTAINER (widget)->details->dnd_info;
-
- if (dnd_info->shadow != NULL)
- gnome_canvas_item_hide (dnd_info->shadow);
-}
-
-/* During drag&drop keep a saved pointer to the private drag context.
- * We also replace the severely broken gtk_drag_get_event_actions.
- * To do this we copy a lot of code from gtkdnd.c.
- *
- * This is a hack-workaround to deal with the inability to override
- * drag action feedback in gtk and will be removed once the appropriate
- * interface gets added to gtkdnd to do this in a clean way.
- * For now we need to mirror the code here
- * to allow us to control the drop action based on the modifier
- * key state, drop target and other drag&drop state.
- *
- * FIXME:
- */
-
-typedef struct GtkDragDestInfo GtkDragDestInfo;
-typedef struct GtkDragStatus GtkDragStatus;
-
-typedef struct GtkDragSourceInfo
-{
- GtkWidget *widget;
- GtkTargetList *target_list; /* Targets for drag data */
- GdkDragAction possible_actions; /* Actions allowed by source */
- GdkDragContext *context; /* drag context */
- GtkWidget *icon_window; /* Window for drag */
- GtkWidget *ipc_widget; /* GtkInvisible for grab, message passing */
- GdkCursor *cursor; /* Cursor for drag */
- gint hot_x, hot_y; /* Hot spot for drag */
- gint button; /* mouse button starting drag */
-
- gint status; /* drag status !!! GtkDragStatus in real life*/
- GdkEvent *last_event; /* motion event waiting for response */
-
- gint start_x, start_y; /* Initial position */
- gint cur_x, cur_y; /* Current Position */
-
- GList *selections; /* selections we've claimed */
-
- GtkDragDestInfo *proxy_dest; /* Set if this is a proxy drag */
-
- guint drop_timeout; /* Timeout for aborting drop */
- guint destroy_icon : 1; /* If true, destroy icon_window
- */
-} GtkDragSourceInfo;
-static GtkDragSourceInfo *saved_drag_source_info;
-
-void
-nautilus_icon_dnd_init (NautilusIconContainer *container,
- GdkBitmap *stipple)
-{
- NautilusIconDndInfo *dnd_info;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- dnd_info = g_new0 (NautilusIconDndInfo, 1);
-
- dnd_info->target_list = gtk_target_list_new (drag_types,
- NAUTILUS_N_ELEMENTS (drag_types));
-
- dnd_info->stipple = gdk_bitmap_ref (stipple);
-
- /* Set up the widget as a drag destination.
- * (But not a source, as drags starting from this widget will be
- * implemented by dealing with events manually.)
- */
- gtk_drag_dest_set (GTK_WIDGET (container),
- 0,
- drop_types, NAUTILUS_N_ELEMENTS (drop_types),
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- /* Messages for outgoing drag. */
- gtk_signal_connect (GTK_OBJECT (container), "drag_data_get",
- GTK_SIGNAL_FUNC (drag_data_get_callback), NULL);
- gtk_signal_connect (GTK_OBJECT (container), "drag_end",
- GTK_SIGNAL_FUNC (drag_end_callback), NULL);
-
- /* Messages for incoming drag. */
- gtk_signal_connect (GTK_OBJECT (container), "drag_data_received",
- GTK_SIGNAL_FUNC (drag_data_received_callback), NULL);
- gtk_signal_connect (GTK_OBJECT (container), "drag_motion",
- GTK_SIGNAL_FUNC (drag_motion_callback), NULL);
- gtk_signal_connect (GTK_OBJECT (container), "drag_drop",
- GTK_SIGNAL_FUNC (drag_drop_callback), NULL);
- gtk_signal_connect (GTK_OBJECT (container), "drag_leave",
- GTK_SIGNAL_FUNC (drag_leave_callback), NULL);
-
- container->details->dnd_info = dnd_info;
- saved_drag_source_info = NULL;
-
-}
-
-void
-nautilus_icon_dnd_fini (NautilusIconContainer *container)
-{
- NautilusIconDndInfo *dnd_info;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- dnd_info = container->details->dnd_info;
- g_return_if_fail (dnd_info != NULL);
-
- gtk_target_list_unref (dnd_info->target_list);
- destroy_selection_list (dnd_info->selection_list);
-
- if (dnd_info->shadow != NULL)
- gtk_object_destroy (GTK_OBJECT (dnd_info->shadow));
-
- gdk_bitmap_unref (dnd_info->stipple);
-
- g_free (dnd_info);
-}
-
-
-static GtkDragSourceInfo *
-nautilus_icon_dnd_get_drag_source_info (GtkWidget *widget, GdkDragContext *context)
-{
- if (context == NULL)
- return NULL;
-
- return g_dataset_get_data (context, "gtk-info");
-}
-
-void
-nautilus_icon_dnd_begin_drag (NautilusIconContainer *container,
- GdkDragAction actions,
- int button,
- GdkEventMotion *event)
-{
- NautilusIconDndInfo *dnd_info;
- GnomeCanvas *canvas;
- GdkDragContext *context;
- GdkPixbuf *pixbuf, *transparent_pixbuf;
- GdkPixmap *pixmap_for_dragged_file;
- GdkBitmap *mask_for_dragged_file;
- int x_offset, y_offset;
- ArtDRect world_rect;
- ArtIRect window_rect;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
- g_return_if_fail (event != NULL);
-
- dnd_info = container->details->dnd_info;
- g_return_if_fail (dnd_info != NULL);
-
- /* Notice that the event is in world coordinates, because of
- the way the canvas handles events.
- */
- canvas = GNOME_CANVAS (container);
- gnome_canvas_world_to_window (canvas,
- event->x, event->y,
- &dnd_info->start_x, &dnd_info->start_y);
-
- /* start the drag */
- context = gtk_drag_begin (GTK_WIDGET (container),
- dnd_info->target_list,
- actions,
- button,
- (GdkEvent *) event);
-
- /* set up state for overriding the broken gtk_drag_get_event_actions call */
- saved_drag_source_info = nautilus_icon_dnd_get_drag_source_info (GTK_WIDGET (container), context);
- g_assert (saved_drag_source_info != NULL);
-
- gtk_signal_connect (GTK_OBJECT (saved_drag_source_info ? saved_drag_source_info->ipc_widget : NULL), "key_press_event",
- GTK_SIGNAL_FUNC (nautilus_icon_drag_key_callback), saved_drag_source_info);
- gtk_signal_connect (GTK_OBJECT (saved_drag_source_info ? saved_drag_source_info->ipc_widget : NULL), "key_release_event",
- GTK_SIGNAL_FUNC (nautilus_icon_drag_key_callback), saved_drag_source_info);
-
- /* create a pixmap and mask to drag with */
- pixbuf = nautilus_icon_canvas_item_get_image (container->details->drag_icon->item, NULL);
-
- /* unfortunately, X is very slow when using a stippled mask, so only use the stipple
- for relatively small pixbufs. Eventually, we may have to remove this entirely
- for UI consistency reasons */
-
- if (gdk_pixbuf_get_width(pixbuf) * gdk_pixbuf_get_height(pixbuf) < 4096) {
- transparent_pixbuf = nautilus_make_semi_transparent (pixbuf);
- } else {
- gdk_pixbuf_ref (pixbuf);
- transparent_pixbuf = pixbuf;
- }
-
- gdk_pixbuf_render_pixmap_and_mask (transparent_pixbuf,
- &pixmap_for_dragged_file,
- &mask_for_dragged_file,
- 128);
-
- gdk_pixbuf_unref (transparent_pixbuf);
-
- /* compute the image's offset */
- nautilus_icon_canvas_item_get_icon_rectangle
- (container->details->drag_icon->item, &world_rect);
- nautilus_gnome_canvas_world_to_window_rectangle
- (canvas, &world_rect, &window_rect);
- x_offset = dnd_info->start_x - window_rect.x0;
- y_offset = dnd_info->start_y - window_rect.y0;
-
- /* set the pixmap and mask for dragging */
- gtk_drag_set_icon_pixmap (context,
- gtk_widget_get_colormap (GTK_WIDGET (container)),
- pixmap_for_dragged_file,
- mask_for_dragged_file,
- x_offset, y_offset);
-}
-
-static gboolean
-drag_motion_callback (GtkWidget *widget,
- GdkDragContext *context,
- int x, int y,
- guint32 time)
-{
- nautilus_icon_dnd_update_drop_action (widget);
- nautilus_icon_container_ensure_drag_data (NAUTILUS_ICON_CONTAINER (widget), context, time);
- nautilus_icon_container_position_shadow (NAUTILUS_ICON_CONTAINER (widget), x, y);
- nautilus_icon_dnd_update_drop_target (NAUTILUS_ICON_CONTAINER (widget), context, x, y);
-
- gdk_drag_status (context, context->suggested_action, time);
-
- return TRUE;
-}
-
-static gboolean
-drag_drop_callback (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint32 time,
- gpointer data)
-{
- NautilusIconDndInfo *dnd_info;
-
- dnd_info = NAUTILUS_ICON_CONTAINER (widget)->details->dnd_info;
-
- nautilus_icon_container_ensure_drag_data (NAUTILUS_ICON_CONTAINER (widget), context, time);
-
- g_assert (dnd_info->got_data_type);
- switch (dnd_info->data_type) {
- case NAUTILUS_ICON_DND_GNOME_ICON_LIST:
- nautilus_icon_container_receive_dropped_icons
- (NAUTILUS_ICON_CONTAINER (widget),
- context, x, y);
- gtk_drag_finish (context, TRUE, FALSE, time);
- break;
- case NAUTILUS_ICON_DND_COLOR:
- nautilus_background_receive_dropped_color
- (nautilus_get_widget_background (widget),
- widget, x, y, dnd_info->selection_data);
- gtk_drag_finish (context, TRUE, FALSE, time);
- break;
- default:
- gtk_drag_finish (context, FALSE, FALSE, time);
- }
-
- nautilus_icon_container_free_drag_data (NAUTILUS_ICON_CONTAINER (widget));
-
- if (saved_drag_source_info != NULL) {
- gtk_signal_disconnect_by_func (GTK_OBJECT (saved_drag_source_info->ipc_widget),
- GTK_SIGNAL_FUNC (nautilus_icon_drag_key_callback),
- saved_drag_source_info);
- }
-
- saved_drag_source_info = NULL;
-
- set_drop_target (NAUTILUS_ICON_CONTAINER (widget), NULL);
-
- return FALSE;
-}
-
-void
-nautilus_icon_dnd_end_drag (NautilusIconContainer *container)
-{
- NautilusIconDndInfo *dnd_info;
-
- g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
-
- dnd_info = container->details->dnd_info;
- g_return_if_fail (dnd_info != NULL);
-
- /* Do nothing.
- * Can that possibly be right?
- */
-}
-
-static int
-nautilus_icon_dnd_modifier_based_action ()
-{
- GdkModifierType modifiers;
- gdk_window_get_pointer (NULL, NULL, NULL, &modifiers);
-
- if ((modifiers & GDK_MOD1_MASK) != 0) {
- return GDK_ACTION_COPY;
-#if 0
- /* FIXME:
- * don't know how to do links yet
- */
- } else if ((modifiers & GDK_CONTROL_MASK) != 0) {
- return GDK_ACTION_LINK;
-#endif
- }
-
- return GDK_ACTION_MOVE;
-}
-
-void
-nautilus_icon_dnd_update_drop_action (GtkWidget *widget)
-{
- if (saved_drag_source_info == NULL)
- return;
-
- saved_drag_source_info->possible_actions = nautilus_icon_dnd_modifier_based_action ();
-}
-
-/* Replacement for broken gtk_drag_get_event_actions */
-
-static void
-nautilus_icon_dnd_get_event_actions (GdkEvent *event,
- gint button,
- GdkDragAction actions,
- GdkDragAction *suggested_action,
- GdkDragAction *possible_actions)
-{
- *suggested_action = nautilus_icon_dnd_modifier_based_action ();
- *possible_actions = *suggested_action;
-}
-
-/* Copied from gtkdnd.c to work around broken gtk_drag_get_event_actions */
-
-static guint32
-nautilus_icon_dnd_get_event_time (GdkEvent *event)
-{
- guint32 tm = GDK_CURRENT_TIME;
-
- if (event)
- switch (event->type)
- {
- case GDK_MOTION_NOTIFY:
- tm = event->motion.time; break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- tm = event->button.time; break;
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- tm = event->key.time; break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- tm = event->crossing.time; break;
- case GDK_PROPERTY_NOTIFY:
- tm = event->property.time; break;
- case GDK_SELECTION_CLEAR:
- case GDK_SELECTION_REQUEST:
- case GDK_SELECTION_NOTIFY:
- tm = event->selection.time; break;
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- tm = event->proximity.time; break;
- default: /* use current time */
- break;
- }
-
- return tm;
-}
-
-/* Copied from gtkdnd.c to work around broken gtk_drag_get_event_actions */
-
-enum {
- TARGET_MOTIF_SUCCESS = 0x40000000,
- TARGET_MOTIF_FAILURE,
- TARGET_DELETE
-};
-
-/* Copied from gtkdnd.c to work around broken gtk_drag_get_event_actions */
-
-static void
-nautilus_icon_dnd_source_check_selection (GtkDragSourceInfo *info,
- GdkAtom selection,
- guint32 time)
-{
- GList *tmp_list;
-
- tmp_list = info->selections;
- while (tmp_list)
- {
- if (GPOINTER_TO_UINT (tmp_list->data) == selection)
- return;
- tmp_list = tmp_list->next;
- }
-
- gtk_selection_owner_set (info->ipc_widget, selection, time);
- info->selections = g_list_prepend (info->selections,
- GUINT_TO_POINTER (selection));
-
- tmp_list = info->target_list->list;
- while (tmp_list)
- {
- GtkTargetPair *pair = tmp_list->data;
-
- gtk_selection_add_target (info->ipc_widget,
- selection,
- pair->target,
- pair->info);
- tmp_list = tmp_list->next;
- }
-
- if (info->context->protocol == GDK_DRAG_PROTO_MOTIF)
- {
- gtk_selection_add_target (info->ipc_widget,
- selection,
- gdk_atom_intern ("XmTRANSFER_SUCCESS", FALSE),
- TARGET_MOTIF_SUCCESS);
- gtk_selection_add_target (info->ipc_widget,
- selection,
- gdk_atom_intern ("XmTRANSFER_FAILURE", FALSE),
- TARGET_MOTIF_FAILURE);
- }
-
- gtk_selection_add_target (info->ipc_widget,
- selection,
- gdk_atom_intern ("DELETE", FALSE),
- TARGET_DELETE);
-}
-
-/* Copied from gtkdnd.c to work around broken gtk_drag_get_event_actions */
-
-static void
-nautilus_icon_dnd_update (GtkDragSourceInfo *info,
- gint x_root,
- gint y_root,
- GdkEvent *event)
-{
- GdkDragAction action;
- GdkDragAction possible_actions;
- GdkWindow *window = NULL;
- GdkWindow *dest_window;
- GdkDragProtocol protocol;
- GdkAtom selection;
- guint32 time = nautilus_icon_dnd_get_event_time (event);
-
- nautilus_icon_dnd_get_event_actions (event,
- info->button,
- info->possible_actions,
- &action, &possible_actions);
- info->cur_x = x_root;
- info->cur_y = y_root;
-
- if (info->icon_window)
- {
- gdk_window_raise (info->icon_window->window);
- gtk_widget_set_uposition (info->icon_window,
- info->cur_x - info->hot_x,
- info->cur_y - info->hot_y);
- window = info->icon_window->window;
- }
-
- gdk_drag_find_window (info->context,
- window, x_root, y_root,
- &dest_window, &protocol);
-
- if (gdk_drag_motion (info->context, dest_window, protocol,
- x_root, y_root, action,
- possible_actions,
- time))
- {
- if (info->last_event)
- gdk_event_free ((GdkEvent *)info->last_event);
-
- info->last_event = gdk_event_copy ((GdkEvent *)event);
- }
-
- if (dest_window)
- gdk_window_unref (dest_window);
-
- selection = gdk_drag_get_selection (info->context);
-
- if (selection)
- nautilus_icon_dnd_source_check_selection (info, selection, time);
-}
-
-/* Copied from gtkdnd.c to work around broken gtk_drag_get_event_actions */
-static int
-nautilus_icon_drag_key_callback (GtkWidget *widget, GdkEventKey *event,
- gpointer data)
-{
- GtkDragSourceInfo *info = (GtkDragSourceInfo *)data;
- GdkModifierType state;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
- g_return_val_if_fail (event != NULL, TRUE);
- g_return_val_if_fail (data != NULL, TRUE);
-
- if (event->type == GDK_KEY_PRESS
- && event->keyval == GDK_Escape) {
- return FALSE;
- }
-
- /* Now send a "motion" so that the modifier state is updated */
-
- /* The state is not yet updated in the event, so we need
- * to query it here. We could use XGetModifierMapping, but
- * that would be overkill.
- */
- gdk_window_get_pointer (GDK_ROOT_PARENT(), NULL, NULL, &state);
-
- event->state = state;
- nautilus_icon_dnd_update (info, info->cur_x, info->cur_y, (GdkEvent *)event);
-
- return TRUE;
-}
diff --git a/libnautilus/nautilus-icon-dnd.h b/libnautilus/nautilus-icon-dnd.h
deleted file mode 100644
index de39a1ca2..000000000
--- a/libnautilus/nautilus-icon-dnd.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-icon-dnd.h - Drag & drop handling for the icon container widget.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>,
- Darin Adler <darin@eazel.com>,
- Andy Hertzfeld <andy@eazel.com>
-*/
-
-#ifndef NAUTILUS_ICON_DND_H
-#define NAUTILUS_ICON_DND_H
-
-#include "nautilus-icon-container.h"
-
-#include <gtk/gtkdnd.h>
-
-typedef struct NautilusIconDndInfo NautilusIconDndInfo;
-typedef enum NautilusIconDndTargetType NautilusIconDndTargetType;
-
-/* Standard DnD types. */
-enum NautilusIconDndTargetType {
- NAUTILUS_ICON_DND_GNOME_ICON_LIST,
- NAUTILUS_ICON_DND_URI_LIST,
- NAUTILUS_ICON_DND_URL,
- NAUTILUS_ICON_DND_COLOR
-};
-
-/* DnD target names. */
-#define NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE "special/x-gnome-icon-list"
-#define NAUTILUS_ICON_DND_URI_LIST_TYPE "text/uri-list"
-#define NAUTILUS_ICON_DND_URL_TYPE "_NETSCAPE_URL"
-#define NAUTILUS_ICON_DND_COLOR_TYPE "application/x-color"
-
-/* DnD-related information. */
-struct NautilusIconDndInfo {
- GtkTargetList *target_list;
-
- /* Stuff saved at "receive data" time needed later in the drag. */
- gboolean got_data_type;
- NautilusIconDndTargetType data_type;
- GtkSelectionData *selection_data;
-
- /* Start of the drag, in world coordinates. */
- gdouble start_x, start_y;
-
- /* List of DndSelectionItems, representing items being dragged, or NULL
- * if data about them has not been received from the source yet.
- */
- GList *selection_list;
-
- /* Stipple for drawing icon shadows during DnD. */
- GdkBitmap *stipple;
-
- /* Shadow for the icons being dragged. */
- GnomeCanvasItem *shadow;
-};
-
-void nautilus_icon_dnd_init (NautilusIconContainer *container,
- GdkBitmap *stipple);
-void nautilus_icon_dnd_fini (NautilusIconContainer *container);
-void nautilus_icon_dnd_begin_drag (NautilusIconContainer *container,
- GdkDragAction actions,
- gint button,
- GdkEventMotion *event);
-void nautilus_icon_dnd_end_drag (NautilusIconContainer *container);
-
-void nautilus_icon_dnd_update_drop_action (GtkWidget *widget);
-
-#endif /* NAUTILUS_ICON_DND_H */
diff --git a/libnautilus/nautilus-icon-factory.c b/libnautilus/nautilus-icon-factory.c
deleted file mode 100644
index 23fa14590..000000000
--- a/libnautilus/nautilus-icon-factory.c
+++ /dev/null
@@ -1,1854 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-icon-factory.c: Class for obtaining icons for files and other objects.
-
- Copyright (C) 1999, 2000 Red Hat Inc.
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: John Sullivan <sullivan@eazel.com>, Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-icon-factory.h"
-
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <gnome.h>
-#include <png.h>
-
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-
-#include <parser.h>
-#include <xmlmemory.h>
-
-#include "librsvg/rsvg.h"
-
-#include "nautilus-string.h"
-#include "nautilus-default-file-icon.h"
-#include "nautilus-metadata.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-glib-extensions.h"
-#include "nautilus-global-preferences.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-xml-extensions.h"
-
-/* List of suffixes to search when looking for an icon file. */
-static const char *icon_file_name_suffixes[] =
-{
- "",
- ".svg",
- ".SVG",
- ".png",
- ".PNG",
- ".gif",
- ".GIF"
-};
-
-#define ICON_NAME_DIRECTORY "i-directory"
-#define ICON_NAME_DIRECTORY_CLOSED "i-dirclosed"
-#define ICON_NAME_EXECUTABLE "i-executable"
-#define ICON_NAME_REGULAR "i-regular"
-#define ICON_NAME_CORE "i-core"
-#define ICON_NAME_SOCKET "i-sock"
-#define ICON_NAME_FIFO "i-fifo"
-#define ICON_NAME_CHARACTER_DEVICE "i-chardev"
-#define ICON_NAME_BLOCK_DEVICE "i-blockdev"
-#define ICON_NAME_BROKEN_SYMBOLIC_LINK "i-brokenlink"
-
-#define ICON_NAME_THUMBNAIL_LOADING "loading"
-
-#define EMBLEM_NAME_PREFIX "emblem-"
-
-/* This used to be called ICON_CACHE_MAX_ENTRIES, but it's misleading
- * to call it that, since we can have any number of entries in the
- * cache if the caller keeps the pixbuf around (we only get rid of
- * items from the cache after the caller unref's them).
-*/
-#define ICON_CACHE_COUNT 20
-
-/* This is the number of milliseconds we wait before sweeping out
- * items from the cache.
- */
-#define ICON_CACHE_SWEEP_TIMEOUT (10 * 1000)
-
-/* For now, images are used themselves as thumbnails when they are
- * below this threshold size. Later we might have to have a more
- * complex rule about when to use an image for itself.
- */
-#define SELF_THUMBNAIL_SIZE_THRESHOLD 16384
-
-/* This circular doubly-linked list structure is used to keep a list
- * of the most recently used items in the cache.
- */
-typedef struct NautilusCircularList NautilusCircularList;
-struct NautilusCircularList {
- NautilusCircularList *next;
- NautilusCircularList *prev;
-};
-
-/* permissions for thumbnail directory */
-
-#define THUMBNAIL_DIR_PERMISSIONS (GNOME_VFS_PERM_USER_ALL | GNOME_VFS_PERM_GROUP_ALL | GNOME_VFS_PERM_OTHER_ALL)
-
-/* The icon factory.
- * These are just globals, but they're in an object so we can
- * connect signals and have multiple icon factories some day
- * if we want to.
- */
-typedef struct {
- GtkObject object;
-
- char *theme_name;
-
- /* A hash table so we pass out the same scalable icon pointer
- * every time someone asks for the same icon. Scalable icons
- * are removed from this hash table when they are destroyed.
- */
- GHashTable *scalable_icons;
-
- /* A hash table that contains a cache of actual images.
- * A circular list of the most recently used images is kept
- * around, and we don't let them go when we sweep the cache.
- */
- GHashTable *icon_cache;
- NautilusCircularList recently_used_dummy_head;
- guint recently_used_count;
- guint sweep_timer;
-
- /* thumbnail task state */
- GList *thumbnails;
- char *new_thumbnail_path;
- gboolean thumbnail_in_progress;
-
- /* id of timeout task for making thumbnails */
- int timeout_task_id;
-} NautilusIconFactory;
-
-typedef struct {
- GtkObjectClass parent_class;
-} NautilusIconFactoryClass;
-
-enum {
- ICONS_CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL];
-
-/* A scalable icon, which is basically the name and path of an icon,
- * before we load the actual pixels of the icons's image.
- */
-struct NautilusScalableIcon {
- guint ref_count;
-
- char *uri;
- char *name;
- char *modifier;
-};
-
-/* The key to a hash table that holds the scaled icons as pixbufs.
- * In a way, it's not really completely a key, because part of the
- * data is stored in here, including the LRU chain.
- */
-typedef struct {
- NautilusScalableIcon *scalable_icon;
- guint size_in_pixels_x;
- guint size_in_pixels_y;
-
- NautilusCircularList recently_used_node;
-
- gboolean custom;
- gboolean scaled;
- ArtIRect text_rect;
-} NautilusIconCacheKey;
-
-/* forward declarations */
-
-static void icon_theme_changed_callback (NautilusPreferences *preferences,
- const char *name,
- gconstpointer value,
- gpointer user_data);
-static GtkType nautilus_icon_factory_get_type (void);
-static void nautilus_icon_factory_initialize_class (NautilusIconFactoryClass *class);
-static void nautilus_icon_factory_initialize (NautilusIconFactory *factory);
-static NautilusIconFactory * nautilus_get_current_icon_factory (void);
-static char * nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file);
-static NautilusIconFactory * nautilus_icon_factory_new (const char *theme_name);
-static void nautilus_icon_factory_set_theme (const char *theme_name);
-static NautilusScalableIcon *nautilus_scalable_icon_get (const char *uri,
- const char *name,
- const char *modifier);
-static guint nautilus_scalable_icon_hash (gconstpointer p);
-static gboolean nautilus_scalable_icon_equal (gconstpointer a,
- gconstpointer b);
-static void nautilus_icon_cache_key_destroy (NautilusIconCacheKey *key);
-static guint nautilus_icon_cache_key_hash (gconstpointer p);
-static gboolean nautilus_icon_cache_key_equal (gconstpointer a,
- gconstpointer b);
-static gboolean vfs_file_exists (const char *file_name);
-static GdkPixbuf * get_image_from_cache (NautilusScalableIcon *scalable_icon,
- guint size_in_pixels_x,
- guint size_in_pixels_y,
- gboolean picky,
- gboolean custom,
- ArtIRect *text_rect);
-static gboolean check_for_thumbnails (NautilusIconFactory *factory);
-static int nautilus_icon_factory_make_thumbnails (gpointer data);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconFactory, nautilus_icon_factory, GTK_TYPE_OBJECT)
-
-/* Return a pointer to the single global icon factory. */
-static NautilusIconFactory *
-nautilus_get_current_icon_factory (void)
-{
- static NautilusIconFactory *global_icon_factory = NULL;
- if (global_icon_factory == NULL) {
- char *theme_preference;
-
- theme_preference
- = nautilus_preferences_get_string (nautilus_preferences_get_global_preferences (),
- NAUTILUS_PREFERENCES_ICON_THEME);
-
- if (theme_preference == NULL) {
- /* Set the default icon theme.
- *
- * We might want to change things such that no default has to be installed
- * for this preference. If so, then the code that fetches the preference
- * would have to deal with either a NULL return value (or "").
- */
- nautilus_preferences_set_info (nautilus_preferences_get_global_preferences (),
- NAUTILUS_PREFERENCES_ICON_THEME,
- NULL,
- NAUTILUS_PREFERENCE_STRING,
- "default",
- NULL);
- theme_preference
- = nautilus_preferences_get_string (nautilus_preferences_get_global_preferences (),
- NAUTILUS_PREFERENCES_ICON_THEME);
- }
- g_assert (theme_preference != NULL);
-
- global_icon_factory = nautilus_icon_factory_new (theme_preference);
- g_free (theme_preference);
-
- nautilus_preferences_add_string_callback (nautilus_preferences_get_global_preferences (),
- NAUTILUS_PREFERENCES_ICON_THEME,
- icon_theme_changed_callback,
- NULL);
-
- }
- return global_icon_factory;
-}
-
-GtkObject *
-nautilus_icon_factory_get (void)
-{
- return GTK_OBJECT (nautilus_get_current_icon_factory ());
-}
-
-/* Create the icon factory. */
-static NautilusIconFactory *
-nautilus_icon_factory_new (const char *theme_name)
-{
- NautilusIconFactory *factory;
-
- factory = (NautilusIconFactory *) gtk_object_new (nautilus_icon_factory_get_type (), NULL);
-
- factory->theme_name = g_strdup (theme_name);
-
- return factory;
-}
-
-static void
-nautilus_icon_factory_initialize (NautilusIconFactory *factory)
-{
- factory->scalable_icons = g_hash_table_new (nautilus_scalable_icon_hash,
- nautilus_scalable_icon_equal);
- factory->icon_cache = g_hash_table_new (nautilus_icon_cache_key_hash,
- nautilus_icon_cache_key_equal);
-
- /* Empty out the recently-used list. */
- factory->recently_used_dummy_head.next = &factory->recently_used_dummy_head;
- factory->recently_used_dummy_head.prev = &factory->recently_used_dummy_head;
-}
-
-static void
-nautilus_icon_factory_initialize_class (NautilusIconFactoryClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (class);
-
- signals[ICONS_CHANGED]
- = gtk_signal_new ("icons_changed",
- GTK_RUN_LAST,
- object_class->type,
- 0,
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-/* Destroy one image in the cache. */
-static gboolean
-nautilus_icon_factory_destroy_cached_image (gpointer key, gpointer value, gpointer user_data)
-{
- nautilus_icon_cache_key_destroy (key);
- gdk_pixbuf_unref (value);
- return TRUE;
-}
-
-/* Reset the cache to the default state. */
-static void
-nautilus_icon_factory_clear (void)
-{
- NautilusIconFactory *factory;
-
- factory = nautilus_get_current_icon_factory ();
-
- g_hash_table_foreach_remove (factory->icon_cache,
- nautilus_icon_factory_destroy_cached_image,
- NULL);
-
- /* Empty out the recently-used list. */
- factory->recently_used_dummy_head.next = &factory->recently_used_dummy_head;
- factory->recently_used_dummy_head.prev = &factory->recently_used_dummy_head;
- factory->recently_used_count = 0;
-}
-
-#if 0
-
-static void
-nautilus_icon_factory_destroy (NautilusIconFactory *factory)
-{
- nautilus_preferences_remove_callback (nautilus_preferences_get_global_preferences (),
- NAUTILUS_PREFERENCES_ICON_THEME,
- icon_theme_changed_callback,
- NULL);
-
- nautilus_icon_factory_clear ();
- g_hash_table_destroy (factory->icon_cache);
-
- g_free (factory->theme_name);
- g_free (factory);
-}
-
-#endif
-
-static gboolean
-nautilus_icon_factory_possibly_free_cached_image (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- NautilusIconCacheKey *icon_key;
- GdkPixbuf *image;
-
- /* Don't free a cache entry that is in the recently used list. */
- icon_key = key;
- if (icon_key->recently_used_node.next != NULL) {
- return FALSE;
- }
-
- /* Don't free a cache entry if the image is still in use. */
- image = value;
-
- /* FIXME: We treat all entries as "in use", until we get a hook we can use
- * in GdkPixbuf.
- */
- return FALSE;
-#if 0
- if (image->ref_count > 1) {
- return FALSE;
- }
-
- /* Free the item. */
- return nautilus_icon_factory_destroy_cached_image (key, value, NULL);
-#endif
-}
-
-/* Sweep the cache, freeing any images that are not in use and are
- * also not recently used.
- */
-static gboolean
-nautilus_icon_factory_sweep (gpointer user_data)
-{
- NautilusIconFactory *factory;
-
- factory = user_data;
-
- g_hash_table_foreach_remove (factory->icon_cache,
- nautilus_icon_factory_possibly_free_cached_image,
- NULL);
-
- factory->sweep_timer = 0;
-
- return FALSE;
-}
-
-/* Schedule a timer to do a sweep. */
-static void
-nautilus_icon_factory_schedule_sweep (void)
-{
- NautilusIconFactory *factory;
-
- factory = nautilus_get_current_icon_factory ();
-
- if (factory->sweep_timer != 0) {
- return;
- }
-
- factory->sweep_timer = g_timeout_add (ICON_CACHE_SWEEP_TIMEOUT,
- nautilus_icon_factory_sweep,
- factory);
-}
-
-/* Change the theme. */
-void
-nautilus_icon_factory_set_theme (const char *theme_name)
-{
- NautilusIconFactory *factory;
-
- factory = nautilus_get_current_icon_factory ();
-
- nautilus_icon_factory_clear ();
-
- g_free (factory->theme_name);
- factory->theme_name = g_strdup (theme_name);
-
- gtk_signal_emit (GTK_OBJECT (factory),
- signals[ICONS_CHANGED]);
-}
-
-/* Use the MIME type to get the icon name. */
-static const char *
-nautilus_icon_factory_get_icon_name_for_regular_file (NautilusFile *file)
-{
- char *file_name;
- gboolean is_core;
- const char *mime_type;
- const char *icon_name;
-
- file_name = nautilus_file_get_name (file);
- is_core = strcmp (file_name, "core") == 0;
- g_free (file_name);
- if (is_core) {
- return ICON_NAME_CORE;
- }
-
- mime_type = nautilus_file_get_mime_type (file);
- if (mime_type != NULL) {
- icon_name = gnome_mime_get_value (mime_type, "icon-filename");
- if (icon_name != NULL) {
- return icon_name;
- }
- }
-
- /* GNOME didn't give us a file name, so we have to fall back on special icon sets. */
- if (nautilus_file_is_executable (file)) {
- return ICON_NAME_EXECUTABLE;
- }
- return ICON_NAME_REGULAR;
-}
-
-/* Get the icon name for a file. */
-static const char *
-nautilus_icon_factory_get_icon_name_for_file (NautilusFile *file)
-{
- /* Get an icon name based on the file's type. */
- switch (nautilus_file_get_file_type (file)) {
- case GNOME_VFS_FILE_TYPE_DIRECTORY:
- return ICON_NAME_DIRECTORY;
- case GNOME_VFS_FILE_TYPE_FIFO:
- return ICON_NAME_FIFO;
- case GNOME_VFS_FILE_TYPE_SOCKET:
- return ICON_NAME_SOCKET;
- case GNOME_VFS_FILE_TYPE_CHARDEVICE:
- return ICON_NAME_CHARACTER_DEVICE;
- case GNOME_VFS_FILE_TYPE_BLOCKDEVICE:
- return ICON_NAME_BLOCK_DEVICE;
- case GNOME_VFS_FILE_TYPE_BROKENSYMLINK:
- return ICON_NAME_BROKEN_SYMBOLIC_LINK;
- case GNOME_VFS_FILE_TYPE_REGULAR:
- case GNOME_VFS_FILE_TYPE_UNKNOWN:
- default:
- return nautilus_icon_factory_get_icon_name_for_regular_file (file);
- }
-}
-
-static char *
-make_full_icon_path (const char *path, const char *suffix)
-{
- char *partial_path, *full_path;
-
- if (path[0] == '/') {
- return g_strconcat (path, suffix, NULL);
- }
-
- /* Build a path for this icon. */
- partial_path = g_strconcat ("nautilus/", path, suffix, NULL);
- full_path = gnome_pixmap_file (partial_path);
- g_free (partial_path);
- return full_path;
-}
-
-/* Return true if the given suffix is a scalable image. */
-static gboolean
-suffix_is_scalable (const char *path)
-{
- const char *suffix;
-
- suffix = (const char *)strrchr (path, '.');
- if (suffix == NULL)
- return FALSE;
- return (!strcmp (suffix, ".svg") || !strcmp (suffix, ".SVG"));
-}
-
-/* Pick a particular icon to use, trying all the various suffixes.
- * Return the path of the icon or NULL if no icon is found.
- */
-static char *
-get_themed_icon_file_path (const char *theme_name,
- const char *icon_name,
- guint icon_size,
- ArtIRect *text_rect)
-{
- int i;
- gboolean include_size;
- char *themed_icon_name, *partial_path, *path, *xml_path;
- xmlDocPtr doc;
- xmlNodePtr node;
- char *size_as_string, *property;
- ArtIRect parsed_rect;
-
- if (theme_name == NULL || icon_name[0] == '/') {
- themed_icon_name = g_strdup (icon_name);
- } else {
- themed_icon_name = g_strconcat (theme_name, "/", icon_name, NULL);
- }
-
- include_size = icon_size != NAUTILUS_ICON_SIZE_STANDARD;
-
- /* Try each suffix. */
- for (i = 0; i < NAUTILUS_N_ELEMENTS (icon_file_name_suffixes); i++) {
-
- if (include_size &&
- !suffix_is_scalable (icon_file_name_suffixes[i])) {
- /* Build a path for this icon. */
- partial_path = g_strdup_printf ("%s-%u",
- themed_icon_name,
- icon_size);
- } else {
- partial_path = g_strdup (themed_icon_name);
- }
-
- path = make_full_icon_path (partial_path,
- icon_file_name_suffixes[i]);
- g_free (partial_path);
-
- /* Return the path if the file exists. */
- if (path != NULL && g_file_exists (path)) {
- break;
- }
- g_free (path);
- path = NULL;
- }
-
- /* Open the XML file to get the text rectangle. */
- if (path != NULL && text_rect != NULL) {
- memset (text_rect, 0, sizeof (*text_rect));
-
- xml_path = make_full_icon_path (themed_icon_name, ".xml");
-
- doc = xmlParseFile (xml_path);
- g_free (xml_path);
-
- size_as_string = g_strdup_printf ("%u", icon_size);
- node = nautilus_xml_get_root_child_by_name_and_property
- (doc, "ICON", "SIZE", size_as_string);
- g_free (size_as_string);
-
- property = xmlGetProp (node, "EMBEDDED_TEXT_RECTANGLE");
- if (property != NULL) {
- if (sscanf (property,
- " %d , %d , %d , %d %*s",
- &parsed_rect.x0,
- &parsed_rect.y0,
- &parsed_rect.x1,
- &parsed_rect.y1) == 4) {
- *text_rect = parsed_rect;
- }
- xmlFree (property);
- }
-
- xmlFreeDoc (doc);
- }
-
- return path;
-}
-
-/* Choose the file name to load, taking into account theme vs. non-theme icons. */
-static char *
-get_icon_file_path (const char *name, const char* modifier, guint size_in_pixels, ArtIRect *text_rect)
-{
- gboolean use_theme_icon;
- const char *theme_name;
- char *path;
-
- use_theme_icon = FALSE;
- theme_name = nautilus_get_current_icon_factory ()->theme_name;
-
- /* Check and see if there is a theme icon to use.
- * This decision must be based on whether there's a non-size-
- * specific theme icon.
- */
- if (theme_name != NULL) {
- path = get_themed_icon_file_path (theme_name,
- name,
- NAUTILUS_ICON_SIZE_STANDARD,
- NULL);
- if (path != NULL) {
- use_theme_icon = TRUE;
- g_free (path);
- }
- }
-
- /* Now we know whether or not to use the theme. */
- /* if there's a modifier, try using that first */
-
- if (modifier && strlen(modifier)) {
- gchar* modified_name = g_strdup_printf("%s-%s", name, modifier);
- path = get_themed_icon_file_path (use_theme_icon ? theme_name : NULL,
- modified_name,
- size_in_pixels,
- text_rect);
- g_free(modified_name);
- if (path)
- return path;
- }
-
- return get_themed_icon_file_path (use_theme_icon ? theme_name : NULL,
- name,
- size_in_pixels,
- text_rect);
-}
-
-static void
-icon_theme_changed_callback (NautilusPreferences *preferences,
- const char *name,
- gconstpointer value,
- gpointer user_data)
-{
- g_assert (NAUTILUS_IS_PREFERENCES (preferences));
- g_assert (strcmp (name, NAUTILUS_PREFERENCES_ICON_THEME) == 0);
- g_assert (value != NULL);
- g_assert (user_data == NULL);
-
- nautilus_icon_factory_set_theme ((char *) value);
-}
-
-/* Get or create a scalable icon. */
-static NautilusScalableIcon *
-nautilus_scalable_icon_get (const char *uri,
- const char *name,
- const char *modifier)
-{
- GHashTable *hash_table;
- NautilusScalableIcon icon_key, *icon;
-
- /* Get at the hash table. */
- hash_table = nautilus_get_current_icon_factory ()->scalable_icons;
-
- /* Check to see if it's already in the table. */
- icon_key.uri = (char *) uri;
- icon_key.name = (char *) name;
- icon_key.modifier = (char *) modifier;
- icon = g_hash_table_lookup (hash_table, &icon_key);
- if (icon == NULL) {
- /* Not in the table, so create it and put it in. */
- icon = g_new0 (NautilusScalableIcon, 1);
- icon->uri = g_strdup (uri);
- icon->name = g_strdup (name);
- icon->modifier = g_strdup (modifier);
- g_hash_table_insert (hash_table, icon, icon);
- }
-
- /* Grab a reference and return it. */
- nautilus_scalable_icon_ref (icon);
- return icon;
-}
-
-void
-nautilus_scalable_icon_ref (NautilusScalableIcon *icon)
-{
- g_return_if_fail (icon != NULL);
-
- icon->ref_count++;
-}
-
-void
-nautilus_scalable_icon_unref (NautilusScalableIcon *icon)
-{
- GHashTable *hash_table;
-
- g_return_if_fail (icon != NULL);
- g_return_if_fail (icon->ref_count != 0);
-
- if (--icon->ref_count != 0) {
- return;
- }
-
- hash_table = nautilus_get_current_icon_factory ()->scalable_icons;
- g_hash_table_remove (hash_table, icon);
-
- g_free (icon->uri);
- g_free (icon->name);
- if (icon->modifier)
- g_free(icon->modifier);
- g_free (icon);
-}
-
-static guint
-nautilus_scalable_icon_hash (gconstpointer p)
-{
- const NautilusScalableIcon *icon;
- guint hash;
-
- icon = p;
- hash = 0;
-
- if (icon->uri != NULL) {
- hash = g_str_hash (icon->uri);
- }
-
- hash <<= 4;
- if (icon->name != NULL) {
- hash ^= g_str_hash (icon->name);
- }
-
- hash <<= 4;
- if (icon->modifier != NULL) {
- hash ^= g_str_hash (icon->modifier);
- }
-
- return hash;
-}
-
-static gboolean
-nautilus_scalable_icon_equal (gconstpointer a,
- gconstpointer b)
-{
- const NautilusScalableIcon *icon_a, *icon_b;
-
- icon_a = a;
- icon_b = b;
-
- return nautilus_strcmp (icon_a->uri, icon_b->uri) == 0
- && nautilus_strcmp (icon_a->name, icon_b->name) == 0
- && nautilus_strcmp (icon_a->modifier, icon_b->modifier) == 0;
-}
-
-NautilusScalableIcon *
-nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char* modifier)
-{
- char *uri, *file_uri;
- const char *name;
- NautilusScalableIcon *scalable_icon;
-
- if (file == NULL) {
- return NULL;
- }
-
- /* if there is a custom image in the metadata, use that. */
- uri = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL);
- file_uri = nautilus_file_get_uri(file);
-
- /* if the file is an image, either use the image itself as the icon if it's small enough,
- or use a thumbnail if one exists. If a thumbnail is required, but does not yet exist,
- put an entry on the thumbnail queue so we eventually make one */
-
- /* also, dont make thumbnails for images in the thumbnails directory */
- if (uri == NULL && nautilus_str_has_prefix (nautilus_file_get_mime_type (file), "image/")) {
- if (nautilus_file_get_size (file) < SELF_THUMBNAIL_SIZE_THRESHOLD) {
- uri = nautilus_file_get_uri (file);
- } else if (strstr(file_uri, "/.thumbnails/") == NULL) {
- uri = nautilus_icon_factory_get_thumbnail_uri (file);
- }
- }
-
- /* Get the generic icon set for this file. */
- g_free(file_uri);
- name = nautilus_icon_factory_get_icon_name_for_file (file);
-
- /* Create the icon or find it in the cache if it's already there. */
- scalable_icon = nautilus_scalable_icon_get (uri, name, modifier);
- g_free (uri);
-
- return scalable_icon;
-}
-
-static void
-add_emblem (GList **icons, const char *name)
-{
- char *name_with_prefix;
-
- name_with_prefix = g_strconcat (EMBLEM_NAME_PREFIX, name, NULL);
- *icons = g_list_prepend (*icons, nautilus_scalable_icon_get (NULL, name_with_prefix, NULL));
- g_free (name_with_prefix);
-}
-
-GList *
-nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file)
-{
- GList *icons, *emblem_names, *p;
-
- icons = NULL;
-
- emblem_names = nautilus_file_get_emblem_names (file);
- for (p = emblem_names; p != NULL; p = p->next) {
- add_emblem (&icons, p->data);
- }
-
- nautilus_g_list_free_deep (emblem_names);
-
- return g_list_reverse (icons);
-}
-
-/* utility to test whether a file exists using vfs */
-static gboolean
-vfs_file_exists (const char *file_uri)
-{
- GnomeVFSResult result;
- GnomeVFSFileInfo *file_info;
-
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info (file_uri, file_info, 0, NULL);
- gnome_vfs_file_info_unref (file_info);
- return result == GNOME_VFS_OK;
-}
-
-/* utility routine that, given the uri of an image, constructs the uri to the corresponding thumbnail */
-
-static char *
-make_thumbnail_path (const char *image_uri, gboolean directory_only)
-{
- char *thumbnail_uri;
- char *temp_str = g_strdup (image_uri);
- char *last_slash = strrchr (temp_str, '/');
- *last_slash = '\0';
-
- if (directory_only) {
- thumbnail_uri = g_strdup_printf ("%s/.thumbnails", temp_str);
- } else {
- if (nautilus_str_has_suffix (image_uri, ".png")
- || nautilus_str_has_suffix (image_uri, ".PNG")) {
- thumbnail_uri = g_strdup_printf ("%s/.thumbnails/%s", temp_str, last_slash + 1);
- } else {
- thumbnail_uri = g_strdup_printf ("%s/.thumbnails/%s.png", temp_str, last_slash + 1);
- }
- }
- g_free (temp_str);
- return thumbnail_uri;
-}
-
-/* structure used for making thumbnails, associating a uri with the requesting controller */
-
-typedef struct {
- char *thumbnail_uri;
-} NautilusThumbnailInfo;
-
-/* GCompareFunc-style function for comparing NautilusThumbnailInfos.
- * Returns 0 if they refer to the same uri.
- */
-static int
-compare_thumbnail_info (gconstpointer a, gconstpointer b)
-{
- NautilusThumbnailInfo *info_a;
- NautilusThumbnailInfo *info_b;
-
- info_a = (NautilusThumbnailInfo *)a;
- info_b = (NautilusThumbnailInfo *)b;
-
- return strcmp (info_a->thumbnail_uri, info_b->thumbnail_uri) != 0;
-}
-
-/* routine that takes a uri of a large image file and returns the uri of its corresponding thumbnail.
- If no thumbnail is available, put the image on the thumbnail queue so one is eventually made. */
-/* FIXME: Most of this thumbnail machinery belongs in NautilusFile, not here.
- */
-
-static char *
-nautilus_icon_factory_get_thumbnail_uri (NautilusFile *file)
-{
- NautilusIconFactory *factory;
- GnomeVFSResult result;
- char *thumbnail_uri;
- char *file_uri;
-
- file_uri = nautilus_file_get_uri (file);
-
- /* compose the uri for the thumbnail */
- thumbnail_uri = make_thumbnail_path (file_uri, FALSE);
-
- /* if the thumbnail file already exists, simply return the uri */
- if (vfs_file_exists (thumbnail_uri)) {
- g_free (file_uri);
- return thumbnail_uri;
- }
-
- /* make the thumbnail directory if necessary */
- g_free (thumbnail_uri);
- thumbnail_uri = make_thumbnail_path (file_uri, TRUE);
- result = gnome_vfs_make_directory (thumbnail_uri, THUMBNAIL_DIR_PERMISSIONS);
-
- /* the thumbnail needs to be created, so add an entry to the thumbnail list */
-
- /* FIXME: need to handle error by making directory elsewhere */
- if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_FILEEXISTS) {
- g_warning ("error when making thumbnail directory: %d", result);
- } else {
- NautilusThumbnailInfo *info = g_new0 (NautilusThumbnailInfo, 1);
- info->thumbnail_uri = file_uri;
-
- factory = nautilus_get_current_icon_factory ();
- if (factory->thumbnails) {
- if (g_list_find_custom (factory->thumbnails, info, compare_thumbnail_info) == NULL) {
- factory->thumbnails = g_list_prepend (factory->thumbnails, info);
- }
- } else {
- factory->thumbnails = g_list_alloc ();
- factory->thumbnails->data = info;
- }
-
- if (factory->timeout_task_id == 0) {
- factory->timeout_task_id = gtk_timeout_add (400, (GtkFunction) nautilus_icon_factory_make_thumbnails, NULL);
- }
- }
- g_free (thumbnail_uri);
-
- /* return the uri to the "loading image" icon */
- return get_icon_file_path (ICON_NAME_THUMBNAIL_LOADING,
- NULL,
- NAUTILUS_ICON_SIZE_STANDARD,
- NULL);
-}
-
-static guint
-get_larger_icon_size (guint size)
-{
- if (size < NAUTILUS_ICON_SIZE_SMALLEST) {
- return NAUTILUS_ICON_SIZE_SMALLEST;
- }
- if (size < NAUTILUS_ICON_SIZE_SMALLER) {
- return NAUTILUS_ICON_SIZE_SMALLER;
- }
- if (size < NAUTILUS_ICON_SIZE_SMALL) {
- return NAUTILUS_ICON_SIZE_SMALL;
- }
- if (size < NAUTILUS_ICON_SIZE_STANDARD) {
- return NAUTILUS_ICON_SIZE_STANDARD;
- }
- if (size < NAUTILUS_ICON_SIZE_LARGE) {
- return NAUTILUS_ICON_SIZE_LARGE;
- }
- if (size < NAUTILUS_ICON_SIZE_LARGER) {
- return NAUTILUS_ICON_SIZE_LARGER;
- }
- return NAUTILUS_ICON_SIZE_LARGEST;
-}
-
-static guint
-get_smaller_icon_size (guint size)
-{
- if (size > NAUTILUS_ICON_SIZE_LARGEST) {
- return NAUTILUS_ICON_SIZE_LARGEST;
- }
- if (size > NAUTILUS_ICON_SIZE_LARGER) {
- return NAUTILUS_ICON_SIZE_LARGER;
- }
- if (size > NAUTILUS_ICON_SIZE_LARGE) {
- return NAUTILUS_ICON_SIZE_LARGE;
- }
- if (size > NAUTILUS_ICON_SIZE_STANDARD) {
- return NAUTILUS_ICON_SIZE_STANDARD;
- }
- if (size > NAUTILUS_ICON_SIZE_SMALL) {
- return NAUTILUS_ICON_SIZE_SMALL;
- }
- if (size > NAUTILUS_ICON_SIZE_SMALLER) {
- return NAUTILUS_ICON_SIZE_SMALLER;
- }
- return NAUTILUS_ICON_SIZE_SMALLEST;
-}
-
-/* Return true if there is another size to try.
- * Set the size pointed to by @current_size to 0 to start.
- */
-static gboolean
-get_next_icon_size_to_try (guint target_size, guint *current_size)
-{
- guint size;
-
- /* Get next larger size. */
- size = *current_size;
- if (size == 0 || size >= target_size) {
- if (size == 0 && target_size != 0) {
- size = target_size - 1;
- }
- if (size < NAUTILUS_ICON_SIZE_LARGEST) {
- *current_size = get_larger_icon_size (size);
- return TRUE;
- }
- size = target_size;
- }
-
- /* Already hit the largest size, get the next smaller size instead. */
- if (size > NAUTILUS_ICON_SIZE_SMALLEST) {
- *current_size = get_smaller_icon_size (size);
- return TRUE;
- }
-
- /* Tried them all. */
- return FALSE;
-}
-
-/* This loads an SVG image, scaling it to the appropriate size. */
-static GdkPixbuf *
-load_specific_image_svg (const char *path, guint size_in_pixels)
-{
- FILE *f;
- GdkPixbuf *result;
-
- f = fopen (path, "r");
- if (f == NULL) {
- return NULL;
- }
- result = rsvg_render_file (f, size_in_pixels *
- (1.0 / NAUTILUS_ICON_SIZE_STANDARD));
- fclose (f);
-
- return result;
-}
-
-/* This load function returns NULL if the icon is not available at this size. */
-static GdkPixbuf *
-load_specific_image (NautilusScalableIcon *scalable_icon,
- guint size_in_pixels,
- gboolean custom,
- ArtIRect *text_rect)
-{
- g_assert (text_rect != NULL);
-
- if (custom) {
- /* Custom icon. */
-
- /* FIXME: This works only with file:// images, because there's
- * no convenience function for loading an image with gnome-vfs
- * and gdk-pixbuf.
- */
- if (size_in_pixels == NAUTILUS_ICON_SIZE_STANDARD
- && nautilus_str_has_prefix (scalable_icon->uri, "file://")) {
- memset (text_rect, 0, sizeof (*text_rect));
- return gdk_pixbuf_new_from_file (scalable_icon->uri + 7);
- }
-
- return NULL;
- } else {
- /* Standard icon. */
- char *path;
- GdkPixbuf *image;
-
- path = get_icon_file_path (scalable_icon->name,
- scalable_icon->modifier,
- size_in_pixels,
- text_rect);
- if (path == NULL) {
- return NULL;
- }
- if (suffix_is_scalable (path))
- image = load_specific_image_svg (path, size_in_pixels);
- else
- image = gdk_pixbuf_new_from_file (path);
- g_free (path);
- return image;
- }
-}
-
-/* This load function is not allowed to return NULL. */
-static GdkPixbuf *
-load_image_for_scaling (NautilusScalableIcon *scalable_icon,
- guint requested_size,
- guint *actual_size_result,
- gboolean *custom,
- ArtIRect *text_rect)
-{
- GdkPixbuf *image;
- guint actual_size;
- static GdkPixbuf *fallback_image;
-
- /* First check for a custom image. */
- actual_size = 0;
- while (get_next_icon_size_to_try (requested_size, &actual_size)) {
- image = get_image_from_cache (scalable_icon,
- actual_size,
- actual_size,
- TRUE,
- TRUE,
- text_rect);
- if (image != NULL) {
- *actual_size_result = actual_size;
- *custom = TRUE;
- return image;
- }
- }
-
- /* Next, go for the normal image. */
- actual_size = 0;
- while (get_next_icon_size_to_try (requested_size, &actual_size)) {
- image = get_image_from_cache (scalable_icon,
- actual_size,
- actual_size,
- TRUE,
- FALSE,
- text_rect);
- if (image != NULL) {
- *actual_size_result = actual_size;
- *custom = FALSE;
- return image;
- }
- }
-
- /* Finally, fall back on the hard-coded image. */
- if (fallback_image == NULL) {
- fallback_image = gdk_pixbuf_new_from_data
- (nautilus_default_file_icon,
- GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- nautilus_default_file_icon_width,
- nautilus_default_file_icon_height,
- nautilus_default_file_icon_width * 4, /* stride */
- NULL, /* don't destroy data */
- NULL);
- }
- gdk_pixbuf_ref (fallback_image);
-
- memset (text_rect, 0, sizeof (*text_rect));
- *actual_size_result = NAUTILUS_ICON_SIZE_STANDARD;
- *custom = FALSE;
- return fallback_image;
-}
-
-/* This load function is not allowed to return NULL. */
-static GdkPixbuf *
-load_image_scale_if_necessary (NautilusScalableIcon *scalable_icon,
- guint requested_size_x,
- guint requested_size_y,
- gboolean *scaled,
- gboolean *custom,
- ArtIRect *text_rect)
-{
- GdkPixbuf *image, *scaled_image;
- guint actual_size;
- int scaled_width, scaled_height;
-
- /* Load the image for the icon that's closest in size to what we want. */
- image = load_image_for_scaling (scalable_icon, requested_size_x,
- &actual_size, custom, text_rect);
- if (requested_size_x == actual_size && requested_size_y == actual_size) {
- *scaled = FALSE;
- return image;
- }
-
- /* Scale the image to the size we want. */
- scaled_width = gdk_pixbuf_get_width (image) * requested_size_x / actual_size;
- scaled_height = gdk_pixbuf_get_height (image) * requested_size_y / actual_size;
- scaled_image = gdk_pixbuf_scale_simple
- (image, scaled_width, scaled_height, GDK_INTERP_BILINEAR);
-
- /* Scale the text rectangle to the same size. */
- text_rect->x0 = text_rect->x0 * requested_size_x / actual_size;
- text_rect->y0 = text_rect->y0 * requested_size_y / actual_size;
- text_rect->x1 = text_rect->x1 * requested_size_x / actual_size;
- text_rect->y1 = text_rect->y1 * requested_size_y / actual_size;
-
- gdk_pixbuf_unref (image);
- *scaled = TRUE;
- return scaled_image;
-}
-
-/* Move this item to the head of the recently-used list,
- * bumping the last item off that list if necessary.
- */
-static void
-mark_recently_used (NautilusCircularList *node)
-{
- NautilusIconFactory *factory;
- NautilusCircularList *head, *last_node;
-
- factory = nautilus_get_current_icon_factory ();
- head = &factory->recently_used_dummy_head;
-
- /* Move the node to the start of the list. */
- if (node->prev != head) {
- if (node->next != NULL) {
- /* Remove the node from its current position in the list. */
- node->next->prev = node->prev;
- node->prev->next = node->next;
- } else {
- /* Node was not already in the list, so add it.
- * If the list is already full, remove the last node.
- */
- if (factory->recently_used_count < ICON_CACHE_COUNT)
- factory->recently_used_count++;
- else {
- /* Remove the last node. */
- last_node = head->prev;
-
- g_assert (last_node != head);
- g_assert (last_node != node);
-
- head->prev = last_node->prev;
- last_node->prev->next = head;
-
- last_node->prev = NULL;
- last_node->next = NULL;
- }
- }
-
- /* Insert the node at the head of the list. */
- node->prev = head;
- node->next = head->next;
- node->next->prev = node;
- head->next = node;
- }
-}
-
-/* Get the image for icon, handling the caching.
- * If @picky is true, then only an unscaled icon is acceptable.
- * Also, if @picky is true, the icon must be a custom icon if
- * @custom is true or a standard icon is @custom is false.
- */
-static GdkPixbuf *
-get_image_from_cache (NautilusScalableIcon *scalable_icon,
- guint size_in_pixels_x,
- guint size_in_pixels_y,
- gboolean picky,
- gboolean custom,
- ArtIRect *text_rect)
-{
- NautilusIconFactory *factory;
- GHashTable *hash_table;
- NautilusIconCacheKey lookup_key, *key;
- GdkPixbuf *image;
- gpointer key_in_table, value;
-
- g_return_val_if_fail (scalable_icon != NULL, NULL);
-
- factory = nautilus_get_current_icon_factory ();
- hash_table = factory->icon_cache;
-
- /* Check to see if it's already in the table. */
- lookup_key.scalable_icon = scalable_icon;
- lookup_key.size_in_pixels_x = size_in_pixels_x;
- lookup_key.size_in_pixels_y = size_in_pixels_y;
- if (g_hash_table_lookup_extended (hash_table, &lookup_key,
- &key_in_table, &value)) {
- /* Found it in the table. */
- key = key_in_table;
-
- /* If we're going to be picky, then don't accept anything
- * other than exactly what we are looking for.
- */
- if (picky && (key->scaled || custom != key->custom)) {
- return NULL;
- }
-
- image = value;
- g_assert (image != NULL);
- } else {
- gboolean got_scaled_image;
- gboolean got_custom_image;
- ArtIRect key_text_rect;
-
- /* Not in the table, so load the image. */
- if (picky) {
- if (size_in_pixels_x != size_in_pixels_y) {
- return NULL;
- }
- image = load_specific_image (scalable_icon,
- size_in_pixels_x,
- custom,
- &key_text_rect);
- if (image == NULL) {
- return NULL;
- }
-
- got_scaled_image = FALSE;
- got_custom_image = custom;
- } else {
- image = load_image_scale_if_necessary (scalable_icon,
- size_in_pixels_x,
- size_in_pixels_y,
- &got_scaled_image,
- &got_custom_image,
- &key_text_rect);
- g_assert (image != NULL);
- }
-
- /* Create the key for the table. */
- key = g_new0 (NautilusIconCacheKey, 1);
- nautilus_scalable_icon_ref (scalable_icon);
- key->scalable_icon = scalable_icon;
- key->size_in_pixels_x = size_in_pixels_x;
- key->size_in_pixels_y = size_in_pixels_y;
- key->scaled = got_scaled_image;
- key->custom = got_custom_image;
- key->text_rect = key_text_rect;
-
- /* Add the item to the hash table. */
- g_hash_table_insert (hash_table, key, image);
- }
-
- /* Return the text rect if the caller asked for it. */
- if (text_rect != NULL) {
- *text_rect = key->text_rect;
- }
-
- /* Since this item was used, keep it in the cache longer. */
- mark_recently_used (&key->recently_used_node);
-
- /* Come back later and sweep the cache. */
- nautilus_icon_factory_schedule_sweep ();
-
- /* Grab a ref for the caller. */
- gdk_pixbuf_ref (image);
- return image;
-}
-
-GdkPixbuf *
-nautilus_icon_factory_get_pixbuf_for_icon (NautilusScalableIcon *scalable_icon,
- guint size_in_pixels_x, guint size_in_pixels_y,
- ArtIRect *text_rect)
-{
- return get_image_from_cache (scalable_icon,
- size_in_pixels_x, size_in_pixels_y,
- FALSE, FALSE, text_rect);
-}
-
-static void
-nautilus_icon_cache_key_destroy (NautilusIconCacheKey *key)
-{
- nautilus_scalable_icon_unref (key->scalable_icon);
-}
-
-static guint
-nautilus_icon_cache_key_hash (gconstpointer p)
-{
- const NautilusIconCacheKey *key;
-
- key = p;
- return (((GPOINTER_TO_UINT (key->scalable_icon) << 4)
- ^ key->size_in_pixels_x) << 4)
- ^ key->size_in_pixels_y;
-}
-
-static gboolean
-nautilus_icon_cache_key_equal (gconstpointer a, gconstpointer b)
-{
- const NautilusIconCacheKey *key_a, *key_b;
-
- key_a = a;
- key_b = b;
-
- return key_a->scalable_icon == key_b->scalable_icon
- && key_a->size_in_pixels_x == key_b->size_in_pixels_x
- && key_a->size_in_pixels_y == key_b->size_in_pixels_y;
-}
-
-/* Return nominal icon size for given zoom level.
- * @zoom_level: zoom level for which to find matching icon size.
- *
- * Return value: icon size between NAUTILUS_ICON_SIZE_SMALLEST and
- * NAUTILUS_ICON_SIZE_LARGEST, inclusive.
- */
-guint
-nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level)
-{
- switch (zoom_level) {
- case NAUTILUS_ZOOM_LEVEL_SMALLEST:
- return NAUTILUS_ICON_SIZE_SMALLEST;
- case NAUTILUS_ZOOM_LEVEL_SMALLER:
- return NAUTILUS_ICON_SIZE_SMALLER;
- case NAUTILUS_ZOOM_LEVEL_SMALL:
- return NAUTILUS_ICON_SIZE_SMALL;
- case NAUTILUS_ZOOM_LEVEL_STANDARD:
- return NAUTILUS_ICON_SIZE_STANDARD;
- case NAUTILUS_ZOOM_LEVEL_LARGE:
- return NAUTILUS_ICON_SIZE_LARGE;
- case NAUTILUS_ZOOM_LEVEL_LARGER:
- return NAUTILUS_ICON_SIZE_LARGER;
- case NAUTILUS_ZOOM_LEVEL_LARGEST:
- return NAUTILUS_ICON_SIZE_LARGEST;
- default:
- g_assert_not_reached ();
- return NAUTILUS_ICON_SIZE_STANDARD;
- }
-}
-
-/* Convenience cover for nautilus_icon_factory_get_icon_for_file
- * and nautilus_icon_factory_get_pixbuf_for_icon.
- */
-GdkPixbuf *
-nautilus_icon_factory_get_pixbuf_for_file (NautilusFile *file,
- guint size_in_pixels)
-{
- NautilusScalableIcon *icon;
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (file != NULL, NULL);
-
- icon = nautilus_icon_factory_get_icon_for_file (file, NULL);
- pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (icon,
- size_in_pixels,
- size_in_pixels,
- NULL);
- nautilus_scalable_icon_unref (icon);
- return pixbuf;
-}
-
-/* Convenience cover for nautilus_icon_factory_get_icon_for_file,
- * nautilus_icon_factory_get_pixbuf_for_icon,
- * and gdk_pixbuf_render_pixmap_and_mask.
- */
-void
-nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
- guint size_in_pixels,
- GdkPixmap **pixmap,
- GdkBitmap **mask)
-{
- GdkPixbuf *pixbuf;
-
- g_return_if_fail (pixmap != NULL);
- g_return_if_fail (mask != NULL);
-
- *pixmap = NULL;
- *mask = NULL;
-
- g_return_if_fail (file != NULL);
-
- pixbuf = nautilus_icon_factory_get_pixbuf_for_file (file, size_in_pixels);
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, pixmap, mask, 128);
- gdk_pixbuf_unref (pixbuf);
-}
-
-/* Convenience function for unrefing and then freeing an entire list. */
-void
-nautilus_scalable_icon_list_free (GList *icon_list)
-{
- g_list_foreach (icon_list, (GFunc) nautilus_scalable_icon_unref, NULL);
- g_list_free (icon_list);
-}
-
-/* utility routine for saving a pixbuf to a png file.
- * This was adapted from Iain Holmes' code in gnome-iconedit, and probably
- * should be in a utility library, possibly in gdk-pixbuf itself.
- */
-static gboolean
-save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename)
-{
- FILE *handle;
- char *buffer;
- gboolean has_alpha;
- int width, height, depth, rowstride;
- guchar *pixels;
- png_structp png_ptr;
- png_infop info_ptr;
- png_text text[2];
- int i;
-
- g_return_val_if_fail (pixbuf != NULL, FALSE);
- g_return_val_if_fail (filename != NULL, FALSE);
- g_return_val_if_fail (filename[0] != '\0', FALSE);
-
- handle = fopen (filename, "wb");
- if (handle == NULL) {
- return FALSE;
- }
-
- png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (png_ptr == NULL) {
- fclose (handle);
- return FALSE;
- }
-
- info_ptr = png_create_info_struct (png_ptr);
- if (info_ptr == NULL) {
- png_destroy_write_struct (&png_ptr, (png_infopp)NULL);
- fclose (handle);
- return FALSE;
- }
-
- if (setjmp (png_ptr->jmpbuf)) {
- png_destroy_write_struct (&png_ptr, &info_ptr);
- fclose (handle);
- return FALSE;
- }
-
- png_init_io (png_ptr, handle);
-
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- depth = gdk_pixbuf_get_bits_per_sample (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- png_set_IHDR (png_ptr, info_ptr, width, height,
- depth, PNG_COLOR_TYPE_RGB_ALPHA,
- PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_DEFAULT,
- PNG_FILTER_TYPE_DEFAULT);
-
- /* Some text to go with the png image */
- text[0].key = "Title";
- text[0].text = filename;
- text[0].compression = PNG_TEXT_COMPRESSION_NONE;
- text[1].key = "Software";
- text[1].text = "Nautilus Thumbnail";
- text[1].compression = PNG_TEXT_COMPRESSION_NONE;
- png_set_text (png_ptr, info_ptr, text, 2);
-
- /* Write header data */
- png_write_info (png_ptr, info_ptr);
-
- /* if there is no alpha in the data, allocate buffer to expand into */
- if (has_alpha) {
- buffer = NULL;
- } else {
- buffer = g_malloc(4 * width);
- }
-
- /* pump the raster data into libpng, one scan line at a time */
- for (i = 0; i < height; i++) {
- if (has_alpha) {
- png_bytep row_pointer = pixels;
- png_write_row (png_ptr, row_pointer);
- } else {
- /* expand RGB to RGBA using an opaque alpha value */
- int x;
- char *buffer_ptr = buffer;
- char *source_ptr = pixels;
- for (x = 0; x < width; x++) {
- *buffer_ptr++ = *source_ptr++;
- *buffer_ptr++ = *source_ptr++;
- *buffer_ptr++ = *source_ptr++;
- *buffer_ptr++ = 255;
- }
- png_write_row (png_ptr, (png_bytep) buffer);
- }
- pixels += rowstride;
- }
-
- png_write_end (png_ptr, info_ptr);
- png_destroy_write_struct (&png_ptr, &info_ptr);
-
- g_free (buffer);
-
- fclose (handle);
- return TRUE;
-}
-
-/* check_for_thumbnails is a utility that checks to see if any of the thumbnails in the pending
- list have been created yet. If it finds one, it removes the elements from the queue and
- returns true, otherwise it returns false */
-
-static gboolean
-check_for_thumbnails (NautilusIconFactory *factory)
-{
- char *current_thumbnail;
- NautilusThumbnailInfo *info;
- GList *stop_element;
- GList *next_thumbnail;
- NautilusFile *file;
-
- for (next_thumbnail = factory->thumbnails;
- next_thumbnail != NULL;
- next_thumbnail = next_thumbnail->next) {
- info = (NautilusThumbnailInfo*) next_thumbnail->data;
- current_thumbnail = make_thumbnail_path (info->thumbnail_uri, FALSE);
- if (vfs_file_exists (current_thumbnail)) {
- /* we found one, so update the icon and remove all of the elements up to and including
- this one from the pending list. */
- g_free (current_thumbnail);
- file = nautilus_file_get (info->thumbnail_uri);
- if (file != NULL) {
- nautilus_file_changed (file);
- nautilus_file_unref (file);
- }
-
- stop_element = next_thumbnail->next;
- while (factory->thumbnails != stop_element) {
- info = (NautilusThumbnailInfo *) factory->thumbnails->data;
- g_free (info->thumbnail_uri);
- g_free (info);
- factory->thumbnails = g_list_remove_link (factory->thumbnails, factory->thumbnails);
- }
- return TRUE;
- }
-
- g_free (current_thumbnail);
- }
-
- return FALSE;
-}
-
-/* utility to draw the thumbnail frame. The frame is rectangular, so it doesn't need an alpha channel */
-
-static void
-draw_thumbnail_frame(GdkPixbuf *frame_pixbuf)
-{
- gint index, width, height, depth, rowstride, fill_value;
- guchar *pixels, *temp_pixels;
-
- width = gdk_pixbuf_get_width (frame_pixbuf);
- height = gdk_pixbuf_get_height (frame_pixbuf);
- depth = gdk_pixbuf_get_bits_per_sample (frame_pixbuf);
- pixels = gdk_pixbuf_get_pixels (frame_pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (frame_pixbuf);
-
- /* loop through the pixbuf a scaleline at a time, drawing the frame */
- for (index = 0; index < height; index++) {
- /* special case the first and last line to make them dark */
- fill_value = (index == 0 || index == height - 1) ? 0 : 239;
- memset(pixels, fill_value, rowstride);
-
- /* draw the frame at the edge for each scanline */
- temp_pixels = pixels;
- *temp_pixels++ = 0;
- *temp_pixels++ = 0;
- *temp_pixels++ = 0;
-
- pixels += rowstride;
-
- temp_pixels = pixels - 3;
- *temp_pixels++ = 0;
- *temp_pixels++ = 0;
- *temp_pixels++ = 0;
- }
-}
-
-/* make_thumbnails is invoked periodically as a timer task to launch a task to make thumbnails */
-
-static int
-nautilus_icon_factory_make_thumbnails (gpointer data)
-{
- pid_t thumbnail_pid;
- NautilusThumbnailInfo *info;
- NautilusIconFactory *factory = nautilus_get_current_icon_factory();
- GList *next_thumbnail = factory->thumbnails;
-
- /* if the queue is empty, there's nothing more to do */
-
- if (next_thumbnail == NULL) {
- gtk_timeout_remove (factory->timeout_task_id);
- factory->timeout_task_id = 0;
- return FALSE;
- }
-
- info = (NautilusThumbnailInfo *) next_thumbnail->data;
-
- /* see which state we're in. If a thumbnail isn't in progress, start one up. Otherwise,
- check if the pending one is completed. */
- if (factory->thumbnail_in_progress) {
- if (check_for_thumbnails(factory)) {
- factory->thumbnail_in_progress = FALSE;
- }
- }
- else {
- /* start up a task to make the thumbnail corresponding to the queue element. */
-
- /* First, compute the path name of the target thumbnail */
- g_free (factory->new_thumbnail_path);
- factory->new_thumbnail_path = make_thumbnail_path (info->thumbnail_uri, FALSE);
-
- /* fork a task to make the thumbnail, using gdk-pixbuf to do the scaling */
- if (!(thumbnail_pid = fork())) {
- GdkPixbuf* full_size_image;
-
- full_size_image = gdk_pixbuf_new_from_file (info->thumbnail_uri + 7);
- if (full_size_image != NULL) {
- GdkPixbuf *scaled_image, *framed_image;
- int scaled_width, scaled_height;
- int full_width = gdk_pixbuf_get_width (full_size_image);
- int full_height = gdk_pixbuf_get_height (full_size_image);
-
- if (full_width > full_height) {
- scaled_width = 96;
- scaled_height = full_height * 96 / full_width;
- } else {
- scaled_height = 96;
- scaled_width = full_width * 96 / full_height;
- }
-
- /* scale the image, then release the large one */
-
- scaled_image = gdk_pixbuf_scale_simple (full_size_image,
- scaled_width, scaled_height,
- GDK_INTERP_BILINEAR);
- gdk_pixbuf_unref (full_size_image);
-
- /* make the frame to mount it in - don't use an alpha channel, since it's rectangular */
- framed_image = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE, 8,
- scaled_width + 12, scaled_height + 12);
- draw_thumbnail_frame(framed_image);
-
- /* copy the scaled image into it, then release it */
- gdk_pixbuf_copy_area (scaled_image, 0, 0,
- scaled_width, scaled_height, framed_image, 6, 6);
- gdk_pixbuf_unref (scaled_image);
-
- if (!save_pixbuf_to_file (framed_image, factory->new_thumbnail_path + 7)) {
- g_warning ("error saving thumbnail %s", factory->new_thumbnail_path + 7);
- }
- gdk_pixbuf_unref (framed_image);
- }
- else {
- /* gdk-pixbuf couldn't load the image, so trying using ImageMagick */
- char *temp_str = g_strdup_printf ("png:%s", factory->new_thumbnail_path + 7);
- char *temp_file = g_strdup_printf("%s.tmp", factory->new_thumbnail_path + 7);
-
- /* scale the image, then draw a border and frame */
- execlp ("convert", "convert", "-geometry", "96x96", info->thumbnail_uri + 7, temp_str, NULL);
- execlp ("convert", "convert", "-bordercolor", "white", "-border", "8x8", info->thumbnail_uri + 7, temp_file, NULL);
- execlp ("convert", "convert", "-mattecolor", "gray", "-frame", "2x2", temp_file, info->thumbnail_uri + 7);
- unlink(temp_file);
- g_free(temp_file);
- g_free (temp_str);
- }
-
- _exit(0);
- }
- factory->thumbnail_in_progress = TRUE;
- }
-
- return TRUE; /* we're not done yet */
-}
-
-
-#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static char *
-self_test_next_icon_size_to_try (guint start_size, guint current_size)
-{
- gboolean got_next_size;
-
- got_next_size = get_next_icon_size_to_try (start_size, &current_size);
- return g_strdup_printf ("%s,%d", got_next_size ? "TRUE" : "FALSE", current_size);
-}
-
-void
-nautilus_self_check_icon_factory (void)
-{
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (0), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (1), 24);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (2), 36);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (3), 48);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (4), 72);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (5), 96);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_get_icon_size_for_zoom_level (6), 192);
-
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (0), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (1), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (11), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (12), 24);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (23), 24);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (24), 36);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (35), 36);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (36), 48);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (47), 48);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (48), 72);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (71), 72);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (72), 96);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (95), 96);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (96), 192);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (191), 192);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (192), 192);
- NAUTILUS_CHECK_INTEGER_RESULT (get_larger_icon_size (0xFFFFFFFF), 192);
-
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (0), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (1), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (11), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (12), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (24), 12);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (25), 24);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (36), 24);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (37), 36);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (48), 36);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (49), 48);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (72), 48);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (73), 72);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (96), 72);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (97), 96);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (192), 96);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (193), 192);
- NAUTILUS_CHECK_INTEGER_RESULT (get_smaller_icon_size (0xFFFFFFFF), 192);
-
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 0), "TRUE,12");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 12), "TRUE,24");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 24), "TRUE,36");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 36), "TRUE,48");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 48), "TRUE,72");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 72), "TRUE,96");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 96), "TRUE,192");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0, 192), "FALSE,192");
-
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 0), "TRUE,36");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 36), "TRUE,48");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 48), "TRUE,72");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 72), "TRUE,96");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 96), "TRUE,192");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 192), "TRUE,24");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 24), "TRUE,12");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (36, 12), "FALSE,12");
-
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 0), "TRUE,48");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 48), "TRUE,72");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 72), "TRUE,96");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 96), "TRUE,192");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 192), "TRUE,36");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 36), "TRUE,24");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 24), "TRUE,12");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (37, 12), "FALSE,12");
-
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 0), "TRUE,192");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 192), "TRUE,96");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 96), "TRUE,72");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 72), "TRUE,48");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 48), "TRUE,36");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 36), "TRUE,24");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 24), "TRUE,12");
- NAUTILUS_CHECK_STRING_RESULT (self_test_next_icon_size_to_try (0xFFFFFFFF, 12), "FALSE,12");
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-icon-factory.h b/libnautilus/nautilus-icon-factory.h
deleted file mode 100644
index aa421ffe3..000000000
--- a/libnautilus/nautilus-icon-factory.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-icon-factory.h: Class for obtaining icons for files and other objects.
-
- Copyright (C) 1999, 2000 Red Hat Inc.
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#ifndef NAUTILUS_ICON_FACTORY_H
-#define NAUTILUS_ICON_FACTORY_H
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-file.h>
-#include <gtk/gtkobject.h>
-#include <libart_lgpl/art_rect.h>
-
-/* NautilusIconFactory is a class that knows how to hand out icons to be
- * used for representing files and some other objects. It was designed
- * specifically to be useful for the Nautilus file browser, but could be
- * used by any program that wants to display the standard icon for a
- * file.
- *
- * The most common usage is to get a NautilusIconFactory object with
- * nautilus_get_current_icon_factory, then ask for an icon for a specific
- * file with nautilus_icon_factory_get_icon_for_file. The caller can ask
- * for any size icon, but normally will use one of the defined
- * NAUTILUS_ICON_SIZE macros.
- */
-
-/* Names for Nautilus's different zoom levels, from tiniest items to largest items */
-typedef enum {
- NAUTILUS_ZOOM_LEVEL_SMALLEST,
- NAUTILUS_ZOOM_LEVEL_SMALLER,
- NAUTILUS_ZOOM_LEVEL_SMALL,
- NAUTILUS_ZOOM_LEVEL_STANDARD,
- NAUTILUS_ZOOM_LEVEL_LARGE,
- NAUTILUS_ZOOM_LEVEL_LARGER,
- NAUTILUS_ZOOM_LEVEL_LARGEST
-} NautilusZoomLevel;
-
-/* Nominal icon sizes for each Nautilus zoom level.
- * This scheme assumes that icons are designed to
- * fit in a square space, though each image needn't
- * be square. Since individual icons can be stretched,
- * each icon is not constrained to this nominal size.
- */
-#define NAUTILUS_ICON_SIZE_SMALLEST 12
-#define NAUTILUS_ICON_SIZE_SMALLER 24
-#define NAUTILUS_ICON_SIZE_SMALL 36
-#define NAUTILUS_ICON_SIZE_STANDARD 48
-#define NAUTILUS_ICON_SIZE_LARGE 72
-#define NAUTILUS_ICON_SIZE_LARGER 96
-#define NAUTILUS_ICON_SIZE_LARGEST 192
-
-typedef struct NautilusScalableIcon NautilusScalableIcon;
-
-/* Instead of a class declaration here, I will just document
- * the signals.
- *
- * "icons_changed", no parameters
- */
-
-/* There's a single NautilusIconFactory object.
- * The only thing you need it for is to connect to its signals.
- */
-GtkObject * nautilus_icon_factory_get (void);
-
-/* Relationship between zoom levels and icons sizes. */
-guint nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level);
-
-/* Choose the appropriate icon, but don't render it yet. */
-NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
- const char *modifier);
-
-NautilusScalableIcon *nautilus_icon_factory_get_icon_by_name (const char *icon_name);
-GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file);
-
-/* Render an icon to a particular size.
- * Ownership of a ref. count in this pixbuf comes with the deal.
- * This allows scaling in both dimensions. All other calls assume
- * that X and Y scaling are the same. The text rectangle tells where
- * this icon can accomodate text. If the icon can't accomodate any
- * text, then the rectangle is (0, 0, 0, 0).
- */
-GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_icon (NautilusScalableIcon *scalable_icon,
- guint size_in_pixels_x,
- guint size_in_pixels_y,
- ArtIRect *embedded_text_rectangle);
-
-/* Convenience functions for the common case where you want to choose
- * and render the icon into a pixbuf all at once.
- */
-GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_file (NautilusFile *file,
- guint size_in_pixels);
-GdkPixbuf * nautilus_icon_factory_get_pixbuf_by_name (const char *icon_name,
- guint size_in_pixels);
-
-/* Convenience functions for legacy interfaces that require a pixmap and
- * bitmap. Maybe we can get rid of these one day.
- */
-void nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
- guint size_in_pixels,
- GdkPixmap **pixmap,
- GdkBitmap **mask);
-void nautilus_icon_factory_get_pixmap_and_mask_by_name (NautilusFile *file,
- guint size_in_pixels,
- GdkPixmap **pixmap,
- GdkBitmap **mask);
-
-/* Manage a scalable icon.
- * Since the factory always passes out references to the same scalable
- * icon, you can compare two scalable icons to see if they are the same
- * with ==.
- */
-void nautilus_scalable_icon_ref (NautilusScalableIcon *scalable_icon);
-void nautilus_scalable_icon_unref (NautilusScalableIcon *scalable_icon);
-
-/* The name of a scalable icon is suitable for storage in metadata.
- * This is a quick way to record the result of getting an icon by name.
- */
-char * nautilus_scalable_icon_get_name (NautilusScalableIcon *scalable_icon);
-
-/* Convenience function for freeing a list of scalable icons.
- * Unrefs all the icons before freeing the list.
- */
-void nautilus_scalable_icon_list_free (GList *scalable_icon_list);
-
-#endif /* NAUTILUS_ICON_FACTORY_H */
diff --git a/libnautilus/nautilus-icon-grid.c b/libnautilus/nautilus-icon-grid.c
deleted file mode 100644
index 3f2947258..000000000
--- a/libnautilus/nautilus-icon-grid.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-icon-container-grid.c - Grid used by icon container.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>, Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-icon-grid.h"
-
-#include <string.h>
-#include <math.h>
-#include "nautilus-gnome-extensions.h"
-
-#define INITIAL_GRID_WIDTH 64
-#define INITIAL_GRID_HEIGHT 64
-
-#define GRID_CELL_WIDTH 80
-#define GRID_CELL_HEIGHT 80
-
-#define FIRST_FREE_NONE G_MININT
-
-struct NautilusIconGrid {
- /* The grid. This is automatically sized to fit all the
- * icons, so it doesn't need to be explicitly allocated.
- */
- ArtIRect bounds;
- GList **elements;
-
- /* This is the number or grid positions that we actually use
- * for finding positions for new icons.
- */
- int visible_width;
-
- /* Position of the first free cell (used to speed up get_position).
- * Set first_free_x to FIRST_FREE_NONE to indicate no free cell.
- */
- int first_free_x, first_free_y;
-};
-
-NautilusIconGrid *
-nautilus_icon_grid_new (void)
-{
- return g_new0 (NautilusIconGrid, 1);
-}
-
-void
-nautilus_icon_grid_clear (NautilusIconGrid *grid)
-{
- int i, num_elements;
-
- num_elements = (grid->bounds.x1 - grid->bounds.x0)
- * (grid->bounds.y1 - grid->bounds.y0);
- for (i = 0; i < num_elements; i++) {
- g_list_free (grid->elements[i]);
- }
- g_free (grid->elements);
- grid->elements = 0;
-
- grid->bounds.x0 = 0;
- grid->bounds.y0 = 0;
- grid->bounds.x1 = 0;
- grid->bounds.y1 = 0;
- grid->first_free_x = 0;
- grid->first_free_y = 0;
-}
-
-void
-nautilus_icon_grid_destroy (NautilusIconGrid *grid)
-{
- nautilus_icon_grid_clear (grid);
- g_free (grid);
-}
-
-static GList **
-get_element_ptr (GList **elements,
- const ArtIRect *bounds,
- int x, int y)
-{
- g_assert (x >= bounds->x0);
- g_assert (y >= bounds->y0);
- g_assert (x < bounds->x1);
- g_assert (y < bounds->y1);
-
- return &elements[(y - bounds->y0)
- * (bounds->x1 - bounds->x0)
- + (x - bounds->x0)];
-}
-
-static GList **
-grid_get_element_ptr (NautilusIconGrid *grid,
- int x, int y)
-{
- return get_element_ptr (grid->elements, &grid->bounds, x, y);
-}
-
-static void
-resize (NautilusIconGrid *grid,
- const ArtIRect *new_bounds)
-{
- int new_size;
- GList **new_elements;
- int x, y;
-
- g_assert (nautilus_art_irect_contains_irect (new_bounds, &grid->bounds));
- g_assert (new_bounds->x1 >= grid->visible_width);
-
- new_size = (new_bounds->x1 - new_bounds->x0) * (new_bounds->y1 - new_bounds->y0);
- new_elements = g_new0 (GList *, new_size);
-
- for (x = grid->bounds.x0; x < grid->bounds.x1; x++) {
- for (y = grid->bounds.y0; y < grid->bounds.y1; y++) {
- *get_element_ptr (new_elements, new_bounds, x, y) =
- *grid_get_element_ptr (grid, x, y);
- }
- }
-
- g_free (grid->elements);
- grid->elements = new_elements;
-
- /* We might have a newly-free position if we are making the grid taller. */
- if (new_bounds->y1 > grid->bounds.y1
- && grid->first_free_x == FIRST_FREE_NONE) {
- grid->first_free_x = 0;
- grid->first_free_y = grid->bounds.y1;
- }
-
- grid->bounds = *new_bounds;
-}
-
-static void
-update_first_free_forward (NautilusIconGrid *grid)
-{
- int x, y;
-
- if (grid->first_free_x == FIRST_FREE_NONE) {
- x = 0;
- y = 0;
- } else {
- x = grid->first_free_x;
- y = grid->first_free_y;
- }
-
- while (y < grid->bounds.y1) {
- if (*grid_get_element_ptr (grid, x, y) == NULL) {
- grid->first_free_x = x;
- grid->first_free_y = y;
- return;
- }
-
- x++;
- if (x >= grid->visible_width) {
- x = 0;
- y++;
- }
- }
-
- /* No free cell found. */
- grid->first_free_x = FIRST_FREE_NONE;
-}
-
-void
-nautilus_icon_grid_set_visible_width (NautilusIconGrid *grid,
- double world_visible_width)
-{
- int visible_width;
- ArtIRect bounds;
-
- visible_width = MAX(1, floor (world_visible_width / GRID_CELL_WIDTH));
-
- if (visible_width > grid->bounds.x1) {
- bounds = grid->bounds;
- bounds.x1 = visible_width;
- resize (grid, &bounds);
- }
-
- /* Check and see if there are newly-free positions because
- * the layout part of the grid is getting wider.
- */
- if (visible_width > grid->visible_width
- && grid->bounds.y1 > 0
- && grid->first_free_x == FIRST_FREE_NONE) {
- grid->first_free_x = visible_width;
- grid->first_free_y = 0;
- }
-
- grid->visible_width = visible_width;
-
- /* Check and see if the old first-free position is illegal
- * because the layout part of the grid is getting narrower.
- */
- if (grid->first_free_x >= visible_width) {
- g_assert (grid->first_free_x != FIRST_FREE_NONE);
- if (grid->first_free_y == grid->bounds.y1 - 1) {
- grid->first_free_x = FIRST_FREE_NONE;
- } else {
- grid->first_free_x = 0;
- grid->first_free_y++;
- update_first_free_forward (grid);
- }
- }
-}
-
-static void
-maybe_resize (NautilusIconGrid *grid,
- int x, int y)
-{
- ArtIRect new_bounds;
-
- new_bounds = grid->bounds;
-
- if (new_bounds.x0 == new_bounds.x1) {
- if (grid->visible_width != 0) {
- new_bounds.x1 = grid->visible_width;
- } else {
- new_bounds.x1 = INITIAL_GRID_WIDTH;
- }
- }
-
- if (new_bounds.y0 == new_bounds.y1) {
- new_bounds.y1 = INITIAL_GRID_HEIGHT;
- }
-
- while (x < new_bounds.x0) {
- new_bounds.x0 -= new_bounds.x1 - new_bounds.x0;
- }
- while (x >= new_bounds.x1) {
- new_bounds.x1 += new_bounds.x1 - new_bounds.x0;
- }
- while (y < new_bounds.y0) {
- new_bounds.y0 -= new_bounds.y1 - new_bounds.y0;
- }
- while (y >= new_bounds.y1) {
- new_bounds.y1 += new_bounds.y1 - new_bounds.y0;
- }
-
- if (!nautilus_art_irect_equal (&new_bounds, &grid->bounds)) {
- resize (grid, &new_bounds);
- }
-}
-
-static void
-grid_add_one (NautilusIconGrid *grid,
- NautilusIcon *icon,
- int x, int y)
-{
- GList **elem_ptr;
-
- maybe_resize (grid, x, y);
-
- elem_ptr = grid_get_element_ptr (grid, x, y);
- g_assert (g_list_find (*elem_ptr, icon) == NULL);
- *elem_ptr = g_list_prepend (*elem_ptr, icon);
-
- if (x == grid->first_free_x && y == grid->first_free_y) {
- update_first_free_forward (grid);
- }
-}
-
-static void
-grid_remove_one (NautilusIconGrid *grid,
- NautilusIcon *icon,
- int x, int y)
-{
- GList **elem_ptr;
-
- elem_ptr = grid_get_element_ptr (grid, x, y);
- g_assert (g_list_find (*elem_ptr, icon) != NULL);
- *elem_ptr = g_list_remove (*elem_ptr, icon);
-
- if (*elem_ptr == NULL) {
- if (grid->first_free_x == FIRST_FREE_NONE
- || grid->first_free_y > y
- || (grid->first_free_y == y && grid->first_free_x > x)) {
- grid->first_free_x = x;
- grid->first_free_y = y;
- }
- }
-}
-
-static void
-add_or_remove (NautilusIconGrid *grid,
- NautilusIcon *icon,
- gboolean add)
-{
- int x, y;
-
- /* Add/remove to all the overlapped grid squares. */
- for (x = icon->grid_rectangle.x0; x < icon->grid_rectangle.x1; x++) {
- for (y = icon->grid_rectangle.y0; y < icon->grid_rectangle.y1; y++) {
- if (add) {
- grid_add_one (grid, icon, x, y);
- } else {
- grid_remove_one (grid, icon, x, y);
- }
- }
- }
-}
-
-void
-nautilus_icon_grid_add (NautilusIconGrid *grid,
- NautilusIcon *icon)
-{
- ArtDRect world_bounds;
-
- /* Figure out how big the icon is. */
- nautilus_gnome_canvas_item_get_world_bounds
- (GNOME_CANVAS_ITEM (icon->item), &world_bounds);
-
- /* Compute grid bounds for the icon. */
- icon->grid_rectangle.x0 = floor (world_bounds.x0 / GRID_CELL_WIDTH);
- icon->grid_rectangle.y0 = floor (world_bounds.y0 / GRID_CELL_HEIGHT);
- icon->grid_rectangle.x1 = ceil (world_bounds.x1 / GRID_CELL_WIDTH);
- icon->grid_rectangle.y1 = ceil (world_bounds.y1 / GRID_CELL_HEIGHT);
-
- add_or_remove (grid, icon, TRUE);
-}
-
-void
-nautilus_icon_grid_remove (NautilusIconGrid *grid,
- NautilusIcon *icon)
-{
- add_or_remove (grid, icon, FALSE);
-}
-
-void
-nautilus_icon_grid_get_position (NautilusIconGrid *grid,
- NautilusIcon *icon,
- ArtPoint *position)
-{
- int grid_x, grid_y;
-
- g_return_if_fail (grid != NULL);
- g_return_if_fail (position != NULL);
-
- if (grid->first_free_x == FIRST_FREE_NONE) {
- grid_x = 0;
- grid_y = grid->bounds.y1;
- } else {
- grid_x = grid->first_free_x;
- grid_y = grid->first_free_y;
- }
-
- position->x = (double) grid_x * GRID_CELL_WIDTH;
- position->y = (double) grid_y * GRID_CELL_HEIGHT;
-}
-
-static int
-nautilus_compare_pointers_as_integers (gconstpointer a, gconstpointer b)
-{
- int ai, bi;
-
- ai = GPOINTER_TO_INT (a);
- bi = GPOINTER_TO_INT (b);
- if (ai < bi) {
- return -1;
- }
- if (ai > bi) {
- return 1;
- }
- return 0;
-}
-
-static GList *
-nautilus_g_list_remove_duplicates (GList *list)
-{
- GList *p, *next;
- gpointer previous_data;
-
- list = g_list_sort (list, nautilus_compare_pointers_as_integers);
-
- previous_data = NULL;
- for (p = list; p != NULL; p = next) {
- next = p->next;
-
- g_assert (p->data != NULL);
- if (previous_data != p->data) {
- previous_data = p->data;
- } else {
- list = g_list_remove_link (list, p);
- g_list_free_1 (p);
- }
- }
- return list;
-}
-
-GList *
-nautilus_icon_grid_get_intersecting_icons (NautilusIconGrid *grid,
- const ArtDRect *world_rect)
-{
- ArtIRect test_rect;
- int x, y;
- GList *list;
- GList *cell_list;
-
- test_rect.x0 = floor (world_rect->x0 / GRID_CELL_WIDTH);
- test_rect.y0 = floor (world_rect->y0 / GRID_CELL_HEIGHT);
- test_rect.x1 = ceil (world_rect->x1 / GRID_CELL_WIDTH);
- test_rect.y1 = ceil (world_rect->y1 / GRID_CELL_HEIGHT);
-
- art_irect_intersect (&test_rect, &test_rect, &grid->bounds);
-
- list = NULL;
- for (x = test_rect.x0; x < test_rect.x1; x++) {
- for (y = test_rect.y0; y < test_rect.y1; y++) {
- cell_list = *grid_get_element_ptr (grid, x, y);
- list = g_list_concat (list, g_list_copy (cell_list));
- }
- }
- return nautilus_g_list_remove_duplicates (list);
-}
diff --git a/libnautilus/nautilus-icon-grid.h b/libnautilus/nautilus-icon-grid.h
deleted file mode 100644
index 6b6d7ee8f..000000000
--- a/libnautilus/nautilus-icon-grid.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-icon-grid.h - Grid used by icon container.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Ettore Perazzoli <ettore@gnu.org>,
- Darin Adler <darin@eazel.com>
-*/
-
-#include "nautilus-icon-private.h"
-
-/* setting up the grid */
-NautilusIconGrid * nautilus_icon_grid_new (void);
-void nautilus_icon_grid_destroy (NautilusIconGrid *grid);
-void nautilus_icon_grid_clear (NautilusIconGrid *grid);
-void nautilus_icon_grid_set_visible_width (NautilusIconGrid *grid,
- double world_visible_width);
-
-/* getting icons in and out of the grid */
-void nautilus_icon_grid_add (NautilusIconGrid *grid,
- NautilusIcon *icon);
-void nautilus_icon_grid_remove (NautilusIconGrid *grid,
- NautilusIcon *icon);
-void nautilus_icon_grid_get_position (NautilusIconGrid *grid,
- NautilusIcon *icon,
- ArtPoint *world_point);
-
-/* getting groups of icons in parts of the grid */
-GList *nautilus_icon_grid_get_intersecting_icons (NautilusIconGrid *grid,
- const ArtDRect *world_rectangle);
diff --git a/libnautilus/nautilus-icon-private.h b/libnautilus/nautilus-icon-private.h
deleted file mode 100644
index 36db8051f..000000000
--- a/libnautilus/nautilus-icon-private.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gnome-icon-container-private.h
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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: Ettore Perazzoli <ettore@gnu.org>
-*/
-
-#ifndef NAUTILUS_ICON_CONTAINER_PRIVATE_H
-#define NAUTILUS_ICON_CONTAINER_PRIVATE_H
-
-#include "nautilus-icon-container.h"
-#include "nautilus-icon-dnd.h"
-#include "nautilus-icon-factory.h"
-#include "nautilus-icon-canvas-item.h"
-
-/* An Icon. */
-
-typedef struct {
- /* Object represented by this icon. */
- NautilusIconData *data;
-
- /* Canvas item for the icon. */
- NautilusIconCanvasItem *item;
-
- /* X/Y coordinates. */
- double x, y;
-
- /* Scale factor (stretches icon). */
- double scale_x, scale_y;
-
- /* Whether this item is selected. */
- gboolean is_selected : 1;
-
- /* Whether this item was selected before rubberbanding. */
- gboolean was_selected_before_rubberband : 1;
-
- /* Grid space occupied by this icon. */
- ArtIRect grid_rectangle;
-} NautilusIcon;
-
-
-
-/* Private NautilusIconContainer members. */
-
-typedef struct {
- gboolean active;
-
- double start_x, start_y;
-
- GnomeCanvasItem *selection_rectangle;
-
- guint timer_id;
-
- guint prev_x, prev_y;
- ArtDRect prev_rect;
-} NautilusIconRubberbandInfo;
-
-typedef enum {
- DRAG_ACTION_MOVE_OR_COPY,
- DRAG_ACTION_STRETCH
-} DragAction;
-
-typedef struct {
- /* Pointer position in canvas coordinates. */
- int pointer_x, pointer_y;
-
- /* Icon top, left, and size in canvas coordinates. */
- int icon_x, icon_y;
- guint icon_size;
-} StretchState;
-
-typedef enum {
- AXIS_NONE,
- AXIS_HORIZONTAL,
- AXIS_VERTICAL
-} Axis;
-
-typedef struct NautilusIconGrid NautilusIconGrid;
-
-struct NautilusIconContainerDetails {
- /* single-click mode setting */
- gboolean single_click_mode;
-
- /* List of icons. */
- GList *icons;
-
- /* The grid. */
- NautilusIconGrid *grid;
-
- /* Current icon for keyboard navigation. */
- NautilusIcon *keyboard_focus;
-
- /* Current icon with stretch handles, so we have only one. */
- NautilusIcon *stretch_icon;
-
- /* Last highlighted drop target. */
- NautilusIcon *drop_target;
-
- /* Rubberbanding status. */
- NautilusIconRubberbandInfo rubberband_info;
-
- /* Timeout used to make a selected icon fully visible after a short
- * period of time. (The timeout is needed to make sure
- * double-clicking still works.)
- */
- guint keyboard_icon_reveal_timer_id;
- NautilusIcon *keyboard_icon_to_reveal;
-
- /* Remembered information about the start of the current event. */
- guint32 button_down_time;
-
- /* Drag state. Valid only if drag_button is non-zero. */
- guint drag_button;
- NautilusIcon *drag_icon;
- int drag_x, drag_y;
- DragAction drag_action;
- gboolean drag_started;
- StretchState stretch_start;
-
- /* Idle ID. */
- guint idle_id;
-
- /* Timeout for selection in browser mode. */
- guint linger_selection_mode_timer_id;
-
- /* Icon to be selected at timeout in browser mode. */
- NautilusIcon *linger_selection_mode_icon;
-
- /* DnD info. */
- NautilusIconDndInfo *dnd_info;
-
- /* zoom level */
- int zoom_level;
-
- /* default fonts used to draw labels */
- GdkFont *label_font[NAUTILUS_ZOOM_LEVEL_LARGEST + 1];
-
- /* State used so arrow keys don't wander if icons aren't lined up.
- * Keeps track of last axis arrow key was used on.
- */
- Axis arrow_key_axis;
- int arrow_key_start;
-};
-
-/* Private functions shared by mutiple files. */
-NautilusIcon *nautilus_icon_container_get_icon_by_uri (NautilusIconContainer *container,
- const char *uri);
-void nautilus_icon_container_move_icon (NautilusIconContainer *container,
- NautilusIcon *icon,
- int x,
- int y,
- double scale_x,
- double scale_y,
- gboolean raise);
-void nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *container,
- GList *icons);
-char * nautilus_icon_container_get_icon_uri (NautilusIconContainer *container,
- NautilusIcon *icon);
-void nautilus_icon_container_update_icon (NautilusIconContainer *container,
- NautilusIcon *icon);
-
-#endif /* NAUTILUS_ICON_CONTAINER_PRIVATE_H */
diff --git a/libnautilus/nautilus-lib-self-check-functions.c b/libnautilus/nautilus-lib-self-check-functions.c
deleted file mode 100644
index e75c7e905..000000000
--- a/libnautilus/nautilus-lib-self-check-functions.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-lib-self-check-functions.c: Wrapper for all self check functions
- in Nautilus proper.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-
-#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
-
-#include "nautilus-lib-self-check-functions.h"
-
-void nautilus_run_lib_self_checks ()
-{
- NAUTILUS_LIB_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_CALL_SELF_CHECK_FUNCTION)
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-lib-self-check-functions.h b/libnautilus/nautilus-lib-self-check-functions.h
deleted file mode 100644
index f8366d13b..000000000
--- a/libnautilus/nautilus-lib-self-check-functions.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-lib-self-check-functions.h: Wrapper and prototypes for all
- self-check functions in libnautilus.
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include "nautilus-self-checks.h"
-
-void nautilus_run_lib_self_checks (void);
-
-/* Putting the prototypes for these self-check functions in each
- header file for the files they are defined in would make compiling
- the self-check framework take way too long (since one file would
- have to include everything).
-
- So we put the list of functions here instead.
-
- Instead of just putting prototypes here, we put this macro that
- can be used to do operations on the whole list of functions.
-*/
-
-#define NAUTILUS_LIB_FOR_EACH_SELF_CHECK_FUNCTION(macro) \
- macro (nautilus_self_check_string) \
- macro (nautilus_self_check_string_list) \
- macro (nautilus_self_check_glib_extensions) \
- macro (nautilus_self_check_gdk_extensions) \
- macro (nautilus_self_check_background) \
- macro (nautilus_self_check_directory) \
- macro (nautilus_self_check_file) \
- macro (nautilus_self_check_icon_container) \
- macro (nautilus_self_check_icon_factory) \
-/* Add new self-check functions to the list above this line. */
-
-/* Generate prototypes for all the functions. */
-NAUTILUS_LIB_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_SELF_CHECK_FUNCTION_PROTOTYPE)
diff --git a/libnautilus/nautilus-list-column-title.c b/libnautilus/nautilus-list-column-title.c
deleted file mode 100644
index 60af67c4c..000000000
--- a/libnautilus/nautilus-list-column-title.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-list-column-title.c: List column title widget for interacting with list columns
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Pavel Cisler <pavel@eazel.com>
-
-*/
-
-#include <config.h>
-#include "nautilus-list-column-title.h"
-
-#include "nautilus-gtk-macros.h"
-#include "nautilus-gdk-extensions.h"
-
-#include "nautilus-list.h"
-
-#include <gdk/gdk.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkmain.h>
-
-#include <libgnomeui/gnome-pixmap.h>
-
-/* these are from GtkCList, for now we need to copy them here
- * eventually the target list should be able to describe the values
- */
-
-enum {
- /* this defines the base grid spacing */
- CELL_SPACING = 1,
-
- /* added the horizontal space at the beginning and end of a row */
- COLUMN_INSET = 3,
-
- /* from GtkButton */
- CHILD_SPACING = 1,
-
- /* the width of the column resize windows */
- DRAG_WIDTH = 6
-};
-
-static char * down_xpm[] = {
- "6 5 2 1",
- " c None",
- ". c #000000",
- "......",
- " ",
- " .... ",
- " ",
- " .. "
-};
-
-static char * up_xpm[] = {
- "6 5 2 1",
- " c None",
- ". c #000000",
- " .. ",
- " ",
- " .... ",
- " ",
- "......"
-};
-
-#define COLUMN_TITLE_THEME_STYLE_NAME "menu"
-
-struct NautilusListColumnTitleDetails
-{
- /* gc for blitting sort order pixmaps, lazily allocated */
- GdkGC *copy_area_gc;
-
- /* sort order indicator pixmaps, lazily allocated */
- GnomePixmap *up_indicator;
- GnomePixmap *down_indicator;
-
- /* offscreen drawing support */
- /* FIXME: consolidate this into it's own class once I figure out all the
- * details
- */
- GtkWidget *offscreen_widget;
- GdkPixmap *offscreen_pixmap;
- GdkGC *offscreen_blitting_gc;
-
- int tracking_column_resize;
- /* index of the column we are currently tracking or -1 */
- int tracking_column_prelight;
- /* index of the column we are currently rolling over or -1 */
- int tracking_column_press;
- /* index of the column we are currently pressing or -1 */
-
- int last_tracking_x;
- /* last horizontal track point so we can only resize when needed */
- gboolean resize_cursor_on;
-
-};
-
-static void nautilus_list_column_title_initialize_class (gpointer klass);
-static void nautilus_list_column_title_initialize (gpointer object, gpointer klass);
-static void nautilus_list_column_title_paint (GtkWidget *widget, GtkWidget *draw_target, GdkDrawable *target_drawable, GdkRectangle *area);
-static void nautilus_list_column_title_draw (GtkWidget *widget, GdkRectangle *box);
-static void nautilus_list_column_title_buffered_draw (GtkWidget *widget);
-static gboolean nautilus_list_column_title_expose (GtkWidget *widget, GdkEventExpose *event);
-static void nautilus_list_column_title_realize (GtkWidget *widget);
-static void nautilus_list_column_title_finalize (GtkObject *object);
-static void nautilus_list_column_title_request (GtkWidget *widget, GtkRequisition *requisition);
-
-static gboolean nautilus_list_column_title_motion (GtkWidget *widget, GdkEventMotion *event);
-static gboolean nautilus_list_column_title_leave (GtkWidget *widget, GdkEventCrossing *event);
-
-static gboolean nautilus_list_column_title_button_press (GtkWidget *widget, GdkEventButton *event);
-static gboolean nautilus_list_column_title_button_release (GtkWidget *widget, GdkEventButton *event);
-
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusListColumnTitle, nautilus_list_column_title, GTK_TYPE_BIN)
-/* generates nautilus_list_column_title_get_type */
-
-static void
-nautilus_list_column_title_initialize_class (gpointer klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->finalize = nautilus_list_column_title_finalize;
- widget_class->draw = nautilus_list_column_title_draw;
- widget_class->expose_event = nautilus_list_column_title_expose;
- widget_class->realize = nautilus_list_column_title_realize;
- widget_class->size_request = nautilus_list_column_title_request;
- widget_class->motion_notify_event = nautilus_list_column_title_motion;
- widget_class->leave_notify_event = nautilus_list_column_title_leave;
- widget_class->button_press_event = nautilus_list_column_title_button_press;
- widget_class->button_release_event = nautilus_list_column_title_button_release;
-}
-
-NautilusListColumnTitle *
-nautilus_list_column_title_new (void)
-{
- return gtk_type_new (nautilus_list_column_title_get_type ());
-}
-
-static void
-nautilus_list_column_title_initialize (gpointer object, gpointer klass)
-{
- NautilusListColumnTitle *column_title;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(object);
- column_title->details = g_new0 (NautilusListColumnTitleDetails, 1);
-
- /* copy_gc, up/down indicators get allocated lazily when needed */
- column_title->details->copy_area_gc = NULL;
- column_title->details->up_indicator = NULL;
- column_title->details->down_indicator = NULL;
- column_title->details->offscreen_widget = NULL;
- column_title->details->offscreen_pixmap = NULL;
- column_title->details->offscreen_blitting_gc = NULL;
-
- column_title->details->resize_cursor_on = FALSE;
- column_title->details->tracking_column_resize = -1;
- column_title->details->tracking_column_prelight = -1;
- column_title->details->tracking_column_press = -1;
- column_title->details->last_tracking_x = -1;
-
- GTK_WIDGET_UNSET_FLAGS (object, GTK_NO_WINDOW);
-}
-
-static void
-nautilus_list_column_title_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- int attributes_mask;
-
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- /* ask for expose events */
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
- attributes.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
- attributes.width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- attributes.height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_KEY_PRESS_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- /* give ourselves a background window */
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-nautilus_list_column_title_finalize (GtkObject *object)
-{
- NautilusListColumnTitle *column_title;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(object);
-
- if (column_title->details->up_indicator != NULL) {
- gtk_widget_destroy (GTK_WIDGET (column_title->details->up_indicator));
- }
- if (column_title->details->down_indicator != NULL) {
- gtk_widget_destroy (GTK_WIDGET (column_title->details->down_indicator));
- }
-
- if (column_title->details->offscreen_widget != NULL) {
- gdk_pixmap_unref (column_title->details->offscreen_pixmap);
- gtk_widget_unref (column_title->details->offscreen_widget);
- gdk_gc_destroy (column_title->details->offscreen_blitting_gc);
-
- }
-
- if (column_title->details->copy_area_gc != NULL) {
- gdk_gc_destroy (column_title->details->copy_area_gc);
- }
-
- g_free (column_title->details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-nautilus_list_column_title_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- /* size requisition: make sure we have at least a minimal height */
-
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (requisition != NULL);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- widget->style->klass->xthickness) * 2;
- requisition->height = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- widget->style->klass->ythickness) * 2;
-
-
- if (GTK_BIN (widget)->child && GTK_WIDGET_VISIBLE (GTK_BIN (widget)->child)) {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (GTK_BIN (widget)->child, &child_requisition);
-
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
-
- requisition->height = MIN (requisition->height, 10);
- }
-}
-
-static const char *
-get_column_label_at (GtkWidget *column_title, int index)
-{
- GtkCList *parent_clist;
-
- parent_clist = GTK_CLIST (column_title->parent);
-
- return parent_clist->column[index].title;
-}
-
-static void
-get_column_frame_at(GtkWidget *column_title, int index, GdkRectangle *result)
-{
- GtkCList *parent_clist;
- parent_clist = GTK_CLIST (column_title->parent);
-
- *result = parent_clist->column_title_area;
- result->x = parent_clist->hoffset + parent_clist->column[index].area.x - COLUMN_INSET;
- result->y = 0;
- result->width = parent_clist->column[index].area.width
- + CELL_SPACING + 2 * COLUMN_INSET - 1;
-}
-
-static GnomePixmap *
-get_sort_indicator (GtkWidget *widget, gboolean ascending)
-{
- /* return the sort order pixmap for a given sort direction
- * allocate the pixmap first time around
- */
- NautilusListColumnTitle *column_title;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
-
- if (ascending) {
- if (column_title->details->up_indicator == NULL) {
- column_title->details->up_indicator =
- GNOME_PIXMAP (gnome_pixmap_new_from_xpm_d (up_xpm));
- }
- return column_title->details->up_indicator;
- } else {
- if (column_title->details->down_indicator == NULL) {
- column_title->details->down_indicator =
- GNOME_PIXMAP (gnome_pixmap_new_from_xpm_d (down_xpm));
- }
- return column_title->details->down_indicator;
- }
-}
-
-/* FIXME:
- * Some of these magic numbers could be replaced with some more dynamic values
- */
-enum {
- CELL_TITLE_INSET = 3,
- TITLE_BASELINE_OFFSET = 6,
- SORT_ORDER_INDICATOR_WIDTH = 10,
- SORT_INDICATOR_X_OFFSET = 6,
- SORT_INDICATOR_Y_OFFSET = 3
-};
-
-static void
-nautilus_list_column_title_paint (GtkWidget *widget, GtkWidget *draw_target,
- GdkDrawable *target_drawable, GdkRectangle *area)
-{
- NautilusListColumnTitle *column_title;
- GtkCList *parent_clist;
- int index;
-
- g_assert (GTK_CLIST (widget->parent) != NULL);
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
- parent_clist = GTK_CLIST (widget->parent);
-
- for (index = 0; index < parent_clist->columns; index++) {
- GdkRectangle cell_rectangle;
- GdkRectangle cell_redraw_area;
- const char *cell_label;
- int text_x_offset;
- int sort_indicator_x_offset;
- GnomePixmap *sort_indicator;
- gboolean right_justified;
-
- sort_indicator_x_offset = 0;
- sort_indicator = NULL;
- right_justified = (parent_clist->column[index].justification == GTK_JUSTIFY_RIGHT);
-
- /* pick the ascending/descending sort indicator if needed */
- if (index == parent_clist->sort_column) {
- sort_indicator = get_sort_indicator (widget,
- parent_clist->sort_type == GTK_SORT_ASCENDING);
- }
-
- get_column_frame_at (widget, index, &cell_rectangle);
- gdk_rectangle_intersect (&cell_rectangle, area, &cell_redraw_area);
-
- if (cell_redraw_area.width == 0 || cell_redraw_area.height == 0) {
- /* no work, go on to the next */
- continue;
- }
-
- cell_label = get_column_label_at (widget, index);
-
- /* FIXME:
- * add support for center justification
- */
-
- if (right_justified) {
- text_x_offset = cell_rectangle.x + cell_rectangle.width - CELL_TITLE_INSET;
- } else {
- text_x_offset = cell_rectangle.x + CELL_TITLE_INSET;
- }
-
- /* Paint the column tiles as rectangles using "menu" (COLUMN_TITLE_THEME_STYLE_NAME).
- * Style buttons as used by GtkCList produce round corners in some themes.
- * Eventually we might consider having a separate style for column titles.
- */
- gtk_paint_box (widget->style, target_drawable,
- column_title->details->tracking_column_prelight == index ?
- GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
- column_title->details->tracking_column_press == index ?
- GTK_SHADOW_IN : GTK_SHADOW_OUT,
- area, draw_target, COLUMN_TITLE_THEME_STYLE_NAME,
- cell_rectangle.x, cell_rectangle.y,
- cell_rectangle.width, cell_rectangle.height);
-
-
- /* Draw the sort indicator if needed */
- if (sort_indicator != NULL) {
- int y_offset;
-
- if (right_justified) {
- sort_indicator_x_offset = cell_rectangle.x + SORT_INDICATOR_X_OFFSET;
- } else {
- sort_indicator_x_offset = cell_rectangle.x + cell_rectangle.width
- - SORT_INDICATOR_X_OFFSET - SORT_ORDER_INDICATOR_WIDTH;
- }
- y_offset = cell_rectangle.y + cell_rectangle.height / 2
- - SORT_INDICATOR_Y_OFFSET;
-
- /* allocate the sort indicator copy gc first time around */
- if (column_title->details->copy_area_gc == NULL) {
- column_title->details->copy_area_gc = gdk_gc_new (widget->window);
- gdk_gc_set_function (column_title->details->copy_area_gc, GDK_COPY);
- }
- /* move the pixmap clip mask and origin to the right spot in the gc */
- gdk_gc_set_clip_mask (column_title->details->copy_area_gc,
- sort_indicator->mask);
- gdk_gc_set_clip_origin (column_title->details->copy_area_gc, sort_indicator_x_offset, y_offset);
-
-
- gdk_draw_pixmap (target_drawable, column_title->details->copy_area_gc,
- sort_indicator->pixmap, 0, 0, sort_indicator_x_offset, y_offset,
- -1, -1);
-
- }
-
- if (cell_label) {
- /* extend the redraw area vertically to contain the entire cell
- * -- seems like if I don't do this, for short exposed areas no text
- * will get drawn
- * this happens when the title is half off-screen and you move it up by a pixel or two;
- * if you move it up faster, it gets redrawn properly
- */
- cell_redraw_area.y = cell_rectangle.y;
- cell_redraw_area.height = cell_rectangle.height;
-
-
- /* clip a little more than the cell rectangle to
- * not have the text draw over the cell broder
- * (this might no longer be needed when the
- * title gets truncated properly, as opposed to
- * getting chopped of
- */
- nautilus_rectangle_inset (&cell_redraw_area, 2, 2);
- if (right_justified) {
- text_x_offset -= gdk_string_width (widget->style->font, cell_label) + 3;
- }
-
- gtk_paint_string (widget->style, target_drawable, GTK_STATE_NORMAL,
- &cell_redraw_area, draw_target, "label",
- text_x_offset,
- cell_rectangle.y + cell_rectangle.height - TITLE_BASELINE_OFFSET,
- cell_label);
- }
- }
-}
-
-static void
-nautilus_list_column_title_draw (GtkWidget *widget, GdkRectangle *area)
-{
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget)) {
- return;
- }
-
- nautilus_list_column_title_paint (widget, widget, widget->window, area);
-}
-
-static void
-nautilus_list_column_title_buffered_draw (GtkWidget *widget)
-{
- /* draw using an offscreen_widget bitmap */
- GdkRectangle redraw_area;
- NautilusListColumnTitle *column_title;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
-
- redraw_area.x = widget->allocation.x;
- redraw_area.y = widget->allocation.y;
- redraw_area.width = widget->allocation.width;
- redraw_area.height = widget->allocation.height;
-
- if (column_title->details->offscreen_widget != NULL
- && (column_title->details->offscreen_widget->allocation.x < redraw_area.x
- || column_title->details->offscreen_widget->allocation.y < redraw_area.y
- || column_title->details->offscreen_widget->allocation.width > redraw_area.width
- || column_title->details->offscreen_widget->allocation.height > redraw_area.height)) {
- /* existing offscreen_widget not large enough, need to
- * allocate a new one, get rid of the old one first
- */
- gdk_pixmap_unref (column_title->details->offscreen_pixmap);
- gtk_widget_unref (column_title->details->offscreen_widget);
- column_title->details->offscreen_widget = NULL;
- }
-
- if (column_title->details->offscreen_widget == NULL) {
- /* allocate a new offscreen_widget */
- column_title->details->offscreen_pixmap = gdk_pixmap_new (widget->window,
- redraw_area.width,
- redraw_area.height, -1);
- column_title->details->offscreen_widget =
- gtk_type_new (gtk_widget_get_type ());
-
- gdk_window_set_user_data (column_title->details->offscreen_pixmap,
- column_title->details->offscreen_widget);
- gtk_widget_show (column_title->details->offscreen_widget);
- }
-
-
- /* Erase the offscreen background.
- * We are using the GtkStyle call to draw the background - this is a tiny bit
- * less efficient but gives us the convenience of setting up the right colors and
- * gc for the style we are using to blit the column titles.
- */
- gtk_paint_box (widget->style, column_title->details->offscreen_pixmap,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- &redraw_area, column_title->details->offscreen_widget,
- COLUMN_TITLE_THEME_STYLE_NAME,
- redraw_area.x, redraw_area.y,
- redraw_area.width, redraw_area.height);
-
- /* render the column titles into the offscreen */
- nautilus_list_column_title_paint (widget, column_title->details->offscreen_widget,
- column_title->details->offscreen_pixmap, &redraw_area);
-
- if (column_title->details->offscreen_blitting_gc == NULL)
- /* allocate a gc to blit the offscreen if needed */
- column_title->details->offscreen_blitting_gc = gdk_gc_new (widget->window);
-
- /* blit the offscreen into the real view */
- gdk_draw_pixmap (widget->window, column_title->details->offscreen_blitting_gc,
- column_title->details->offscreen_pixmap,
- 0, 0, 0, 0, -1, -1);
-}
-
-static gboolean
-nautilus_list_column_title_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (event != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget)) {
- return FALSE;
- }
-
- nautilus_list_column_title_paint (widget, widget, widget->window, &event->area);
-
- return FALSE;
-}
-
-static int
-in_column_rect (GtkWidget *widget, int x, int y)
-{
- /* return the index of the column we hit or -1 */
-
- GtkCList *parent_clist;
- int index;
-
- parent_clist = GTK_CLIST (widget->parent);
-
- for (index = 0; index < parent_clist->columns; index++) {
- /* hit testing for column resizing */
- GdkRectangle cell_rectangle;
-
- get_column_frame_at (widget, index, &cell_rectangle);
-
- /* inset by a pixel so that you have to move past the border
- * to be considered inside the rect
- * nautilus_list_column_title_leave depends on this
- */
- nautilus_rectangle_inset (&cell_rectangle, 1, 0);
-
-
- if (nautilus_rectangle_contains (&cell_rectangle, x, y))
- return index;
- }
-
- return -1;
-}
-
-static int
-in_resize_rect (GtkWidget *widget, int x, int y)
-{
- /* return the index of the resize rect of a column we hit or -1 */
-
- GtkCList *parent_clist;
- int index;
-
- parent_clist = GTK_CLIST (widget->parent);
-
- for (index = 0; index < parent_clist->columns; index++) {
- /* hit testing for column resizing */
- GdkRectangle resize_rectangle;
-
- get_column_frame_at (widget, index, &resize_rectangle);
-
- nautilus_rectangle_inset (&resize_rectangle, 1, 0);
-
- resize_rectangle.x = resize_rectangle.x + resize_rectangle.width - DRAG_WIDTH / 2;
- resize_rectangle.width = DRAG_WIDTH;
-
- if (nautilus_rectangle_contains (&resize_rectangle, x, y))
- return index;
- }
-
- return -1;
-}
-
-static void
-show_hide_resize_cursor_if_needed (GtkWidget *widget, gboolean on)
-{
- NautilusListColumnTitle *column_title;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
-
- if (on == column_title->details->resize_cursor_on)
- /* already set right */
- return;
-
- if (on) {
- /* switch to a resize cursor */
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- gdk_window_set_cursor (widget->window, cursor);
- gdk_cursor_destroy (cursor);
- } else
- /* restore to old cursor */
- gdk_window_set_cursor (widget->window, NULL);
-
- column_title->details->resize_cursor_on = on;
-}
-
-static gboolean
-track_prelight (GtkWidget *widget, int mouse_x, int mouse_y)
-{
- NautilusListColumnTitle *column_title;
- int over_column;
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
-
- /* see if we need to update the prelight state of a column */
- over_column = in_column_rect (widget, mouse_x, mouse_y);
-
- if (column_title->details->tracking_column_resize != -1) {
- /* resizing a column, don't prelight */
- over_column = -1;
- }
-
- if (column_title->details->tracking_column_press != -1) {
- /* pressing a column, don't prelight */
- over_column = -1;
- }
-
- if (column_title->details->tracking_column_prelight == over_column) {
- /* no change */
- return FALSE;
- }
-
- /* update state and tell callers to redraw */
- column_title->details->tracking_column_prelight = over_column;
-
- return TRUE;
-}
-
-static gboolean
-nautilus_list_column_title_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- NautilusListColumnTitle *column_title;
- GtkWidget *parent_list;
- int mouse_x, mouse_y;
- gboolean title_update_needed;
-
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (NAUTILUS_IS_LIST (widget->parent));
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
- parent_list = GTK_WIDGET (widget->parent);
- title_update_needed = FALSE;
-
- gdk_window_get_pointer (widget->window, &mouse_x, &mouse_y, NULL);
-
- if (column_title->details->tracking_column_resize != -1) {
- /* we are currently tracking a column */
- if (column_title->details->last_tracking_x != mouse_x) {
- /* mouse did move horizontally since last time */
- column_title->details->last_tracking_x = mouse_x;
- (NAUTILUS_LIST_CLASS (NAUTILUS_KLASS (parent_list)))->
- column_resize_track (parent_list,
- column_title->details->tracking_column_resize);
- title_update_needed = TRUE;
- }
- } else {
- /* make sure we are showing the right cursor */
- show_hide_resize_cursor_if_needed (widget,
- in_resize_rect (widget, mouse_x, mouse_y) != -1);
- }
-
- /* see if we need to update the prelight state of a column */
- title_update_needed |= track_prelight (widget, mouse_x, mouse_y);
-
- if (title_update_needed) {
- nautilus_list_column_title_buffered_draw (widget);
- }
-
- return TRUE;
-}
-
-static gboolean
-nautilus_list_column_title_leave (GtkWidget *widget, GdkEventCrossing *event)
-{
- NautilusListColumnTitle *column_title;
-
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (NAUTILUS_IS_LIST (widget->parent));
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
-
- /* see if we need to update the prelight state of a column */
- if (column_title->details->tracking_column_prelight != -1) {
- column_title->details->tracking_column_prelight = -1;
- gtk_widget_set_state (widget, GTK_STATE_NORMAL);
- nautilus_list_column_title_buffered_draw (widget);
- }
-
- return TRUE;
-}
-
-static gboolean
-nautilus_list_column_title_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- NautilusListColumnTitle *column_title;
- GtkWidget *parent_list;
-
- g_assert (event != NULL);
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (NAUTILUS_IS_LIST (widget->parent));
- g_assert (NAUTILUS_LIST_COLUMN_TITLE(widget)->details->tracking_column_resize == -1);
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
- parent_list = GTK_WIDGET (widget->parent);
-
- if (event->type == GDK_BUTTON_PRESS) {
- int resized_column;
- int clicked_column;
-
- resized_column = in_resize_rect (widget, (int)event->x, (int)event->y);
- clicked_column = in_column_rect (widget, (int)event->x, (int)event->y);
-
- if (resized_column != -1) {
- GdkCursor *cursor;
- int grab_result;
-
- /* during the drag, use the resize cursor */
- cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
-
- /* grab the pointer events so that we get them even when
- * the mouse tracks out of the widget window
- */
- grab_result = gdk_pointer_grab (widget->window, FALSE,
- GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, cursor, event->time);
- gdk_cursor_destroy (cursor);
-
- if (grab_result != 0)
- /* failed to grab the pointer, give up
- *
- * The grab results are not very well documented
- * looks like they may be Success, GrabSuccess, AlreadyGrabbed
- * or anything else the low level X calls in gdk_pointer_grab
- * decide to return.
- */
- return FALSE;
-
- /* set up new state */
- column_title->details->tracking_column_resize = resized_column;
- column_title->details->tracking_column_prelight = -1;
-
- /* FIXME:
- * use a "resized" state here ?
- */
- gtk_widget_set_state (widget, GTK_STATE_NORMAL);
-
- /* start column resize tracking */
- (NAUTILUS_LIST_CLASS (NAUTILUS_KLASS (parent_list)))->
- column_resize_track_start (parent_list, resized_column);
-
- return FALSE;
- }
- if (clicked_column != -1) {
- /* clicked a column, draw the pressed column title */
- column_title->details->tracking_column_prelight = -1;
- column_title->details->tracking_column_press = clicked_column;
- gtk_widget_set_state (widget, GTK_STATE_ACTIVE);
- /* FIXME:
- * buffered draw may be better here
- */
- gtk_widget_queue_draw (widget);
- }
-
- }
-
- return FALSE;
-}
-
-static gboolean
-nautilus_list_column_title_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- NautilusListColumnTitle *column_title;
- GtkWidget *parent_list;
-
- g_assert (event != NULL);
- g_assert (NAUTILUS_IS_LIST_COLUMN_TITLE (widget));
- g_assert (NAUTILUS_IS_LIST (widget->parent));
-
- column_title = NAUTILUS_LIST_COLUMN_TITLE(widget);
- parent_list = GTK_WIDGET (widget->parent);
-
- if (column_title->details->tracking_column_resize != -1) {
-
- /* let go of all the pointer events */
- if (gdk_pointer_is_grabbed ())
- gdk_pointer_ungrab (event->time);
-
- /* end column resize tracking */
- (NAUTILUS_LIST_CLASS (NAUTILUS_KLASS (parent_list)))->
- column_resize_track_end (parent_list,
- column_title->details->tracking_column_resize);
- column_title->details->tracking_column_resize = -1;
-
- } else if (column_title->details->tracking_column_press != -1) {
-
- /* column title press -- change the sort order */
- gtk_signal_emit_by_name (GTK_OBJECT (parent_list), "click_column",
- column_title->details->tracking_column_press);
- /* end press tracking */
- column_title->details->tracking_column_press = -1;
- }
-
- track_prelight (widget, (int)event->x, (int)event->y);
- gtk_widget_set_state (widget,
- column_title->details->tracking_column_prelight != -1 ?
- GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- /* FIXME:
- * buffered draw may be better here
- */
- gtk_widget_queue_draw (widget);
-
- return FALSE;
-}
diff --git a/libnautilus/nautilus-list-column-title.h b/libnautilus/nautilus-list-column-title.h
deleted file mode 100644
index 5c069800b..000000000
--- a/libnautilus/nautilus-list-column-title.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-list-column-title.h: List column title widget for interacting with list columns
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Pavel Cisler <pavel@eazel.com>
-
-*/
-
-#ifndef __NAUTILUS_LIST_COLUMN_TITLE__
-#define __NAUTILUS_LIST_COLUMN_TITLE__
-
-#include <gdk/gdktypes.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkbin.h>
-#include <gtk/gtkenums.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define NAUTILUS_TYPE_LIST_COLUMN_TITLE \
- (nautilus_list_column_title_get_type ())
-#define NAUTILUS_LIST_COLUMN_TITLE(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_LIST_COLUMN_TITLE, NautilusListColumnTitle))
-#define NAUTILUS_LIST_COLUMN_TITLE_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_LIST_COLUMN_TITLE, NautilusListColumnTitleClass))
-#define NAUTILUS_IS_LIST_COLUMN_TITLE(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_LIST_COLUMN_TITLE))
-#define NAUTILUS_IS_LIST_COLUMN_TITLE_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_LIST_COLUMN_TITLE))
-
-typedef struct NautilusListColumnTitle NautilusListColumnTitle;
-typedef struct NautilusListColumnTitleClass NautilusListColumnTitleClass;
-typedef struct NautilusListColumnTitleDetails NautilusListColumnTitleDetails;
-
-
-struct NautilusListColumnTitle
-{
- GtkBin bin;
- NautilusListColumnTitleDetails *details;
-};
-
-struct NautilusListColumnTitleClass
-{
- GtkBinClass parent_class;
-};
-
-GtkType nautilus_list_column_title_get_type (void);
-NautilusListColumnTitle *nautilus_list_column_title_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __NAUTILUS_LIST_COLUMN_TITLE__ */
diff --git a/libnautilus/nautilus-list.c b/libnautilus/nautilus-list.c
deleted file mode 100644
index a5eca73cc..000000000
--- a/libnautilus/nautilus-list.c
+++ /dev/null
@@ -1,2306 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-list.h: Enhanced version of GtkCList for Nautilus.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Federico Mena <federico@nuclecu.unam.mx>,
- Ettore Perazzoli <ettore@gnu.org>,
- John Sullivan <sullivan@eazel.com>,
- Pavel Cisler <pavel@eazel.com>
- */
-
-#include <config.h>
-#include "nautilus-list.h"
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkbindings.h>
-#include <gtk/gtkdnd.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkmain.h>
-#include <glib.h>
-#include "nautilus-gdk-extensions.h"
-
-#include "nautilus-glib-extensions.h"
-#include "nautilus-gdk-extensions.h"
-#include "nautilus-gdk-pixbuf-extensions.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-background.h"
-#include "nautilus-list-column-title.h"
-
-/* Timeout for making the row currently selected for keyboard operation
- * visible. FIXME: This *must* be higher than the double-click time in GDK,
- * but there is no way to access its value from outside.
- */
-#define KEYBOARD_ROW_REVEAL_TIMEOUT 300
-
-struct NautilusListDetails
-{
- /* Preferences */
- gboolean single_click_mode;
-
- /* The anchor row for range selections */
- int anchor_row;
-
- /* Mouse information saved on button press */
- int dnd_press_button;
- int dnd_press_x, dnd_press_y;
- int button_down_row;
- guint32 button_down_time;
-
- /* Timeout used to make a selected row fully visible after a short
- * period of time. (The timeout is needed to make sure
- * double-clicking still works, and to optimize holding down arrow key.)
- */
- guint keyboard_row_reveal_timer_id;
- int keyboard_row_to_reveal;
-
- /* Signal IDs that we sometimes want to block. */
- guint select_row_signal_id;
- guint unselect_row_signal_id;
-
- /* Delayed selection information */
- int dnd_select_pending;
- guint dnd_select_pending_state;
-
- GtkWidget *title;
-};
-
-/* maximum amount of milliseconds the mouse button is allowed to stay down and still be considered a click */
-#define MAX_CLICK_TIME 1500
-
-/* horizontal space between images in a pixbuf list cell */
-#define PIXBUF_LIST_SPACING 2
-
-/* Some #defines stolen from gtkclist.c that we need for other stolen code. */
-
-/* minimum allowed width of a column */
-#define COLUMN_MIN_WIDTH 5
-
-/* this defines the base grid spacing */
-#define CELL_SPACING 1
-
-/* added the horizontal space at the beginning and end of a row */
-#define COLUMN_INSET 3
-
-/* the width of the column resize windows */
-#define DRAG_WIDTH 6
-
-/* gives the left pixel of the given column in context of
- * the clist's hoffset */
-#define COLUMN_LEFT_XPIXEL(clist, colnum) ((clist)->column[(colnum)].area.x + \
- (clist)->hoffset)
-
-/* gives the top pixel of the given row in context of
- * the clist's voffset */
-#define ROW_TOP_YPIXEL(clist, row) (((clist)->row_height * (row)) + \
- (((row) + 1) * CELL_SPACING) + \
- (clist)->voffset)
-
-/* returns the row index from a y pixel location in the
- * context of the clist's voffset */
-#define ROW_FROM_YPIXEL(clist, y) (((y) - (clist)->voffset) / \
- ((clist)->row_height + CELL_SPACING))
-
-/* returns the GList item for the nth row */
-#define ROW_ELEMENT(clist, row) (((row) == (clist)->rows - 1) ? \
- (clist)->row_list_end : \
- g_list_nth ((clist)->row_list, (row)))
-
-/* returns the total height of the list */
-#define LIST_HEIGHT(clist) (((clist)->row_height * ((clist)->rows)) + \
- (CELL_SPACING * ((clist)->rows + 1)))
-
-enum {
- CONTEXT_CLICK_SELECTION,
- CONTEXT_CLICK_BACKGROUND,
- ACTIVATE,
- START_DRAG,
- SELECTION_CHANGED,
- LAST_SIGNAL
-};
-
-enum {
- TARGET_COLOR
-};
-
-static GtkTargetEntry nautilus_list_dnd_target_table[] = {
- { "application/x-color", 0, TARGET_COLOR }
-};
-
-static void activate_row (NautilusList *list, gint row);
-static int get_cell_horizontal_start_position (GtkCList *clist, GtkCListRow *clist_row,
- int column, int content_width);
-static void get_cell_style (GtkCList *clist, GtkCListRow *clist_row,
- gint state, gint column, GtkStyle **style,
- GdkGC **fg_gc, GdkGC **bg_gc);
-
-static void nautilus_list_initialize_class (NautilusListClass *class);
-static void nautilus_list_initialize (NautilusList *list);
-static void nautilus_list_destroy (GtkObject *object);
-
-static gint nautilus_list_button_press (GtkWidget *widget, GdkEventButton *event);
-static gint nautilus_list_button_release (GtkWidget *widget, GdkEventButton *event);
-static gint nautilus_list_motion (GtkWidget *widget, GdkEventMotion *event);
-static void nautilus_list_drag_begin (GtkWidget *widget, GdkDragContext *context);
-static void nautilus_list_drag_end (GtkWidget *widget, GdkDragContext *context);
-static void nautilus_list_drag_data_get (GtkWidget *widget, GdkDragContext *context,
- GtkSelectionData *data, guint info, guint time);
-static void nautilus_list_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time);
-static gboolean nautilus_list_drag_motion (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time);
-static gboolean nautilus_list_drag_drop (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time);
-static void nautilus_list_drag_data_received (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *data,
- guint info, guint time);
-static void nautilus_list_clear_keyboard_focus (NautilusList *list);
-static void nautilus_list_draw_focus (GtkWidget *widget);
-static int nautilus_list_get_first_selected_row (NautilusList *list);
-static int nautilus_list_get_last_selected_row (NautilusList *list);
-static gint nautilus_list_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static void nautilus_list_unselect_all (GtkCList *clist);
-static void nautilus_list_select_all (GtkCList *clist);
-
-static void reveal_row (NautilusList *list, int row);
-static void schedule_keyboard_row_reveal (NautilusList *list, int row);
-static void unschedule_keyboard_row_reveal (NautilusList *list);
-static void emit_selection_changed (NautilusList *clist);
-
-static void nautilus_list_clear (GtkCList *clist);
-static void draw_row (GtkCList *list, GdkRectangle *area, gint row, GtkCListRow *clist_row);
-
-static void nautilus_list_realize (GtkWidget *widget);
-static void nautilus_list_set_cell_contents (GtkCList *clist,
- GtkCListRow *clist_row,
- gint column,
- GtkCellType type,
- const gchar *text,
- guint8 spacing,
- GdkPixmap *pixmap,
- GdkBitmap *mask);
-static void nautilus_list_size_request (GtkWidget *widget, GtkRequisition *requisition);
-
-static void nautilus_list_resize_column (GtkCList *widget, int column, int width);
-
-static void nautilus_list_column_resize_track_start (GtkWidget *widget, int column);
-static void nautilus_list_column_resize_track (GtkWidget *widget, int column);
-static void nautilus_list_column_resize_track_end (GtkWidget *widget, int column);
-static gboolean row_set_selected (NautilusList *list, int row, GtkCListRow *clist_row, gboolean select);
-static gboolean select_row_unselect_others (NautilusList *list, int row_to_select);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusList, nautilus_list, GTK_TYPE_CLIST)
-
-static guint list_signals[LAST_SIGNAL];
-
-/* Standard class initialization function */
-static void
-nautilus_list_initialize_class (NautilusListClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkCListClass *clist_class;
- NautilusListClass *list_class;
-
- GtkBindingSet *clist_binding_set;
-
- object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
- clist_class = (GtkCListClass *) klass;
- list_class = (NautilusListClass *) klass;
-
- list_signals[CONTEXT_CLICK_SELECTION] =
- gtk_signal_new ("context_click_selection",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusListClass, context_click_selection),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- list_signals[CONTEXT_CLICK_BACKGROUND] =
- gtk_signal_new ("context_click_background",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusListClass, context_click_background),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- list_signals[ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusListClass, activate),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- list_signals[START_DRAG] =
- gtk_signal_new ("start_drag",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusListClass, start_drag),
- gtk_marshal_NONE__INT_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_EVENT);
- list_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusListClass, selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, list_signals, LAST_SIGNAL);
-
- /* Turn off the GtkCList key bindings that we want unbound.
- * We only need to do this for the keys that we don't handle
- * in nautilus_list_key_press. These extra ones are turned off
- * to avoid inappropriate GtkCList code and to standardize the
- * keyboard behavior in Nautilus.
- */
- clist_binding_set = gtk_binding_set_by_class (clist_class);
-
- /* Use Control-A for Select All, not Control-/ */
- gtk_binding_entry_clear (clist_binding_set,
- '/',
- GDK_CONTROL_MASK);
- /* Don't use Control-\ for Unselect All (maybe invent Nautilus
- * standard for this?) */
- gtk_binding_entry_clear (clist_binding_set,
- '\\',
- GDK_CONTROL_MASK);
- /* Hide GtkCList's weird extend-selection-from-keyboard stuff.
- * Users can use control-navigation and control-space to create
- * extended selections.
- */
- gtk_binding_entry_clear (clist_binding_set,
- GDK_Shift_L,
- GDK_RELEASE_MASK | GDK_SHIFT_MASK);
- gtk_binding_entry_clear (clist_binding_set,
- GDK_Shift_R,
- GDK_RELEASE_MASK | GDK_SHIFT_MASK);
- gtk_binding_entry_clear (clist_binding_set,
- GDK_Shift_L,
- GDK_RELEASE_MASK | GDK_SHIFT_MASK | GDK_CONTROL_MASK);
- gtk_binding_entry_clear (clist_binding_set,
- GDK_Shift_R,
- GDK_RELEASE_MASK | GDK_SHIFT_MASK | GDK_CONTROL_MASK);
-
- list_class->column_resize_track_start = nautilus_list_column_resize_track_start;
- list_class->column_resize_track = nautilus_list_column_resize_track;
- list_class->column_resize_track_end = nautilus_list_column_resize_track_end;
-
- clist_class->clear = nautilus_list_clear;
- clist_class->draw_row = draw_row;
- clist_class->resize_column = nautilus_list_resize_column;
- clist_class->set_cell_contents = nautilus_list_set_cell_contents;
- clist_class->select_all = nautilus_list_select_all;
- clist_class->unselect_all = nautilus_list_unselect_all;
-
- widget_class->button_press_event = nautilus_list_button_press;
- widget_class->button_release_event = nautilus_list_button_release;
- widget_class->motion_notify_event = nautilus_list_motion;
- widget_class->drag_begin = nautilus_list_drag_begin;
- widget_class->drag_end = nautilus_list_drag_end;
- widget_class->drag_data_get = nautilus_list_drag_data_get;
- widget_class->drag_leave = nautilus_list_drag_leave;
- widget_class->drag_motion = nautilus_list_drag_motion;
- widget_class->drag_drop = nautilus_list_drag_drop;
- widget_class->drag_data_received = nautilus_list_drag_data_received;
- widget_class->draw_focus = nautilus_list_draw_focus;
- widget_class->key_press_event = nautilus_list_key_press;
- widget_class->realize = nautilus_list_realize;
- widget_class->size_request = nautilus_list_size_request;
-
- object_class->destroy = nautilus_list_destroy;
-}
-
-/* Standard object initialization function */
-static void
-nautilus_list_initialize (NautilusList *list)
-{
- list->details = g_new0 (NautilusListDetails, 1);
- list->details->anchor_row = -1;
-
- /* This should be read from preferences */
- list->details->single_click_mode = TRUE;
-
- /* GtkCList does not specify pointer motion by default */
- gtk_widget_add_events (GTK_WIDGET (list), GDK_POINTER_MOTION_MASK);
-
- /* Get ready to accept some dragged stuff. */
- gtk_drag_dest_set (GTK_WIDGET (list),
- GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
- nautilus_list_dnd_target_table,
- NAUTILUS_N_ELEMENTS (nautilus_list_dnd_target_table),
- GDK_ACTION_COPY);
-
- /* Emit "selection changed" signal when parent class changes selection */
- list->details->select_row_signal_id = gtk_signal_connect (GTK_OBJECT (list),
- "select_row",
- emit_selection_changed,
- list);
- list->details->unselect_row_signal_id = gtk_signal_connect (GTK_OBJECT (list),
- "unselect_row",
- emit_selection_changed,
- list);
-
- list->details->title = GTK_WIDGET (nautilus_list_column_title_new());
-}
-
-static void
-nautilus_list_destroy (GtkObject *object)
-{
- NautilusList *list;
-
- list = NAUTILUS_LIST (object);
-
- unschedule_keyboard_row_reveal (list);
-
- g_free (list->details);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static void
-emit_selection_changed (NautilusList *list)
-{
- g_assert (NAUTILUS_IS_LIST (list));
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
-}
-
-static void
-activate_row (NautilusList *list, gint row)
-{
- GtkCListRow *elem;
-
- elem = g_list_nth (GTK_CLIST (list)->row_list,
- row)->data;
- gtk_signal_emit (GTK_OBJECT (list),
- list_signals[ACTIVATE],
- elem->data);
-}
-
-gboolean
-nautilus_list_is_row_selected (NautilusList *list, gint row)
-{
- GtkCListRow *elem;
-
- g_return_val_if_fail (row >= 0, FALSE);
- g_return_val_if_fail (row < GTK_CLIST (list)->rows, FALSE);
-
- elem = g_list_nth (GTK_CLIST (list)->row_list, row)->data;
-
- return elem->state == GTK_STATE_SELECTED;
-}
-
-/* Selects the rows between the anchor to the specified row, inclusive.
- * Returns TRUE if selection changed. */
-static gboolean
-select_range (NautilusList *list, int row)
-{
- int min, max;
- int i;
- gboolean selection_changed;
-
- selection_changed = FALSE;
-
- if (list->details->anchor_row == -1) {
- list->details->anchor_row = row;
- }
-
- if (row < list->details->anchor_row) {
- min = row;
- max = list->details->anchor_row;
- } else {
- min = list->details->anchor_row;
- max = row;
- }
-
- for (i = min; i <= max; i++) {
- selection_changed |= row_set_selected (list, i, NULL, TRUE);
- }
-
- return selection_changed;
-}
-
-/* Handles row selection according to the specified modifier state */
-static void
-select_row_from_mouse (NautilusList *list, int row, guint state)
-{
- int range, additive;
- gboolean should_select_row;
- gboolean selection_changed;
-
- selection_changed = FALSE;
-
- range = (state & GDK_SHIFT_MASK) != 0;
- additive = (state & GDK_CONTROL_MASK) != 0;
-
- if (!additive) {
- selection_changed |= select_row_unselect_others (list, -1);
- }
-
- if (range) {
- selection_changed |= select_range (list, row);
- } else {
- should_select_row = !additive || !nautilus_list_is_row_selected (list, row);
- selection_changed |= row_set_selected (list, row, NULL, should_select_row);
- list->details->anchor_row = row;
- }
-
- if (selection_changed) {
- emit_selection_changed (list);
- }
-}
-
-/*
- * row_set_selected:
- *
- * Select or unselect a row. Return TRUE if selection has changed.
- * Does not emit the SELECTION_CHANGED signal; it's up to the caller
- * to handle that.
- *
- * @list: The NautilusList in question.
- * @row: index of row number to select or unselect.
- * @clist_row: GtkCListRow pointer for given list. Passing this avoids
- * expensive lookup. If it's NULL, it will be looked up in this function.
- * @select: TRUE if row should be selected, FALSE otherwise.
- *
- * Return Value: TRUE if selection has changed, FALSE otherwise.
- */
-static gboolean
-row_set_selected (NautilusList *list, int row, GtkCListRow *clist_row, gboolean select)
-{
- g_assert (row >= 0 && row < GTK_CLIST (list)->rows);
-
- if (clist_row == NULL) {
- clist_row = ROW_ELEMENT (GTK_CLIST (list), row)->data;
- }
-
- if (select == (clist_row->state == GTK_STATE_SELECTED)) {
- return FALSE;
- }
-
- /* Block signal handlers so we can make sure the selection-changed
- * signal gets sent only once.
- */
- gtk_signal_handler_block (GTK_OBJECT(list),
- list->details->select_row_signal_id);
- gtk_signal_handler_block (GTK_OBJECT(list),
- list->details->unselect_row_signal_id);
-
- if (select) {
- gtk_clist_select_row (GTK_CLIST (list), row, -1);
- } else {
- gtk_clist_unselect_row (GTK_CLIST (list), row, -1);
- }
-
- gtk_signal_handler_unblock (GTK_OBJECT(list),
- list->details->select_row_signal_id);
- gtk_signal_handler_unblock (GTK_OBJECT(list),
- list->details->unselect_row_signal_id);
-
- return TRUE;
-}
-
-/**
- * select_row_unselect_others:
- *
- * Change the selected rows as necessary such that only
- * the given row remains selected.
- *
- * @list: The NautilusList in question.
- * @row: The row number to leave selected. Use -1 to leave
- * no row selected.
- *
- * Return value: TRUE if the selection changed; FALSE otherwise.
- */
-static gboolean
-select_row_unselect_others (NautilusList *list, int row_to_select)
-{
- GList *p;
- int row;
- gboolean selection_changed;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (list), FALSE);
-
- selection_changed = FALSE;
- for (p = GTK_CLIST (list)->row_list, row = 0; p != NULL; p = p->next, ++row) {
- selection_changed |= row_set_selected (list, row, p->data, row == row_to_select);
- }
-
- return selection_changed;
-}
-
-static void
-nautilus_list_unselect_all (GtkCList *clist)
-{
- g_return_if_fail (NAUTILUS_IS_LIST (clist));
-
- if (select_row_unselect_others (NAUTILUS_LIST (clist), -1)) {
- emit_selection_changed (NAUTILUS_LIST (clist));
- }
-}
-
-static void
-nautilus_list_select_all (GtkCList *clist)
-{
- GList *p;
- int row;
- gboolean selection_changed;
-
- g_return_if_fail (NAUTILUS_IS_LIST (clist));
-
- selection_changed = FALSE;
- for (p = clist->row_list, row = 0; p != NULL; p = p->next, ++row) {
- selection_changed |= row_set_selected (NAUTILUS_LIST (clist), row, p->data, TRUE);
- }
-
- if (selection_changed) {
- emit_selection_changed (NAUTILUS_LIST (clist));
- }
-}
-
-/* Our handler for button_press events. We override all of GtkCList's broken
- * behavior.
- */
-static gint
-nautilus_list_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- NautilusList *list;
- GtkCList *clist;
- int on_row;
- gint row, col;
- int retval;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- list = NAUTILUS_LIST (widget);
- clist = GTK_CLIST (widget);
- retval = FALSE;
-
- if (event->window != clist->clist_window)
- return NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, button_press_event, (widget, event));
-
- on_row = gtk_clist_get_selection_info (clist, event->x, event->y, &row, &col);
- list->details->button_down_time = event->time;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (event->button == 1 || event->button == 2) {
- if (on_row) {
-
- /* Save the clicked row for DnD and single-click activate */
-
- list->details->button_down_row = row;
-
- /* Save the mouse info for DnD */
-
- list->details->dnd_press_button = event->button;
- list->details->dnd_press_x = event->x;
- list->details->dnd_press_y = event->y;
-
- /* Handle selection */
-
- if ((nautilus_list_is_row_selected (list, row)
- && !(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)))
- || ((event->state & GDK_CONTROL_MASK)
- && !(event->state & GDK_SHIFT_MASK))) {
- list->details->dnd_select_pending = TRUE;
- list->details->dnd_select_pending_state = event->state;
- }
-
- select_row_from_mouse (list, row, event->state);
- } else {
- gtk_clist_unselect_all (clist);
- }
-
- retval = TRUE;
- } else if (event->button == 3) {
- if (on_row) {
- /* Context menu applies to all selected items. First use click
- * to modify selection as appropriate, then emit signal that
- * will bring up menu.
- */
- select_row_from_mouse (list, row, event->state);
- gtk_signal_emit (GTK_OBJECT (list),
- list_signals[CONTEXT_CLICK_SELECTION]);
- } else
- gtk_signal_emit (GTK_OBJECT (list),
- list_signals[CONTEXT_CLICK_BACKGROUND]);
-
- retval = TRUE;
- }
-
- break;
-
- case GDK_2BUTTON_PRESS:
- if (event->button == 1) {
- list->details->dnd_select_pending = FALSE;
- list->details->dnd_select_pending_state = 0;
-
- if (on_row) {
- /* Activate on double-click even if single_click_mode
- * is set, so second click doesn't get passed to child
- * directory.
- */
- activate_row (list, row);
- }
-
- retval = TRUE;
- break;
- }
-
- default:
- break;
- }
-
- return retval;
-}
-
-/* Our handler for button_release events. We override all of GtkCList's broken
- * behavior.
- */
-static gint
-nautilus_list_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- NautilusList *list;
- GtkCList *clist;
- GtkCListRow *clist_row;
- int on_row;
- gint row, col;
- GtkStyle *style;
- int text_x, text_width;
- int retval;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- list = NAUTILUS_LIST (widget);
- clist = GTK_CLIST (widget);
- retval = FALSE;
-
- if (event->window != clist->clist_window)
- return NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, button_release_event, (widget, event));
-
- on_row = gtk_clist_get_selection_info (clist, event->x, event->y, &row, &col);
-
- if (!(event->button == 1 || event->button == 2))
- return FALSE;
-
- list->details->dnd_press_button = 0;
- list->details->dnd_press_x = 0;
- list->details->dnd_press_y = 0;
-
- if (on_row) {
- /* Clean up after abortive drag-and-drop attempt (since user can't
- * reorder list view items, releasing mouse in list view cancels
- * drag-and-drop possibility).
- */
- if (list->details->dnd_select_pending) {
- list->details->dnd_select_pending = FALSE;
- list->details->dnd_select_pending_state = 0;
- }
-
- /*
- * Activate on single click if not extending selection, mouse hasn't moved to
- * a different row, not too much time has passed, and this is a link-type cell.
- */
- if (list->details->single_click_mode &&
- !(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)))
- {
- gint elapsed_time = event->time - list->details->button_down_time;
-
- if (elapsed_time < MAX_CLICK_TIME && list->details->button_down_row == row)
- {
- clist_row = ROW_ELEMENT (clist, row)->data;
- if (clist_row->cell[col].type == NAUTILUS_CELL_LINK_TEXT) {
- /* One final test. Check whether the click was in the
- * horizontal bounds of the displayed text.
- */
- get_cell_style (clist, clist_row, GTK_STATE_NORMAL, col, &style, NULL, NULL);
- text_width = gdk_string_width (style->font, GTK_CELL_TEXT (clist_row->cell[col])->text);
- text_x = get_cell_horizontal_start_position (clist, clist_row, col, text_width);
- if (event->x >= text_x && event->x <= text_x + text_width) {
- activate_row (list, row);
- }
- }
- }
- }
-
- retval = TRUE;
- }
-
- return retval;
-}
-
-static void
-nautilus_list_clear_keyboard_focus (NautilusList *list)
-{
- if (GTK_CLIST (list)->focus_row >= 0) {
- gtk_widget_draw_focus (GTK_WIDGET (list));
- }
-
- GTK_CLIST (list)->focus_row = -1;
-}
-
-static void
-nautilus_list_set_keyboard_focus (NautilusList *list, int row)
-{
- g_assert (row >= 0 && row < GTK_CLIST (list)->rows);
-
- if (row == GTK_CLIST (list)->focus_row) {
- return;
- }
-
- nautilus_list_clear_keyboard_focus (list);
-
- GTK_CLIST (list)->focus_row = row;
-
- gtk_widget_draw_focus (GTK_WIDGET (list));
-}
-
-static void
-nautilus_list_keyboard_move_to (NautilusList *list, int row, GdkEventKey *event)
-{
- GtkCList *clist;
-
- g_assert (NAUTILUS_IS_LIST (list));
- g_assert (row >= 0 || row < GTK_CLIST (list)->rows);
-
- clist = GTK_CLIST (list);
-
- if ((event->state & GDK_CONTROL_MASK) != 0) {
- /* Move the keyboard focus. */
- nautilus_list_set_keyboard_focus (list, row);
- } else {
- /* Select row and get rid of special keyboard focus. */
- nautilus_list_clear_keyboard_focus (list);
- if (select_row_unselect_others (list, row)) {
- emit_selection_changed (list);
- }
- }
-
- schedule_keyboard_row_reveal (list, row);
-}
-
-static gboolean
-keyboard_row_reveal_timeout_callback (gpointer data)
-{
- NautilusList *list;
- int row;
-
- GDK_THREADS_ENTER ();
-
- list = NAUTILUS_LIST (data);
- row = list->details->keyboard_row_to_reveal;
-
- if (row >= 0 && row < GTK_CLIST (list)->rows) {
- /* Only reveal the row if it's still the keyboard focus
- * or if it's still selected.
- * FIXME: Need to unschedule this if the user scrolls explicitly.
- */
- if (row == GTK_CLIST (list)->focus_row
- || nautilus_list_is_row_selected (list, row)) {
- reveal_row (list, row);
- }
- list->details->keyboard_row_reveal_timer_id = 0;
- }
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
-static void
-unschedule_keyboard_row_reveal (NautilusList *list)
-{
- if (list->details->keyboard_row_reveal_timer_id != 0) {
- gtk_timeout_remove (list->details->keyboard_row_reveal_timer_id);
- }
-}
-
-static void
-schedule_keyboard_row_reveal (NautilusList *list, int row)
-{
- unschedule_keyboard_row_reveal (list);
-
- list->details->keyboard_row_to_reveal = row;
- list->details->keyboard_row_reveal_timer_id
- = gtk_timeout_add (KEYBOARD_ROW_REVEAL_TIMEOUT,
- keyboard_row_reveal_timeout_callback,
- list);
-}
-
-static void
-reveal_row (NautilusList *list, int row)
-{
- GtkCList *clist;
-
- g_assert (NAUTILUS_IS_LIST (list));
-
- clist = GTK_CLIST (list);
-
- if (ROW_TOP_YPIXEL (clist, row) + clist->row_height >
- clist->clist_window_height) {
- gtk_clist_moveto (clist, row, -1, 1, 0);
- } else if (ROW_TOP_YPIXEL (clist, row) < 0) {
- gtk_clist_moveto (clist, row, -1, 0, 0);
- }
-}
-
-static void
-nautilus_list_keyboard_navigation_key_press (NautilusList *list, GdkEventKey *event,
- GtkScrollType scroll_type, gboolean jump_to_end)
-{
- GtkCList *clist;
- int start_row;
- int destination_row;
- int rows_per_page;
-
- g_assert (NAUTILUS_IS_LIST (list));
-
- clist = GTK_CLIST (list);
-
- if (scroll_type == GTK_SCROLL_JUMP) {
- destination_row = (jump_to_end ?
- clist->rows - 1 :
- 0);
- } else {
- /* Choose the row to start with.
- * If we have a keyboard focus, start with it.
- * If there's a selection, use the selected row farthest toward the end.
- */
-
- if (GTK_CLIST (list)->focus_row >= 0) {
- start_row = clist->focus_row;
- } else {
- start_row = (scroll_type == GTK_SCROLL_STEP_FORWARD || scroll_type == GTK_SCROLL_PAGE_FORWARD ?
- nautilus_list_get_last_selected_row (list) :
- nautilus_list_get_first_selected_row (list));
- }
-
- /* If there's no row to start with, select the row farthest toward the end.
- * If there is a row to start with, select the next row in the arrow direction.
- */
- if (start_row < 0) {
- destination_row = (scroll_type == GTK_SCROLL_STEP_FORWARD || scroll_type == GTK_SCROLL_PAGE_FORWARD ?
- clist->rows - 1 :
- 0);
- } else if (scroll_type == GTK_SCROLL_STEP_FORWARD) {
- destination_row = MIN (clist->rows - 1, start_row + 1);
- } else if (scroll_type == GTK_SCROLL_STEP_BACKWARD) {
- destination_row = MAX (0, start_row - 1);
- } else {
- g_assert (scroll_type == GTK_SCROLL_PAGE_FORWARD || GTK_SCROLL_PAGE_BACKWARD);
- rows_per_page = (2 * clist->clist_window_height -
- clist->row_height - CELL_SPACING) /
- (2 * (clist->row_height + CELL_SPACING));
-
- if (scroll_type == GTK_SCROLL_PAGE_FORWARD) {
- destination_row = MIN (clist->rows - 1,
- start_row + rows_per_page);
- } else {
- destination_row = MAX (0,
- start_row - rows_per_page);
- }
- }
- }
-
- nautilus_list_keyboard_move_to (list, destination_row, event);
-}
-
-static void
-nautilus_list_keyboard_home (NautilusList *list, GdkEventKey *event)
-{
- /* Home selects the first row.
- * Control-Home sets the keyboard focus to the first row.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_JUMP, FALSE);
-}
-
-static void
-nautilus_list_keyboard_end (NautilusList *list, GdkEventKey *event)
-{
- /* End selects the last row.
- * Control-End sets the keyboard focus to the last row.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_JUMP, TRUE);
-}
-
-static void
-nautilus_list_keyboard_up (NautilusList *list, GdkEventKey *event)
-{
- /* Up selects the next higher row.
- * Control-Up sets the keyboard focus to the next higher icon.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_STEP_BACKWARD, FALSE);
-}
-
-static void
-nautilus_list_keyboard_down (NautilusList *list, GdkEventKey *event)
-{
- /* Down selects the next lower row.
- * Control-Down sets the keyboard focus to the next lower icon.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_STEP_FORWARD, FALSE);
-}
-
-static void
-nautilus_list_keyboard_page_up (NautilusList *list, GdkEventKey *event)
-{
- /* Page Up selects a row one screenful higher.
- * Control-Page Up sets the keyboard focus to the row one screenful higher.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_PAGE_BACKWARD, FALSE);
-}
-
-static void
-nautilus_list_keyboard_page_down (NautilusList *list, GdkEventKey *event)
-{
- /* Page Down selects a row one screenful lower.
- * Control-Page Down sets the keyboard focus to the row one screenful lower.
- */
- nautilus_list_keyboard_navigation_key_press (list, event, GTK_SCROLL_PAGE_FORWARD, FALSE);
-}
-
-static void
-nautilus_list_keyboard_space (NautilusList *list, GdkEventKey *event)
-{
- if (event->state & GDK_CONTROL_MASK) {
- gtk_signal_emit_by_name (GTK_OBJECT (list), "toggle_focus_row");
- }
-}
-
-static void
-nautilus_list_activate_selected_items (NautilusList *list)
-{
- int row;
-
- for (row = 0; row < GTK_CLIST (list)->rows; ++row) {
- if (nautilus_list_is_row_selected (list, row)) {
- activate_row (list, row);
- }
- }
-}
-
-static int
-nautilus_list_key_press (GtkWidget *widget,
- GdkEventKey *event)
-{
- NautilusList *list;
-
- list = NAUTILUS_LIST (widget);
-
- switch (event->keyval) {
- case GDK_Home:
- nautilus_list_keyboard_home (list, event);
- break;
- case GDK_End:
- nautilus_list_keyboard_end (list, event);
- break;
- case GDK_Page_Up:
- nautilus_list_keyboard_page_up (list, event);
- break;
- case GDK_Page_Down:
- nautilus_list_keyboard_page_down (list, event);
- break;
- case GDK_Up:
- nautilus_list_keyboard_up (list, event);
- break;
- case GDK_Down:
- nautilus_list_keyboard_down (list, event);
- break;
- case GDK_space:
- nautilus_list_keyboard_space (list, event);
- break;
- case GDK_Return:
- nautilus_list_activate_selected_items (list);
- break;
- default:
- if (NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, key_press_event, (widget, event))) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-nautilus_list_realize (GtkWidget *widget)
-{
- NautilusList *list;
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
-
- list = NAUTILUS_LIST (widget);
- clist = GTK_CLIST (widget);
-
- clist->column[0].button = list->details->title;
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, realize, (widget));
-
- if (clist->title_window) {
- gtk_widget_set_parent_window (list->details->title, clist->title_window);
- }
- gtk_widget_set_parent (list->details->title, GTK_WIDGET (clist));
- gtk_widget_show (list->details->title);
-
- GTK_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES);
-}
-
-/* this is here just temporarily */
-static gint
-list_requisition_width (GtkCList *clist)
-{
- gint width = CELL_SPACING;
- gint i;
-
- for (i = clist->columns - 1; i >= 0; i--) {
- if (!clist->column[i].visible)
- continue;
-
- if (clist->column[i].width_set)
- width += clist->column[i].width + CELL_SPACING + (2 * COLUMN_INSET);
- else if (GTK_CLIST_SHOW_TITLES(clist) && clist->column[i].button)
- width += clist->column[i].button->requisition.width;
- }
-
- return width;
-}
-
-
-static void
-nautilus_list_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- /* stolen from gtk_clist
- * make sure the proper title ammount is allocated for the column
- * title view -- this would not otherwise be done because
- * NautilusList depends the buttons being there when doing a size calculation
- */
- NautilusList *list;
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
- g_return_if_fail (requisition != NULL);
-
- clist = GTK_CLIST (widget);
- list = NAUTILUS_LIST (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- /* compute the size of the column title (title) area */
- clist->column_title_area.height = 0;
- if (GTK_CLIST_SHOW_TITLES(clist) && list->details->title) {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (list->details->title,
- &child_requisition);
-
- child_requisition.height = 20;
- /* for now */
-
- clist->column_title_area.height =
- MAX (clist->column_title_area.height,
- child_requisition.height);
- }
-
- requisition->width += (widget->style->klass->xthickness +
- GTK_CONTAINER (widget)->border_width) * 2;
- requisition->height += (clist->column_title_area.height +
- (widget->style->klass->ythickness +
- GTK_CONTAINER (widget)->border_width) * 2);
-
-
- requisition->width += list_requisition_width (clist);
- requisition->height += LIST_HEIGHT (clist);
-}
-
-static gint
-new_column_width (GtkCList *clist, gint column, gint *x)
-{
- gint xthickness = GTK_WIDGET (clist)->style->klass->xthickness;
- gint width;
- gint cx;
- gint dx;
- gint last_column;
-
- /* first translate the x position from widget->window
- * to clist->clist_window */
- cx = *x - xthickness;
-
- for (last_column = clist->columns - 1;
- last_column >= 0 && !clist->column[last_column].visible; last_column--);
-
- /* calculate new column width making sure it doesn't end up
- * less than the minimum width */
- dx = (COLUMN_LEFT_XPIXEL (clist, column) + COLUMN_INSET +
- (column < last_column) * CELL_SPACING);
- width = cx - dx;
-
- if (width < MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width)) {
- width = MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width);
- cx = dx + width;
- *x = cx + xthickness;
- } else if (clist->column[column].max_width >= COLUMN_MIN_WIDTH &&
- width > clist->column[column].max_width) {
- width = clist->column[column].max_width;
- cx = dx + clist->column[column].max_width;
- *x = cx + xthickness;
- }
-
- if (cx < 0 || cx > clist->clist_window_width)
- *x = -1;
-
- return width;
-}
-
-static void
-size_allocate_columns (GtkCList *clist, gboolean block_resize)
-{
- int xoffset = CELL_SPACING + COLUMN_INSET;
- int last_column;
- int i;
-
- /* find last visible column and calculate correct column width */
- for (last_column = clist->columns - 1;
- last_column >= 0 && !clist->column[last_column].visible; last_column--)
- ;
-
- if (last_column < 0)
- return;
-
- for (i = 0; i <= last_column; i++) {
- if (!clist->column[i].visible)
- continue;
-
- clist->column[i].area.x = xoffset;
- if (clist->column[i].width_set) {
- if (!block_resize && GTK_CLIST_SHOW_TITLES(clist) &&
- clist->column[i].auto_resize && clist->column[i].button) {
- gint width;
-
- width = (clist->column[i].button->requisition.width -
- (CELL_SPACING + (2 * COLUMN_INSET)));
-
- if (width > clist->column[i].width)
- gtk_clist_set_column_width (clist, i, width);
- }
-
- clist->column[i].area.width = clist->column[i].width;
- xoffset += clist->column[i].width + CELL_SPACING + (2 * COLUMN_INSET);
- } else if (GTK_CLIST_SHOW_TITLES(clist) && clist->column[i].button) {
- clist->column[i].area.width =
- clist->column[i].button->requisition.width -
- (CELL_SPACING + (2 * COLUMN_INSET));
- xoffset += clist->column[i].button->requisition.width;
- }
- }
-
- clist->column[last_column].area.width += MAX (0, clist->clist_window_width + COLUMN_INSET - xoffset);
-}
-
-static void
-size_allocate_title_buttons (GtkCList *clist)
-{
- GtkAllocation button_allocation;
- int last_column;
- int last_button = 0;
- int i;
-
- button_allocation.x = clist->hoffset;
- button_allocation.y = 0;
- button_allocation.width = 0;
- button_allocation.height = clist->column_title_area.height;
-
- /* find last visible column */
- for (last_column = clist->columns - 1; last_column >= 0; last_column--)
- if (clist->column[last_column].visible)
- break;
-
- for (i = 0; i < last_column; i++) {
- if (!clist->column[i].visible) {
- last_button = i + 1;
- gdk_window_hide (clist->column[i].window);
- continue;
- }
-
- button_allocation.width += (clist->column[i].area.width +
- CELL_SPACING + 2 * COLUMN_INSET);
-
- if (!clist->column[i + 1].button) {
- gdk_window_hide (clist->column[i].window);
- continue;
- }
-
- gtk_widget_size_allocate (clist->column[last_button].button,
- &button_allocation);
- button_allocation.x += button_allocation.width;
- button_allocation.width = 0;
-
- last_button = i + 1;
- }
-
- button_allocation.width += (clist->column[last_column].area.width +
- 2 * (CELL_SPACING + COLUMN_INSET));
- gtk_widget_size_allocate (clist->column[last_button].button,
- &button_allocation);
-
-}
-
-static void
-nautilus_list_draw_focus (GtkWidget *widget)
-{
- GdkGCValues saved_values;
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
-
- if (!GTK_WIDGET_DRAWABLE (widget) || !GTK_WIDGET_CAN_FOCUS (widget)) {
- return;
- }
-
- clist = GTK_CLIST (widget);
- if (clist->focus_row < 0) {
- return;
- }
-
- gdk_gc_get_values (clist->xor_gc, &saved_values);
-
- gdk_gc_set_stipple (clist->xor_gc, nautilus_stipple_bitmap ());
- gdk_gc_set_fill (clist->xor_gc, GDK_STIPPLED);
-
- gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
- 0, ROW_TOP_YPIXEL(clist, clist->focus_row),
- clist->clist_window_width - 1,
- clist->row_height - 1);
- /* Resetting the stipple to the saved value causes death
- * deep in Bonobo X handling, believe it or not. Fortunately
- * we don't need to.
- */
- gdk_gc_set_fill (clist->xor_gc, saved_values.fill);
-}
-
-static void
-get_cell_style (GtkCList *clist, GtkCListRow *clist_row,
- gint state, gint column, GtkStyle **style,
- GdkGC **fg_gc, GdkGC **bg_gc)
-{
- gint fg_state;
-
- if ((state == GTK_STATE_NORMAL) &&
- (GTK_WIDGET (clist)->state == GTK_STATE_INSENSITIVE))
- fg_state = GTK_STATE_INSENSITIVE;
- else
- fg_state = state;
-
- if (clist_row->cell[column].style) {
- if (style)
- *style = clist_row->cell[column].style;
- if (fg_gc)
- *fg_gc = clist_row->cell[column].style->fg_gc[fg_state];
- if (bg_gc) {
- if (state == GTK_STATE_SELECTED)
- *bg_gc = clist_row->cell[column].style->bg_gc[state];
- else
- *bg_gc = clist_row->cell[column].style->base_gc[state];
- }
- } else if (clist_row->style) {
- if (style)
- *style = clist_row->style;
- if (fg_gc)
- *fg_gc = clist_row->style->fg_gc[fg_state];
- if (bg_gc) {
- if (state == GTK_STATE_SELECTED)
- *bg_gc = clist_row->style->bg_gc[state];
- else
- *bg_gc = clist_row->style->base_gc[state];
- }
- } else {
- if (style)
- *style = GTK_WIDGET (clist)->style;
- if (fg_gc)
- *fg_gc = GTK_WIDGET (clist)->style->fg_gc[fg_state];
- if (bg_gc) {
- if (state == GTK_STATE_SELECTED)
- *bg_gc = GTK_WIDGET (clist)->style->bg_gc[state];
- else
- *bg_gc = GTK_WIDGET (clist)->style->base_gc[state];
- }
-
- if (state != GTK_STATE_SELECTED) {
- if (fg_gc && clist_row->fg_set)
- *fg_gc = clist->fg_gc;
- if (bg_gc && clist_row->bg_set)
- *bg_gc = clist->bg_gc;
- }
- }
-}
-
-static void
-gdk_window_size_as_rectangle (GdkWindow *gdk_window, GdkRectangle *rectangle)
-{
- gint width, height;
-
- gdk_window_get_size (gdk_window, &width, &height);
- rectangle->width = width;
- rectangle->height = height;
-}
-
-static gint
-draw_cell_pixmap (GdkWindow *window, GdkRectangle *clip_rectangle, GdkGC *fg_gc,
- GdkPixmap *pixmap, GdkBitmap *mask,
- gint x, gint y)
-{
- GdkRectangle image_rectangle;
- GdkRectangle intersect_rectangle;
-
- gdk_window_size_as_rectangle (pixmap, &image_rectangle);
- image_rectangle.x = x;
- image_rectangle.y = y;
-
- if (!gdk_rectangle_intersect (clip_rectangle, &image_rectangle, &intersect_rectangle)) {
- return x;
- }
-
- if (mask) {
- gdk_gc_set_clip_mask (fg_gc, mask);
- gdk_gc_set_clip_origin (fg_gc, x, y);
- }
-
- gdk_draw_pixmap (window, fg_gc, pixmap,
- intersect_rectangle.x - x, intersect_rectangle.y - y,
- image_rectangle.x, image_rectangle.y,
- intersect_rectangle.width, intersect_rectangle.height);
-
- if (mask) {
- gdk_gc_set_clip_origin (fg_gc, 0, 0);
- gdk_gc_set_clip_mask (fg_gc, NULL);
- }
-
- return x + intersect_rectangle.width;
-}
-
-static gint
-draw_cell_pixbuf (GdkWindow *window, GdkRectangle *clip_rectangle, GdkGC *fg_gc,
- GdkPixbuf *pixbuf, gint x, gint y)
-{
- GdkRectangle image_rectangle;
- GdkRectangle intersect_rectangle;
-
- image_rectangle.width = gdk_pixbuf_get_width (pixbuf);
- image_rectangle.height = gdk_pixbuf_get_height (pixbuf);
- image_rectangle.x = x;
- image_rectangle.y = y;
-
- if (!gdk_rectangle_intersect (clip_rectangle, &image_rectangle, &intersect_rectangle)) {
- return x;
- }
-
- gdk_pixbuf_render_to_drawable_alpha (pixbuf, window,
- intersect_rectangle.x - x, intersect_rectangle.y - y,
- image_rectangle.x, image_rectangle.y,
- intersect_rectangle.width, intersect_rectangle.height,
- GDK_PIXBUF_ALPHA_BILEVEL, 128, GDK_RGB_DITHER_MAX,
- 0, 0);
-
- return x + intersect_rectangle.width;
-}
-
-/**
- * get_cell_horizontal_start_position:
- *
- * Get the leftmost x value at which the contents of this cell are painted.
- *
- * @clist: The list in question.
- * @row: The row data structure for the target cell.
- * @column: The column of the target cell.
- * @content_width: The already-computed width of the cell contents.
- *
- * Return value: x value at which the contents of this cell are painted.
- */
-static int
-get_cell_horizontal_start_position (GtkCList *clist, GtkCListRow *clist_row, int column, int content_width)
-{
- int initial_offset;
-
- initial_offset = clist->column[column].area.x +
- clist->hoffset +
- clist_row->cell[column].horizontal;
-
- switch (clist->column[column].justification) {
- case GTK_JUSTIFY_LEFT:
- return initial_offset;
- case GTK_JUSTIFY_RIGHT:
- return initial_offset + clist->column[column].area.width - content_width;
- case GTK_JUSTIFY_CENTER:
- case GTK_JUSTIFY_FILL:
- default:
- return initial_offset + (clist->column[column].area.width - content_width)/2;
- }
-}
-
-static void
-draw_row (GtkCList *clist,
- GdkRectangle *area,
- gint row,
- GtkCListRow *clist_row)
-{
- GtkWidget *widget;
- GdkRectangle *rect;
- GdkRectangle row_rectangle;
- GdkRectangle cell_rectangle;
- GdkRectangle clip_rectangle;
- GdkRectangle intersect_rectangle;
- gint last_column;
- gint state;
- gint i;
-
- g_return_if_fail (clist != NULL);
-
- /* bail now if we arn't drawable yet */
- if (!GTK_WIDGET_DRAWABLE (clist) || row < 0 || row >= clist->rows)
- return;
-
- widget = GTK_WIDGET (clist);
-
- /* if the function is passed the pointer to the row instead of null,
- * it avoids this expensive lookup */
- if (!clist_row)
- clist_row = ROW_ELEMENT (clist, row)->data;
-
- /* rectangle of the entire row */
- row_rectangle.x = 0;
- row_rectangle.y = ROW_TOP_YPIXEL (clist, row);
- row_rectangle.width = clist->clist_window_width;
- row_rectangle.height = clist->row_height;
-
- /* rectangle of the cell spacing above the row */
- cell_rectangle.x = 0;
- cell_rectangle.y = row_rectangle.y - CELL_SPACING;
- cell_rectangle.width = row_rectangle.width;
- cell_rectangle.height = CELL_SPACING;
-
- /* rectangle used to clip drawing operations, its y and height
- * positions only need to be set once, so we set them once here.
- * the x and width are set withing the drawing loop below once per
- * column */
- clip_rectangle.y = row_rectangle.y;
- clip_rectangle.height = row_rectangle.height;
-
- if (clist_row->state == GTK_STATE_NORMAL)
- {
- if (clist_row->fg_set)
- gdk_gc_set_foreground (clist->fg_gc, &clist_row->foreground);
- if (clist_row->bg_set)
- gdk_gc_set_foreground (clist->bg_gc, &clist_row->background);
- }
-
- state = clist_row->state;
-
- /* draw the cell borders and background */
- if (area)
- {
- rect = &intersect_rectangle;
- if (gdk_rectangle_intersect (area, &cell_rectangle,
- &intersect_rectangle))
- gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_ACTIVE],
- TRUE,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
-
- /* the last row has to clear its bottom cell spacing too */
- if (clist_row == clist->row_list_end->data)
- {
- cell_rectangle.y += clist->row_height + CELL_SPACING;
-
- if (gdk_rectangle_intersect (area, &cell_rectangle,
- &intersect_rectangle))
- gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_ACTIVE],
- TRUE,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
- }
-
- if (!gdk_rectangle_intersect (area, &row_rectangle,&intersect_rectangle))
- return;
-
- }
- else
- {
- rect = &clip_rectangle;
- gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_ACTIVE],
- TRUE,
- cell_rectangle.x,
- cell_rectangle.y,
- cell_rectangle.width,
- cell_rectangle.height);
-
- /* the last row has to clear its bottom cell spacing too */
- if (clist_row == clist->row_list_end->data)
- {
- cell_rectangle.y += clist->row_height + CELL_SPACING;
-
- gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_ACTIVE],
- TRUE,
- cell_rectangle.x,
- cell_rectangle.y,
- cell_rectangle.width,
- cell_rectangle.height);
- }
- }
-
- for (last_column = clist->columns - 1;
- last_column >= 0 && !clist->column[last_column].visible; last_column--)
- ;
-
- /* iterate and draw all the columns (row cells) and draw their contents */
- for (i = 0; i < clist->columns; i++)
- {
- GtkStyle *style;
- GdkGC *fg_gc;
- GdkGC *bg_gc;
- GdkGCValues saved_values;
-
- GList *p;
-
- gint width;
- gint height;
- gint pixmap_width;
- gint offset = 0;
- gint baseline;
- gint row_center_offset;
-
- if (!clist->column[i].visible)
- continue;
-
- get_cell_style (clist, clist_row, state, i, &style, &fg_gc, &bg_gc);
-
- clip_rectangle.x = clist->column[i].area.x + clist->hoffset;
- clip_rectangle.width = clist->column[i].area.width;
-
- /* calculate clipping region clipping region */
- clip_rectangle.x -= COLUMN_INSET + CELL_SPACING;
- clip_rectangle.width += (2 * COLUMN_INSET + CELL_SPACING +
- (i == last_column) * CELL_SPACING);
-
- if (area && !gdk_rectangle_intersect (area, &clip_rectangle,
- &intersect_rectangle))
- continue;
-
- gdk_draw_rectangle (clist->clist_window, bg_gc, TRUE,
- rect->x, rect->y, rect->width, rect->height);
-
- clip_rectangle.x += COLUMN_INSET + CELL_SPACING;
- clip_rectangle.width -= (2 * COLUMN_INSET + CELL_SPACING +
- (i == last_column) * CELL_SPACING);
-
- /* calculate real width for column justification */
- width = 0;
- pixmap_width = 0;
- offset = 0;
- switch ((NautilusCellType)clist_row->cell[i].type)
- {
- case NAUTILUS_CELL_TEXT:
- case NAUTILUS_CELL_LINK_TEXT:
- width = gdk_string_width (style->font,
- GTK_CELL_TEXT (clist_row->cell[i])->text);
- break;
- case NAUTILUS_CELL_PIXMAP:
- gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
- &pixmap_width, &height);
- width = pixmap_width;
- break;
- case NAUTILUS_CELL_PIXTEXT:
- gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
- &pixmap_width, &height);
- width = (pixmap_width +
- GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing +
- gdk_string_width (style->font,
- GTK_CELL_PIXTEXT
- (clist_row->cell[i])->text));
- break;
- case NAUTILUS_CELL_PIXBUF_LIST:
- for (p = NAUTILUS_CELL_PIXBUF_LIST (clist_row->cell[i])->pixbufs; p != NULL; p = p->next) {
- if (width != 0) {
- width += PIXBUF_LIST_SPACING;
- }
- width += gdk_pixbuf_get_width (p->data);
- }
- break;
- default:
- continue;
- break;
- }
-
- offset = get_cell_horizontal_start_position (clist, clist_row, i, width);
-
- /* Draw Text and/or Pixmap */
- switch ((NautilusCellType)clist_row->cell[i].type)
- {
- case NAUTILUS_CELL_PIXMAP:
- draw_cell_pixmap (clist->clist_window, &clip_rectangle, fg_gc,
- GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
- GTK_CELL_PIXMAP (clist_row->cell[i])->mask,
- offset,
- clip_rectangle.y + clist_row->cell[i].vertical +
- (clip_rectangle.height - height) / 2);
- break;
- case NAUTILUS_CELL_PIXTEXT:
- offset =
- draw_cell_pixmap (clist->clist_window, &clip_rectangle, fg_gc,
- GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
- GTK_CELL_PIXTEXT (clist_row->cell[i])->mask,
- offset,
- clip_rectangle.y + clist_row->cell[i].vertical+
- (clip_rectangle.height - height) / 2);
- offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
- case NAUTILUS_CELL_TEXT:
- case NAUTILUS_CELL_LINK_TEXT:
- if (style != GTK_WIDGET (clist)->style)
- row_center_offset = (((clist->row_height - style->font->ascent -
- style->font->descent - 1) / 2) + 1.5 +
- style->font->ascent);
- else
- row_center_offset = clist->row_center_offset;
-
- baseline = row_rectangle.y + row_center_offset + clist_row->cell[i].vertical;
-
- gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
-
- /* For link text cells, draw with blue link-like color and use underline. */
- if ((NautilusCellType)clist_row->cell[i].type == NAUTILUS_CELL_LINK_TEXT
- && NAUTILUS_LIST (clist)->details->single_click_mode) {
- if (state == GTK_STATE_NORMAL) {
- gdk_gc_get_values (fg_gc, &saved_values);
- gdk_rgb_gc_set_foreground (fg_gc, NAUTILUS_RGB_COLOR_BLUE);
- }
- }
- gdk_draw_string (clist->clist_window, style->font, fg_gc,
- offset,
- baseline,
- ((NautilusCellType)clist_row->cell[i].type == GTK_CELL_PIXTEXT) ?
- GTK_CELL_PIXTEXT (clist_row->cell[i])->text :
- GTK_CELL_TEXT (clist_row->cell[i])->text);
-
- if ((NautilusCellType)clist_row->cell[i].type == NAUTILUS_CELL_LINK_TEXT
- && NAUTILUS_LIST (clist)->details->single_click_mode) {
- gdk_draw_line (clist->clist_window, fg_gc,
- offset, baseline + 1,
- offset + width, baseline + 1);
- /* Revert color change we made a moment ago. */
- if (state == GTK_STATE_NORMAL) {
- gdk_gc_set_foreground (fg_gc, &saved_values.foreground);
- }
- }
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
- break;
- case NAUTILUS_CELL_PIXBUF_LIST:
- {
- GdkPixmap *gdk_pixmap;
- GdkBitmap *mask;
- guint pixbuf_width;
- guint ellipsis_width;
-
- ellipsis_width = gdk_string_width (style->font, "...");
-
- for (p = NAUTILUS_CELL_PIXBUF_LIST (clist_row->cell[i])->pixbufs; p != NULL; p = p->next) {
- gdk_pixbuf_render_pixmap_and_mask (p->data, &gdk_pixmap, &mask, 128);
- pixbuf_width = gdk_pixbuf_get_width (p->data);
-
- if ((p->next != NULL && pixbuf_width + ellipsis_width >=
- clip_rectangle.x + clip_rectangle.width - offset) ||
- (pixbuf_width >= clip_rectangle.x + clip_rectangle.width - offset)) {
- /* Not enough room for this icon & ellipsis, just draw ellipsis. */
-
- gdk_draw_string (clist->clist_window, style->font, fg_gc,
- offset,
- clip_rectangle.y + clip_rectangle.height/2,
- "...");
-
- break;
- }
-
- height = gdk_pixbuf_get_height (p->data);
-
- offset = draw_cell_pixbuf (clist->clist_window,
- &clip_rectangle, fg_gc,
- p->data,
- offset,
- clip_rectangle.y + clist_row->cell[i].vertical +
- (clip_rectangle.height - height) / 2);
-
- offset += PIXBUF_LIST_SPACING;
- }
- break;
- }
- default:
- break;
- }
- }
-
- /* draw focus rectangle */
- if (clist->focus_row == row &&
- GTK_WIDGET_CAN_FOCUS (widget) && GTK_WIDGET_HAS_FOCUS(widget))
- {
- if (!area)
- gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
- row_rectangle.x, row_rectangle.y,
- row_rectangle.width - 1, row_rectangle.height - 1);
- else if (gdk_rectangle_intersect (area, &row_rectangle,
- &intersect_rectangle))
- {
- gdk_gc_set_clip_rectangle (clist->xor_gc, &intersect_rectangle);
- gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
- row_rectangle.x, row_rectangle.y,
- row_rectangle.width - 1,
- row_rectangle.height - 1);
- gdk_gc_set_clip_rectangle (clist->xor_gc, NULL);
- }
- }
-}
-
-static void
-draw_rows (GtkCList *clist, GdkRectangle *area)
-{
- GList *list;
- gint i;
- gint first_row;
- gint last_row;
-
- if (clist->row_height == 0 || !GTK_WIDGET_DRAWABLE (clist))
- return;
-
- first_row = ROW_FROM_YPIXEL (clist, area->y);
- last_row = ROW_FROM_YPIXEL (clist, area->y + area->height);
-
- /* this is a small special case which exposes the bottom cell line
- * on the last row -- it might go away if I change the wall the cell
- * spacings are drawn
- */
- if (clist->rows == first_row)
- first_row--;
-
- list = ROW_ELEMENT (clist, first_row);
- for (i = first_row; i <= last_row ; i++) {
- if (list == NULL)
- break;
-
- GTK_CLIST_CLASS ((GTK_OBJECT (clist))->klass)->draw_row (clist, area, i,
- list->data);
- list = list->next;
- }
-}
-
-static void
-nautilus_list_resize_column (GtkCList *clist, int column, int width)
-{
- /* override resize column to invalidate the title */
- NautilusList *list;
-
- g_assert (NAUTILUS_IS_LIST (clist));
-
- list = NAUTILUS_LIST (clist);
-
- gtk_widget_queue_draw (list->details->title);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_CLIST_CLASS, resize_column, (clist, column, width));
-}
-
-/* Macros borrowed from gtkclist.c */
-/* returns the GList item for the nth row */
-#define ROW_ELEMENT(clist, row) (((row) == (clist)->rows - 1) ? \
- (clist)->row_list_end : \
- g_list_nth ((clist)->row_list, (row)))
-
-
-#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass)
-
-/* redraw the list if it's not frozen */
-#define CLIST_UNFROZEN(clist) (((GtkCList*) (clist))->freeze_count == 0)
-
-/**
- * nautilus_list_mark_cell_as_link:
- *
- * Mark a text cell as a link cell. Link cells are drawn differently,
- * and activate rather than select on single-click. The cell must
- * be a text cell (not a pixmap cell or one of the other types).
- *
- * @list: The NautilusList in question.
- * @column: The column of the desired cell.
- * @row: The row of the desired cell.
- */
-void
-nautilus_list_mark_cell_as_link (NautilusList *list,
- gint row,
- gint column)
-{
- GtkCListRow *clist_row;
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (list));
-
- clist = GTK_CLIST (list);
-
- g_return_if_fail (row >= 0 && row < clist->rows);
- g_return_if_fail (column >= 0 && column < clist->columns);
-
- clist_row = ROW_ELEMENT (clist, row)->data;
-
- /*
- * We only support changing text cells to links. Maybe someday
- * we'll support pixmap or pixtext link cells too.
- */
- g_return_if_fail ((NautilusCellType)clist_row->cell[column].type == NAUTILUS_CELL_TEXT);
-
- clist_row->cell[column].type = NAUTILUS_CELL_LINK_TEXT;
-}
-
-
-static void
-nautilus_list_set_cell_contents (GtkCList *clist,
- GtkCListRow *clist_row,
- gint column,
- GtkCellType type,
- const gchar *text,
- guint8 spacing,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
-{
- /*
- * Note that we don't do the auto_resize bracketing here that's done
- * in the parent class. It would require copying over huge additional
- * chunks of code. We might decide we need that someday, but the
- * chances seem larger that we'll switch away from CList first.
- */
-
- if ((NautilusCellType)clist_row->cell[column].type == NAUTILUS_CELL_PIXBUF_LIST) {
- /* Clean up old data, which parent class doesn't know about. */
- nautilus_gdk_pixbuf_list_free (NAUTILUS_CELL_PIXBUF_LIST (clist_row->cell[column])->pixbufs);
- }
-
- /* If old cell was a link-text cell, convert it back to a normal text
- * cell so it gets cleaned up properly by GtkCList code.
- */
- if ((NautilusCellType)clist_row->cell[column].type == NAUTILUS_CELL_LINK_TEXT) {
- clist_row->cell[column].type = NAUTILUS_CELL_TEXT;
- }
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_CLIST_CLASS, set_cell_contents, (clist, clist_row, column, type, text, spacing, pixmap, mask));
-
-
- if ((NautilusCellType)type == NAUTILUS_CELL_PIXBUF_LIST) {
- clist_row->cell[column].type = NAUTILUS_CELL_PIXBUF_LIST;
- /* Hideously, we concealed our list of pixbufs in the pixmap parameter. */
- NAUTILUS_CELL_PIXBUF_LIST (clist_row->cell[column])->pixbufs = (GList *)pixmap;
- }
-}
-
-/**
- * nautilus_list_set_pixbuf_list:
- *
- * Set the contents of a cell to a list of similarly-sized GdkPixbufs.
- *
- * @list: The NautilusList in question.
- * @row: The row of the target cell.
- * @column: The column of the target cell.
- * @pixbufs: A GList of GdkPixbufs.
- */
-void
-nautilus_list_set_pixbuf_list (NautilusList *list,
- gint row,
- gint column,
- GList *pixbufs)
-{
- GtkCList *clist;
- GtkCListRow *clist_row;
-
- g_return_if_fail (NAUTILUS_IS_LIST (list));
-
- clist = GTK_CLIST (list);
-
- if (row < 0 || row >= clist->rows)
- return;
- if (column < 0 || column >= clist->columns)
- return;
-
- clist_row = ROW_ELEMENT (clist, row)->data;
-
- /*
- * We have to go through the set_cell_contents bottleneck, which only
- * allows expected parameter types. Since our pixbuf_list is not an
- * expected parameter type, we have to sneak it in by casting it into
- * one of the expected parameters.
- */
- GTK_CLIST_CLASS_FW (clist)->set_cell_contents
- (clist, clist_row, column, (GtkCellType)NAUTILUS_CELL_PIXBUF_LIST, NULL, 0, (GdkPixmap *)pixbufs, NULL);
-
- /* redraw the list if it's not frozen */
- if (CLIST_UNFROZEN (clist))
- {
- if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
- GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
- }
-}
-
-static void
-nautilus_list_track_new_column_width (GtkCList *clist, int column, int new_width)
-{
- NautilusList *list;
-
- list = NAUTILUS_LIST (clist);
-
- /* pin new_width to min and max values */
- if (new_width < MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width))
- new_width = MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width);
- if (clist->column[column].max_width >= 0 &&
- new_width > clist->column[column].max_width)
- new_width = clist->column[column].max_width;
-
- /* check to see if the pinned value is still different */
- if (clist->column[column].width == new_width)
- return;
-
- /* set the new width */
- clist->column[column].width = new_width;
- clist->column[column].width_set = TRUE;
-
- size_allocate_columns (clist, TRUE);
- size_allocate_title_buttons (clist);
-
- /* redraw the invalid columns */
- if (clist->freeze_count == 0) {
-
- GdkRectangle area;
-
- area = clist->column_title_area;
- area.x = clist->column[column].area.x;
- area.height += clist->clist_window_height;
-
- draw_rows (clist, &area);
- }
-}
-
-/* Our handler for motion_notify events. We override all of GtkCList's broken
- * behavior.
- */
-static gint
-nautilus_list_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- NautilusList *list;
- GtkCList *clist;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- list = NAUTILUS_LIST (widget);
- clist = GTK_CLIST (widget);
-
- if (event->window != clist->clist_window)
- return NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, motion_notify_event, (widget, event));
-
- if (!((list->details->dnd_press_button == 1 && (event->state & GDK_BUTTON1_MASK))
- || (list->details->dnd_press_button == 2 && (event->state & GDK_BUTTON2_MASK))))
- return FALSE;
-
- /* This is the same threshold value that is used in gtkdnd.c */
-
- if (MAX (abs (list->details->dnd_press_x - event->x),
- abs (list->details->dnd_press_y - event->y)) <= 3)
- return FALSE;
-
- /* Handle any pending selections */
-
- if (list->details->dnd_select_pending) {
- select_row_from_mouse (list,
- list->details->button_down_row,
- list->details->dnd_select_pending_state);
-
- list->details->dnd_select_pending = FALSE;
- list->details->dnd_select_pending_state = 0;
- }
-
- gtk_signal_emit (GTK_OBJECT (list),
- list_signals[START_DRAG],
- list->details->dnd_press_button,
- event);
- return TRUE;
-}
-
-void
-nautilus_list_column_resize_track_start (GtkWidget *widget, int column)
-{
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
-
- clist = GTK_CLIST (widget);
- clist->drag_pos = column;
-}
-
-void
-nautilus_list_column_resize_track (GtkWidget *widget, int column)
-{
- GtkCList *clist;
- int x;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
-
- clist = GTK_CLIST (widget);
-
- gtk_widget_get_pointer (widget, &x, NULL);
- nautilus_list_track_new_column_width (clist, column,
- new_column_width (clist, column, &x));
-
-}
-
-void
-nautilus_list_column_resize_track_end (GtkWidget *widget, int column)
-{
- GtkCList *clist;
-
- g_return_if_fail (NAUTILUS_IS_LIST (widget));
-
- clist = GTK_CLIST (widget);
- clist->drag_pos = -1;
-}
-
-/* We override the drag_begin signal to do nothing */
-static void
-nautilus_list_drag_begin (GtkWidget *widget, GdkDragContext *context)
-{
- /* nothing */
-}
-
-/* We override the drag_end signal to do nothing */
-static void
-nautilus_list_drag_end (GtkWidget *widget, GdkDragContext *context)
-{
- /* nothing */
-}
-
-/* We override the drag_data_get signal to do nothing */
-static void
-nautilus_list_drag_data_get (GtkWidget *widget, GdkDragContext *context,
- GtkSelectionData *data, guint info, guint time)
-{
- /* nothing */
-}
-
-/* We override the drag_leave signal to do nothing */
-static void
-nautilus_list_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time)
-{
- /* nothing */
-}
-
-/* We override the drag_motion signal to do nothing */
-static gboolean
-nautilus_list_drag_motion (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time)
-{
- return FALSE;
-}
-
-/* We override the drag_drop signal to do nothing */
-static gboolean
-nautilus_list_drag_drop (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time)
-{
- return FALSE;
-}
-
-/* We override the drag_data_received signal to accept colors. */
-static void
-nautilus_list_drag_data_received (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *data,
- guint info, guint time)
-{
- switch (info) {
- case TARGET_COLOR:
- nautilus_background_receive_dropped_color
- (nautilus_get_widget_background (widget),
- widget, x, y, data);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-/* Our handler for the clear signal of the clist. We have to reset the anchor
- * to null.
- */
-static void
-nautilus_list_clear (GtkCList *clist)
-{
- NautilusList *list;
-
- g_return_if_fail (NAUTILUS_IS_LIST (clist));
-
- list = NAUTILUS_LIST (clist);
- list->details->anchor_row = -1;
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_CLIST_CLASS, clear, (clist));
-}
-
-
-/**
- * nautilus_list_new_with_titles:
- * @columns: The number of columns in the list
- * @titles: The titles for the columns
- *
- * Return value: The newly-created file list.
- **/
-GtkWidget *
-nautilus_list_new_with_titles (int columns, const char * const *titles)
-{
- NautilusList *list;
-
- list = gtk_type_new (nautilus_list_get_type ());
- gtk_clist_construct (GTK_CLIST (list), columns, NULL);
- if (titles) {
- GtkCList *clist;
- int index;
-
- clist = GTK_CLIST(list);
-
- for (index = 0; index < columns; index++) {
- clist->column[index].title = g_strdup (titles[index]);
- }
- }
-
- gtk_clist_set_selection_mode (GTK_CLIST (list),
- GTK_SELECTION_MULTIPLE);
-
- return GTK_WIDGET (list);
-}
-
-static int
-nautilus_list_get_first_selected_row (NautilusList *list)
-{
- GtkCListRow *row;
- GList *p;
- int row_number;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (list), -1);
-
- row_number = 0;
- for (p = GTK_CLIST (list)->row_list; p != NULL; p = p->next) {
- row = p->data;
- if (row->state == GTK_STATE_SELECTED) {
- return row_number;
- }
-
- ++row_number;
- }
-
- return -1;
-}
-
-static int
-nautilus_list_get_last_selected_row (NautilusList *list)
-{
- GtkCListRow *row;
- GList *p;
- int row_number;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (list), -1);
-
- row_number = GTK_CLIST (list)->rows - 1;
- for (p = GTK_CLIST (list)->row_list_end; p != NULL; p = p->prev) {
- row = p->data;
- if (row->state == GTK_STATE_SELECTED) {
- return row_number;
- }
-
- --row_number;
- }
-
- return -1;
-}
-
-GList *
-nautilus_list_get_selection (NautilusList *list)
-{
- GList *retval;
- GList *p;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST (list), NULL);
-
- retval = NULL;
- for (p = GTK_CLIST (list)->row_list; p != NULL; p = p->next) {
- GtkCListRow *row;
-
- row = p->data;
- if (row->state == GTK_STATE_SELECTED)
- retval = g_list_prepend (retval, row->data);
- }
-
- return retval;
-}
-
-void
-nautilus_list_set_selection (NautilusList *list, GList *selection)
-{
- GList *p;
- gboolean selection_changed;
- gboolean select_this;
- int i;
-
- g_return_if_fail (NAUTILUS_IS_LIST (list));
-
- /* FIXME: Selecting n items in an m-element container is an
- O(m*n) task using this algorithm, making it quadratic if
- you select them all with this method, which actually
- happens if you select all in list view and switch to icon
- view. We should build a hash table from the list first;
- then we can get O(m+n) performance. */
-
- selection_changed = FALSE;
-
- for (p = GTK_CLIST (list)->row_list, i = 0; p != NULL; p = p->next, i++) {
- GtkCListRow *row;
- gpointer row_data;
-
- row = p->data;
- row_data = row->data;
-
- select_this = (NULL != g_list_find (selection, row_data));
-
- selection_changed |= row_set_selected (list, i, row_data, select_this);
- }
-
- if (selection_changed) {
- emit_selection_changed (list);
- }
-}
-
diff --git a/libnautilus/nautilus-list.h b/libnautilus/nautilus-list.h
deleted file mode 100644
index ecd49ec1f..000000000
--- a/libnautilus/nautilus-list.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-list.h: Enhanced version of GtkCList for Nautilus.
-
- Copyright (C) 1999, 2000 Free Software Foundation
- 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.
-
- Authors: Federico Mena <federico@nuclecu.unam.mx>,
- Ettore Perazzoli <ettore@gnu.org>,
- John Sullivan <sullivan@eazel.com>,
- Pavel Cisler <pavel@eazel.com>
- */
-
-#ifndef NAUTILUS_LIST_H
-#define NAUTILUS_LIST_H
-
-#include <gtk/gtkclist.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/* This class was originally derived from the GtkFList class in gmc.
- */
-
-/* It is sad that we have to do this. GtkCList's behavior is so broken that we
- * have to override all the event handlers and implement our own selection
- * behavior. Sigh. -Federico
- */
-
-/* Superset of GtkCellType enum defined in gtk-clist.h */
-typedef enum
-{
- NAUTILUS_CELL_EMPTY, /* GTK_CELL_EMPTY */
- NAUTILUS_CELL_TEXT, /* GTK_CELL_TEXT */
- NAUTILUS_CELL_PIXMAP, /* GTK_CELL_PIXMAP */
- NAUTILUS_CELL_PIXTEXT, /* GTK_CELL_PIXTEXT */
- NAUTILUS_CELL_WIDGET, /* GTK_CELL_WIDGET */
- NAUTILUS_CELL_PIXBUF_LIST, /* new for Nautilus */
- NAUTILUS_CELL_LINK_TEXT /* new for Nautilus */
-} NautilusCellType;
-
-/* pointer casting for cells */
-#define NAUTILUS_CELL_PIXBUF_LIST(cell) (((NautilusCellPixbufList *) &(cell)))
-/* no #define for NAUTILUS_CELL_LINK_TEXT, use GTK_CELL_TEXT instead */
-
-typedef struct _NautilusCellPixbufList NautilusCellPixbufList;
-/* no struct for NautilusCellLinkText, use GtkCellText instead */
-
-/*
- * Since the info in each cell must fit in the GtkCell struct that CList defines,
- * we disguise ours in the GtkCellWidget format, with our pixbufs pointer where
- * the widget would be.
- */
-struct _NautilusCellPixbufList
-{
- NautilusCellType type;
-
- gint16 vertical;
- gint16 horizontal;
-
- GtkStyle *style;
-
- GList *pixbufs; /* list of GdkPixbuf * */
-};
-
-#define NAUTILUS_TYPE_LIST (nautilus_list_get_type ())
-#define NAUTILUS_LIST(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_LIST, NautilusList))
-#define NAUTILUS_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_LIST, NautilusListClass))
-#define NAUTILUS_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_LIST))
-#define NAUTILUS_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_LIST))
-
-typedef struct NautilusList NautilusList;
-typedef struct NautilusListClass NautilusListClass;
-typedef struct NautilusListDetails NautilusListDetails;
-
-struct NautilusList {
- GtkCList clist;
- NautilusListDetails *details;
-};
-
-struct NautilusListClass {
- GtkCListClass parent_class;
-
- /* Signal: invoke the popup menu for selected items */
- void (* context_click_selection) (NautilusList *list, int row);
-
- /* Signal: invoke the popup menu for empty areas */
- void (* context_click_background) (NautilusList *list);
-
- /* Signal: open the file in the selected row */
- void (* activate) (NautilusList *list, gpointer data);
-
- /* Signal: initiate a drag and drop operation */
- void (* start_drag) (NautilusList *list, int button, GdkEvent *event);
-
- /* Signal: selection has changed */
- void (* selection_changed) (NautilusList *list);
-
- /* column resize tracking calls */
- void (* column_resize_track_start) (GtkWidget *widget, int column);
- void (* column_resize_track) (GtkWidget *widget, int column);
- void (* column_resize_track_end) (GtkWidget *widget, int column);
-};
-
-GtkType nautilus_list_get_type (void);
-GtkWidget *nautilus_list_new_with_titles (int columns,
- const char * const *titles);
-GList * nautilus_list_get_selection (NautilusList *list);
-void nautilus_list_set_selection (NautilusList *list, GList *selection);
-gboolean nautilus_list_is_row_selected (NautilusList *list,
- int row);
-void nautilus_list_set_pixbuf_list (NautilusList *list,
- gint row,
- gint column,
- GList *pixbufs);
-void nautilus_list_mark_cell_as_link (NautilusList *list,
- gint row,
- gint column);
-#endif /* NAUTILUS_LIST_H */
diff --git a/libnautilus/nautilus-meta-view-frame.c b/libnautilus/nautilus-meta-view-frame.c
index 56037dc54..99d933b3a 100644
--- a/libnautilus/nautilus-meta-view-frame.c
+++ b/libnautilus/nautilus-meta-view-frame.c
@@ -24,16 +24,16 @@
*
*/
-/* ntl-meta-view-frame.c: Implementation for object that represents a
+/* nautilus-meta-view-frame.c: Implementation for object that represents a
nautilus meta view implementation. */
#include <config.h>
-#include "ntl-meta-view-frame.h"
+#include "nautilus-meta-view-frame.h"
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-property-bag.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
struct NautilusMetaViewFrameDetails {
char *label;
diff --git a/libnautilus/nautilus-meta-view-frame.h b/libnautilus/nautilus-meta-view-frame.h
index 1a4320354..6a22f7bc5 100644
--- a/libnautilus/nautilus-meta-view-frame.h
+++ b/libnautilus/nautilus-meta-view-frame.h
@@ -23,13 +23,13 @@
* Author: Elliot Lee <sopwith@redhat.com>
*
*/
-/* ntl-meta-view-frame.h: Interface for object that represents the
+/* nautilus-meta-view-frame.h: Interface for object that represents the
frame a nautilus meta view plugs into. */
-#ifndef NTL_META_VIEW_FRAME_H
-#define NTL_META_VIEW_FRAME_H
+#ifndef NAUTILUS_META_VIEW_FRAME_H
+#define NAUTILUS_META_VIEW_FRAME_H
-#include <libnautilus/ntl-view-frame.h>
+#include <libnautilus/nautilus-view-frame.h>
#include <bonobo/bonobo-control.h>
#define NAUTILUS_TYPE_META_VIEW_FRAME (nautilus_meta_view_frame_get_type ())
diff --git a/libnautilus/nautilus-metadata.h b/libnautilus/nautilus-metadata.h
deleted file mode 100644
index 87602f24b..000000000
--- a/libnautilus/nautilus-metadata.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-metadata.h: #defines and other metadata-related info
-
- Copyright (C) 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#ifndef NAUTILUS_METADATA_H
-#define NAUTILUS_METADATA_H
-
-/* Keys for getting/setting Nautilus metadata. All metadata used in Nautilus
- * should define its key here, so we can keep track of the whole set easily.
- */
-
-/* Per-directory */
-
-#define NAUTILUS_METADATA_KEY_INITIAL_VIEW "INITIAL_VIEW"
-#define NAUTILUS_METADATA_KEY_CONTENT_VIEWS "CONTENT_VIEWS"
-
-#define NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR "BACKGROUND_COLOR"
-#define NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE "BACKGROUND_TILE_IMAGE"
-#define NAUTILUS_METADATA_KEY_ICON_VIEW_ZOOM_LEVEL "ICONS_ZOOM_LEVEL"
-
-#define NAUTILUS_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL "LIST_ZOOM_LEVEL"
-#define NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN "LIST_SORT_COLUMN"
-#define NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED "LIST_SORT_REVERSED"
-
-#define NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR "SIDEBAR_BACKGROUND_COLOR"
-#define NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE "SIDEBAR_BACKGROUND_TILE_IMAGE"
-
-/* Per-file */
-
-#define NAUTILUS_METADATA_KEY_NOTES "NOTES"
-#define NAUTILUS_METADATA_KEY_ANNOTATION "ANNOTATION"
-#define NAUTILUS_METADATA_KEY_ICON_POSITION "ICON_POSITION"
-#define NAUTILUS_METADATA_KEY_ICON_SCALE "ICON_SCALE"
-#define NAUTILUS_METADATA_KEY_CUSTOM_ICON "CUSTOM_ICON"
-
-#endif /* NAUTILUS_METADATA_H */
diff --git a/libnautilus/nautilus-mime-type.c b/libnautilus/nautilus-mime-type.c
deleted file mode 100644
index f7645c254..000000000
--- a/libnautilus/nautilus-mime-type.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
-
- 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.
-
- Here are the routines that return applications that are relevant to a given MIME-type.
- For now, the info is kept in a statically defined string table, but it eventually has to
- be editable and augmentable. We'll probably use OAF or GConf for this, but at least this
- lets us get going with the UI for now.
-
- Author: Andy Hertzfeld <andy@eazel.com>
-*/
-
-#include <string.h>
-#include <stdio.h>
-#include "nautilus-glib-extensions.h"
-
-#include "nautilus-mime-type.h"
-
-typedef struct {
- gchar *base_type;
- gchar *sub_type;
- gchar *display_name;
- gchar *command_string;
-} MimeTypeItem;
-
-/* here is the string table associating mime types with commands */
-/* FIXME: this should be kept in a file somewhere, possibly using GConf or OAF */
-
-static MimeTypeItem mime_type_table [] = {
- { "text", "plain", "Edit with gEdit", "gedit" },
- { "text", "html", "View with Netscape", "netscape" },
- { "image", "*", "Edit with GIMP", "gimp" },
- { "text", "*", "Edit with gnotepad", "gnp" }
-};
-
-/* release the storage contained in the passed-in command list */
-
-void nautilus_mime_type_dispose_list (GList *command_list)
-{
- GList *next_command;
- for (next_command = command_list; next_command != NULL; next_command = next_command->next)
- {
- NautilusCommandInfo *item = (NautilusCommandInfo *) next_command->data;
-
- g_free(item->display_name);
- g_free(item->command_string);
- g_free(item);
- }
-
- g_list_free (command_list);
-}
-
-/* return a list of commands corresponding to the passed in mime-type, by iterating
- through the table */
-
-GList* nautilus_mime_type_get_commands (const gchar *mime_type)
-{
- gint index;
- gchar *slash_pos, *temp_str;
- gchar *target_base_type, *target_sub_type;
- NautilusCommandInfo *new_command_item;
- GList *command_list = NULL;
-
- /* parse the mime type into a base type and a sub type */
-
- temp_str = strdup(mime_type);
-
- target_base_type = temp_str;
- slash_pos = strchr(temp_str, '/');
- if (slash_pos)
- {
- *slash_pos = '\0';
- target_sub_type = slash_pos + 1;
- }
- else
- target_sub_type = NULL;
-
- /* iterate through the table, creating a new command info node for each mime type that matches */
-
- for (index = 0; index < NAUTILUS_N_ELEMENTS(mime_type_table); index++)
- {
- /* see if the types match */
-
- if (strcmp(mime_type_table[index].base_type, target_base_type) == 0)
- {
- gchar *cur_sub_type = mime_type_table[index].sub_type;
- if ((target_sub_type == NULL) || (strcmp(cur_sub_type, target_sub_type) == 0) || (strcmp(cur_sub_type, "*") == 0))
- {
- /* the types match, so allocate a command entry */
- new_command_item = g_new0 (NautilusCommandInfo, 1);
-
- /* add it to the list */
- if (command_list != NULL)
- command_list = g_list_append(command_list, new_command_item);
- else
- {
- command_list = g_list_alloc();
- command_list->data = new_command_item;
- }
-
- new_command_item->display_name = strdup(mime_type_table[index].display_name);
- new_command_item->command_string = strdup(mime_type_table[index].command_string);
- }
- }
- }
-
- g_free(temp_str);
- return command_list;
-}
-
-
diff --git a/libnautilus/nautilus-mime-type.h b/libnautilus/nautilus-mime-type.h
deleted file mode 100644
index 1eec097fa..000000000
--- a/libnautilus/nautilus-mime-type.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
-
- 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: Andy Hertzfeld <andy@eazel.com>
-*/
-
-#ifndef NAUTILUS_MIME_TYPE_H
-#define NAUTILUS_MIME_TYPE_H
-
-typedef struct _NautilusCommandInfo NautilusCommandInfo;
-
-struct _NautilusCommandInfo {
- gchar *display_name;
- gchar *command_string;
- };
-
-GList* nautilus_mime_type_get_commands (const gchar *mime_type);
-void nautilus_mime_type_dispose_list (GList *command_list);
-
-#endif /* NAUTILUS_MIME_TYPE_H */
diff --git a/libnautilus/nautilus-self-checks.c b/libnautilus/nautilus-self-checks.c
deleted file mode 100644
index 496319ba6..000000000
--- a/libnautilus/nautilus-self-checks.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-self-checks.c: The self-check framework.
-
- Copyright (C) 1999 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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>
-*/
-
-#include <config.h>
-
-#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
-
-#include "nautilus-self-checks.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static gboolean failed;
-
-static const char *current_expression;
-static const char *current_file_name;
-static int current_line_number;
-
-void nautilus_exit_if_self_checks_failed (void)
-{
- if (!failed) {
- return;
- }
-
- printf ("\n");
-
- exit (EXIT_FAILURE);
-}
-
-static void
-nautilus_report_check_failure (char *result, char *expected)
-{
- if (!failed) {
- printf ("\n");
- }
-
- printf ("FAIL: check failed in %s, line %d\n", current_file_name, current_line_number);
- printf (" evaluated: %s\n", current_expression);
- printf (" expected: %s\n", expected == NULL ? "NULL" : expected);
- printf (" got: %s\n", result == NULL ? "NULL" : result);
-
- failed = TRUE;
-
- g_free (result);
- g_free (expected);
-}
-
-static char *
-nautilus_strdup_boolean (gboolean boolean)
-{
- if (boolean == FALSE) {
- return g_strdup ("FALSE");
- }
- if (boolean == TRUE) {
- return g_strdup ("TRUE");
- }
- return g_strdup_printf ("gboolean(%d)", boolean);
-}
-
-void
-nautilus_before_check (const char *expression,
- const char *file_name,
- int line_number)
-{
- current_expression = expression;
- current_file_name = file_name;
- current_line_number = line_number;
-}
-
-static void
-nautilus_after_check ()
-{
- /* It would be good to check here if there was a memory leak. */
-}
-
-void
-nautilus_check_boolean_result (gboolean result, gboolean expected)
-{
- if (result != expected) {
- nautilus_report_check_failure (nautilus_strdup_boolean(result),
- nautilus_strdup_boolean(expected));
- }
- nautilus_after_check ();
-}
-
-void
-nautilus_check_integer_result (long result, long expected)
-{
- if (result != expected) {
- nautilus_report_check_failure (g_strdup_printf("%ld", result),
- g_strdup_printf("%ld", expected));
- }
- nautilus_after_check ();
-}
-
-void
-nautilus_check_string_result (char *result, const char *expected)
-{
- gboolean match;
-
- /* Stricter than nautilus_strcmp.
- * NULL does not match "" in this test.
- */
- if (expected == NULL) {
- match = result == NULL;
- } else {
- match = result != NULL && strcmp (result, expected) == 0;
- }
-
- if (!match) {
- nautilus_report_check_failure (result, g_strdup (expected));
- }
- nautilus_after_check ();
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-self-checks.h b/libnautilus/nautilus-self-checks.h
deleted file mode 100644
index 30a40ac6a..000000000
--- a/libnautilus/nautilus-self-checks.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-self-checks.h: The self-check framework.
-
- Copyright (C) 1999 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; 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_SELF_CHECKS_H
-#define NAUTILUS_SELF_CHECKS_H
-
-#include <glib.h>
-
-#define NAUTILUS_CHECK_RESULT(type, expression, expected_value) \
-G_STMT_START { \
- nautilus_before_check (#expression, __FILE__, __LINE__); \
- nautilus_check_##type##_result (expression, expected_value); \
-} G_STMT_END
-
-#define NAUTILUS_CHECK_BOOLEAN_RESULT(expression, expected_value) \
- NAUTILUS_CHECK_RESULT(boolean, expression, expected_value)
-#define NAUTILUS_CHECK_INTEGER_RESULT(expression, expected_value) \
- NAUTILUS_CHECK_RESULT(integer, expression, expected_value)
-#define NAUTILUS_CHECK_STRING_RESULT(expression, expected_value) \
- NAUTILUS_CHECK_RESULT(string, expression, expected_value)
-
-void nautilus_exit_if_self_checks_failed (void);
-
-void nautilus_before_check (const char *expression,
- const char *file_name,
- int line_number);
-
-void nautilus_check_boolean_result (gboolean result,
- gboolean expected_value);
-void nautilus_check_integer_result (long result,
- long expected_value);
-void nautilus_check_string_result (char *result,
- const char *expected_value);
-
-#define NAUTILUS_SELF_CHECK_FUNCTION_PROTOTYPE(function) \
- void function (void);
-
-#define NAUTILUS_CALL_SELF_CHECK_FUNCTION(function) \
- function ();
-
-#endif /* NAUTILUS_SELF_CHECKS_H */
diff --git a/libnautilus/nautilus-string-list.c b/libnautilus/nautilus-string-list.c
deleted file mode 100644
index 14022986f..000000000
--- a/libnautilus/nautilus-string-list.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-string-list.h: A collection of strings.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-string-list.h"
-
-#include <string.h>
-#include "nautilus-lib-self-check-functions.h"
-
-static gboolean supress_out_of_bounds_warning;
-
-struct NautilusStringList
-{
- GList *strings;
-};
-
-/**
- * nautilus_string_list_new:
- *
- * Construct an empty string list.
- *
- * Returns the string list.
- */
-NautilusStringList *
-nautilus_string_list_new (void)
-{
- NautilusStringList * string_list;
-
- string_list = g_new (NautilusStringList, 1);
-
- string_list->strings = NULL;
-
- return string_list;
-}
-
-/**
- * nautilus_string_list_new:
- *
- * Construct an empty string list.
- *
- * Returns the string list.
- */
-NautilusStringList *
-nautilus_string_list_new_from_string (const char *string)
-{
- NautilusStringList * string_list;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- string_list = nautilus_string_list_new ();
-
- nautilus_string_list_insert (string_list, string);
-
- return string_list;
-}
-
-/**
- * nautilus_string_list_new:
- *
- * Construct an empty string list.
- *
- * Returns the string list.
- */
-NautilusStringList *
-nautilus_string_list_new_from_string_list (const NautilusStringList *other)
-{
- NautilusStringList *string_list;
- GList *other_iterator;
- const char *other_string;
-
- g_return_val_if_fail (other != NULL, NULL);
-
- string_list = nautilus_string_list_new ();
-
- for (other_iterator = other->strings;
- other_iterator != NULL;
- other_iterator = other_iterator->next) {
-
- other_string = (const char *) other_iterator->data;
-
- g_assert (other_string != NULL);
-
- nautilus_string_list_insert (string_list, other_string);
- }
-
- return string_list;
-}
-
-/* Construct a string list from tokens delimited by the given string and delimiter */
-NautilusStringList *
-nautilus_string_list_new_from_tokens (const char *string,
- const char *delimiter)
-{
- NautilusStringList *string_list;
- char **string_array;
- guint i;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
-
- string_list = nautilus_string_list_new ();
-
- string_array = g_strsplit (string, delimiter, -1);
-
- if (string_array) {
- for (i = 0; string_array[i]; i++) {
- nautilus_string_list_insert (string_list, string_array[i]);
- }
-
- g_free (string_array);
- }
-
- return string_list;
-}
-
-void
-nautilus_string_list_free (NautilusStringList *string_list)
-{
- g_return_if_fail (string_list != NULL);
-
- nautilus_string_list_clear (string_list);
- g_free (string_list);
-}
-
-void
-nautilus_string_list_insert (NautilusStringList *string_list,
- const char *string)
-{
- g_return_if_fail (string_list != NULL);
- g_return_if_fail (string != NULL);
-
- string_list->strings = g_list_append (string_list->strings,
- (gpointer) g_strdup (string));
-}
-
-char *
-nautilus_string_list_nth (const NautilusStringList *string_list, guint n)
-{
- g_return_val_if_fail (string_list != NULL, NULL);
-
- if (n < g_list_length (string_list->strings)) {
- const char * s = (const char *) g_list_nth_data (string_list->strings, n);
-
- g_assert (s != NULL);
-
- return g_strdup (s);
- } else if (!supress_out_of_bounds_warning) {
- g_warning ("nautilus_string_list_nth (n = %d) is out of bounds.", n);
- }
-
- return NULL;
-}
-
-gboolean
-nautilus_string_list_contains (const NautilusStringList *string_list,
- const char *string)
-{
- GList *find;
-
- g_return_val_if_fail (string_list != NULL, FALSE);
- g_return_val_if_fail (string != NULL, FALSE);
-
- find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp);
-
- return find == NULL ? FALSE : TRUE;
-}
-
-guint
-nautilus_string_list_get_length (const NautilusStringList *string_list)
-{
- g_return_val_if_fail (string_list != NULL, 0);
-
- return g_list_length (string_list->strings);
-}
-
-void
-nautilus_string_list_clear (NautilusStringList *string_list)
-{
- g_return_if_fail (string_list != NULL);
-
- g_list_foreach (string_list->strings, (GFunc) g_free, NULL);
- g_list_free (string_list->strings);
-
- string_list->strings = NULL;
-}
-
-gboolean
-nautilus_string_list_equals (const NautilusStringList *a,
- const NautilusStringList *b)
-{
- GList *a_iterator;
- GList *b_iterator;
- const char * a_string;
- const char * b_string;
-
- g_return_val_if_fail (a != NULL, FALSE);
- g_return_val_if_fail (b != NULL, FALSE);
-
- for (a_iterator = a->strings, b_iterator = b->strings;
- a_iterator != NULL && b_iterator != NULL;
- a_iterator = a_iterator->next, b_iterator = b_iterator->next) {
-
- a_string = (const char *) a_iterator->data;
- b_string = (const char *) b_iterator->data;
-
- if (strcmp (a_string, b_string) != 0) {
- return FALSE;
- }
- }
-
- return a_iterator == NULL && b_iterator == NULL;
-}
-
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-void
-nautilus_self_check_string_list (void)
-{
- NautilusStringList *fruits;
- NautilusStringList *cities;
- NautilusStringList *cities_copy;
- NautilusStringList *empty;
- NautilusStringList *tokens;
- NautilusStringList *single;
-
- const char token_string[] = "london:paris:rome";
- const char token_string_thick[] = "london####paris####rome";
-
- empty = nautilus_string_list_new ();
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (empty), 0);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (empty, "something"), FALSE);
-
- /********/
-
- cities = nautilus_string_list_new ();
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (cities, empty), TRUE);
-
- nautilus_string_list_insert (cities, "london");
- nautilus_string_list_insert (cities, "paris");
- nautilus_string_list_insert (cities, "rome");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (cities, empty), FALSE);
-
- /********/
-
- cities_copy = nautilus_string_list_new_from_string_list (cities);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (cities, cities_copy), TRUE);
-
- nautilus_string_list_free (cities_copy);
-
- /********/
-
- fruits = nautilus_string_list_new ();
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (fruits, empty), TRUE);
-
- nautilus_string_list_insert (fruits, "orange");
- nautilus_string_list_insert (fruits, "apple");
- nautilus_string_list_insert (fruits, "strawberry");
- nautilus_string_list_insert (fruits, "cherry");
- nautilus_string_list_insert (fruits, "bananna");
- nautilus_string_list_insert (fruits, "watermelon");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (fruits, empty), FALSE);
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_string_list_nth (fruits, 0), "orange");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_string_list_nth (fruits, 2), "strawberry");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_string_list_nth (fruits, 3), "cherry");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_string_list_nth (fruits, 5), "watermelon");
- supress_out_of_bounds_warning = TRUE;
- NAUTILUS_CHECK_STRING_RESULT (nautilus_string_list_nth (fruits, 6), NULL);
- supress_out_of_bounds_warning = FALSE;
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (fruits), 6);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (fruits, "orange"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (fruits, "apple"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (fruits, "watermelon"), TRUE);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (fruits, "pineapple"), FALSE);
-
- nautilus_string_list_clear (fruits);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (fruits, "orange"), FALSE);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (fruits), 0);
-
- nautilus_string_list_free (fruits);
- nautilus_string_list_free (empty);
-
- /********/
-
- tokens = nautilus_string_list_new_from_tokens (token_string, ":");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (cities, tokens), TRUE);
-
- nautilus_string_list_free (tokens);
-
- tokens = nautilus_string_list_new_from_tokens (token_string_thick, "####");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_equals (cities, tokens), TRUE);
-
- nautilus_string_list_free (cities);
- nautilus_string_list_free (tokens);
-
- /********/
-
- single = nautilus_string_list_new_from_string ("something");
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (single, "something"), TRUE);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (single), 1);
-
- nautilus_string_list_free (single);
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-string-list.h b/libnautilus/nautilus-string-list.h
deleted file mode 100644
index b14cab14a..000000000
--- a/libnautilus/nautilus-string-list.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-string-list.h: A collection of strings.
-
- Copyright (C) 1999, 2000 Eazel, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#ifndef NAUTILUS_STRING_LIST_H
-#define NAUTILUS_STRING_LIST_H
-
-#include <glib.h>
-
-/* Opaque type declaration. */
-typedef struct NautilusStringList NautilusStringList;
-
-/* Construct an empty string list. */
-NautilusStringList *nautilus_string_list_new (void);
-
-/* Construct a string list with a single element */
-NautilusStringList *nautilus_string_list_new_from_string (const char *string);
-
-/* Construct a string list that is a copy of another string list */
-NautilusStringList *nautilus_string_list_new_from_string_list (const NautilusStringList *other);
-
-/* Construct a string list from tokens delimited by the given string and delimeter */
-NautilusStringList *nautilus_string_list_new_from_tokens (const char *string,
- const char *delimiter);
-
-/* Free a string list */
-void nautilus_string_list_free (NautilusStringList *string_list);
-
-/* Insert a string into the collection. */
-void nautilus_string_list_insert (NautilusStringList *string_list,
- const gchar *string);
-/* Clear the collection. */
-void nautilus_string_list_clear (NautilusStringList *string_list);
-
-/* Access the nth string in the collection. Returns an strduped string. */
-gchar * nautilus_string_list_nth (const NautilusStringList *string_list,
- guint n);
-
-/* Does the string list contain the given string ? */
-gboolean nautilus_string_list_contains (const NautilusStringList *string_list,
- const char *string);
-
-/* How many strings are currently in the collection ? */
-guint nautilus_string_list_get_length (const NautilusStringList *string_list);
-
-/* Does the string list a equal string list b ? */
-gboolean nautilus_string_list_equals (const NautilusStringList *a,
- const NautilusStringList *b);
-
-#endif /* NAUTILUS_STRING_LIST_H */
diff --git a/libnautilus/nautilus-string.c b/libnautilus/nautilus-string.c
deleted file mode 100644
index 937248c2b..000000000
--- a/libnautilus/nautilus-string.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-string.c: String routines to augment <string.h>.
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-string.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "nautilus-lib-self-check-functions.h"
-
-size_t
-nautilus_strlen (const char *string)
-{
- return string == NULL ? 0 : strlen (string);
-}
-
-char *
-nautilus_strchr (const char *haystack, char needle)
-{
- return haystack == NULL ? NULL : strchr (haystack, needle);
-}
-
-int
-nautilus_strcmp (const char *string_a, const char *string_b)
-{
- return strcmp (string_a == NULL ? "" : string_a,
- string_b == NULL ? "" : string_b);
-}
-
-int
-nautilus_eat_strcmp (char *string_a, const char *string_b)
-{
- int result;
-
- result = nautilus_strcmp (string_a, string_b);
- g_free (string_a);
- return result;
-}
-
-gboolean
-nautilus_str_has_prefix (const char *haystack, const char *needle)
-{
- const char *h, *n;
-
- /* Eat one character at a time. */
- h = haystack == NULL ? "" : haystack;
- n = needle == NULL ? "" : needle;
- do {
- if (*n == '\0') {
- return TRUE;
- }
- if (*h == '\0') {
- return FALSE;
- }
- } while (*h++ == *n++);
- return FALSE;
-}
-
-gboolean
-nautilus_str_has_suffix (const char *haystack, const char *needle)
-{
- const char *h, *n;
-
- if (needle == NULL) {
- return TRUE;
- }
- if (haystack == NULL) {
- return needle[0] == '\0';
- }
-
- /* Eat one character at a time. */
- h = haystack + strlen(haystack);
- n = needle + strlen(needle);
- do {
- if (n == needle) {
- return TRUE;
- }
- if (h == haystack) {
- return FALSE;
- }
- } while (*--h == *--n);
- return FALSE;
-}
-
-
-/**
- * nautilus_str_get_prefix:
- * Get a new string containing the first part of an existing string.
- *
- * @source: The string whose prefix should be extracted.
- * @delimiter: The string that marks the end of the prefix.
- *
- * Return value: A newly-allocated string that that matches the first part
- * of @source, up to but not including the first occurrence of
- * @delimiter. If @source is NULL, returns NULL. If
- * @delimiter is NULL, returns a copy of @source.
- * If @delimiter does not occur in @source, returns
- * a copy of @source.
- **/
-char *
-nautilus_str_get_prefix (const char *source,
- const char *delimiter)
-{
- char *prefix_start;
-
- if (source == NULL) {
- return NULL;
- }
-
- if (delimiter == NULL) {
- return g_strdup (source);
- }
-
- prefix_start = strstr (source, delimiter);
-
- if (prefix_start == NULL) {
- return NULL;
- }
-
- return g_strndup (source, prefix_start - source);
-}
-
-gboolean
-nautilus_str_to_int (const char *string, int *integer)
-{
- long result;
- char *parse_end;
-
- /* Check for the case of an empty string. */
- if (string == NULL || *string == '\0') {
- return FALSE;
- }
-
- /* Call the standard library routine to do the conversion. */
- errno = 0;
- result = strtol (string, &parse_end, 0);
-
- /* Check that the result is in range. */
- if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE) {
- return FALSE;
- }
- if (result < G_MININT || result > G_MAXINT) {
- return FALSE;
- }
-
- /* Check that all the trailing characters are spaces. */
- while (*parse_end != '\0') {
- if (!isspace (*parse_end++)) {
- return FALSE;
- }
- }
-
- /* Return the result. */
- *integer = result;
- return TRUE;
-}
-
-/**
- * nautilus_str_strip_chr:
- * Remove all occurrences of a character from a string.
- *
- * @source: The string to be stripped.
- * @remove_this: The char to remove from @source
- *
- * Return value: A copy of @source, after removing all occurrences
- * of @remove_this.
- */
-char *
-nautilus_str_strip_chr (const char *source, char remove_this)
-{
- char *result, *out;
- const char *in;
-
- if (source == NULL) {
- return NULL;
- }
-
- result = g_malloc (strlen (source) + 1);
- in = source;
- out = result;
- do {
- if (*in != remove_this) {
- *out++ = *in;
- }
- } while (*in++ != '\0');
-
- return result;
-}
-
-/**
- * nautilus_str_strip_trailing_chr:
- * Remove trailing occurrences of a character from a string.
- *
- * @source: The string to be stripped.
- * @remove_this: The char to remove from @source
- *
- * Return value: @source, after removing trailing occurrences
- * of @remove_this.
- */
-char *
-nautilus_str_strip_trailing_chr (const char *source, char remove_this)
-{
- const char *end;
-
- if (source == NULL) {
- return NULL;
- }
-
- for (end = source + strlen (source); end != source; end--) {
- if (end[-1] != remove_this) {
- break;
- }
- }
-
- return g_strndup (source, end - source);
-}
-
-gboolean
-nautilus_eat_str_to_int (char *source, int *integer)
-{
- gboolean result;
-
- result = nautilus_str_to_int (source, integer);
- g_free (source);
- return result;
-}
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static int
-call_str_to_int (const char *string)
-{
- int integer;
-
- integer = 9999;
- nautilus_str_to_int (string, &integer);
- return integer;
-}
-
-static int
-call_eat_str_to_int (char *string)
-{
- int integer;
-
- integer = 9999;
- nautilus_eat_str_to_int (string, &integer);
- return integer;
-}
-
-void
-nautilus_self_check_string (void)
-{
- int integer;
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (NULL), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (""), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen ("abc"), 3);
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strcmp (NULL, NULL), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strcmp (NULL, ""), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strcmp ("", NULL), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strcmp ("a", "a"), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strcmp ("aaab", "aaab"), 0);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp (NULL, "a") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("a", NULL) > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("", "a") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("a", "") > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("a", "b") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("a", "ab") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("ab", "a") > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("aaa", "aaab") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_strcmp ("aaab", "aaa") > 0, TRUE);
-
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_eat_strcmp (NULL, NULL), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_eat_strcmp (NULL, ""), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_eat_strcmp (g_strdup (""), NULL), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_eat_strcmp (g_strdup ("a"), "a"), 0);
- NAUTILUS_CHECK_INTEGER_RESULT (nautilus_eat_strcmp (g_strdup ("aaab"), "aaab"), 0);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (NULL, "a") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("a"), NULL) > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup (""), "a") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("a"), "") > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("a"), "b") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("a"), "ab") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("ab"), "a") > 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("aaa"), "aaab") < 0, TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_strcmp (g_strdup ("aaab"), "aaa") > 0, TRUE);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix (NULL, NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix (NULL, ""), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("", NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("a", "a"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("aaab", "aaab"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix (NULL, "a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("a", NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("", "a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("a", ""), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("a", "b"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("a", "ab"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("ab", "a"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("aaa", "aaab"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_prefix ("aaab", "aaa"), TRUE);
-
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix (NULL, NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix (NULL, ""), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("", NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("a", "a"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("aaab", "aaab"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix (NULL, "a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("a", NULL), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("", "a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("a", ""), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("a", "b"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("a", "ab"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("ab", "a"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("ab", "b"), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("aaa", "baaa"), FALSE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_has_suffix ("baaa", "aaa"), TRUE);
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix (NULL, NULL), NULL);
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix (NULL, "foo"), NULL);
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix ("foo", NULL), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix ("foo", "foo"), "");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix ("foo:", ":"), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix ("foo:bar", ":"), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_get_prefix ("footle:bar", "tle:"), "foo");
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr (NULL, '_'), NULL);
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr ("foo", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr ("_foo", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr ("foo_", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr ("_foo__", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_chr ("_f_o__o_", '_'), "foo");
-
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr (NULL, '_'), NULL);
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr ("foo", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr ("_foo", '_'), "_foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr ("foo_", '_'), "foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr ("_foo__", '_'), "_foo");
- NAUTILUS_CHECK_STRING_RESULT (nautilus_str_strip_trailing_chr ("_f_o__o_", '_'), "_f_o__o");
-
- #define TEST_INTEGER_CONVERSION_FUNCTIONS(string, boolean_result, integer_result) \
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_str_to_int (string, &integer), boolean_result); \
- NAUTILUS_CHECK_INTEGER_RESULT (call_str_to_int (string), integer_result); \
- NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_eat_str_to_int (g_strdup (string), &integer), boolean_result); \
- NAUTILUS_CHECK_INTEGER_RESULT (call_eat_str_to_int (g_strdup (string)), integer_result);
-
- TEST_INTEGER_CONVERSION_FUNCTIONS (NULL, FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("a", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS (".", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("0", TRUE, 0)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("1", TRUE, 1)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("+1", TRUE, 1)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("-1", TRUE, -1)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("2147483647", TRUE, 2147483647)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("2147483648", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("+2147483647", TRUE, 2147483647)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("+2147483648", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("-2147483648", TRUE, INT_MIN)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("-2147483649", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("1a", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("0.0", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("1e1", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("21474836470", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("+21474836470", FALSE, 9999)
- TEST_INTEGER_CONVERSION_FUNCTIONS ("-21474836480", FALSE, 9999)
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus/nautilus-string.h b/libnautilus/nautilus-string.h
deleted file mode 100644
index 3c2884691..000000000
--- a/libnautilus/nautilus-string.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-string.h: String routines to augment <string.h>.
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_STRING_H
-#define NAUTILUS_STRING_H
-
-#include <glib.h>
-#include <string.h>
-
-/* We use the "str" abbrevation to mean char * string, since
- * "string" usually means g_string instead.
- */
-
-/* NULL is allowed for all the str parameters to these functions. */
-
-/* Versions of basic string functions that allow NULL. */
-size_t nautilus_strlen (const char *string);
-char * nautilus_strchr (const char *haystack,
- char needle);
-int nautilus_strcmp (const char *string_a,
- const char *string_b);
-
-/* Versions of basic string functions that free their parameters. */
-int nautilus_eat_strcmp (char *string_a_gets_freed,
- const char *string_b);
-
-/* Other basic string operations. */
-gboolean nautilus_str_has_prefix (const char *target,
- const char *prefix);
-char * nautilus_str_get_prefix (const char *source,
- const char *delimiter);
-gboolean nautilus_str_has_suffix (const char *target,
- const char *suffix);
-char * nautilus_str_strip_chr (const char *string,
- char remove_this);
-char * nautilus_str_strip_trailing_chr (const char *string,
- char remove_this);
-
-/* Conversions to and from strings. */
-gboolean nautilus_str_to_int (const char *string,
- int *integer);
-gboolean nautilus_eat_str_to_int (char *string_gets_freed,
- int *integer);
-
-#endif /* NAUTILUS_STRING_H */
diff --git a/libnautilus/nautilus-view-frame-private.h b/libnautilus/nautilus-view-frame-private.h
index 4ddbce9cc..e03076fba 100644
--- a/libnautilus/nautilus-view-frame-private.h
+++ b/libnautilus/nautilus-view-frame-private.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef NTL_VIEW_FRAME_PRIVATE_H
-#define NTL_VIEW_FRAME_PRIVATE_H
+#ifndef NAUTILUS_VIEW_FRAME_PRIVATE_H
+#define NAUTILUS_VIEW_FRAME_PRIVATE_H
struct _NautilusViewFramePrivate {
BonoboObject *control;
diff --git a/libnautilus/nautilus-view-frame.c b/libnautilus/nautilus-view-frame.c
index 1e5b917ec..090230c5d 100644
--- a/libnautilus/nautilus-view-frame.c
+++ b/libnautilus/nautilus-view-frame.c
@@ -24,17 +24,17 @@
*
*/
-/* ntl-view-frame.c: Implementation for object that represents a
+/* nautilus-view-frame.c: Implementation for object that represents a
nautilus view implementation. */
#include <config.h>
-#include "ntl-view-frame.h"
+#include "nautilus-view-frame.h"
#include "nautilus-view-frame-private.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
enum {
diff --git a/libnautilus/nautilus-view-frame.h b/libnautilus/nautilus-view-frame.h
index 793af6897..eeaae6bd7 100644
--- a/libnautilus/nautilus-view-frame.h
+++ b/libnautilus/nautilus-view-frame.h
@@ -24,13 +24,13 @@
*
*/
-/* ntl-view-frame.h: Interface of the object representing the frame a
+/* nautilus-view-frame.h: Interface of the object representing the frame a
data view plugs into. */
-#ifndef NTL_VIEW_FRAME_H
-#define NTL_VIEW_FRAME_H
+#ifndef NAUTILUS_VIEW_FRAME_H
+#define NAUTILUS_VIEW_FRAME_H
-#include <libnautilus/nautilus.h>
+#include <libnautilus/nautilus-view-component.h>
#include <bonobo/bonobo-object.h>
#include <gtk/gtkwidget.h>
diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c
index 1e5b917ec..090230c5d 100644
--- a/libnautilus/nautilus-view.c
+++ b/libnautilus/nautilus-view.c
@@ -24,17 +24,17 @@
*
*/
-/* ntl-view-frame.c: Implementation for object that represents a
+/* nautilus-view-frame.c: Implementation for object that represents a
nautilus view implementation. */
#include <config.h>
-#include "ntl-view-frame.h"
+#include "nautilus-view-frame.h"
#include "nautilus-view-frame-private.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
enum {
diff --git a/libnautilus/nautilus-view.h b/libnautilus/nautilus-view.h
index 793af6897..eeaae6bd7 100644
--- a/libnautilus/nautilus-view.h
+++ b/libnautilus/nautilus-view.h
@@ -24,13 +24,13 @@
*
*/
-/* ntl-view-frame.h: Interface of the object representing the frame a
+/* nautilus-view-frame.h: Interface of the object representing the frame a
data view plugs into. */
-#ifndef NTL_VIEW_FRAME_H
-#define NTL_VIEW_FRAME_H
+#ifndef NAUTILUS_VIEW_FRAME_H
+#define NAUTILUS_VIEW_FRAME_H
-#include <libnautilus/nautilus.h>
+#include <libnautilus/nautilus-view-component.h>
#include <bonobo/bonobo-object.h>
#include <gtk/gtkwidget.h>
diff --git a/libnautilus/nautilus-xml-extensions.c b/libnautilus/nautilus-xml-extensions.c
deleted file mode 100644
index 3e1302895..000000000
--- a/libnautilus/nautilus-xml-extensions.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-xml-extensions.c - functions that extend gnome-xml
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-xml-extensions.h"
-
-#include <glib.h>
-#include "nautilus-string.h"
-#include <stdlib.h>
-#include <xmlmemory.h>
-
-xmlNodePtr
-nautilus_xml_get_children (xmlNodePtr parent)
-{
- if (parent == NULL) {
- return NULL;
- }
- return parent->childs;
-}
-
-xmlNodePtr
-nautilus_xml_get_root_children (xmlDocPtr document)
-{
- return nautilus_xml_get_children (xmlDocGetRootElement (document));
-}
-
-xmlNodePtr
-nautilus_xml_get_child_by_name_and_property (xmlNodePtr parent,
- const char *child_name,
- const char *property_name,
- const char *property_value)
-{
- xmlNodePtr child;
- xmlChar *property;
- gboolean match;
-
- if (parent == NULL) {
- return NULL;
- }
- for (child = nautilus_xml_get_children (parent); child != NULL; child = child->next) {
- if (strcmp (child->name, child_name) == 0) {
- property = xmlGetProp (child, property_name);
- match = nautilus_strcmp (property, property_value) == 0;
- xmlFree (property);
- if (match) {
- return child;
- }
- }
- }
- return NULL;
-}
-
-xmlNodePtr
-nautilus_xml_get_root_child_by_name_and_property (xmlDocPtr document,
- const char *child_name,
- const char *property_name,
- const char *property_value)
-{
- return nautilus_xml_get_child_by_name_and_property
- (xmlDocGetRootElement (document),
- child_name,
- property_name,
- property_value);
-}
diff --git a/libnautilus/nautilus-xml-extensions.h b/libnautilus/nautilus-xml-extensions.h
deleted file mode 100644
index 484fb8684..000000000
--- a/libnautilus/nautilus-xml-extensions.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-xml-extensions.h - functions that extend gnome-xml
-
- 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.
-
- Authors: Darin Adler <darin@eazel.com>
-*/
-
-#ifndef NAUTILUS_XML_EXTENSIONS_H
-#define NAUTILUS_XML_EXTENSIONS_H
-
-#include <tree.h>
-
-xmlNodePtr nautilus_xml_get_children (xmlNodePtr parent);
-xmlNodePtr nautilus_xml_get_root_children (xmlDocPtr document);
-xmlNodePtr nautilus_xml_get_child_by_name_and_property (xmlNodePtr parent,
- const char *child_name,
- const char *property_name,
- const char *property_value);
-xmlNodePtr nautilus_xml_get_root_child_by_name_and_property (xmlDocPtr document,
- const char *child_name,
- const char *property_name,
- const char *property_value);
-
-#endif /* NAUTILUS_XML_EXTENSIONS_H */
diff --git a/libnautilus/nautilus-zoomable.c b/libnautilus/nautilus-zoomable.c
index 33e8706ad..fff021402 100644
--- a/libnautilus/nautilus-zoomable.c
+++ b/libnautilus/nautilus-zoomable.c
@@ -28,7 +28,7 @@
#include <config.h>
#include "nautilus-zoomable.h"
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-control.h>
diff --git a/libnautilus/ntl-content-view-frame.c b/libnautilus/ntl-content-view-frame.c
deleted file mode 100644
index d878cba1e..000000000
--- a/libnautilus/ntl-content-view-frame.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* ntl-content-view-frame.c: Implementation for object that
- represents the frame a nautilus content view plugs into. */
-
-#include <config.h>
-#include "ntl-content-view-frame.h"
-#include "nautilus-view-frame-private.h"
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <bonobo/bonobo-control.h>
-
-
-typedef struct {
- POA_Nautilus_View servant;
- gpointer bonobo_object;
-
- NautilusContentViewFrame *view;
-} impl_POA_Nautilus_ContentView;
-
-extern POA_Nautilus_View__epv libnautilus_Nautilus_View_epv;
-
-static POA_Nautilus_ContentView__epv impl_Nautilus_ContentView_epv = {
- NULL /* _private */
-};
-
-static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
-
-static POA_Nautilus_ContentView__vepv impl_Nautilus_ContentView_vepv =
-{
- &base_epv,
- NULL,
- &libnautilus_Nautilus_View_epv,
- &impl_Nautilus_ContentView_epv
-};
-
-static void nautilus_content_view_frame_initialize (NautilusContentViewFrame *view);
-static void nautilus_content_view_frame_destroy (NautilusContentViewFrame *view);
-static void nautilus_content_view_frame_initialize_class (NautilusContentViewFrameClass *klass);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusContentViewFrame, nautilus_content_view_frame, NAUTILUS_TYPE_VIEW_FRAME)
-
-static void
-nautilus_content_view_frame_initialize (NautilusContentViewFrame *view)
-{
-}
-
-NautilusContentViewFrame *
-nautilus_content_view_frame_new (GtkWidget *widget)
-{
- BonoboObject *control;
-
- control = BONOBO_OBJECT (bonobo_control_new (widget));
-
- return nautilus_content_view_frame_new_from_bonobo_control (control);
-}
-
-NautilusContentViewFrame *
-nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control)
-{
- NautilusContentViewFrame *view;
-
- view = NAUTILUS_CONTENT_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_CONTENT_VIEW_FRAME,
- "bonobo_control", bonobo_control,
- NULL));
-
- return view;
-}
-
-static void
-nautilus_content_view_frame_destroy (NautilusContentViewFrame *view)
-{
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
-}
-
-static void
-nautilus_content_view_frame_initialize_class (NautilusContentViewFrameClass *klass)
-{
- NautilusViewFrameClass *view_class;
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
- object_class->destroy = (void (*)(GtkObject *))nautilus_content_view_frame_destroy;
-
- view_class = (NautilusViewFrameClass *) klass;
- view_class->servant_init_func = POA_Nautilus_ContentView__init;
- view_class->servant_destroy_func = POA_Nautilus_ContentView__fini;
- view_class->vepv = &impl_Nautilus_ContentView_vepv;
-}
-
-void
-nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
- const char *new_title)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (NAUTILUS_IS_CONTENT_VIEW_FRAME (view));
- g_return_if_fail (new_title != NULL);
-
- CORBA_exception_init(&ev);
-
- if (nautilus_view_frame_ensure_view_frame (NAUTILUS_VIEW_FRAME (view))) {
- Nautilus_ContentViewFrame_request_title_change (NAUTILUS_VIEW_FRAME (view)->private->view_frame, new_title, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(NAUTILUS_VIEW_FRAME (view)->private->view_frame, &ev);
- NAUTILUS_VIEW_FRAME (view)->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free(&ev);
-}
diff --git a/libnautilus/ntl-content-view-frame.h b/libnautilus/ntl-content-view-frame.h
deleted file mode 100644
index a945a1a60..000000000
--- a/libnautilus/ntl-content-view-frame.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* ntl-content-view-frame.h: Interface for object that represents a
- the frame a nautilus content view plugs into. */
-
-#ifndef NTL_CONTENT_VIEW_FRAME_H
-#define NTL_CONTENT_VIEW_FRAME_H
-
-#include <libnautilus/ntl-view-frame.h>
-
-#define NAUTILUS_TYPE_CONTENT_VIEW_FRAME (nautilus_content_view_frame_get_type ())
-#define NAUTILUS_CONTENT_VIEW_FRAME(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CONTENT_VIEW_FRAME, NautilusContentViewFrame))
-#define NAUTILUS_CONTENT_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CONTENT_VIEW_FRAME, NautilusContentViewFrameClass))
-#define NAUTILUS_IS_CONTENT_VIEW_FRAME(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CONTENT_VIEW_FRAME))
-#define NAUTILUS_IS_CONTENT_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_CONTENT_VIEW_FRAME))
-
-typedef struct _NautilusContentViewFrame NautilusContentViewFrame;
-typedef struct _NautilusContentViewFrameClass NautilusContentViewFrameClass;
-
-struct _NautilusContentViewFrameClass {
- NautilusViewFrameClass parent_spot;
-};
-
-struct _NautilusContentViewFrame {
- NautilusViewFrame parent;
-};
-
-GtkType nautilus_content_view_frame_get_type (void);
-NautilusContentViewFrame *nautilus_content_view_frame_new (GtkWidget *widget);
-NautilusContentViewFrame *nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control);
-
-void nautilus_content_view_frame_request_title_change (NautilusContentViewFrame *view,
- const char *new_title);
-
-#endif
diff --git a/libnautilus/ntl-meta-view-frame.c b/libnautilus/ntl-meta-view-frame.c
deleted file mode 100644
index 56037dc54..000000000
--- a/libnautilus/ntl-meta-view-frame.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* ntl-meta-view-frame.c: Implementation for object that represents a
- nautilus meta view implementation. */
-
-#include <config.h>
-#include "ntl-meta-view-frame.h"
-
-#include <libgnome/gnome-i18n.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-
-struct NautilusMetaViewFrameDetails {
- char *label;
-};
-
-/* Property indices. */
-enum {
- LABEL
-};
-
-typedef struct {
- POA_Nautilus_View servant;
- gpointer bonobo_object;
-
- NautilusMetaViewFrame *view;
-} impl_POA_Nautilus_MetaView;
-
-extern POA_Nautilus_View__epv libnautilus_Nautilus_View_epv;
-static POA_Nautilus_MetaView__epv impl_Nautilus_MetaView_epv;
-static PortableServer_ServantBase__epv base_epv;
-static POA_Nautilus_MetaView__vepv impl_Nautilus_MetaView_vepv =
-{
- &base_epv,
- NULL,
- &libnautilus_Nautilus_View_epv,
- &impl_Nautilus_MetaView_epv
-};
-
-static void nautilus_meta_view_frame_initialize (NautilusMetaViewFrame *view);
-static void nautilus_meta_view_frame_destroy (NautilusMetaViewFrame *view);
-static void nautilus_meta_view_frame_initialize_class (NautilusMetaViewFrameClass *klass);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusMetaViewFrame, nautilus_meta_view_frame, NAUTILUS_TYPE_VIEW_FRAME)
-
-static void
-nautilus_meta_view_frame_initialize (NautilusMetaViewFrame *view)
-{
- view->details = g_new0 (NautilusMetaViewFrameDetails, 1);
-}
-
-NautilusMetaViewFrame *
-nautilus_meta_view_frame_new (GtkWidget *widget)
-{
- BonoboControl *control;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- control = bonobo_control_new (widget);
- return nautilus_meta_view_frame_new_from_bonobo_control (control);
-}
-
-static void
-set_property (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- NautilusMetaViewFrame *view;
-
- view = NAUTILUS_META_VIEW_FRAME (user_data);
-
- switch (arg_id) {
- case LABEL:
- nautilus_meta_view_frame_set_label (view,
- BONOBO_ARG_GET_STRING (arg));
- break;
-
- default:
- g_warning ("unknown property");
- }
-}
-
-static void
-get_property (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- NautilusMetaViewFrame *view;
-
- view = NAUTILUS_META_VIEW_FRAME (user_data);
-
- switch (arg_id) {
- case LABEL:
- BONOBO_ARG_SET_STRING (arg, view->details->label);
- break;
-
- default:
- g_warning ("unknown property");
- }
-}
-
-NautilusMetaViewFrame *
-nautilus_meta_view_frame_new_from_bonobo_control (BonoboControl *bonobo_control)
-{
- NautilusMetaViewFrame *view;
- BonoboPropertyBag *bag;
-
- g_return_val_if_fail (BONOBO_IS_CONTROL (bonobo_control), NULL);
- g_return_val_if_fail (bonobo_control_get_property_bag (BONOBO_CONTROL (bonobo_control)) == NULL, NULL);
-
- view = NAUTILUS_META_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_META_VIEW_FRAME,
- "bonobo_control", bonobo_control,
- NULL));
-
- bag = bonobo_property_bag_new (get_property, set_property, view);
- bonobo_property_bag_add (bag, "label", LABEL, BONOBO_ARG_STRING, NULL,
- _("Label"), 0);
- bonobo_control_set_property_bag (bonobo_control, bag);
-
- return view;
-}
-
-static void
-nautilus_meta_view_frame_destroy (NautilusMetaViewFrame *view)
-{
- g_free (view->details->label);
- g_free (view->details);
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
-}
-
-static void
-nautilus_meta_view_frame_initialize_class (NautilusMetaViewFrameClass *klass)
-{
- NautilusViewFrameClass *view_class;
-
- view_class = NAUTILUS_VIEW_FRAME_CLASS (klass);
-
- GTK_OBJECT_CLASS (klass)->destroy = (void (*)(GtkObject *)) nautilus_meta_view_frame_destroy;
-
- view_class->servant_init_func = POA_Nautilus_MetaView__init;
- view_class->servant_destroy_func = POA_Nautilus_MetaView__fini;
- view_class->vepv = &impl_Nautilus_MetaView_vepv;
-}
-
-void
-nautilus_meta_view_frame_set_label (NautilusMetaViewFrame *view,
- const char *label)
-{
- g_return_if_fail (NAUTILUS_IS_META_VIEW_FRAME (view));
-
- g_free (view->details->label);
- view->details->label = g_strdup (label);
-}
diff --git a/libnautilus/ntl-meta-view-frame.h b/libnautilus/ntl-meta-view-frame.h
deleted file mode 100644
index 1a4320354..000000000
--- a/libnautilus/ntl-meta-view-frame.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-/* ntl-meta-view-frame.h: Interface for object that represents the
- frame a nautilus meta view plugs into. */
-
-#ifndef NTL_META_VIEW_FRAME_H
-#define NTL_META_VIEW_FRAME_H
-
-#include <libnautilus/ntl-view-frame.h>
-#include <bonobo/bonobo-control.h>
-
-#define NAUTILUS_TYPE_META_VIEW_FRAME (nautilus_meta_view_frame_get_type ())
-#define NAUTILUS_META_VIEW_FRAME(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_META_VIEW_FRAME, NautilusMetaViewFrame))
-#define NAUTILUS_META_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_META_VIEW_FRAME, NautilusMetaViewFrameClass))
-#define NAUTILUS_IS_META_VIEW_FRAME(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_META_VIEW_FRAME))
-#define NAUTILUS_IS_META_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_META_VIEW_FRAME))
-
-typedef struct NautilusMetaViewFrame NautilusMetaViewFrame;
-typedef struct NautilusMetaViewFrameClass NautilusMetaViewFrameClass;
-typedef struct NautilusMetaViewFrameDetails NautilusMetaViewFrameDetails;
-
-struct NautilusMetaViewFrame {
- NautilusViewFrame base;
- NautilusMetaViewFrameDetails *details;
-};
-
-struct NautilusMetaViewFrameClass {
- NautilusViewFrameClass base;
-};
-
-GtkType nautilus_meta_view_frame_get_type (void);
-NautilusMetaViewFrame *nautilus_meta_view_frame_new (GtkWidget *widget);
-NautilusMetaViewFrame *nautilus_meta_view_frame_new_from_bonobo_control (BonoboControl *control);
-void nautilus_meta_view_frame_set_label (NautilusMetaViewFrame *view,
- const char *label);
-
-#endif
diff --git a/libnautilus/ntl-view-frame.c b/libnautilus/ntl-view-frame.c
deleted file mode 100644
index 1e5b917ec..000000000
--- a/libnautilus/ntl-view-frame.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* ntl-view-frame.c: Implementation for object that represents a
- nautilus view implementation. */
-
-#include <config.h>
-#include "ntl-view-frame.h"
-#include "nautilus-view-frame-private.h"
-
-#include <gtk/gtksignal.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-control.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-
-
-enum {
- NOTIFY_LOCATION_CHANGE,
- NOTIFY_SELECTION_CHANGE,
- LOAD_STATE,
- SAVE_STATE,
- SHOW_PROPERTIES,
- STOP_LOCATION_CHANGE,
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_CONTROL
-};
-
-static guint nautilus_view_frame_signals[LAST_SIGNAL];
-
-typedef struct {
- POA_Nautilus_View servant;
- gpointer bonobo_object;
-
- NautilusViewFrame *view;
-} impl_POA_Nautilus_View;
-
-void nautilus_view_frame_real_set_bonobo_control (NautilusViewFrame *view,
- BonoboObject *bonobo_control);
-
-
-static void
-impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
- CORBA_char * config_path,
- CORBA_Environment * ev);
-
-static void
-impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
- CORBA_char * config_path,
- CORBA_Environment * ev);
-
-static void
-impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
- Nautilus_NavigationInfo * navinfo,
- CORBA_Environment * ev);
-
-static void
-impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
-
-static void
-impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
- Nautilus_SelectionInfo * selinfo,
- CORBA_Environment * ev);
-
-static void
-impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev);
-
-POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
-{
- NULL, /* _private */
- (gpointer) & impl_Nautilus_View_save_state,
- (gpointer) & impl_Nautilus_View_load_state,
- (gpointer) & impl_Nautilus_View_notify_location_change,
- (gpointer) & impl_Nautilus_View_stop_location_change,
- (gpointer) & impl_Nautilus_View_notify_selection_change,
- (gpointer) & impl_Nautilus_View_show_properties
-};
-
-static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
-
-static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
-{
- &base_epv,
- NULL,
- &libnautilus_Nautilus_View_epv
-};
-
-static void
-impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
- CORBA_char * config_path,
- CORBA_Environment * ev)
-{
- gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[SAVE_STATE], config_path);
-}
-
-static void
-impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
- CORBA_char * config_path,
- CORBA_Environment * ev)
-{
- gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[LOAD_STATE], config_path);
-}
-
-static void
-impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
- Nautilus_NavigationInfo * navinfo,
- CORBA_Environment * ev)
-{
- gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[NOTIFY_LOCATION_CHANGE], navinfo);
-}
-
-static void
-impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev)
-{
- gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[SHOW_PROPERTIES]);
-}
-
-static void
-impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
- Nautilus_SelectionInfo * selinfo,
- CORBA_Environment * ev)
-{
- gtk_signal_emit (GTK_OBJECT(servant->view), nautilus_view_frame_signals[NOTIFY_SELECTION_CHANGE], selinfo);
-}
-
-static void
-impl_Nautilus_View_stop_location_change(impl_POA_Nautilus_View * servant,
- CORBA_Environment * ev)
-{
- gtk_signal_emit(GTK_OBJECT(servant->view), nautilus_view_frame_signals[STOP_LOCATION_CHANGE]);
-}
-
-
-static void
-impl_Nautilus_View__destroy(BonoboObject *obj, impl_POA_Nautilus_View *servant)
-{
- PortableServer_ObjectId *objid;
- CORBA_Environment ev;
- void (*servant_destroy_func) (PortableServer_Servant servant, CORBA_Environment *ev);
-
- CORBA_exception_init(&ev);
-
- servant_destroy_func = NAUTILUS_VIEW_FRAME_CLASS (GTK_OBJECT (servant->view)->klass)->servant_destroy_func;
- objid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), objid, &ev);
- CORBA_free (objid);
- obj->servant = NULL;
-
- servant_destroy_func ((PortableServer_Servant) servant, &ev);
- g_free (servant);
- CORBA_exception_free(&ev);
-}
-
-static Nautilus_ViewFrame
-impl_Nautilus_View__create(NautilusViewFrame *view, CORBA_Environment * ev)
-{
- Nautilus_ViewFrame retval;
-
- impl_POA_Nautilus_View *newservant;
- void (*servant_init_func) (PortableServer_Servant servant, CORBA_Environment *ev);
- NautilusViewFrameClass *view_class = NAUTILUS_VIEW_FRAME_CLASS (GTK_OBJECT(view)->klass);
-
- servant_init_func = view_class->servant_init_func;
- newservant = g_new0 (impl_POA_Nautilus_View, 1);
- newservant->servant.vepv = view_class->vepv;
- if (!newservant->servant.vepv->Bonobo_Unknown_epv)
- newservant->servant.vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
- servant_init_func ((PortableServer_Servant) newservant, ev);
-
- newservant->view = view;
-
- retval = bonobo_object_activate_servant (BONOBO_OBJECT (view), newservant);
-
- gtk_signal_connect (GTK_OBJECT (view), "destroy", GTK_SIGNAL_FUNC (impl_Nautilus_View__destroy), newservant);
-
- return retval;
-}
-
-static void nautilus_view_frame_initialize (NautilusViewFrame *view);
-static void nautilus_view_frame_destroy (NautilusViewFrame *view);
-static void nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass);
-static void nautilus_view_frame_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void nautilus_view_frame_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusViewFrame, nautilus_view_frame, BONOBO_OBJECT_TYPE)
-
-
-static void
-nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
- object_class->destroy = (void (*)(GtkObject*))nautilus_view_frame_destroy;
- object_class->set_arg = nautilus_view_frame_set_arg;
- object_class->get_arg = nautilus_view_frame_get_arg;
-
- klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
- klass->servant_init_func = POA_Nautilus_View__init;
- klass->servant_destroy_func = POA_Nautilus_View__fini;
- klass->vepv = &impl_Nautilus_View_vepv;
-
- nautilus_view_frame_signals[NOTIFY_LOCATION_CHANGE] =
- gtk_signal_new("notify_location_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_location_change),
- gtk_marshal_NONE__BOXED,
- GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
- nautilus_view_frame_signals[NOTIFY_SELECTION_CHANGE] =
- gtk_signal_new("notify_selection_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, notify_selection_change),
- gtk_marshal_NONE__BOXED,
- GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
- nautilus_view_frame_signals[LOAD_STATE] =
- gtk_signal_new("load_state",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, load_state),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
- nautilus_view_frame_signals[SAVE_STATE] =
- gtk_signal_new("save_state",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, save_state),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
- nautilus_view_frame_signals[SHOW_PROPERTIES] =
- gtk_signal_new("show_properties",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, show_properties),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- nautilus_view_frame_signals[STOP_LOCATION_CHANGE] =
- gtk_signal_new("stop_location_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (NautilusViewFrameClass, stop_location_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- gtk_object_class_add_signals (object_class, nautilus_view_frame_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("NautilusViewFrame::bonobo_control",
- GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
- ARG_CONTROL);
-}
-
-static void
-nautilus_view_frame_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- switch(arg_id) {
- case ARG_CONTROL:
- nautilus_view_frame_real_set_bonobo_control (NAUTILUS_VIEW_FRAME (object),
- (BonoboObject *)GTK_VALUE_OBJECT(*arg));
- }
-}
-
-static void
-nautilus_view_frame_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (object);
-
- switch(arg_id) {
- case ARG_CONTROL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (object)));
- }
-}
-
-static void
-nautilus_view_frame_initialize (NautilusViewFrame *view)
-{
- CORBA_Environment ev;
- CORBA_exception_init(&ev);
-
- view->private = g_new0 (NautilusViewFramePrivate, 1);
-
- bonobo_object_construct (BONOBO_OBJECT (view), impl_Nautilus_View__create (view, &ev));
-
- CORBA_exception_free(&ev);
-}
-
-NautilusViewFrame *
-nautilus_view_frame_new (GtkWidget *widget)
-{
- BonoboObject *control;
-
- control = BONOBO_OBJECT (bonobo_control_new (widget));
-
- return nautilus_view_frame_new_from_bonobo_control (control);
-}
-
-NautilusViewFrame *
-nautilus_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control)
-{
- NautilusViewFrame *view_frame;
-
- view_frame = NAUTILUS_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_VIEW_FRAME,
- "bonobo_control", bonobo_control,
- NULL));
-
- return view_frame;
-}
-
-static void
-nautilus_view_frame_destroy (NautilusViewFrame *view)
-{
- NautilusViewFrameClass *klass;
-
- klass = NAUTILUS_VIEW_FRAME_CLASS (GTK_OBJECT (view)->klass);
-
- g_free (view->private);
-
- NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
-}
-
-gboolean
-nautilus_view_frame_ensure_view_frame (NautilusViewFrame *view)
-{
- CORBA_Environment ev;
-
- g_assert (view != NULL);
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- CORBA_exception_init (&ev);
-
- if (CORBA_Object_is_nil (view->private->view_frame, &ev)) {
- view->private->view_frame = Bonobo_Unknown_query_interface
- (bonobo_control_get_control_frame
- (BONOBO_CONTROL (nautilus_view_frame_get_bonobo_control (view))),
- "IDL:Nautilus/ViewFrame:1.0", &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- view->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
-
- if (CORBA_Object_is_nil (view->private->view_frame, &ev)) {
- CORBA_exception_free (&ev);
- return FALSE;
- } else {
- CORBA_exception_free (&ev);
- return TRUE;
- }
-}
-
-void
-nautilus_view_frame_request_location_change (NautilusViewFrame *view,
- Nautilus_NavigationRequestInfo *loc)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- CORBA_exception_init (&ev);
-
- if (nautilus_view_frame_ensure_view_frame (view)) {
- Nautilus_ViewFrame_request_location_change(view->private->view_frame, loc, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->view_frame, &ev);
- view->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free(&ev);
-}
-
-void
-nautilus_view_frame_request_selection_change (NautilusViewFrame *view,
- Nautilus_SelectionRequestInfo *loc)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- CORBA_exception_init(&ev);
-
- if (nautilus_view_frame_ensure_view_frame (view)) {
- Nautilus_ViewFrame_request_selection_change(view->private->view_frame, loc, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->view_frame, &ev);
- view->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free(&ev);
-}
-
-void
-nautilus_view_frame_request_status_change (NautilusViewFrame *view,
- Nautilus_StatusRequestInfo *loc)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- CORBA_exception_init(&ev);
-
- if (nautilus_view_frame_ensure_view_frame (view)) {
- Nautilus_ViewFrame_request_status_change(view->private->view_frame, loc, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->view_frame, &ev);
- view->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free(&ev);
-}
-
-void
-nautilus_view_frame_request_progress_change(NautilusViewFrame *view,
- Nautilus_ProgressRequestInfo *loc)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- CORBA_exception_init(&ev);
-
- if (nautilus_view_frame_ensure_view_frame (view)) {
- Nautilus_ViewFrame_request_progress_change(view->private->view_frame, loc, &ev);
- if(ev._major != CORBA_NO_EXCEPTION)
- {
- CORBA_Object_release(view->private->view_frame, &ev);
- view->private->view_frame = CORBA_OBJECT_NIL;
- }
- }
-
- CORBA_exception_free(&ev);
-}
-
-
-BonoboObject *
-nautilus_view_frame_get_bonobo_control (NautilusViewFrame *view)
-{
- return view->private->control;
-}
-
-
-void
-nautilus_view_frame_real_set_bonobo_control (NautilusViewFrame *view,
- BonoboObject *bonobo_control)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init(&ev);
-
- /* FIXME: what if this fails? Create a new control, or bomb somehow? */
- view->private->control = bonobo_object_query_local_interface (bonobo_control, "IDL:Bonobo/Control:1.0");
- bonobo_object_unref (view->private->control); /* we don't want this spare ref */
-
- bonobo_object_add_interface (BONOBO_OBJECT (view), view->private->control);
-
- CORBA_exception_free(&ev);
-}
diff --git a/libnautilus/ntl-view-frame.h b/libnautilus/ntl-view-frame.h
deleted file mode 100644
index c3619df39..000000000
--- a/libnautilus/ntl-view-frame.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * This 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 this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* ntl-view-frame.h: Interface of the object representing the frame a
- data view plugs into. */
-
-#ifndef NTL_VIEW_FRAME_H
-#define NTL_VIEW_FRAME_H
-
-#include <libnautilus/nautilus-view-component.h>
-#include <bonobo/bonobo-object.h>
-#include <gtk/gtkwidget.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define NAUTILUS_TYPE_VIEW_FRAME (nautilus_view_frame_get_type ())
-#define NAUTILUS_VIEW_FRAME(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_FRAME, NautilusViewFrame))
-#define NAUTILUS_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_FRAME, NautilusViewFrameClass))
-#define NAUTILUS_IS_VIEW_FRAME(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_FRAME))
-#define NAUTILUS_IS_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_FRAME))
-
-typedef struct _NautilusViewFrame NautilusViewFrame;
-typedef struct _NautilusViewFrameClass NautilusViewFrameClass;
-
-struct _NautilusViewFrameClass
-{
- BonoboObjectClass parent_spot;
-
- void (*save_state) (NautilusViewFrame *view, const char *config_path);
- void (*load_state) (NautilusViewFrame *view, const char *config_path);
- void (*notify_location_change) (NautilusViewFrame *view,
- Nautilus_NavigationInfo *nav_context);
- void (*stop_location_change) (NautilusViewFrame *view);
- void (*notify_selection_change) (NautilusViewFrame *view,
- Nautilus_SelectionInfo *nav_context);
- void (*show_properties) (NautilusViewFrame *view);
-
- BonoboObjectClass *parent_class;
-
- gpointer servant_init_func, servant_destroy_func, vepv;
-};
-
-typedef struct _NautilusViewFramePrivate NautilusViewFramePrivate;
-
-struct _NautilusViewFrame
-{
- BonoboObject parent;
- NautilusViewFramePrivate *private;
-};
-
-GtkType nautilus_view_frame_get_type (void);
-NautilusViewFrame *nautilus_view_frame_new (GtkWidget *widget);
-NautilusViewFrame *nautilus_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control);
-void nautilus_view_frame_request_location_change (NautilusViewFrame *view,
- Nautilus_NavigationRequestInfo *loc);
-void nautilus_view_frame_request_selection_change (NautilusViewFrame *view,
- Nautilus_SelectionRequestInfo *loc);
-void nautilus_view_frame_request_status_change (NautilusViewFrame *view,
- Nautilus_StatusRequestInfo *loc);
-void nautilus_view_frame_request_progress_change (NautilusViewFrame *view,
- Nautilus_ProgressRequestInfo *loc);
-BonoboObject *nautilus_view_frame_get_bonobo_control (NautilusViewFrame *view);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/nautilus-widgets/nautilus-preferences-box.c b/nautilus-widgets/nautilus-preferences-box.c
index 9d1132aa7..49947584d 100644
--- a/nautilus-widgets/nautilus-preferences-box.c
+++ b/nautilus-widgets/nautilus-preferences-box.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-box.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkclist.h>
diff --git a/nautilus-widgets/nautilus-preferences-dialog.c b/nautilus-widgets/nautilus-preferences-dialog.c
index 1d701f3fb..e82f3e466 100644
--- a/nautilus-widgets/nautilus-preferences-dialog.c
+++ b/nautilus-widgets/nautilus-preferences-dialog.c
@@ -23,7 +23,7 @@
*/
#include <nautilus-widgets/nautilus-preferences-dialog.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* #include "caption-table.h" */
diff --git a/nautilus-widgets/nautilus-preferences-group.c b/nautilus-widgets/nautilus-preferences-group.c
index 831783543..134321078 100644
--- a/nautilus-widgets/nautilus-preferences-group.c
+++ b/nautilus-widgets/nautilus-preferences-group.c
@@ -27,7 +27,7 @@
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* Signals */
typedef enum
diff --git a/nautilus-widgets/nautilus-preferences-item.c b/nautilus-widgets/nautilus-preferences-item.c
index 6ee5ac027..b53b56246 100644
--- a/nautilus-widgets/nautilus-preferences-item.c
+++ b/nautilus-widgets/nautilus-preferences-item.c
@@ -24,7 +24,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
diff --git a/nautilus-widgets/nautilus-preferences-pane.c b/nautilus-widgets/nautilus-preferences-pane.c
index f2fe5f4ef..63f457aac 100644
--- a/nautilus-widgets/nautilus-preferences-pane.c
+++ b/nautilus-widgets/nautilus-preferences-pane.c
@@ -24,7 +24,7 @@
#include <nautilus-widgets/nautilus-preferences-pane.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
diff --git a/nautilus-widgets/nautilus-preferences.c b/nautilus-widgets/nautilus-preferences.c
index 7729ecf22..b2fba5aef 100644
--- a/nautilus-widgets/nautilus-preferences.c
+++ b/nautilus-widgets/nautilus-preferences.c
@@ -26,7 +26,7 @@
#include "nautilus-preferences.h"
#include <libgnome/gnome-config.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const char PREFERENCES_GLOBAL_DOMAIN[] = "Nautilus::Global";
diff --git a/nautilus-widgets/nautilus-radio-button-group.c b/nautilus-widgets/nautilus-radio-button-group.c
index 509afe7de..38a9030b9 100644
--- a/nautilus-widgets/nautilus-radio-button-group.c
+++ b/nautilus-widgets/nautilus-radio-button-group.c
@@ -26,7 +26,7 @@
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const gint RADIO_BUTTON_GROUP_INVALID = -1;
diff --git a/po/ChangeLog b/po/ChangeLog
index 946752ac4..0860fea45 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-14 Ramiro Estrugo <ramiro@eazel.com>
+
+ * POTFILES.in: Updated for libnautilus -> libnautilus-extensions
+ changes.
+
2000-04-14 Fatih Demir <kabalak@gmx.net>
* tr.po : Added the Turkish translation .
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ff48f9328..da359e871 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,9 +15,9 @@ src/file-manager/fm-icon-view.c
src/file-manager/fm-list-view.c
src/file-manager/fm-properties-window.c
nautilus-widgets/nautilus-preferences-dialog.c
-libnautilus/nautilus-file.c
-libnautilus/nautilus-global-preferences.c
-libnautilus/ntl-meta-view-frame.c
+libnautilus-extensions/nautilus-file.c
+libnautilus-extensions/nautilus-global-preferences.c
+libnautilus/nautilus-meta-view-frame.c
components/history/ntl-history-view.c
components/html/gnome-dialogs.c
components/html/main.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 0e362ce86..35f51e5be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ LDADD =\
file-manager/libntl-file-manager.la \
../nautilus-widgets/libnautilus-widgets.la \
../libnautilus/libnautilus.la \
+ ../libnautilus-extensions/libnautilus-extensions.la \
../librsvg/librsvg.la \
$(BONOBO_LIBS) \
$(GNORBA_LIBS) \
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 91f32fbff..7ea35d4c4 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -41,16 +41,18 @@
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-result.h>
-#include <libnautilus/nautilus-alloc.h>
-#include <libnautilus/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
+
#include <libnautilus/nautilus-zoomable.h>
+#include <libnautilus-extensions/nautilus-alloc.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+
#include "fm-properties-window.h"
#include "dfos-xfer.h"
diff --git a/src/file-manager/fm-directory-view.h b/src/file-manager/fm-directory-view.h
index 84e34a488..d306dd989 100644
--- a/src/file-manager/fm-directory-view.h
+++ b/src/file-manager/fm-directory-view.h
@@ -28,10 +28,10 @@
#include <bonobo/bonobo-ui-handler.h>
#include <gtk/gtkmenu.h>
#include <gtk/gtkscrolledwindow.h>
-#include <libnautilus/ntl-content-view-frame.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-icon-container.h>
+#include <libnautilus/nautilus-content-view-frame.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-icon-container.h>
typedef struct FMDirectoryView FMDirectoryView;
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
diff --git a/src/file-manager/fm-icon-text-window.c b/src/file-manager/fm-icon-text-window.c
index 72938484f..59480dcdd 100644
--- a/src/file-manager/fm-icon-text-window.c
+++ b/src/file-manager/fm-icon-text-window.c
@@ -39,8 +39,8 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-uidefs.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
static void ensure_unique_attributes (int menu_index);
static gboolean fm_icon_text_window_delete_event_cb (GtkWidget *widget,
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 3f32fcbef..9762d9b58 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -39,15 +39,15 @@
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-xfer.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-directory-background.h>
-#include <libnautilus/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-icon-container.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-directory-background.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-icon-container.h>
/* Paths to use when creating & referring to bonobo menu items */
#define MENU_PATH_BEFORE_STRETCH_SEPARATOR "/Settings/Before Stretch Separator"
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index bdc0ebb48..0f26f165e 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -31,11 +31,11 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-pixmap.h>
#include <libgnomeui/gnome-uidefs.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-list.h>
-#include <libnautilus/nautilus-directory-background.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-list.h>
+#include <libnautilus-extensions/nautilus-directory-background.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
struct FMListViewDetails
{
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 45a9244ed..bb03135bb 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -43,9 +43,9 @@
#include <gtk/gtksignal.h>
#include <gtk/gtkvbox.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
static GHashTable *windows;
diff --git a/src/file-manager/fm-properties-window.h b/src/file-manager/fm-properties-window.h
index db57c6642..9f3e816c5 100644
--- a/src/file-manager/fm-properties-window.h
+++ b/src/file-manager/fm-properties-window.h
@@ -27,7 +27,7 @@
#define FM_PROPERTIES_WINDOW_H
#include <gtk/gtkwindow.h>
-#include <libnautilus/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-file.h>
GtkWindow *fm_properties_window_get_or_create (NautilusFile *);
diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c
index 9d01c8dc4..c0c01515d 100644
--- a/src/nautilus-applicable-views.c
+++ b/src/nautilus-applicable-views.c
@@ -28,10 +28,10 @@
#include "ntl-uri-map.h"
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
diff --git a/src/nautilus-applicable-views.h b/src/nautilus-applicable-views.h
index ea66c0d02..89ede4e1f 100644
--- a/src/nautilus-applicable-views.h
+++ b/src/nautilus-applicable-views.h
@@ -31,7 +31,7 @@
#include <glib.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libnautilus/nautilus-view-component.h>
-#include <libnautilus/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-directory.h>
typedef struct NautilusNavigationInfo NautilusNavigationInfo;
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index f8b0c9a0a..4e87e71e7 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -29,7 +29,7 @@
#include <bonobo.h>
#include "file-manager/fm-icon-view.h"
#include "file-manager/fm-list-view.h"
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
typedef struct {
POA_Nautilus_Application servant;
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index 2c0b6576f..9e9cef77a 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -29,10 +29,10 @@
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-xml-extensions.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-xml-extensions.h>
#include <parser.h>
#include <tree.h>
diff --git a/src/nautilus-bookmark-list.h b/src/nautilus-bookmark-list.h
index de0b234f2..e45e4a336 100644
--- a/src/nautilus-bookmark-list.h
+++ b/src/nautilus-bookmark-list.h
@@ -25,7 +25,7 @@
#ifndef NAUTILUS_BOOKMARK_LIST_H
#define NAUTILUS_BOOKMARK_LIST_H
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
typedef struct NautilusBookmarkList NautilusBookmarkList;
typedef struct NautilusBookmarkListClass NautilusBookmarkListClass;
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 7183f5612..7d0110cba 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -23,7 +23,7 @@
*/
#include "nautilus-bookmarks-window.h"
-#include <libnautilus/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
/* Static variables to keep track of window state. If there were
* more than one bookmark-editing window, these would be struct or
diff --git a/src/nautilus-index-tabs.c b/src/nautilus-index-tabs.c
index ee1360d2d..6a5652643 100644
--- a/src/nautilus-index-tabs.c
+++ b/src/nautilus-index-tabs.c
@@ -27,7 +27,7 @@
#include <math.h>
#include <stdio.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
diff --git a/src/nautilus-index-title.c b/src/nautilus-index-title.c
index 99b859abf..8b113eba5 100644
--- a/src/nautilus-index-title.c
+++ b/src/nautilus-index-title.c
@@ -34,12 +34,12 @@
#include <gtk/gtksignal.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
static void nautilus_index_title_initialize_class (NautilusIndexTitleClass *klass);
static void nautilus_index_title_destroy (GtkObject *object);
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index 3d2000982..876f19fef 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -31,15 +31,15 @@
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-mime-type.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-mime-type.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index fdc94ccb4..06c5d72f4 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -39,9 +39,9 @@
#include <libgnomeui/gnome-uidefs.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#define NAUTILUS_DND_URI_LIST_TYPE "text/uri-list"
#define NAUTILUS_DND_TEXT_PLAIN_TYPE "text/plain"
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index 99e6db5bc..415e0ba7c 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -31,9 +31,9 @@
#include "config.h"
#include "nautilus.h"
#include "nautilus-self-check-functions.h"
-#include <libnautilus/nautilus-debug.h>
-#include <libnautilus/nautilus-lib-self-check-functions.h>
-#include <libnautilus/nautilus-self-checks.h>
+#include <libnautilus-extensions/nautilus-debug.h>
+#include <libnautilus-extensions/nautilus-lib-self-check-functions.h>
+#include <libnautilus-extensions/nautilus-self-checks.h>
#include <libgnomevfs/gnome-vfs-init.h>
int
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index c04b7197f..5a41ee8e3 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -30,12 +30,12 @@
#include "ntl-window-private.h"
-#include <libnautilus/nautilus-bonobo-extensions.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
static void activate_bookmark_in_menu_item (BonoboUIHandler *uih,
gpointer user_data,
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 250b15f55..80094dd44 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -38,9 +38,9 @@
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-zoom-control.h"
#include <ctype.h>
#include <libgnomevfs/gnome-vfs-uri.h>
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 8b353150b..5ff013bec 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -29,7 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
#include "ntl-uri-map.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index 250b15f55..80094dd44 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -38,9 +38,9 @@
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-zoom-control.h"
#include <ctype.h>
#include <libgnomevfs/gnome-vfs-uri.h>
diff --git a/src/nautilus-object-window.h b/src/nautilus-object-window.h
index 8b353150b..5ff013bec 100644
--- a/src/nautilus-object-window.h
+++ b/src/nautilus-object-window.h
@@ -29,7 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
#include "ntl-uri-map.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c
index ee1360d2d..6a5652643 100644
--- a/src/nautilus-sidebar-tabs.c
+++ b/src/nautilus-sidebar-tabs.c
@@ -27,7 +27,7 @@
#include <math.h>
#include <stdio.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index 99b859abf..8b113eba5 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -34,12 +34,12 @@
#include <gtk/gtksignal.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
static void nautilus_index_title_initialize_class (NautilusIndexTitleClass *klass);
static void nautilus_index_title_destroy (GtkObject *object);
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index 3d2000982..876f19fef 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -31,15 +31,15 @@
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-mime-type.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-mime-type.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
diff --git a/src/nautilus-signaller.c b/src/nautilus-signaller.c
index 405c0962c..adc2677f6 100644
--- a/src/nautilus-signaller.c
+++ b/src/nautilus-signaller.c
@@ -27,7 +27,7 @@
#include "nautilus-signaller.h"
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
enum
{
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 250b15f55..80094dd44 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -38,9 +38,9 @@
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-zoom-control.h"
#include <ctype.h>
#include <libgnomevfs/gnome-vfs-uri.h>
diff --git a/src/nautilus-spatial-window.h b/src/nautilus-spatial-window.h
index 8b353150b..5ff013bec 100644
--- a/src/nautilus-spatial-window.h
+++ b/src/nautilus-spatial-window.h
@@ -29,7 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
#include "ntl-uri-map.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
diff --git a/src/nautilus-view-frame-bonobo-embeddable.c b/src/nautilus-view-frame-bonobo-embeddable.c
index 57ab4c02a..ae56a1723 100644
--- a/src/nautilus-view-frame-bonobo-embeddable.c
+++ b/src/nautilus-view-frame-bonobo-embeddable.c
@@ -28,7 +28,7 @@
#include "nautilus.h"
#include "ntl-view-private.h"
-#include <libnautilus/bonobo-stream-vfs.h>
+#include <libnautilus-extensions/bonobo-stream-vfs.h>
typedef struct {
BonoboObject *container, *client_site, *view_frame;
diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c
index e4b75c62f..019b9e650 100644
--- a/src/nautilus-view-frame.c
+++ b/src/nautilus-view-frame.c
@@ -29,7 +29,7 @@
#include "ntl-view-private.h"
#include "nautilus.h"
-#include <libnautilus/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <gtk/gtksignal.h>
#include <gtk/gtk.h>
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 59146379a..430551706 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -38,9 +38,9 @@
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
#include "ntl-app.h"
#include "ntl-meta-view.h"
#include "ntl-uri-map.h"
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index c04b7197f..5a41ee8e3 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -30,12 +30,12 @@
#include "ntl-window-private.h"
-#include <libnautilus/nautilus-bonobo-extensions.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
static void activate_bookmark_in_menu_item (BonoboUIHandler *uih,
gpointer user_data,
diff --git a/src/nautilus-window-state.c b/src/nautilus-window-state.c
index 4d063d3d1..021f44aec 100644
--- a/src/nautilus-window-state.c
+++ b/src/nautilus-window-state.c
@@ -25,8 +25,8 @@
*/
#include "nautilus.h"
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
void
nautilus_window_set_initial_state (NautilusWindow *window, const char *initial_url)
diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c
index d2e26537f..90921b628 100644
--- a/src/nautilus-window-toolbars.c
+++ b/src/nautilus-window-toolbars.c
@@ -27,8 +27,8 @@
#include "ntl-app.h"
#include <gnome.h>
-#include <libnautilus/nautilus-bookmark.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
/* forward declarations */
static void nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 250b15f55..80094dd44 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -38,9 +38,9 @@
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-zoom-control.h"
#include <ctype.h>
#include <libgnomevfs/gnome-vfs-uri.h>
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 8b353150b..5ff013bec 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -29,7 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
#include "ntl-uri-map.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"
diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c
index 8335827b8..9744ffca6 100644
--- a/src/nautilus-zoom-control.c
+++ b/src/nautilus-zoom-control.c
@@ -30,8 +30,8 @@
#include <stdio.h>
#include <gnome.h>
#include <math.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
#include "nautilus-zoom-control.h"
enum {
diff --git a/src/ntl-app.c b/src/ntl-app.c
index f8b0c9a0a..4e87e71e7 100644
--- a/src/ntl-app.c
+++ b/src/ntl-app.c
@@ -29,7 +29,7 @@
#include <bonobo.h>
#include "file-manager/fm-icon-view.h"
#include "file-manager/fm-list-view.h"
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
typedef struct {
POA_Nautilus_Application servant;
diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c
index 3d2000982..876f19fef 100644
--- a/src/ntl-index-panel.c
+++ b/src/ntl-index-panel.c
@@ -31,15 +31,15 @@
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-background.h>
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-file.h>
-#include <libnautilus/nautilus-glib-extensions.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-gtk-macros.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-mime-type.h>
+#include <libnautilus-extensions/nautilus-background.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-glib-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-mime-type.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
diff --git a/src/ntl-main.c b/src/ntl-main.c
index 99e6db5bc..415e0ba7c 100644
--- a/src/ntl-main.c
+++ b/src/ntl-main.c
@@ -31,9 +31,9 @@
#include "config.h"
#include "nautilus.h"
#include "nautilus-self-check-functions.h"
-#include <libnautilus/nautilus-debug.h>
-#include <libnautilus/nautilus-lib-self-check-functions.h>
-#include <libnautilus/nautilus-self-checks.h>
+#include <libnautilus-extensions/nautilus-debug.h>
+#include <libnautilus-extensions/nautilus-lib-self-check-functions.h>
+#include <libnautilus-extensions/nautilus-self-checks.h>
#include <libgnomevfs/gnome-vfs-init.h>
int
diff --git a/src/ntl-meta-view.c b/src/ntl-meta-view.c
index f575d7b17..07ec77c58 100644
--- a/src/ntl-meta-view.c
+++ b/src/ntl-meta-view.c
@@ -27,7 +27,7 @@
#include "nautilus.h"
#include "ntl-view-private.h"
#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
diff --git a/src/ntl-uri-map.c b/src/ntl-uri-map.c
index 9d01c8dc4..c0c01515d 100644
--- a/src/ntl-uri-map.c
+++ b/src/ntl-uri-map.c
@@ -28,10 +28,10 @@
#include "ntl-uri-map.h"
-#include <libnautilus/nautilus-directory.h>
-#include <libnautilus/nautilus-metadata.h>
-#include <libnautilus/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
diff --git a/src/ntl-uri-map.h b/src/ntl-uri-map.h
index ea66c0d02..89ede4e1f 100644
--- a/src/ntl-uri-map.h
+++ b/src/ntl-uri-map.h
@@ -31,7 +31,7 @@
#include <glib.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libnautilus/nautilus-view-component.h>
-#include <libnautilus/nautilus-directory.h>
+#include <libnautilus-extensions/nautilus-directory.h>
typedef struct NautilusNavigationInfo NautilusNavigationInfo;
diff --git a/src/ntl-view-bonobo-subdoc.c b/src/ntl-view-bonobo-subdoc.c
index 57ab4c02a..ae56a1723 100644
--- a/src/ntl-view-bonobo-subdoc.c
+++ b/src/ntl-view-bonobo-subdoc.c
@@ -28,7 +28,7 @@
#include "nautilus.h"
#include "ntl-view-private.h"
-#include <libnautilus/bonobo-stream-vfs.h>
+#include <libnautilus-extensions/bonobo-stream-vfs.h>
typedef struct {
BonoboObject *container, *client_site, *view_frame;
diff --git a/src/ntl-view.c b/src/ntl-view.c
index e4b75c62f..019b9e650 100644
--- a/src/ntl-view.c
+++ b/src/ntl-view.c
@@ -29,7 +29,7 @@
#include "ntl-view-private.h"
#include "nautilus.h"
-#include <libnautilus/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <gtk/gtksignal.h>
#include <gtk/gtk.h>
diff --git a/src/ntl-window-msgs.c b/src/ntl-window-msgs.c
index 59146379a..430551706 100644
--- a/src/ntl-window-msgs.c
+++ b/src/ntl-window-msgs.c
@@ -38,9 +38,9 @@
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
-#include <libnautilus/nautilus-string.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-metadata.h>
+#include <libnautilus-extensions/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
#include "ntl-app.h"
#include "ntl-meta-view.h"
#include "ntl-uri-map.h"
diff --git a/src/ntl-window-state.c b/src/ntl-window-state.c
index 4d063d3d1..021f44aec 100644
--- a/src/ntl-window-state.c
+++ b/src/ntl-window-state.c
@@ -25,8 +25,8 @@
*/
#include "nautilus.h"
-#include <libnautilus/nautilus-file-utilities.h>
-#include <libnautilus/nautilus-global-preferences.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
void
nautilus_window_set_initial_state (NautilusWindow *window, const char *initial_url)
diff --git a/src/ntl-window.c b/src/ntl-window.c
index 250b15f55..80094dd44 100644
--- a/src/ntl-window.c
+++ b/src/ntl-window.c
@@ -38,9 +38,9 @@
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libnautilus/nautilus-gtk-extensions.h>
-#include <libnautilus/nautilus-icon-factory.h>
-#include <libnautilus/nautilus-string.h>
+#include <libnautilus-extensions/nautilus-gtk-extensions.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-zoom-control.h"
#include <ctype.h>
#include <libgnomevfs/gnome-vfs-uri.h>
diff --git a/src/ntl-window.h b/src/ntl-window.h
index 8b353150b..5ff013bec 100644
--- a/src/ntl-window.h
+++ b/src/ntl-window.h
@@ -29,7 +29,7 @@
#define NTL_WINDOW_H
#include <libgnomeui/gnome-app.h>
-#include <libnautilus/nautilus-bookmark.h>
+#include <libnautilus-extensions/nautilus-bookmark.h>
#include "ntl-uri-map.h"
#include "ntl-view.h"
#include "ntl-index-panel.h"