summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2017-12-12 16:56:29 +0200
committerErnestas Kulik <ernestask@gnome.org>2018-01-02 12:51:32 +0200
commit74dd9c9f72002d482c898a704bb5b95655e35e08 (patch)
tree0472fecf3b99f1669be99fe18f343d0a47eea535
parent816b8247f3147637d13b55446ee38d4470c0f225 (diff)
downloadnautilus-74dd9c9f72002d482c898a704bb5b95655e35e08.tar.gz
general: remove desktop support
-rw-r--r--build-aux/flatpak/org.gnome.Nautilus.json1
-rw-r--r--config.h.meson1
-rw-r--r--data/.gitignore2
-rw-r--r--data/meson.build24
-rw-r--r--data/nautilus-autostart.desktop.in7
-rw-r--r--data/nautilus-classic.desktop.in11
-rw-r--r--data/org.gnome.nautilus.gschema.xml56
-rwxr-xr-xdata/run-uncrustify.sh2
-rw-r--r--docs/nautilus.17
-rw-r--r--eel/eel-vfs-extensions.c6
-rw-r--r--eel/eel-vfs-extensions.h2
-rw-r--r--meson.build8
-rw-r--r--meson_options.txt3
-rw-r--r--nautilus-desktop/.gitignore1
-rw-r--r--nautilus-desktop/main-desktop.c49
-rw-r--r--nautilus-desktop/meson.build30
-rw-r--r--nautilus-desktop/nautilus-desktop-application.c280
-rw-r--r--nautilus-desktop/nautilus-desktop-application.h36
-rw-r--r--nautilus-desktop/nautilus-desktop-canvas-view-container.c215
-rw-r--r--nautilus-desktop/nautilus-desktop-canvas-view-container.h35
-rw-r--r--nautilus-desktop/nautilus-desktop-canvas-view.c794
-rw-r--r--nautilus-desktop/nautilus-desktop-canvas-view.h54
-rw-r--r--nautilus-desktop/nautilus-desktop-directory-file.c568
-rw-r--r--nautilus-desktop/nautilus-desktop-directory-file.h53
-rw-r--r--nautilus-desktop/nautilus-desktop-directory.c588
-rw-r--r--nautilus-desktop/nautilus-desktop-directory.h58
-rw-r--r--nautilus-desktop/nautilus-desktop-icon-file.c550
-rw-r--r--nautilus-desktop/nautilus-desktop-icon-file.h60
-rw-r--r--nautilus-desktop/nautilus-desktop-link-monitor.c460
-rw-r--r--nautilus-desktop/nautilus-desktop-link-monitor.h60
-rw-r--r--nautilus-desktop/nautilus-desktop-link.c482
-rw-r--r--nautilus-desktop/nautilus-desktop-link.h77
-rw-r--r--nautilus-desktop/nautilus-desktop-metadata.c90
-rw-r--r--nautilus-desktop/nautilus-desktop-metadata.h43
-rw-r--r--nautilus-desktop/nautilus-desktop-window-slot.c69
-rw-r--r--nautilus-desktop/nautilus-desktop-window-slot.h36
-rw-r--r--nautilus-desktop/nautilus-desktop-window.c533
-rw-r--r--nautilus-desktop/nautilus-desktop-window.h59
-rw-r--r--po/POTFILES.in5
-rw-r--r--src/meson.build9
-rw-r--r--src/nautilus-application.c4
-rw-r--r--src/nautilus-bookmark.c3
-rw-r--r--src/nautilus-canvas-container.c2486
-rw-r--r--src/nautilus-canvas-container.h34
-rw-r--r--src/nautilus-canvas-dnd.c251
-rw-r--r--src/nautilus-canvas-private.h46
-rw-r--r--src/nautilus-canvas-view.c686
-rw-r--r--src/nautilus-canvas-view.h11
-rw-r--r--src/nautilus-dbus-manager.c4
-rw-r--r--src/nautilus-directory-async.c20
-rw-r--r--src/nautilus-directory-notify.h8
-rw-r--r--src/nautilus-directory.c64
-rw-r--r--src/nautilus-dnd.c83
-rw-r--r--src/nautilus-dnd.h3
-rw-r--r--src/nautilus-file-changes-queue.c95
-rw-r--r--src/nautilus-file-changes-queue.h4
-rw-r--r--src/nautilus-file-operations.c250
-rw-r--r--src/nautilus-file-operations.h8
-rw-r--r--src/nautilus-file-private.h1
-rw-r--r--src/nautilus-file-undo-operations.c11
-rw-r--r--src/nautilus-file-utilities.c58
-rw-r--r--src/nautilus-file-utilities.h2
-rw-r--r--src/nautilus-file.c42
-rw-r--r--src/nautilus-file.h5
-rw-r--r--src/nautilus-files-view-dnd.c105
-rw-r--r--src/nautilus-files-view-dnd.h16
-rw-r--r--src/nautilus-files-view.c178
-rw-r--r--src/nautilus-files-view.h17
-rw-r--r--src/nautilus-global-preferences.c2
-rw-r--r--src/nautilus-global-preferences.h14
-rw-r--r--src/nautilus-icon-names.h7
-rw-r--r--src/nautilus-lib-self-check-functions.h1
-rw-r--r--src/nautilus-link.c93
-rw-r--r--src/nautilus-link.h4
-rw-r--r--src/nautilus-list-view.c31
-rw-r--r--src/nautilus-metadata.c8
-rw-r--r--src/nautilus-metadata.h9
-rw-r--r--src/nautilus-properties-window.c4
-rw-r--r--src/nautilus-recent.c3
-rw-r--r--src/nautilus-tree-view-drag-dest.c46
-rw-r--r--src/nautilus-view-icon-controller.c7
-rw-r--r--src/nautilus-view.h1
-rw-r--r--src/nautilus-window-slot-dnd.c3
-rw-r--r--src/nautilus-window-slot.c3
-rw-r--r--src/nautilus-window.c86
-rw-r--r--src/resources/css/Adwaita.css23
-rw-r--r--src/resources/css/nautilus.css7
-rw-r--r--src/resources/ui/nautilus-files-view-context-menus.ui36
-rw-r--r--test/test-copy.c1
89 files changed, 253 insertions, 10055 deletions
diff --git a/build-aux/flatpak/org.gnome.Nautilus.json b/build-aux/flatpak/org.gnome.Nautilus.json
index 87b2792d1..03b667658 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.json
+++ b/build-aux/flatpak/org.gnome.Nautilus.json
@@ -84,7 +84,6 @@
"builddir": true,
"name": "nautilus",
"config-opts": [
- "-Denable-desktop=false",
"-Denable-selinux=false",
"--libdir=/app/lib"
],
diff --git a/config.h.meson b/config.h.meson
index 8014bb678..f1c420bb6 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -3,7 +3,6 @@
#mesondefine GETTEXT_PACKAGE
#mesondefine HAVE_EXEMPI
#mesondefine HAVE_SELINUX
-#mesondefine ENABLE_DESKTOP
#mesondefine ENABLE_PACKAGEKIT
#mesondefine LOCALEDIR
#mesondefine NAUTILUS_DATADIR
diff --git a/data/.gitignore b/data/.gitignore
index fe14726f1..89808d77c 100644
--- a/data/.gitignore
+++ b/data/.gitignore
@@ -1,7 +1,5 @@
/lineup-parameters
/nautilus-autorun-software.desktop
-/nautilus-autostart.desktop
-/nautilus-classic.desktop
/org.freedesktop.FileManager1.service
/org.gnome.Nautilus.appdata.xml
/org.gnome.Nautilus.desktop
diff --git a/data/meson.build b/data/meson.build
index a67999761..e185428f4 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -22,24 +22,6 @@ desktop_autorun_software = i18n.merge_file ('desktop-autorun-software',
po_dir: po_dir,
type: 'desktop')
-desktop_autostart = i18n.merge_file ('desktop-autostart',
- input: 'nautilus-autostart.desktop.in',
- output: 'nautilus-autostart.desktop',
- install: true,
- install_dir: join_paths (sysconfdir, 'xdg', 'autostart'),
- po_dir: po_dir,
- type: 'desktop')
-
-if get_option ('enable-desktop')
- desktop_classic = i18n.merge_file ('desktop-classic',
- input: 'nautilus-classic.desktop.in',
- output: 'nautilus-classic.desktop',
- install: true,
- install_dir: desktopdir,
- po_dir: po_dir,
- type: 'desktop')
-endif
-
appdata = i18n.merge_file ('appdata',
input: 'org.gnome.Nautilus.appdata.xml.in',
output: 'org.gnome.Nautilus.appdata.xml',
@@ -72,12 +54,6 @@ if desktop_file_validate.found ()
args: [desktop.full_path ()])
test ('validate-desktop-autorun-software', desktop_file_validate,
args: [desktop_autorun_software.full_path ()])
- test ('validate-desktop-autostart', desktop_file_validate,
- args: [desktop_autostart.full_path ()])
- if get_option ('enable-desktop')
- test ('validate-desktop-classic', desktop_file_validate,
- args: [desktop_classic.full_path ()])
- endif
endif
appstream_util = find_program ('appstream-util', required: false)
diff --git a/data/nautilus-autostart.desktop.in b/data/nautilus-autostart.desktop.in
deleted file mode 100644
index 10926da74..000000000
--- a/data/nautilus-autostart.desktop.in
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Files
-Exec=nautilus-desktop
-OnlyShowIn=GNOME;Unity;
-AutostartCondition=GSettings org.gnome.desktop.background show-desktop-icons
-NoDisplay=true
diff --git a/data/nautilus-classic.desktop.in b/data/nautilus-classic.desktop.in
deleted file mode 100644
index 4da9777b1..000000000
--- a/data/nautilus-classic.desktop.in
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Desktop Icons
-Comment=Classic session desktop file for desktop icons
-Exec=nautilus-desktop --force
-OnlyShowIn=GNOME;
-NoDisplay=true
-X-GNOME-Autostart-Phase=Desktop
-X-GNOME-Autostart-Notify=true
-X-GNOME-AutoRestart=true
-X-GNOME-Provides=filemanager
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 4cbb7647b..d4ca8f2a3 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -68,7 +68,6 @@
<child schema="org.gnome.nautilus.compression" name="compression"/>
<child schema="org.gnome.nautilus.icon-view" name="icon-view"/>
<child schema="org.gnome.nautilus.list-view" name="list-view"/>
- <child schema="org.gnome.nautilus.desktop" name="desktop"/>
<child schema="org.gnome.nautilus.window-state" name="window-state"/>
</schema>
@@ -231,7 +230,7 @@
<key type="as" name="captions">
<default>[ 'none', 'none', 'none' ]</default>
<summary>List of possible captions on icons</summary>
- <description>A list of captions below an icon in the icon view and the desktop. The actual number of captions shown depends on the zoom level. Some possible values are: “size”, “type”, “date_modified”, “owner”, “group”, “permissions”, and “mime_type”.</description>
+ <description>A list of captions below an icon in the icon view. The actual number of captions shown depends on the zoom level. Some possible values are: “size”, “type”, “date_modified”, “owner”, “group”, “permissions”, and “mime_type”.</description>
</key>
<key name="default-zoom-level" enum="org.gnome.nautilus.CanvasZoomLevel">
<default>'large'</default>
@@ -269,59 +268,6 @@
</key>
</schema>
- <schema path="/org/gnome/nautilus/desktop/" id="org.gnome.nautilus.desktop" gettext-domain="nautilus">
- <key type="s" name="font">
- <default l10n="messages" context="desktop-font">''</default>
- <summary>Desktop font</summary>
- <description>The font description used for the icons on the desktop.</description>
- </key>
- <key type="b" name="home-icon-visible">
- <default>true</default>
- <summary>Home icon visible on desktop</summary>
- <description>If this is set to true, an icon linking to the home folder will be put on the desktop.</description>
- </key>
- <key type="b" name="trash-icon-visible">
- <default>true</default>
- <summary>Trash icon visible on desktop</summary>
- <description>If this is set to true, an icon linking to the Trash will be put on the desktop.</description>
- </key>
- <key type="b" name="volumes-visible">
- <default>true</default>
- <summary>Show mounted volumes on the desktop</summary>
- <description>If this is set to true, icons linking to mounted volumes will be put on the desktop.</description>
- </key>
- <key type="b" name="network-icon-visible">
- <default>false</default>
- <summary>Network Servers icon visible on the desktop</summary>
- <description>If this is set to true, an icon linking to the Network Servers view will be put on the desktop.</description>
- </key>
- <key type="s" name="home-icon-name">
- <default l10n="messages" context="home-icon-name">'Home'</default>
- <summary>Desktop home icon name</summary>
- <description>This name can be set if you want a custom name for the home icon on the desktop.</description>
- </key>
- <key type="s" name="trash-icon-name">
- <default l10n="messages" context="trash-icon-name">'Trash'</default>
- <summary>Desktop Trash icon name</summary>
- <description>This name can be set if you want a custom name for the Trash icon on the desktop.</description>
- </key>
- <key type="s" name="network-icon-name">
- <default l10n="messages" context="network-icon-name">'Network Servers'</default>
- <summary>Network servers icon name</summary>
- <description>This name can be set if you want a custom name for the network servers icon on the desktop.</description>
- </key>
- <key type="i" name="text-ellipsis-limit">
- <default>3</default>
- <summary>Text Ellipsis Limit</summary>
- <description>An integer specifying how parts of overlong file names should be replaced by ellipses on the desktop. If the number is larger than 0, the file name will not exceed the given number of lines. If the number is 0 or smaller, no limit is imposed on the number of displayed lines.</description>
- </key>
- <key type="b" name="background-fade">
- <default>true</default>
- <summary>Fade the background on change</summary>
- <description>If set to true, then Nautilus will use a fade effect to change the desktop background.</description>
- </key>
- </schema>
-
<schema path="/org/gnome/nautilus/window-state/" id="org.gnome.nautilus.window-state" gettext-domain="nautilus">
<key type="s" name="geometry">
<default>''</default>
diff --git a/data/run-uncrustify.sh b/data/run-uncrustify.sh
index 39bb29006..4f98b5db2 100755
--- a/data/run-uncrustify.sh
+++ b/data/run-uncrustify.sh
@@ -2,7 +2,7 @@
DATA=$(dirname "$BASH_SOURCE")
if [ -x "$DATA/lineup-parameters" ];
then
- for DIR in "$DATA/../"{src,nautilus-desktop,test,libnautilus-extension,eel,nautilus-sendto-extension}
+ for DIR in "$DATA/../"{src,test,libnautilus-extension,eel,nautilus-sendto-extension}
do
for FILE in $(find "$DIR" -name "*.c")
do
diff --git a/docs/nautilus.1 b/docs/nautilus.1
index f274f5836..70304a1d2 100644
--- a/docs/nautilus.1
+++ b/docs/nautilus.1
@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH Nautilus 1 "23 September 2016"
+.TH Nautilus 1 "12 December 2017"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -51,11 +51,6 @@ Always open a new window for browsing specified URIs.
Only create windows for explicitly specified URIs.
.TP
-.B \-\-no-desktop
-Never manage the desktop (ignore the GSettings preference). \fBDeprecated\fR - the
-desktop is managed in a separate binary.
-
-.TP
.BR \-q ", " \-\-quit
Quit Nautilus.
diff --git a/eel/eel-vfs-extensions.c b/eel/eel-vfs-extensions.c
index 6c626f7e3..a35e26ed3 100644
--- a/eel/eel-vfs-extensions.c
+++ b/eel/eel-vfs-extensions.c
@@ -67,12 +67,6 @@ eel_uri_is_other_locations (const char *uri)
return g_str_has_prefix (uri, "other-locations:");
}
-gboolean
-eel_uri_is_desktop (const char *uri)
-{
- return g_str_has_prefix (uri, EEL_DESKTOP_URI);
-}
-
char *
eel_make_valid_utf8 (const char *name)
{
diff --git a/eel/eel-vfs-extensions.h b/eel/eel-vfs-extensions.h
index 0ad6b2be5..f8b6a1f64 100644
--- a/eel/eel-vfs-extensions.h
+++ b/eel/eel-vfs-extensions.h
@@ -32,14 +32,12 @@
G_BEGIN_DECLS
#define EEL_TRASH_URI "trash:"
-#define EEL_DESKTOP_URI "x-nautilus-desktop:"
#define EEL_SEARCH_URI "x-nautilus-search:"
gboolean eel_uri_is_favorites (const char *uri);
gboolean eel_uri_is_trash (const char *uri);
gboolean eel_uri_is_trash_folder (const char *uri);
gboolean eel_uri_is_in_trash (const char *uri);
-gboolean eel_uri_is_desktop (const char *uri);
gboolean eel_uri_is_search (const char *uri);
gboolean eel_uri_is_other_locations (const char *uri);
gboolean eel_uri_is_recent (const char *uri);
diff --git a/meson.build b/meson.build
index 17865c47e..fbc57b034 100644
--- a/meson.build
+++ b/meson.build
@@ -63,10 +63,6 @@ conf.set_quoted ('LOCALEDIR', join_paths (prefix, localedir))
conf.set_quoted ('NAUTILUS_DATADIR', join_paths (datadir, 'nautilus'))
conf.set_quoted ('NAUTILUS_EXTENSIONDIR', join_paths (prefix, extensiondir))
-if get_option ('enable-desktop')
- conf.set10 ('ENABLE_DESKTOP', true)
-endif
-
if get_option ('enable-packagekit')
conf.set10 ('ENABLE_PACKAGEKIT', true)
endif
@@ -106,10 +102,6 @@ if get_option ('enable-gtk-doc')
subdir ('docs')
endif
-if get_option ('enable-desktop')
- subdir ('nautilus-desktop')
-endif
-
if get_option ('enable-nst-extension')
subdir ('nautilus-sendto-extension')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 783061463..21bc5db45 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,9 +7,6 @@ option ('enable-nst-extension',
option ('enable-selinux',
type: 'boolean',
value: true)
-option ('enable-desktop',
- type: 'boolean',
- value: true)
option ('enable-packagekit',
type: 'boolean',
value: true)
diff --git a/nautilus-desktop/.gitignore b/nautilus-desktop/.gitignore
deleted file mode 100644
index c58f84ea8..000000000
--- a/nautilus-desktop/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/nautilus-desktop
diff --git a/nautilus-desktop/main-desktop.c b/nautilus-desktop/main-desktop.c
deleted file mode 100644
index 23cfb3e4c..000000000
--- a/nautilus-desktop/main-desktop.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <config.h>
-
-#include "nautilus-desktop-application.h"
-#include <src/nautilus-resources.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef HAVE_EXEMPI
-#include <exempi/xmp.h>
-#endif
-
-int
-main (int argc,
- char *argv[])
-{
- NautilusDesktopApplication *application;
- int retval;
-
- /* Initialize gettext support */
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- g_set_prgname ("nautilus-desktop");
-
-#ifdef HAVE_EXEMPI
- xmp_init ();
-#endif
-
- gdk_set_allowed_backends ("x11");
-
- nautilus_register_resource ();
- application = nautilus_desktop_application_new ();
-
- retval = g_application_run (G_APPLICATION (application),
- argc, argv);
-
- g_object_unref (application);
-
- return retval;
-}
diff --git a/nautilus-desktop/meson.build b/nautilus-desktop/meson.build
deleted file mode 100644
index a5e207d1e..000000000
--- a/nautilus-desktop/meson.build
+++ /dev/null
@@ -1,30 +0,0 @@
-nautilus_desktop_sources = [
- 'main-desktop.c',
- 'nautilus-desktop-application.c',
- 'nautilus-desktop-application.h',
- 'nautilus-desktop-canvas-view.c',
- 'nautilus-desktop-canvas-view.h',
- 'nautilus-desktop-canvas-view-container.c',
- 'nautilus-desktop-canvas-view-container.h',
- 'nautilus-desktop-directory.c',
- 'nautilus-desktop-directory.h',
- 'nautilus-desktop-directory-file.c',
- 'nautilus-desktop-directory-file.h',
- 'nautilus-desktop-icon-file.c',
- 'nautilus-desktop-icon-file.h',
- 'nautilus-desktop-link.c',
- 'nautilus-desktop-link.h',
- 'nautilus-desktop-link-monitor.c',
- 'nautilus-desktop-link-monitor.h',
- 'nautilus-desktop-metadata.c',
- 'nautilus-desktop-metadata.h',
- 'nautilus-desktop-window.c',
- 'nautilus-desktop-window.h',
- 'nautilus-desktop-window-slot.c',
- 'nautilus-desktop-window-slot.h'
-]
-
-nautilus_desktop = executable ('nautilus-desktop',
- nautilus_desktop_sources,
- dependencies: libnautilus_dep,
- install: true)
diff --git a/nautilus-desktop/nautilus-desktop-application.c b/nautilus-desktop/nautilus-desktop-application.c
deleted file mode 100644
index 634526813..000000000
--- a/nautilus-desktop/nautilus-desktop-application.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* nautilus-desktop-application.c
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "nautilus-desktop-application.h"
-#include "nautilus-desktop-window.h"
-#include "nautilus-desktop-directory.h"
-#include "nautilus-file-utilities.h"
-
-#include "nautilus-freedesktop-generated.h"
-
-#include <src/nautilus-global-preferences.h>
-#include <eel/eel.h>
-#include <gdk/gdkx.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-
-static NautilusFreedesktopFileManager1 *freedesktop_proxy = NULL;
-
-struct _NautilusDesktopApplication
-{
- NautilusApplication parent_instance;
-
- gboolean force;
- GCancellable *freedesktop_cancellable;
-};
-
-G_DEFINE_TYPE (NautilusDesktopApplication, nautilus_desktop_application, NAUTILUS_TYPE_APPLICATION)
-
-static void
-on_show_folders (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- GError *error = NULL;
-
- nautilus_freedesktop_file_manager1_call_show_items_finish (freedesktop_proxy,
- res,
- &error);
- if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- {
- g_warning ("Unable to show items with File Manager freedesktop proxy: %s", error->message);
- }
-
- g_clear_error (&error);
-}
-
-static void
-open_location_on_dbus (NautilusDesktopApplication *self,
- const gchar *uri)
-{
- const gchar *uris[] = { uri, NULL };
-
- nautilus_freedesktop_file_manager1_call_show_folders (freedesktop_proxy,
- uris,
- "",
- self->freedesktop_cancellable,
- on_show_folders,
- self);
-}
-
-static void
-open_location_full (NautilusApplication *app,
- GFile *location,
- NautilusWindowOpenFlags flags,
- GList *selection,
- NautilusWindow *target_window,
- NautilusWindowSlot *target_slot)
-{
- NautilusDesktopApplication *self = NAUTILUS_DESKTOP_APPLICATION (app);
- gchar *uri;
-
- uri = g_file_get_uri (location);
- if (eel_uri_is_desktop (uri) && target_window &&
- NAUTILUS_IS_DESKTOP_WINDOW (target_window))
- {
- nautilus_window_open_location_full (target_window, location, flags, selection, NULL);
- }
- else
- {
- if (freedesktop_proxy)
- {
- open_location_on_dbus (self, uri);
- }
- else
- {
- g_warning ("cannot open folder on desktop, freedesktop bus not ready\n");
- }
- }
-
- g_free (uri);
-}
-
-static void
-nautilus_application_set_desktop_visible (NautilusDesktopApplication *self,
- gboolean visible)
-{
- GtkWidget *desktop_window;
-
- if (visible)
- {
- nautilus_desktop_window_ensure ();
- }
- else
- {
- desktop_window = nautilus_desktop_window_get ();
- if (desktop_window != NULL)
- {
- gtk_widget_destroy (desktop_window);
- }
- }
-}
-
-static void
-update_desktop_from_gsettings (NautilusDesktopApplication *self)
-{
- GdkDisplay *display;
- gboolean visible;
-
-#ifdef GDK_WINDOWING_X11
- display = gdk_display_get_default ();
- visible = g_settings_get_boolean (gnome_background_preferences,
- NAUTILUS_PREFERENCES_SHOW_DESKTOP);
- visible = visible || self->force;
-
- if (!GDK_IS_X11_DISPLAY (display))
- {
- if (visible)
- {
- g_warning ("Desktop icons only supported on X11. Desktop not created");
- }
-
- return;
- }
-
- nautilus_application_set_desktop_visible (self, visible);
-
- return;
-#endif
-
- g_warning ("Desktop icons only supported on X11. Desktop not created");
-}
-
-static void
-init_desktop (NautilusDesktopApplication *self)
-{
- if (!self->force)
- {
- g_signal_connect_swapped (gnome_background_preferences, "changed::" NAUTILUS_PREFERENCES_SHOW_DESKTOP,
- G_CALLBACK (update_desktop_from_gsettings),
- self);
- }
- update_desktop_from_gsettings (self);
-}
-
-static void
-nautilus_desktop_application_activate (GApplication *app)
-{
- /* Do nothing */
-}
-
-static gint
-nautilus_desktop_application_command_line (GApplication *application,
- GApplicationCommandLine *command_line)
-{
- NautilusDesktopApplication *self = NAUTILUS_DESKTOP_APPLICATION (application);
- GVariantDict *options;
-
- options = g_application_command_line_get_options_dict (command_line);
-
- if (g_variant_dict_contains (options, "force"))
- {
- self->force = TRUE;
- }
-
- init_desktop (self);
-
- return EXIT_SUCCESS;
-}
-
-static void
-nautilus_desktop_application_startup (GApplication *app)
-{
- NautilusDesktopApplication *self = NAUTILUS_DESKTOP_APPLICATION (app);
- GError *error = NULL;
-
- nautilus_application_startup_common (NAUTILUS_APPLICATION (app));
- self->freedesktop_cancellable = g_cancellable_new ();
- freedesktop_proxy = nautilus_freedesktop_file_manager1_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.freedesktop.FileManager1",
- "/org/freedesktop/FileManager1",
- self->freedesktop_cancellable,
- &error);
-
- if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- {
- g_warning ("Unable to create File Manager freedesktop proxy: %s", error->message);
- }
-
- g_clear_error (&error);
-}
-
-static void
-nautilus_desktop_application_dispose (GObject *object)
-{
- NautilusDesktopApplication *self = NAUTILUS_DESKTOP_APPLICATION (object);
-
- g_clear_object (&self->freedesktop_cancellable);
-
-
- G_OBJECT_CLASS (nautilus_desktop_application_parent_class)->dispose (object);
-}
-
-static void
-nautilus_desktop_application_class_init (NautilusDesktopApplicationClass *klass)
-{
- GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- NautilusApplicationClass *parent_class = NAUTILUS_APPLICATION_CLASS (klass);
-
- parent_class->open_location_full = open_location_full;
-
- application_class->startup = nautilus_desktop_application_startup;
- application_class->activate = nautilus_desktop_application_activate;
- application_class->command_line = nautilus_desktop_application_command_line;
-
- gobject_class->dispose = nautilus_desktop_application_dispose;
-}
-
-static void
-nautilus_desktop_ensure_builtins (void)
-{
- /* Ensure the type so it can be registered early as a directory extension provider*/
- g_type_ensure (NAUTILUS_TYPE_DESKTOP_DIRECTORY);
-}
-
-const GOptionEntry desktop_options[] =
-{
- { "force", '\0', 0, G_OPTION_ARG_NONE, NULL,
- N_("Always manage the desktop (ignore the GSettings preference)."), NULL },
- { NULL }
-};
-
-static void
-nautilus_desktop_application_init (NautilusDesktopApplication *self)
-{
- self->force = FALSE;
-
- g_application_add_main_option_entries (G_APPLICATION (self), desktop_options);
- nautilus_ensure_extension_points ();
- nautilus_ensure_extension_builtins ();
- nautilus_desktop_ensure_builtins ();
-}
-
-NautilusDesktopApplication *
-nautilus_desktop_application_new (void)
-{
- return g_object_new (NAUTILUS_TYPE_DESKTOP_APPLICATION,
- "application-id", "org.gnome.NautilusDesktop",
- "register-session", TRUE,
- "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
- NULL);
-}
diff --git a/nautilus-desktop/nautilus-desktop-application.h b/nautilus-desktop/nautilus-desktop-application.h
deleted file mode 100644
index 4f4c62c47..000000000
--- a/nautilus-desktop/nautilus-desktop-application.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* nautilus-desktop-application.h
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NAUTILUS_DESKTOP_APPLICATION_H
-#define NAUTILUS_DESKTOP_APPLICATION_H
-
-#include <glib.h>
-#include "nautilus-application.h"
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_DESKTOP_APPLICATION (nautilus_desktop_application_get_type())
-
-G_DECLARE_FINAL_TYPE (NautilusDesktopApplication, nautilus_desktop_application, NAUTILUS, DESKTOP_APPLICATION, NautilusApplication)
-
-NautilusDesktopApplication *nautilus_desktop_application_new (void);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_DESKTOP_APPLICATION_H */
-
diff --git a/nautilus-desktop/nautilus-desktop-canvas-view-container.c b/nautilus-desktop/nautilus-desktop-canvas-view-container.c
deleted file mode 100644
index 40012380a..000000000
--- a/nautilus-desktop/nautilus-desktop-canvas-view-container.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* nautilus-desktop-canvas-view-container.c
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include "nautilus-desktop-canvas-view-container.h"
-#include "nautilus-desktop-icon-file.h"
-
-struct _NautilusDesktopCanvasViewContainer
-{
- NautilusCanvasViewContainer parent_instance;
-};
-
-G_DEFINE_TYPE (NautilusDesktopCanvasViewContainer, nautilus_desktop_canvas_view_container, NAUTILUS_TYPE_CANVAS_VIEW_CONTAINER)
-
-/* Sort as follows:
- * 0) home link
- * 1) network link
- * 2) mount links
- * 3) other
- * 4) trash link
- */
-typedef enum
-{
- SORT_HOME_LINK,
- SORT_NETWORK_LINK,
- SORT_MOUNT_LINK,
- SORT_OTHER,
- SORT_TRASH_LINK
-} SortCategory;
-
-static SortCategory
-get_sort_category (NautilusFile *file)
-{
- NautilusDesktopLink *link;
- SortCategory category;
-
- category = SORT_OTHER;
-
- if (NAUTILUS_IS_DESKTOP_ICON_FILE (file))
- {
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
- if (link != NULL)
- {
- switch (nautilus_desktop_link_get_link_type (link))
- {
- case NAUTILUS_DESKTOP_LINK_HOME:
- {
- category = SORT_HOME_LINK;
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_MOUNT:
- {
- category = SORT_MOUNT_LINK;
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_TRASH:
- {
- category = SORT_TRASH_LINK;
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_NETWORK:
- {
- category = SORT_NETWORK_LINK;
- }
- break;
-
- default:
- {
- category = SORT_OTHER;
- }
- break;
- }
- g_object_unref (link);
- }
- }
-
- return category;
-}
-
-static int
-real_compare_icons (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data_a,
- NautilusCanvasIconData *data_b)
-{
- NautilusFile *file_a;
- NautilusFile *file_b;
- NautilusFilesView *directory_view;
- SortCategory category_a, category_b;
-
- file_a = (NautilusFile *) data_a;
- file_b = (NautilusFile *) data_b;
-
- directory_view = NAUTILUS_FILES_VIEW (NAUTILUS_CANVAS_VIEW_CONTAINER (container)->view);
- g_return_val_if_fail (directory_view != NULL, 0);
-
- category_a = get_sort_category (file_a);
- category_b = get_sort_category (file_b);
-
- if (category_a == category_b)
- {
- return nautilus_file_compare_for_sort (file_a,
- file_b,
- NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
- nautilus_files_view_should_sort_directories_first (directory_view),
- FALSE);
- }
-
- if (category_a < category_b)
- {
- return -1;
- }
- else
- {
- return +1;
- }
-}
-
-static void
-real_get_icon_text (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data,
- char **editable_text,
- char **additional_text,
- gboolean include_invisible)
-{
- NautilusFile *file;
- gboolean use_additional;
-
- file = NAUTILUS_FILE (data);
-
- g_assert (NAUTILUS_IS_FILE (file));
- g_assert (editable_text != NULL);
-
- use_additional = (additional_text != NULL);
-
- /* Strip the suffix for nautilus object xml files. */
- *editable_text = nautilus_file_get_display_name (file);
-
- if (!use_additional)
- {
- return;
- }
-
- if (NAUTILUS_IS_DESKTOP_ICON_FILE (file) ||
- nautilus_file_is_nautilus_link (file))
- {
- /* Don't show the normal extra information for desktop icons,
- * or desktop files, it doesn't make sense.
- */
- *additional_text = NULL;
-
- return;
- }
-
- return NAUTILUS_CANVAS_CONTAINER_CLASS (nautilus_desktop_canvas_view_container_parent_class)->get_icon_text (container,
- data,
- editable_text,
- additional_text,
- include_invisible);
-}
-
-static char *
-real_get_icon_description (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data)
-{
- NautilusFile *file;
-
- file = NAUTILUS_FILE (data);
- g_assert (NAUTILUS_IS_FILE (file));
-
- if (NAUTILUS_IS_DESKTOP_ICON_FILE (file))
- {
- return NULL;
- }
-
- return NAUTILUS_CANVAS_CONTAINER_CLASS (nautilus_desktop_canvas_view_container_parent_class)->get_icon_description (container,
- data);
-}
-
-NautilusDesktopCanvasViewContainer *
-nautilus_desktop_canvas_view_container_new (void)
-{
- return g_object_new (NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW_CONTAINER, NULL);
-}
-
-static void
-nautilus_desktop_canvas_view_container_class_init (NautilusDesktopCanvasViewContainerClass *klass)
-{
- NautilusCanvasContainerClass *container_class = NAUTILUS_CANVAS_CONTAINER_CLASS (klass);
-
- container_class->get_icon_description = real_get_icon_description;
- container_class->get_icon_text = real_get_icon_text;
- container_class->compare_icons = real_compare_icons;
-}
-
-static void
-nautilus_desktop_canvas_view_container_init (NautilusDesktopCanvasViewContainer *self)
-{
-}
diff --git a/nautilus-desktop/nautilus-desktop-canvas-view-container.h b/nautilus-desktop/nautilus-desktop-canvas-view-container.h
deleted file mode 100644
index 018062b7d..000000000
--- a/nautilus-desktop/nautilus-desktop-canvas-view-container.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* nautilus-desktop-canvas-view-container.h
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-#ifndef NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H
-#define NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H
-
-#include <glib.h>
-#include "nautilus-canvas-view-container.h"
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW_CONTAINER (nautilus_desktop_canvas_view_container_get_type())
-
-G_DECLARE_FINAL_TYPE (NautilusDesktopCanvasViewContainer, nautilus_desktop_canvas_view_container, NAUTILUS, DESKTOP_CANVAS_VIEW_CONTAINER, NautilusCanvasViewContainer)
-
-NautilusDesktopCanvasViewContainer *nautilus_desktop_canvas_view_container_new (void);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H */
-
diff --git a/nautilus-desktop/nautilus-desktop-canvas-view.c b/nautilus-desktop/nautilus-desktop-canvas-view.c
deleted file mode 100644
index 16a285fd3..000000000
--- a/nautilus-desktop/nautilus-desktop-canvas-view.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/* nautilus-desktop-canvas-view.c - implementation of canvas view for managing the desktop.
- *
- * Copyright (C) 2000, 2001 Eazel, Inc.mou
- *
- * 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,
- * see <http://www.gnu.org/licenses/>.
- *
- * Authors: Mike Engber <engber@eazel.com>
- * Gene Z. Ragan <gzr@eazel.com>
- * Miguel de Icaza <miguel@ximian.com>
- */
-
-#include <config.h>
-#include <stdlib.h>
-
-#include "nautilus-desktop-canvas-view.h"
-
-#include "nautilus-desktop-canvas-view-container.h"
-#include "nautilus-desktop-icon-file.h"
-#include "nautilus-desktop-directory.h"
-
-#include <X11/Xatom.h>
-#include <gtk/gtk.h>
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-vfs-extensions.h>
-#include <fcntl.h>
-#include <gdk/gdkx.h>
-#include <glib/gi18n.h>
-#include <src/nautilus-directory-notify.h>
-#include <src/nautilus-file-changes-queue.h>
-#include <src/nautilus-file-operations.h>
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-ui-utilities.h>
-#include <src/nautilus-global-preferences.h>
-#include <src/nautilus-link.h>
-#include <src/nautilus-metadata.h>
-#include <src/nautilus-monitor.h>
-#include <src/nautilus-program-choosing.h>
-#include <src/nautilus-trash-monitor.h>
-#include <src/nautilus-files-view.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-struct NautilusDesktopCanvasViewDetails
-{
- GdkWindow *root_window;
-};
-
-static void default_zoom_level_changed (gpointer user_data);
-static void real_update_context_menus (NautilusFilesView *view);
-static char *real_get_backing_uri (NautilusFilesView *view);
-static void real_check_empty_states (NautilusFilesView *view);
-static void nautilus_desktop_canvas_view_update_canvas_container_fonts (NautilusDesktopCanvasView *view);
-static void font_changed_callback (gpointer callback_data);
-
-G_DEFINE_TYPE (NautilusDesktopCanvasView, nautilus_desktop_canvas_view, NAUTILUS_TYPE_CANVAS_VIEW)
-
-static char *desktop_directory;
-
-#define get_canvas_container(w) nautilus_canvas_view_get_canvas_container (NAUTILUS_CANVAS_VIEW (w))
-
-#define POPUP_PATH_CANVAS_APPEARANCE "/selection/Canvas Appearance Items"
-
-static void
-canvas_container_set_workarea (NautilusCanvasContainer *canvas_container,
- GdkScreen *screen,
- long *workareas,
- int n_items)
-{
- int left, right, top, bottom;
- int screen_width, screen_height;
- int scale;
- int i;
-
- left = right = top = bottom = 0;
-
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
-
- scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
- scale = scale ? scale : 1;
-
- for (i = 0; i < n_items; i += 4)
- {
- int x = workareas [i] / scale;
- int y = workareas [i + 1] / scale;
- int width = workareas [i + 2] / scale;
- int height = workareas [i + 3] / scale;
-
- if ((x + width) > screen_width || (y + height) > screen_height)
- {
- continue;
- }
-
- left = MAX (left, x);
- right = MAX (right, screen_width - width - x);
- top = MAX (top, y);
- bottom = MAX (bottom, screen_height - height - y);
- }
-
- nautilus_canvas_container_set_margins (canvas_container,
- left, right, top, bottom);
-}
-
-static void
-net_workarea_changed (NautilusDesktopCanvasView *canvas_view,
- GdkWindow *window)
-{
- long *nworkareas = NULL;
- long *workareas = NULL;
- GdkAtom type_returned;
- int format_returned;
- int length_returned;
- NautilusCanvasContainer *canvas_container;
- GdkScreen *screen;
-
- g_return_if_fail (NAUTILUS_IS_DESKTOP_CANVAS_VIEW (canvas_view));
-
- canvas_container = get_canvas_container (canvas_view);
-
- /* Find the number of desktops so we know how long the
- * workareas array is going to be (each desktop will have four
- * elements in the workareas array describing
- * x,y,width,height) */
- gdk_error_trap_push ();
- if (!gdk_property_get (window,
- gdk_atom_intern ("_NET_NUMBER_OF_DESKTOPS", FALSE),
- gdk_x11_xatom_to_atom (XA_CARDINAL),
- 0, 4, FALSE,
- &type_returned,
- &format_returned,
- &length_returned,
- (guchar **) &nworkareas))
- {
- g_warning ("Can not calculate _NET_NUMBER_OF_DESKTOPS");
- }
- if (gdk_error_trap_pop ()
- || nworkareas == NULL
- || type_returned != gdk_x11_xatom_to_atom (XA_CARDINAL)
- || format_returned != 32)
- {
- g_warning ("Can not calculate _NET_NUMBER_OF_DESKTOPS");
- }
-
- /* Note : gdk_property_get() is broken (API documents admit
- * this). As a length argument, it expects the number of
- * _bytes_ of data you require. Internally, gdk_property_get
- * converts that value to a count of 32 bit (4 byte) elements.
- * However, the length returned is in bytes, but is calculated
- * via the count of returned elements * sizeof(long). This
- * means on a 64 bit system, the number of bytes you have to
- * request does not correspond to the number of bytes you get
- * back, and is the reason for the workaround below.
- */
- gdk_error_trap_push ();
- if (nworkareas == NULL || (*nworkareas < 1)
- || !gdk_property_get (window,
- gdk_atom_intern ("_NET_WORKAREA", FALSE),
- gdk_x11_xatom_to_atom (XA_CARDINAL),
- 0, ((*nworkareas) * 4 * 4), FALSE,
- &type_returned,
- &format_returned,
- &length_returned,
- (guchar **) &workareas))
- {
- g_warning ("Can not get _NET_WORKAREA");
- workareas = NULL;
- }
-
- if (gdk_error_trap_pop ()
- || workareas == NULL
- || type_returned != gdk_x11_xatom_to_atom (XA_CARDINAL)
- || ((*nworkareas) * 4 * sizeof (long)) != length_returned
- || format_returned != 32)
- {
- g_warning ("Can not determine workarea, guessing at layout");
- nautilus_canvas_container_set_margins (canvas_container,
- 0, 0, 0, 0);
- }
- else
- {
- screen = gdk_window_get_screen (window);
-
- canvas_container_set_workarea
- (canvas_container, screen, workareas, length_returned / sizeof (long));
- }
-
- if (nworkareas != NULL)
- {
- g_free (nworkareas);
- }
-
- if (workareas != NULL)
- {
- g_free (workareas);
- }
-}
-
-static GdkFilterReturn
-desktop_canvas_view_property_filter (GdkXEvent *gdk_xevent,
- GdkEvent *event,
- gpointer data)
-{
- XEvent *xevent = gdk_xevent;
- NautilusDesktopCanvasView *canvas_view;
-
- canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (data);
-
- switch (xevent->type)
- {
- case PropertyNotify:
- {
- if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_NET_WORKAREA"))
- {
- net_workarea_changed (canvas_view, event->any.window);
- }
- }
- break;
-
- default:
- {
- }
- break;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static guint
-real_get_id (NautilusFilesView *view)
-{
- return NAUTILUS_VIEW_DESKTOP_ID;
-}
-
-static void
-nautilus_desktop_canvas_view_dispose (GObject *object)
-{
- NautilusDesktopCanvasView *canvas_view;
-
- canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (object);
-
- g_signal_handlers_disconnect_by_func (nautilus_icon_view_preferences,
- default_zoom_level_changed,
- canvas_view);
- g_signal_handlers_disconnect_by_func (nautilus_preferences,
- font_changed_callback,
- canvas_view);
- g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
- nautilus_files_view_update_context_menus,
- canvas_view);
-
- G_OBJECT_CLASS (nautilus_desktop_canvas_view_parent_class)->dispose (object);
-}
-
-static void
-nautilus_desktop_canvas_view_end_loading (NautilusFilesView *view,
- gboolean all_files_seen)
-{
- gboolean needs_reorganization;
- gchar *stored_size_icon;
- guint current_zoom;
- guint current_icon_size;
- gchar *current_icon_size_string;
- NautilusFile *file;
-
- NAUTILUS_FILES_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->end_loading (view, all_files_seen);
-
- if (!all_files_seen)
- {
- return;
- }
-
- file = nautilus_files_view_get_directory_as_file (view);
- g_return_if_fail (file != NULL);
-
- stored_size_icon = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_DESKTOP_ICON_SIZE, NULL);
- current_zoom = nautilus_canvas_container_get_zoom_level (get_canvas_container (view));
- current_icon_size = nautilus_canvas_container_get_icon_size_for_zoom_level (current_zoom);
- needs_reorganization = stored_size_icon == NULL || atoi (stored_size_icon) != current_icon_size;
-
- if (needs_reorganization)
- {
- current_icon_size_string = g_strdup_printf ("%d", current_icon_size);
- nautilus_canvas_view_clean_up_by_name (NAUTILUS_CANVAS_VIEW (view));
- nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_DESKTOP_ICON_SIZE,
- NULL, current_icon_size_string);
-
- g_free (current_icon_size_string);
- }
-
- g_free (stored_size_icon);
-}
-
-static NautilusCanvasContainer *
-real_create_canvas_container (NautilusCanvasView *canvas_view)
-{
- return NAUTILUS_CANVAS_CONTAINER (nautilus_desktop_canvas_view_container_new ());
-}
-
-static void
-nautilus_desktop_canvas_view_class_init (NautilusDesktopCanvasViewClass *class)
-{
- NautilusFilesViewClass *vclass;
- NautilusCanvasViewClass *canvas_class;
-
- vclass = NAUTILUS_FILES_VIEW_CLASS (class);
- canvas_class = NAUTILUS_CANVAS_VIEW_CLASS (class);
-
-
- G_OBJECT_CLASS (class)->dispose = nautilus_desktop_canvas_view_dispose;
-
- canvas_class->create_canvas_container = real_create_canvas_container;
-
- vclass->update_context_menus = real_update_context_menus;
- vclass->get_view_id = real_get_id;
- vclass->end_loading = nautilus_desktop_canvas_view_end_loading;
- vclass->get_backing_uri = real_get_backing_uri;
- vclass->check_empty_states = real_check_empty_states;
-
- g_type_class_add_private (class, sizeof (NautilusDesktopCanvasViewDetails));
-}
-
-static void
-unrealized_callback (GtkWidget *widget,
- NautilusDesktopCanvasView *desktop_canvas_view)
-{
- g_return_if_fail (desktop_canvas_view->details->root_window != NULL);
-
- /* Remove the property filter */
- gdk_window_remove_filter (desktop_canvas_view->details->root_window,
- desktop_canvas_view_property_filter,
- desktop_canvas_view);
- desktop_canvas_view->details->root_window = NULL;
-}
-
-static void
-realized_callback (GtkWidget *widget,
- NautilusDesktopCanvasView *desktop_canvas_view)
-{
- GdkWindow *root_window;
- GdkScreen *screen;
-
- g_return_if_fail (desktop_canvas_view->details->root_window == NULL);
-
- screen = gtk_widget_get_screen (widget);
- root_window = gdk_screen_get_root_window (screen);
-
- desktop_canvas_view->details->root_window = root_window;
-
- /* Read out the workarea geometry and update the icon container accordingly */
- net_workarea_changed (desktop_canvas_view, root_window);
-
- /* Setup the property filter */
- gdk_window_set_events (root_window, GDK_PROPERTY_CHANGE_MASK);
- gdk_window_add_filter (root_window,
- desktop_canvas_view_property_filter,
- desktop_canvas_view);
-}
-
-static void
-desktop_canvas_container_realize (GtkWidget *widget,
- NautilusDesktopCanvasView *desktop_canvas_view)
-{
- GdkWindow *bin_window;
- GdkRGBA transparent = { 0, 0, 0, 0 };
-
- bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
- gdk_window_set_background_rgba (bin_window, &transparent);
-}
-
-static NautilusCanvasZoomLevel
-get_default_zoom_level (void)
-{
- NautilusCanvasZoomLevel default_zoom_level;
-
- default_zoom_level = g_settings_get_enum (nautilus_icon_view_preferences,
- NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL);
-
- return CLAMP (default_zoom_level, NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL, NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
-}
-
-static void
-set_up_zoom_level (NautilusDesktopCanvasView *desktop_canvas_view)
-{
- NautilusCanvasZoomLevel new_level;
-
- new_level = get_default_zoom_level ();
- nautilus_canvas_container_set_zoom_level (get_canvas_container (desktop_canvas_view),
- new_level);
-}
-
-static void
-default_zoom_level_changed (gpointer user_data)
-{
- NautilusCanvasZoomLevel new_level;
- NautilusDesktopCanvasView *desktop_canvas_view;
- gint new_icon_size;
- NautilusFile *file;
- gchar *new_icon_size_string;
-
- desktop_canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (user_data);
- file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (user_data));
- new_level = get_default_zoom_level ();
- new_icon_size = nautilus_canvas_container_get_icon_size_for_zoom_level (new_level);
- new_icon_size_string = g_strdup_printf ("%d", new_icon_size);
-
- nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_DESKTOP_ICON_SIZE,
- NULL, new_icon_size_string);
- set_up_zoom_level (desktop_canvas_view);
-
- g_free (new_icon_size_string);
-}
-
-static void
-font_changed_callback (gpointer callback_data)
-{
- g_return_if_fail (NAUTILUS_IS_DESKTOP_CANVAS_VIEW (callback_data));
-
- nautilus_desktop_canvas_view_update_canvas_container_fonts (NAUTILUS_DESKTOP_CANVAS_VIEW (callback_data));
-}
-
-static void
-nautilus_desktop_canvas_view_update_canvas_container_fonts (NautilusDesktopCanvasView *canvas_view)
-{
- NautilusCanvasContainer *canvas_container;
- char *font;
-
- canvas_container = get_canvas_container (canvas_view);
- g_assert (canvas_container != NULL);
-
- font = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_FONT);
-
- nautilus_canvas_container_set_font (canvas_container, font);
-
- g_free (font);
-}
-
-static const gchar *
-get_control_center_command (const gchar **params_out)
-{
- gchar *path;
- const gchar *retval;
- const gchar *params;
- const gchar *xdg_current_desktop;
- gchar **desktop_names;
- gboolean is_unity;
- int i;
-
- path = NULL;
- retval = NULL;
- params = NULL;
-
- xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
-
- /* Detect the Unity-based environments */
- is_unity = FALSE;
- if (xdg_current_desktop != NULL)
- {
- desktop_names = g_strsplit (xdg_current_desktop, ":", 0);
- for (i = 0; desktop_names[i]; ++i)
- {
- if (!g_strcmp0 (desktop_names[i], "Unity"))
- {
- is_unity = TRUE;
- break;
- }
- }
- g_strfreev (desktop_names);
- }
-
- /* In Unity look for unity-control-center */
- if (is_unity)
- {
- path = g_find_program_in_path ("unity-control-center");
- if (path != NULL)
- {
- retval = "unity-control-center";
- params = "appearance";
- goto out;
- }
- }
-
- /* Otherwise look for gnome-control-center */
- path = g_find_program_in_path ("gnome-control-center");
- if (path != NULL)
- {
- retval = "gnome-control-center";
- params = "background";
- }
-
-out:
- g_free (path);
- if (params_out != NULL)
- {
- *params_out = params;
- }
-
- return retval;
-}
-
-static void
-action_change_background (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- const gchar *control_center_cmd, *params;
-
- g_assert (NAUTILUS_FILES_VIEW (user_data));
-
- control_center_cmd = get_control_center_command (&params);
- if (control_center_cmd == NULL)
- {
- return;
- }
-
- nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (user_data)),
- control_center_cmd,
- FALSE,
- params, NULL);
-}
-
-static void
-action_empty_trash (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- g_assert (NAUTILUS_IS_FILES_VIEW (user_data));
-
- nautilus_file_operations_empty_trash (GTK_WIDGET (user_data));
-}
-
-static void
-action_stretch (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- nautilus_canvas_container_show_stretch_handles
- (get_canvas_container (user_data));
-}
-
-static void
-action_unstretch (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- nautilus_canvas_container_unstretch (get_canvas_container (user_data));
-}
-
-static void
-action_organize_desktop_by_name (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- nautilus_canvas_view_clean_up_by_name (NAUTILUS_CANVAS_VIEW (user_data));
-}
-
-static gboolean
-trash_link_is_selection (NautilusFilesView *view)
-{
- GList *selection;
- NautilusDesktopLink *link;
- gboolean result;
-
- result = FALSE;
-
- selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
-
- if ((g_list_length (selection) == 1) &&
- NAUTILUS_IS_DESKTOP_ICON_FILE (selection->data))
- {
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (selection->data));
- /* link may be NULL if the link was recently removed (unmounted) */
- if (link != NULL &&
- nautilus_desktop_link_get_link_type (link) == NAUTILUS_DESKTOP_LINK_TRASH)
- {
- result = TRUE;
- }
- if (link)
- {
- g_object_unref (link);
- }
- }
-
- nautilus_file_list_free (selection);
-
- return result;
-}
-
-const GActionEntry desktop_view_entries[] =
-{
- { "change-background", action_change_background },
- { "organize-desktop-by-name", action_organize_desktop_by_name },
- { "empty-trash", action_empty_trash },
- { "stretch", action_stretch },
- { "unstretch", action_unstretch },
-};
-
-static void
-real_check_empty_states (NautilusFilesView *view)
-{
- /* Do nothing */
-}
-
-static char *
-real_get_backing_uri (NautilusFilesView *view)
-{
- gchar *uri;
- NautilusDirectory *directory;
- NautilusDirectory *model;
-
- g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
-
- model = nautilus_files_view_get_model (view);
-
- if (model == NULL)
- {
- return NULL;
- }
-
- directory = nautilus_desktop_directory_get_real_directory (NAUTILUS_DESKTOP_DIRECTORY (model));
-
- uri = nautilus_directory_get_uri (directory);
-
- nautilus_directory_unref (directory);
-
- return uri;
-}
-
-static void
-real_update_context_menus (NautilusFilesView *view)
-{
- NautilusCanvasContainer *canvas_container;
- NautilusDesktopCanvasView *desktop_view;
- GAction *action;
- GActionGroup *view_action_group;
- GList *selection;
- int selection_count;
-
- g_assert (NAUTILUS_IS_DESKTOP_CANVAS_VIEW (view));
-
- NAUTILUS_FILES_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->update_context_menus (view);
-
- view_action_group = nautilus_files_view_get_action_group (view);
- desktop_view = NAUTILUS_DESKTOP_CANVAS_VIEW (view);
- selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
- selection_count = g_list_length (selection);
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "empty-trash");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), trash_link_is_selection (view));
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "keep-aligned");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "organize-desktop-by-name");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "change-background");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "properties");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count > 0);
-
- /* Stretch */
- canvas_container = get_canvas_container (desktop_view);
-
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "stretch");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count == 1 &&
- canvas_container != NULL &&
- !nautilus_canvas_container_has_stretch_handles (canvas_container));
-
- nautilus_file_list_free (selection);
-
- /* Unstretch */
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "unstretch");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), canvas_container != NULL &&
- nautilus_canvas_container_is_stretched (canvas_container));
-}
-
-static void
-nautilus_desktop_canvas_view_init (NautilusDesktopCanvasView *desktop_canvas_view)
-{
- NautilusCanvasContainer *canvas_container;
- GtkAllocation allocation;
- GActionGroup *view_action_group;
- GtkAdjustment *hadj, *vadj;
-
- desktop_canvas_view->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_canvas_view,
- NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW,
- NautilusDesktopCanvasViewDetails);
-
- if (desktop_directory == NULL)
- {
- desktop_directory = nautilus_get_desktop_directory ();
- }
-
- canvas_container = get_canvas_container (desktop_canvas_view);
-
- nautilus_canvas_container_set_is_fixed_size (canvas_container, TRUE);
- nautilus_canvas_container_set_is_desktop (canvas_container, TRUE);
- nautilus_canvas_container_set_store_layout_timestamps (canvas_container, TRUE);
-
- /* Set allocation to be at 0, 0 */
- gtk_widget_get_allocation (GTK_WIDGET (canvas_container), &allocation);
- allocation.x = 0;
- allocation.y = 0;
- gtk_widget_set_allocation (GTK_WIDGET (canvas_container), &allocation);
-
- gtk_widget_queue_resize (GTK_WIDGET (canvas_container));
-
- hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas_container));
- vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas_container));
-
- gtk_adjustment_set_value (hadj, 0);
- gtk_adjustment_set_value (vadj, 0);
-
- nautilus_files_view_ignore_hidden_file_preferences
- (NAUTILUS_FILES_VIEW (desktop_canvas_view));
-
- nautilus_files_view_set_show_foreign (NAUTILUS_FILES_VIEW (desktop_canvas_view),
- FALSE);
-
- g_signal_connect_object (canvas_container, "realize",
- G_CALLBACK (desktop_canvas_container_realize), desktop_canvas_view, 0);
-
- g_signal_connect_object (desktop_canvas_view, "realize",
- G_CALLBACK (realized_callback), desktop_canvas_view, 0);
- g_signal_connect_object (desktop_canvas_view, "unrealize",
- G_CALLBACK (unrealized_callback), desktop_canvas_view, 0);
-
- g_signal_connect_swapped (nautilus_icon_view_preferences,
- "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
- G_CALLBACK (default_zoom_level_changed),
- desktop_canvas_view);
-
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_FONT,
- G_CALLBACK (font_changed_callback),
- desktop_canvas_view);
-
- set_up_zoom_level (desktop_canvas_view);
- nautilus_desktop_canvas_view_update_canvas_container_fonts (desktop_canvas_view);
-
- g_signal_connect_swapped (gnome_lockdown_preferences,
- "changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
- G_CALLBACK (nautilus_files_view_update_context_menus),
- desktop_canvas_view);
-
- view_action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (desktop_canvas_view));
-
- g_action_map_add_action_entries (G_ACTION_MAP (view_action_group),
- desktop_view_entries,
- G_N_ELEMENTS (desktop_view_entries),
- NAUTILUS_FILES_VIEW (desktop_canvas_view));
-}
-
-NautilusFilesView *
-nautilus_desktop_canvas_view_new (NautilusWindowSlot *slot)
-{
- NautilusFilesView *view;
-
- view = g_object_new (NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW,
- "window-slot", slot,
- "supports-zooming", FALSE,
- "supports-auto-layout", FALSE,
- "supports-manual-layout", TRUE,
- "supports-scaling", TRUE,
- "supports-keep-aligned", TRUE,
- NULL);
-
- if (g_object_is_floating (view))
- {
- g_object_ref_sink (view);
- }
-
- return view;
-}
diff --git a/nautilus-desktop/nautilus-desktop-canvas-view.h b/nautilus-desktop/nautilus-desktop-canvas-view.h
deleted file mode 100644
index e40d80ff4..000000000
--- a/nautilus-desktop/nautilus-desktop-canvas-view.h
+++ /dev/null
@@ -1,54 +0,0 @@
-
-/* fm-icon-view.h - interface for icon view of directory.
-
- 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,
- see <http://www.gnu.org/licenses/>.
-
- Authors: Mike Engber <engber@eazel.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_CANVAS_VIEW_H
-#define NAUTILUS_DESKTOP_CANVAS_VIEW_H
-
-#include "nautilus-canvas-view.h"
-
-#define NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW nautilus_desktop_canvas_view_get_type()
-#define NAUTILUS_DESKTOP_CANVAS_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW, NautilusDesktopCanvasView))
-#define NAUTILUS_DESKTOP_CANVAS_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW, NautilusDesktopCanvasViewClass))
-#define NAUTILUS_IS_DESKTOP_CANVAS_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW))
-#define NAUTILUS_IS_DESKTOP_CANVAS_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW))
-#define NAUTILUS_DESKTOP_CANVAS_VIEW_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW, NautilusDesktopCanvasViewClass))
-
-typedef struct NautilusDesktopCanvasViewDetails NautilusDesktopCanvasViewDetails;
-typedef struct {
- NautilusCanvasView parent;
- NautilusDesktopCanvasViewDetails *details;
-} NautilusDesktopCanvasView;
-
-typedef struct {
- NautilusCanvasViewClass parent_class;
-} NautilusDesktopCanvasViewClass;
-
-/* GObject support */
-GType nautilus_desktop_canvas_view_get_type (void);
-NautilusFilesView * nautilus_desktop_canvas_view_new (NautilusWindowSlot *slot);
-
-#endif /* NAUTILUS_DESKTOP_CANVAS_VIEW_H */
diff --git a/nautilus-desktop/nautilus-desktop-directory-file.c b/nautilus-desktop/nautilus-desktop-directory-file.c
deleted file mode 100644
index 3d451adb0..000000000
--- a/nautilus-desktop/nautilus-desktop-directory-file.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * nautilus-desktop-directory-file.c: Subclass of NautilusFile to help implement the
- * virtual desktop.
- *
- * Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include <config.h>
-#include "nautilus-desktop-directory-file.h"
-#include "nautilus-desktop-metadata.h"
-#include "nautilus-desktop-directory.h"
-
-#include <src/nautilus-directory-notify.h>
-#include <src/nautilus-directory-private.h>
-#include <src/nautilus-file-attributes.h>
-#include <src/nautilus-file-private.h>
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-metadata.h>
-
-#include <eel/eel-glib-extensions.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <string.h>
-
-struct NautilusDesktopDirectoryFileDetails
-{
- NautilusDesktopDirectory *desktop_directory;
-
- NautilusFile *real_dir_file;
-
- GHashTable *callbacks;
- GHashTable *monitors;
-};
-
-typedef struct
-{
- NautilusDesktopDirectoryFile *desktop_file;
- NautilusFileCallback callback;
- gpointer callback_data;
-
- NautilusFileAttributes delegated_attributes;
- NautilusFileAttributes non_delegated_attributes;
-
- GList *non_ready_files;
-
- gboolean initializing;
-} DesktopCallback;
-
-typedef struct
-{
- NautilusDesktopDirectoryFile *desktop_file;
-
- NautilusFileAttributes delegated_attributes;
- NautilusFileAttributes non_delegated_attributes;
-} DesktopMonitor;
-
-G_DEFINE_TYPE (NautilusDesktopDirectoryFile, nautilus_desktop_directory_file,
- NAUTILUS_TYPE_FILE);
-
-static guint
-desktop_callback_hash (gconstpointer desktop_callback_as_pointer)
-{
- const DesktopCallback *desktop_callback;
-
- desktop_callback = desktop_callback_as_pointer;
- return GPOINTER_TO_UINT (desktop_callback->callback)
- ^ GPOINTER_TO_UINT (desktop_callback->callback_data);
-}
-
-static gboolean
-desktop_callback_equal (gconstpointer desktop_callback_as_pointer,
- gconstpointer desktop_callback_as_pointer_2)
-{
- const DesktopCallback *desktop_callback, *desktop_callback_2;
-
- desktop_callback = desktop_callback_as_pointer;
- desktop_callback_2 = desktop_callback_as_pointer_2;
-
- return desktop_callback->callback == desktop_callback_2->callback
- && desktop_callback->callback_data == desktop_callback_2->callback_data;
-}
-
-
-static void
-real_file_changed_callback (NautilusFile *real_file,
- gpointer callback_data)
-{
- NautilusDesktopDirectoryFile *desktop_file;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (callback_data);
- nautilus_file_changed (NAUTILUS_FILE (desktop_file));
-}
-
-static NautilusFileAttributes
-get_delegated_attributes_mask (void)
-{
- return NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS |
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT |
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES |
- NAUTILUS_FILE_ATTRIBUTE_INFO;
-}
-
-static void
-partition_attributes (NautilusFileAttributes attributes,
- NautilusFileAttributes *delegated_attributes,
- NautilusFileAttributes *non_delegated_attributes)
-{
- NautilusFileAttributes mask;
-
- mask = get_delegated_attributes_mask ();
-
- *delegated_attributes = attributes & mask;
- *non_delegated_attributes = attributes & ~mask;
-}
-
-static void
-desktop_directory_file_monitor_add (NautilusFile *file,
- gconstpointer client,
- NautilusFileAttributes attributes)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- DesktopMonitor *monitor;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- /* Map the client to a unique value so this doesn't interfere
- * with direct monitoring of the file by the same client.
- */
- monitor = g_hash_table_lookup (desktop_file->details->monitors, client);
- if (monitor != NULL)
- {
- g_assert (monitor->desktop_file == desktop_file);
- }
- else
- {
- monitor = g_new0 (DesktopMonitor, 1);
- monitor->desktop_file = desktop_file;
- g_hash_table_insert (desktop_file->details->monitors,
- (gpointer) client, monitor);
- }
-
- partition_attributes (attributes,
- &monitor->delegated_attributes,
- &monitor->non_delegated_attributes);
-
- /* Pawn off partioned attributes to real dir file */
- nautilus_file_monitor_add (desktop_file->details->real_dir_file,
- monitor, monitor->delegated_attributes);
-
- /* Do the rest ourself */
- nautilus_directory_monitor_add_internal
- (file->details->directory, file,
- client, TRUE,
- monitor->non_delegated_attributes,
- NULL, NULL);
-}
-
-static void
-desktop_directory_file_monitor_remove (NautilusFile *file,
- gconstpointer client)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- DesktopMonitor *monitor;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- /* Map the client to the value used by the earlier add call. */
- monitor = g_hash_table_lookup (desktop_file->details->monitors, client);
- if (monitor == NULL)
- {
- return;
- }
-
- /* Call through to the real file remove calls. */
- g_hash_table_remove (desktop_file->details->monitors, client);
-
- /* Remove the locally handled parts */
- nautilus_directory_monitor_remove_internal
- (file->details->directory, file, client);
-}
-
-static void
-desktop_callback_destroy (DesktopCallback *desktop_callback)
-{
- g_assert (desktop_callback != NULL);
- g_assert (NAUTILUS_IS_DESKTOP_DIRECTORY_FILE (desktop_callback->desktop_file));
-
- nautilus_file_unref (NAUTILUS_FILE (desktop_callback->desktop_file));
- g_list_free (desktop_callback->non_ready_files);
- g_free (desktop_callback);
-}
-
-static void
-desktop_callback_check_done (DesktopCallback *desktop_callback)
-{
- /* Check if we are ready. */
- if (desktop_callback->initializing ||
- desktop_callback->non_ready_files != NULL)
- {
- return;
- }
-
- /* Ensure our metadata is updated before calling back */
- nautilus_desktop_update_metadata_from_keyfile (NAUTILUS_FILE (desktop_callback->desktop_file), "directory");
-
- /* Remove from the hash table before sending it. */
- g_hash_table_remove (desktop_callback->desktop_file->details->callbacks,
- desktop_callback);
-
- /* We are ready, so do the real callback. */
- (*desktop_callback->callback)(NAUTILUS_FILE (desktop_callback->desktop_file),
- desktop_callback->callback_data);
-
- /* And we are done. */
- desktop_callback_destroy (desktop_callback);
-}
-
-static void
-desktop_callback_remove_file (DesktopCallback *desktop_callback,
- NautilusFile *file)
-{
- desktop_callback->non_ready_files = g_list_remove
- (desktop_callback->non_ready_files, file);
- desktop_callback_check_done (desktop_callback);
-}
-
-static void
-ready_callback (NautilusFile *file,
- gpointer callback_data)
-{
- DesktopCallback *desktop_callback;
-
- g_assert (NAUTILUS_IS_FILE (file));
- g_assert (callback_data != NULL);
-
- desktop_callback = callback_data;
- g_assert (g_list_find (desktop_callback->non_ready_files, file) != NULL);
-
- desktop_callback_remove_file (desktop_callback, file);
-}
-
-static void
-desktop_directory_file_call_when_ready (NautilusFile *file,
- NautilusFileAttributes attributes,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- DesktopCallback search_key, *desktop_callback;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- /* Check to be sure we aren't overwriting. */
- search_key.callback = callback;
- search_key.callback_data = callback_data;
- if (g_hash_table_lookup (desktop_file->details->callbacks, &search_key) != NULL)
- {
- g_warning ("tried to add a new callback while an old one was pending");
- return;
- }
-
- /* Create a desktop_callback record. */
- desktop_callback = g_new0 (DesktopCallback, 1);
- nautilus_file_ref (file);
- desktop_callback->desktop_file = desktop_file;
- desktop_callback->callback = callback;
- desktop_callback->callback_data = callback_data;
- desktop_callback->initializing = TRUE;
-
- partition_attributes (attributes,
- &desktop_callback->delegated_attributes,
- &desktop_callback->non_delegated_attributes);
-
- desktop_callback->non_ready_files = g_list_prepend
- (desktop_callback->non_ready_files, file);
- desktop_callback->non_ready_files = g_list_prepend
- (desktop_callback->non_ready_files, desktop_file->details->real_dir_file);
-
- /* Put it in the hash table. */
- g_hash_table_insert (desktop_file->details->callbacks,
- desktop_callback, desktop_callback);
-
- /* Now connect to each file's call_when_ready. */
- nautilus_directory_call_when_ready_internal
- (file->details->directory, file,
- desktop_callback->non_delegated_attributes,
- FALSE, NULL, ready_callback, desktop_callback);
- nautilus_file_call_when_ready
- (desktop_file->details->real_dir_file,
- desktop_callback->delegated_attributes,
- ready_callback, desktop_callback);
-
- desktop_callback->initializing = FALSE;
-
- /* Check if any files became read while we were connecting up
- * the call_when_ready callbacks (also handles the pathological
- * case where there are no files at all).
- */
- desktop_callback_check_done (desktop_callback);
-}
-
-static void
-desktop_directory_file_cancel_call_when_ready (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- DesktopCallback search_key, *desktop_callback;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- /* Find the entry in the table. */
- search_key.callback = callback;
- search_key.callback_data = callback_data;
- desktop_callback = g_hash_table_lookup (desktop_file->details->callbacks, &search_key);
- if (desktop_callback == NULL)
- {
- return;
- }
-
- /* Remove from the hash table before working with it. */
- g_hash_table_remove (desktop_callback->desktop_file->details->callbacks, desktop_callback);
-
- /* Tell the real directory to cancel the call. */
- nautilus_directory_cancel_callback_internal
- (file->details->directory, file,
- NULL, ready_callback, desktop_callback);
-
- nautilus_file_cancel_call_when_ready
- (desktop_file->details->real_dir_file,
- ready_callback, desktop_callback);
-
- desktop_callback_destroy (desktop_callback);
-}
-
-static gboolean
-real_check_if_ready (NautilusFile *file,
- NautilusFileAttributes attributes)
-{
- return nautilus_directory_check_if_ready_internal
- (file->details->directory, file,
- attributes);
-}
-
-static gboolean
-desktop_directory_file_check_if_ready (NautilusFile *file,
- NautilusFileAttributes attributes)
-{
- NautilusFileAttributes delegated_attributes, non_delegated_attributes;
- NautilusDesktopDirectoryFile *desktop_file;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- partition_attributes (attributes,
- &delegated_attributes,
- &non_delegated_attributes);
-
- return real_check_if_ready (file, non_delegated_attributes) &&
- nautilus_file_check_if_ready (desktop_file->details->real_dir_file,
- delegated_attributes);
-}
-
-static gboolean
-desktop_directory_file_get_item_count (NautilusFile *file,
- guint *count,
- gboolean *count_unreadable)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- gboolean got_count;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- got_count = nautilus_file_get_directory_item_count (desktop_file->details->real_dir_file,
- count,
- count_unreadable);
-
- if (count)
- {
- *count += g_list_length (file->details->directory->details->file_list);
- }
-
- return got_count;
-}
-
-static NautilusRequestStatus
-desktop_directory_file_get_deep_counts (NautilusFile *file,
- guint *directory_count,
- guint *file_count,
- guint *unreadable_directory_count,
- goffset *total_size)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- NautilusRequestStatus status;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- status = nautilus_file_get_deep_counts (desktop_file->details->real_dir_file,
- directory_count,
- file_count,
- unreadable_directory_count,
- total_size,
- TRUE);
-
- if (file_count)
- {
- *file_count += g_list_length (file->details->directory->details->file_list);
- }
-
- return status;
-}
-
-static gboolean
-desktop_directory_file_get_date (NautilusFile *file,
- NautilusDateType date_type,
- time_t *date)
-{
- NautilusDesktopDirectoryFile *desktop_file;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);
-
- return nautilus_file_get_date (desktop_file->details->real_dir_file,
- date_type,
- date);
-}
-
-static char *
-desktop_directory_file_get_where_string (NautilusFile *file)
-{
- return g_strdup (_("on the desktop"));
-}
-
-
-static void
-monitor_destroy (gpointer data)
-{
- DesktopMonitor *monitor = data;
-
- nautilus_file_monitor_remove
- (NAUTILUS_FILE (monitor->desktop_file->details->real_dir_file), monitor);
- g_free (monitor);
-}
-
-static void
-nautilus_desktop_directory_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *value)
-{
- nautilus_desktop_set_metadata_string (file, "directory", key, value);
-}
-
-static void
-nautilus_desktop_directory_file_set_metadata_as_list (NautilusFile *file,
- const char *key,
- char **value)
-{
- nautilus_desktop_set_metadata_stringv (file, "directory", key, (const gchar **) value);
-}
-
-static void
-nautilus_desktop_directory_file_init (NautilusDesktopDirectoryFile *desktop_file)
-{
- NautilusDesktopDirectory *desktop_directory;
- NautilusDirectory *real_dir;
- NautilusFile *real_dir_file;
-
- desktop_file->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_file,
- NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE,
- NautilusDesktopDirectoryFileDetails);
-
- desktop_directory = NAUTILUS_DESKTOP_DIRECTORY (nautilus_directory_get_by_uri (EEL_DESKTOP_URI));
- desktop_file->details->desktop_directory = desktop_directory;
-
- desktop_file->details->callbacks = g_hash_table_new
- (desktop_callback_hash, desktop_callback_equal);
- desktop_file->details->monitors = g_hash_table_new_full (NULL, NULL,
- NULL, monitor_destroy);
-
- real_dir = nautilus_desktop_directory_get_real_directory (desktop_directory);
- real_dir_file = nautilus_directory_get_corresponding_file (real_dir);
- nautilus_directory_unref (real_dir);
-
- desktop_file->details->real_dir_file = real_dir_file;
- g_signal_connect_object (real_dir_file, "changed",
- G_CALLBACK (real_file_changed_callback), desktop_file, 0);
-}
-
-
-static void
-desktop_callback_remove_file_cover (gpointer key,
- gpointer value,
- gpointer callback_data)
-{
- desktop_callback_remove_file
- (value, NAUTILUS_FILE (callback_data));
-}
-
-
-static void
-desktop_finalize (GObject *object)
-{
- NautilusDesktopDirectoryFile *desktop_file;
- NautilusDesktopDirectory *desktop_directory;
-
- desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (object);
- desktop_directory = desktop_file->details->desktop_directory;
-
- /* Todo: ghash now safe? */
- eel_g_hash_table_safe_for_each
- (desktop_file->details->callbacks,
- desktop_callback_remove_file_cover,
- desktop_file->details->real_dir_file);
-
- if (g_hash_table_size (desktop_file->details->callbacks) != 0)
- {
- g_warning ("call_when_ready still pending when desktop virtual file is destroyed");
- }
-
- g_hash_table_destroy (desktop_file->details->callbacks);
- g_hash_table_destroy (desktop_file->details->monitors);
-
- nautilus_file_unref (desktop_file->details->real_dir_file);
- nautilus_directory_unref (NAUTILUS_DIRECTORY (desktop_directory));
-
- G_OBJECT_CLASS (nautilus_desktop_directory_file_parent_class)->finalize (object);
-}
-
-static void
-nautilus_desktop_directory_file_class_init (NautilusDesktopDirectoryFileClass *klass)
-{
- GObjectClass *object_class;
- NautilusFileClass *file_class;
-
- object_class = G_OBJECT_CLASS (klass);
- file_class = NAUTILUS_FILE_CLASS (klass);
-
- object_class->finalize = desktop_finalize;
-
- file_class->default_file_type = G_FILE_TYPE_DIRECTORY;
-
- file_class->monitor_add = desktop_directory_file_monitor_add;
- file_class->monitor_remove = desktop_directory_file_monitor_remove;
- file_class->call_when_ready = desktop_directory_file_call_when_ready;
- file_class->cancel_call_when_ready = desktop_directory_file_cancel_call_when_ready;
- file_class->check_if_ready = desktop_directory_file_check_if_ready;
- file_class->get_item_count = desktop_directory_file_get_item_count;
- file_class->get_deep_counts = desktop_directory_file_get_deep_counts;
- file_class->get_date = desktop_directory_file_get_date;
- file_class->get_where_string = desktop_directory_file_get_where_string;
- file_class->set_metadata = nautilus_desktop_directory_file_set_metadata;
- file_class->set_metadata_as_list = nautilus_desktop_directory_file_set_metadata_as_list;
-
- g_type_class_add_private (klass, sizeof (NautilusDesktopDirectoryFileDetails));
-}
diff --git a/nautilus-desktop/nautilus-desktop-directory-file.h b/nautilus-desktop/nautilus-desktop-directory-file.h
deleted file mode 100644
index 5813fda44..000000000
--- a/nautilus-desktop/nautilus-desktop-directory-file.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- nautilus-desktop-directory-file.h: Subclass of NautilusFile to implement the
- the case of the desktop directory
-
- Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
-
- Author: Alexander Larsson <alexl@redhat.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_DIRECTORY_FILE_H
-#define NAUTILUS_DESKTOP_DIRECTORY_FILE_H
-
-#include <src/nautilus-file.h>
-
-#define NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE nautilus_desktop_directory_file_get_type()
-#define NAUTILUS_DESKTOP_DIRECTORY_FILE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE, NautilusDesktopDirectoryFile))
-#define NAUTILUS_DESKTOP_DIRECTORY_FILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE, NautilusDesktopDirectoryFileClass))
-#define NAUTILUS_IS_DESKTOP_DIRECTORY_FILE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE))
-#define NAUTILUS_IS_DESKTOP_DIRECTORY_FILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE))
-#define NAUTILUS_DESKTOP_DIRECTORY_FILE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE, NautilusDesktopDirectoryFileClass))
-
-typedef struct NautilusDesktopDirectoryFileDetails NautilusDesktopDirectoryFileDetails;
-
-typedef struct {
- NautilusFile parent_slot;
- NautilusDesktopDirectoryFileDetails *details;
-} NautilusDesktopDirectoryFile;
-
-typedef struct {
- NautilusFileClass parent_slot;
-} NautilusDesktopDirectoryFileClass;
-
-GType nautilus_desktop_directory_file_get_type (void);
-
-#endif /* NAUTILUS_DESKTOP_DIRECTORY_FILE_H */
diff --git a/nautilus-desktop/nautilus-desktop-directory.c b/nautilus-desktop/nautilus-desktop-directory.c
deleted file mode 100644
index 4f8de90df..000000000
--- a/nautilus-desktop/nautilus-desktop-directory.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * nautilus-desktop-directory.c: Subclass of NautilusDirectory to implement
- * a virtual directory consisting of the desktop directory and the desktop
- * icons
- *
- * Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include <config.h>
-#include "nautilus-desktop-directory.h"
-#include "nautilus-desktop-directory-file.h"
-
-#include <src/nautilus-directory-private.h>
-#include <src/nautilus-file.h>
-#include <src/nautilus-file-private.h>
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-global-preferences.h>
-#include <gtk/gtk.h>
-
-struct NautilusDesktopDirectoryDetails
-{
- NautilusDirectory *real_directory;
- GHashTable *callbacks;
- GHashTable *monitors;
-};
-
-typedef struct
-{
- NautilusDesktopDirectory *desktop_dir;
- NautilusDirectoryCallback callback;
- gpointer callback_data;
-
- NautilusFileAttributes wait_for_attributes;
- gboolean wait_for_file_list;
-
- GList *non_ready_directories;
- GList *merged_file_list;
-} MergedCallback;
-
-
-typedef struct
-{
- NautilusDesktopDirectory *desktop_dir;
-
- gboolean monitor_hidden_files;
- NautilusFileAttributes monitor_attributes;
-} MergedMonitor;
-
-static void desktop_directory_changed_callback (gpointer data);
-
-G_DEFINE_TYPE_WITH_CODE (NautilusDesktopDirectory, nautilus_desktop_directory, NAUTILUS_TYPE_DIRECTORY,
- nautilus_ensure_extension_points ();
- g_io_extension_point_implement (NAUTILUS_DIRECTORY_PROVIDER_EXTENSION_POINT_NAME,
- g_define_type_id,
- NAUTILUS_DESKTOP_DIRECTORY_PROVIDER_NAME,
- 0));
-static gboolean
-desktop_contains_file (NautilusDirectory *directory,
- NautilusFile *file)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- if (nautilus_directory_contains_file (desktop->details->real_directory, file))
- {
- return TRUE;
- }
-
- return file->details->directory == directory;
-}
-
-static guint
-merged_callback_hash (gconstpointer merged_callback_as_pointer)
-{
- const MergedCallback *merged_callback;
-
- merged_callback = merged_callback_as_pointer;
- return GPOINTER_TO_UINT (merged_callback->callback)
- ^ GPOINTER_TO_UINT (merged_callback->callback_data);
-}
-
-static gboolean
-merged_callback_equal (gconstpointer merged_callback_as_pointer,
- gconstpointer merged_callback_as_pointer_2)
-{
- const MergedCallback *merged_callback, *merged_callback_2;
-
- merged_callback = merged_callback_as_pointer;
- merged_callback_2 = merged_callback_as_pointer_2;
-
- return merged_callback->callback == merged_callback_2->callback
- && merged_callback->callback_data == merged_callback_2->callback_data;
-}
-
-static void
-merged_callback_destroy (MergedCallback *merged_callback)
-{
- g_assert (merged_callback != NULL);
- g_assert (NAUTILUS_IS_DESKTOP_DIRECTORY (merged_callback->desktop_dir));
-
- g_list_free (merged_callback->non_ready_directories);
- nautilus_file_list_free (merged_callback->merged_file_list);
- g_free (merged_callback);
-}
-
-static void
-merged_callback_check_done (MergedCallback *merged_callback)
-{
- /* Check if we are ready. */
- if (merged_callback->non_ready_directories != NULL)
- {
- return;
- }
-
- /* Remove from the hash table before sending it. */
- g_hash_table_steal (merged_callback->desktop_dir->details->callbacks, merged_callback);
-
- /* We are ready, so do the real callback. */
- (*merged_callback->callback)(NAUTILUS_DIRECTORY (merged_callback->desktop_dir),
- merged_callback->merged_file_list,
- merged_callback->callback_data);
-
- /* And we are done. */
- merged_callback_destroy (merged_callback);
-}
-
-static void
-merged_callback_remove_directory (MergedCallback *merged_callback,
- NautilusDirectory *directory)
-{
- merged_callback->non_ready_directories = g_list_remove
- (merged_callback->non_ready_directories, directory);
- merged_callback_check_done (merged_callback);
-}
-
-static void
-directory_ready_callback (NautilusDirectory *directory,
- GList *files,
- gpointer callback_data)
-{
- MergedCallback *merged_callback;
-
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (callback_data != NULL);
-
- merged_callback = callback_data;
- g_assert (g_list_find (merged_callback->non_ready_directories, directory) != NULL);
-
- /* Update based on this call. */
- merged_callback->merged_file_list = g_list_concat
- (merged_callback->merged_file_list,
- nautilus_file_list_copy (files));
-
- /* Check if we are ready. */
- merged_callback_remove_directory (merged_callback, directory);
-}
-
-static void
-desktop_call_when_ready (NautilusDirectory *directory,
- NautilusFileAttributes file_attributes,
- gboolean wait_for_file_list,
- NautilusDirectoryCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopDirectory *desktop;
- MergedCallback search_key, *merged_callback;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- /* Check to be sure we aren't overwriting. */
- search_key.callback = callback;
- search_key.callback_data = callback_data;
- if (g_hash_table_lookup (desktop->details->callbacks, &search_key) != NULL)
- {
- g_warning ("tried to add a new callback while an old one was pending");
- return;
- }
-
- /* Create a merged_callback record. */
- merged_callback = g_new0 (MergedCallback, 1);
- merged_callback->desktop_dir = desktop;
- merged_callback->callback = callback;
- merged_callback->callback_data = callback_data;
- merged_callback->wait_for_attributes = file_attributes;
- merged_callback->wait_for_file_list = wait_for_file_list;
- merged_callback->non_ready_directories = g_list_prepend
- (merged_callback->non_ready_directories, directory);
- merged_callback->non_ready_directories = g_list_prepend
- (merged_callback->non_ready_directories, desktop->details->real_directory);
-
-
- merged_callback->merged_file_list = g_list_concat (NULL,
- nautilus_file_list_copy (directory->details->file_list));
-
- /* Put it in the hash table. */
- g_hash_table_insert (desktop->details->callbacks,
- merged_callback, merged_callback);
-
- /* Now tell all the directories about it. */
- nautilus_directory_call_when_ready
- (desktop->details->real_directory,
- merged_callback->wait_for_attributes,
- merged_callback->wait_for_file_list,
- directory_ready_callback, merged_callback);
- nautilus_directory_call_when_ready_internal
- (directory,
- NULL,
- merged_callback->wait_for_attributes,
- merged_callback->wait_for_file_list,
- directory_ready_callback,
- NULL,
- merged_callback);
-}
-
-static void
-desktop_cancel_callback (NautilusDirectory *directory,
- NautilusDirectoryCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopDirectory *desktop;
- MergedCallback search_key, *merged_callback;
- GList *node;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- /* Find the entry in the table. */
- search_key.callback = callback;
- search_key.callback_data = callback_data;
- merged_callback = g_hash_table_lookup (desktop->details->callbacks, &search_key);
- if (merged_callback == NULL)
- {
- return;
- }
-
- /* Remove from the hash table before working with it. */
- g_hash_table_steal (merged_callback->desktop_dir->details->callbacks, merged_callback);
-
- /* Tell all the directories to cancel the call. */
- for (node = merged_callback->non_ready_directories; node != NULL; node = node->next)
- {
- nautilus_directory_cancel_callback
- (node->data,
- directory_ready_callback, merged_callback);
- }
- merged_callback_destroy (merged_callback);
-}
-
-static void
-merged_monitor_destroy (MergedMonitor *monitor)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = monitor->desktop_dir;
-
- /* Call through to the real directory remove calls. */
- nautilus_directory_file_monitor_remove (desktop->details->real_directory, monitor);
-
- nautilus_directory_monitor_remove_internal (NAUTILUS_DIRECTORY (desktop), NULL, monitor);
-
- g_free (monitor);
-}
-
-static void
-build_merged_callback_list (NautilusDirectory *directory,
- GList *file_list,
- gpointer callback_data)
-{
- GList **merged_list;
-
- merged_list = callback_data;
- *merged_list = g_list_concat (*merged_list,
- nautilus_file_list_copy (file_list));
-}
-
-static void
-desktop_monitor_add (NautilusDirectory *directory,
- gconstpointer client,
- gboolean monitor_hidden_files,
- NautilusFileAttributes file_attributes,
- NautilusDirectoryCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopDirectory *desktop;
- MergedMonitor *monitor;
- GList *merged_callback_list;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- /* Map the client to a unique value so this doesn't interfere
- * with direct monitoring of the directory by the same client.
- */
- monitor = g_hash_table_lookup (desktop->details->monitors, client);
- if (monitor != NULL)
- {
- g_assert (monitor->desktop_dir == desktop);
- }
- else
- {
- monitor = g_new0 (MergedMonitor, 1);
- monitor->desktop_dir = desktop;
- g_hash_table_insert (desktop->details->monitors,
- (gpointer) client, monitor);
- }
- monitor->monitor_hidden_files = monitor_hidden_files;
- monitor->monitor_attributes = file_attributes;
-
- /* Call through to the real directory add calls. */
- merged_callback_list = NULL;
-
- /* Call up to real dir */
- nautilus_directory_file_monitor_add
- (desktop->details->real_directory, monitor,
- monitor_hidden_files,
- file_attributes,
- build_merged_callback_list, &merged_callback_list);
-
- /* Handle the desktop part */
- merged_callback_list = g_list_concat (merged_callback_list,
- nautilus_file_list_copy (directory->details->file_list));
-
-
- if (callback != NULL)
- {
- (*callback)(directory, merged_callback_list, callback_data);
- }
- nautilus_file_list_free (merged_callback_list);
-}
-
-static void
-desktop_monitor_remove (NautilusDirectory *directory,
- gconstpointer client)
-{
- NautilusDesktopDirectory *desktop;
- MergedMonitor *monitor;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- monitor = g_hash_table_lookup (desktop->details->monitors, client);
- if (monitor == NULL)
- {
- return;
- }
-
- g_hash_table_remove (desktop->details->monitors, client);
-}
-
-static void
-desktop_force_reload (NautilusDirectory *directory)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- nautilus_directory_force_reload (desktop->details->real_directory);
-
- /* We don't invalidate the files in desktop, since they are always
- * up to date. (And we don't ever want to mark them invalid.) */
-}
-
-static gboolean
-desktop_are_all_files_seen (NautilusDirectory *directory)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- if (!nautilus_directory_are_all_files_seen (desktop->details->real_directory))
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-desktop_is_not_empty (NautilusDirectory *directory)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);
-
- if (nautilus_directory_is_not_empty (desktop->details->real_directory))
- {
- return TRUE;
- }
-
- return directory->details->file_list != NULL;
-}
-
-static GList *
-desktop_get_file_list (NautilusDirectory *directory)
-{
- GList *real_dir_file_list, *desktop_dir_file_list = NULL;
-
- real_dir_file_list = nautilus_directory_get_file_list
- (NAUTILUS_DESKTOP_DIRECTORY (directory)->details->real_directory);
- desktop_dir_file_list = NAUTILUS_DIRECTORY_CLASS (nautilus_desktop_directory_parent_class)->get_file_list (directory);
-
- return g_list_concat (real_dir_file_list, desktop_dir_file_list);
-}
-
-NautilusDirectory *
-nautilus_desktop_directory_get_real_directory (NautilusDesktopDirectory *desktop)
-{
- nautilus_directory_ref (desktop->details->real_directory);
- return desktop->details->real_directory;
-}
-
-
-static void
-desktop_finalize (GObject *object)
-{
- NautilusDesktopDirectory *desktop;
-
- desktop = NAUTILUS_DESKTOP_DIRECTORY (object);
-
- nautilus_directory_unref (desktop->details->real_directory);
-
- g_hash_table_destroy (desktop->details->callbacks);
- g_hash_table_destroy (desktop->details->monitors);
- g_free (desktop->details);
-
- g_signal_handlers_disconnect_by_func (nautilus_preferences,
- desktop_directory_changed_callback,
- desktop);
-
- G_OBJECT_CLASS (nautilus_desktop_directory_parent_class)->finalize (object);
-}
-
-static void
-done_loading_callback (NautilusDirectory *real_directory,
- NautilusDesktopDirectory *desktop)
-{
- nautilus_directory_emit_done_loading (NAUTILUS_DIRECTORY (desktop));
-}
-
-
-static void
-forward_files_added_cover (NautilusDirectory *real_directory,
- GList *files,
- gpointer callback_data)
-{
- nautilus_directory_emit_files_added (NAUTILUS_DIRECTORY (callback_data), files);
-}
-
-static void
-forward_files_changed_cover (NautilusDirectory *real_directory,
- GList *files,
- gpointer callback_data)
-{
- nautilus_directory_emit_files_changed (NAUTILUS_DIRECTORY (callback_data), files);
-}
-
-static void
-update_desktop_directory (NautilusDesktopDirectory *desktop)
-{
- char *desktop_path;
- char *desktop_uri;
- NautilusDirectory *real_directory;
-
- real_directory = desktop->details->real_directory;
- if (real_directory != NULL)
- {
- g_hash_table_foreach_remove (desktop->details->callbacks, (GHRFunc) gtk_true, NULL);
- g_hash_table_foreach_remove (desktop->details->monitors, (GHRFunc) gtk_true, NULL);
-
- g_signal_handlers_disconnect_by_func (real_directory, done_loading_callback, desktop);
- g_signal_handlers_disconnect_by_func (real_directory, forward_files_added_cover, desktop);
- g_signal_handlers_disconnect_by_func (real_directory, forward_files_changed_cover, desktop);
-
- nautilus_directory_unref (real_directory);
- }
-
- desktop_path = nautilus_get_desktop_directory ();
- desktop_uri = g_filename_to_uri (desktop_path, NULL, NULL);
- real_directory = nautilus_directory_get_by_uri (desktop_uri);
- g_free (desktop_uri);
- g_free (desktop_path);
-
- g_signal_connect_object (real_directory, "done-loading",
- G_CALLBACK (done_loading_callback), desktop, 0);
- g_signal_connect_object (real_directory, "files-added",
- G_CALLBACK (forward_files_added_cover), desktop, 0);
- g_signal_connect_object (real_directory, "files-changed",
- G_CALLBACK (forward_files_changed_cover), desktop, 0);
-
- desktop->details->real_directory = real_directory;
-}
-
-static NautilusFile *
-real_new_file_from_filename (NautilusDirectory *directory,
- const char *filename,
- gboolean self_owned)
-{
- NautilusFile *file;
-
- g_assert (NAUTILUS_IS_DIRECTORY (directory));
- g_assert (filename != NULL);
- g_assert (filename[0] != '\0');
-
- if (self_owned)
- {
- file = NAUTILUS_FILE (g_object_new (NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE, NULL));
- }
- else
- {
- g_critical ("Accessing desktop uris directly is not supported.");
-
- return NULL;
- }
-
- nautilus_file_set_directory (file, directory);
-
- return file;
-}
-
-static gboolean
-real_handles_location (GFile *location)
-{
- g_autofree gchar *uri = NULL;
-
- uri = g_file_get_uri (location);
-
- return eel_uri_is_desktop (uri);
-}
-
-static void
-desktop_directory_changed_callback (gpointer data)
-{
- update_desktop_directory (NAUTILUS_DESKTOP_DIRECTORY (data));
- nautilus_directory_force_reload (NAUTILUS_DIRECTORY (data));
-}
-
-static void
-nautilus_desktop_directory_init (NautilusDesktopDirectory *desktop)
-{
- desktop->details = g_new0 (NautilusDesktopDirectoryDetails, 1);
-
- desktop->details->callbacks = g_hash_table_new_full
- (merged_callback_hash, merged_callback_equal,
- NULL, (GDestroyNotify) merged_callback_destroy);
- desktop->details->monitors = g_hash_table_new_full (NULL, NULL,
- NULL, (GDestroyNotify) merged_monitor_destroy);
-
- update_desktop_directory (NAUTILUS_DESKTOP_DIRECTORY (desktop));
-}
-
-static void
-nautilus_desktop_directory_class_init (NautilusDesktopDirectoryClass *class)
-{
- NautilusDirectoryClass *directory_class;
-
- directory_class = NAUTILUS_DIRECTORY_CLASS (class);
-
- G_OBJECT_CLASS (class)->finalize = desktop_finalize;
-
- directory_class->contains_file = desktop_contains_file;
- directory_class->call_when_ready = desktop_call_when_ready;
- directory_class->cancel_callback = desktop_cancel_callback;
- directory_class->file_monitor_add = desktop_monitor_add;
- directory_class->file_monitor_remove = desktop_monitor_remove;
- directory_class->force_reload = desktop_force_reload;
- directory_class->are_all_files_seen = desktop_are_all_files_seen;
- directory_class->is_not_empty = desktop_is_not_empty;
- directory_class->new_file_from_filename = real_new_file_from_filename;
- directory_class->handles_location = real_handles_location;
- /* Override get_file_list so that we can return the list of files
- * in NautilusDesktopDirectory->details->real_directory,
- * in addition to the list of standard desktop icons on the desktop.
- */
- directory_class->get_file_list = desktop_get_file_list;
-}
diff --git a/nautilus-desktop/nautilus-desktop-directory.h b/nautilus-desktop/nautilus-desktop-directory.h
deleted file mode 100644
index 7c357fc03..000000000
--- a/nautilus-desktop/nautilus-desktop-directory.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- nautilus-desktop-directory.h: Subclass of NautilusDirectory to implement
- a virtual directory consisting of the desktop directory and the desktop
- icons
-
- Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
-
- Author: Alexander Larsson <alexl@redhat.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_DIRECTORY_H
-#define NAUTILUS_DESKTOP_DIRECTORY_H
-
-#include <src/nautilus-directory.h>
-
-#define NAUTILUS_TYPE_DESKTOP_DIRECTORY nautilus_desktop_directory_get_type()
-#define NAUTILUS_DESKTOP_DIRECTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY, NautilusDesktopDirectory))
-#define NAUTILUS_DESKTOP_DIRECTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_DIRECTORY, NautilusDesktopDirectoryClass))
-#define NAUTILUS_IS_DESKTOP_DIRECTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY))
-#define NAUTILUS_IS_DESKTOP_DIRECTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_DIRECTORY))
-#define NAUTILUS_DESKTOP_DIRECTORY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_DIRECTORY, NautilusDesktopDirectoryClass))
-
-#define NAUTILUS_DESKTOP_DIRECTORY_PROVIDER_NAME "desktop-directory-provider"
-
-typedef struct NautilusDesktopDirectoryDetails NautilusDesktopDirectoryDetails;
-
-typedef struct {
- NautilusDirectory parent_slot;
- NautilusDesktopDirectoryDetails *details;
-} NautilusDesktopDirectory;
-
-typedef struct {
- NautilusDirectoryClass parent_slot;
-
-} NautilusDesktopDirectoryClass;
-
-GType nautilus_desktop_directory_get_type (void);
-NautilusDirectory * nautilus_desktop_directory_get_real_directory (NautilusDesktopDirectory *desktop_directory);
-
-#endif /* NAUTILUS_DESKTOP_DIRECTORY_H */
diff --git a/nautilus-desktop/nautilus-desktop-icon-file.c b/nautilus-desktop/nautilus-desktop-icon-file.c
deleted file mode 100644
index a35190f3f..000000000
--- a/nautilus-desktop/nautilus-desktop-icon-file.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * nautilus-desktop-icon-file.c: Subclass of NautilusFile to help implement the
- * virtual desktop icons.
- *
- * Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include <config.h>
-#include "nautilus-desktop-icon-file.h"
-#include "nautilus-desktop-metadata.h"
-#include "nautilus-desktop-directory-file.h"
-#include "nautilus-desktop-directory.h"
-
-#include <src/nautilus-directory-notify.h>
-#include <src/nautilus-directory-private.h>
-#include <src/nautilus-file-attributes.h>
-#include <src/nautilus-file-private.h>
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-file-operations.h>
-#include <src/nautilus-link.h>
-#include <src/nautilus-file-undo-manager.h>
-
-#include <eel/eel-glib-extensions.h>
-#include <glib/gi18n.h>
-#include <string.h>
-#include <gio/gio.h>
-
-struct NautilusDesktopIconFileDetails
-{
- NautilusDesktopLink *link;
-};
-
-G_DEFINE_TYPE (NautilusDesktopIconFile, nautilus_desktop_icon_file, NAUTILUS_TYPE_FILE)
-
-
-static void
-desktop_icon_file_monitor_add (NautilusFile *file,
- gconstpointer client,
- NautilusFileAttributes attributes)
-{
- nautilus_directory_monitor_add_internal
- (file->details->directory, file,
- client, TRUE, attributes, NULL, NULL);
-}
-
-static void
-desktop_icon_file_monitor_remove (NautilusFile *file,
- gconstpointer client)
-{
- nautilus_directory_monitor_remove_internal
- (file->details->directory, file, client);
-}
-
-static void
-desktop_icon_file_call_when_ready (NautilusFile *file,
- NautilusFileAttributes attributes,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- nautilus_directory_call_when_ready_internal
- (file->details->directory, file,
- attributes, FALSE, NULL, callback, callback_data);
-}
-
-static void
-desktop_icon_file_cancel_call_when_ready (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data)
-{
- nautilus_directory_cancel_callback_internal
- (file->details->directory, file,
- NULL, callback, callback_data);
-}
-
-static gboolean
-desktop_icon_file_check_if_ready (NautilusFile *file,
- NautilusFileAttributes attributes)
-{
- return nautilus_directory_check_if_ready_internal
- (file->details->directory, file,
- attributes);
-}
-
-static gboolean
-desktop_icon_file_get_item_count (NautilusFile *file,
- guint *count,
- gboolean *count_unreadable)
-{
- if (count != NULL)
- {
- *count = 0;
- }
- if (count_unreadable != NULL)
- {
- *count_unreadable = FALSE;
- }
- return TRUE;
-}
-
-static NautilusRequestStatus
-desktop_icon_file_get_deep_counts (NautilusFile *file,
- guint *directory_count,
- guint *file_count,
- guint *unreadable_directory_count,
- goffset *total_size)
-{
- if (directory_count != NULL)
- {
- *directory_count = 0;
- }
- if (file_count != NULL)
- {
- *file_count = 0;
- }
- if (unreadable_directory_count != NULL)
- {
- *unreadable_directory_count = 0;
- }
- if (total_size != NULL)
- {
- *total_size = 0;
- }
-
- return NAUTILUS_REQUEST_DONE;
-}
-
-static gboolean
-desktop_icon_file_get_date (NautilusFile *file,
- NautilusDateType date_type,
- time_t *date)
-{
- NautilusDesktopIconFile *desktop_file;
-
- desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
-
- return nautilus_desktop_link_get_date (desktop_file->details->link,
- date_type, date);
-}
-
-static char *
-desktop_icon_file_get_where_string (NautilusFile *file)
-{
- return g_strdup (_("on the desktop"));
-}
-
-static void
-nautilus_desktop_icon_file_init (NautilusDesktopIconFile *desktop_file)
-{
- desktop_file->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_file,
- NAUTILUS_TYPE_DESKTOP_ICON_FILE,
- NautilusDesktopIconFileDetails);
-}
-
-static void
-update_info_from_link (NautilusDesktopIconFile *icon_file)
-{
- NautilusFile *file;
- NautilusDesktopLink *link;
- char *display_name;
- GMount *mount;
-
- file = NAUTILUS_FILE (icon_file);
-
- link = icon_file->details->link;
-
- if (link == NULL)
- {
- return;
- }
-
- eel_ref_str_unref (file->details->mime_type);
- file->details->mime_type = eel_ref_str_get_unique ("application/x-nautilus-link");
- file->details->type = G_FILE_TYPE_SHORTCUT;
- file->details->size = 0;
- file->details->has_permissions = FALSE;
- file->details->can_read = TRUE;
- file->details->can_write = TRUE;
-
- file->details->can_mount = FALSE;
- file->details->can_unmount = FALSE;
- file->details->can_eject = FALSE;
- if (file->details->mount)
- {
- g_object_unref (file->details->mount);
- }
- mount = nautilus_desktop_link_get_mount (link);
- file->details->mount = mount;
- if (mount)
- {
- file->details->can_unmount = g_mount_can_unmount (mount);
- file->details->can_eject = g_mount_can_eject (mount);
- }
-
- file->details->file_info_is_up_to_date = TRUE;
-
- display_name = nautilus_desktop_link_get_display_name (link);
- nautilus_file_set_display_name (file,
- display_name, NULL, TRUE);
- g_free (display_name);
-
- if (file->details->icon != NULL)
- {
- g_object_unref (file->details->icon);
- }
- file->details->icon = nautilus_desktop_link_get_icon (link);
- g_free (file->details->activation_uri);
- file->details->activation_uri = nautilus_desktop_link_get_activation_uri (link);
- file->details->got_link_info = TRUE;
- file->details->link_info_is_up_to_date = TRUE;
-
- file->details->directory_count = 0;
- file->details->got_directory_count = TRUE;
- file->details->directory_count_is_up_to_date = TRUE;
-}
-
-void
-nautilus_desktop_icon_file_update (NautilusDesktopIconFile *icon_file)
-{
- NautilusFile *file;
-
- update_info_from_link (icon_file);
- file = NAUTILUS_FILE (icon_file);
- nautilus_file_changed (file);
-}
-
-void
-nautilus_desktop_icon_file_remove (NautilusDesktopIconFile *icon_file)
-{
- NautilusFile *file;
- GList list;
-
- icon_file->details->link = NULL;
-
- file = NAUTILUS_FILE (icon_file);
-
- /* ref here because we might be removing the last ref when we
- * mark the file gone below, but we need to keep a ref at
- * least long enough to send the change notification.
- */
- nautilus_file_ref (file);
-
- file->details->is_gone = TRUE;
-
- list.data = file;
- list.next = NULL;
- list.prev = NULL;
-
- nautilus_directory_remove_file (file->details->directory, file);
- nautilus_directory_emit_change_signals (file->details->directory, &list);
-
- nautilus_file_unref (file);
-}
-
-NautilusDesktopIconFile *
-nautilus_desktop_icon_file_new (NautilusDesktopLink *link)
-{
- NautilusFile *file;
- NautilusDirectory *directory;
- NautilusDesktopIconFile *icon_file;
- GList list;
- char *name;
-
- directory = nautilus_directory_get_by_uri (EEL_DESKTOP_URI);
-
- file = NAUTILUS_FILE (g_object_new (NAUTILUS_TYPE_DESKTOP_ICON_FILE, NULL));
-
-#ifdef NAUTILUS_FILE_DEBUG_REF
- printf ("%10p ref'd\n", file);
- eazel_dump_stack_trace ("\t", 10);
-#endif
-
- nautilus_file_set_directory (file, directory);
-
- icon_file = NAUTILUS_DESKTOP_ICON_FILE (file);
- icon_file->details->link = link;
-
- name = nautilus_desktop_link_get_file_name (link);
- file->details->name = eel_ref_str_new (name);
- g_free (name);
-
- update_info_from_link (icon_file);
-
- nautilus_desktop_update_metadata_from_keyfile (file, file->details->name);
-
- nautilus_directory_add_file (directory, file);
-
- list.data = file;
- list.next = NULL;
- list.prev = NULL;
- nautilus_directory_emit_files_added (directory, &list);
-
- return icon_file;
-}
-
-/* Note: This can return NULL if the link was recently removed (i.e. unmounted) */
-NautilusDesktopLink *
-nautilus_desktop_icon_file_get_link (NautilusDesktopIconFile *icon_file)
-{
- if (icon_file->details->link)
- {
- return g_object_ref (icon_file->details->link);
- }
- else
- {
- return NULL;
- }
-}
-
-static void
-nautilus_desktop_icon_file_unmount (NautilusFile *file,
- GMountOperation *mount_op,
- GCancellable *cancellable,
- NautilusFileOperationCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopIconFile *desktop_file;
- GMount *mount;
-
- desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
- if (desktop_file)
- {
- mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
- if (mount != NULL)
- {
- nautilus_file_operations_unmount_mount (NULL, mount, FALSE, TRUE);
- }
- }
-}
-
-static void
-nautilus_desktop_icon_file_eject (NautilusFile *file,
- GMountOperation *mount_op,
- GCancellable *cancellable,
- NautilusFileOperationCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopIconFile *desktop_file;
- GMount *mount;
-
- desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
- if (desktop_file)
- {
- mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
- if (mount != NULL)
- {
- nautilus_file_operations_unmount_mount (NULL, mount, TRUE, TRUE);
- }
- }
-}
-
-static char *
-real_get_target_uri (NautilusFile *file)
-{
- char *uri = NULL;
- GFile *location;
- NautilusDesktopLink *link;
-
- g_return_val_if_fail (NAUTILUS_IS_DESKTOP_ICON_FILE (file), NULL);
-
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
-
- if (link != NULL)
- {
- location = nautilus_desktop_link_get_activation_location (link);
- g_object_unref (link);
- if (location != NULL)
- {
- uri = g_file_get_uri (location);
- g_object_unref (location);
-
- return uri;
- }
- }
-
- return NAUTILUS_FILE_CLASS (nautilus_desktop_icon_file_parent_class)->get_target_uri (file);
-}
-
-static void
-real_rename (NautilusFile *file,
- const char *new_name,
- NautilusFileOperationCallback callback,
- gpointer callback_data)
-{
- NautilusDesktopLink *link;
- char *old_name;
- gboolean success;
- GError *error;
-
- g_return_if_fail (NAUTILUS_IS_FILE (file));
- g_return_if_fail (new_name != NULL);
- g_return_if_fail (callback != NULL);
-
- /* Can't rename a file that's already gone.
- * We need to check this here because there may be a new
- * file with the same name.
- */
- if (nautilus_file_rename_handle_file_gone (file, callback, callback_data))
- {
- return;
- }
-
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
- old_name = nautilus_file_get_display_name (file);
-
- if ((old_name != NULL && strcmp (new_name, old_name) == 0))
- {
- success = TRUE;
- }
- else
- {
- success = (link != NULL && nautilus_desktop_link_rename (link, new_name));
- }
-
- if (success)
- {
- (*callback)(file, NULL, NULL, callback_data);
- }
- else
- {
- error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Unable to rename desktop icon"));
- (*callback)(file, NULL, error, callback_data);
- g_error_free (error);
- }
-
- g_free (old_name);
- g_object_unref (link);
-
- return;
-}
-
-static gboolean
-real_can_rename (NautilusFile *file)
-{
- NautilusDesktopLink *link;
- gboolean can_rename;
-
- can_rename = NAUTILUS_FILE_CLASS (nautilus_desktop_icon_file_parent_class)->can_rename (file);
-
- if (!can_rename)
- {
- return FALSE;
- }
-
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
-
- /* Certain types of links can't be renamed */
- if (link != NULL)
- {
- can_rename = nautilus_desktop_link_can_rename (link);
- g_object_unref (link);
- }
-
- return can_rename;
-}
-
-static gboolean
-real_drag_can_accept_files (NautilusFile *drop_target_item)
-{
- return TRUE;
-}
-
-static void
-real_invalidate_attributes_internal (NautilusFile *file,
- NautilusFileAttributes attributes)
-{
- /* Desktop icon files are always up to date.
- * If we invalidate their attributes they
- * will lose data, so we just ignore them.
- */
- return;
-}
-
-static gboolean
-real_opens_in_view (NautilusFile *file)
-{
- return TRUE;
-}
-
-static gboolean
-real_is_special_link (NautilusFile *file)
-{
- return TRUE;
-}
-
-static void
-nautilus_desktop_icon_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *value)
-{
- nautilus_desktop_set_metadata_string (file, file->details->name, key, value);
-}
-
-static void
-nautilus_desktop_icon_file_set_metadata_as_list (NautilusFile *file,
- const char *key,
- char **value)
-{
- nautilus_desktop_set_metadata_stringv (file, file->details->name, key, (const gchar **) value);
-}
-
-static void
-nautilus_desktop_icon_file_class_init (NautilusDesktopIconFileClass *klass)
-{
- GObjectClass *object_class;
- NautilusFileClass *file_class;
-
- object_class = G_OBJECT_CLASS (klass);
- file_class = NAUTILUS_FILE_CLASS (klass);
-
- file_class->default_file_type = G_FILE_TYPE_DIRECTORY;
-
- file_class->monitor_add = desktop_icon_file_monitor_add;
- file_class->monitor_remove = desktop_icon_file_monitor_remove;
- file_class->call_when_ready = desktop_icon_file_call_when_ready;
- file_class->cancel_call_when_ready = desktop_icon_file_cancel_call_when_ready;
- file_class->check_if_ready = desktop_icon_file_check_if_ready;
- file_class->get_item_count = desktop_icon_file_get_item_count;
- file_class->get_deep_counts = desktop_icon_file_get_deep_counts;
- file_class->get_date = desktop_icon_file_get_date;
- file_class->get_where_string = desktop_icon_file_get_where_string;
- file_class->set_metadata = nautilus_desktop_icon_file_set_metadata;
- file_class->set_metadata_as_list = nautilus_desktop_icon_file_set_metadata_as_list;
- file_class->unmount = nautilus_desktop_icon_file_unmount;
- file_class->eject = nautilus_desktop_icon_file_eject;
- file_class->can_rename = real_can_rename;
- file_class->rename = real_rename;
- file_class->get_target_uri = real_get_target_uri;
- file_class->drag_can_accept_files = real_drag_can_accept_files;
- file_class->invalidate_attributes_internal = real_invalidate_attributes_internal;
- file_class->opens_in_view = real_opens_in_view;
- file_class->is_special_link = real_is_special_link;
-
- g_type_class_add_private (object_class, sizeof (NautilusDesktopIconFileDetails));
-}
diff --git a/nautilus-desktop/nautilus-desktop-icon-file.h b/nautilus-desktop/nautilus-desktop-icon-file.h
deleted file mode 100644
index 4271af9c7..000000000
--- a/nautilus-desktop/nautilus-desktop-icon-file.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- nautilus-desktop-file.h: Subclass of NautilusFile to implement the
- the case of a desktop icon file
-
- Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
-
- Author: Alexander Larsson <alexl@redhat.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_ICON_FILE_H
-#define NAUTILUS_DESKTOP_ICON_FILE_H
-
-#include "nautilus-desktop-link.h"
-
-#include <src/nautilus-file.h>
-
-#define NAUTILUS_TYPE_DESKTOP_ICON_FILE nautilus_desktop_icon_file_get_type()
-#define NAUTILUS_DESKTOP_ICON_FILE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_ICON_FILE, NautilusDesktopIconFile))
-#define NAUTILUS_DESKTOP_ICON_FILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_ICON_FILE, NautilusDesktopIconFileClass))
-#define NAUTILUS_IS_DESKTOP_ICON_FILE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_ICON_FILE))
-#define NAUTILUS_IS_DESKTOP_ICON_FILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_ICON_FILE))
-#define NAUTILUS_DESKTOP_ICON_FILE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_ICON_FILE, NautilusDesktopIconFileClass))
-
-typedef struct NautilusDesktopIconFileDetails NautilusDesktopIconFileDetails;
-
-typedef struct {
- NautilusFile parent_slot;
- NautilusDesktopIconFileDetails *details;
-} NautilusDesktopIconFile;
-
-typedef struct {
- NautilusFileClass parent_slot;
-} NautilusDesktopIconFileClass;
-
-GType nautilus_desktop_icon_file_get_type (void);
-
-NautilusDesktopIconFile *nautilus_desktop_icon_file_new (NautilusDesktopLink *link);
-void nautilus_desktop_icon_file_update (NautilusDesktopIconFile *icon_file);
-void nautilus_desktop_icon_file_remove (NautilusDesktopIconFile *icon_file);
-NautilusDesktopLink *nautilus_desktop_icon_file_get_link (NautilusDesktopIconFile *icon_file);
-
-#endif /* NAUTILUS_DESKTOP_ICON_FILE_H */
diff --git a/nautilus-desktop/nautilus-desktop-link-monitor.c b/nautilus-desktop/nautilus-desktop-link-monitor.c
deleted file mode 100644
index 955150fa4..000000000
--- a/nautilus-desktop/nautilus-desktop-link-monitor.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * nautilus-desktop-link-monitor.c: singleton thatn manages the links
- *
- * Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include <config.h>
-#include "nautilus-desktop-link-monitor.h"
-#include "nautilus-desktop-link.h"
-#include "nautilus-desktop-icon-file.h"
-#include "nautilus-desktop-directory.h"
-
-#include <eel/eel-debug.h>
-#include <eel/eel-vfs-extensions.h>
-#include <eel/eel-stock-dialogs.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
-#include <src/nautilus-trash-monitor.h>
-#include <src/nautilus-global-preferences.h>
-#include <src/nautilus-directory.h>
-
-#include <string.h>
-
-struct NautilusDesktopLinkMonitorDetails
-{
- GVolumeMonitor *volume_monitor;
- NautilusDirectory *desktop_dir;
-
- NautilusDesktopLink *home_link;
- NautilusDesktopLink *trash_link;
- NautilusDesktopLink *network_link;
-
- GList *mount_links;
-};
-
-G_DEFINE_TYPE (NautilusDesktopLinkMonitor, nautilus_desktop_link_monitor, G_TYPE_OBJECT);
-
-static NautilusDesktopLinkMonitor *the_link_monitor = NULL;
-
-void
-nautilus_desktop_link_monitor_shutdown (void)
-{
- g_clear_object (&the_link_monitor);
-}
-
-NautilusDesktopLinkMonitor *
-nautilus_desktop_link_monitor_get (void)
-{
- if (the_link_monitor == NULL)
- {
- g_object_new (NAUTILUS_TYPE_DESKTOP_LINK_MONITOR, NULL);
- eel_debug_call_at_shutdown (nautilus_desktop_link_monitor_shutdown);
- }
- return the_link_monitor;
-}
-
-static gboolean
-volume_file_name_used (NautilusDesktopLinkMonitor *monitor,
- const char *name)
-{
- GList *l;
- char *other_name;
- gboolean same;
-
- for (l = monitor->details->mount_links; l != NULL; l = l->next)
- {
- other_name = nautilus_desktop_link_get_file_name (l->data);
- same = strcmp (name, other_name) == 0;
- g_free (other_name);
-
- if (same)
- {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-char *
-nautilus_desktop_link_monitor_make_filename_unique (NautilusDesktopLinkMonitor *monitor,
- const char *filename)
-{
- char *unique_name;
- int i;
-
- i = 2;
- unique_name = g_strdup (filename);
- while (volume_file_name_used (monitor, unique_name))
- {
- g_free (unique_name);
- unique_name = g_strdup_printf ("%s.%d", filename, i++);
- }
- return unique_name;
-}
-
-static gboolean
-has_mount (NautilusDesktopLinkMonitor *monitor,
- GMount *mount)
-{
- gboolean ret;
- GMount *other_mount;
- GList *l;
-
- ret = FALSE;
-
- for (l = monitor->details->mount_links; l != NULL; l = l->next)
- {
- other_mount = nautilus_desktop_link_get_mount (l->data);
- if (mount == other_mount)
- {
- g_object_unref (other_mount);
- ret = TRUE;
- break;
- }
- g_object_unref (other_mount);
- }
-
- return ret;
-}
-
-static void
-create_mount_link (NautilusDesktopLinkMonitor *monitor,
- GMount *mount)
-{
- NautilusDesktopLink *link;
-
- if (has_mount (monitor, mount))
- {
- return;
- }
-
- if ((!g_mount_is_shadowed (mount)) &&
- g_settings_get_boolean (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE))
- {
- link = nautilus_desktop_link_new_from_mount (mount);
- monitor->details->mount_links = g_list_prepend (monitor->details->mount_links, link);
- }
-}
-
-static void
-remove_mount_link (NautilusDesktopLinkMonitor *monitor,
- GMount *mount)
-{
- GList *l;
- NautilusDesktopLink *link;
- GMount *other_mount;
-
- link = NULL;
- for (l = monitor->details->mount_links; l != NULL; l = l->next)
- {
- other_mount = nautilus_desktop_link_get_mount (l->data);
- if (mount == other_mount)
- {
- g_object_unref (other_mount);
- link = l->data;
- break;
- }
- g_object_unref (other_mount);
- }
-
- if (link)
- {
- monitor->details->mount_links = g_list_remove (monitor->details->mount_links, link);
- g_object_unref (link);
- }
-}
-
-
-
-static void
-mount_added_callback (GVolumeMonitor *volume_monitor,
- GMount *mount,
- NautilusDesktopLinkMonitor *monitor)
-{
- create_mount_link (monitor, mount);
-}
-
-
-static void
-mount_removed_callback (GVolumeMonitor *volume_monitor,
- GMount *mount,
- NautilusDesktopLinkMonitor *monitor)
-{
- remove_mount_link (monitor, mount);
-}
-
-static void
-mount_changed_callback (GVolumeMonitor *volume_monitor,
- GMount *mount,
- NautilusDesktopLinkMonitor *monitor)
-{
- /* TODO: update the mount with other details */
-
- /* remove a mount if it goes into the shadows */
- if (g_mount_is_shadowed (mount) && has_mount (monitor, mount))
- {
- remove_mount_link (monitor, mount);
- }
-}
-
-static void
-update_link_visibility (NautilusDesktopLinkMonitor *monitor,
- NautilusDesktopLink **link_ref,
- NautilusDesktopLinkType link_type,
- const char *preference_key)
-{
- if (g_settings_get_boolean (nautilus_desktop_preferences, preference_key))
- {
- if (*link_ref == NULL)
- {
- *link_ref = nautilus_desktop_link_new (link_type);
- }
- }
- else
- {
- if (*link_ref != NULL)
- {
- g_object_unref (*link_ref);
- *link_ref = NULL;
- }
- }
-}
-
-static void
-desktop_home_visible_changed (gpointer callback_data)
-{
- NautilusDesktopLinkMonitor *monitor;
-
- monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
-
- update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (monitor),
- &monitor->details->home_link,
- NAUTILUS_DESKTOP_LINK_HOME,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE);
-}
-
-static void
-desktop_trash_visible_changed (gpointer callback_data)
-{
- NautilusDesktopLinkMonitor *monitor;
-
- monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
-
- update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data),
- &monitor->details->trash_link,
- NAUTILUS_DESKTOP_LINK_TRASH,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE);
-}
-
-static void
-desktop_network_visible_changed (gpointer callback_data)
-{
- NautilusDesktopLinkMonitor *monitor;
-
- monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
-
- update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data),
- &monitor->details->network_link,
- NAUTILUS_DESKTOP_LINK_NETWORK,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE);
-}
-
-static void
-desktop_volumes_visible_changed (gpointer callback_data)
-{
- NautilusDesktopLinkMonitor *monitor;
- GList *l, *mounts;
-
- monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data);
-
- if (g_settings_get_boolean (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE))
- {
- if (monitor->details->mount_links == NULL)
- {
- mounts = g_volume_monitor_get_mounts (monitor->details->volume_monitor);
- for (l = mounts; l != NULL; l = l->next)
- {
- create_mount_link (monitor, l->data);
- g_object_unref (l->data);
- }
- g_list_free (mounts);
- }
- }
- else
- {
- g_list_foreach (monitor->details->mount_links, (GFunc) g_object_unref, NULL);
- g_list_free (monitor->details->mount_links);
- monitor->details->mount_links = NULL;
- }
-}
-
-static void
-create_link_and_add_preference (NautilusDesktopLink **link_ref,
- NautilusDesktopLinkType link_type,
- const char *preference_key,
- GCallback callback,
- gpointer callback_data)
-{
- char *detailed_signal;
-
- if (g_settings_get_boolean (nautilus_desktop_preferences, preference_key))
- {
- *link_ref = nautilus_desktop_link_new (link_type);
- }
-
- detailed_signal = g_strconcat ("changed::", preference_key, NULL);
- g_signal_connect_swapped (nautilus_desktop_preferences,
- detailed_signal,
- callback, callback_data);
-
- g_free (detailed_signal);
-}
-
-static void
-nautilus_desktop_link_monitor_init (NautilusDesktopLinkMonitor *monitor)
-{
- GList *l, *mounts;
- GMount *mount;
-
- monitor->details = G_TYPE_INSTANCE_GET_PRIVATE (monitor, NAUTILUS_TYPE_DESKTOP_LINK_MONITOR,
- NautilusDesktopLinkMonitorDetails);
-
- the_link_monitor = monitor;
- monitor->details->volume_monitor = g_volume_monitor_get ();
-
- /* We keep around a ref to the desktop dir */
- monitor->details->desktop_dir = nautilus_directory_get_by_uri (EEL_DESKTOP_URI);
-
- /* Default links */
-
- create_link_and_add_preference (&monitor->details->home_link,
- NAUTILUS_DESKTOP_LINK_HOME,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE,
- G_CALLBACK (desktop_home_visible_changed),
- monitor);
-
- create_link_and_add_preference (&monitor->details->trash_link,
- NAUTILUS_DESKTOP_LINK_TRASH,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
- G_CALLBACK (desktop_trash_visible_changed),
- monitor);
-
- create_link_and_add_preference (&monitor->details->network_link,
- NAUTILUS_DESKTOP_LINK_NETWORK,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE,
- G_CALLBACK (desktop_network_visible_changed),
- monitor);
-
- /* Mount links */
-
- mounts = g_volume_monitor_get_mounts (monitor->details->volume_monitor);
- for (l = mounts; l != NULL; l = l->next)
- {
- mount = l->data;
- create_mount_link (monitor, mount);
- g_object_unref (mount);
- }
- g_list_free (mounts);
-
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE,
- G_CALLBACK (desktop_volumes_visible_changed),
- monitor);
-
- g_signal_connect_object (monitor->details->volume_monitor, "mount-added",
- G_CALLBACK (mount_added_callback), monitor, 0);
- g_signal_connect_object (monitor->details->volume_monitor, "mount-removed",
- G_CALLBACK (mount_removed_callback), monitor, 0);
- g_signal_connect_object (monitor->details->volume_monitor, "mount-changed",
- G_CALLBACK (mount_changed_callback), monitor, 0);
-}
-
-static void
-remove_link_and_preference (NautilusDesktopLink **link_ref,
- const char *preference_key,
- GCallback callback,
- gpointer callback_data)
-{
- if (*link_ref != NULL)
- {
- g_object_unref (*link_ref);
- *link_ref = NULL;
- }
-
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- callback, callback_data);
-}
-
-static void
-desktop_link_monitor_finalize (GObject *object)
-{
- NautilusDesktopLinkMonitor *monitor;
-
- monitor = NAUTILUS_DESKTOP_LINK_MONITOR (object);
-
- /* Default links */
-
- remove_link_and_preference (&monitor->details->home_link,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE,
- G_CALLBACK (desktop_home_visible_changed),
- monitor);
-
- remove_link_and_preference (&monitor->details->trash_link,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
- G_CALLBACK (desktop_trash_visible_changed),
- monitor);
-
- remove_link_and_preference (&monitor->details->network_link,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE,
- G_CALLBACK (desktop_network_visible_changed),
- monitor);
-
- /* Mounts */
-
- g_list_foreach (monitor->details->mount_links, (GFunc) g_object_unref, NULL);
- g_list_free (monitor->details->mount_links);
- monitor->details->mount_links = NULL;
-
- nautilus_directory_unref (monitor->details->desktop_dir);
- monitor->details->desktop_dir = NULL;
-
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- desktop_volumes_visible_changed,
- monitor);
-
- g_object_unref (monitor->details->volume_monitor);
-
- G_OBJECT_CLASS (nautilus_desktop_link_monitor_parent_class)->finalize (object);
-}
-
-static void
-nautilus_desktop_link_monitor_class_init (NautilusDesktopLinkMonitorClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = desktop_link_monitor_finalize;
-
- g_type_class_add_private (klass, sizeof (NautilusDesktopLinkMonitorDetails));
-}
diff --git a/nautilus-desktop/nautilus-desktop-link-monitor.h b/nautilus-desktop/nautilus-desktop-link-monitor.h
deleted file mode 100644
index 304f23910..000000000
--- a/nautilus-desktop/nautilus-desktop-link-monitor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- nautilus-desktop-link-monitor.h: singleton that manages the desktop links
-
- Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
-
- Author: Alexander Larsson <alexl@redhat.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_LINK_MONITOR_H
-#define NAUTILUS_DESKTOP_LINK_MONITOR_H
-
-#include <gtk/gtk.h>
-#include "nautilus-desktop-link.h"
-
-#define NAUTILUS_TYPE_DESKTOP_LINK_MONITOR nautilus_desktop_link_monitor_get_type()
-#define NAUTILUS_DESKTOP_LINK_MONITOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_LINK_MONITOR, NautilusDesktopLinkMonitor))
-#define NAUTILUS_DESKTOP_LINK_MONITOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_LINK_MONITOR, NautilusDesktopLinkMonitorClass))
-#define NAUTILUS_IS_DESKTOP_LINK_MONITOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_LINK_MONITOR))
-#define NAUTILUS_IS_DESKTOP_LINK_MONITOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_LINK_MONITOR))
-#define NAUTILUS_DESKTOP_LINK_MONITOR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_LINK_MONITOR, NautilusDesktopLinkMonitorClass))
-
-typedef struct NautilusDesktopLinkMonitorDetails NautilusDesktopLinkMonitorDetails;
-
-typedef struct {
- GObject parent_slot;
- NautilusDesktopLinkMonitorDetails *details;
-} NautilusDesktopLinkMonitor;
-
-typedef struct {
- GObjectClass parent_slot;
-} NautilusDesktopLinkMonitorClass;
-
-GType nautilus_desktop_link_monitor_get_type (void);
-
-NautilusDesktopLinkMonitor * nautilus_desktop_link_monitor_get (void);
-void nautilus_desktop_link_monitor_shutdown (void);
-
-/* Used by nautilus-desktop-link.c */
-char * nautilus_desktop_link_monitor_make_filename_unique (NautilusDesktopLinkMonitor *monitor,
- const char *filename);
-
-#endif /* NAUTILUS_DESKTOP_LINK_MONITOR_H */
diff --git a/nautilus-desktop/nautilus-desktop-link.c b/nautilus-desktop/nautilus-desktop-link.c
deleted file mode 100644
index e10d6c4e7..000000000
--- a/nautilus-desktop/nautilus-desktop-link.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * nautilus-desktop-link.c: Class that handles the links on the desktop
- *
- * Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include <config.h>
-
-#include "nautilus-desktop-link.h"
-#include "nautilus-desktop-link-monitor.h"
-#include "nautilus-desktop-icon-file.h"
-#include "nautilus-directory-private.h"
-#include "nautilus-desktop-directory.h"
-
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-trash-monitor.h>
-#include <src/nautilus-global-preferences.h>
-#include <src/nautilus-icon-names.h>
-
-#include <string.h>
-
-struct NautilusDesktopLinkDetails
-{
- NautilusDesktopLinkType type;
- char *filename;
- char *display_name;
- GFile *activation_location;
- GIcon *icon;
-
- NautilusDesktopIconFile *icon_file;
-
- /* Just for mount icons: */
- GMount *mount;
-};
-
-G_DEFINE_TYPE (NautilusDesktopLink, nautilus_desktop_link, G_TYPE_OBJECT)
-
-static void
-create_icon_file (NautilusDesktopLink *link)
-{
- link->details->icon_file = nautilus_desktop_icon_file_new (link);
-}
-
-static void
-nautilus_desktop_link_changed (NautilusDesktopLink *link)
-{
- if (link->details->icon_file != NULL)
- {
- nautilus_desktop_icon_file_update (link->details->icon_file);
- }
-}
-
-static void
-mount_changed_callback (GMount *mount,
- NautilusDesktopLink *link)
-{
- g_free (link->details->display_name);
- if (link->details->activation_location)
- {
- g_object_unref (link->details->activation_location);
- }
- if (link->details->icon)
- {
- g_object_unref (link->details->icon);
- }
-
- link->details->display_name = g_mount_get_name (mount);
- link->details->activation_location = g_mount_get_default_location (mount);
- link->details->icon = g_mount_get_icon (mount);
-
- nautilus_desktop_link_changed (link);
-}
-
-static GIcon *
-get_desktop_trash_icon (void)
-{
- const gchar *icon_name;
-
- if (nautilus_trash_monitor_is_empty ())
- {
- icon_name = NAUTILUS_DESKTOP_ICON_TRASH;
- }
- else
- {
- icon_name = NAUTILUS_DESKTOP_ICON_TRASH_FULL;
- }
-
- return g_themed_icon_new (icon_name);
-}
-
-static void
-trash_state_changed_callback (NautilusTrashMonitor *trash_monitor,
- gboolean state,
- gpointer callback_data)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (callback_data);
- g_assert (link->details->type == NAUTILUS_DESKTOP_LINK_TRASH);
-
- if (link->details->icon)
- {
- g_object_unref (link->details->icon);
- }
- link->details->icon = get_desktop_trash_icon ();
-
- nautilus_desktop_link_changed (link);
-}
-
-static void
-home_name_changed (gpointer callback_data)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (callback_data);
- g_assert (link->details->type == NAUTILUS_DESKTOP_LINK_HOME);
-
- g_free (link->details->display_name);
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME);
- if (link->details->display_name[0] == 0)
- {
- g_free (link->details->display_name);
- link->details->display_name = g_strdup (_("Home"));
- }
-
- nautilus_desktop_link_changed (link);
-}
-
-static void
-trash_name_changed (gpointer callback_data)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (callback_data);
- g_assert (link->details->type == NAUTILUS_DESKTOP_LINK_TRASH);
-
- g_free (link->details->display_name);
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME);
- nautilus_desktop_link_changed (link);
-}
-
-static void
-network_name_changed (gpointer callback_data)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (callback_data);
- g_assert (link->details->type == NAUTILUS_DESKTOP_LINK_NETWORK);
-
- g_free (link->details->display_name);
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME);
- nautilus_desktop_link_changed (link);
-}
-
-NautilusDesktopLink *
-nautilus_desktop_link_new (NautilusDesktopLinkType type)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (g_object_new (NAUTILUS_TYPE_DESKTOP_LINK, NULL));
-
- link->details->type = type;
- switch (type)
- {
- case NAUTILUS_DESKTOP_LINK_HOME:
- {
- link->details->filename = g_strdup ("home");
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME);
- link->details->activation_location = g_file_new_for_path (g_get_home_dir ());
- link->details->icon = g_themed_icon_new (NAUTILUS_DESKTOP_ICON_HOME);
-
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME,
- G_CALLBACK (home_name_changed),
- link);
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_TRASH:
- {
- link->details->filename = g_strdup ("trash");
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME);
- link->details->activation_location = g_file_new_for_uri (EEL_TRASH_URI);
- link->details->icon = get_desktop_trash_icon ();
-
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME,
- G_CALLBACK (trash_name_changed),
- link);
- g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed",
- G_CALLBACK (trash_state_changed_callback), link, 0);
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_NETWORK:
- {
- link->details->filename = g_strdup ("network");
- link->details->display_name = g_settings_get_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME);
- link->details->activation_location = g_file_new_for_uri ("network:///");
- link->details->icon = g_themed_icon_new (NAUTILUS_DESKTOP_ICON_NETWORK);
-
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME,
- G_CALLBACK (network_name_changed),
- link);
- }
- break;
-
- default:
- case NAUTILUS_DESKTOP_LINK_MOUNT:
- {
- g_assert_not_reached ();
- }
- break;
- }
-
- create_icon_file (link);
-
- return link;
-}
-
-NautilusDesktopLink *
-nautilus_desktop_link_new_from_mount (GMount *mount)
-{
- NautilusDesktopLink *link;
- GVolume *volume;
- char *name, *filename;
-
- link = NAUTILUS_DESKTOP_LINK (g_object_new (NAUTILUS_TYPE_DESKTOP_LINK, NULL));
-
- link->details->type = NAUTILUS_DESKTOP_LINK_MOUNT;
-
- link->details->mount = g_object_ref (mount);
-
- /* We try to use the drive name to get somewhat stable filenames
- * for metadata */
- volume = g_mount_get_volume (mount);
- if (volume != NULL)
- {
- name = g_volume_get_name (volume);
- g_object_unref (volume);
- }
- else
- {
- name = g_mount_get_name (mount);
- }
-
- /* Replace slashes in name */
- filename = g_strconcat (g_strdelimit (name, "/", '-'), ".volume", NULL);
- link->details->filename =
- nautilus_desktop_link_monitor_make_filename_unique (nautilus_desktop_link_monitor_get (),
- filename);
- g_free (filename);
- g_free (name);
-
- link->details->display_name = g_mount_get_name (mount);
-
- link->details->activation_location = g_mount_get_default_location (mount);
- link->details->icon = g_mount_get_icon (mount);
-
- g_signal_connect_object (mount, "changed",
- G_CALLBACK (mount_changed_callback), link, 0);
-
- create_icon_file (link);
-
- return link;
-}
-
-GMount *
-nautilus_desktop_link_get_mount (NautilusDesktopLink *link)
-{
- if (link->details->mount)
- {
- return g_object_ref (link->details->mount);
- }
- return NULL;
-}
-
-NautilusDesktopLinkType
-nautilus_desktop_link_get_link_type (NautilusDesktopLink *link)
-{
- return link->details->type;
-}
-
-char *
-nautilus_desktop_link_get_file_name (NautilusDesktopLink *link)
-{
- return g_strdup (link->details->filename);
-}
-
-char *
-nautilus_desktop_link_get_display_name (NautilusDesktopLink *link)
-{
- return g_strdup (link->details->display_name);
-}
-
-GIcon *
-nautilus_desktop_link_get_icon (NautilusDesktopLink *link)
-{
- if (link->details->icon != NULL)
- {
- return g_object_ref (link->details->icon);
- }
- return NULL;
-}
-
-GFile *
-nautilus_desktop_link_get_activation_location (NautilusDesktopLink *link)
-{
- if (link->details->activation_location)
- {
- return g_object_ref (link->details->activation_location);
- }
- return NULL;
-}
-
-char *
-nautilus_desktop_link_get_activation_uri (NautilusDesktopLink *link)
-{
- if (link->details->activation_location)
- {
- return g_file_get_uri (link->details->activation_location);
- }
- return NULL;
-}
-
-
-gboolean
-nautilus_desktop_link_get_date (NautilusDesktopLink *link,
- NautilusDateType date_type,
- time_t *date)
-{
- return FALSE;
-}
-
-gboolean
-nautilus_desktop_link_can_rename (NautilusDesktopLink *link)
-{
- return (link->details->type == NAUTILUS_DESKTOP_LINK_HOME ||
- link->details->type == NAUTILUS_DESKTOP_LINK_TRASH ||
- link->details->type == NAUTILUS_DESKTOP_LINK_NETWORK);
-}
-
-gboolean
-nautilus_desktop_link_rename (NautilusDesktopLink *link,
- const char *name)
-{
- switch (link->details->type)
- {
- case NAUTILUS_DESKTOP_LINK_HOME:
- {
- g_settings_set_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME,
- name);
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_TRASH:
- {
- g_settings_set_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME,
- name);
- }
- break;
-
- case NAUTILUS_DESKTOP_LINK_NETWORK:
- {
- g_settings_set_string (nautilus_desktop_preferences,
- NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME,
- name);
- }
- break;
-
- default:
- {
- g_assert_not_reached ();
- /* FIXME: Do we want volume renaming?
- * We didn't support that before. */
- }
- break;
- }
-
- return TRUE;
-}
-
-static void
-nautilus_desktop_link_init (NautilusDesktopLink *link)
-{
- link->details = G_TYPE_INSTANCE_GET_PRIVATE (link,
- NAUTILUS_TYPE_DESKTOP_LINK,
- NautilusDesktopLinkDetails);
-}
-
-static void
-desktop_link_finalize (GObject *object)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (object);
-
- if (link->details->icon_file != NULL)
- {
- nautilus_desktop_icon_file_remove (link->details->icon_file);
- nautilus_file_unref (NAUTILUS_FILE (link->details->icon_file));
- link->details->icon_file = NULL;
- }
-
- if (link->details->type == NAUTILUS_DESKTOP_LINK_HOME)
- {
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- home_name_changed,
- link);
- }
-
- if (link->details->type == NAUTILUS_DESKTOP_LINK_TRASH)
- {
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- trash_name_changed,
- link);
- }
-
- if (link->details->type == NAUTILUS_DESKTOP_LINK_NETWORK)
- {
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- network_name_changed,
- link);
- }
-
- if (link->details->type == NAUTILUS_DESKTOP_LINK_MOUNT)
- {
- g_object_unref (link->details->mount);
- }
-
- g_free (link->details->filename);
- g_free (link->details->display_name);
- if (link->details->activation_location)
- {
- g_object_unref (link->details->activation_location);
- }
- if (link->details->icon)
- {
- g_object_unref (link->details->icon);
- }
-
- G_OBJECT_CLASS (nautilus_desktop_link_parent_class)->finalize (object);
-}
-
-static void
-nautilus_desktop_link_class_init (NautilusDesktopLinkClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = desktop_link_finalize;
-
- g_type_class_add_private (object_class, sizeof (NautilusDesktopLinkDetails));
-}
diff --git a/nautilus-desktop/nautilus-desktop-link.h b/nautilus-desktop/nautilus-desktop-link.h
deleted file mode 100644
index f3bcfc604..000000000
--- a/nautilus-desktop/nautilus-desktop-link.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- nautilus-desktop-link.h: Class that handles the links on the desktop
-
- Copyright (C) 2003 Red Hat, 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, see <http://www.gnu.org/licenses/>.
-
- Author: Alexander Larsson <alexl@redhat.com>
-*/
-
-#ifndef NAUTILUS_DESKTOP_LINK_H
-#define NAUTILUS_DESKTOP_LINK_H
-
-#include <src/nautilus-file.h>
-#include <gio/gio.h>
-
-#define NAUTILUS_TYPE_DESKTOP_LINK nautilus_desktop_link_get_type()
-#define NAUTILUS_DESKTOP_LINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_LINK, NautilusDesktopLink))
-#define NAUTILUS_DESKTOP_LINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_LINK, NautilusDesktopLinkClass))
-#define NAUTILUS_IS_DESKTOP_LINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_LINK))
-#define NAUTILUS_IS_DESKTOP_LINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_LINK))
-#define NAUTILUS_DESKTOP_LINK_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_LINK, NautilusDesktopLinkClass))
-
-typedef struct NautilusDesktopLinkDetails NautilusDesktopLinkDetails;
-
-typedef struct {
- GObject parent_slot;
- NautilusDesktopLinkDetails *details;
-} NautilusDesktopLink;
-
-typedef struct {
- GObjectClass parent_slot;
-} NautilusDesktopLinkClass;
-
-typedef enum {
- NAUTILUS_DESKTOP_LINK_HOME,
- NAUTILUS_DESKTOP_LINK_TRASH,
- NAUTILUS_DESKTOP_LINK_MOUNT,
- NAUTILUS_DESKTOP_LINK_NETWORK
-} NautilusDesktopLinkType;
-
-GType nautilus_desktop_link_get_type (void);
-
-NautilusDesktopLink * nautilus_desktop_link_new (NautilusDesktopLinkType type);
-NautilusDesktopLink * nautilus_desktop_link_new_from_mount (GMount *mount);
-NautilusDesktopLinkType nautilus_desktop_link_get_link_type (NautilusDesktopLink *link);
-char * nautilus_desktop_link_get_file_name (NautilusDesktopLink *link);
-char * nautilus_desktop_link_get_display_name (NautilusDesktopLink *link);
-GIcon * nautilus_desktop_link_get_icon (NautilusDesktopLink *link);
-GFile * nautilus_desktop_link_get_activation_location (NautilusDesktopLink *link);
-char * nautilus_desktop_link_get_activation_uri (NautilusDesktopLink *link);
-gboolean nautilus_desktop_link_get_date (NautilusDesktopLink *link,
- NautilusDateType date_type,
- time_t *date);
-GMount * nautilus_desktop_link_get_mount (NautilusDesktopLink *link);
-gboolean nautilus_desktop_link_can_rename (NautilusDesktopLink *link);
-gboolean nautilus_desktop_link_rename (NautilusDesktopLink *link,
- const char *name);
-
-
-#endif /* NAUTILUS_DESKTOP_LINK_H */
diff --git a/nautilus-desktop/nautilus-desktop-metadata.c b/nautilus-desktop/nautilus-desktop-metadata.c
deleted file mode 100644
index 99d5ffb93..000000000
--- a/nautilus-desktop/nautilus-desktop-metadata.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Nautilus
- *
- * Copyright (C) 2011 Red Hat, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <cosimoc@redhat.com>
- */
-
-#include <config.h>
-
-#include "nautilus-desktop-metadata.h"
-
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-keyfile-metadata.h>
-
-static gchar *
-get_keyfile_path (void)
-{
- gchar *xdg_dir, *retval;
-
- xdg_dir = nautilus_get_user_directory ();
- retval = g_build_filename (xdg_dir, "desktop-metadata", NULL);
-
- g_free (xdg_dir);
-
- return retval;
-}
-
-void
-nautilus_desktop_set_metadata_string (NautilusFile *file,
- const gchar *name,
- const gchar *key,
- const gchar *string)
-{
- gchar *keyfile_filename;
-
- keyfile_filename = get_keyfile_path ();
-
- nautilus_keyfile_metadata_set_string (file, keyfile_filename,
- name, key, string);
-
- g_free (keyfile_filename);
-}
-
-void
-nautilus_desktop_set_metadata_stringv (NautilusFile *file,
- const char *name,
- const char *key,
- const char * const *stringv)
-{
- gchar *keyfile_filename;
-
- keyfile_filename = get_keyfile_path ();
-
- nautilus_keyfile_metadata_set_stringv (file, keyfile_filename,
- name, key, stringv);
-
- g_free (keyfile_filename);
-}
-
-gboolean
-nautilus_desktop_update_metadata_from_keyfile (NautilusFile *file,
- const gchar *name)
-{
- gchar *keyfile_filename;
- gboolean result;
-
- keyfile_filename = get_keyfile_path ();
-
- result = nautilus_keyfile_metadata_update_from_keyfile (file,
- keyfile_filename,
- name);
-
- g_free (keyfile_filename);
- return result;
-}
diff --git a/nautilus-desktop/nautilus-desktop-metadata.h b/nautilus-desktop/nautilus-desktop-metadata.h
deleted file mode 100644
index 55b25d132..000000000
--- a/nautilus-desktop/nautilus-desktop-metadata.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Nautilus
- *
- * Copyright (C) 2011 Red Hat, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * see <http://www.gnu.org/licenses/>.
- *
- * Authors: Cosimo Cecchi <cosimoc@redhat.com>
- */
-
-#ifndef __NAUTILUS_DESKTOP_METADATA_H__
-#define __NAUTILUS_DESKTOP_METADATA_H__
-
-#include <glib.h>
-
-#include <src/nautilus-file.h>
-
-void nautilus_desktop_set_metadata_string (NautilusFile *file,
- const gchar *name,
- const gchar *key,
- const gchar *string);
-
-void nautilus_desktop_set_metadata_stringv (NautilusFile *file,
- const char *name,
- const char *key,
- const char * const *stringv);
-
-gboolean nautilus_desktop_update_metadata_from_keyfile (NautilusFile *file,
- const gchar *name);
-
-#endif /* __NAUTILUS_DESKTOP_METADATA_H__ */
diff --git a/nautilus-desktop/nautilus-desktop-window-slot.c b/nautilus-desktop/nautilus-desktop-window-slot.c
deleted file mode 100644
index b7633cec2..000000000
--- a/nautilus-desktop/nautilus-desktop-window-slot.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* nautilus-desktop-window-slot.c
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include "nautilus-desktop-window-slot.h"
-#include "nautilus-desktop-canvas-view.h"
-
-struct _NautilusDesktopWindowSlot
-{
- NautilusWindowSlot parent_instance;
-};
-
-G_DEFINE_TYPE (NautilusDesktopWindowSlot, nautilus_desktop_window_slot, NAUTILUS_TYPE_WINDOW_SLOT)
-
-static NautilusView *
-real_get_view_for_location (NautilusWindowSlot *self,
- GFile *location)
-{
- return NAUTILUS_VIEW (nautilus_desktop_canvas_view_new (self));
-}
-
-NautilusDesktopWindowSlot *
-nautilus_desktop_window_slot_new (NautilusWindow *window)
-{
- return g_object_new (NAUTILUS_TYPE_DESKTOP_WINDOW_SLOT,
- "window", window,
- NULL);
-}
-
-static void
-nautilus_desktop_window_slot_class_init (NautilusDesktopWindowSlotClass *klass)
-{
- NautilusWindowSlotClass *parent_class = NAUTILUS_WINDOW_SLOT_CLASS (klass);
-
- parent_class->get_view_for_location = real_get_view_for_location;
-}
-
-static void
-nautilus_desktop_window_slot_init (NautilusDesktopWindowSlot *self)
-{
- GAction *action;
- GActionGroup *action_group;
-
- /* Disable search on desktop */
- action_group = gtk_widget_get_action_group (GTK_WIDGET (self), "slot");
-
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "search-visible");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
-
- /* Disable the ability to change between types of views */
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode-toggle");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
-}
diff --git a/nautilus-desktop/nautilus-desktop-window-slot.h b/nautilus-desktop/nautilus-desktop-window-slot.h
deleted file mode 100644
index fcc64afba..000000000
--- a/nautilus-desktop/nautilus-desktop-window-slot.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* nautilus-window-desktop-slot.h
- *
- * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-#ifndef NAUTILUS_DESKTOP_WINDOW_SLOT_H
-#define NAUTILUS_DESKTOP_WINDOW_SLOT_H
-
-#include <src/nautilus-window-slot.h>
-#include <src/nautilus-window.h>
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_DESKTOP_WINDOW_SLOT (nautilus_desktop_window_slot_get_type())
-
-G_DECLARE_FINAL_TYPE (NautilusDesktopWindowSlot, nautilus_desktop_window_slot, NAUTILUS, DESKTOP_WINDOW_SLOT, NautilusWindowSlot)
-
-
-NautilusDesktopWindowSlot *nautilus_desktop_window_slot_new (NautilusWindow *window);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_DESKTOP_WINDOW_SLOT_H */
-
diff --git a/nautilus-desktop/nautilus-desktop-window.c b/nautilus-desktop/nautilus-desktop-window.c
deleted file mode 100644
index f35c849c6..000000000
--- a/nautilus-desktop/nautilus-desktop-window.c
+++ /dev/null
@@ -1,533 +0,0 @@
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Darin Adler <darin@bentspoon.com>
- */
-
-#include <config.h>
-
-#include "nautilus-desktop-window.h"
-#include "nautilus-desktop-window-slot.h"
-#include "nautilus-desktop-link-monitor.h"
-
-#include <X11/Xatom.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <gio/gio.h>
-#include <glib/gi18n.h>
-
-#define GNOME_DESKTOP_USE_UNSTABLE_API
-#include <libgnome-desktop/gnome-bg.h>
-
-#include <eel/eel-vfs-extensions.h>
-#include <src/nautilus-file-utilities.h>
-#include <src/nautilus-icon-names.h>
-#include <src/nautilus-global-preferences.h>
-#include <src/nautilus-window.h>
-#include <src/nautilus-application.h>
-
-struct NautilusDesktopWindowDetails
-{
- gulong size_changed_id;
-
- gboolean loaded;
-
- GtkWidget *desktop_selection;
-
- gboolean composited;
- cairo_surface_t *surface;
-};
-
-G_DEFINE_TYPE (NautilusDesktopWindow, nautilus_desktop_window,
- NAUTILUS_TYPE_WINDOW);
-
-static void
-background_changed (NautilusDesktopWindow *window)
-{
- GtkWidget *widget = GTK_WIDGET (window);
- GdkScreen *screen = gtk_widget_get_screen (widget);
-
- g_clear_pointer (&window->details->surface, cairo_surface_destroy);
-
- window->details->surface = gnome_bg_get_surface_from_root (screen);
- gtk_widget_queue_draw (widget);
-}
-
-static GdkFilterReturn
-filter_func (GdkXEvent *xevent,
- GdkEvent *event,
- NautilusDesktopWindow *window)
-{
- XEvent *xev = (XEvent *) xevent;
- GdkAtom gdkatom;
-
- if (xev->type != PropertyNotify)
- {
- return GDK_FILTER_CONTINUE;
- }
-
- gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID");
- if (xev->xproperty.atom != gdk_x11_atom_to_xatom (gdkatom))
- {
- return GDK_FILTER_CONTINUE;
- }
-
- background_changed (window);
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-nautilus_desktop_window_composited_changed (GtkWidget *widget)
-{
- NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (widget);
- GdkScreen *screen = gtk_widget_get_screen (widget);
- gboolean composited = gdk_screen_is_composited (screen);
- GdkWindow *root;
- gint events;
-
- if (window->details->composited == composited)
- {
- return;
- }
-
- window->details->composited = composited;
- root = gdk_screen_get_root_window (screen);
-
- if (composited)
- {
- gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window);
-
- g_clear_pointer (&window->details->surface, cairo_surface_destroy);
- }
- else
- {
- events = gdk_window_get_events (root);
-
- gdk_window_set_events (root, events | GDK_PROPERTY_CHANGE_MASK);
- gdk_window_add_filter (root, (GdkFilterFunc) filter_func, window);
- background_changed (window);
- }
-}
-
-static gboolean
-nautilus_desktop_window_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (widget);
-
- if (window->details->surface)
- {
- cairo_set_source_surface (cr, window->details->surface, 0, 0);
- cairo_paint (cr);
- }
-
- return GTK_WIDGET_CLASS (nautilus_desktop_window_parent_class)->draw (widget, cr);
-}
-
-static void
-nautilus_desktop_window_update_directory (NautilusDesktopWindow *window)
-{
- GFile *location;
-
- g_assert (NAUTILUS_IS_DESKTOP_WINDOW (window));
-
- window->details->loaded = FALSE;
- location = g_file_new_for_uri (EEL_DESKTOP_URI);
- /* We use NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE so the nautilus-window
- * doesn't call gtk_window_present () which raises the window on the stack
- * and actually hides it from the background */
- nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
- location,
- NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE,
- NULL, NAUTILUS_WINDOW (window), NULL);
- window->details->loaded = TRUE;
-
- g_object_unref (location);
-}
-
-static void
-nautilus_desktop_window_finalize (GObject *obj)
-{
- NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (obj);
- GdkScreen *screen;
- GdkWindow *root;
-
- nautilus_desktop_link_monitor_shutdown ();
-
- if (window->details->composited == FALSE)
- {
- screen = gtk_widget_get_screen (GTK_WIDGET (window));
- root = gdk_screen_get_root_window (screen);
-
- gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window);
- }
-
- g_clear_pointer (&window->details->surface, cairo_surface_destroy);
-
- G_OBJECT_CLASS (nautilus_desktop_window_parent_class)->finalize (obj);
-}
-
-static void
-nautilus_desktop_window_init_actions (NautilusDesktopWindow *window)
-{
- GAction *action;
-
- /* Don't allow close action on desktop */
- action = g_action_map_lookup_action (G_ACTION_MAP (window),
- "close-current-view");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
-
- /* Don't allow new tab on desktop */
- action = g_action_map_lookup_action (G_ACTION_MAP (window),
- "new-tab");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
-
- /* Don't allow switching to home dir on desktop */
- action = g_action_map_lookup_action (G_ACTION_MAP (window),
- "go-home");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
-}
-
-static void
-selection_get_cb (GtkWidget *widget,
- GtkSelectionData *selection_data,
- guint info,
- guint time)
-{
- /* No extra targets atm */
-}
-
-static gboolean
-selection_clear_event_cb (GtkWidget *widget,
- GdkEventSelection *event,
- NautilusDesktopWindow *window)
-{
- gtk_widget_destroy (GTK_WIDGET (window));
-
- return TRUE;
-}
-
-static void
-nautilus_desktop_window_init_selection (NautilusDesktopWindow *window)
-{
- char selection_name[32];
- GdkAtom selection_atom;
- Window selection_owner;
- GdkDisplay *display;
- GtkWidget *selection_widget;
- GdkScreen *screen;
-
- screen = gdk_screen_get_default ();
-
- g_snprintf (selection_name, sizeof (selection_name),
- "_NET_DESKTOP_MANAGER_S%d", gdk_screen_get_number (screen));
- selection_atom = gdk_atom_intern (selection_name, FALSE);
- display = gdk_screen_get_display (screen);
-
- selection_owner = XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
- gdk_x11_atom_to_xatom_for_display (display,
- selection_atom));
- if (selection_owner != None)
- {
- g_critical ("Another desktop manager in use; desktop window won't be created");
- return;
- }
-
- selection_widget = gtk_invisible_new_for_screen (screen);
- /* We need this for gdk_x11_get_server_time() */
- gtk_widget_add_events (selection_widget, GDK_PROPERTY_CHANGE_MASK);
-
- if (!gtk_selection_owner_set_for_display (display,
- selection_widget,
- selection_atom,
- gdk_x11_get_server_time (gtk_widget_get_window (selection_widget))))
- {
- gtk_widget_destroy (selection_widget);
- g_critical ("Can't set ourselves as selection owner for desktop manager; "
- "desktop window won't be created");
- return;
- }
-
- g_signal_connect (selection_widget, "selection-get",
- G_CALLBACK (selection_get_cb), window);
- g_signal_connect (selection_widget, "selection-clear-event",
- G_CALLBACK (selection_clear_event_cb), window);
-
- window->details->desktop_selection = selection_widget;
-}
-
-static void
-nautilus_desktop_window_constructed (GObject *obj)
-{
- AtkObject *accessible;
- NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (obj);
-
- G_OBJECT_CLASS (nautilus_desktop_window_parent_class)->constructed (obj);
-
- /* Initialize the desktop link monitor singleton */
- nautilus_desktop_link_monitor_get ();
-
- /* shouldn't really be needed given our semantic type
- * of _NET_WM_TYPE_DESKTOP, but why not
- */
- gtk_window_set_resizable (GTK_WINDOW (window),
- FALSE);
- gtk_window_set_decorated (GTK_WINDOW (window),
- FALSE);
-
- gtk_window_move (GTK_WINDOW (window), 0, 0);
-
- g_object_set_data (G_OBJECT (window), "is_desktop_window",
- GINT_TO_POINTER (1));
-
- nautilus_desktop_window_init_selection (window);
- nautilus_desktop_window_init_actions (window);
-
- if (window->details->desktop_selection != NULL)
- {
- /* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */
- accessible = gtk_widget_get_accessible (GTK_WIDGET (window));
-
- if (accessible)
- {
- atk_object_set_name (accessible, _("Desktop"));
- }
-
- /* Special sawmill setting */
- gtk_window_set_wmclass (GTK_WINDOW (window), "desktop_window", "Nautilus");
-
- /* Point window at the desktop folder.
- * Note that nautilus_desktop_window_init is too early to do this.
- */
- nautilus_desktop_window_update_directory (window);
-
- /* We realize it immediately so that the NAUTILUS_DESKTOP_WINDOW_ID
- * property is set so gnome-settings-daemon doesn't try to set
- * background. And we do a gdk_flush() to be sure X gets it.
- */
- gtk_widget_realize (GTK_WIDGET (window));
- gdk_flush ();
- }
-}
-
-static void
-nautilus_desktop_window_init (NautilusDesktopWindow *window)
-{
- GtkWidget *widget = GTK_WIDGET (window);
-
- window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, NAUTILUS_TYPE_DESKTOP_WINDOW,
- NautilusDesktopWindowDetails);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)),
- "nautilus-desktop-window");
-
- window->details->composited = TRUE;
- nautilus_desktop_window_composited_changed (widget);
-}
-
-static void
-nautilus_desktop_window_screen_size_changed (GdkScreen *screen,
- NautilusDesktopWindow *window)
-{
- int width_request, height_request;
-
- width_request = gdk_screen_get_width (screen);
- height_request = gdk_screen_get_height (screen);
-
- g_object_set (window,
- "width_request", width_request,
- "height_request", height_request,
- NULL);
-}
-
-static NautilusDesktopWindow *
-nautilus_desktop_window_new (void)
-{
- GdkScreen *screen;
- GApplication *application;
- NautilusDesktopWindow *window;
- int width_request, height_request;
-
- application = g_application_get_default ();
- screen = gdk_screen_get_default ();
- width_request = gdk_screen_get_width (screen);
- height_request = gdk_screen_get_height (screen);
-
- window = g_object_new (NAUTILUS_TYPE_DESKTOP_WINDOW,
- "application", application,
- "disable-chrome", TRUE,
- "width_request", width_request,
- "height_request", height_request,
- NULL);
-
- return window;
-}
-
-static NautilusDesktopWindow *the_desktop_window = NULL;
-
-void
-nautilus_desktop_window_ensure (void)
-{
- NautilusDesktopWindow *window;
-
- if (!the_desktop_window)
- {
- window = nautilus_desktop_window_new ();
- g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &the_desktop_window);
- the_desktop_window = window;
- }
-}
-
-GtkWidget *
-nautilus_desktop_window_get (void)
-{
- return GTK_WIDGET (the_desktop_window);
-}
-
-static gboolean
-nautilus_desktop_window_delete_event (GtkWidget *widget,
- GdkEventAny *event)
-{
- /* Returning true tells GTK+ not to delete the window. */
- return TRUE;
-}
-
-static void
-map (GtkWidget *widget)
-{
- /* Chain up to realize our children */
- GTK_WIDGET_CLASS (nautilus_desktop_window_parent_class)->map (widget);
- gdk_window_lower (gtk_widget_get_window (widget));
-}
-
-static void
-unrealize (GtkWidget *widget)
-{
- NautilusDesktopWindow *window;
- NautilusDesktopWindowDetails *details;
-
- window = NAUTILUS_DESKTOP_WINDOW (widget);
- details = window->details;
-
- if (details->size_changed_id != 0)
- {
- g_signal_handler_disconnect (gtk_window_get_screen (GTK_WINDOW (window)),
- details->size_changed_id);
- details->size_changed_id = 0;
- }
-
- gtk_widget_destroy (details->desktop_selection);
-
- GTK_WIDGET_CLASS (nautilus_desktop_window_parent_class)->unrealize (widget);
-}
-
-static void
-set_wmspec_desktop_hint (GdkWindow *window)
-{
- GdkAtom atom;
-
- atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_DESKTOP", FALSE);
-
- gdk_property_change (window,
- gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE),
- gdk_x11_xatom_to_atom (XA_ATOM), 32,
- GDK_PROP_MODE_REPLACE, (guchar *) &atom, 1);
-}
-
-static void
-realize (GtkWidget *widget)
-{
- NautilusDesktopWindow *window;
- NautilusDesktopWindowDetails *details;
- GdkVisual *visual;
-
- window = NAUTILUS_DESKTOP_WINDOW (widget);
- details = window->details;
-
- /* Make sure we get keyboard events */
- gtk_widget_set_events (widget, gtk_widget_get_events (widget)
- | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
-
- visual = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget));
- if (visual)
- {
- gtk_widget_set_visual (widget, visual);
- }
-
- /* Do the work of realizing. */
- GTK_WIDGET_CLASS (nautilus_desktop_window_parent_class)->realize (widget);
-
- /* This is the new way to set up the desktop window */
- set_wmspec_desktop_hint (gtk_widget_get_window (widget));
-
- details->size_changed_id =
- g_signal_connect (gtk_window_get_screen (GTK_WINDOW (window)), "size-changed",
- G_CALLBACK (nautilus_desktop_window_screen_size_changed), window);
-}
-
-static void
-real_sync_title (NautilusWindow *window,
- NautilusWindowSlot *slot)
-{
- /* hardcode "Desktop" */
- gtk_window_set_title (GTK_WINDOW (window), _("Desktop"));
-}
-
-static void
-real_window_close (NautilusWindow *window)
-{
- /* stub, does nothing */
- return;
-}
-
-static NautilusWindowSlot *
-real_create_slot (NautilusWindow *window,
- GFile *location)
-{
- return NAUTILUS_WINDOW_SLOT (nautilus_desktop_window_slot_new (window));
-}
-
-static void
-nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
-{
- GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
- NautilusWindowClass *nclass = NAUTILUS_WINDOW_CLASS (klass);
- GObjectClass *oclass = G_OBJECT_CLASS (klass);
-
- oclass->constructed = nautilus_desktop_window_constructed;
- oclass->finalize = nautilus_desktop_window_finalize;
-
- wclass->realize = realize;
- wclass->unrealize = unrealize;
- wclass->map = map;
- wclass->delete_event = nautilus_desktop_window_delete_event;
- wclass->composited_changed = nautilus_desktop_window_composited_changed;
- wclass->draw = nautilus_desktop_window_draw;
-
- nclass->sync_title = real_sync_title;
- nclass->close = real_window_close;
- nclass->create_slot = real_create_slot;
-
- g_type_class_add_private (klass, sizeof (NautilusDesktopWindowDetails));
-}
-
-gboolean
-nautilus_desktop_window_loaded (NautilusDesktopWindow *window)
-{
- return window->details->loaded;
-}
diff --git a/nautilus-desktop/nautilus-desktop-window.h b/nautilus-desktop/nautilus-desktop-window.h
deleted file mode 100644
index 818c23bc7..000000000
--- a/nautilus-desktop/nautilus-desktop-window.h
+++ /dev/null
@@ -1,59 +0,0 @@
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Darin Adler <darin@bentspoon.com>
- */
-
-/* nautilus-desktop-window.h
- */
-
-#ifndef NAUTILUS_DESKTOP_WINDOW_H
-#define NAUTILUS_DESKTOP_WINDOW_H
-
-#include <src/nautilus-window.h>
-
-#define NAUTILUS_TYPE_DESKTOP_WINDOW nautilus_desktop_window_get_type()
-#define NAUTILUS_DESKTOP_WINDOW(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_DESKTOP_WINDOW, NautilusDesktopWindow))
-#define NAUTILUS_DESKTOP_WINDOW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_DESKTOP_WINDOW, NautilusDesktopWindowClass))
-#define NAUTILUS_IS_DESKTOP_WINDOW(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_DESKTOP_WINDOW))
-#define NAUTILUS_IS_DESKTOP_WINDOW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DESKTOP_WINDOW))
-#define NAUTILUS_DESKTOP_WINDOW_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_WINDOW, NautilusDesktopWindowClass))
-
-typedef struct NautilusDesktopWindowDetails NautilusDesktopWindowDetails;
-
-typedef struct {
- NautilusWindow parent_spot;
- NautilusDesktopWindowDetails *details;
-} NautilusDesktopWindow;
-
-typedef struct {
- NautilusWindowClass parent_spot;
-} NautilusDesktopWindowClass;
-
-GType nautilus_desktop_window_get_type (void);
-GtkWidget * nautilus_desktop_window_get (void);
-void nautilus_desktop_window_ensure (void);
-gboolean nautilus_desktop_window_loaded (NautilusDesktopWindow *window);
-
-#endif /* NAUTILUS_DESKTOP_WINDOW_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1da446029..387819a15 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,11 +13,6 @@ eel/eel-vfs-extensions.c
libnautilus-extension/nautilus-column.c
libnautilus-extension/nautilus-menu-item.c
libnautilus-extension/nautilus-property-page.c
-nautilus-desktop/nautilus-desktop-application.c
-nautilus-desktop/nautilus-desktop-directory-file.c
-nautilus-desktop/nautilus-desktop-icon-file.c
-nautilus-desktop/nautilus-desktop-link.c
-nautilus-desktop/nautilus-desktop-window.c
nautilus-sendto-extension/nautilus-nste.c
src/nautilus-application.c
src/nautilus-autorun-software.c
diff --git a/src/meson.build b/src/meson.build
index aca423ac7..801f1845d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,3 @@
-built_sources = []
gdbus_sources = []
enums = []
@@ -6,8 +5,6 @@ gdbus_sources += gnome.gdbus_codegen ('nautilus-freedesktop-generated',
join_paths (meson.source_root (), 'data', 'freedesktop-dbus-interfaces.xml'),
interface_prefix: 'org.freedesktop',
namespace: 'NautilusFreedesktop')
-# The header is used in nautilus-desktop.
-built_sources += gdbus_sources
gdbus_sources += gnome.gdbus_codegen ('nautilus-generated',
join_paths (meson.source_root (), 'data', 'dbus-interfaces.xml'),
@@ -36,12 +33,11 @@ resources = gnome.compile_resources ('nautilus-resources',
source_dir: 'resources',
c_name: 'nautilus',
extra_args: '--manual-register')
-built_sources += resources[1]
libnautilus_sources = [
enums,
gdbus_sources,
- resources[0],
+ resources,
'animation/egg-animation.c',
'animation/egg-animation.h',
'animation/egg-frame-source.c',
@@ -295,8 +291,7 @@ libnautilus_include_dirs = include_directories ('.')
libnautilus_dep = declare_dependency (link_with: libnautilus,
include_directories: [nautilus_include_dirs,
libnautilus_include_dirs],
- dependencies: nautilus_deps,
- sources: built_sources)
+ dependencies: nautilus_deps)
nautilus = executable ('nautilus',
'nautilus-main.c',
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index adcb7d3e7..08b8f229e 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -948,9 +948,7 @@ const GOptionEntry options[] =
/* dummy, only for compatibility reasons */
{ "browser", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, NULL,
NULL, NULL },
- { "no-desktop", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, NULL,
- NULL, NULL },
- /* ditto */
+ /* ditto */
{ "geometry", 'g', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, NULL,
N_("Create the initial window with the given geometry."), N_("GEOMETRY") },
{ "version", '\0', 0, G_OPTION_ARG_NONE, NULL,
diff --git a/src/nautilus-bookmark.c b/src/nautilus-bookmark.c
index 5c51fdbc0..0deb72b68 100644
--- a/src/nautilus-bookmark.c
+++ b/src/nautilus-bookmark.c
@@ -213,8 +213,7 @@ nautilus_bookmark_get_is_builtin (NautilusBookmark *bookmark)
}
/* exclude XDG locations which are not in our builtin list */
- if (xdg_type == G_USER_DIRECTORY_DESKTOP &&
- !g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP))
+ if (xdg_type == G_USER_DIRECTORY_DESKTOP)
{
return FALSE;
}
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index b85a2adc2..7a375cea2 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -102,21 +102,6 @@
#define LARGE_ICON_GRID_WIDTH 106
#define LARGER_ICON_GRID_WIDTH 128
-/* Desktop layout mode defines */
-#define DESKTOP_PAD_HORIZONTAL 10
-#define DESKTOP_PAD_VERTICAL 10
-#define SNAP_SIZE_X 78
-#define SNAP_SIZE_Y 20
-
-#define SNAP_HORIZONTAL(func, x) ((func ((double) ((x) - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X) * SNAP_SIZE_X) + DESKTOP_PAD_HORIZONTAL)
-#define SNAP_VERTICAL(func, y) ((func ((double) ((y) - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y) * SNAP_SIZE_Y) + DESKTOP_PAD_VERTICAL)
-
-#define SNAP_NEAREST_HORIZONTAL(x) SNAP_HORIZONTAL (floor, x + SNAP_SIZE_X / 2)
-#define SNAP_NEAREST_VERTICAL(y) SNAP_VERTICAL (floor, y + SNAP_SIZE_Y / 2)
-
-#define SNAP_CEIL_HORIZONTAL(x) SNAP_HORIZONTAL (ceil, x)
-#define SNAP_CEIL_VERTICAL(y) SNAP_VERTICAL (ceil, y)
-
/* Copied from NautilusCanvasContainer */
#define NAUTILUS_CANVAS_CONTAINER_SEARCH_DIALOG_TIMEOUT 5
@@ -141,8 +126,6 @@ static void preview_selected_items (NautilusCanvasContainer *container)
static void activate_selected_items (NautilusCanvasContainer *container);
static void activate_selected_items_alternate (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon);
-static void compute_stretch (StretchState *start,
- StretchState *current);
static NautilusCanvasIcon *get_first_selected_icon (NautilusCanvasContainer *container);
static NautilusCanvasIcon *get_nth_selected_icon (NautilusCanvasContainer *container,
int index);
@@ -181,7 +164,6 @@ static int compare_icons_vertical (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon_a,
NautilusCanvasIcon *icon_b);
-static void store_layout_timestamps_now (NautilusCanvasContainer *container);
static void schedule_redo_layout (NautilusCanvasContainer *container);
static const char *nautilus_canvas_container_accessible_action_names[] =
@@ -217,15 +199,10 @@ enum
GET_ICON_URI,
GET_ICON_ACTIVATION_URI,
GET_ICON_DROP_TARGET_URI,
- GET_STORED_ICON_POSITION,
- ICON_POSITION_CHANGED,
- GET_STORED_LAYOUT_TIMESTAMP,
- STORE_LAYOUT_TIMESTAMP,
ICON_RENAME_STARTED,
ICON_RENAME_ENDED,
ICON_STRETCH_STARTED,
ICON_STRETCH_ENDED,
- LAYOUT_CHANGED,
MOVE_COPY_ITEMS,
HANDLE_NETSCAPE_URL,
HANDLE_URI_LIST,
@@ -274,14 +251,6 @@ icon_set_position (NautilusCanvasIcon *icon,
double y)
{
NautilusCanvasContainer *container;
- double pixels_per_unit;
- int container_left, container_top, container_right, container_bottom;
- int x1, x2, y1, y2;
- int container_x, container_y, container_width, container_height;
- EelDRect icon_bounds;
- int item_width, item_height;
- int height_above, width_left;
- int min_x, max_x, min_y, max_y;
if (icon->x == x && icon->y == y)
{
@@ -290,56 +259,6 @@ icon_set_position (NautilusCanvasIcon *icon,
container = NAUTILUS_CANVAS_CONTAINER (EEL_CANVAS_ITEM (icon->item)->canvas);
- if (nautilus_canvas_container_get_is_fixed_size (container))
- {
- /* FIXME: This should be:
- *
- * container_x = GTK_WIDGET (container)->allocation.x;
- * container_y = GTK_WIDGET (container)->allocation.y;
- * container_width = GTK_WIDGET (container)->allocation.width;
- * container_height = GTK_WIDGET (container)->allocation.height;
- *
- * But for some reason the widget allocation is sometimes not done
- * at startup, and the allocation is then only 45x60. which is
- * really bad.
- *
- * For now, we have a cheesy workaround:
- */
- container_x = 0;
- container_y = 0;
- container_width = gdk_screen_width () - container_x
- - container->details->left_margin
- - container->details->right_margin;
- container_height = gdk_screen_height () - container_y
- - container->details->top_margin
- - container->details->bottom_margin;
- pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
- /* Clip the position of the icon within our desktop bounds */
- container_left = container_x / pixels_per_unit;
- container_top = container_y / pixels_per_unit;
- container_right = container_left + container_width / pixels_per_unit;
- container_bottom = container_top + container_height / pixels_per_unit;
-
- icon_get_bounding_box (icon, &x1, &y1, &x2, &y2,
- BOUNDS_USAGE_FOR_ENTIRE_ITEM);
- item_width = x2 - x1;
- item_height = y2 - y1;
-
- icon_bounds = nautilus_canvas_item_get_icon_rectangle (icon->item);
-
- /* determine icon rectangle relative to item rectangle */
- height_above = icon_bounds.y0 - y1;
- width_left = icon_bounds.x0 - x1;
-
- min_x = container_left + DESKTOP_PAD_HORIZONTAL + width_left;
- max_x = container_right - DESKTOP_PAD_HORIZONTAL - item_width + width_left;
- x = CLAMP (x, min_x, max_x);
-
- min_y = container_top + height_above + DESKTOP_PAD_VERTICAL;
- max_y = container_bottom - DESKTOP_PAD_VERTICAL - item_height + height_above;
- y = CLAMP (y, min_y, max_y);
- }
-
if (icon->x == ICON_UNPOSITIONED_VALUE)
{
icon->x = 0;
@@ -438,41 +357,11 @@ icon_get_size (NautilusCanvasContainer *container,
{
if (size != NULL)
{
- *size = MAX (nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level)
- * icon->scale, NAUTILUS_CANVAS_ICON_SIZE_SMALL);
+ *size = MAX (nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level),
+ NAUTILUS_CANVAS_ICON_SIZE_SMALL);
}
}
-/* The icon_set_size function is 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_set_size (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon,
- guint icon_size,
- gboolean snap,
- gboolean update_position)
-{
- guint old_size;
- double scale;
-
- icon_get_size (container, icon, &old_size);
- if (icon_size == old_size)
- {
- return;
- }
-
- scale = (double) icon_size /
- nautilus_canvas_container_get_icon_size_for_zoom_level
- (container->details->zoom_level);
- nautilus_canvas_container_move_icon (container, icon,
- icon->x, icon->y,
- scale, FALSE,
- snap, update_position);
-}
-
static void
icon_raise (NautilusCanvasIcon *icon)
{
@@ -485,24 +374,6 @@ icon_raise (NautilusCanvasIcon *icon)
}
static void
-emit_stretch_started (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon)
-{
- g_signal_emit (container,
- signals[ICON_STRETCH_STARTED], 0,
- icon->data);
-}
-
-static void
-emit_stretch_ended (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon)
-{
- g_signal_emit (container,
- signals[ICON_STRETCH_ENDED], 0,
- icon->data);
-}
-
-static void
icon_toggle_selected (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
{
@@ -521,26 +392,6 @@ icon_toggle_selected (NautilusCanvasContainer *container,
"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_canvas_item_set_show_stretch_handles (icon->item, FALSE);
- /* snap the icon if necessary */
- if (container->details->keep_aligned)
- {
- nautilus_canvas_container_move_icon (container,
- icon,
- icon->x, icon->y,
- icon->scale,
- FALSE, TRUE, TRUE);
- }
-
- emit_stretch_ended (container, icon);
- }
-
/* Raise each newly-selected icon to the front as it is selected. */
if (icon->is_selected)
{
@@ -787,15 +638,9 @@ reveal_icon (NautilusCanvasContainer *container,
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
- if (nautilus_canvas_container_is_auto_layout (container))
- {
- /* ensure that we reveal the entire row/column */
- icon_get_row_and_column_bounds (container, icon, &bounds);
- }
- else
- {
- item_get_canvas_bounds (EEL_CANVAS_ITEM (icon->item), &bounds);
- }
+ /* ensure that we reveal the entire row/column */
+ icon_get_row_and_column_bounds (container, icon, &bounds);
+
if (bounds.y0 < gtk_adjustment_get_value (vadj))
{
gtk_adjustment_set_value (vadj, bounds.y0);
@@ -1182,28 +1027,8 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
- if (nautilus_canvas_container_get_is_fixed_size (container))
- {
- /* Set the scroll region to the size of the container allocation */
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- eel_canvas_set_scroll_region
- (EEL_CANVAS (container),
- (double) -container->details->left_margin / pixels_per_unit,
- (double) -container->details->top_margin / pixels_per_unit,
- ((double) (allocation.width - 1)
- - container->details->left_margin
- - container->details->right_margin)
- / pixels_per_unit,
- ((double) (allocation.height - 1)
- - container->details->top_margin
- - container->details->bottom_margin)
- / pixels_per_unit);
- return;
- }
-
reset_scroll_region = container->details->reset_scroll_region_trigger
- || nautilus_canvas_container_is_empty (container)
- || nautilus_canvas_container_is_auto_layout (container);
+ || nautilus_canvas_container_is_empty (container);
/* The trigger is only cleared when container is non-empty, so
* callers can reliably reset the scroll region when an item
@@ -1219,50 +1044,16 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
/* Add border at the "end"of the layout (i.e. after the icons), to
* ensure we get some space when scrolled to the end.
- * For horizontal layouts, we add a bottom border.
- * Vertical layout is used by the compact view so the end
- * depends on the RTL setting.
*/
- if (nautilus_canvas_container_is_layout_vertical (container))
- {
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- x1 -= ICON_PAD_LEFT + CONTAINER_PAD_LEFT;
- }
- else
- {
- x2 += ICON_PAD_RIGHT + CONTAINER_PAD_RIGHT;
- }
- }
- else
- {
- y2 += ICON_PAD_BOTTOM + CONTAINER_PAD_BOTTOM;
- }
+ y2 += ICON_PAD_BOTTOM + CONTAINER_PAD_BOTTOM;
/* Auto-layout assumes a 0, 0 scroll origin and at least allocation->width.
* Then we lay out to the right or to the left, so
* x can be < 0 and > allocation */
- if (nautilus_canvas_container_is_auto_layout (container))
- {
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- x1 = MIN (x1, 0);
- x2 = MAX (x2, allocation.width / pixels_per_unit);
- y1 = 0;
- }
- else
- {
- /* Otherwise we add the padding that is at the start of the
- * layout */
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- x2 += ICON_PAD_RIGHT + CONTAINER_PAD_RIGHT;
- }
- else
- {
- x1 -= ICON_PAD_LEFT + CONTAINER_PAD_LEFT;
- }
- y1 -= ICON_PAD_TOP + CONTAINER_PAD_TOP;
- }
+ gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
+ x1 = MIN (x1, 0);
+ x2 = MAX (x2, allocation.width / pixels_per_unit);
+ y1 = 0;
x2 -= 1;
x2 = MAX (x1, x2);
@@ -1541,370 +1332,6 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
g_array_free (positions, TRUE);
}
-static void
-snap_position (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon,
- int *x,
- int *y)
-{
- int center_x;
- int baseline_y;
- int icon_width;
- int icon_height;
- int total_width;
- int total_height;
- EelDRect canvas_position;
- GtkAllocation allocation;
-
- canvas_position = nautilus_canvas_item_get_icon_rectangle (icon->item);
- icon_width = canvas_position.x1 - canvas_position.x0;
- icon_height = canvas_position.y1 - canvas_position.y0;
-
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- total_width = CANVAS_WIDTH (container, allocation);
- total_height = CANVAS_HEIGHT (container, allocation);
-
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- *x = get_mirror_x_position (container, icon, *x);
- }
-
- if (*x + icon_width / 2 < DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X)
- {
- *x = DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X - icon_width / 2;
- }
-
- if (*x + icon_width / 2 > total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X))
- {
- *x = total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X + (icon_width / 2));
- }
-
- if (*y + icon_height < DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y)
- {
- *y = DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y - icon_height;
- }
-
- if (*y + icon_height > total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y))
- {
- *y = total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y + (icon_height / 2));
- }
-
- center_x = *x + icon_width / 2;
- *x = SNAP_NEAREST_HORIZONTAL (center_x) - (icon_width / 2);
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- *x = get_mirror_x_position (container, icon, *x);
- }
-
-
- /* Find the grid position vertically and place on the proper baseline */
- baseline_y = *y + icon_height;
- baseline_y = SNAP_NEAREST_VERTICAL (baseline_y);
- *y = baseline_y - icon_height;
-}
-
-static int
-compare_icons_by_position (gconstpointer a,
- gconstpointer b)
-{
- NautilusCanvasIcon *icon_a, *icon_b;
- int x1, y1, x2, y2;
- int center_a;
- int center_b;
-
- icon_a = (NautilusCanvasIcon *) a;
- icon_b = (NautilusCanvasIcon *) b;
-
- icon_get_bounding_box (icon_a, &x1, &y1, &x2, &y2,
- BOUNDS_USAGE_FOR_DISPLAY);
- center_a = x1 + (x2 - x1) / 2;
- icon_get_bounding_box (icon_b, &x1, &y1, &x2, &y2,
- BOUNDS_USAGE_FOR_DISPLAY);
- center_b = x1 + (x2 - x1) / 2;
-
- return center_a == center_b ?
- icon_a->y - icon_b->y :
- center_a - center_b;
-}
-
-static PlacementGrid *
-placement_grid_new (NautilusCanvasContainer *container,
- gboolean tight)
-{
- PlacementGrid *grid;
- int width, height;
- int num_columns;
- int num_rows;
- int i;
- GtkAllocation allocation;
-
- /* Get container dimensions */
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- width = CANVAS_WIDTH (container, allocation);
- height = CANVAS_HEIGHT (container, allocation);
-
- num_columns = width / SNAP_SIZE_X;
- num_rows = height / SNAP_SIZE_Y;
-
- if (num_columns == 0 || num_rows == 0)
- {
- return NULL;
- }
-
- grid = g_new0 (PlacementGrid, 1);
- grid->tight = tight;
- grid->num_columns = num_columns;
- grid->num_rows = num_rows;
-
- grid->grid_memory = g_new0 (int, (num_rows * num_columns));
- grid->icon_grid = g_new0 (int *, num_columns);
-
- for (i = 0; i < num_columns; i++)
- {
- grid->icon_grid[i] = grid->grid_memory + (i * num_rows);
- }
-
- return grid;
-}
-
-static void
-placement_grid_free (PlacementGrid *grid)
-{
- g_free (grid->icon_grid);
- g_free (grid->grid_memory);
- g_free (grid);
-}
-
-static gboolean
-placement_grid_position_is_free (PlacementGrid *grid,
- EelIRect pos)
-{
- int x, y;
-
- g_assert (pos.x0 >= 0 && pos.x0 < grid->num_columns);
- g_assert (pos.y0 >= 0 && pos.y0 < grid->num_rows);
- g_assert (pos.x1 >= 0 && pos.x1 < grid->num_columns);
- g_assert (pos.y1 >= 0 && pos.y1 < grid->num_rows);
-
- for (x = pos.x0; x <= pos.x1; x++)
- {
- for (y = pos.y0; y <= pos.y1; y++)
- {
- if (grid->icon_grid[x][y] != 0)
- {
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-static void
-placement_grid_mark (PlacementGrid *grid,
- EelIRect pos)
-{
- int x, y;
-
- g_assert (pos.x0 >= 0 && pos.x0 < grid->num_columns);
- g_assert (pos.y0 >= 0 && pos.y0 < grid->num_rows);
- g_assert (pos.x1 >= 0 && pos.x1 < grid->num_columns);
- g_assert (pos.y1 >= 0 && pos.y1 < grid->num_rows);
-
- for (x = pos.x0; x <= pos.x1; x++)
- {
- for (y = pos.y0; y <= pos.y1; y++)
- {
- grid->icon_grid[x][y] = 1;
- }
- }
-}
-
-static void
-canvas_position_to_grid_position (PlacementGrid *grid,
- EelIRect canvas_position,
- EelIRect *grid_position)
-{
- /* The first causes minimal moving around during a snap, but
- * can end up with partially overlapping icons. The second one won't
- * allow any overlapping, but can cause more movement to happen
- * during a snap. */
- if (grid->tight)
- {
- grid_position->x0 = ceil ((double) (canvas_position.x0 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
- grid_position->y0 = ceil ((double) (canvas_position.y0 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
- grid_position->x1 = floor ((double) (canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
- grid_position->y1 = floor ((double) (canvas_position.y1 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
- }
- else
- {
- grid_position->x0 = floor ((double) (canvas_position.x0 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
- grid_position->y0 = floor ((double) (canvas_position.y0 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
- grid_position->x1 = floor ((double) (canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
- grid_position->y1 = floor ((double) (canvas_position.y1 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
- }
-
- grid_position->x0 = CLAMP (grid_position->x0, 0, grid->num_columns - 1);
- grid_position->y0 = CLAMP (grid_position->y0, 0, grid->num_rows - 1);
- grid_position->x1 = CLAMP (grid_position->x1, grid_position->x0, grid->num_columns - 1);
- grid_position->y1 = CLAMP (grid_position->y1, grid_position->y0, grid->num_rows - 1);
-}
-
-static void
-placement_grid_mark_icon (PlacementGrid *grid,
- NautilusCanvasIcon *icon)
-{
- EelIRect canvas_pos;
- EelIRect grid_pos;
-
- icon_get_bounding_box (icon,
- &canvas_pos.x0, &canvas_pos.y0,
- &canvas_pos.x1, &canvas_pos.y1,
- BOUNDS_USAGE_FOR_LAYOUT);
- canvas_position_to_grid_position (grid,
- canvas_pos,
- &grid_pos);
- placement_grid_mark (grid, grid_pos);
-}
-
-static void
-find_empty_location (NautilusCanvasContainer *container,
- PlacementGrid *grid,
- NautilusCanvasIcon *icon,
- int start_x,
- int start_y,
- int *x,
- int *y)
-{
- double icon_width, icon_height;
- int canvas_width;
- int canvas_height;
- int height_for_bound_check;
- EelIRect icon_position;
- EelDRect pixbuf_rect;
- gboolean collision;
- GtkAllocation allocation;
-
- /* Get container dimensions */
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- canvas_width = CANVAS_WIDTH (container, allocation);
- canvas_height = CANVAS_HEIGHT (container, allocation);
-
- icon_get_bounding_box (icon,
- &icon_position.x0, &icon_position.y0,
- &icon_position.x1, &icon_position.y1,
- BOUNDS_USAGE_FOR_LAYOUT);
- icon_width = icon_position.x1 - icon_position.x0;
- icon_height = icon_position.y1 - icon_position.y0;
-
- icon_get_bounding_box (icon,
- NULL, &icon_position.y0,
- NULL, &icon_position.y1,
- BOUNDS_USAGE_FOR_ENTIRE_ITEM);
- height_for_bound_check = icon_position.y1 - icon_position.y0;
-
- pixbuf_rect = nautilus_canvas_item_get_icon_rectangle (icon->item);
-
- /* Start the icon on a grid location */
- snap_position (container, icon, &start_x, &start_y);
-
- icon_position.x0 = start_x;
- icon_position.y0 = start_y;
- icon_position.x1 = icon_position.x0 + icon_width;
- icon_position.y1 = icon_position.y0 + icon_height;
-
- do
- {
- EelIRect grid_position;
- gboolean need_new_column;
-
- collision = FALSE;
-
- canvas_position_to_grid_position (grid,
- icon_position,
- &grid_position);
-
- need_new_column = icon_position.y0 + height_for_bound_check + DESKTOP_PAD_VERTICAL > canvas_height;
-
- if (need_new_column ||
- !placement_grid_position_is_free (grid, grid_position))
- {
- icon_position.y0 += SNAP_SIZE_Y;
- icon_position.y1 = icon_position.y0 + icon_height;
-
- if (need_new_column)
- {
- /* Move to the next column */
- icon_position.y0 = DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y - (pixbuf_rect.y1 - pixbuf_rect.y0);
- while (icon_position.y0 < DESKTOP_PAD_VERTICAL)
- {
- icon_position.y0 += SNAP_SIZE_Y;
- }
- icon_position.y1 = icon_position.y0 + icon_height;
-
- icon_position.x0 += SNAP_SIZE_X;
- icon_position.x1 = icon_position.x0 + icon_width;
- }
-
- collision = TRUE;
- }
- }
- while (collision && (icon_position.x1 < canvas_width));
-
- *x = icon_position.x0;
- *y = icon_position.y0;
-}
-
-static void
-align_icons (NautilusCanvasContainer *container)
-{
- GList *unplaced_icons;
- GList *l;
- PlacementGrid *grid;
-
- unplaced_icons = g_list_copy (container->details->icons);
-
- unplaced_icons = g_list_sort (unplaced_icons,
- compare_icons_by_position);
-
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- unplaced_icons = g_list_reverse (unplaced_icons);
- }
-
- grid = placement_grid_new (container, TRUE);
-
- if (!grid)
- {
- return;
- }
-
- for (l = unplaced_icons; l != NULL; l = l->next)
- {
- NautilusCanvasIcon *icon;
- int x, y;
-
- icon = l->data;
- x = icon->saved_ltr_x;
- y = icon->y;
- find_empty_location (container, grid,
- icon, x, y, &x, &y);
-
- icon_set_position (icon, x, y);
- icon->saved_ltr_x = icon->x;
- placement_grid_mark_icon (grid, icon);
- }
-
- g_list_free (unplaced_icons);
-
- placement_grid_free (grid);
-
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- nautilus_canvas_container_set_rtl_positions (container);
- }
-}
-
static double
get_mirror_x_position (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon,
@@ -1940,221 +1367,11 @@ nautilus_canvas_container_set_rtl_positions (NautilusCanvasContainer *container)
}
static void
-lay_down_icons_vertical_desktop (NautilusCanvasContainer *container,
- GList *icons)
-{
- GList *p, *placed_icons, *unplaced_icons;
- int total, new_length, placed;
- NautilusCanvasIcon *icon;
- int height, max_width, column_width, icon_width, icon_height;
- int x, y, x1, x2, y1, y2;
- EelDRect icon_rect;
- GtkAllocation allocation;
-
- /* We can't get the right allocation if the size hasn't been allocated yet */
- g_return_if_fail (container->details->has_been_allocated);
-
- /* Get container dimensions */
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- height = CANVAS_HEIGHT (container, allocation);
-
- /* Determine which icons have and have not been placed */
- placed_icons = NULL;
- unplaced_icons = NULL;
-
- total = g_list_length (container->details->icons);
- new_length = g_list_length (icons);
- placed = total - new_length;
- if (placed > 0)
- {
- PlacementGrid *grid;
- /* Add only placed icons in list */
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
- if (icon_is_positioned (icon))
- {
- icon_set_position (icon, icon->saved_ltr_x, icon->y);
- placed_icons = g_list_prepend (placed_icons, icon);
- }
- else
- {
- icon->x = 0;
- icon->y = 0;
- unplaced_icons = g_list_prepend (unplaced_icons, icon);
- }
- }
- placed_icons = g_list_reverse (placed_icons);
- unplaced_icons = g_list_reverse (unplaced_icons);
-
- grid = placement_grid_new (container, FALSE);
-
- if (grid)
- {
- for (p = placed_icons; p != NULL; p = p->next)
- {
- placement_grid_mark_icon
- (grid, (NautilusCanvasIcon *) p->data);
- }
-
- /* Place unplaced icons in the best locations */
- for (p = unplaced_icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- icon_rect = nautilus_canvas_item_get_icon_rectangle (icon->item);
-
- /* Start the icon in the first column */
- x = DESKTOP_PAD_HORIZONTAL + (SNAP_SIZE_X / 2) - ((icon_rect.x1 - icon_rect.x0) / 2);
- y = DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y - (icon_rect.y1 - icon_rect.y0);
-
- find_empty_location (container,
- grid,
- icon,
- x, y,
- &x, &y);
-
- icon_set_position (icon, x, y);
- icon->saved_ltr_x = x;
- placement_grid_mark_icon (grid, icon);
- }
-
- placement_grid_free (grid);
- }
-
- g_list_free (placed_icons);
- g_list_free (unplaced_icons);
- }
- else
- {
- /* There are no placed icons. Just lay them down using our rules */
- x = DESKTOP_PAD_HORIZONTAL;
-
- while (icons != NULL)
- {
- int center_x;
- int baseline;
- int icon_height_for_bound_check;
- gboolean should_snap;
-
- should_snap = container->details->keep_aligned;
-
- y = DESKTOP_PAD_VERTICAL;
-
- max_width = 0;
-
- /* Calculate max width for column */
- for (p = icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- icon_get_bounding_box (icon, &x1, &y1, &x2, &y2,
- BOUNDS_USAGE_FOR_LAYOUT);
- icon_width = x2 - x1;
- icon_height = y2 - y1;
-
- icon_get_bounding_box (icon, NULL, &y1, NULL, &y2,
- BOUNDS_USAGE_FOR_ENTIRE_ITEM);
- icon_height_for_bound_check = y2 - y1;
-
- if (should_snap)
- {
- /* Snap the baseline to a grid position */
- icon_rect = nautilus_canvas_item_get_icon_rectangle (icon->item);
- baseline = y + (icon_rect.y1 - icon_rect.y0);
- baseline = SNAP_CEIL_VERTICAL (baseline);
- y = baseline - (icon_rect.y1 - icon_rect.y0);
- }
-
- /* Check and see if we need to move to a new column */
- if (y != DESKTOP_PAD_VERTICAL && y + icon_height_for_bound_check > height)
- {
- break;
- }
-
- if (max_width < icon_width)
- {
- max_width = icon_width;
- }
-
- y += icon_height + DESKTOP_PAD_VERTICAL;
- }
-
- y = DESKTOP_PAD_VERTICAL;
-
- center_x = x + max_width / 2;
- column_width = max_width;
- if (should_snap)
- {
- /* Find the grid column to center on */
- center_x = SNAP_CEIL_HORIZONTAL (center_x);
- column_width = (center_x - x) + (max_width / 2);
- }
-
- /* Lay out column */
- for (p = icons; p != NULL; p = p->next)
- {
- icon = p->data;
- icon_get_bounding_box (icon, &x1, &y1, &x2, &y2,
- BOUNDS_USAGE_FOR_LAYOUT);
- icon_height = y2 - y1;
-
- icon_get_bounding_box (icon, NULL, &y1, NULL, &y2,
- BOUNDS_USAGE_FOR_ENTIRE_ITEM);
- icon_height_for_bound_check = y2 - y1;
-
- icon_rect = nautilus_canvas_item_get_icon_rectangle (icon->item);
-
- if (should_snap)
- {
- baseline = y + (icon_rect.y1 - icon_rect.y0);
- baseline = SNAP_CEIL_VERTICAL (baseline);
- y = baseline - (icon_rect.y1 - icon_rect.y0);
- }
-
- /* Check and see if we need to move to a new column */
- if (y != DESKTOP_PAD_VERTICAL && y > height - icon_height_for_bound_check &&
- /* Make sure we lay out at least one icon per column, to make progress */
- p != icons)
- {
- x += column_width + DESKTOP_PAD_HORIZONTAL;
- break;
- }
-
- icon_set_position (icon,
- center_x - (icon_rect.x1 - icon_rect.x0) / 2,
- y);
-
- icon->saved_ltr_x = icon->x;
- y += icon_height + DESKTOP_PAD_VERTICAL;
- }
- icons = p;
- }
- }
-
- /* These modes are special. We freeze all of our positions
- * after we do the layout.
- */
- /* FIXME bugzilla.gnome.org 42478:
- * This should not be tied to the direction of layout.
- * It should be a separate switch.
- */
- nautilus_canvas_container_freeze_icon_positions (container);
-}
-
-static void
lay_down_icons (NautilusCanvasContainer *container,
GList *icons,
double start_y)
{
- if (container->details->is_desktop)
- {
- lay_down_icons_vertical_desktop (container, icons);
- }
- else
- {
- lay_down_icons_horizontal (container, icons, start_y);
- }
+ lay_down_icons_horizontal (container, icons, start_y);
}
static void
@@ -2169,21 +1386,12 @@ redo_layout_internal (NautilusCanvasContainer *container)
return;
}
- /* Don't do any re-laying-out during stretching. Later we
- * might add smart logic that does this and leaves room for
- * the stretched icon, but if we do it we want it to be fast
- * and only re-lay-out when it's really needed.
- */
- if (container->details->auto_layout
- && container->details->drag_state != DRAG_STATE_STRETCH)
+ if (container->details->needs_resort)
{
- if (container->details->needs_resort)
- {
- resort (container);
- container->details->needs_resort = FALSE;
- }
- lay_down_icons (container, container->details->icons, 0);
+ resort (container);
+ container->details->needs_resort = FALSE;
}
+ lay_down_icons (container, container->details->icons, 0);
if (nautilus_canvas_container_is_layout_rtl (container))
{
@@ -2242,67 +1450,6 @@ redo_layout (NautilusCanvasContainer *container)
}
}
-static void
-reload_icon_positions (NautilusCanvasContainer *container)
-{
- GList *p, *no_position_icons;
- NautilusCanvasIcon *icon;
- gboolean have_stored_position;
- NautilusCanvasPosition position;
- EelDRect bounds;
- double bottom;
- EelCanvasItem *item;
-
- g_assert (!container->details->auto_layout);
-
- resort (container);
-
- no_position_icons = NULL;
-
- /* Place all the icons with positions. */
- bottom = 0;
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- have_stored_position = FALSE;
- g_signal_emit (container,
- signals[GET_STORED_ICON_POSITION], 0,
- icon->data,
- &position,
- &have_stored_position);
- if (have_stored_position)
- {
- icon_set_position (icon, position.x, position.y);
- item = EEL_CANVAS_ITEM (icon->item);
- nautilus_canvas_item_get_bounds_for_layout (icon->item,
- &bounds.x0,
- &bounds.y0,
- &bounds.x1,
- &bounds.y1);
- eel_canvas_item_i2w (item->parent,
- &bounds.x0,
- &bounds.y0);
- eel_canvas_item_i2w (item->parent,
- &bounds.x1,
- &bounds.y1);
- if (bounds.y1 > bottom)
- {
- bottom = bounds.y1;
- }
- }
- else
- {
- no_position_icons = g_list_prepend (no_position_icons, icon);
- }
- }
- no_position_icons = g_list_reverse (no_position_icons);
-
- /* Place all the other icons. */
- lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM);
- g_list_free (no_position_icons);
-}
-
/* Container-level icon handling functions. */
static gboolean
@@ -2406,75 +1553,6 @@ unselect_all (NautilusCanvasContainer *container)
return select_one_unselect_others (container, NULL);
}
-void
-nautilus_canvas_container_move_icon (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon,
- int x,
- int y,
- double scale,
- gboolean raise,
- gboolean snap,
- gboolean update_position)
-{
- NautilusCanvasContainerDetails *details;
- gboolean emit_signal;
- NautilusCanvasPosition position;
-
- details = container->details;
-
- emit_signal = FALSE;
-
- if (scale != icon->scale)
- {
- icon->scale = scale;
- nautilus_canvas_container_update_icon (container, icon);
- if (update_position)
- {
- redo_layout (container);
- emit_signal = TRUE;
- }
- }
-
- if (!details->auto_layout)
- {
- if (details->keep_aligned && snap)
- {
- snap_position (container, icon, &x, &y);
- }
-
- if (x != icon->x || y != icon->y)
- {
- icon_set_position (icon, x, y);
- emit_signal = update_position;
- }
-
- icon->saved_ltr_x = nautilus_canvas_container_is_layout_rtl (container) ? get_mirror_x_position (container, icon, icon->x) : icon->x;
- }
-
- if (emit_signal)
- {
- position.x = icon->saved_ltr_x;
- position.y = icon->y;
- position.scale = scale;
- g_signal_emit (container,
- signals[ICON_POSITION_CHANGED], 0,
- icon->data, &position);
- }
-
- if (raise)
- {
- icon_raise (icon);
- }
-
- /* FIXME bugzilla.gnome.org 42474:
- * Handling of the scroll region is inconsistent here. In
- * the scale-changing case, redo_layout is called, which updates the
- * scroll region appropriately. In other cases, it's up to the
- * caller to make sure the scroll region is updated. This could
- * lead to hard-to-track-down bugs.
- */
-}
-
/* Implementation of rubberband selection. */
static void
rubberband_select (NautilusCanvasContainer *container,
@@ -2668,76 +1746,16 @@ get_rubber_color (NautilusCanvasContainer *container,
GdkRGBA *bgcolor,
GdkRGBA *bordercolor)
{
- Atom real_type;
- gint result = -1;
- gint real_format;
- gulong items_read = 0;
- gulong items_left = 0;
- gchar *colors;
- Atom representative_colors_atom;
- Display *display;
-
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- representative_colors_atom = gdk_x11_get_xatom_by_name ("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS");
- display = gdk_x11_display_get_xdisplay (gdk_display_get_default ());
-
- gdk_error_trap_push ();
- result = XGetWindowProperty (display,
- GDK_ROOT_WINDOW (),
- representative_colors_atom,
- 0L,
- G_MAXLONG,
- False,
- XA_STRING,
- &real_type,
- &real_format,
- &items_read,
- &items_left,
- (guchar **) &colors);
- gdk_error_trap_pop_ignored ();
- }
-
- if (result == Success && items_read)
- {
- /* by treating the result as a nul-terminated string, we
- * select the first colour in the list.
- */
- GdkRGBA read;
- gdouble shade;
-
- gdk_rgba_parse (&read, colors);
- XFree (colors);
+ GtkStyleContext *context;
- /* Border
- *
- * We shade darker colours to be slightly lighter and
- * lighter ones to be slightly darker.
- */
- shade = read.green < 0.5 ? 1.1 : 0.9;
- bordercolor->red = read.red * shade;
- bordercolor->green = read.green * shade;
- bordercolor->blue = read.blue * shade;
- bordercolor->alpha = 1.0;
-
- /* Background */
- *bgcolor = read;
- bgcolor->alpha = 0.6;
- }
- else
- {
- /* Fallback to the style context if we can't get the Atom */
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (container));
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
+ context = gtk_widget_get_style_context (GTK_WIDGET (container));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
- gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, bgcolor);
- gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, bordercolor);
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, bgcolor);
+ gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, bordercolor);
- gtk_style_context_restore (context);
- }
+ gtk_style_context_restore (context);
}
static void
@@ -3339,40 +2357,6 @@ next_row_rightmost (NautilusCanvasContainer *container,
}
static gboolean
-next_column_bottommost (NautilusCanvasContainer *container,
- NautilusCanvasIcon *start_icon,
- NautilusCanvasIcon *best_so_far,
- NautilusCanvasIcon *candidate,
- void *data)
-{
- /* sort out icons that are not on the right of the current column */
- if (compare_with_start_column (container, candidate) >= 0)
- {
- return FALSE;
- }
-
- if (best_so_far != NULL)
- {
- if (compare_icons_horizontal_first (container,
- best_so_far,
- candidate) > 0)
- {
- /* candidate is above best choice, but below the current row */
- return TRUE;
- }
-
- if (compare_icons_vertical_first (container,
- best_so_far,
- candidate) < 0)
- {
- return TRUE;
- }
- }
-
- return best_so_far == NULL;
-}
-
-static gboolean
previous_row_rightmost (NautilusCanvasContainer *container,
NautilusCanvasIcon *start_icon,
NautilusCanvasIcon *best_so_far,
@@ -3477,123 +2461,6 @@ same_column_below_highest (NautilusCanvasContainer *container,
}
static gboolean
-previous_column_highest (NautilusCanvasContainer *container,
- NautilusCanvasIcon *start_icon,
- NautilusCanvasIcon *best_so_far,
- NautilusCanvasIcon *candidate,
- void *data)
-{
- /* sort out icons that are not before the current column */
- if (compare_with_start_column (container, candidate) <= 0)
- {
- return FALSE;
- }
-
- if (best_so_far != NULL)
- {
- if (compare_icons_horizontal (container,
- best_so_far,
- candidate) < 0)
- {
- /* candidate is right of the best choice, but left of the current column */
- return TRUE;
- }
-
- if (compare_icons_vertical (container,
- best_so_far,
- candidate) > 0)
- {
- return TRUE;
- }
- }
-
- return best_so_far == NULL;
-}
-
-
-static gboolean
-next_column_highest (NautilusCanvasContainer *container,
- NautilusCanvasIcon *start_icon,
- NautilusCanvasIcon *best_so_far,
- NautilusCanvasIcon *candidate,
- void *data)
-{
- /* sort out icons that are not after the current column */
- if (compare_with_start_column (container, candidate) >= 0)
- {
- return FALSE;
- }
-
- if (best_so_far != NULL)
- {
- if (compare_icons_horizontal_first (container,
- best_so_far,
- candidate) > 0)
- {
- /* candidate is left of the best choice, but right of the current column */
- return TRUE;
- }
-
- if (compare_icons_vertical_first (container,
- best_so_far,
- candidate) > 0)
- {
- return TRUE;
- }
- }
-
- return best_so_far == NULL;
-}
-
-static gboolean
-previous_column_lowest (NautilusCanvasContainer *container,
- NautilusCanvasIcon *start_icon,
- NautilusCanvasIcon *best_so_far,
- NautilusCanvasIcon *candidate,
- void *data)
-{
- /* sort out icons that are not before the current column */
- if (compare_with_start_column (container, candidate) <= 0)
- {
- return FALSE;
- }
-
- if (best_so_far != NULL)
- {
- if (compare_icons_horizontal_first (container,
- best_so_far,
- candidate) < 0)
- {
- /* candidate is right of the best choice, but left of the current column */
- return TRUE;
- }
-
- if (compare_icons_vertical_first (container,
- best_so_far,
- candidate) < 0)
- {
- return TRUE;
- }
- }
-
- return best_so_far == NULL;
-}
-
-static gboolean
-last_column_lowest (NautilusCanvasContainer *container,
- NautilusCanvasIcon *start_icon,
- NautilusCanvasIcon *best_so_far,
- NautilusCanvasIcon *candidate,
- void *data)
-{
- if (best_so_far == NULL)
- {
- return TRUE;
- }
- return compare_icons_horizontal_first (container, best_so_far, candidate) < 0;
-}
-
-static gboolean
closest_in_90_degrees (NautilusCanvasContainer *container,
NautilusCanvasIcon *start_icon,
NautilusCanvasIcon *best_so_far,
@@ -3725,8 +2592,7 @@ keyboard_move_to (NautilusCanvasContainer *container,
clear_keyboard_rubberband_start (container);
}
else if (event != NULL &&
- ((event->state & GDK_CONTROL_MASK) != 0 ||
- !container->details->auto_layout) &&
+ (event->state & GDK_CONTROL_MASK) != 0 &&
(event->state & GDK_SHIFT_MASK) != 0)
{
/* Do rubberband selection */
@@ -3811,11 +2677,7 @@ keyboard_end (NautilusCanvasContainer *container,
from = find_best_selected_icon (container, NULL,
leftmost_in_top_row,
NULL);
- to = find_best_icon (container, NULL,
- nautilus_canvas_container_is_layout_vertical (container) ?
- last_column_lowest :
- rightmost_in_bottom_row,
- NULL);
+ to = find_best_icon (container, NULL, rightmost_in_bottom_row, NULL);
keyboard_move_to (container, to, from, event);
}
@@ -3898,7 +2760,7 @@ keyboard_arrow_key (NautilusCanvasContainer *container,
to = find_best_icon
(container, from,
- container->details->auto_layout ? better_destination : better_destination_manual,
+ better_destination,
&data);
/* Wrap around to next/previous row/column */
@@ -3929,7 +2791,6 @@ keyboard_arrow_key (NautilusCanvasContainer *container,
* Should select 4.
*/
if (to == NULL &&
- container->details->auto_layout &&
better_destination_fallback_fallback != NULL)
{
to = find_best_icon
@@ -3959,23 +2820,13 @@ keyboard_right (NautilusCanvasContainer *container,
GdkEventKey *event)
{
IsBetterCanvasFunction fallback;
- IsBetterCanvasFunction next_column_fallback;
fallback = NULL;
- if (container->details->auto_layout &&
- !nautilus_canvas_container_is_layout_vertical (container) &&
- !is_rectangle_selection_event (event))
+ if (!is_rectangle_selection_event (event))
{
fallback = next_row_leftmost;
}
- next_column_fallback = NULL;
- if (nautilus_canvas_container_is_layout_vertical (container) &&
- gtk_widget_get_direction (GTK_WIDGET (container)) != GTK_TEXT_DIR_RTL)
- {
- next_column_fallback = next_column_bottommost;
- }
-
/* Right selects the next icon in the same row.
* Control-Right sets the keyboard focus to the next icon in the same row.
*/
@@ -3987,7 +2838,7 @@ keyboard_right (NautilusCanvasContainer *container,
rightmost_in_top_row : leftmost_in_top_row,
same_row_right_side_leftmost,
fallback,
- next_column_fallback,
+ NULL,
closest_in_90_degrees);
}
@@ -3996,23 +2847,13 @@ keyboard_left (NautilusCanvasContainer *container,
GdkEventKey *event)
{
IsBetterCanvasFunction fallback;
- IsBetterCanvasFunction previous_column_fallback;
fallback = NULL;
- if (container->details->auto_layout &&
- !nautilus_canvas_container_is_layout_vertical (container) &&
- !is_rectangle_selection_event (event))
+ if (!is_rectangle_selection_event (event))
{
fallback = previous_row_rightmost;
}
- previous_column_fallback = NULL;
- if (nautilus_canvas_container_is_layout_vertical (container) &&
- gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
- {
- previous_column_fallback = previous_column_lowest;
- }
-
/* Left selects the next icon in the same row.
* Control-Left sets the keyboard focus to the next icon in the same row.
*/
@@ -4024,7 +2865,7 @@ keyboard_left (NautilusCanvasContainer *container,
rightmost_in_top_row : leftmost_in_top_row,
same_row_left_side_rightmost,
fallback,
- previous_column_fallback,
+ NULL,
closest_in_90_degrees);
}
@@ -4032,35 +2873,16 @@ static void
keyboard_down (NautilusCanvasContainer *container,
GdkEventKey *event)
{
- IsBetterCanvasFunction fallback;
IsBetterCanvasFunction next_row_fallback;
- fallback = NULL;
- if (container->details->auto_layout &&
- nautilus_canvas_container_is_layout_vertical (container) &&
- !is_rectangle_selection_event (event))
+ next_row_fallback = NULL;
+ if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
{
- if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
- {
- fallback = previous_column_highest;
- }
- else
- {
- fallback = next_column_highest;
- }
+ next_row_fallback = next_row_leftmost;
}
-
- next_row_fallback = NULL;
- if (!nautilus_canvas_container_is_layout_vertical (container))
+ else
{
- if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
- {
- next_row_fallback = next_row_leftmost;
- }
- else
- {
- next_row_fallback = next_row_rightmost;
- }
+ next_row_fallback = next_row_rightmost;
}
/* Down selects the next icon in the same column.
@@ -4073,7 +2895,7 @@ keyboard_down (NautilusCanvasContainer *container,
nautilus_canvas_container_is_layout_rtl (container) ?
rightmost_in_top_row : leftmost_in_top_row,
same_column_below_highest,
- fallback,
+ NULL,
next_row_fallback,
closest_in_90_degrees);
}
@@ -4082,23 +2904,6 @@ static void
keyboard_up (NautilusCanvasContainer *container,
GdkEventKey *event)
{
- IsBetterCanvasFunction fallback;
-
- fallback = NULL;
- if (container->details->auto_layout &&
- nautilus_canvas_container_is_layout_vertical (container) &&
- !is_rectangle_selection_event (event))
- {
- if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
- {
- fallback = next_column_bottommost;
- }
- else
- {
- fallback = previous_column_lowest;
- }
- }
-
/* Up selects the next icon in the same column.
* Control-Up sets the keyboard focus to the next icon in the same column.
*/
@@ -4109,7 +2914,7 @@ keyboard_up (NautilusCanvasContainer *container,
nautilus_canvas_container_is_layout_rtl (container) ?
rightmost_in_top_row : leftmost_in_top_row,
same_column_above_lowest,
- fallback,
+ NULL,
NULL,
closest_in_90_degrees);
}
@@ -4190,12 +2995,6 @@ destroy (GtkWidget *object)
container->details->idle_id = 0;
}
- if (container->details->stretch_idle_id != 0)
- {
- g_source_remove (container->details->stretch_idle_id);
- container->details->stretch_idle_id = 0;
- }
-
if (container->details->align_idle_id != 0)
{
g_source_remove (container->details->align_idle_id);
@@ -4227,9 +3026,6 @@ finalize (GObject *object)
g_signal_handlers_disconnect_by_func (nautilus_icon_view_preferences,
text_ellipsis_limit_changed_container_callback,
object);
- g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
- text_ellipsis_limit_changed_container_callback,
- object);
g_hash_table_destroy (details->icon_set);
details->icon_set = NULL;
@@ -4457,13 +3253,7 @@ style_updated (GtkWidget *widget)
container = NAUTILUS_CANVAS_CONTAINER (widget);
- /* Don't chain up to parent, if this is a desktop container,
- * because that resets the background of the window.
- */
- if (!nautilus_canvas_container_get_is_desktop (container))
- {
- GTK_WIDGET_CLASS (nautilus_canvas_container_parent_class)->style_updated (widget);
- }
+ GTK_WIDGET_CLASS (nautilus_canvas_container_parent_class)->style_updated (widget);
if (gtk_widget_get_realized (widget))
{
@@ -4702,274 +3492,11 @@ clear_drag_state (NautilusCanvasContainer *container)
}
static gboolean
-start_stretching (NautilusCanvasContainer *container,
- GdkEvent *event)
-{
- NautilusCanvasContainerDetails *details;
- NautilusCanvasIcon *icon;
- GtkWidget *toplevel;
- GdkDisplay *display;
- GtkCornerType corner;
- GdkCursor *cursor;
-
- details = container->details;
- icon = details->stretch_icon;
- display = gtk_widget_get_display (GTK_WIDGET (container));
-
- /* Check if we hit the stretch handles. */
- if (!nautilus_canvas_item_hit_test_stretch_handles (icon->item,
- details->drag_x, details->drag_y,
- &corner))
- {
- return FALSE;
- }
-
- switch (corner)
- {
- case GTK_CORNER_TOP_LEFT:
- {
- cursor = gdk_cursor_new_for_display (display, GDK_TOP_LEFT_CORNER);
- }
- break;
-
- case GTK_CORNER_BOTTOM_LEFT:
- {
- cursor = gdk_cursor_new_for_display (display, GDK_BOTTOM_LEFT_CORNER);
- }
- break;
-
- case GTK_CORNER_TOP_RIGHT:
- {
- cursor = gdk_cursor_new_for_display (display, GDK_TOP_RIGHT_CORNER);
- }
- break;
-
- case GTK_CORNER_BOTTOM_RIGHT:
- {
- cursor = gdk_cursor_new_for_display (display, GDK_BOTTOM_RIGHT_CORNER);
- }
- break;
-
- default:
- {
- cursor = NULL;
- }
- break;
- }
- /* Set up the dragging. */
- details->drag_state = DRAG_STATE_STRETCH;
- eel_canvas_w2c (EEL_CANVAS (container),
- details->drag_x,
- details->drag_y,
- &details->stretch_start.pointer_x,
- &details->stretch_start.pointer_y);
- eel_canvas_w2c (EEL_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);
-
- eel_canvas_item_grab (EEL_CANVAS_ITEM (icon->item),
- (GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK),
- cursor,
- event);
- if (cursor)
- {
- g_object_unref (cursor);
- }
-
- /* Ensure the window itself is focused.. */
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
- if (toplevel != NULL && gtk_widget_get_realized (toplevel))
- {
- gdk_window_focus (gtk_widget_get_window (toplevel), GDK_CURRENT_TIME);
- }
-
- return TRUE;
-}
-
-static gboolean
-update_stretch_at_idle (NautilusCanvasContainer *container)
-{
- NautilusCanvasContainerDetails *details;
- NautilusCanvasIcon *icon;
- double world_x, world_y;
- StretchState stretch_state;
-
- details = container->details;
- icon = details->stretch_icon;
-
- if (icon == NULL)
- {
- container->details->stretch_idle_id = 0;
- return FALSE;
- }
-
- eel_canvas_w2c (EEL_CANVAS (container),
- details->world_x, details->world_y,
- &stretch_state.pointer_x, &stretch_state.pointer_y);
-
- compute_stretch (&details->stretch_start,
- &stretch_state);
-
- eel_canvas_c2w (EEL_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, FALSE, FALSE);
-
- container->details->stretch_idle_id = 0;
-
- return FALSE;
-}
-
-static void
-continue_stretching (NautilusCanvasContainer *container,
- double world_x,
- double world_y)
-{
- g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
-
- container->details->world_x = world_x;
- container->details->world_y = world_y;
-
- if (container->details->stretch_idle_id == 0)
- {
- container->details->stretch_idle_id = g_idle_add ((GSourceFunc) update_stretch_at_idle, container);
- }
-}
-
-static gboolean
-keyboard_stretching (NautilusCanvasContainer *container,
- GdkEventKey *event)
-{
- NautilusCanvasIcon *icon;
- guint size;
-
- icon = container->details->stretch_icon;
-
- if (icon == NULL || !icon->is_selected)
- {
- return FALSE;
- }
-
- icon_get_size (container, icon, &size);
-
- switch (event->keyval)
- {
- case GDK_KEY_equal:
- case GDK_KEY_plus:
- case GDK_KEY_KP_Add:
- {
- icon_set_size (container, icon, size + 5, FALSE, FALSE);
- }
- break;
-
- case GDK_KEY_minus:
- case GDK_KEY_KP_Subtract:
- {
- icon_set_size (container, icon, size - 5, FALSE, FALSE);
- }
- break;
-
- case GDK_KEY_0:
- case GDK_KEY_KP_0:
- {
- nautilus_canvas_container_move_icon (container, icon,
- icon->x, icon->y,
- 1.0,
- FALSE, TRUE, TRUE);
- }
- break;
- }
-
- return TRUE;
-}
-
-static void
-ungrab_stretch_icon (NautilusCanvasContainer *container)
-{
- eel_canvas_item_ungrab (EEL_CANVAS_ITEM (container->details->stretch_icon->item));
-}
-
-static void
-end_stretching (NautilusCanvasContainer *container,
- double world_x,
- double world_y)
-{
- NautilusCanvasPosition position;
- NautilusCanvasIcon *icon;
-
- continue_stretching (container, world_x, world_y);
- ungrab_stretch_icon (container);
-
- /* now that we're done stretching, update the icon's position */
-
- icon = container->details->drag_icon;
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- position.x = icon->saved_ltr_x = get_mirror_x_position (container, icon, icon->x);
- }
- else
- {
- position.x = icon->x;
- }
- position.y = icon->y;
- position.scale = icon->scale;
- g_signal_emit (container,
- signals[ICON_POSITION_CHANGED], 0,
- icon->data, &position);
-
- clear_drag_state (container);
- redo_layout (container);
-}
-
-static gboolean
-undo_stretching (NautilusCanvasContainer *container)
-{
- NautilusCanvasIcon *stretched_icon;
-
- stretched_icon = container->details->stretch_icon;
-
- if (stretched_icon == NULL)
- {
- return FALSE;
- }
-
- if (container->details->drag_state == DRAG_STATE_STRETCH)
- {
- ungrab_stretch_icon (container);
- clear_drag_state (container);
- }
- nautilus_canvas_item_set_show_stretch_handles
- (stretched_icon->item, FALSE);
-
- icon_set_position (stretched_icon,
- container->details->stretch_initial_x,
- container->details->stretch_initial_y);
- icon_set_size (container,
- stretched_icon,
- container->details->stretch_initial_size,
- TRUE,
- TRUE);
-
- container->details->stretch_icon = NULL;
- emit_stretch_ended (container, stretched_icon);
- redo_layout (container);
-
- return TRUE;
-}
-
-static gboolean
button_release_event (GtkWidget *widget,
GdkEventButton *event)
{
NautilusCanvasContainer *container;
NautilusCanvasContainerDetails *details;
- double world_x, world_y;
container = NAUTILUS_CANVAS_CONTAINER (widget);
details = container->details;
@@ -5000,14 +3527,6 @@ button_release_event (GtkWidget *widget,
}
break;
- case DRAG_STATE_STRETCH:
- {
- eel_canvas_window_to_world
- (EEL_CANVAS (container), event->x, event->y, &world_x, &world_y);
- end_stretching (container, world_x, world_y);
- }
- break;
-
default:
{
}
@@ -5079,14 +3598,6 @@ motion_notify_event (GtkWidget *widget,
}
break;
- case DRAG_STATE_STRETCH:
- {
- eel_canvas_window_to_world
- (EEL_CANVAS (container), event->x, event->y, &world_x, &world_y);
- continue_stretching (container, world_x, world_y);
- }
- break;
-
default:
{
}
@@ -5208,27 +3719,6 @@ key_press_event (GtkWidget *widget,
}
break;
- case GDK_KEY_Escape:
- {
- handled = undo_stretching (container);
- }
- break;
-
- case GDK_KEY_plus:
- case GDK_KEY_minus:
- case GDK_KEY_equal:
- case GDK_KEY_KP_Add:
- case GDK_KEY_KP_Subtract:
- case GDK_KEY_0:
- case GDK_KEY_KP_0:
- {
- if (event->state & GDK_CONTROL_MASK)
- {
- handled = keyboard_stretching (container, event);
- }
- }
- break;
-
case GDK_KEY_F10:
{
/* handle Ctrl+F10 because we want to display the
@@ -5332,20 +3822,10 @@ nautilus_canvas_container_constructor (GType type,
construct_params);
container = NAUTILUS_CANVAS_CONTAINER (object);
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- g_signal_connect_swapped (nautilus_desktop_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
- G_CALLBACK (text_ellipsis_limit_changed_container_callback),
- container);
- }
- else
- {
- g_signal_connect_swapped (nautilus_icon_view_preferences,
- "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
- G_CALLBACK (text_ellipsis_limit_changed_container_callback),
- container);
- }
+ g_signal_connect_swapped (nautilus_icon_view_preferences,
+ "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
+ G_CALLBACK (text_ellipsis_limit_changed_container_callback),
+ container);
return object;
}
@@ -5441,37 +3921,6 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- signals[ICON_POSITION_CHANGED]
- = g_signal_new ("icon-position-changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- icon_position_changed),
- NULL, NULL,
- g_cclosure_marshal_generic,
- G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
- signals[ICON_STRETCH_STARTED]
- = g_signal_new ("icon-stretch-started",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- icon_stretch_started),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
- signals[ICON_STRETCH_ENDED]
- = g_signal_new ("icon-stretch-ended",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- icon_stretch_ended),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
signals[GET_ICON_URI]
= g_signal_new ("get-icon-uri",
G_TYPE_FROM_CLASS (class),
@@ -5510,13 +3959,10 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
move_copy_items),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 6,
+ G_TYPE_NONE, 3,
G_TYPE_POINTER,
G_TYPE_POINTER,
- G_TYPE_POINTER,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_NETSCAPE_URL]
= g_signal_new ("handle-netscape-url",
G_TYPE_FROM_CLASS (class),
@@ -5525,12 +3971,10 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
handle_netscape_url),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_URI_LIST]
= g_signal_new ("handle-uri-list",
G_TYPE_FROM_CLASS (class),
@@ -5539,12 +3983,10 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
handle_uri_list),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_TEXT]
= g_signal_new ("handle-text",
G_TYPE_FROM_CLASS (class),
@@ -5553,12 +3995,10 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
handle_text),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_RAW]
= g_signal_new ("handle-raw",
G_TYPE_FROM_CLASS (class),
@@ -5567,14 +4007,12 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
handle_raw),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 7,
+ G_TYPE_NONE, 5,
G_TYPE_POINTER,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_HOVER] =
g_signal_new ("handle-hover",
G_TYPE_FROM_CLASS (class),
@@ -5605,48 +4043,6 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
G_TYPE_INT, 2,
G_TYPE_POINTER,
G_TYPE_STRING);
- signals[GET_STORED_ICON_POSITION]
- = g_signal_new ("get-stored-icon-position",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- get_stored_icon_position),
- NULL, NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
- signals[GET_STORED_LAYOUT_TIMESTAMP]
- = g_signal_new ("get-stored-layout-timestamp",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- get_stored_layout_timestamp),
- NULL, NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
- signals[STORE_LAYOUT_TIMESTAMP]
- = g_signal_new ("store-layout-timestamp",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- store_layout_timestamp),
- NULL, NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
- signals[LAYOUT_CHANGED]
- = g_signal_new ("layout-changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusCanvasContainerClass,
- layout_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
signals[BAND_SELECT_STARTED]
= g_signal_new ("band-select-started",
G_TYPE_FROM_CLASS (class),
@@ -5770,7 +4166,6 @@ handle_scale_factor_changed (GObject *object,
static int text_ellipsis_limits[NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES];
-static int desktop_text_ellipsis_limit;
static gboolean
get_text_ellipsis_limit_for_zoom (char **strs,
@@ -5853,15 +4248,6 @@ text_ellipsis_limit_changed_callback (gpointer callback_data)
}
static void
-desktop_text_ellipsis_limit_changed_callback (gpointer callback_data)
-{
- int pref;
-
- pref = g_settings_get_int (nautilus_desktop_preferences, NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT);
- desktop_text_ellipsis_limit = pref;
-}
-
-static void
nautilus_canvas_container_init (NautilusCanvasContainer *container)
{
NautilusCanvasContainerDetails *details;
@@ -5870,7 +4256,6 @@ nautilus_canvas_container_init (NautilusCanvasContainer *container)
details = g_new0 (NautilusCanvasContainerDetails, 1);
details->icon_set = g_hash_table_new (g_direct_hash, g_direct_equal);
- details->layout_timestamp = UNDEFINED_TIME;
details->zoom_level = NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD;
container->details = details;
@@ -5891,12 +4276,6 @@ nautilus_canvas_container_init (NautilusCanvasContainer *container)
NULL);
text_ellipsis_limit_changed_callback (NULL);
- g_signal_connect_swapped (nautilus_icon_view_preferences,
- "changed::" NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
- G_CALLBACK (desktop_text_ellipsis_limit_changed_callback),
- NULL);
- desktop_text_ellipsis_limit_changed_callback (NULL);
-
setup_prefs = TRUE;
}
}
@@ -5993,17 +4372,6 @@ handle_canvas_button_press (NautilusCanvasContainer *container,
details->drag_y = event->y;
details->drag_state = DRAG_STATE_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, (GdkEvent *) event))
- {
- return TRUE;
- }
- }
}
/* Modify the selection as appropriate. Selection is modified
@@ -6142,8 +4510,6 @@ nautilus_canvas_container_clear (NautilusCanvasContainer *container)
g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
details = container->details;
- details->layout_timestamp = UNDEFINED_TIME;
- details->store_layout_timestamps_when_finishing_new_icons = FALSE;
if (details->icons == NULL)
{
@@ -6154,7 +4520,6 @@ nautilus_canvas_container_clear (NautilusCanvasContainer *container)
clear_keyboard_rubberband_start (container);
unschedule_keyboard_icon_reveal (container);
set_pending_icon_to_reveal (container, NULL);
- details->stretch_icon = NULL;
details->drop_target = NULL;
for (p = details->icons; p != NULL; p = p->next)
@@ -6224,24 +4589,8 @@ nautilus_canvas_container_get_first_visible_icon (NautilusCanvasContainer *conta
&x1, &y1, &x2, &y2);
compare_lt = FALSE;
- if (nautilus_canvas_container_is_layout_vertical (container))
- {
- pos = &x1;
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- compare_lt = TRUE;
- better_icon = x1 < x + ICON_PAD_LEFT;
- }
- else
- {
- better_icon = x2 > x + ICON_PAD_LEFT;
- }
- }
- else
- {
- pos = &y1;
- better_icon = y2 > y + ICON_PAD_TOP;
- }
+ pos = &y1;
+ better_icon = y2 > y + ICON_PAD_TOP;
if (better_icon)
{
if (best_icon == NULL)
@@ -6278,11 +4627,10 @@ nautilus_canvas_container_scroll_to_canvas (NautilusCanvasContainer *container,
{
GList *l;
NautilusCanvasIcon *icon;
- GtkAdjustment *hadj, *vadj;
+ GtkAdjustment *vadj;
EelIRect bounds;
GtkAllocation allocation;
- hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
@@ -6298,31 +4646,10 @@ nautilus_canvas_container_scroll_to_canvas (NautilusCanvasContainer *container,
if (icon->data == data &&
icon_is_positioned (icon))
{
- if (nautilus_canvas_container_is_auto_layout (container))
- {
- /* ensure that we reveal the entire row/column */
- icon_get_row_and_column_bounds (container, icon, &bounds);
- }
- else
- {
- item_get_canvas_bounds (EEL_CANVAS_ITEM (icon->item), &bounds);
- }
+ /* ensure that we reveal the entire row/column */
+ icon_get_row_and_column_bounds (container, icon, &bounds);
- if (nautilus_canvas_container_is_layout_vertical (container))
- {
- if (nautilus_canvas_container_is_layout_rtl (container))
- {
- gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
- }
- else
- {
- gtk_adjustment_set_value (hadj, bounds.x0);
- }
- }
- else
- {
- gtk_adjustment_set_value (vadj, bounds.y0);
- }
+ gtk_adjustment_set_value (vadj, bounds.y0);
}
l = l->next;
@@ -6440,10 +4767,6 @@ icon_destroy (NautilusCanvasContainer *container,
{
set_pending_icon_to_reveal (container, NULL);
}
- if (details->stretch_icon == icon)
- {
- details->stretch_icon = NULL;
- }
icon_free (icon);
@@ -6605,14 +4928,7 @@ nautilus_canvas_container_update_visible_icons (NautilusCanvasContainer *contain
&x1,
&y1);
- if (nautilus_canvas_container_is_layout_vertical (container))
- {
- visible = x1 >= min_x && x0 <= max_x;
- }
- else
- {
- visible = y1 >= min_y && y0 <= max_y;
- }
+ visible = y1 >= min_y && y0 <= max_y;
if (visible)
{
@@ -6632,20 +4948,14 @@ static void
handle_vadjustment_changed (GtkAdjustment *adjustment,
NautilusCanvasContainer *container)
{
- if (!nautilus_canvas_container_is_layout_vertical (container))
- {
- nautilus_canvas_container_update_visible_icons (container);
- }
+ nautilus_canvas_container_update_visible_icons (container);
}
static void
handle_hadjustment_changed (GtkAdjustment *adjustment,
NautilusCanvasContainer *container)
{
- if (nautilus_canvas_container_is_layout_vertical (container))
- {
- nautilus_canvas_container_update_visible_icons (container);
- }
+ nautilus_canvas_container_update_visible_icons (container);
}
@@ -6707,37 +5017,6 @@ nautilus_canvas_container_update_icon (NautilusCanvasContainer *container,
g_free (additional_text);
}
-static gboolean
-assign_icon_position (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon)
-{
- gboolean have_stored_position;
- NautilusCanvasPosition position;
-
- /* Get the stored position. */
- have_stored_position = FALSE;
- position.scale = 1.0;
- g_signal_emit (container,
- signals[GET_STORED_ICON_POSITION], 0,
- icon->data,
- &position,
- &have_stored_position);
- icon->scale = position.scale;
- if (!container->details->auto_layout)
- {
- if (have_stored_position)
- {
- icon_set_position (icon, position.x, position.y);
- icon->saved_ltr_x = icon->x;
- }
- else
- {
- return FALSE;
- }
- }
- return TRUE;
-}
-
static void
finish_adding_icon (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
@@ -6754,147 +5033,22 @@ finish_adding_icon (NautilusCanvasContainer *container,
static gboolean
finish_adding_new_icons (NautilusCanvasContainer *container)
{
- GList *p, *new_icons, *no_position_icons, *semi_position_icons;
- NautilusCanvasIcon *icon;
- double bottom;
+ GList *p, *new_icons;
new_icons = container->details->new_icons;
container->details->new_icons = NULL;
/* Position most icons (not unpositioned manual-layout icons). */
new_icons = g_list_reverse (new_icons);
- no_position_icons = semi_position_icons = NULL;
for (p = new_icons; p != NULL; p = p->next)
{
- icon = p->data;
- if (icon->has_lazy_position)
- {
- if (!assign_icon_position (container, icon))
- {
- semi_position_icons = g_list_prepend (semi_position_icons, icon);
- }
- }
- else if (!assign_icon_position (container, icon))
- {
- no_position_icons = g_list_prepend (no_position_icons, icon);
- }
-
- finish_adding_icon (container, icon);
+ finish_adding_icon (container, p->data);
}
g_list_free (new_icons);
- if (semi_position_icons != NULL)
- {
- PlacementGrid *grid;
- time_t now;
- gboolean dummy;
-
- g_assert (!container->details->auto_layout);
-
- semi_position_icons = g_list_reverse (semi_position_icons);
-
- /* This is currently only used on the desktop.
- * Thus, we pass FALSE for tight, like lay_down_icons_tblr */
- grid = placement_grid_new (container, FALSE);
-
- /* we can do nothing, just return */
- if (grid == NULL)
- {
- return FALSE;
- }
-
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- if (icon_is_positioned (icon) && !icon->has_lazy_position)
- {
- placement_grid_mark_icon (grid, icon);
- }
- }
-
- now = time (NULL);
-
- for (p = semi_position_icons; p != NULL; p = p->next)
- {
- NautilusCanvasIcon *icon;
- NautilusCanvasPosition position;
- int x, y;
-
- icon = p->data;
- x = icon->x;
- y = icon->y;
-
- find_empty_location (container, grid,
- icon, x, y, &x, &y);
-
- icon_set_position (icon, x, y);
-
- position.x = icon->x;
- position.y = icon->y;
- position.scale = icon->scale;
- placement_grid_mark_icon (grid, icon);
- g_signal_emit (container, signals[ICON_POSITION_CHANGED], 0,
- icon->data, &position);
- g_signal_emit (container, signals[STORE_LAYOUT_TIMESTAMP], 0,
- icon->data, &now, &dummy);
-
- /* ensure that next time we run this code, the formerly semi-positioned
- * icons are treated as being positioned. */
- icon->has_lazy_position = FALSE;
- }
-
- placement_grid_free (grid);
-
- g_list_free (semi_position_icons);
- }
-
- /* Position the unpositioned manual layout icons. */
- if (no_position_icons != NULL)
- {
- g_assert (!container->details->auto_layout);
-
- sort_icons (container, &no_position_icons);
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- lay_down_icons (container, no_position_icons, CONTAINER_PAD_TOP);
- }
- else
- {
- get_all_icon_bounds (container, NULL, NULL, NULL, &bottom, BOUNDS_USAGE_FOR_LAYOUT);
- lay_down_icons (container, no_position_icons, bottom + ICON_PAD_BOTTOM);
- }
- g_list_free (no_position_icons);
- }
-
- if (container->details->store_layout_timestamps_when_finishing_new_icons)
- {
- store_layout_timestamps_now (container);
- container->details->store_layout_timestamps_when_finishing_new_icons = FALSE;
- }
-
return TRUE;
}
-static gboolean
-is_old_or_unknown_icon_data (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data)
-{
- time_t timestamp;
- gboolean success;
-
- if (container->details->layout_timestamp == UNDEFINED_TIME)
- {
- /* don't know */
- return FALSE;
- }
-
- g_signal_emit (container,
- signals[GET_STORED_LAYOUT_TIMESTAMP], 0,
- data, &timestamp, &success);
- return (!success || timestamp < container->details->layout_timestamp);
-}
-
/**
* nautilus_canvas_container_add:
* @container: A NautilusCanvasContainer
@@ -6931,8 +5085,6 @@ nautilus_canvas_container_add (NautilusCanvasContainer *container,
* if the previous icon position is free. If the position
* is occupied, another position near the last one will
*/
- icon->has_lazy_position = is_old_or_unknown_icon_data (container, data);
- icon->scale = 1.0;
icon->item = NAUTILUS_CANVAS_ITEM
(eel_canvas_item_new (EEL_CANVAS_GROUP (EEL_CANVAS (container)->root),
nautilus_canvas_item_get_type (),
@@ -7223,11 +5375,9 @@ nautilus_canvas_container_get_icons_bounding_box (NautilusCanvasContainer *conta
icon_get_bounding_box ((NautilusCanvasIcon *) node->data,
&x1, &y1, &x2, &y2,
BOUNDS_USAGE_FOR_DISPLAY);
- g_array_index (result, GdkRectangle, index).x = x1 * EEL_CANVAS (container)->pixels_per_unit +
- container->details->left_margin;
+ g_array_index (result, GdkRectangle, index).x = x1 * EEL_CANVAS (container)->pixels_per_unit;
g_array_index (result, GdkRectangle, index).width = (x2 - x1) * EEL_CANVAS (container)->pixels_per_unit;
- g_array_index (result, GdkRectangle, index).y = y1 * EEL_CANVAS (container)->pixels_per_unit +
- container->details->top_margin;
+ g_array_index (result, GdkRectangle, index).y = y1 * EEL_CANVAS (container)->pixels_per_unit;
g_array_index (result, GdkRectangle, index).height = (y2 - y1) * EEL_CANVAS (container)->pixels_per_unit;
}
@@ -7558,162 +5708,6 @@ has_selection (NautilusCanvasContainer *container)
return get_nth_selected_icon (container, 1) != NULL;
}
-/**
- * nautilus_canvas_container_show_stretch_handles:
- * @container: An canvas container widget.
- *
- * Makes stretch handles visible on the first selected icon.
- **/
-void
-nautilus_canvas_container_show_stretch_handles (NautilusCanvasContainer *container)
-{
- NautilusCanvasContainerDetails *details;
- NautilusCanvasIcon *icon;
- guint initial_size;
-
- 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 canvas. */
- if (details->stretch_icon != NULL)
- {
- nautilus_canvas_item_set_show_stretch_handles
- (details->stretch_icon->item, FALSE);
- ungrab_stretch_icon (container);
- emit_stretch_ended (container, details->stretch_icon);
- }
- nautilus_canvas_item_set_show_stretch_handles (icon->item, TRUE);
- details->stretch_icon = icon;
-
- icon_get_size (container, icon, &initial_size);
-
- /* only need to keep size in one dimension, since they are constrained to be the same */
- container->details->stretch_initial_x = icon->x;
- container->details->stretch_initial_y = icon->y;
- container->details->stretch_initial_size = initial_size;
-
- emit_stretch_started (container, icon);
-}
-
-/**
- * nautilus_canvas_container_has_stretch_handles
- * @container: An canvas container widget.
- *
- * Returns true if the first selected item has stretch handles.
- **/
-gboolean
-nautilus_canvas_container_has_stretch_handles (NautilusCanvasContainer *container)
-{
- NautilusCanvasIcon *icon;
-
- icon = get_first_selected_icon (container);
- if (icon == NULL)
- {
- return FALSE;
- }
-
- return icon == container->details->stretch_icon;
-}
-
-/**
- * nautilus_canvas_container_is_stretched
- * @container: An canvas container widget.
- *
- * Returns true if the any selected item is stretched to a size other than 1.0.
- **/
-gboolean
-nautilus_canvas_container_is_stretched (NautilusCanvasContainer *container)
-{
- GList *p;
- NautilusCanvasIcon *icon;
-
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
- if (icon->is_selected && icon->scale != 1.0)
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nautilus_canvas_container_unstretch
- * @container: An canvas container widget.
- *
- * Gets rid of any canvas stretching.
- **/
-void
-nautilus_canvas_container_unstretch (NautilusCanvasContainer *container)
-{
- GList *p;
- NautilusCanvasIcon *icon;
-
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
- if (icon->is_selected)
- {
- nautilus_canvas_container_move_icon (container, icon,
- icon->x, icon->y,
- 1.0,
- FALSE, TRUE, TRUE);
- }
- }
-}
-
-static void
-compute_stretch (StretchState *start,
- StretchState *current)
-{
- gboolean right, bottom;
- int x_stretch, y_stretch;
-
- /* FIXME bugzilla.gnome.org 45390: This doesn't correspond to
- * the way the handles are drawn.
- */
- /* Figure out which handle we are dragging. */
- right = start->pointer_x > start->icon_x + (int) start->icon_size / 2;
- bottom = start->pointer_y > start->icon_y + (int) 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_CANVAS_ICON_SIZE_SMALL);
-
- /* 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_canvas_container_get_icon_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
@@ -7768,164 +5762,13 @@ reset_scroll_region_if_not_empty (NautilusCanvasContainer *container)
}
}
-/* Switch from automatic layout to manual or vice versa.
- * If we switch to manual layout, we restore the icon positions from the
- * last manual layout.
- */
-void
-nautilus_canvas_container_set_auto_layout (NautilusCanvasContainer *container,
- gboolean auto_layout)
-{
- g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
- g_return_if_fail (auto_layout == FALSE || auto_layout == TRUE);
-
- if (container->details->auto_layout == auto_layout)
- {
- return;
- }
-
- reset_scroll_region_if_not_empty (container);
- container->details->auto_layout = auto_layout;
-
- if (!auto_layout)
- {
- reload_icon_positions (container);
- nautilus_canvas_container_freeze_icon_positions (container);
- }
-
- container->details->needs_resort = TRUE;
- redo_layout (container);
-
- g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
-}
-
-gboolean
-nautilus_canvas_container_is_keep_aligned (NautilusCanvasContainer *container)
-{
- return container->details->keep_aligned;
-}
-
-static gboolean
-align_icons_callback (gpointer callback_data)
-{
- NautilusCanvasContainer *container;
-
- container = NAUTILUS_CANVAS_CONTAINER (callback_data);
- align_icons (container);
- container->details->align_idle_id = 0;
-
- return FALSE;
-}
-
-static void
-unschedule_align_icons (NautilusCanvasContainer *container)
-{
- if (container->details->align_idle_id != 0)
- {
- g_source_remove (container->details->align_idle_id);
- container->details->align_idle_id = 0;
- }
-}
-
-static void
-schedule_align_icons (NautilusCanvasContainer *container)
-{
- if (container->details->align_idle_id == 0
- && container->details->has_been_allocated)
- {
- container->details->align_idle_id = g_idle_add
- (align_icons_callback, container);
- }
-}
-
-void
-nautilus_canvas_container_set_keep_aligned (NautilusCanvasContainer *container,
- gboolean keep_aligned)
-{
- if (container->details->keep_aligned != keep_aligned)
- {
- container->details->keep_aligned = keep_aligned;
-
- if (keep_aligned && !container->details->auto_layout)
- {
- schedule_align_icons (container);
- }
- else
- {
- unschedule_align_icons (container);
- }
- }
-}
-
-/* Switch from automatic to manual layout, freezing all the icons in their
- * current positions instead of restoring canvas positions from the last manual
- * layout as set_auto_layout does.
- */
-void
-nautilus_canvas_container_freeze_icon_positions (NautilusCanvasContainer *container)
-{
- gboolean changed;
- GList *p;
- NautilusCanvasIcon *icon;
- NautilusCanvasPosition position;
-
- /* This early-exit avoids freezing the icons before they have been properly
- * positioned, since we won't re-layout if auto_layout is FALSE.
- *
- * The container will freeze the icons after it lays them out once we've
- * been allocated (e.g. in lay_out_icons_vertical_desktop).
- */
- if (!container->details->has_been_allocated)
- {
- g_debug ("Not freezing icon positions yet; we haven't been allocated");
- return;
- }
-
- changed = container->details->auto_layout;
- container->details->auto_layout = FALSE;
-
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- position.x = icon->saved_ltr_x;
- position.y = icon->y;
- position.scale = icon->scale;
- g_signal_emit (container, signals[ICON_POSITION_CHANGED], 0,
- icon->data, &position);
- }
-
- if (changed)
- {
- g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
- }
-}
-
/* Re-sort, switching to automatic layout if it was in manual layout. */
void
nautilus_canvas_container_sort (NautilusCanvasContainer *container)
{
- gboolean changed;
-
- changed = !container->details->auto_layout;
- container->details->auto_layout = TRUE;
-
reset_scroll_region_if_not_empty (container);
container->details->needs_resort = TRUE;
redo_layout (container);
-
- if (changed)
- {
- g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
- }
-}
-
-gboolean
-nautilus_canvas_container_is_auto_layout (NautilusCanvasContainer *container)
-{
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container), FALSE);
-
- return container->details->auto_layout;
}
void
@@ -7937,68 +5780,6 @@ nautilus_canvas_container_set_single_click_mode (NautilusCanvasContainer *contai
container->details->single_click_mode = single_click_mode;
}
-/* Return if the canvas container is a fixed size */
-gboolean
-nautilus_canvas_container_get_is_fixed_size (NautilusCanvasContainer *container)
-{
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container), FALSE);
-
- return container->details->is_fixed_size;
-}
-
-/* Set the canvas container to be a fixed size */
-void
-nautilus_canvas_container_set_is_fixed_size (NautilusCanvasContainer *container,
- gboolean is_fixed_size)
-{
- g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
-
- container->details->is_fixed_size = is_fixed_size;
-}
-
-gboolean
-nautilus_canvas_container_get_is_desktop (NautilusCanvasContainer *container)
-{
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container), FALSE);
-
- return container->details->is_desktop;
-}
-
-void
-nautilus_canvas_container_set_is_desktop (NautilusCanvasContainer *container,
- gboolean is_desktop)
-{
- g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
-
- container->details->is_desktop = is_desktop;
-
- if (is_desktop)
- {
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (container));
- gtk_style_context_add_class (context, "nautilus-desktop");
- }
-}
-
-void
-nautilus_canvas_container_set_margins (NautilusCanvasContainer *container,
- int left_margin,
- int right_margin,
- int top_margin,
- int bottom_margin)
-{
- g_return_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container));
-
- container->details->left_margin = left_margin;
- container->details->right_margin = right_margin;
- container->details->top_margin = top_margin;
- container->details->bottom_margin = bottom_margin;
-
- /* redo layout of icons as the margins have changed */
- schedule_redo_layout (container);
-}
-
/* handle theme changes */
void
@@ -8638,28 +6419,12 @@ nautilus_canvas_container_is_layout_rtl (NautilusCanvasContainer *container)
return (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL);
}
-gboolean
-nautilus_canvas_container_is_layout_vertical (NautilusCanvasContainer *container)
-{
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_CONTAINER (container), FALSE);
-
- /* we only do vertical layout in the desktop nowadays */
- return container->details->is_desktop;
-}
-
int
nautilus_canvas_container_get_max_layout_lines_for_pango (NautilusCanvasContainer *container)
{
int limit;
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- limit = desktop_text_ellipsis_limit;
- }
- else
- {
- limit = text_ellipsis_limits[container->details->zoom_level];
- }
+ limit = text_ellipsis_limits[container->details->zoom_level];
if (limit <= 0)
{
@@ -8674,14 +6439,7 @@ nautilus_canvas_container_get_max_layout_lines (NautilusCanvasContainer *contain
{
int limit;
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- limit = desktop_text_ellipsis_limit;
- }
- else
- {
- limit = text_ellipsis_limits[container->details->zoom_level];
- }
+ limit = text_ellipsis_limits[container->details->zoom_level];
if (limit <= 0)
{
@@ -8690,113 +6448,3 @@ nautilus_canvas_container_get_max_layout_lines (NautilusCanvasContainer *contain
return limit;
}
-
-void
-nautilus_canvas_container_begin_loading (NautilusCanvasContainer *container)
-{
- gboolean dummy;
-
- if (nautilus_canvas_container_get_store_layout_timestamps (container))
- {
- container->details->layout_timestamp = UNDEFINED_TIME;
- g_signal_emit (container,
- signals[GET_STORED_LAYOUT_TIMESTAMP], 0,
- NULL, &container->details->layout_timestamp, &dummy);
- }
-}
-
-static void
-store_layout_timestamps_now (NautilusCanvasContainer *container)
-{
- NautilusCanvasIcon *icon;
- GList *p;
- gboolean dummy;
-
- container->details->layout_timestamp = time (NULL);
- g_signal_emit (container,
- signals[STORE_LAYOUT_TIMESTAMP], 0,
- NULL, &container->details->layout_timestamp, &dummy);
-
- for (p = container->details->icons; p != NULL; p = p->next)
- {
- icon = p->data;
-
- g_signal_emit (container,
- signals[STORE_LAYOUT_TIMESTAMP], 0,
- icon->data, &container->details->layout_timestamp, &dummy);
- }
-}
-
-
-void
-nautilus_canvas_container_end_loading (NautilusCanvasContainer *container,
- gboolean all_icons_added)
-{
- if (all_icons_added &&
- nautilus_canvas_container_get_store_layout_timestamps (container))
- {
- if (container->details->new_icons == NULL)
- {
- store_layout_timestamps_now (container);
- }
- else
- {
- container->details->store_layout_timestamps_when_finishing_new_icons = TRUE;
- }
- }
-}
-
-gboolean
-nautilus_canvas_container_get_store_layout_timestamps (NautilusCanvasContainer *container)
-{
- return container->details->store_layout_timestamps;
-}
-
-
-void
-nautilus_canvas_container_set_store_layout_timestamps (NautilusCanvasContainer *container,
- gboolean store_layout_timestamps)
-{
- container->details->store_layout_timestamps = store_layout_timestamps;
-}
-
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-static char *
-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_canvas_container (void)
-{
- EEL_CHECK_STRING_RESULT (check_compute_stretch (0, 0, 64, 0, 0, 0, 0), "0,0:64");
- EEL_CHECK_STRING_RESULT (check_compute_stretch (0, 0, 64, 64, 64, 65, 65), "0,0:65");
- EEL_CHECK_STRING_RESULT (check_compute_stretch (0, 0, 64, 64, 64, 65, 64), "0,0:64");
- EEL_CHECK_STRING_RESULT (check_compute_stretch (100, 100, 64, 105, 105, 40, 40), "35,35:129");
-}
-
-#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
diff --git a/src/nautilus-canvas-container.h b/src/nautilus-canvas-container.h
index 635349d7e..63cec4b6b 100644
--- a/src/nautilus-canvas-container.h
+++ b/src/nautilus-canvas-container.h
@@ -86,7 +86,6 @@ typedef struct {
GdkEventButton *event);
void (* move_copy_items) (NautilusCanvasContainer *container,
const GList *item_uris,
- GdkPoint *relative_item_points,
const char *target_uri,
GdkDragAction action,
int x,
@@ -194,10 +193,6 @@ typedef struct {
void (* icon_position_changed) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data,
const NautilusCanvasPosition *position);
- void (* icon_stretch_started) (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data);
- void (* icon_stretch_ended) (NautilusCanvasContainer *container,
- NautilusCanvasIconData *data);
int (* preview) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data,
gboolean start_flag);
@@ -238,14 +233,6 @@ void nautilus_canvas_container_begin_loading (Nauti
void nautilus_canvas_container_end_loading (NautilusCanvasContainer *container,
gboolean all_icons_added);
-/* control the layout */
-gboolean nautilus_canvas_container_is_auto_layout (NautilusCanvasContainer *container);
-void nautilus_canvas_container_set_auto_layout (NautilusCanvasContainer *container,
- gboolean auto_layout);
-
-gboolean nautilus_canvas_container_is_keep_aligned (NautilusCanvasContainer *container);
-void nautilus_canvas_container_set_keep_aligned (NautilusCanvasContainer *container,
- gboolean keep_aligned);
void nautilus_canvas_container_sort (NautilusCanvasContainer *container);
void nautilus_canvas_container_freeze_icon_positions (NautilusCanvasContainer *container);
@@ -270,10 +257,6 @@ void nautilus_canvas_container_set_selection (Nauti
GList *selection);
GArray * nautilus_canvas_container_get_selected_icon_locations (NautilusCanvasContainer *view);
GArray * nautilus_canvas_container_get_selected_icons_bounding_box (NautilusCanvasContainer *container);
-gboolean nautilus_canvas_container_has_stretch_handles (NautilusCanvasContainer *container);
-gboolean nautilus_canvas_container_is_stretched (NautilusCanvasContainer *container);
-void nautilus_canvas_container_show_stretch_handles (NautilusCanvasContainer *container);
-void nautilus_canvas_container_unstretch (NautilusCanvasContainer *container);
/* options */
NautilusCanvasZoomLevel nautilus_canvas_container_get_zoom_level (NautilusCanvasContainer *view);
@@ -283,12 +266,6 @@ void nautilus_canvas_container_set_single_click_mode (Nauti
gboolean single_click_mode);
void nautilus_canvas_container_enable_linger_selection (NautilusCanvasContainer *view,
gboolean enable);
-gboolean nautilus_canvas_container_get_is_fixed_size (NautilusCanvasContainer *container);
-void nautilus_canvas_container_set_is_fixed_size (NautilusCanvasContainer *container,
- gboolean is_fixed_size);
-gboolean nautilus_canvas_container_get_is_desktop (NautilusCanvasContainer *container);
-void nautilus_canvas_container_set_is_desktop (NautilusCanvasContainer *container,
- gboolean is_desktop);
void nautilus_canvas_container_reset_scroll_region (NautilusCanvasContainer *container);
void nautilus_canvas_container_set_font (NautilusCanvasContainer *container,
const char *font);
@@ -301,24 +278,17 @@ char* nautilus_canvas_container_get_icon_description (Nauti
NautilusCanvasIconData *data);
gboolean nautilus_canvas_container_is_layout_rtl (NautilusCanvasContainer *container);
-gboolean nautilus_canvas_container_is_layout_vertical (NautilusCanvasContainer *container);
gboolean nautilus_canvas_container_get_store_layout_timestamps (NautilusCanvasContainer *container);
-void nautilus_canvas_container_set_store_layout_timestamps (NautilusCanvasContainer *container,
- gboolean store_layout);
void nautilus_canvas_container_widget_to_file_operation_position (NautilusCanvasContainer *container,
GdkPoint *position);
guint nautilus_canvas_container_get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level);
-#define CANVAS_WIDTH(container,allocation) ((allocation.width \
- - container->details->left_margin \
- - container->details->right_margin) \
+#define CANVAS_WIDTH(container,allocation) (allocation.width \
/ EEL_CANVAS (container)->pixels_per_unit)
-#define CANVAS_HEIGHT(container,allocation) ((allocation.height \
- - container->details->top_margin \
- - container->details->bottom_margin) \
+#define CANVAS_HEIGHT(container,allocation) (allocation.height \
/ EEL_CANVAS (container)->pixels_per_unit)
#endif /* NAUTILUS_CANVAS_CONTAINER_H */
diff --git a/src/nautilus-canvas-dnd.c b/src/nautilus-canvas-dnd.c
index 7ef7dd56e..27f1a6c3b 100644
--- a/src/nautilus-canvas-dnd.c
+++ b/src/nautilus-canvas-dnd.c
@@ -87,8 +87,7 @@ static char *nautilus_canvas_container_find_drop_target (NautilusCanvasContainer
GdkDragContext *context,
int x,
int y,
- gboolean *icon_hit,
- gboolean rewrite_desktop);
+ gboolean *icon_hit);
static EelCanvasItem *
create_selection_shadow (NautilusCanvasContainer *container,
@@ -252,7 +251,7 @@ icon_get_data_binder (NautilusCanvasIcon *icon,
uri = nautilus_canvas_container_get_icon_uri (container, icon);
file = nautilus_file_get_by_uri (uri);
- if (!eel_uri_is_desktop (uri) && !nautilus_file_is_nautilus_link (file))
+ if (!nautilus_file_is_nautilus_link (file))
{
g_free (uri);
uri = nautilus_canvas_container_get_icon_activation_uri (container, icon);
@@ -482,7 +481,7 @@ set_direct_save_uri (GtkWidget *widget,
filename = get_direct_save_filename (context);
drop_target = nautilus_canvas_container_find_drop_target (NAUTILUS_CANVAS_CONTAINER (widget),
- context, x, y, NULL, TRUE);
+ context, x, y, NULL);
if (drop_target && eel_uri_is_trash (drop_target))
{
@@ -537,14 +536,7 @@ get_data_on_first_target_we_support (GtkWidget *widget,
gtk_target_list_add_text_targets (drop_types_list_root, NAUTILUS_ICON_DND_TEXT);
}
- if (nautilus_canvas_container_get_is_desktop (NAUTILUS_CANVAS_CONTAINER (widget)))
- {
- list = drop_types_list_root;
- }
- else
- {
- list = drop_types_list;
- }
+ list = drop_types_list;
target = gtk_drag_dest_find_target (widget, context, list);
if (target != GDK_NONE)
@@ -685,14 +677,8 @@ nautilus_canvas_container_selection_items_local (NautilusCanvasContainer *contai
/* get the URI associated with the container */
container_uri_string = get_container_uri (container);
- if (eel_uri_is_desktop (container_uri_string))
- {
- result = nautilus_drag_items_on_desktop (items);
- }
- else
- {
- result = nautilus_drag_items_local (container_uri_string, items);
- }
+ result = nautilus_drag_items_local (container_uri_string, items);
+
g_free (container_uri_string);
return result;
@@ -713,13 +699,12 @@ receive_dropped_netscape_url (NautilusCanvasContainer *container,
return;
}
- drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL, TRUE);
+ drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL);
g_signal_emit_by_name (container, "handle-netscape-url",
encoded_url,
drop_target,
- gdk_drag_context_get_selected_action (context),
- x, y);
+ gdk_drag_context_get_selected_action (context));
g_free (drop_target);
}
@@ -739,13 +724,12 @@ receive_dropped_uri_list (NautilusCanvasContainer *container,
return;
}
- drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL, TRUE);
+ drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL);
g_signal_emit_by_name (container, "handle-uri-list",
uri_list,
drop_target,
- gdk_drag_context_get_selected_action (context),
- x, y);
+ gdk_drag_context_get_selected_action (context));
g_free (drop_target);
}
@@ -765,13 +749,12 @@ receive_dropped_text (NautilusCanvasContainer *container,
return;
}
- drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL, TRUE);
+ drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL);
g_signal_emit_by_name (container, "handle-text",
text,
drop_target,
- gdk_drag_context_get_selected_action (context),
- x, y);
+ gdk_drag_context_get_selected_action (context));
g_free (drop_target);
}
@@ -793,15 +776,14 @@ receive_dropped_raw (NautilusCanvasContainer *container,
return;
}
- drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL, TRUE);
+ drop_target = nautilus_canvas_container_find_drop_target (container, context, x, y, NULL);
g_signal_emit_by_name (container, "handle-raw",
raw_data,
length,
drop_target,
direct_save_uri,
- gdk_drag_context_get_selected_action (context),
- x, y);
+ gdk_drag_context_get_selected_action (context));
g_free (drop_target);
}
@@ -910,87 +892,13 @@ stop_auto_scroll (NautilusCanvasContainer *container)
}
static void
-handle_local_move (NautilusCanvasContainer *container,
- double world_x,
- double world_y)
-{
- GList *moved_icons, *p;
- NautilusDragSelectionItem *item;
- NautilusCanvasIcon *icon;
- NautilusFile *file;
- char screen_string[32];
- GdkScreen *screen;
- time_t now;
-
- if (container->details->auto_layout)
- {
- return;
- }
-
- time (&now);
-
- /* Move and select the icons. */
- moved_icons = NULL;
- for (p = container->details->dnd_info->drag_info.selection_list; p != NULL; p = p->next)
- {
- item = p->data;
-
- icon = nautilus_canvas_container_get_icon_by_uri
- (container, item->uri);
-
- if (icon == NULL)
- {
- /* probably dragged from another screen. Add it to
- * this screen
- */
-
- file = nautilus_file_get_by_uri (item->uri);
-
- screen = gtk_widget_get_screen (GTK_WIDGET (container));
- g_snprintf (screen_string, sizeof (screen_string), "%d",
- gdk_screen_get_number (screen));
- nautilus_file_set_metadata (file,
- NAUTILUS_METADATA_KEY_SCREEN,
- NULL, screen_string);
- nautilus_file_set_time_metadata (file,
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP, now);
-
- nautilus_canvas_container_add (container, NAUTILUS_CANVAS_ICON_DATA (file));
-
- icon = nautilus_canvas_container_get_icon_by_uri
- (container, item->uri);
- }
-
- if (item->got_icon_position)
- {
- nautilus_canvas_container_move_icon
- (container, icon,
- world_x + item->icon_x, world_y + item->icon_y,
- icon->scale,
- TRUE, TRUE, TRUE);
- }
- moved_icons = g_list_prepend (moved_icons, icon);
- }
- nautilus_canvas_container_select_list_unselect_others
- (container, moved_icons);
- /* Might have been moved in a way that requires adjusting scroll region. */
- nautilus_canvas_container_update_scroll_region (container);
- g_list_free (moved_icons);
-}
-
-static void
handle_nonlocal_move (NautilusCanvasContainer *container,
GdkDragAction action,
- int x,
- int y,
const char *target_uri,
gboolean icon_hit)
{
GList *source_uris, *p;
- GArray *source_item_locations = NULL;
gboolean free_target_uri, is_rtl;
- int index, item_x;
- GtkAllocation allocation;
if (container->details->dnd_info->drag_info.selection_list == NULL)
{
@@ -1007,50 +915,13 @@ handle_nonlocal_move (NautilusCanvasContainer *container,
is_rtl = nautilus_canvas_container_is_layout_rtl (container);
- if (!icon_hit && eel_uri_is_desktop (target_uri))
- {
- /* Drop onto a container. Pass along the item points to allow placing
- * the items in their same relative positions in the new container.
- */
- source_item_locations = g_array_new (FALSE, TRUE, sizeof (GdkPoint));
- source_item_locations = g_array_set_size (source_item_locations,
- g_list_length (container->details->dnd_info->drag_info.selection_list));
-
- for (index = 0, p = container->details->dnd_info->drag_info.selection_list;
- p != NULL; index++, p = p->next)
- {
- item_x = ((NautilusDragSelectionItem *) p->data)->icon_x;
- if (is_rtl)
- {
- item_x = -item_x - ((NautilusDragSelectionItem *) p->data)->icon_width;
- }
- g_array_index (source_item_locations, GdkPoint, index).x = item_x;
- g_array_index (source_item_locations, GdkPoint, index).y =
- ((NautilusDragSelectionItem *) p->data)->icon_y;
- }
- }
-
free_target_uri = FALSE;
- /* Rewrite internal desktop URIs to the normal target uri */
- if (eel_uri_is_desktop (target_uri))
- {
- target_uri = nautilus_get_desktop_directory_uri ();
- free_target_uri = TRUE;
- }
-
- if (is_rtl)
- {
- gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
- x = CANVAS_WIDTH (container, allocation) - x;
- }
/* start the copy */
g_signal_emit_by_name (container, "move-copy-items",
source_uris,
- source_item_locations,
target_uri,
- action,
- x, y);
+ action);
if (free_target_uri)
{
@@ -1058,10 +929,6 @@ handle_nonlocal_move (NautilusCanvasContainer *container,
}
g_list_free (source_uris);
- if (source_item_locations != NULL)
- {
- g_array_free (source_item_locations, TRUE);
- }
}
static char *
@@ -1069,8 +936,7 @@ nautilus_canvas_container_find_drop_target (NautilusCanvasContainer *container,
GdkDragContext *context,
int x,
int y,
- gboolean *icon_hit,
- gboolean rewrite_desktop)
+ gboolean *icon_hit)
{
NautilusCanvasIcon *drop_target_icon;
double world_x, world_y;
@@ -1131,24 +997,16 @@ nautilus_canvas_container_find_drop_target (NautilusCanvasContainer *container,
if (container_uri != NULL)
{
- if (rewrite_desktop && eel_uri_is_desktop (container_uri))
+ gboolean can;
+ file = nautilus_file_get_by_uri (container_uri);
+ can = nautilus_drag_can_accept_info (file,
+ container->details->dnd_info->drag_info.data_type,
+ container->details->dnd_info->drag_info.selection_list);
+ g_object_unref (file);
+ if (!can)
{
g_free (container_uri);
- container_uri = nautilus_get_desktop_directory_uri ();
- }
- else
- {
- gboolean can;
- file = nautilus_file_get_by_uri (container_uri);
- can = nautilus_drag_can_accept_info (file,
- container->details->dnd_info->drag_info.data_type,
- container->details->dnd_info->drag_info.selection_list);
- g_object_unref (file);
- if (!can)
- {
- g_free (container_uri);
- container_uri = NULL;
- }
+ container_uri = NULL;
}
}
@@ -1185,19 +1043,8 @@ nautilus_canvas_container_receive_dropped_icons (NautilusCanvasContainer *contai
if (real_action == GDK_ACTION_ASK)
{
- /* FIXME bugzilla.gnome.org 42485: This belongs in FMDirectoryView, not here. */
- /* Check for special case items in selection list */
- if (nautilus_drag_selection_includes_special_link (container->details->dnd_info->drag_info.selection_list))
- {
- /* We only want to move the trash */
- action = GDK_ACTION_MOVE;
- }
- else
- {
- action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
- }
- real_action = nautilus_drag_drop_action_ask
- (GTK_WIDGET (container), action);
+ action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
+ real_action = nautilus_drag_drop_action_ask (GTK_WIDGET (container), action);
}
if (real_action > 0)
@@ -1208,25 +1055,19 @@ nautilus_canvas_container_receive_dropped_icons (NautilusCanvasContainer *contai
&world_x, &world_y);
drop_target = nautilus_canvas_container_find_drop_target (container,
- context, x, y, &icon_hit, FALSE);
+ context, x, y, &icon_hit);
local_move_only = FALSE;
if (!icon_hit && real_action == GDK_ACTION_MOVE)
{
- /* we can just move the canvas positions if the move ended up in
- * the item's parent container
- */
local_move_only = nautilus_canvas_container_selection_items_local
(container, container->details->dnd_info->drag_info.selection_list);
}
- if (local_move_only)
+ /* If the move is local, there is nothing to do. */
+ if (!local_move_only)
{
- handle_local_move (container, world_x, world_y);
- }
- else
- {
- handle_nonlocal_move (container, real_action, world_x, world_y, drop_target, icon_hit);
+ handle_nonlocal_move (container, real_action, drop_target, icon_hit);
}
}
@@ -1266,7 +1107,7 @@ nautilus_canvas_container_get_drop_action (NautilusCanvasContainer *container,
*action = 0;
drop_target = nautilus_canvas_container_find_drop_target (container,
- context, x, y, &icon_hit, FALSE);
+ context, x, y, &icon_hit);
if (drop_target == NULL)
{
return;
@@ -1606,17 +1447,9 @@ static void
start_dnd_highlight (GtkWidget *widget)
{
NautilusCanvasDndInfo *dnd_info;
- GtkWidget *toplevel;
dnd_info = NAUTILUS_CANVAS_CONTAINER (widget)->details->dnd_info;
- toplevel = gtk_widget_get_toplevel (widget);
- if (toplevel != NULL &&
- g_object_get_data (G_OBJECT (toplevel), "is_desktop_window"))
- {
- return;
- }
-
if (!dnd_info->highlighted)
{
dnd_info->highlighted = TRUE;
@@ -1674,11 +1507,6 @@ check_hover_timer (NautilusCanvasContainer *container,
return;
}
- if (nautilus_canvas_container_get_is_desktop (container))
- {
- return;
- }
-
remove_hover_timer (dnd_info);
settings = gtk_widget_get_settings (GTK_WIDGET (container));
@@ -1720,7 +1548,7 @@ drag_motion_callback (GtkWidget *widget,
{
char *uri;
uri = nautilus_canvas_container_find_drop_target (NAUTILUS_CANVAS_CONTAINER (widget),
- context, x, y, NULL, TRUE);
+ context, x, y, NULL);
check_hover_timer (NAUTILUS_CANVAS_CONTAINER (widget), uri);
g_free (uri);
start_dnd_highlight (widget);
@@ -1931,19 +1759,11 @@ drag_data_received_callback (GtkWidget *widget,
selection_data[0] == 'F' &&
drag_info->direct_save_uri != NULL)
{
- GdkPoint p;
GFile *location;
location = g_file_new_for_uri (drag_info->direct_save_uri);
nautilus_file_changes_queue_file_added (location);
- p.x = x;
- p.y = y;
- nautilus_file_changes_queue_schedule_position_set (
- location,
- p,
- gdk_screen_get_number (
- gtk_widget_get_screen (widget)));
g_object_unref (location);
nautilus_file_changes_consume_changes (TRUE);
success = TRUE;
@@ -1980,12 +1800,7 @@ nautilus_canvas_dnd_init (NautilusCanvasContainer *container)
* (But not a source, as drags starting from this widget will be
* implemented by dealing with events manually.)
*/
- n_elements = G_N_ELEMENTS (drop_types);
- if (!nautilus_canvas_container_get_is_desktop (container))
- {
- /* Don't set up rootwindow drop */
- n_elements -= 1;
- }
+ n_elements = G_N_ELEMENTS (drop_types) - 1;
gtk_drag_dest_set (GTK_WIDGET (container),
0,
drop_types, n_elements,
diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h
index 0f3ad706b..e9ae3b638 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -47,9 +47,6 @@ typedef struct {
* to the nautilus metafile.
*/
double saved_ltr_x;
-
- /* Scale factor (stretches icon). */
- double scale;
/* Position in the view */
int position;
@@ -62,8 +59,6 @@ typedef struct {
/* Whether this item is visible in the view. */
eel_boolean_bit is_visible : 1;
-
- eel_boolean_bit has_lazy_position : 1;
} NautilusCanvasIcon;
@@ -130,11 +125,6 @@ struct NautilusCanvasContainerDetails {
/* Starting icon for keyboard rubberbanding. */
NautilusCanvasIcon *keyboard_rubberband_start;
- /* Current icon with stretch handles, so we have only one. */
- NautilusCanvasIcon *stretch_icon;
- double stretch_initial_x, stretch_initial_y;
- guint stretch_initial_size;
-
/* Last highlighted drop target. */
NautilusCanvasIcon *drop_target;
@@ -165,7 +155,6 @@ struct NautilusCanvasContainerDetails {
int drag_x, drag_y;
DragState drag_state;
gboolean drag_started;
- StretchState stretch_start;
gboolean icon_selected_on_button_down;
gboolean double_clicked;
@@ -177,9 +166,6 @@ struct NautilusCanvasContainerDetails {
/* Idle ID. */
guint idle_id;
- /* Idle handler for stretch code */
- guint stretch_idle_id;
-
/* Align idle id */
guint align_idle_id;
@@ -201,10 +187,6 @@ struct NautilusCanvasContainerDetails {
/* Mode settings. */
gboolean single_click_mode;
- gboolean auto_layout;
-
- /* Should the container keep icons aligned to a grid */
- gboolean keep_aligned;
/* Set to TRUE after first allocation has been done */
gboolean has_been_allocated;
@@ -212,24 +194,8 @@ struct NautilusCanvasContainerDetails {
int size_allocation_count;
guint size_allocation_count_id;
- /* Is the container fixed or resizable */
- gboolean is_fixed_size;
-
- /* Is the container for a desktop window */
- gboolean is_desktop;
-
/* Ignore the visible area the next time the scroll region is recomputed */
gboolean reset_scroll_region_trigger;
-
- /* The position we are scaling to on stretch */
- double world_x;
- double world_y;
-
- /* margins to follow, used for the desktop panel avoidance */
- int left_margin;
- int right_margin;
- int top_margin;
- int bottom_margin;
/* a11y items used by canvas items */
guint a11y_item_action_idle_handler;
@@ -238,23 +204,11 @@ struct NautilusCanvasContainerDetails {
eel_boolean_bit is_loading : 1;
eel_boolean_bit needs_resort : 1;
eel_boolean_bit selection_needs_resort : 1;
-
- eel_boolean_bit store_layout_timestamps : 1;
- eel_boolean_bit store_layout_timestamps_when_finishing_new_icons : 1;
- time_t layout_timestamp;
};
/* Private functions shared by mutiple files. */
NautilusCanvasIcon *nautilus_canvas_container_get_icon_by_uri (NautilusCanvasContainer *container,
const char *uri);
-void nautilus_canvas_container_move_icon (NautilusCanvasContainer *container,
- NautilusCanvasIcon *icon,
- int x,
- int y,
- double scale,
- gboolean raise,
- gboolean snap,
- gboolean update_position);
void nautilus_canvas_container_select_list_unselect_others (NautilusCanvasContainer *container,
GList *icons);
char * nautilus_canvas_container_get_icon_uri (NautilusCanvasContainer *container,
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 5b2683b44..71187cfc3 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -56,17 +56,6 @@
#include <sys/wait.h>
#include <unistd.h>
-enum
-{
- PROP_SUPPORTS_AUTO_LAYOUT = 1,
- PROP_SUPPORTS_SCALING,
- PROP_SUPPORTS_KEEP_ALIGNED,
- PROP_SUPPORTS_MANUAL_LAYOUT,
- NUM_PROPERTIES
-};
-
-static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
-
typedef gboolean (*SortCriterionMatchFunc) (NautilusFile *file);
typedef struct
@@ -86,8 +75,10 @@ typedef enum
MENU_ITEM_TYPE_TREE
} MenuItemType;
-typedef struct
+struct _NautilusCanvasView
{
+ NautilusFilesView parent_instance;
+
GList *icons_not_positioned;
guint react_to_canvas_change_idle_id;
@@ -96,18 +87,13 @@ typedef struct
GtkWidget *canvas_container;
- gboolean supports_auto_layout;
- gboolean supports_manual_layout;
- gboolean supports_scaling;
- gboolean supports_keep_aligned;
-
/* FIXME: Needed for async operations. Suposedly we would use cancellable and gtask,
* sadly gtkclipboard doesn't support that.
* We follow this pattern for checking validity of the object in the views.
* Ideally we would connect to a weak reference and do a cancellable.
*/
gboolean destroyed;
-} NautilusCanvasViewPrivate;
+};
/* Note that the first item in this list is the default sort,
* and that the items show up in the menu in the order they
@@ -186,19 +172,17 @@ static const SortCriterion sort_criteria[] =
}
};
-G_DEFINE_TYPE_WITH_PRIVATE (NautilusCanvasView, nautilus_canvas_view, NAUTILUS_TYPE_FILES_VIEW);
+G_DEFINE_TYPE (NautilusCanvasView, nautilus_canvas_view, NAUTILUS_TYPE_FILES_VIEW);
static void nautilus_canvas_view_set_directory_sort_by (NautilusCanvasView *canvas_view,
NautilusFile *file,
const SortCriterion *sort);
static void nautilus_canvas_view_update_click_mode (NautilusCanvasView *canvas_view);
-static gboolean nautilus_canvas_view_supports_scaling (NautilusCanvasView *canvas_view);
static void nautilus_canvas_view_reveal_selection (NautilusFilesView *view);
static const SortCriterion *get_sort_criterion_by_metadata_text (const char *metadata_text,
gboolean reversed);
static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type,
gboolean reversed);
-static void switch_to_manual_layout (NautilusCanvasView *view);
static const SortCriterion *get_default_sort_order (NautilusFile *file);
static void nautilus_canvas_view_clear (NautilusFilesView *view);
static void on_clipboard_owner_changed (GtkClipboard *clipboard,
@@ -209,18 +193,16 @@ static void
nautilus_canvas_view_destroy (GtkWidget *object)
{
NautilusCanvasView *canvas_view;
- NautilusCanvasViewPrivate *priv;
GtkClipboard *clipboard;
canvas_view = NAUTILUS_CANVAS_VIEW (object);
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
nautilus_canvas_view_clear (NAUTILUS_FILES_VIEW (object));
- if (priv->react_to_canvas_change_idle_id != 0)
+ if (canvas_view->react_to_canvas_change_idle_id != 0)
{
- g_source_remove (priv->react_to_canvas_change_idle_id);
- priv->react_to_canvas_change_idle_id = 0;
+ g_source_remove (canvas_view->react_to_canvas_change_idle_id);
+ canvas_view->react_to_canvas_change_idle_id = 0;
}
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
@@ -228,10 +210,10 @@ nautilus_canvas_view_destroy (GtkWidget *object)
on_clipboard_owner_changed,
canvas_view);
- if (priv->icons_not_positioned)
+ if (canvas_view->icons_not_positioned)
{
- nautilus_file_list_free (priv->icons_not_positioned);
- priv->icons_not_positioned = NULL;
+ nautilus_file_list_free (canvas_view->icons_not_positioned);
+ canvas_view->icons_not_positioned = NULL;
}
GTK_WIDGET_CLASS (nautilus_canvas_view_parent_class)->destroy (object);
@@ -240,11 +222,7 @@ nautilus_canvas_view_destroy (GtkWidget *object)
static NautilusCanvasContainer *
get_canvas_container (NautilusCanvasView *canvas_view)
{
- NautilusCanvasViewPrivate *priv;
-
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
-
- return NAUTILUS_CANVAS_CONTAINER (priv->canvas_container);
+ return NAUTILUS_CANVAS_CONTAINER (canvas_view->canvas_container);
}
NautilusCanvasContainer *
@@ -253,81 +231,15 @@ nautilus_canvas_view_get_canvas_container (NautilusCanvasView *canvas_view)
return get_canvas_container (canvas_view);
}
-static gboolean
-nautilus_canvas_view_supports_manual_layout (NautilusCanvasView *view)
-{
- NautilusCanvasViewPrivate *priv;
-
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
-
- priv = nautilus_canvas_view_get_instance_private (view);
-
- return priv->supports_manual_layout;
-}
-
-static gboolean
-get_stored_icon_position_callback (NautilusCanvasContainer *container,
- NautilusFile *file,
- NautilusCanvasPosition *position,
- NautilusCanvasView *canvas_view)
-{
- char *position_string, *scale_string;
- gboolean position_good;
- char c;
-
- g_assert (NAUTILUS_IS_CANVAS_CONTAINER (container));
- g_assert (NAUTILUS_IS_FILE (file));
- g_assert (position != NULL);
- g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
-
- if (!nautilus_canvas_view_supports_manual_layout (canvas_view))
- {
- return FALSE;
- }
-
- /* Get the current position of this canvas from the metadata. */
- position_string = nautilus_file_get_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_POSITION, "");
- position_good = sscanf
- (position_string, " %d , %d %c",
- &position->x, &position->y, &c) == 2;
- g_free (position_string);
-
- /* If it is the desktop directory, maybe the gnome-libs metadata has information about it */
-
- /* Disable scaling if not on the desktop */
- if (nautilus_canvas_view_supports_scaling (canvas_view))
- {
- /* Get the scale of the canvas from the metadata. */
- scale_string = nautilus_file_get_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_SCALE, "1");
- position->scale = g_ascii_strtod (scale_string, NULL);
- if (errno != 0)
- {
- position->scale = 1.0;
- }
-
- g_free (scale_string);
- }
- else
- {
- position->scale = 1.0;
- }
-
- return position_good;
-}
-
static void
update_sort_criterion (NautilusCanvasView *canvas_view,
const SortCriterion *sort,
gboolean set_metadata)
{
NautilusFile *file;
- NautilusCanvasViewPrivate *priv;
const SortCriterion *overrided_sort_criterion;
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (canvas_view));
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
/* Make sure we use the default one and not one that the user used previously
* of the change to not allow sorting on search and recent, or the
@@ -336,7 +248,7 @@ update_sort_criterion (NautilusCanvasView *canvas_view,
{
overrided_sort_criterion = get_default_sort_order (file);
}
- else if (sort != NULL && priv->sort != sort)
+ else if (sort != NULL && canvas_view->sort != sort)
{
overrided_sort_criterion = sort;
if (set_metadata)
@@ -352,27 +264,7 @@ update_sort_criterion (NautilusCanvasView *canvas_view,
return;
}
- priv->sort = overrided_sort_criterion;
-}
-
-void
-nautilus_canvas_view_clean_up_by_name (NautilusCanvasView *canvas_view)
-{
- NautilusCanvasContainer *canvas_container;
-
- canvas_container = get_canvas_container (canvas_view);
-
- update_sort_criterion (canvas_view, &sort_criteria[0], FALSE);
-
- nautilus_canvas_container_sort (canvas_container);
- nautilus_canvas_container_freeze_icon_positions (canvas_container);
-}
-
-static gboolean
-nautilus_canvas_view_using_auto_layout (NautilusCanvasView *canvas_view)
-{
- return nautilus_canvas_container_is_auto_layout
- (get_canvas_container (canvas_view));
+ canvas_view->sort = overrided_sort_criterion;
}
static void
@@ -497,42 +389,6 @@ nautilus_canvas_view_file_changed (NautilusFilesView *view,
NAUTILUS_CANVAS_ICON_DATA (file));
}
-static gboolean
-nautilus_canvas_view_supports_auto_layout (NautilusCanvasView *view)
-{
- NautilusCanvasViewPrivate *priv;
-
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
-
- priv = nautilus_canvas_view_get_instance_private (view);
-
- return priv->supports_auto_layout;
-}
-
-static gboolean
-nautilus_canvas_view_supports_scaling (NautilusCanvasView *view)
-{
- NautilusCanvasViewPrivate *priv;
-
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
-
- priv = nautilus_canvas_view_get_instance_private (view);
-
- return priv->supports_scaling;
-}
-
-static gboolean
-nautilus_canvas_view_supports_keep_aligned (NautilusCanvasView *view)
-{
- NautilusCanvasViewPrivate *priv;
-
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
-
- priv = nautilus_canvas_view_get_instance_private (view);
-
- return priv->supports_keep_aligned;
-}
-
static const SortCriterion *
nautilus_canvas_view_get_directory_sort_by (NautilusCanvasView *canvas_view,
NautilusFile *file)
@@ -541,11 +397,6 @@ nautilus_canvas_view_get_directory_sort_by (NautilusCanvasView *canvas_view,
g_autofree char *sort_by = NULL;
gboolean reversed;
- if (!nautilus_canvas_view_supports_auto_layout (canvas_view))
- {
- return get_sort_criterion_by_metadata_text ("name", FALSE);
- }
-
default_sort = get_default_sort_order (file);
g_return_val_if_fail (default_sort != NULL, NULL);
@@ -592,11 +443,6 @@ nautilus_canvas_view_set_directory_sort_by (NautilusCanvasView *canvas_view,
{
const SortCriterion *default_sort_criterion;
- if (!nautilus_canvas_view_supports_auto_layout (canvas_view))
- {
- return;
- }
-
default_sort_criterion = get_default_sort_order (file);
g_return_if_fail (default_sort_criterion != NULL);
@@ -610,78 +456,6 @@ nautilus_canvas_view_set_directory_sort_by (NautilusCanvasView *canvas_view,
sort->reverse_order);
}
-static gboolean
-get_default_directory_keep_aligned (void)
-{
- return TRUE;
-}
-
-static gboolean
-nautilus_canvas_view_get_directory_keep_aligned (NautilusCanvasView *canvas_view,
- NautilusFile *file)
-{
- if (!nautilus_canvas_view_supports_keep_aligned (canvas_view))
- {
- return FALSE;
- }
-
- return nautilus_file_get_boolean_metadata
- (file,
- NAUTILUS_METADATA_KEY_ICON_VIEW_KEEP_ALIGNED,
- get_default_directory_keep_aligned ());
-}
-
-static void
-nautilus_canvas_view_set_directory_keep_aligned (NautilusCanvasView *canvas_view,
- NautilusFile *file,
- gboolean keep_aligned)
-{
- if (!nautilus_canvas_view_supports_keep_aligned (canvas_view))
- {
- return;
- }
-
- nautilus_file_set_boolean_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_VIEW_KEEP_ALIGNED,
- get_default_directory_keep_aligned (),
- keep_aligned);
-}
-
-static gboolean
-nautilus_canvas_view_get_directory_auto_layout (NautilusCanvasView *canvas_view,
- NautilusFile *file)
-{
- if (!nautilus_canvas_view_supports_auto_layout (canvas_view))
- {
- return FALSE;
- }
-
- if (!nautilus_canvas_view_supports_manual_layout (canvas_view))
- {
- return TRUE;
- }
-
- return nautilus_file_get_boolean_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, TRUE);
-}
-
-static void
-nautilus_canvas_view_set_directory_auto_layout (NautilusCanvasView *canvas_view,
- NautilusFile *file,
- gboolean auto_layout)
-{
- if (!nautilus_canvas_view_supports_auto_layout (canvas_view) ||
- !nautilus_canvas_view_supports_manual_layout (canvas_view))
- {
- return;
- }
-
- nautilus_file_set_boolean_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT,
- TRUE,
- auto_layout);
-}
-
static const SortCriterion *
get_sort_criterion_by_metadata_text (const char *metadata_text,
gboolean reversed)
@@ -761,8 +535,6 @@ nautilus_canvas_view_begin_loading (NautilusFilesView *view)
uri = nautilus_file_get_uri (file);
canvas_container = GTK_WIDGET (get_canvas_container (canvas_view));
- nautilus_canvas_container_begin_loading (NAUTILUS_CANVAS_CONTAINER (canvas_container));
-
g_free (uri);
/* Set the sort mode.
@@ -772,18 +544,6 @@ nautilus_canvas_view_begin_loading (NautilusFilesView *view)
sort = nautilus_canvas_view_get_directory_sort_by (canvas_view, file);
update_sort_criterion (canvas_view, sort, FALSE);
- nautilus_canvas_container_set_keep_aligned
- (get_canvas_container (canvas_view),
- nautilus_canvas_view_get_directory_keep_aligned (canvas_view, file));
-
- /* We must set auto-layout last, because it invokes the layout_changed
- * callback, which works incorrectly if the other layout criteria are
- * not already set up properly (see bug 6500, e.g.)
- */
- nautilus_canvas_container_set_auto_layout
- (get_canvas_container (canvas_view),
- nautilus_canvas_view_get_directory_auto_layout (canvas_view, file));
-
/* We could have changed to the trash directory or to searching, and then
* we need to update the menus */
nautilus_files_view_update_context_menus (view);
@@ -795,15 +555,14 @@ on_clipboard_contents_received (GtkClipboard *clipboard,
GtkSelectionData *selection_data,
gpointer user_data)
{
- NautilusCanvasViewPrivate *priv;
- NautilusCanvasView *view = NAUTILUS_CANVAS_VIEW (user_data);
+ NautilusCanvasView *canvas_view;
- priv = nautilus_canvas_view_get_instance_private (view);
+ canvas_view = NAUTILUS_CANVAS_VIEW (user_data);
- if (priv->destroyed)
+ if (canvas_view->destroyed)
{
/* We've been destroyed since call */
- g_object_unref (view);
+ g_object_unref (canvas_view);
return;
}
@@ -814,7 +573,7 @@ on_clipboard_contents_received (GtkClipboard *clipboard,
uris = nautilus_clipboard_get_uri_list_from_selection_data (selection_data);
files = nautilus_file_list_from_uri_list (uris);
- nautilus_canvas_container_set_highlighted_for_clipboard (get_canvas_container (view),
+ nautilus_canvas_container_set_highlighted_for_clipboard (get_canvas_container (canvas_view),
files);
nautilus_file_list_free (files);
@@ -822,11 +581,11 @@ on_clipboard_contents_received (GtkClipboard *clipboard,
}
else
{
- nautilus_canvas_container_set_highlighted_for_clipboard (get_canvas_container (view),
+ nautilus_canvas_container_set_highlighted_for_clipboard (get_canvas_container (canvas_view),
NULL);
}
- g_object_unref (view);
+ g_object_unref (canvas_view);
}
static void
@@ -854,8 +613,6 @@ nautilus_canvas_view_end_loading (NautilusFilesView *view,
NautilusCanvasView *canvas_view;
canvas_view = NAUTILUS_CANVAS_VIEW (view);
- nautilus_canvas_container_end_loading (nautilus_canvas_view_get_canvas_container (canvas_view),
- all_files_seen);
update_clipboard_status (canvas_view);
}
@@ -984,28 +741,6 @@ nautilus_canvas_view_get_selection (NautilusFilesView *view)
}
static void
-action_keep_aligned (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- NautilusFile *file;
- NautilusCanvasView *canvas_view;
- gboolean keep_aligned;
-
- canvas_view = NAUTILUS_CANVAS_VIEW (user_data);
- file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (canvas_view));
- keep_aligned = g_variant_get_boolean (state);
-
- nautilus_canvas_view_set_directory_keep_aligned (canvas_view,
- file,
- keep_aligned);
- nautilus_canvas_container_set_keep_aligned (get_canvas_container (canvas_view),
- keep_aligned);
-
- g_simple_action_set_state (action, state);
-}
-
-static void
action_sort_order_changed (GSimpleAction *action,
GVariant *value,
gpointer user_data)
@@ -1019,20 +754,11 @@ action_sort_order_changed (GSimpleAction *action,
sort_criterion = get_sort_criterion_by_action_target_name (target_name);
g_assert (sort_criterion != NULL);
- /* Note that id might be a toggle item.
- * Ignore non-sort ids so that they don't cause sorting.
- */
- if (sort_criterion->sort_type == NAUTILUS_FILE_SORT_NONE)
- {
- switch_to_manual_layout (user_data);
- }
- else
- {
- update_sort_criterion (user_data, sort_criterion, TRUE);
- nautilus_canvas_container_sort (get_canvas_container (user_data));
- nautilus_canvas_view_reveal_selection (NAUTILUS_FILES_VIEW (user_data));
- }
+ update_sort_criterion (user_data, sort_criterion, TRUE);
+
+ nautilus_canvas_container_sort (get_canvas_container (user_data));
+ nautilus_canvas_view_reveal_selection (NAUTILUS_FILES_VIEW (user_data));
g_simple_action_set_state (action, value);
}
@@ -1061,48 +787,8 @@ action_zoom_to_level (GSimpleAction *action,
}
}
-static void
-switch_to_manual_layout (NautilusCanvasView *canvas_view)
-{
- NautilusCanvasViewPrivate *priv;
-
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
-
- if (!nautilus_canvas_view_using_auto_layout (canvas_view) ||
- !nautilus_files_view_is_editable (NAUTILUS_FILES_VIEW (canvas_view)))
- {
- return;
- }
-
- priv->sort = &sort_criteria[0];
-
- nautilus_canvas_container_set_auto_layout
- (get_canvas_container (canvas_view), FALSE);
-}
-
-static void
-layout_changed_callback (NautilusCanvasContainer *container,
- NautilusCanvasView *canvas_view)
-{
- NautilusFile *file;
-
- g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
- g_assert (container == get_canvas_container (canvas_view));
-
- file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (canvas_view));
-
- if (file != NULL)
- {
- nautilus_canvas_view_set_directory_auto_layout
- (canvas_view,
- file,
- nautilus_canvas_view_using_auto_layout (canvas_view));
- }
-}
-
const GActionEntry canvas_view_entries[] =
{
- { "keep-aligned", NULL, NULL, "true", action_keep_aligned },
{ "sort", NULL, "s", "'name'", action_sort_order_changed },
{ "zoom-to-level", NULL, NULL, "1", action_zoom_to_level }
};
@@ -1168,56 +854,42 @@ static void
nautilus_canvas_view_update_actions_state (NautilusFilesView *view)
{
GActionGroup *view_action_group;
+ GVariant *sort_state;
GAction *action;
- gboolean keep_aligned;
NautilusCanvasView *canvas_view;
- NautilusCanvasViewPrivate *priv;
canvas_view = NAUTILUS_CANVAS_VIEW (view);
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
NAUTILUS_FILES_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_actions_state (view);
view_action_group = nautilus_files_view_get_action_group (view);
- if (nautilus_canvas_view_supports_auto_layout (canvas_view))
- {
- GVariant *sort_state;
-
- /* When we change the sort action state, even using the same value, it triggers
- * the sort action changed handler, which reveals the selection, since we expect
- * the selection to be visible when the user changes the sort order. But we may
- * need to update the actions state for others reason than an actual sort change,
- * so we need to prevent to trigger the sort action changed handler for those cases.
- * To achieve this, check if the action state value actually changed before setting
- * it
- */
- sort_state = g_action_group_get_action_state (view_action_group, "sort");
-
- if (g_strcmp0 (g_variant_get_string (sort_state, NULL),
- priv->sort->action_target_name) != 0)
- {
- g_action_group_change_action_state (view_action_group,
- "sort",
- g_variant_new_string (priv->sort->action_target_name));
- }
- g_variant_unref (sort_state);
+ /* When we change the sort action state, even using the same value, it triggers
+ * the sort action changed handler, which reveals the selection, since we expect
+ * the selection to be visible when the user changes the sort order. But we may
+ * need to update the actions state for others reason than an actual sort change,
+ * so we need to prevent to trigger the sort action changed handler for those cases.
+ * To achieve this, check if the action state value actually changed before setting
+ * it
+ */
+ sort_state = g_action_group_get_action_state (view_action_group, "sort");
+
+ if (g_strcmp0 (g_variant_get_string (sort_state, NULL),
+ canvas_view->sort->action_target_name) != 0)
+ {
+ g_action_group_change_action_state (view_action_group,
+ "sort",
+ g_variant_new_string (canvas_view->sort->action_target_name));
}
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "sort");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
!showing_recent_directory (view) &&
!showing_search_directory (view));
- action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "keep-aligned");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
- priv->supports_keep_aligned);
- if (priv->supports_keep_aligned)
- {
- keep_aligned = nautilus_canvas_container_is_keep_aligned (get_canvas_container (canvas_view));
- g_action_change_state (action, g_variant_new_boolean (keep_aligned));
- }
update_sort_action_state_hint (canvas_view);
+
+ g_variant_unref (sort_state);
}
static void
@@ -1308,14 +980,6 @@ nautilus_canvas_view_invert_selection (NautilusFilesView *view)
(get_canvas_container (NAUTILUS_CANVAS_VIEW (view)));
}
-static gboolean
-nautilus_canvas_view_using_manual_layout (NautilusFilesView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
-
- return !nautilus_canvas_view_using_auto_layout (NAUTILUS_CANVAS_VIEW (view));
-}
-
static void
nautilus_canvas_view_widget_to_file_operation_position (NautilusFilesView *view,
GdkPoint *position)
@@ -1445,15 +1109,11 @@ nautilus_canvas_view_compare_files (NautilusCanvasView *canvas_view,
NautilusFile *a,
NautilusFile *b)
{
- NautilusCanvasViewPrivate *priv;
-
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
-
return nautilus_file_compare_for_sort
- (a, b, priv->sort->sort_type,
+ (a, b, canvas_view->sort->sort_type,
/* Use type-unsafe cast for performance */
nautilus_files_view_should_sort_directories_first ((NautilusFilesView *) canvas_view),
- priv->sort->reverse_order);
+ canvas_view->sort->reverse_order);
}
static int
@@ -1496,37 +1156,6 @@ canvas_container_context_click_background_callback (NautilusCanvasContainer *con
nautilus_files_view_pop_up_background_context_menu (NAUTILUS_FILES_VIEW (canvas_view), event);
}
-static void
-icon_position_changed_callback (NautilusCanvasContainer *container,
- NautilusFile *file,
- const NautilusCanvasPosition *position,
- NautilusCanvasView *canvas_view)
-{
- char *position_string;
- char scale_string[G_ASCII_DTOSTR_BUF_SIZE];
-
- g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
- g_assert (container == get_canvas_container (canvas_view));
- g_assert (NAUTILUS_IS_FILE (file));
-
- /* Store the new position of the canvas in the metadata. */
- if (!nautilus_canvas_view_using_auto_layout (canvas_view))
- {
- position_string = g_strdup_printf
- ("%d,%d", position->x, position->y);
- nautilus_file_set_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_POSITION,
- NULL, position_string);
- g_free (position_string);
- }
-
-
- g_ascii_dtostr (scale_string, sizeof (scale_string), position->scale);
- nautilus_file_set_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_SCALE,
- "1.0", scale_string);
-}
-
static char *
get_icon_uri_callback (NautilusCanvasContainer *container,
NautilusFile *file,
@@ -1621,11 +1250,7 @@ nautilus_canvas_view_sort_directories_first_changed (NautilusFilesView *director
canvas_view = NAUTILUS_CANVAS_VIEW (directory_view);
- if (nautilus_canvas_view_using_auto_layout (canvas_view))
- {
- nautilus_canvas_container_sort
- (get_canvas_container (canvas_view));
- }
+ nautilus_canvas_container_sort (get_canvas_container (canvas_view));
}
static gboolean
@@ -1647,17 +1272,14 @@ canvas_view_get_container_uri (NautilusCanvasContainer *container,
static void
canvas_view_move_copy_items (NautilusCanvasContainer *container,
const GList *item_uris,
- GArray *relative_item_points,
const char *target_dir,
int copy_action,
- int x,
- int y,
NautilusFilesView *view)
{
nautilus_clipboard_clear_if_colliding_uris (GTK_WIDGET (view),
item_uris);
- nautilus_files_view_move_copy_items (view, item_uris, relative_item_points, target_dir,
- copy_action, x, y);
+ nautilus_files_view_move_copy_items (view, item_uris, target_dir,
+ copy_action);
}
static void
@@ -1675,95 +1297,16 @@ nautilus_canvas_view_update_click_mode (NautilusCanvasView *canvas_view)
click_mode == NAUTILUS_CLICK_POLICY_SINGLE);
}
-static gboolean
-get_stored_layout_timestamp (NautilusCanvasContainer *container,
- NautilusCanvasIconData *icon_data,
- time_t *timestamp,
- NautilusCanvasView *view)
-{
- NautilusFile *file;
- NautilusDirectory *directory;
-
- if (icon_data == NULL)
- {
- directory = nautilus_files_view_get_model (NAUTILUS_FILES_VIEW (view));
- if (directory == NULL)
- {
- return FALSE;
- }
-
- file = nautilus_directory_get_corresponding_file (directory);
- *timestamp = nautilus_file_get_time_metadata (file,
- NAUTILUS_METADATA_KEY_ICON_VIEW_LAYOUT_TIMESTAMP);
- nautilus_file_unref (file);
- }
- else
- {
- *timestamp = nautilus_file_get_time_metadata (NAUTILUS_FILE (icon_data),
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP);
- }
-
- return TRUE;
-}
-
-static gboolean
-store_layout_timestamp (NautilusCanvasContainer *container,
- NautilusCanvasIconData *icon_data,
- const time_t *timestamp,
- NautilusCanvasView *view)
-{
- NautilusFile *file;
- NautilusDirectory *directory;
-
- if (icon_data == NULL)
- {
- directory = nautilus_files_view_get_model (NAUTILUS_FILES_VIEW (view));
- if (directory == NULL)
- {
- return FALSE;
- }
-
- file = nautilus_directory_get_corresponding_file (directory);
- nautilus_file_set_time_metadata (file,
- NAUTILUS_METADATA_KEY_ICON_VIEW_LAYOUT_TIMESTAMP,
- (time_t) *timestamp);
- nautilus_file_unref (file);
- }
- else
- {
- nautilus_file_set_time_metadata (NAUTILUS_FILE (icon_data),
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP,
- (time_t) *timestamp);
- }
-
- return TRUE;
-}
-
-static NautilusCanvasContainer *
-create_canvas_container (NautilusCanvasView *canvas_view)
-{
- return NAUTILUS_CANVAS_VIEW_CLASS (G_OBJECT_GET_CLASS (canvas_view))->create_canvas_container (canvas_view);
-}
-
-static NautilusCanvasContainer *
-real_create_canvas_container (NautilusCanvasView *canvas_view)
-{
- return nautilus_canvas_view_container_new (canvas_view);
-}
-
static void
initialize_canvas_container (NautilusCanvasView *canvas_view,
NautilusCanvasContainer *canvas_container)
{
GtkWidget *content_widget;
- NautilusCanvasViewPrivate *priv;
-
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (canvas_view));
- priv->canvas_container = GTK_WIDGET (canvas_container);
+ canvas_view->canvas_container = GTK_WIDGET (canvas_container);
g_object_add_weak_pointer (G_OBJECT (canvas_container),
- (gpointer *) &priv->canvas_container);
+ (gpointer *) &canvas_view->canvas_container);
gtk_widget_set_can_focus (GTK_WIDGET (canvas_container), TRUE);
@@ -1781,8 +1324,6 @@ initialize_canvas_container (NautilusCanvasView *canvas_view,
G_CALLBACK (canvas_container_context_click_selection_callback), canvas_view, 0);
g_signal_connect_object (canvas_container, "context-click-background",
G_CALLBACK (canvas_container_context_click_background_callback), canvas_view, 0);
- g_signal_connect_object (canvas_container, "icon-position-changed",
- G_CALLBACK (icon_position_changed_callback), canvas_view, 0);
g_signal_connect_object (canvas_container, "selection-changed",
G_CALLBACK (selection_changed_callback), canvas_view, 0);
/* FIXME: many of these should move into fm-canvas-container as virtual methods */
@@ -1798,21 +1339,6 @@ initialize_canvas_container (NautilusCanvasView *canvas_view,
G_CALLBACK (canvas_view_get_container_uri), canvas_view, 0);
g_signal_connect_object (canvas_container, "can-accept-item",
G_CALLBACK (canvas_view_can_accept_item), canvas_view, 0);
- g_signal_connect_object (canvas_container, "get-stored-icon-position",
- G_CALLBACK (get_stored_icon_position_callback), canvas_view, 0);
- g_signal_connect_object (canvas_container, "layout-changed",
- G_CALLBACK (layout_changed_callback), canvas_view, 0);
- g_signal_connect_object (canvas_container, "icon-stretch-started",
- G_CALLBACK (nautilus_files_view_update_context_menus), canvas_view,
- G_CONNECT_SWAPPED);
- g_signal_connect_object (canvas_container, "icon-stretch-ended",
- G_CALLBACK (nautilus_files_view_update_context_menus), canvas_view,
- G_CONNECT_SWAPPED);
-
- g_signal_connect_object (canvas_container, "get-stored-layout-timestamp",
- G_CALLBACK (get_stored_layout_timestamp), canvas_view, 0);
- g_signal_connect_object (canvas_container, "store-layout-timestamp",
- G_CALLBACK (store_layout_timestamp), canvas_view, 0);
gtk_container_add (GTK_CONTAINER (content_widget),
GTK_WIDGET (canvas_container));
@@ -1830,12 +1356,10 @@ canvas_view_handle_netscape_url (NautilusCanvasContainer *container,
const char *encoded_url,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusCanvasView *view)
{
nautilus_files_view_handle_netscape_url_drop (NAUTILUS_FILES_VIEW (view),
- encoded_url, target_uri, action, x, y);
+ encoded_url, target_uri, action);
}
static void
@@ -1843,12 +1367,10 @@ canvas_view_handle_uri_list (NautilusCanvasContainer *container,
const char *item_uris,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusCanvasView *view)
{
nautilus_files_view_handle_uri_list_drop (NAUTILUS_FILES_VIEW (view),
- item_uris, target_uri, action, x, y);
+ item_uris, target_uri, action);
}
static void
@@ -1856,12 +1378,10 @@ canvas_view_handle_text (NautilusCanvasContainer *container,
const char *text,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusCanvasView *view)
{
nautilus_files_view_handle_text_drop (NAUTILUS_FILES_VIEW (view),
- text, target_uri, action, x, y);
+ text, target_uri, action);
}
static void
@@ -1871,12 +1391,10 @@ canvas_view_handle_raw (NautilusCanvasContainer *container,
const char *target_uri,
const char *direct_save_uri,
GdkDragAction action,
- int x,
- int y,
NautilusCanvasView *view)
{
nautilus_files_view_handle_raw_drop (NAUTILUS_FILES_VIEW (view),
- raw_data, length, target_uri, direct_save_uri, action, x, y);
+ raw_data, length, target_uri, direct_save_uri, action);
}
static void
@@ -1935,60 +1453,12 @@ nautilus_canvas_view_get_id (NautilusFilesView *view)
}
static void
-nautilus_canvas_view_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- NautilusCanvasView *canvas_view;
- NautilusCanvasViewPrivate *priv;
-
- canvas_view = NAUTILUS_CANVAS_VIEW (object);
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
-
- switch (prop_id)
- {
- case PROP_SUPPORTS_AUTO_LAYOUT:
- {
- priv->supports_auto_layout = g_value_get_boolean (value);
- }
- break;
-
- case PROP_SUPPORTS_MANUAL_LAYOUT:
- {
- priv->supports_manual_layout = g_value_get_boolean (value);
- }
- break;
-
- case PROP_SUPPORTS_SCALING:
- {
- priv->supports_scaling = g_value_get_boolean (value);
- }
- break;
-
- case PROP_SUPPORTS_KEEP_ALIGNED:
- {
- priv->supports_keep_aligned = g_value_get_boolean (value);
- }
- break;
-
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- break;
- }
-}
-
-static void
nautilus_canvas_view_dispose (GObject *object)
{
NautilusCanvasView *canvas_view;
- NautilusCanvasViewPrivate *priv;
canvas_view = NAUTILUS_CANVAS_VIEW (object);
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
- priv->destroyed = TRUE;
+ canvas_view->destroyed = TRUE;
g_signal_handlers_disconnect_by_func (nautilus_preferences,
default_sort_order_changed_callback,
@@ -2014,13 +1484,10 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
nautilus_files_view_class = NAUTILUS_FILES_VIEW_CLASS (klass);
oclass = G_OBJECT_CLASS (klass);
- oclass->set_property = nautilus_canvas_view_set_property;
oclass->dispose = nautilus_canvas_view_dispose;
GTK_WIDGET_CLASS (klass)->destroy = nautilus_canvas_view_destroy;
- klass->create_canvas_container = real_create_canvas_container;
-
nautilus_files_view_class->add_files = nautilus_canvas_view_add_files;
nautilus_files_view_class->begin_loading = nautilus_canvas_view_begin_loading;
nautilus_files_view_class->bump_zoom_level = nautilus_canvas_view_bump_zoom_level;
@@ -2046,58 +1513,23 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
nautilus_files_view_class->click_policy_changed = nautilus_canvas_view_click_policy_changed;
nautilus_files_view_class->update_actions_state = nautilus_canvas_view_update_actions_state;
nautilus_files_view_class->sort_directories_first_changed = nautilus_canvas_view_sort_directories_first_changed;
- nautilus_files_view_class->using_manual_layout = nautilus_canvas_view_using_manual_layout;
nautilus_files_view_class->widget_to_file_operation_position = nautilus_canvas_view_widget_to_file_operation_position;
nautilus_files_view_class->get_view_id = nautilus_canvas_view_get_id;
nautilus_files_view_class->get_first_visible_file = canvas_view_get_first_visible_file;
nautilus_files_view_class->scroll_to_file = canvas_view_scroll_to_file;
-
- properties[PROP_SUPPORTS_AUTO_LAYOUT] =
- g_param_spec_boolean ("supports-auto-layout",
- "Supports auto layout",
- "Whether this view supports auto layout",
- TRUE,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY);
- properties[PROP_SUPPORTS_MANUAL_LAYOUT] =
- g_param_spec_boolean ("supports-manual-layout",
- "Supports manual layout",
- "Whether this view supports manual layout",
- FALSE,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY);
- properties[PROP_SUPPORTS_SCALING] =
- g_param_spec_boolean ("supports-scaling",
- "Supports scaling",
- "Whether this view supports scaling",
- FALSE,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY);
- properties[PROP_SUPPORTS_KEEP_ALIGNED] =
- g_param_spec_boolean ("supports-keep-aligned",
- "Supports keep aligned",
- "Whether this view supports keep aligned",
- FALSE,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
static void
nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
{
- NautilusCanvasViewPrivate *priv;
NautilusCanvasContainer *canvas_container;
GActionGroup *view_action_group;
GtkClipboard *clipboard;
- priv = nautilus_canvas_view_get_instance_private (canvas_view);
-
- priv->sort = &sort_criteria[0];
- priv->destroyed = FALSE;
+ canvas_view->sort = &sort_criteria[0];
+ canvas_view->destroyed = FALSE;
- canvas_container = create_canvas_container (canvas_view);
+ canvas_container = nautilus_canvas_view_container_new (canvas_view);
initialize_canvas_container (canvas_view, canvas_container);
g_signal_connect_swapped (nautilus_preferences,
diff --git a/src/nautilus-canvas-view.h b/src/nautilus-canvas-view.h
index 799cc932d..86fbc2ea5 100644
--- a/src/nautilus-canvas-view.h
+++ b/src/nautilus-canvas-view.h
@@ -32,20 +32,11 @@ G_BEGIN_DECLS
#define NAUTILUS_TYPE_CANVAS_VIEW nautilus_canvas_view_get_type()
-G_DECLARE_DERIVABLE_TYPE (NautilusCanvasView, nautilus_canvas_view, NAUTILUS, CANVAS_VIEW, NautilusFilesView)
-
-struct _NautilusCanvasViewClass {
- NautilusFilesViewClass parent_class;
-
- NautilusCanvasContainer * (* create_canvas_container) (NautilusCanvasView *canvas_view);
-};
+G_DECLARE_FINAL_TYPE (NautilusCanvasView, nautilus_canvas_view, NAUTILUS, CANVAS_VIEW, NautilusFilesView)
int nautilus_canvas_view_compare_files (NautilusCanvasView *canvas_view,
NautilusFile *a,
NautilusFile *b);
-void nautilus_canvas_view_filter_by_screen (NautilusCanvasView *canvas_view,
- gboolean filter);
-void nautilus_canvas_view_clean_up_by_name (NautilusCanvasView *canvas_view);
NautilusFilesView * nautilus_canvas_view_new (NautilusWindowSlot *slot);
diff --git a/src/nautilus-dbus-manager.c b/src/nautilus-dbus-manager.c
index 77d00d615..ae09247e7 100644
--- a/src/nautilus-dbus-manager.c
+++ b/src/nautilus-dbus-manager.c
@@ -112,9 +112,7 @@ handle_copy_uris (NautilusDBusFileOperations *object,
g_file_new_for_uri (sources[idx]));
}
- nautilus_file_operations_copy (source_files, NULL,
- dest_dir,
- NULL, NULL, NULL);
+ nautilus_file_operations_copy (source_files, dest_dir, NULL, NULL, NULL);
g_list_free_full (source_files, g_object_unref);
g_object_unref (dest_dir);
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index 05a87e360..d642e6fad 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -196,8 +196,7 @@ static void link_info_done (NautilusDirectory *directory,
const char *uri,
const char *name,
GIcon *icon,
- gboolean is_launcher,
- gboolean is_foreign);
+ gboolean is_launcher);
static void move_file_to_low_priority_queue (NautilusDirectory *directory,
NautilusFile *file);
static void move_file_to_extension_queue (NautilusDirectory *directory,
@@ -1812,7 +1811,7 @@ lacks_link_info (NautilusFile *file)
}
else
{
- link_info_done (file->details->directory, file, NULL, NULL, NULL, FALSE, FALSE);
+ link_info_done (file->details->directory, file, NULL, NULL, NULL, FALSE);
return FALSE;
}
}
@@ -2416,8 +2415,7 @@ monitor_includes_file (const Monitor *monitor,
return FALSE;
}
return nautilus_file_should_show (file,
- monitor->monitor_hidden_files,
- TRUE);
+ monitor->monitor_hidden_files);
}
static gboolean
@@ -3592,8 +3590,7 @@ link_info_done (NautilusDirectory *directory,
const char *uri,
const char *name,
GIcon *icon,
- gboolean is_launcher,
- gboolean is_foreign)
+ gboolean is_launcher)
{
gboolean is_trusted;
@@ -3625,7 +3622,6 @@ link_info_done (NautilusDirectory *directory,
file->details->custom_icon = g_object_ref (icon);
}
file->details->is_launcher = is_launcher;
- file->details->is_foreign_link = is_foreign;
file->details->is_trusted_link = is_trusted;
nautilus_directory_async_state_changed (directory);
@@ -3667,7 +3663,6 @@ link_info_got_data (NautilusDirectory *directory,
char *link_uri, *uri, *name;
GIcon *icon;
gboolean is_launcher;
- gboolean is_foreign;
nautilus_directory_ref (directory);
@@ -3675,14 +3670,13 @@ link_info_got_data (NautilusDirectory *directory,
name = NULL;
icon = NULL;
is_launcher = FALSE;
- is_foreign = FALSE;
/* Handle the case where we read the Nautilus link. */
if (result)
{
link_uri = nautilus_file_get_uri (file);
nautilus_link_get_link_info_given_file_contents (file_contents, bytes_read, link_uri,
- &uri, &name, &icon, &is_launcher, &is_foreign);
+ &uri, &name, &icon, &is_launcher);
g_free (link_uri);
}
else
@@ -3691,7 +3685,7 @@ link_info_got_data (NautilusDirectory *directory,
}
nautilus_file_ref (file);
- link_info_done (directory, file, uri, name, icon, is_launcher, is_foreign);
+ link_info_done (directory, file, uri, name, icon, is_launcher);
nautilus_file_changed (file);
nautilus_file_unref (file);
@@ -3785,7 +3779,7 @@ link_info_start (NautilusDirectory *directory,
/* If it's not a link we are done. If it is, we need to read it. */
if (!nautilus_style_link)
{
- link_info_done (directory, file, NULL, NULL, NULL, FALSE, FALSE);
+ link_info_done (directory, file, NULL, NULL, NULL, FALSE);
}
else
{
diff --git a/src/nautilus-directory-notify.h b/src/nautilus-directory-notify.h
index a55a8363f..92130e749 100644
--- a/src/nautilus-directory-notify.h
+++ b/src/nautilus-directory-notify.h
@@ -32,13 +32,6 @@ typedef struct {
GFile *to;
} GFilePair;
-typedef struct {
- GFile *location;
- gboolean set;
- GdkPoint point;
- int screen;
-} NautilusFileChangesQueuePosition;
-
/* Almost-public change notification calls */
void nautilus_directory_notify_files_added (GList *files);
void nautilus_directory_notify_files_moved (GList *file_pairs);
@@ -52,7 +45,6 @@ void nautilus_directory_schedule_metadata_remove (GList *files);
void nautilus_directory_schedule_metadata_copy_by_uri (GList *uri_pairs);
void nautilus_directory_schedule_metadata_move_by_uri (GList *uri_pairs);
void nautilus_directory_schedule_metadata_remove_by_uri (GList *uris);
-void nautilus_directory_schedule_position_set (GList *position_setting_list);
/* Change notification hack.
* This is called when code modifies the file and it needs to trigger
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 26a5c4b76..884135ca3 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -1679,70 +1679,6 @@ nautilus_directory_notify_files_moved (GList *file_pairs)
g_list_free (new_files_list);
}
-void
-nautilus_directory_schedule_position_set (GList *position_setting_list)
-{
- GList *p;
- const NautilusFileChangesQueuePosition *item;
- NautilusFile *file;
- char str[64];
- time_t now;
-
- time (&now);
-
- for (p = position_setting_list; p != NULL; p = p->next)
- {
- item = (NautilusFileChangesQueuePosition *) p->data;
-
- file = nautilus_file_get (item->location);
-
- if (item->set)
- {
- g_snprintf (str, sizeof (str), "%d,%d", item->point.x, item->point.y);
- }
- else
- {
- str[0] = 0;
- }
- nautilus_file_set_metadata
- (file,
- NAUTILUS_METADATA_KEY_ICON_POSITION,
- NULL,
- str);
-
- if (item->set)
- {
- nautilus_file_set_time_metadata
- (file,
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP,
- now);
- }
- else
- {
- nautilus_file_set_time_metadata
- (file,
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP,
- UNDEFINED_TIME);
- }
-
- if (item->set)
- {
- g_snprintf (str, sizeof (str), "%d", item->screen);
- }
- else
- {
- str[0] = 0;
- }
- nautilus_file_set_metadata
- (file,
- NAUTILUS_METADATA_KEY_SCREEN,
- NULL,
- str);
-
- nautilus_file_unref (file);
- }
-}
-
gboolean
nautilus_directory_contains_file (NautilusDirectory *directory,
NautilusFile *file)
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index 575d12f2a..4ead3f831 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -332,42 +332,6 @@ nautilus_drag_items_local (const char *target_uri_string,
((NautilusDragSelectionItem *) selection_list->data)->uri);
}
-gboolean
-nautilus_drag_items_on_desktop (const GList *selection_list)
-{
- char *uri;
- GFile *desktop, *item, *parent;
- gboolean result;
-
- /* check if the first item on the list is in trash.
- * FIXME:
- * 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
- */
- uri = ((NautilusDragSelectionItem *) selection_list->data)->uri;
- if (eel_uri_is_desktop (uri))
- {
- return TRUE;
- }
-
- desktop = nautilus_get_desktop_location ();
-
- item = g_file_new_for_uri (uri);
- parent = g_file_get_parent (item);
- g_object_unref (item);
-
- result = FALSE;
-
- if (parent)
- {
- result = g_file_equal (desktop, parent);
- g_object_unref (parent);
- }
- g_object_unref (desktop);
-
- return result;
-}
-
GdkDragAction
nautilus_drag_default_drop_action_for_netscape_url (GdkDragContext *context)
{
@@ -535,14 +499,6 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
dropped_file = ((NautilusDragSelectionItem *) items->data)->file;
target_file = nautilus_file_get_by_uri (target_uri_string);
- if (eel_uri_is_desktop (dropped_uri) &&
- !eel_uri_is_desktop (target_uri_string))
- {
- /* Desktop items only move on the desktop */
- *action = 0;
- return;
- }
-
/*
* Check for trash URI. We do a find_directory for any Trash directory.
* Passing 0 permissions as gnome-vfs would override the permissions
@@ -567,26 +523,6 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
nautilus_file_unref (target_file);
return;
}
- else if (eel_uri_is_desktop (target_uri_string))
- {
- target = nautilus_get_desktop_location ();
-
- nautilus_file_unref (target_file);
- target_file = nautilus_file_get (target);
-
- if (eel_uri_is_desktop (dropped_uri))
- {
- /* Only move to Desktop icons */
- if (actions & GDK_ACTION_MOVE)
- {
- *action = GDK_ACTION_MOVE;
- }
-
- g_object_unref (target);
- nautilus_file_unref (target_file);
- return;
- }
- }
else if (target_file != NULL && nautilus_file_is_archive (target_file))
{
*action = GDK_ACTION_COPY;
@@ -1050,22 +986,3 @@ nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info)
drag_info->auto_scroll_timeout_id = 0;
}
}
-
-gboolean
-nautilus_drag_selection_includes_special_link (GList *selection_list)
-{
- GList *node;
- char *uri;
-
- for (node = selection_list; node != NULL; node = node->next)
- {
- uri = ((NautilusDragSelectionItem *) node->data)->uri;
-
- if (eel_uri_is_desktop (uri))
- {
- return TRUE;
- }
- }
-
- return FALSE;
-}
diff --git a/src/nautilus-dnd.h b/src/nautilus-dnd.h
index d4d3bb853..551b21278 100644
--- a/src/nautilus-dnd.h
+++ b/src/nautilus-dnd.h
@@ -106,7 +106,6 @@ gboolean nautilus_drag_items_local (const char *target_uri,
const GList *selection_list);
gboolean nautilus_drag_uris_local (const char *target_uri,
const GList *source_uri_list);
-gboolean nautilus_drag_items_on_desktop (const GList *selection_list);
void nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
const char *target_uri,
const GList *items,
@@ -138,8 +137,6 @@ void nautilus_drag_autoscroll_start (NautilusDragInfo *drag_info,
gpointer user_data);
void nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info);
-gboolean nautilus_drag_selection_includes_special_link (GList *selection_list);
-
NautilusDragInfo * nautilus_drag_get_source_data (GdkDragContext *context);
GList * nautilus_drag_file_list_from_selection_list (const GList *selection_list);
diff --git a/src/nautilus-file-changes-queue.c b/src/nautilus-file-changes-queue.c
index 44c2d55c3..8f042fa7f 100644
--- a/src/nautilus-file-changes-queue.c
+++ b/src/nautilus-file-changes-queue.c
@@ -29,8 +29,6 @@ typedef enum
CHANGE_FILE_CHANGED,
CHANGE_FILE_REMOVED,
CHANGE_FILE_MOVED,
- CHANGE_POSITION_SET,
- CHANGE_POSITION_REMOVE
} NautilusFileChangeKind;
typedef struct
@@ -147,38 +145,6 @@ nautilus_file_changes_queue_file_moved (GFile *from,
nautilus_file_changes_queue_add_common (queue, new_item);
}
-void
-nautilus_file_changes_queue_schedule_position_set (GFile *location,
- GdkPoint point,
- int screen)
-{
- NautilusFileChange *new_item;
- NautilusFileChangesQueue *queue;
-
- queue = nautilus_file_changes_queue_get ();
-
- new_item = g_new (NautilusFileChange, 1);
- new_item->kind = CHANGE_POSITION_SET;
- new_item->from = g_object_ref (location);
- new_item->point = point;
- new_item->screen = screen;
- nautilus_file_changes_queue_add_common (queue, new_item);
-}
-
-void
-nautilus_file_changes_queue_schedule_position_remove (GFile *location)
-{
- NautilusFileChange *new_item;
- NautilusFileChangesQueue *queue;
-
- queue = nautilus_file_changes_queue_get ();
-
- new_item = g_new (NautilusFileChange, 1);
- new_item->kind = CHANGE_POSITION_REMOVE;
- new_item->from = g_object_ref (location);
- nautilus_file_changes_queue_add_common (queue, new_item);
-}
-
static NautilusFileChange *
nautilus_file_changes_queue_get_change (NautilusFileChangesQueue *queue)
{
@@ -234,21 +200,6 @@ pairs_list_free (GList *pairs)
g_list_free_full (pairs, g_free);
}
-static void
-position_set_list_free (GList *list)
-{
- GList *p;
- NautilusFileChangesQueuePosition *item;
-
- for (p = list; p != NULL; p = p->next)
- {
- item = p->data;
- g_object_unref (item->location);
- }
- /* delete the list and the now empty structs */
- g_list_free_full (list, g_free);
-}
-
/* go through changes in the change queue, send ones with the same kind
* in a list to the different nautilus_directory_notify calls
*/
@@ -257,9 +208,7 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
{
NautilusFileChange *change;
GList *additions, *changes, *deletions, *moves;
- GList *position_set_requests;
GFilePair *pair;
- NautilusFileChangesQueuePosition *position_set;
guint chunk_count;
NautilusFileChangesQueue *queue;
gboolean flush_needed;
@@ -269,7 +218,6 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
changes = NULL;
deletions = NULL;
moves = NULL;
- position_set_requests = NULL;
queue = nautilus_file_changes_queue_get ();
@@ -292,27 +240,17 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
else
{
flush_needed = additions != NULL
- && change->kind != CHANGE_FILE_ADDED
- && change->kind != CHANGE_POSITION_SET
- && change->kind != CHANGE_POSITION_REMOVE;
+ && change->kind != CHANGE_FILE_ADDED;
flush_needed |= changes != NULL
&& change->kind != CHANGE_FILE_CHANGED;
flush_needed |= moves != NULL
- && change->kind != CHANGE_FILE_MOVED
- && change->kind != CHANGE_POSITION_SET
- && change->kind != CHANGE_POSITION_REMOVE;
+ && change->kind != CHANGE_FILE_MOVED;
flush_needed |= deletions != NULL
&& change->kind != CHANGE_FILE_REMOVED;
- flush_needed |= position_set_requests != NULL
- && change->kind != CHANGE_POSITION_SET
- && change->kind != CHANGE_POSITION_REMOVE
- && change->kind != CHANGE_FILE_ADDED
- && change->kind != CHANGE_FILE_MOVED;
-
flush_needed |= !consume_all && chunk_count >= CONSUME_CHANGES_MAX_CHUNK;
/* we have reached the chunk maximum */
}
@@ -352,13 +290,6 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
g_list_free_full (changes, g_object_unref);
changes = NULL;
}
- if (position_set_requests != NULL)
- {
- position_set_requests = g_list_reverse (position_set_requests);
- nautilus_directory_schedule_position_set (position_set_requests);
- position_set_list_free (position_set_requests);
- position_set_requests = NULL;
- }
}
if (change == NULL)
@@ -397,28 +328,6 @@ nautilus_file_changes_consume_changes (gboolean consume_all)
}
break;
- case CHANGE_POSITION_SET:
- {
- position_set = g_new (NautilusFileChangesQueuePosition, 1);
- position_set->location = change->from;
- position_set->set = TRUE;
- position_set->point = change->point;
- position_set->screen = change->screen;
- position_set_requests = g_list_prepend (position_set_requests,
- position_set);
- }
- break;
-
- case CHANGE_POSITION_REMOVE:
- {
- position_set = g_new (NautilusFileChangesQueuePosition, 1);
- position_set->location = change->from;
- position_set->set = FALSE;
- position_set_requests = g_list_prepend (position_set_requests,
- position_set);
- }
- break;
-
default:
{
g_assert_not_reached ();
diff --git a/src/nautilus-file-changes-queue.h b/src/nautilus-file-changes-queue.h
index aa75238c6..f851b4cbf 100644
--- a/src/nautilus-file-changes-queue.h
+++ b/src/nautilus-file-changes-queue.h
@@ -28,10 +28,6 @@ void nautilus_file_changes_queue_file_changed (GFile *lo
void nautilus_file_changes_queue_file_removed (GFile *location);
void nautilus_file_changes_queue_file_moved (GFile *from,
GFile *to);
-void nautilus_file_changes_queue_schedule_position_set (GFile *location,
- GdkPoint point,
- int screen);
-void nautilus_file_changes_queue_schedule_position_remove (GFile *location);
void nautilus_file_changes_consume_changes (gboolean consume_all);
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 457196c7c..1de885026 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -67,7 +67,6 @@ typedef struct
{
GTimer *time;
GtkWindow *parent_window;
- int screen_num;
guint inhibit_cookie;
NautilusProgressInfo *progress;
GCancellable *cancellable;
@@ -87,10 +86,7 @@ typedef struct
gboolean is_move;
GList *files;
GFile *destination;
- GFile *desktop_location;
GFile *fake_display_source;
- GdkPoint *icon_positions;
- int n_icon_positions;
GHashTable *debuting_files;
gchar *target_name;
NautilusCopyCallback done_callback;
@@ -116,8 +112,6 @@ typedef struct
GFile *src;
char *src_data;
int length;
- GdkPoint position;
- gboolean has_position;
GFile *created_file;
NautilusCreateCallback done_callback;
gpointer done_callback_data;
@@ -1019,7 +1013,6 @@ init_common (gsize job_size,
GtkWindow *parent_window)
{
CommonJob *common;
- GdkScreen *screen;
common = g_malloc0 (job_size);
@@ -1033,12 +1026,6 @@ init_common (gsize job_size,
common->cancellable = nautilus_progress_info_get_cancellable (common->progress);
common->time = g_timer_new ();
common->inhibit_cookie = 0;
- common->screen_num = 0;
- if (parent_window)
- {
- screen = gtk_widget_get_screen (GTK_WIDGET (parent_window));
- common->screen_num = gdk_screen_get_number (screen);
- }
return common;
}
@@ -1135,8 +1122,7 @@ static gboolean
can_delete_without_confirm (GFile *file)
{
if (g_file_has_uri_scheme (file, "burn") ||
- g_file_has_uri_scheme (file, "recent") ||
- g_file_has_uri_scheme (file, "x-nautilus-desktop"))
+ g_file_has_uri_scheme (file, "recent"))
{
return TRUE;
}
@@ -4449,7 +4435,6 @@ static void copy_move_file (CopyMoveJob *job,
SourceInfo *source_info,
TransferInfo *transfer_info,
GHashTable *debuting_files,
- GdkPoint *point,
gboolean overwrite,
gboolean *skipped_file,
gboolean readonly_source_fs);
@@ -4681,7 +4666,7 @@ retry:
src_file = g_file_get_child (src,
g_file_info_get_name (info));
copy_move_file (copy_job, src_file, *dest, same_fs, FALSE, &dest_fs_type,
- source_info, transfer_info, NULL, NULL, FALSE, &local_skipped_file,
+ source_info, transfer_info, NULL, FALSE, &local_skipped_file,
readonly_source_fs);
if (local_skipped_file)
@@ -4981,56 +4966,6 @@ query_fs_type (GFile *file,
return ret;
}
-static gboolean
-is_trusted_desktop_file (GFile *file,
- GCancellable *cancellable)
-{
- char *basename;
- gboolean res;
- GFileInfo *info;
-
- /* Don't trust non-local files */
- if (!g_file_is_native (file))
- {
- return FALSE;
- }
-
- basename = g_file_get_basename (file);
- if (!g_str_has_suffix (basename, ".desktop"))
- {
- g_free (basename);
- return FALSE;
- }
- g_free (basename);
-
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- cancellable,
- NULL);
-
- if (info == NULL)
- {
- return FALSE;
- }
-
- res = FALSE;
-
- /* Weird file => not trusted,
- * Already executable => no need to mark trusted */
- if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR &&
- !g_file_info_get_attribute_boolean (info,
- G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE) &&
- nautilus_is_in_system_dir (file))
- {
- res = TRUE;
- }
- g_object_unref (info);
-
- return res;
-}
-
static FileConflictResponse *
handle_copy_move_conflict (CommonJob *job,
GFile *src,
@@ -5081,7 +5016,6 @@ copy_move_file (CopyMoveJob *copy_job,
SourceInfo *source_info,
TransferInfo *transfer_info,
GHashTable *debuting_files,
- GdkPoint *position,
gboolean overwrite,
gboolean *skipped_file,
gboolean readonly_source_fs)
@@ -5273,14 +5207,6 @@ retry:
if (debuting_files)
{
dest_uri = g_file_get_uri (dest);
- if (position)
- {
- nautilus_file_changes_queue_schedule_position_set (dest, *position, job->screen_num);
- }
- else if (eel_uri_is_desktop (dest_uri))
- {
- nautilus_file_changes_queue_schedule_position_remove (dest);
- }
g_hash_table_replace (debuting_files, g_object_ref (dest), GINT_TO_POINTER (TRUE));
}
@@ -5293,18 +5219,6 @@ retry:
nautilus_file_changes_queue_file_added (dest);
}
- /* If copying a trusted desktop file to the desktop,
- * mark it as trusted. */
- if (copy_job->desktop_location != NULL &&
- g_file_equal (copy_job->desktop_location, dest_dir) &&
- is_trusted_desktop_file (src, job->cancellable))
- {
- mark_desktop_file_executable (job,
- job->cancellable,
- dest,
- FALSE);
- }
-
if (job->undo_info != NULL)
{
nautilus_file_undo_info_ext_add_origin_target_pair (NAUTILUS_FILE_UNDO_INFO_EXT (job->undo_info),
@@ -5604,7 +5518,6 @@ copy_files (CopyMoveJob *job,
GFile *src;
gboolean same_fs;
int i;
- GdkPoint *point;
gboolean skipped_file;
gboolean unique_names;
GFile *dest;
@@ -5641,16 +5554,6 @@ copy_files (CopyMoveJob *job,
{
src = l->data;
- if (i < job->n_icon_positions)
- {
- point = &job->icon_positions[i];
- }
- else
- {
- point = NULL;
- }
-
-
same_fs = FALSE;
if (dest_fs_id)
{
@@ -5673,7 +5576,7 @@ copy_files (CopyMoveJob *job,
&dest_fs_type,
source_info, transfer_info,
job->debuting_files,
- point, FALSE, &skipped_file,
+ FALSE, &skipped_file,
readonly_source_fs);
g_object_unref (dest);
@@ -5709,12 +5612,7 @@ copy_task_done (GObject *source_object,
{
g_object_unref (job->destination);
}
- if (job->desktop_location)
- {
- g_object_unref (job->desktop_location);
- }
g_hash_table_unref (job->debuting_files);
- g_free (job->icon_positions);
g_free (job->target_name);
g_clear_object (&job->fake_display_source);
@@ -5824,7 +5722,6 @@ nautilus_file_operations_copy_file (GFile *source_file,
void
nautilus_file_operations_copy (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
@@ -5834,7 +5731,6 @@ nautilus_file_operations_copy (GList *files,
CopyMoveJob *job;
job = op_job_new (CopyMoveJob, parent_window);
- job->desktop_location = nautilus_get_desktop_location ();
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
@@ -5842,14 +5738,6 @@ nautilus_file_operations_copy (GList *files,
/* Need to indicate the destination for the operation notification open
* button. */
nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir);
- if (relative_item_points != NULL &&
- relative_item_points->len > 0)
- {
- job->icon_positions =
- g_memdup (relative_item_points->data,
- sizeof (GdkPoint) * relative_item_points->len);
- job->n_icon_positions = relative_item_points->len;
- }
job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
inhibit_power_manager ((CommonJob *) job, _("Copying Files"));
@@ -5900,29 +5788,17 @@ typedef struct
{
GFile *file;
gboolean overwrite;
- gboolean has_position;
- GdkPoint position;
} MoveFileCopyFallback;
static MoveFileCopyFallback *
move_copy_file_callback_new (GFile *file,
- gboolean overwrite,
- GdkPoint *position)
+ gboolean overwrite)
{
MoveFileCopyFallback *fallback;
fallback = g_new (MoveFileCopyFallback, 1);
fallback->file = file;
fallback->overwrite = overwrite;
- if (position)
- {
- fallback->has_position = TRUE;
- fallback->position = *position;
- }
- else
- {
- fallback->has_position = FALSE;
- }
return fallback;
}
@@ -5949,7 +5825,6 @@ move_file_prepare (CopyMoveJob *move_job,
gboolean same_fs,
char **dest_fs_type,
GHashTable *debuting_files,
- GdkPoint *position,
GList **fallback_files,
int files_left)
{
@@ -6038,14 +5913,6 @@ retry:
nautilus_file_changes_queue_file_moved (src, dest);
dest_uri = g_file_get_uri (dest);
- if (position)
- {
- nautilus_file_changes_queue_schedule_position_set (dest, *position, job->screen_num);
- }
- else if (eel_uri_is_desktop (dest_uri))
- {
- nautilus_file_changes_queue_schedule_position_remove (dest);
- }
if (job->undo_info != NULL)
{
@@ -6169,8 +6036,7 @@ retry:
g_error_free (error);
fallback = move_copy_file_callback_new (src,
- overwrite,
- position);
+ overwrite);
*fallback_files = g_list_prepend (*fallback_files, fallback);
}
else if (IS_IO_ERROR (error, CANCELLED))
@@ -6238,7 +6104,6 @@ move_files_prepare (CopyMoveJob *job,
GFile *src;
gboolean same_fs;
int i;
- GdkPoint *point;
int total, left;
common = &job->common;
@@ -6254,16 +6119,6 @@ move_files_prepare (CopyMoveJob *job,
{
src = l->data;
- if (i < job->n_icon_positions)
- {
- point = &job->icon_positions[i];
- }
- else
- {
- point = NULL;
- }
-
-
same_fs = FALSE;
if (dest_fs_id)
{
@@ -6273,7 +6128,6 @@ move_files_prepare (CopyMoveJob *job,
move_file_prepare (job, src, job->destination,
same_fs, dest_fs_type,
job->debuting_files,
- point,
fallbacks,
left);
report_preparing_move_progress (job, total, --left);
@@ -6296,7 +6150,6 @@ move_files (CopyMoveJob *job,
GFile *src;
gboolean same_fs;
int i;
- GdkPoint *point;
gboolean skipped_file;
MoveFileCopyFallback *fallback;
common = &job->common;
@@ -6311,15 +6164,6 @@ move_files (CopyMoveJob *job,
fallback = l->data;
src = fallback->file;
- if (fallback->has_position)
- {
- point = &fallback->position;
- }
- else
- {
- point = NULL;
- }
-
same_fs = FALSE;
if (dest_fs_id)
{
@@ -6333,7 +6177,7 @@ move_files (CopyMoveJob *job,
same_fs, FALSE, dest_fs_type,
source_info, transfer_info,
job->debuting_files,
- point, fallback->overwrite, &skipped_file, FALSE);
+ fallback->overwrite, &skipped_file, FALSE);
i++;
if (skipped_file)
@@ -6363,7 +6207,6 @@ move_task_done (GObject *source_object,
g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
- g_free (job->icon_positions);
finalize_common ((CommonJob *) job);
@@ -6445,7 +6288,6 @@ aborted:
void
nautilus_file_operations_move (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
@@ -6463,14 +6305,6 @@ nautilus_file_operations_move (GList *files,
/* Need to indicate the destination for the operation notification open
* button. */
nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir);
- if (relative_item_points != NULL &&
- relative_item_points->len > 0)
- {
- job->icon_positions =
- g_memdup (relative_item_points->data,
- sizeof (GdkPoint) * relative_item_points->len);
- job->n_icon_positions = relative_item_points->len;
- }
job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
inhibit_power_manager ((CommonJob *) job, _("Moving Files"));
@@ -6559,7 +6393,6 @@ link_file (CopyMoveJob *job,
GFile *dest_dir,
char **dest_fs_type,
GHashTable *debuting_files,
- GdkPoint *position,
int files_left)
{
GFile *src_dir;
@@ -6618,14 +6451,6 @@ retry:
nautilus_file_changes_queue_file_added (dest);
dest_uri = g_file_get_uri (dest);
- if (position)
- {
- nautilus_file_changes_queue_schedule_position_set (dest, *position, common->screen_num);
- }
- else if (eel_uri_is_desktop (dest_uri))
- {
- nautilus_file_changes_queue_schedule_position_remove (dest);
- }
return;
}
@@ -6748,7 +6573,6 @@ link_task_done (GObject *source_object,
g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
- g_free (job->icon_positions);
finalize_common ((CommonJob *) job);
@@ -6764,7 +6588,6 @@ link_task_thread_func (GTask *task,
CopyMoveJob *job;
CommonJob *common;
GFile *src;
- GdkPoint *point;
g_autofree char *dest_fs_type = NULL;
int total, left;
int i;
@@ -6795,19 +6618,9 @@ link_task_thread_func (GTask *task,
{
src = l->data;
- if (i < job->n_icon_positions)
- {
- point = &job->icon_positions[i];
- }
- else
- {
- point = NULL;
- }
-
-
link_file (job, src, job->destination,
&dest_fs_type, job->debuting_files,
- point, left);
+ left);
report_preparing_link_progress (job, total, --left);
i++;
}
@@ -6815,7 +6628,6 @@ link_task_thread_func (GTask *task,
void
nautilus_file_operations_link (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
@@ -6832,14 +6644,6 @@ nautilus_file_operations_link (GList *files,
/* Need to indicate the destination for the operation notification open
* button. */
nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir);
- if (relative_item_points != NULL &&
- relative_item_points->len > 0)
- {
- job->icon_positions =
- g_memdup (relative_item_points->data,
- sizeof (GdkPoint) * relative_item_points->len);
- job->n_icon_positions = relative_item_points->len;
- }
job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
if (!nautilus_file_undo_manager_is_operating ())
@@ -6861,7 +6665,6 @@ nautilus_file_operations_link (GList *files,
void
nautilus_file_operations_duplicate (GList *files,
- GArray *relative_item_points,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
gpointer done_callback_data)
@@ -6881,14 +6684,6 @@ nautilus_file_operations_duplicate (GList *files,
/* Need to indicate the destination for the operation notification open
* button. */
nautilus_progress_info_set_destination (((CommonJob *) job)->progress, parent);
- if (relative_item_points != NULL &&
- relative_item_points->len > 0)
- {
- job->icon_positions =
- g_memdup (relative_item_points->data,
- sizeof (GdkPoint) * relative_item_points->len);
- job->n_icon_positions = relative_item_points->len;
- }
job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
if (!nautilus_file_undo_manager_is_operating ())
@@ -7117,7 +6912,6 @@ callback_for_move_to_trash (GHashTable *debuting_uris,
void
nautilus_file_operations_copy_move (const GList *item_uris,
- GArray *relative_item_points,
const char *target_dir,
GdkDragAction copy_action,
GtkWidget *parent_view,
@@ -7176,14 +6970,12 @@ nautilus_file_operations_copy_move (const GList *item_uris,
g_file_equal (src_dir, dest)))
{
nautilus_file_operations_duplicate (locations,
- relative_item_points,
parent_window,
done_callback, done_callback_data);
}
else
{
nautilus_file_operations_copy (locations,
- relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
@@ -7211,7 +7003,6 @@ nautilus_file_operations_copy_move (const GList *item_uris,
else
{
nautilus_file_operations_move (locations,
- relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
@@ -7220,7 +7011,6 @@ nautilus_file_operations_copy_move (const GList *item_uris,
else
{
nautilus_file_operations_link (locations,
- relative_item_points,
dest,
parent_window,
done_callback, done_callback_data);
@@ -7483,14 +7273,6 @@ retry:
job->created_file = g_object_ref (dest);
nautilus_file_changes_queue_file_added (dest);
dest_uri = g_file_get_uri (dest);
- if (job->has_position)
- {
- nautilus_file_changes_queue_schedule_position_set (dest, job->position, common->screen_num);
- }
- else if (eel_uri_is_desktop (dest_uri))
- {
- nautilus_file_changes_queue_schedule_position_remove (dest);
- }
}
else
{
@@ -7666,7 +7448,6 @@ retry:
void
nautilus_file_operations_new_folder (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir,
const char *folder_name,
NautilusCreateCallback done_callback,
@@ -7688,11 +7469,6 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view,
job->dest_dir = g_file_new_for_uri (parent_dir);
job->filename = g_strdup (folder_name);
job->make_dir = TRUE;
- if (target_point != NULL)
- {
- job->position = *target_point;
- job->has_position = TRUE;
- }
if (!nautilus_file_undo_manager_is_operating ())
{
@@ -7706,7 +7482,6 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view,
void
nautilus_file_operations_new_file_from_template (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir,
const char *target_filename,
const char *template_uri,
@@ -7727,11 +7502,6 @@ nautilus_file_operations_new_file_from_template (GtkWidget *parent_
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->dest_dir = g_file_new_for_uri (parent_dir);
- if (target_point != NULL)
- {
- job->position = *target_point;
- job->has_position = TRUE;
- }
job->filename = g_strdup (target_filename);
if (template_uri)
@@ -7751,7 +7521,6 @@ nautilus_file_operations_new_file_from_template (GtkWidget *parent_
void
nautilus_file_operations_new_file (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir,
const char *target_filename,
const char *initial_contents,
@@ -7773,11 +7542,6 @@ nautilus_file_operations_new_file (GtkWidget *parent_view,
job->done_callback = done_callback;
job->done_callback_data = done_callback_data;
job->dest_dir = g_file_new_for_uri (parent_dir);
- if (target_point != NULL)
- {
- job->position = *target_point;
- job->has_position = TRUE;
- }
job->src_data = g_memdup (initial_contents, length);
job->length = length;
job->filename = g_strdup (target_filename);
diff --git a/src/nautilus-file-operations.h b/src/nautilus-file-operations.h
index a479ee6e0..e8c6ed393 100644
--- a/src/nautilus-file-operations.h
+++ b/src/nautilus-file-operations.h
@@ -52,7 +52,6 @@ typedef void (* NautilusExtractCallback) (GList *outputs,
/* FIXME: int copy_action should be an enum */
void nautilus_file_operations_copy_move (const GList *item_uris,
- GArray *relative_item_points,
const char *target_dir_uri,
GdkDragAction copy_action,
GtkWidget *parent_view,
@@ -67,13 +66,11 @@ void nautilus_file_operations_copy_file (GFile *source_file,
gpointer done_callback_data);
void nautilus_file_operations_empty_trash (GtkWidget *parent_view);
void nautilus_file_operations_new_folder (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir_uri,
const char *folder_name,
NautilusCreateCallback done_callback,
gpointer done_callback_data);
void nautilus_file_operations_new_file (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir,
const char *target_filename,
const char *initial_contents,
@@ -81,7 +78,6 @@ void nautilus_file_operations_new_file (GtkWidget *parent_vie
NautilusCreateCallback done_callback,
gpointer data);
void nautilus_file_operations_new_file_from_template (GtkWidget *parent_view,
- GdkPoint *target_point,
const char *parent_dir,
const char *target_filename,
const char *template_uri,
@@ -124,24 +120,20 @@ void nautilus_file_operations_mount_volume_full (GtkWindow
GObject *mount_callback_data_object);
void nautilus_file_operations_copy (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
gpointer done_callback_data);
void nautilus_file_operations_move (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
gpointer done_callback_data);
void nautilus_file_operations_duplicate (GList *files,
- GArray *relative_item_points,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
gpointer done_callback_data);
void nautilus_file_operations_link (GList *files,
- GArray *relative_item_points,
GFile *target_dir,
GtkWindow *parent_window,
NautilusCopyCallback done_callback,
diff --git a/src/nautilus-file-private.h b/src/nautilus-file-private.h
index cb2bebbe8..ec7fea40a 100644
--- a/src/nautilus-file-private.h
+++ b/src/nautilus-file-private.h
@@ -176,7 +176,6 @@ struct NautilusFileDetails
eel_boolean_bit is_launcher : 1;
eel_boolean_bit is_trusted_link : 1;
- eel_boolean_bit is_foreign_link : 1;
eel_boolean_bit is_symlink : 1;
eel_boolean_bit is_mountpoint : 1;
eel_boolean_bit is_hidden : 1;
diff --git a/src/nautilus-file-undo-operations.c b/src/nautilus-file-undo-operations.c
index e971274ef..73ad6ff05 100644
--- a/src/nautilus-file-undo-operations.c
+++ b/src/nautilus-file-undo-operations.c
@@ -541,7 +541,6 @@ ext_create_link_redo_func (NautilusFileUndoInfoExt *self,
GtkWindow *parent_window)
{
nautilus_file_operations_link (g_queue_peek_head_link (self->priv->sources),
- NULL,
self->priv->dest_dir,
parent_window,
file_undo_info_transfer_callback,
@@ -553,7 +552,6 @@ ext_duplicate_redo_func (NautilusFileUndoInfoExt *self,
GtkWindow *parent_window)
{
nautilus_file_operations_duplicate (g_queue_peek_head_link (self->priv->sources),
- NULL,
parent_window,
file_undo_info_transfer_callback,
self);
@@ -564,7 +562,6 @@ ext_copy_redo_func (NautilusFileUndoInfoExt *self,
GtkWindow *parent_window)
{
nautilus_file_operations_copy (g_queue_peek_head_link (self->priv->sources),
- NULL,
self->priv->dest_dir,
parent_window,
file_undo_info_transfer_callback,
@@ -576,7 +573,6 @@ ext_move_restore_redo_func (NautilusFileUndoInfoExt *self,
GtkWindow *parent_window)
{
nautilus_file_operations_move (g_queue_peek_head_link (self->priv->sources),
- NULL,
self->priv->dest_dir,
parent_window,
file_undo_info_transfer_callback,
@@ -629,7 +625,6 @@ ext_move_undo_func (NautilusFileUndoInfoExt *self,
GtkWindow *parent_window)
{
nautilus_file_operations_move (g_queue_peek_head_link (self->priv->destinations),
- NULL,
self->priv->src_dir,
parent_window,
file_undo_info_transfer_callback,
@@ -822,7 +817,7 @@ create_from_template_redo_func (NautilusFileUndoInfoCreate *self,
parent = g_file_get_parent (self->priv->target_file);
parent_uri = g_file_get_uri (parent);
new_name = g_file_get_parse_name (self->priv->target_file);
- nautilus_file_operations_new_file_from_template (NULL, NULL,
+ nautilus_file_operations_new_file_from_template (NULL,
parent_uri, new_name,
self->priv->template,
create_callback, self);
@@ -843,7 +838,7 @@ create_folder_redo_func (NautilusFileUndoInfoCreate *self,
name = g_file_get_basename (self->priv->target_file);
parent = g_file_get_parent (self->priv->target_file);
parent_uri = g_file_get_uri (parent);
- nautilus_file_operations_new_folder (NULL, NULL, parent_uri, name,
+ nautilus_file_operations_new_folder (NULL, parent_uri, name,
create_callback, self);
g_free (name);
@@ -862,7 +857,7 @@ create_empty_redo_func (NautilusFileUndoInfoCreate *self,
parent = g_file_get_parent (self->priv->target_file);
parent_uri = g_file_get_uri (parent);
new_name = g_file_get_parse_name (self->priv->target_file);
- nautilus_file_operations_new_file (NULL, NULL, parent_uri,
+ nautilus_file_operations_new_file (NULL, parent_uri,
new_name,
self->priv->template,
self->priv->length,
diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
index 26683729e..ba67b8559 100644
--- a/src/nautilus-file-utilities.c
+++ b/src/nautilus-file-utilities.c
@@ -404,62 +404,6 @@ get_desktop_path (void)
return desktop_path;
}
-/**
- * nautilus_get_desktop_directory:
- *
- * Get the path for the directory containing files on the desktop.
- *
- * Return value: the directory path.
- **/
-char *
-nautilus_get_desktop_directory (void)
-{
- const char *desktop_directory;
-
- desktop_directory = get_desktop_path ();
-
- /* Don't try to create a home directory */
- if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS))
- {
- g_mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
- /* FIXME bugzilla.gnome.org 41286:
- * How should we handle the case where this mkdir fails?
- * Note that nautilus_application_startup will refuse to launch if this
- * directory doesn't get created, so that case is OK. But the directory
- * could be deleted after Nautilus was launched, and perhaps
- * there is some bad side-effect of not handling that case.
- */
- }
-
- return g_strdup (desktop_directory);
-}
-
-GFile *
-nautilus_get_desktop_location (void)
-{
- return g_file_new_for_path (get_desktop_path ());
-}
-
-/**
- * nautilus_get_desktop_directory_uri:
- *
- * Get the uri for the directory containing files on the desktop.
- *
- * Return value: the directory path.
- **/
-char *
-nautilus_get_desktop_directory_uri (void)
-{
- char *desktop_path;
- char *desktop_uri;
-
- desktop_path = nautilus_get_desktop_directory ();
- desktop_uri = g_filename_to_uri (desktop_path, NULL, NULL);
- g_free (desktop_path);
-
- return desktop_uri;
-}
-
char *
nautilus_get_home_directory_uri (void)
{
@@ -946,7 +890,7 @@ ensure_dirs_task_ready_cb (GObject *_source,
locations = locations_from_file_list (files);
nautilus_file_operations_move
- (locations, NULL,
+ (locations,
original_dir_location,
data->parent_window,
NULL, NULL);
diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h
index 1aad4d487..415f01b3e 100644
--- a/src/nautilus-file-utilities.h
+++ b/src/nautilus-file-utilities.h
@@ -32,9 +32,7 @@
* freed with g_free, is not NULL, and is guaranteed to exist.
*/
char * nautilus_get_user_directory (void);
-char * nautilus_get_desktop_directory (void);
GFile * nautilus_get_desktop_location (void);
-char * nautilus_get_desktop_directory_uri (void);
char * nautilus_get_home_directory_uri (void);
gboolean nautilus_is_desktop_directory_file (GFile *dir,
const char *filename);
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 6b7301405..e62b54a5c 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -507,7 +507,6 @@ nautilus_file_clear_info (NautilusFile *file)
file->details->thumbnailing_failed = FALSE;
file->details->is_launcher = FALSE;
- file->details->is_foreign_link = FALSE;
file->details->is_trusted_link = FALSE;
file->details->is_symlink = FALSE;
file->details->is_hidden = FALSE;
@@ -1639,29 +1638,6 @@ nautilus_file_is_desktop_directory (NautilusFile *file)
return nautilus_is_desktop_directory_file (location, eel_ref_str_peek (file->details->name));
}
-/**
- * nautilus_file_is_child_of_desktop_directory:
- *
- * Check whether this file is a direct child of the desktop directory.
- *
- * @file: The file to check.
- *
- * Return value: TRUE if this file is a direct child of the desktop directory.
- */
-gboolean
-nautilus_file_is_child_of_desktop_directory (NautilusFile *file)
-{
- g_autoptr (GFile) location = NULL;
-
- location = nautilus_directory_get_location (file->details->directory);
- if (location == NULL)
- {
- return FALSE;
- }
-
- return nautilus_is_desktop_directory (location);
-}
-
static gboolean
is_desktop_file (NautilusFile *file)
{
@@ -4140,7 +4116,6 @@ nautilus_file_is_hidden_file (NautilusFile *file)
* nautilus_file_should_show:
* @file: the file to check
* @show_hidden: whether we want to show hidden files or not
- * @show_foreign: whether we want to show foreign files or not
*
* Determines if a #NautilusFile should be shown. Note that when browsing
* a trash directory, this function will always return %TRUE.
@@ -4149,8 +4124,7 @@ nautilus_file_is_hidden_file (NautilusFile *file)
*/
gboolean
nautilus_file_should_show (NautilusFile *file,
- gboolean show_hidden,
- gboolean show_foreign)
+ gboolean show_hidden)
{
/* Never hide any files in trash. */
if (nautilus_file_is_in_trash (file))
@@ -4163,11 +4137,6 @@ nautilus_file_should_show (NautilusFile *file,
return FALSE;
}
- if (!show_foreign && nautilus_file_is_foreign_link (file))
- {
- return FALSE;
- }
-
return TRUE;
}
@@ -4210,8 +4179,7 @@ filter_hidden_partition_callback (NautilusFile *file,
options = GPOINTER_TO_INT (callback_data);
return nautilus_file_should_show (file,
- options & SHOW_HIDDEN,
- TRUE);
+ options & SHOW_HIDDEN);
}
GList *
@@ -4708,12 +4676,6 @@ nautilus_file_is_launcher (NautilusFile *file)
}
gboolean
-nautilus_file_is_foreign_link (NautilusFile *file)
-{
- return file->details->is_foreign_link;
-}
-
-gboolean
nautilus_file_is_trusted_link (NautilusFile *file)
{
return file->details->is_trusted_link;
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 868fcce0b..c3e434c94 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -225,7 +225,6 @@ gboolean nautilus_file_is_other_locations (Nautilu
gboolean nautilus_file_is_favorite_location (NautilusFile *file);
gboolean nautilus_file_is_home (NautilusFile *file);
gboolean nautilus_file_is_desktop_directory (NautilusFile *file);
-gboolean nautilus_file_is_child_of_desktop_directory (NautilusFile *file);
GError * nautilus_file_get_file_info_error (NautilusFile *file);
gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
guint *count,
@@ -454,8 +453,7 @@ int nautilus_file_compare_display_name (Nautilu
/* filtering functions for use by various directory views */
gboolean nautilus_file_is_hidden_file (NautilusFile *file);
gboolean nautilus_file_should_show (NautilusFile *file,
- gboolean show_hidden,
- gboolean show_foreign);
+ gboolean show_hidden);
GList *nautilus_file_list_filter_hidden (GList *files,
gboolean show_hidden);
@@ -464,7 +462,6 @@ GList *nautilus_file_list_filter_hidden (GList
* Getting this can require reading the contents of the file.
*/
gboolean nautilus_file_is_launcher (NautilusFile *file);
-gboolean nautilus_file_is_foreign_link (NautilusFile *file);
gboolean nautilus_file_is_trusted_link (NautilusFile *file);
gboolean nautilus_file_has_activation_uri (NautilusFile *file);
char * nautilus_file_get_activation_uri (NautilusFile *file);
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 656229728..ca4714ee6 100644
--- a/src/nautilus-files-view-dnd.c
+++ b/src/nautilus-files-view-dnd.c
@@ -43,39 +43,12 @@
#define GET_ANCESTOR(obj) \
GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (obj), GTK_TYPE_WINDOW))
-static inline void
-view_widget_to_file_operation_position (NautilusFilesView *view,
- GdkPoint *position)
-{
- NautilusFilesViewClass *class = NAUTILUS_FILES_VIEW_GET_CLASS (view);
-
- if (class->widget_to_file_operation_position != NULL)
- {
- class->widget_to_file_operation_position (view, position);
- }
-}
-
-static void
-view_widget_to_file_operation_position_xy (NautilusFilesView *view,
- int *x,
- int *y)
-{
- GdkPoint position;
-
- position.x = *x;
- position.y = *y;
- view_widget_to_file_operation_position (view, &position);
- *x = position.x;
- *y = position.y;
-}
-
typedef struct
{
NautilusFilesView *view;
char *link_name;
char *target_uri;
char *url;
- GdkPoint point;
} NetscapeUrlDropLink;
static void
@@ -142,7 +115,6 @@ handle_netscape_url_drop_link_cb (GObject *source_object,
link_display_name,
icon_name,
data->url,
- &data->point,
screen_num,
TRUE);
@@ -161,13 +133,10 @@ void
nautilus_files_view_handle_netscape_url_drop (NautilusFilesView *view,
const char *encoded_url,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y)
+ GdkDragAction action)
{
char *url, *title;
char *link_name;
- GArray *points = NULL;
char **bits;
GList *uri_list = NULL;
GFile *f;
@@ -209,8 +178,6 @@ nautilus_files_view_handle_netscape_url_drop (NautilusFilesView *view,
f = g_file_new_for_uri (url);
- view_widget_to_file_operation_position_xy (view, &x, &y);
-
/* We don't support GDK_ACTION_ASK or GDK_ACTION_PRIVATE
* and we don't support combinations either. */
if ((action != GDK_ACTION_DEFAULT) &&
@@ -241,8 +208,6 @@ nautilus_files_view_handle_netscape_url_drop (NautilusFilesView *view,
data = g_slice_new0 (NetscapeUrlDropLink);
data->link_name = link_name;
- data->point.x = x;
- data->point.y = y;
data->view = g_object_ref (view);
data->target_uri = g_strdup (target_uri);
data->url = g_strdup (url);
@@ -256,22 +221,13 @@ nautilus_files_view_handle_netscape_url_drop (NautilusFilesView *view,
}
else
{
- GdkPoint tmp_point = { 0, 0 };
-
- if (eel_uri_is_desktop (target_uri))
- {
- /* pass in a 1-item array of icon positions, relative to x, y */
- points = g_array_new (FALSE, TRUE, sizeof (GdkPoint));
- g_array_append_val (points, tmp_point);
- }
uri_list = g_list_append (uri_list, url);
- nautilus_files_view_move_copy_items (view, uri_list, points,
+ nautilus_files_view_move_copy_items (view, uri_list,
target_uri,
- action, x, y);
+ action);
g_list_free (uri_list);
- g_array_free (points, TRUE);
}
g_object_unref (f);
@@ -282,16 +238,13 @@ void
nautilus_files_view_handle_uri_list_drop (NautilusFilesView *view,
const char *item_uris,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y)
+ GdkDragAction action)
{
gchar **uri_list;
GList *real_uri_list = NULL;
char *container_uri;
const char *real_target_uri;
int n_uris, i;
- GArray *points;
if (item_uris == NULL)
{
@@ -348,32 +301,13 @@ nautilus_files_view_handle_uri_list_drop (NautilusFilesView *view,
}
real_target_uri = target_uri != NULL ? target_uri : container_uri;
- if (n_uris == 1 && eel_uri_is_desktop (real_target_uri))
- {
- GdkPoint tmp_point = { 0, 0 };
-
- /* pass in a 1-item array of icon positions, relative to x, y */
- points = g_array_new (FALSE, TRUE, sizeof (GdkPoint));
- g_array_append_val (points, tmp_point);
- }
- else
- {
- points = NULL;
- }
-
- view_widget_to_file_operation_position_xy (view, &x, &y);
- nautilus_files_view_move_copy_items (view, real_uri_list, points,
+ nautilus_files_view_move_copy_items (view, real_uri_list,
real_target_uri,
- action, x, y);
+ action);
g_list_free_full (real_uri_list, g_free);
- if (points != NULL)
- {
- g_array_free (points, TRUE);
- }
-
g_free (container_uri);
}
@@ -455,13 +389,10 @@ void
nautilus_files_view_handle_text_drop (NautilusFilesView *view,
const char *text,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y)
+ GdkDragAction action)
{
int length;
char *container_uri;
- GdkPoint pos;
char *filename;
if (text == NULL)
@@ -480,10 +411,6 @@ nautilus_files_view_handle_text_drop (NautilusFilesView *view,
length = strlen (text);
- pos.x = x;
- pos.y = y;
- view_widget_to_file_operation_position (view, &pos);
-
/* try to get text to use as a filename */
filename = get_drop_filename (text);
@@ -491,8 +418,7 @@ nautilus_files_view_handle_text_drop (NautilusFilesView *view,
target_uri != NULL ? target_uri : container_uri,
filename,
text,
- length,
- &pos);
+ length);
g_free (filename);
g_free (container_uri);
}
@@ -503,13 +429,10 @@ nautilus_files_view_handle_raw_drop (NautilusFilesView *view,
int length,
const char *target_uri,
const char *direct_save_uri,
- GdkDragAction action,
- int x,
- int y)
+ GdkDragAction action)
{
char *container_uri, *filename;
GFile *direct_save_full;
- GdkPoint pos;
if (raw_data == NULL)
{
@@ -525,10 +448,6 @@ nautilus_files_view_handle_raw_drop (NautilusFilesView *view,
g_assert (container_uri != NULL);
}
- pos.x = x;
- pos.y = y;
- view_widget_to_file_operation_position (view, &pos);
-
filename = NULL;
if (direct_save_uri != NULL)
{
@@ -545,7 +464,7 @@ nautilus_files_view_handle_raw_drop (NautilusFilesView *view,
nautilus_files_view_new_file_with_initial_contents (
view, target_uri != NULL ? target_uri : container_uri,
- filename, raw_data, length, &pos);
+ filename, raw_data, length);
g_free (container_uri);
g_free (filename);
@@ -580,9 +499,9 @@ nautilus_files_view_drop_proxy_received_uris (NautilusFilesView *view,
nautilus_clipboard_clear_if_colliding_uris (GTK_WIDGET (view),
source_uri_list);
- nautilus_files_view_move_copy_items (view, source_uri_list, NULL,
+ nautilus_files_view_move_copy_items (view, source_uri_list,
target_uri != NULL ? target_uri : container_uri,
- action, 0, 0);
+ action);
g_free (container_uri);
}
diff --git a/src/nautilus-files-view-dnd.h b/src/nautilus-files-view-dnd.h
index 1680e0a19..0b946d994 100644
--- a/src/nautilus-files-view-dnd.h
+++ b/src/nautilus-files-view-dnd.h
@@ -32,29 +32,21 @@
void nautilus_files_view_handle_netscape_url_drop (NautilusFilesView *view,
const char *encoded_url,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y);
+ GdkDragAction action);
void nautilus_files_view_handle_uri_list_drop (NautilusFilesView *view,
const char *item_uris,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y);
+ GdkDragAction action);
void nautilus_files_view_handle_text_drop (NautilusFilesView *view,
const char *text,
const char *target_uri,
- GdkDragAction action,
- int x,
- int y);
+ GdkDragAction action);
void nautilus_files_view_handle_raw_drop (NautilusFilesView *view,
const char *raw_data,
int length,
const char *target_uri,
const char *direct_save_uri,
- GdkDragAction action,
- int x,
- int y);
+ GdkDragAction action);
void nautilus_files_view_handle_hover (NautilusFilesView *view,
const char *target_uri);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 2d5465aee..ddde56e02 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -224,7 +224,6 @@ typedef struct
gboolean sort_directories_first;
- gboolean show_foreign_files;
gboolean show_hidden_files;
gboolean ignore_hidden_file_preferences;
@@ -378,18 +377,6 @@ real_setup_loading_floating_bar (NautilusFilesView *view)
priv = nautilus_files_view_get_instance_private (view);
- gboolean disable_chrome;
-
- g_object_get (nautilus_files_view_get_window (view),
- "disable-chrome", &disable_chrome,
- NULL);
-
- if (disable_chrome)
- {
- gtk_widget_hide (priv->floating_bar);
- return;
- }
-
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (priv->floating_bar));
nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (priv->floating_bar),
nautilus_view_is_searching (NAUTILUS_VIEW (view)) ? _("Searching…") : _("Loading…"));
@@ -466,8 +453,6 @@ real_floating_bar_set_short_status (NautilusFilesView *view,
priv = nautilus_files_view_get_instance_private (view);
- gboolean disable_chrome;
-
if (priv->loading)
{
return;
@@ -477,11 +462,7 @@ real_floating_bar_set_short_status (NautilusFilesView *view,
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (priv->floating_bar),
FALSE);
- g_object_get (nautilus_files_view_get_window (view),
- "disable-chrome", &disable_chrome,
- NULL);
-
- if ((primary_status == NULL && detail_status == NULL) || disable_chrome)
+ if (primary_status == NULL && detail_status == NULL)
{
gtk_widget_hide (priv->floating_bar);
nautilus_floating_bar_remove_hover_timeout (NAUTILUS_FLOATING_BAR (priv->floating_bar));
@@ -689,14 +670,6 @@ nautilus_files_view_reveal_selection (NautilusFilesView *view)
NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->reveal_selection (view);
}
-static gboolean
-nautilus_files_view_using_manual_layout (NautilusFilesView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
-
- return NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->using_manual_layout (view);
-}
-
/**
* nautilus_files_view_get_toolbar_menu_sections:
* @view: a #NautilusFilesView
@@ -1170,11 +1143,6 @@ get_view_directory (NautilusFilesView *view)
priv = nautilus_files_view_get_instance_private (view);
uri = nautilus_directory_get_uri (priv->model);
- if (eel_uri_is_desktop (uri))
- {
- g_free (uri);
- uri = nautilus_get_desktop_directory_uri ();
- }
f = g_file_new_for_uri (uri);
path = g_file_get_path (f);
g_object_unref (f);
@@ -1823,8 +1791,6 @@ new_folder_done (GFile *new_folder,
NautilusFilesView *directory_view;
NautilusFilesViewPrivate *priv;
NautilusFile *file;
- char screen_string[32];
- GdkScreen *screen;
NewFolderData *data;
data = (NewFolderData *) user_data;
@@ -1846,17 +1812,7 @@ new_folder_done (GFile *new_folder,
goto fail;
}
- screen = gtk_widget_get_screen (GTK_WIDGET (directory_view));
- g_snprintf (screen_string, sizeof (screen_string), "%d", gdk_screen_get_number (screen));
-
-
file = nautilus_file_get (new_folder);
- if (nautilus_file_is_child_of_desktop_directory (file))
- {
- nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_SCREEN,
- NULL,
- screen_string);
- }
if (data->selection != NULL)
{
@@ -1874,10 +1830,8 @@ new_folder_done (GFile *new_folder,
nautilus_files_view_move_copy_items (directory_view,
uris,
- NULL,
target_uri,
- GDK_ACTION_MOVE,
- 0, 0);
+ GDK_ACTION_MOVE);
g_list_free_full (uris, g_free);
g_free (target_uri);
}
@@ -1935,29 +1889,6 @@ new_folder_data_new (NautilusFilesView *directory_view,
return data;
}
-static GdkPoint *
-context_menu_to_file_operation_position (NautilusFilesView *view)
-{
- NautilusFilesViewPrivate *priv;
-
- g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
-
- priv = nautilus_files_view_get_instance_private (view);
-
- if (nautilus_files_view_using_manual_layout (view)
- && priv->context_menu_position.x >= 0
- && priv->context_menu_position.y >= 0)
- {
- NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->widget_to_file_operation_position
- (view, &priv->context_menu_position);
- return &priv->context_menu_position;
- }
- else
- {
- return NULL;
- }
-}
-
static GdkRectangle *
nautilus_files_view_compute_rename_popover_pointing_to (NautilusFilesView *view)
{
@@ -2042,7 +1973,6 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
NewFolderData *data;
- GdkPoint *position = NULL;
g_autofree gchar *parent_uri = NULL;
g_autofree gchar *name = NULL;
NautilusFile *parent;
@@ -2066,12 +1996,8 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
parent_uri = nautilus_files_view_get_backing_uri (view);
parent = nautilus_file_get_by_uri (parent_uri);
- if (eel_uri_is_desktop (parent_uri))
- {
- position = context_menu_to_file_operation_position (view);
- }
nautilus_file_operations_new_folder (GTK_WIDGET (view),
- position, parent_uri, name,
+ parent_uri, name,
new_folder_done, data);
g_clear_object (&priv->new_folder_controller);
@@ -2388,8 +2314,7 @@ nautilus_files_view_new_file_with_initial_contents (NautilusFilesView *view,
const char *parent_uri,
const char *filename,
const char *initial_contents,
- int length,
- GdkPoint *pos)
+ int length)
{
NewFolderData *data;
@@ -2397,13 +2322,8 @@ nautilus_files_view_new_file_with_initial_contents (NautilusFilesView *view,
data = setup_new_folder_data (view);
- if (pos == NULL)
- {
- pos = context_menu_to_file_operation_position (view);
- }
-
nautilus_file_operations_new_file (GTK_WIDGET (view),
- pos, parent_uri, filename,
+ parent_uri, filename,
initial_contents, length,
new_folder_done, data);
}
@@ -2413,7 +2333,6 @@ nautilus_files_view_new_file (NautilusFilesView *directory_view,
const char *parent_uri,
NautilusFile *source)
{
- GdkPoint *pos;
NewFolderData *data;
char *source_uri;
char *container_uri;
@@ -2431,22 +2350,18 @@ nautilus_files_view_new_file (NautilusFilesView *directory_view,
parent_uri != NULL ? parent_uri : container_uri,
NULL,
NULL,
- 0,
- NULL);
+ 0);
g_free (container_uri);
return;
}
g_return_if_fail (nautilus_file_is_local (source));
- pos = context_menu_to_file_operation_position (directory_view);
-
data = setup_new_folder_data (directory_view);
source_uri = nautilus_file_get_uri (source);
nautilus_file_operations_new_file_from_template (GTK_WIDGET (directory_view),
- pos,
parent_uri != NULL ? parent_uri : container_uri,
NULL,
source_uri,
@@ -2629,9 +2544,8 @@ handle_clipboard_data (NautilusFilesView *view,
if (item_uris != NULL && destination_uri != NULL)
{
- nautilus_files_view_move_copy_items (view, item_uris, NULL, destination_uri,
- action,
- 0, 0);
+ nautilus_files_view_move_copy_items (view, item_uris, destination_uri,
+ action);
/* If items are cut then remove from clipboard */
if (action == GDK_ACTION_MOVE)
@@ -4738,25 +4652,6 @@ nautilus_files_view_get_content_widget (NautilusFilesView *view)
return priv->scrolled_window;
}
-static void
-offset_drop_points (GArray *relative_item_points,
- int x_offset,
- int y_offset)
-{
- guint index;
-
- if (relative_item_points == NULL)
- {
- return;
- }
-
- for (index = 0; index < relative_item_points->len; index++)
- {
- g_array_index (relative_item_points, GdkPoint, index).x += x_offset;
- g_array_index (relative_item_points, GdkPoint, index).y += y_offset;
- }
-}
-
static gboolean
nautilus_files_view_special_link_in_selection (NautilusFilesView *view,
GList *selection)
@@ -5265,7 +5160,6 @@ get_strings_for_environment_variables (NautilusFilesView *view,
*/
directory_uri = nautilus_directory_get_uri (priv->model);
if (g_str_has_prefix (directory_uri, "file:") ||
- eel_uri_is_desktop (directory_uri) ||
eel_uri_is_trash (directory_uri))
{
*file_paths = get_file_paths_as_newline_delimited_string (view, selected_files);
@@ -5279,11 +5173,6 @@ get_strings_for_environment_variables (NautilusFilesView *view,
*uris = get_file_uris_as_newline_delimited_string (view, selected_files);
*uri = nautilus_directory_get_uri (priv->model);
- if (eel_uri_is_desktop (*uri))
- {
- g_free (*uri);
- *uri = nautilus_get_desktop_directory_uri ();
- }
}
/*
@@ -5967,9 +5856,8 @@ on_destination_dialog_response (GtkDialog *dialog,
}
uris = g_list_reverse (uris);
- nautilus_files_view_move_copy_items (copy_data->view, uris, NULL, target_uri,
- copy_data->is_move ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
- 0, 0);
+ nautilus_files_view_move_copy_items (copy_data->view, uris, target_uri,
+ copy_data->is_move ? GDK_ACTION_MOVE : GDK_ACTION_COPY);
g_list_free_full (uris, g_free);
g_free (target_uri);
@@ -6163,9 +6051,8 @@ action_create_links_in_place (GSimpleAction *action,
destination_uri = nautilus_files_view_get_backing_uri (view);
- nautilus_files_view_move_copy_items (view, item_uris, NULL, destination_uri,
- GDK_ACTION_LINK,
- 0, 0);
+ nautilus_files_view_move_copy_items (view, item_uris, destination_uri,
+ GDK_ACTION_LINK);
g_list_free_full (item_uris, g_free);
nautilus_file_list_free (selection);
@@ -6746,7 +6633,6 @@ action_set_as_wallpaper (GSimpleAction *action,
g_object_unref (target);
uris = g_list_prepend (NULL, nautilus_file_get_uri (file));
nautilus_file_operations_copy_move (uris,
- NULL,
target_uri,
GDK_ACTION_COPY,
GTK_WIDGET (user_data),
@@ -8857,16 +8743,7 @@ nautilus_files_view_should_show_file (NautilusFilesView *view,
priv = nautilus_files_view_get_instance_private (view);
return nautilus_file_should_show (file,
- priv->show_hidden_files,
- priv->show_foreign_files);
-}
-
-static gboolean
-real_using_manual_layout (NautilusFilesView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
-
- return FALSE;
+ priv->show_hidden_files);
}
void
@@ -8887,17 +8764,6 @@ nautilus_files_view_ignore_hidden_file_preferences (NautilusFilesView *view)
priv->ignore_hidden_file_preferences = TRUE;
}
-void
-nautilus_files_view_set_show_foreign (NautilusFilesView *view,
- gboolean show_foreign)
-{
- NautilusFilesViewPrivate *priv;
-
- priv = nautilus_files_view_get_instance_private (view);
-
- priv->show_foreign_files = show_foreign;
-}
-
char *
nautilus_files_view_get_uri (NautilusFilesView *view)
{
@@ -8917,21 +8783,11 @@ nautilus_files_view_get_uri (NautilusFilesView *view)
void
nautilus_files_view_move_copy_items (NautilusFilesView *view,
const GList *item_uris,
- GArray *relative_item_points,
const char *target_uri,
- int copy_action,
- int x,
- int y)
+ int copy_action)
{
NautilusFile *target_file;
- g_assert (relative_item_points == NULL
- || relative_item_points->len == 0
- || g_list_length ((GList *) item_uris) == relative_item_points->len);
-
- /* add the drop location to the icon offsets */
- offset_drop_points (relative_item_points, x, y);
-
target_file = nautilus_file_get_existing_by_uri (target_uri);
/* special-case "command:" here instead of starting a move/copy */
if (target_file != NULL && nautilus_file_is_launcher (target_file))
@@ -8985,7 +8841,7 @@ nautilus_files_view_move_copy_items (NautilusFilesView *view,
nautilus_file_unref (target_file);
nautilus_file_operations_copy_move
- (item_uris, relative_item_points,
+ (item_uris,
target_uri, copy_action, GTK_WIDGET (view),
copy_move_done_callback, pre_copy_move (view));
}
@@ -9579,7 +9435,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
G_TYPE_NONE, 0);
klass->get_backing_uri = real_get_backing_uri;
- klass->using_manual_layout = real_using_manual_layout;
klass->get_window = nautilus_files_view_get_window;
klass->update_context_menus = real_update_context_menus;
klass->update_actions_state = real_update_actions_state;
@@ -9753,9 +9608,6 @@ nautilus_files_view_init (NautilusFilesView *view)
G_CALLBACK (floating_bar_action_cb),
view);
- /* Default to true; desktop-icon-view sets to false */
- priv->show_foreign_files = TRUE;
-
priv->non_ready_files =
g_hash_table_new_full (file_and_directory_hash,
file_and_directory_equal,
diff --git a/src/nautilus-files-view.h b/src/nautilus-files-view.h
index 7689f98d7..80384f27d 100644
--- a/src/nautilus-files-view.h
+++ b/src/nautilus-files-view.h
@@ -196,13 +196,6 @@ struct _NautilusFilesViewClass {
NautilusFile *a,
NautilusFile *b);
- /* using_manual_layout is a function pointer that subclasses may
- * override to control whether or not items can be freely positioned
- * on the user-visible area.
- * Note that this value is not guaranteed to be constant within the
- * view's lifecycle. */
- gboolean (* using_manual_layout) (NautilusFilesView *view);
-
/* is_empty is a function pointer that subclasses must
* override to report whether the view contains any items.
*/
@@ -286,8 +279,6 @@ gboolean nautilus_files_view_should_show_file (Nautil
NautilusFile *file);
gboolean nautilus_files_view_should_sort_directories_first (NautilusFilesView *view);
void nautilus_files_view_ignore_hidden_file_preferences (NautilusFilesView *view);
-void nautilus_files_view_set_show_foreign (NautilusFilesView *view,
- gboolean show_foreign);
gboolean nautilus_files_view_handle_scroll_event (NautilusFilesView *view,
GdkEventScroll *event);
@@ -305,17 +296,13 @@ guint nautilus_files_view_get_view_id (NautilusView
char * nautilus_files_view_get_backing_uri (NautilusFilesView *view);
void nautilus_files_view_move_copy_items (NautilusFilesView *view,
const GList *item_uris,
- GArray *relative_item_points,
const char *target_uri,
- int copy_action,
- int x,
- int y);
+ int copy_action);
void nautilus_files_view_new_file_with_initial_contents (NautilusFilesView *view,
const char *parent_uri,
const char *filename,
const char *initial_contents,
- int length,
- GdkPoint *pos);
+ int length);
/* selection handling */
void nautilus_files_view_activate_selection (NautilusFilesView *view);
diff --git a/src/nautilus-global-preferences.c b/src/nautilus-global-preferences.c
index 94326b94a..d24db28c3 100644
--- a/src/nautilus-global-preferences.c
+++ b/src/nautilus-global-preferences.c
@@ -36,7 +36,6 @@ GSettings *nautilus_preferences;
GSettings *nautilus_compression_preferences;
GSettings *nautilus_icon_view_preferences;
GSettings *nautilus_list_view_preferences;
-GSettings *nautilus_desktop_preferences;
GSettings *nautilus_window_state;
GSettings *gtk_filechooser_preferences;
GSettings *gnome_lockdown_preferences;
@@ -61,7 +60,6 @@ nautilus_global_preferences_init (void)
nautilus_window_state = g_settings_new ("org.gnome.nautilus.window-state");
nautilus_icon_view_preferences = g_settings_new ("org.gnome.nautilus.icon-view");
nautilus_list_view_preferences = g_settings_new ("org.gnome.nautilus.list-view");
- nautilus_desktop_preferences = g_settings_new ("org.gnome.nautilus.desktop");
/* Some settings such as show hidden files are shared between Nautilus and GTK file chooser */
gtk_filechooser_preferences = g_settings_new_with_path ("org.gtk.Settings.FileChooser",
"/org/gtk/settings/file-chooser/");
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index 7c19ba1fd..3bfa87731 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -101,7 +101,6 @@ typedef enum
/* ellipsization preferences */
#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT "text-ellipsis-limit"
-#define NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT "text-ellipsis-limit"
/* List View */
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level"
@@ -139,25 +138,12 @@ typedef enum
NAUTILUS_SIMPLE_SEARCH_BAR
} NautilusSearchBarMode;
-#define NAUTILUS_PREFERENCES_DESKTOP_FONT "font"
-#define NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE "home-icon-visible"
-#define NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME "home-icon-name"
-#define NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE "trash-icon-visible"
-#define NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME "trash-icon-name"
-#define NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE "volumes-visible"
-#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE "network-icon-visible"
-#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_NAME "network-icon-name"
-#define NAUTILUS_PREFERENCES_DESKTOP_BACKGROUND_FADE "background-fade"
-
/* bulk rename utility */
#define NAUTILUS_PREFERENCES_BULK_RENAME_TOOL "bulk-rename-tool"
/* Lockdown */
#define NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE "disable-command-line"
-/* Desktop background */
-#define NAUTILUS_PREFERENCES_SHOW_DESKTOP "show-desktop-icons"
-
/* Recent files */
#define NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED "remember-recent-files"
diff --git a/src/nautilus-icon-names.h b/src/nautilus-icon-names.h
index 64574662c..f6f75a953 100644
--- a/src/nautilus-icon-names.h
+++ b/src/nautilus-icon-names.h
@@ -21,13 +21,6 @@
#define NAUTILUS_ICON_FOLDER_TEMPLATES "folder-templates-symbolic"
#define NAUTILUS_ICON_FOLDER_VIDEOS "folder-videos-symbolic"
-/* Icons for desktop */
-#define NAUTILUS_DESKTOP_ICON_DESKTOP "user-desktop"
-#define NAUTILUS_DESKTOP_ICON_TRASH "user-trash"
-#define NAUTILUS_DESKTOP_ICON_TRASH_FULL "user-trash-full"
-#define NAUTILUS_DESKTOP_ICON_HOME "user-home"
-#define NAUTILUS_DESKTOP_ICON_NETWORK "network-workgroup"
-
/* Fullcolor icons */
#define NAUTILUS_ICON_FULLCOLOR_FOLDER "folder"
#define NAUTILUS_ICON_FULLCOLOR_FOLDER_REMOTE "folder-remote"
diff --git a/src/nautilus-lib-self-check-functions.h b/src/nautilus-lib-self-check-functions.h
index c326c60fd..77dcd2152 100644
--- a/src/nautilus-lib-self-check-functions.h
+++ b/src/nautilus-lib-self-check-functions.h
@@ -40,7 +40,6 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_file_operations) \
macro (nautilus_self_check_directory) \
macro (nautilus_self_check_file) \
- macro (nautilus_self_check_canvas_container) \
/* Add new self-check functions to the list above this line. */
/* Generate prototypes for all the functions. */
diff --git a/src/nautilus-link.c b/src/nautilus-link.c
index a16efa212..d52841843 100644
--- a/src/nautilus-link.c
+++ b/src/nautilus-link.c
@@ -189,7 +189,6 @@ nautilus_link_local_create (const char *directory_uri,
const char *display_name,
const char *image,
const char *target_uri,
- const GdkPoint *point,
int screen,
gboolean unique_filename)
{
@@ -197,7 +196,6 @@ nautilus_link_local_create (const char *directory_uri,
char *contents;
GFile *file;
GList dummy_list;
- NautilusFileChangesQueuePosition item;
g_autofree char *link_name = NULL;
g_autoptr (GFile) directory = NULL;
@@ -212,14 +210,7 @@ nautilus_link_local_create (const char *directory_uri,
return FALSE;
}
- if (eel_uri_is_desktop (directory_uri))
- {
- real_directory_uri = nautilus_get_desktop_directory_uri ();
- }
- else
- {
- real_directory_uri = g_strdup (directory_uri);
- }
+ real_directory_uri = g_strdup (directory_uri);
link_name = g_strdup_printf ("%s.desktop", base_name);
directory = g_file_new_for_uri (real_directory_uri);
@@ -268,20 +259,6 @@ nautilus_link_local_create (const char *directory_uri,
dummy_list.prev = NULL;
nautilus_directory_notify_files_added (&dummy_list);
- if (point != NULL)
- {
- item.location = file;
- item.set = TRUE;
- item.point.x = point->x;
- item.point.y = point->y;
- item.screen = screen;
- dummy_list.data = &item;
- dummy_list.next = NULL;
- dummy_list.prev = NULL;
-
- nautilus_directory_schedule_position_set (&dummy_list);
- }
-
g_object_unref (file);
return TRUE;
}
@@ -543,48 +520,6 @@ nautilus_link_local_get_link_uri (const char *uri)
return retval;
}
-static gboolean
-string_array_contains (gchar **array,
- gchar **desktop_names)
-{
- gchar **p;
- gchar **desktop;
-
- if (!array)
- {
- return FALSE;
- }
-
- for (p = array; *p; p++)
- {
- for (desktop = desktop_names; *desktop; desktop++)
- {
- if (g_ascii_strcasecmp (*p, *desktop) == 0)
- {
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-static gchar **
-get_desktop_names (void)
-{
- const gchar *current_desktop;
-
- current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
-
- if (current_desktop == NULL || current_desktop[0] == 0)
- {
- /* historic behavior */
- current_desktop = "GNOME";
- }
-
- return g_strsplit (current_desktop, ":", -1);
-}
-
void
nautilus_link_get_link_info_given_file_contents (const char *file_contents,
int link_file_size,
@@ -592,14 +527,10 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
char **uri,
char **name,
GIcon **icon,
- gboolean *is_launcher,
- gboolean *is_foreign)
+ gboolean *is_launcher)
{
GKeyFile *key_file;
- gchar **desktop_names;
char *type;
- char **only_show_in;
- char **not_show_in;
key_file = g_key_file_new ();
if (!g_key_file_load_from_data (key_file,
@@ -612,8 +543,6 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
return;
}
- desktop_names = get_desktop_names ();
-
*uri = nautilus_link_get_link_uri_from_desktop (key_file, file_uri);
*name = nautilus_link_get_link_name_from_desktop (key_file);
*icon = nautilus_link_get_link_icon_from_desktop (key_file);
@@ -627,23 +556,5 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
}
g_free (type);
- *is_foreign = FALSE;
- only_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP,
- "OnlyShowIn", NULL, NULL);
- if (only_show_in && !string_array_contains (only_show_in, desktop_names))
- {
- *is_foreign = TRUE;
- }
- g_strfreev (only_show_in);
-
- not_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP,
- "NotShowIn", NULL, NULL);
- if (not_show_in && string_array_contains (not_show_in, desktop_names))
- {
- *is_foreign = TRUE;
- }
- g_strfreev (not_show_in);
-
- g_strfreev (desktop_names);
g_key_file_free (key_file);
}
diff --git a/src/nautilus-link.h b/src/nautilus-link.h
index 72d9c1743..be0c691ce 100644
--- a/src/nautilus-link.h
+++ b/src/nautilus-link.h
@@ -29,7 +29,6 @@ gboolean nautilus_link_local_create (const char
const char *display_name,
const char *image,
const char *target_uri,
- const GdkPoint *point,
int screen,
gboolean unique_filename);
gboolean nautilus_link_local_set_text (const char *uri,
@@ -44,7 +43,6 @@ void nautilus_link_get_link_info_given_file_contents (const char
char **uri,
char **name,
GIcon **icon,
- gboolean *is_launcher,
- gboolean *is_foreign);
+ gboolean *is_launcher);
#endif /* NAUTILUS_LINK_H */
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 89e54cb09..0e2d678b3 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1304,12 +1304,10 @@ list_view_handle_netscape_url (NautilusTreeViewDragDest *dest,
const char *encoded_url,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusListView *view)
{
nautilus_files_view_handle_netscape_url_drop (NAUTILUS_FILES_VIEW (view),
- encoded_url, target_uri, action, x, y);
+ encoded_url, target_uri, action);
}
static void
@@ -1317,12 +1315,10 @@ list_view_handle_uri_list (NautilusTreeViewDragDest *dest,
const char *item_uris,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusListView *view)
{
nautilus_files_view_handle_uri_list_drop (NAUTILUS_FILES_VIEW (view),
- item_uris, target_uri, action, x, y);
+ item_uris, target_uri, action);
}
static void
@@ -1330,12 +1326,10 @@ list_view_handle_text (NautilusTreeViewDragDest *dest,
const char *text,
const char *target_uri,
GdkDragAction action,
- int x,
- int y,
NautilusListView *view)
{
nautilus_files_view_handle_text_drop (NAUTILUS_FILES_VIEW (view),
- text, target_uri, action, x, y);
+ text, target_uri, action);
}
static void
@@ -1345,13 +1339,11 @@ list_view_handle_raw (NautilusTreeViewDragDest *dest,
const char *target_uri,
const char *direct_save_uri,
GdkDragAction action,
- int x,
- int y,
NautilusListView *view)
{
nautilus_files_view_handle_raw_drop (NAUTILUS_FILES_VIEW (view),
raw_data, length, target_uri, direct_save_uri,
- action, x, y);
+ action);
}
static void
@@ -1367,8 +1359,6 @@ move_copy_items_callback (NautilusTreeViewDragDest *dest,
const GList *item_uris,
const char *target_uri,
guint action,
- int x,
- int y,
gpointer user_data)
{
NautilusFilesView *view = user_data;
@@ -1377,10 +1367,8 @@ move_copy_items_callback (NautilusTreeViewDragDest *dest,
item_uris);
nautilus_files_view_move_copy_items (view,
item_uris,
- NULL,
target_uri,
- action,
- x, y);
+ action);
}
static void
@@ -3489,14 +3477,6 @@ nautilus_list_view_compare_files (NautilusFilesView *view,
return nautilus_list_model_compare_func (list_view->details->model, file1, file2);
}
-static gboolean
-nautilus_list_view_using_manual_layout (NautilusFilesView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), FALSE);
-
- return FALSE;
-}
-
static void
nautilus_list_view_dispose (GObject *object)
{
@@ -3803,7 +3783,6 @@ nautilus_list_view_class_init (NautilusListViewClass *class)
nautilus_files_view_class->compare_files = nautilus_list_view_compare_files;
nautilus_files_view_class->sort_directories_first_changed = nautilus_list_view_sort_directories_first_changed;
nautilus_files_view_class->end_file_changes = nautilus_list_view_end_file_changes;
- nautilus_files_view_class->using_manual_layout = nautilus_list_view_using_manual_layout;
nautilus_files_view_class->get_view_id = nautilus_list_view_get_id;
nautilus_files_view_class->get_first_visible_file = nautilus_list_view_get_first_visible_file;
nautilus_files_view_class->scroll_to_file = list_view_scroll_to_file;
diff --git a/src/nautilus-metadata.c b/src/nautilus-metadata.c
index bee04e7ca..16bf2f2e3 100644
--- a/src/nautilus-metadata.c
+++ b/src/nautilus-metadata.c
@@ -24,12 +24,8 @@ static char *used_metadata_names[] =
{
NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR,
NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE,
- NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT,
NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_BY,
NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_REVERSED,
- NAUTILUS_METADATA_KEY_ICON_VIEW_KEEP_ALIGNED,
- NAUTILUS_METADATA_KEY_ICON_VIEW_LAYOUT_TIMESTAMP,
- NAUTILUS_METADATA_KEY_DESKTOP_ICON_SIZE,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED,
NAUTILUS_METADATA_KEY_LIST_VIEW_VISIBLE_COLUMNS,
@@ -44,12 +40,8 @@ static char *used_metadata_names[] =
NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE,
NAUTILUS_METADATA_KEY_SIDEBAR_BUTTONS,
NAUTILUS_METADATA_KEY_ANNOTATION,
- NAUTILUS_METADATA_KEY_ICON_POSITION,
- NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP,
- NAUTILUS_METADATA_KEY_ICON_SCALE,
NAUTILUS_METADATA_KEY_CUSTOM_ICON,
NAUTILUS_METADATA_KEY_CUSTOM_ICON_NAME,
- NAUTILUS_METADATA_KEY_SCREEN,
NAUTILUS_METADATA_KEY_EMBLEMS,
NAUTILUS_METADATA_KEY_DESKTOP_FILE_TRUSTED,
NULL
diff --git a/src/nautilus-metadata.h b/src/nautilus-metadata.h
index c4a303ec5..996c520b1 100644
--- a/src/nautilus-metadata.h
+++ b/src/nautilus-metadata.h
@@ -34,13 +34,8 @@
#define NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR "folder-background-color"
#define NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE "folder-background-image"
-#define NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT "nautilus-icon-view-auto-layout"
#define NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_BY "nautilus-icon-view-sort-by"
#define NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_REVERSED "nautilus-icon-view-sort-reversed"
-#define NAUTILUS_METADATA_KEY_ICON_VIEW_KEEP_ALIGNED "nautilus-icon-view-keep-aligned"
-#define NAUTILUS_METADATA_KEY_ICON_VIEW_LAYOUT_TIMESTAMP "nautilus-icon-view-layout-timestamp"
-
-#define NAUTILUS_METADATA_KEY_DESKTOP_ICON_SIZE "nautilus-desktop-icon-size"
#define NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN "nautilus-list-view-sort-column"
#define NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED "nautilus-list-view-sort-reversed"
@@ -58,13 +53,9 @@
#define NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE "nautilus-sidebar-background-image"
#define NAUTILUS_METADATA_KEY_SIDEBAR_BUTTONS "nautilus-sidebar-buttons"
-#define NAUTILUS_METADATA_KEY_ICON_POSITION "nautilus-icon-position"
-#define NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP "nautilus-icon-position-timestamp"
#define NAUTILUS_METADATA_KEY_ANNOTATION "annotation"
-#define NAUTILUS_METADATA_KEY_ICON_SCALE "icon-scale"
#define NAUTILUS_METADATA_KEY_CUSTOM_ICON "custom-icon"
#define NAUTILUS_METADATA_KEY_CUSTOM_ICON_NAME "custom-icon-name"
-#define NAUTILUS_METADATA_KEY_SCREEN "screen"
#define NAUTILUS_METADATA_KEY_EMBLEMS "emblems"
#define NAUTILUS_METADATA_KEY_DESKTOP_FILE_TRUSTED "trusted"
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 40ad2554d..46f491f30 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -466,9 +466,6 @@ reset_icon (NautilusPropertiesWindow *properties_window)
file = NAUTILUS_FILE (l->data);
nautilus_file_set_metadata (file,
- NAUTILUS_METADATA_KEY_ICON_SCALE,
- NULL, NULL);
- nautilus_file_set_metadata (file,
NAUTILUS_METADATA_KEY_CUSTOM_ICON,
NULL, NULL);
}
@@ -5522,7 +5519,6 @@ set_icon (const char *icon_uri,
}
nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL, real_icon_uri);
- nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_ICON_SCALE, NULL, NULL);
}
g_free (file_uri);
diff --git a/src/nautilus-recent.c b/src/nautilus-recent.c
index ab50fef8f..08253e01f 100644
--- a/src/nautilus-recent.c
+++ b/src/nautilus-recent.c
@@ -51,8 +51,7 @@ nautilus_recent_add_file (NautilusFile *file,
/* do not add trash:// etc */
if (eel_uri_is_trash (uri) ||
eel_uri_is_search (uri) ||
- eel_uri_is_recent (uri) ||
- eel_uri_is_desktop (uri))
+ eel_uri_is_recent (uri))
{
g_free (uri);
return;
diff --git a/src/nautilus-tree-view-drag-dest.c b/src/nautilus-tree-view-drag-dest.c
index 42868e3bd..7a15d7170 100644
--- a/src/nautilus-tree-view-drag-dest.c
+++ b/src/nautilus-tree-view-drag-dest.c
@@ -752,17 +752,8 @@ receive_uris (NautilusTreeViewDragDest *dest,
if (real_action == GDK_ACTION_ASK)
{
- if (nautilus_drag_selection_includes_special_link (dest->details->drag_list))
- {
- /* We only want to move the trash */
- action = GDK_ACTION_MOVE;
- }
- else
- {
- action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
- }
- real_action = nautilus_drag_drop_action_ask
- (GTK_WIDGET (dest->details->tree_view), action);
+ action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
+ real_action = nautilus_drag_drop_action_ask (GTK_WIDGET (dest->details->tree_view), action);
}
/* We only want to copy external uris */
@@ -890,8 +881,7 @@ receive_dropped_raw (NautilusTreeViewDragDest *dest,
g_signal_emit (dest, signals[HANDLE_RAW], 0,
raw_data, length, drop_target,
dest->details->direct_save_uri,
- gdk_drag_context_get_selected_action (context),
- x, y);
+ gdk_drag_context_get_selected_action (context));
g_free (drop_target);
}
@@ -1275,12 +1265,10 @@ nautilus_tree_view_drag_dest_class_init (NautilusTreeViewDragDestClass *class)
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_POINTER,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_NETSCAPE_URL] =
g_signal_new ("handle-netscape-url",
G_TYPE_FROM_CLASS (class),
@@ -1289,12 +1277,10 @@ nautilus_tree_view_drag_dest_class_init (NautilusTreeViewDragDestClass *class)
handle_netscape_url),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_URI_LIST] =
g_signal_new ("handle-uri-list",
G_TYPE_FROM_CLASS (class),
@@ -1303,12 +1289,10 @@ nautilus_tree_view_drag_dest_class_init (NautilusTreeViewDragDestClass *class)
handle_uri_list),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_TEXT] =
g_signal_new ("handle-text",
G_TYPE_FROM_CLASS (class),
@@ -1317,12 +1301,10 @@ nautilus_tree_view_drag_dest_class_init (NautilusTreeViewDragDestClass *class)
handle_text),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 5,
+ G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_RAW] =
g_signal_new ("handle-raw",
G_TYPE_FROM_CLASS (class),
@@ -1331,14 +1313,12 @@ nautilus_tree_view_drag_dest_class_init (NautilusTreeViewDragDestClass *class)
handle_raw),
NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_NONE, 7,
+ G_TYPE_NONE, 5,
G_TYPE_POINTER,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
- GDK_TYPE_DRAG_ACTION,
- G_TYPE_INT,
- G_TYPE_INT);
+ GDK_TYPE_DRAG_ACTION);
signals[HANDLE_HOVER] =
g_signal_new ("handle-hover",
G_TYPE_FROM_CLASS (class),
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index f6199ba13..1b7007982 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -705,12 +705,6 @@ real_compare_files (NautilusFilesView *files_view,
return 0;
}
-static gboolean
-real_using_manual_layout (NautilusFilesView *files_view)
-{
- return FALSE;
-}
-
static void
real_end_loading (NautilusFilesView *files_view,
gboolean all_files_seen)
@@ -912,7 +906,6 @@ nautilus_view_icon_controller_class_init (NautilusViewIconControllerClass *klass
files_view_class->compare_files = real_compare_files;
files_view_class->sort_directories_first_changed = real_sort_directories_first_changed;
files_view_class->end_file_changes = real_end_file_changes;
- files_view_class->using_manual_layout = real_using_manual_layout;
files_view_class->end_loading = real_end_loading;
files_view_class->get_view_id = real_get_view_id;
files_view_class->get_first_visible_file = real_get_first_visible_file;
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 0f8170764..dcd39e0ad 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -30,7 +30,6 @@ enum
{
NAUTILUS_VIEW_GRID_ID,
NAUTILUS_VIEW_LIST_ID,
- NAUTILUS_VIEW_DESKTOP_ID,
NAUTILUS_VIEW_EMPTY_ID,
NAUTILUS_VIEW_OTHER_LOCATIONS_ID,
NAUTILUS_VIEW_INVALID_ID,
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index dede5dc1f..c983debc5 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -451,8 +451,7 @@ slot_proxy_handle_drop (GtkWidget *widget,
nautilus_files_view_handle_netscape_url_drop (target_view,
drag_info->data.netscape_url,
target_uri,
- gdk_drag_context_get_selected_action (context),
- 0, 0);
+ gdk_drag_context_get_selected_action (context));
}
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index d364115a9..b8452e817 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -226,8 +226,7 @@ real_handles_location (NautilusWindowSlot *self,
uri = g_file_get_uri(location);
file = nautilus_file_get (location);
- handles_location = !nautilus_file_is_other_locations (file) &&
- !eel_uri_is_desktop (uri);
+ handles_location = !nautilus_file_is_other_locations (file);
nautilus_file_unref (file);
return handles_location;
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index ccf274644..3034cdc80 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -134,8 +134,6 @@ typedef struct
/* focus widget before the location bar has been shown temporarily */
GtkWidget *last_focus_widget;
- gboolean disable_chrome;
-
guint sidebar_width_handler_id;
guint bookmarks_id;
@@ -146,19 +144,12 @@ typedef struct
enum
{
- PROP_DISABLE_CHROME = 1,
- NUM_PROPERTIES,
-};
-
-enum
-{
SLOT_ADDED,
SLOT_REMOVED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
-static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE_WITH_PRIVATE (NautilusWindow, nautilus_window, GTK_TYPE_APPLICATION_WINDOW);
@@ -1286,7 +1277,7 @@ places_sidebar_drag_perform_drop_cb (GtkPlacesSidebar *sidebar,
dest_uri = g_file_get_uri (dest_file);
source_uri_list = build_uri_list_from_gfile_list (source_file_list);
- nautilus_file_operations_copy_move (source_uri_list, NULL, dest_uri, action, GTK_WIDGET (sidebar), NULL, NULL);
+ nautilus_file_operations_copy_move (source_uri_list, dest_uri, action, GTK_WIDGET (sidebar), NULL, NULL);
g_free (dest_uri);
g_list_free_full (source_uri_list, g_free);
@@ -1559,11 +1550,6 @@ nautilus_window_show_sidebar (NautilusWindow *window)
priv = nautilus_window_get_instance_private (window);
- if (priv->disable_chrome)
- {
- return;
- }
-
gtk_widget_show (priv->sidebar);
setup_side_pane_width (window);
}
@@ -1824,8 +1810,7 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
if (undo_info != NULL &&
state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO &&
- nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_MOVE_TO_TRASH &&
- !priv->disable_chrome)
+ nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_MOVE_TO_TRASH)
{
files = nautilus_file_undo_info_trash_get_files (NAUTILUS_FILE_UNDO_INFO_TRASH (undo_info));
@@ -1908,8 +1893,7 @@ nautilus_window_show_operation_notification (NautilusWindow *window,
priv = nautilus_window_get_instance_private (window);
current_location = nautilus_window_slot_get_location (priv->active_slot);
- if (gtk_window_has_toplevel_focus (GTK_WINDOW (window)) &&
- !priv->disable_chrome)
+ if (gtk_window_has_toplevel_focus (GTK_WINDOW (window)))
{
remove_notifications (window);
gtk_label_set_text (GTK_LABEL (priv->notification_operation_label),
@@ -2107,9 +2091,6 @@ setup_toolbar (NautilusWindow *window)
priv = nautilus_window_get_instance_private (window);
g_object_set (priv->toolbar, "window", window, NULL);
- g_object_bind_property (window, "disable-chrome",
- priv->toolbar, "visible",
- G_BINDING_INVERT_BOOLEAN);
/* connect to the pathbar signals */
path_bar = nautilus_toolbar_get_path_bar (NAUTILUS_TOOLBAR (priv->toolbar));
@@ -2393,56 +2374,6 @@ nautilus_window_constructed (GObject *self)
nautilus_profile_end (NULL);
}
-static void
-nautilus_window_set_property (GObject *object,
- guint arg_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- NautilusWindow *window;
- window = NAUTILUS_WINDOW (object);
- NautilusWindowPrivate *priv;
-
- priv = nautilus_window_get_instance_private (window);
-
- switch (arg_id)
- {
- case PROP_DISABLE_CHROME:
- {
- priv->disable_chrome = g_value_get_boolean (value);
- }
- break;
-
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, arg_id, pspec);
- }
- break;
- }
-}
-
-static void
-nautilus_window_get_property (GObject *object,
- guint arg_id,
- GValue *value,
- GParamSpec *pspec)
-{
- NautilusWindow *window;
- window = NAUTILUS_WINDOW (object);
- NautilusWindowPrivate *priv;
-
- priv = nautilus_window_get_instance_private (window);
-
- switch (arg_id)
- {
- case PROP_DISABLE_CHROME:
- {
- g_value_set_boolean (value, priv->disable_chrome);
- }
- break;
- }
-}
-
static gint
sort_slots_active_last (NautilusWindowSlot *a,
NautilusWindowSlot *b,
@@ -2922,8 +2853,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
oclass->finalize = nautilus_window_finalize;
oclass->constructed = nautilus_window_constructed;
- oclass->get_property = nautilus_window_get_property;
- oclass->set_property = nautilus_window_set_property;
wclass->destroy = nautilus_window_destroy;
wclass->show = nautilus_window_show;
@@ -2957,13 +2886,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
gtk_widget_class_bind_template_callback (wclass, places_sidebar_show_other_locations_with_flags);
gtk_widget_class_bind_template_callback (wclass, places_sidebar_show_starred_location);
- properties[PROP_DISABLE_CHROME] =
- g_param_spec_boolean ("disable-chrome",
- "Disable chrome",
- "Disable window chrome, for the desktop",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
signals[SLOT_ADDED] =
g_signal_new ("slot-added",
G_TYPE_FROM_CLASS (class),
@@ -2998,8 +2920,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
gtk_widget_class_bind_template_callback (wclass, on_notification_operation_open_clicked);
gtk_widget_class_bind_template_callback (wclass, on_notification_operation_close_clicked);
-
- g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
NautilusWindow *
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 789b89d2b..098d0914a 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -18,29 +18,6 @@
color: mix (@theme_selected_fg_color, @theme_selected_bg_color, 0.20);
}
-.nautilus-desktop.nautilus-canvas-item {
- color: @theme_selected_fg_color;
- text-shadow: 1px 1px black;
-}
-
-.nautilus-desktop.nautilus-canvas-item:active {
- color: @theme_text_color;
-}
-
-.nautilus-desktop.nautilus-canvas-item:selected {
- color: @theme_selected_fg_color;
-}
-
-.nautilus-desktop.nautilus-canvas-item:active,
-.nautilus-desktop.nautilus-canvas-item:hover,
-.nautilus-desktop.nautilus-canvas-item:selected {
- text-shadow: none;
-}
-
-.nautilus-desktop.nautilus-canvas-item:selected:backdrop {
- color: @theme_unfocused_selected_fg_color;
-}
-
/* Toolbar */
/* Here we use the .button background-image colors from Adwaita, but ligthen them,
diff --git a/src/resources/css/nautilus.css b/src/resources/css/nautilus.css
index 4f875e1e2..a85df669a 100644
--- a/src/resources/css/nautilus.css
+++ b/src/resources/css/nautilus.css
@@ -3,13 +3,6 @@
-gtk-outline-radius: 20px;
}
-.nautilus-desktop-window,
-.nautilus-desktop-window paned,
-.nautilus-desktop-window notebook,
-.nautilus-desktop-window notebook > stack {
- background: transparent;
-}
-
.nautilus-menu-sort-heading {
min-height: 26px;
padding-left: 5px;
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui b/src/resources/ui/nautilus-files-view-context-menus.ui
index ba392663c..0b0a365cd 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -38,25 +38,6 @@
</item>
</section>
<section>
- <item>
- <attribute name="label" translatable="yes">_Keep aligned</attribute>
- <attribute name="action">view.keep-aligned</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Organize _Desktop by Name</attribute>
- <attribute name="action">view.organize-desktop-by-name</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">Change _Background</attribute>
- <attribute name="action">view.change-background</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- </section>
- <section>
<attribute name="id">extensions</attribute>
</section>
</menu>
@@ -191,11 +172,6 @@
<attribute name="hidden-when">action-disabled</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">Empty Trash</attribute>
- <attribute name="action">view.empty-trash</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- <item>
<attribute name="label" translatable="yes">_Restore From Trash</attribute>
<attribute name="action">view.restore-from-trash</attribute>
<attribute name="hidden-when">action-disabled</attribute>
@@ -203,18 +179,6 @@
</section>
<section>
<item>
- <attribute name="label" translatable="yes">Resize Icon…</attribute>
- <attribute name="action">view.stretch</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Restore Icon’s Original Size</attribute>
- <attribute name="action">view.unstretch</attribute>
- <attribute name="hidden-when">action-disabled</attribute>
- </item>
- </section>
- <section>
- <item>
<attribute name="label" translatable="yes">Rena_me…</attribute>
<attribute name="action">view.rename</attribute>
</item>
diff --git a/test/test-copy.c b/test/test-copy.c
index c927e47b1..45cb8d168 100644
--- a/test/test-copy.c
+++ b/test/test-copy.c
@@ -75,7 +75,6 @@ main (int argc,
manager = nautilus_progress_info_manager_dup_singleton ();
nautilus_file_operations_copy (sources,
- NULL /* GArray *relative_item_points */,
dest,
GTK_WINDOW (window),
copy_done, NULL);