Commit 74dd9c9f authored by Ernestas Kulik's avatar Ernestas Kulik 🦑

general: remove desktop support

parent 816b8247
......@@ -84,7 +84,6 @@
"builddir": true,
"name": "nautilus",
"config-opts": [
"-Denable-desktop=false",
"-Denable-selinux=false",
"--libdir=/app/lib"
],
......
......@@ -3,7 +3,6 @@
#mesondefine GETTEXT_PACKAGE
#mesondefine HAVE_EXEMPI
#mesondefine HAVE_SELINUX
#mesondefine ENABLE_DESKTOP
#mesondefine ENABLE_PACKAGEKIT
#mesondefine LOCALEDIR
#mesondefine NAUTILUS_DATADIR
......
/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
......
......@@ -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)
......
[Desktop Entry]
Type=Application
Name=Files
Exec=nautilus-desktop
OnlyShowIn=GNOME;Unity;
AutostartCondition=GSettings org.gnome.desktop.background show-desktop-icons
NoDisplay=true
[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
......@@ -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>
......
......@@ -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
......
......@@ -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:
......@@ -50,11 +50,6 @@ Always open a new window for browsing specified URIs.
.BR \-n ", " \-\-no-default-window
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.
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
......
#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;
}
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)
/* 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);
}
/* 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 */
/* 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;