[nautilus/wip/antoniof/gnome-42: 13/72] Revert "general: Switch to GTK4"
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gnome-42: 13/72] Revert "general: Switch to GTK4"
- Date: Fri, 11 Feb 2022 19:27:59 +0000 (UTC)
commit 6973e014a546bf131dfbef88b26c2cd6e0fd2fc9
Author: Ondrej Holy <oholy redhat com>
Date: Fri Feb 11 14:23:49 2022 +0100
Revert "general: Switch to GTK4"
This reverts commit e358c2343c47aa26d568254a12f06a8431b2da42.
build-aux/flatpak/org.gnome.Nautilus.json | 2 +-
build-aux/flatpak/org.gnome.Nautilus.yml | 2 +-
eel/check-program.c | 3 +-
eel/eel-stock-dialogs.c | 12 +-
.../bacon-video-widget-properties.c | 2 +-
.../audio-video-properties/test-properties-page.c | 4 +-
.../nautilus-image-properties-page.c | 6 +-
libnautilus-extension/meson.build | 6 +-
meson.build | 10 +-
src/gtk/gtk-code-generator.sh | 43 +-
src/gtk/nautilusgtkbookmarksmanager.c | 125 +-
...agerprivate.h => nautilusgtkbookmarksmanager.h} | 15 +-
src/gtk/nautilusgtkplacessidebar.c | 2629 ++++++++++++--------
src/gtk/nautilusgtkplacessidebar.h | 159 ++
src/gtk/nautilusgtkplacessidebarprivate.h | 138 +-
src/gtk/nautilusgtkplacesview.c | 1510 ++++++-----
src/gtk/nautilusgtkplacesview.ui | 342 ++-
src/gtk/nautilusgtkplacesviewprivate.h | 35 +-
src/gtk/nautilusgtkplacesviewrow.c | 47 +-
src/gtk/nautilusgtkplacesviewrow.ui | 137 +-
src/gtk/nautilusgtkplacesviewrowprivate.h | 2 +
src/gtk/nautilusgtksidebarrow.c | 102 +-
src/gtk/nautilusgtksidebarrow.ui | 122 +-
src/gtk/nautilusgtksidebarrowprivate.h | 3 +-
src/meson.build | 10 +-
src/nautilus-application.c | 18 +-
src/nautilus-autorun-software.c | 12 +-
src/nautilus-batch-rename-dialog.c | 52 +-
src/nautilus-compress-dialog-controller.c | 40 +-
src/nautilus-dnd.c | 3 +-
src/nautilus-file-conflict-dialog.c | 26 +-
src/nautilus-file-conflict-dialog.h | 4 +-
src/nautilus-file-name-widget-controller.c | 2 +-
src/nautilus-file-operations.c | 32 +-
src/nautilus-file.c | 25 +-
src/nautilus-file.h | 6 +-
src/nautilus-files-view.c | 179 +-
src/nautilus-floating-bar.c | 26 +-
src/nautilus-gtk4-helpers.c | 218 ++
src/nautilus-gtk4-helpers.h | 66 +
src/nautilus-icon-info.c | 142 +-
src/nautilus-icon-info.h | 5 +-
src/nautilus-list-model.c | 12 +-
src/nautilus-list-view-dnd.c | 2 +-
src/nautilus-list-view-dnd.h | 2 +-
src/nautilus-list-view-private.h | 6 +
src/nautilus-list-view.c | 126 +-
src/nautilus-location-entry.c | 49 +-
src/nautilus-mime-actions.c | 18 +-
src/nautilus-new-folder-dialog-controller.c | 6 +-
src/nautilus-notebook.c | 15 +-
src/nautilus-operations-ui-manager.c | 36 +-
src/nautilus-pathbar.c | 66 +-
src/nautilus-places-view.c | 21 +-
src/nautilus-preferences-window.c | 34 +-
src/nautilus-progress-info-widget.c | 8 +-
src/nautilus-properties-window.c | 156 +-
src/nautilus-properties-window.h | 4 +-
src/nautilus-query-editor.c | 31 +-
src/nautilus-rename-file-popover-controller.c | 31 +-
src/nautilus-search-engine-recent.c | 16 +-
src/nautilus-search-popover.c | 62 +-
src/nautilus-shell-search-provider.c | 20 +-
src/nautilus-special-location-bar.c | 5 +-
src/nautilus-special-location-bar.h | 3 +-
src/nautilus-toolbar.c | 93 +-
src/nautilus-toolbar.h | 4 +-
src/nautilus-trash-bar.c | 15 +-
src/nautilus-trash-bar.h | 3 +-
src/nautilus-ui-utilities.c | 2 +-
src/nautilus-view-icon-controller.c | 86 +-
src/nautilus-view-icon-item-ui.c | 6 +-
src/nautilus-window-slot-dnd.c | 12 +-
src/nautilus-window-slot.c | 20 +-
src/nautilus-window.c | 202 +-
src/nautilus-window.h | 4 +-
src/nautilus-x-content-bar.c | 9 +-
src/nautilus-x-content-bar.h | 3 +-
src/resources/ui/nautilus-batch-rename-dialog.ui | 396 +--
src/resources/ui/nautilus-column-chooser.ui | 27 +-
src/resources/ui/nautilus-compress-dialog.ui | 46 +-
src/resources/ui/nautilus-create-folder-dialog.ui | 24 +-
src/resources/ui/nautilus-file-conflict-dialog.ui | 38 +-
.../nautilus-file-properties-change-permissions.ui | 107 +-
.../ui/nautilus-files-view-context-menus.ui | 14 +-
.../ui/nautilus-files-view-select-items.ui | 14 +-
src/resources/ui/nautilus-folder-is-empty.ui | 21 +-
.../ui/nautilus-list-view-column-editor.ui | 14 +-
src/resources/ui/nautilus-no-search-results.ui | 34 +-
...lus-operations-ui-manager-request-passphrase.ui | 10 +-
src/resources/ui/nautilus-pathbar-context-menu.ui | 2 +-
src/resources/ui/nautilus-preferences-window.ui | 41 +-
src/resources/ui/nautilus-progress-info-widget.ui | 48 +-
src/resources/ui/nautilus-properties-window.ui | 1981 ++++++++-------
src/resources/ui/nautilus-rename-file-popover.ui | 23 +-
src/resources/ui/nautilus-search-popover.ui | 401 +--
src/resources/ui/nautilus-starred-is-empty.ui | 21 +-
src/resources/ui/nautilus-toolbar-view-menu.ui | 2 +-
src/resources/ui/nautilus-toolbar.ui | 120 +-
src/resources/ui/nautilus-trash-is-empty.ui | 21 +-
src/resources/ui/nautilus-view-icon-item-ui.ui | 10 +-
src/resources/ui/nautilus-window.ui | 67 +-
.../display/test-nautilus-mime-actions-set.c | 2 +-
.../automated/display/test-nautilus-mime-actions.c | 2 +-
test/interactive/test.c | 2 +-
105 files changed, 6353 insertions(+), 4645 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Nautilus.json b/build-aux/flatpak/org.gnome.Nautilus.json
index f952cfeed..fb6213074 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.json
+++ b/build-aux/flatpak/org.gnome.Nautilus.json
@@ -118,7 +118,7 @@
"builddir": true,
"config-opts": [
"-Ddocs=false",
- "-Dbackends=gtk4",
+ "-Dbackends=gtk3",
"--libdir=/app/lib",
"--buildtype=debugoptimized"
],
diff --git a/build-aux/flatpak/org.gnome.Nautilus.yml b/build-aux/flatpak/org.gnome.Nautilus.yml
index af617396f..555f95905 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.yml
+++ b/build-aux/flatpak/org.gnome.Nautilus.yml
@@ -86,7 +86,7 @@ modules:
builddir: true
config-opts:
- "-Ddocs=false"
- - "-Dbackends=gtk4"
+ - "-Dbackends=gtk3"
- "--libdir=/app/lib"
- "--buildtype=debugoptimized"
sources:
diff --git a/eel/check-program.c b/eel/check-program.c
index 04cbc7de6..1e0f0a382 100644
--- a/eel/check-program.c
+++ b/eel/check-program.c
@@ -40,7 +40,8 @@ main (int argc,
LIBXML_TEST_VERSION
- gtk_init ();
+ gtk_init (&argc,
+ &argv);
/* Run the checks for eel twice. */
diff --git a/eel/eel-stock-dialogs.c b/eel/eel-stock-dialogs.c
index 9844da086..9e10eb28a 100644
--- a/eel/eel-stock-dialogs.c
+++ b/eel/eel-stock-dialogs.c
@@ -101,7 +101,7 @@ timed_wait_delayed_close_timeout_callback (gpointer callback_data)
G_CALLBACK (timed_wait_delayed_close_destroy_dialog_callback),
GUINT_TO_POINTER (handler_id));
- gtk_window_destroy (GTK_WINDOW (callback_data));
+ gtk_widget_destroy (GTK_WIDGET (callback_data));
return FALSE;
}
@@ -151,7 +151,7 @@ timed_wait_free (TimedWait *wait)
}
else
{
- gtk_window_destroy (GTK_WINDOW (wait->dialog));
+ gtk_widget_destroy (GTK_WIDGET (wait->dialog));
}
}
@@ -187,7 +187,7 @@ trash_dialog_response_callback (GtkDialog *dialog,
int response_id,
TimedWait *wait)
{
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static gboolean
@@ -334,7 +334,7 @@ eel_show_simple_dialog (GtkWidget *parent,
chosen_parent = NULL;
if (parent != NULL)
{
- top_widget = GTK_WIDGET (gtk_widget_get_root (parent));
+ top_widget = gtk_widget_get_toplevel (parent);
if (GTK_IS_WINDOW (top_widget))
{
chosen_parent = top_widget;
@@ -368,7 +368,7 @@ eel_show_simple_dialog (GtkWidget *parent,
}
va_end (button_title_args);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
return GTK_DIALOG (dialog);
}
@@ -414,7 +414,7 @@ show_message_dialog (const char *primary_text,
gtk_widget_show (GTK_WIDGET (dialog));
g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_window_destroy), NULL);
+ G_CALLBACK (gtk_widget_destroy), NULL);
return dialog;
}
diff --git a/extensions/audio-video-properties/bacon-video-widget-properties.c
b/extensions/audio-video-properties/bacon-video-widget-properties.c
index fca9dfd7d..b2b2aaf37 100644
--- a/extensions/audio-video-properties/bacon-video-widget-properties.c
+++ b/extensions/audio-video-properties/bacon-video-widget-properties.c
@@ -276,7 +276,7 @@ bacon_video_widget_properties_new (void)
g_object_unref (group);
- gtk_widget_show (GTK_WIDGET (props));
+ gtk_widget_show_all (GTK_WIDGET (props));
return GTK_WIDGET (props);
}
diff --git a/extensions/audio-video-properties/test-properties-page.c
b/extensions/audio-video-properties/test-properties-page.c
index f52881625..21be43a34 100644
--- a/extensions/audio-video-properties/test-properties-page.c
+++ b/extensions/audio-video-properties/test-properties-page.c
@@ -38,7 +38,7 @@ create_props (const char *url)
props = totem_properties_view_new (url, label);
gtk_container_add (GTK_CONTAINER (window), props);
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
}
static void
@@ -58,7 +58,7 @@ int main (int argc, char **argv)
totem_gst_disable_display_decoders ();
gst_init (&argc, &argv);
- gtk_init ();
+ gtk_init (&argc, &argv);
if (argc != 2) {
g_print ("Usage: %s [URI]\n", argv[0]);
diff --git a/extensions/image-properties/nautilus-image-properties-page.c
b/extensions/image-properties/nautilus-image-properties-page.c
index ea415aa69..a8dd7a6d2 100644
--- a/extensions/image-properties/nautilus-image-properties-page.c
+++ b/extensions/image-properties/nautilus-image-properties-page.c
@@ -80,7 +80,7 @@ append_item (NautilusImagesPropertiesPage *page,
value_label = gtk_label_new (value);
- gtk_label_set_wrap (GTK_LABEL (value_label), TRUE);
+ gtk_label_set_line_wrap (GTK_LABEL (value_label), TRUE);
gtk_grid_attach_next_to (GTK_GRID (page->grid), value_label,
name_label, GTK_POS_RIGHT,
1, 1);
@@ -93,7 +93,7 @@ append_item (NautilusImagesPropertiesPage *page,
static void
nautilus_image_properties_page_init (NautilusImagesPropertiesPage *self)
{
- self->page_widget = gtk_scrolled_window_new ();
+ self->page_widget = gtk_scrolled_window_new (NULL, NULL);
g_object_set (self->page_widget,
"margin-bottom", 6,
@@ -119,7 +119,7 @@ nautilus_image_properties_page_init (NautilusImagesPropertiesPage *self)
self->grid);
#endif
- gtk_widget_show (GTK_WIDGET (self->page_widget));
+ gtk_widget_show_all (GTK_WIDGET (self->page_widget));
}
static void
diff --git a/libnautilus-extension/meson.build b/libnautilus-extension/meson.build
index 6ceb53a14..ad791f60e 100644
--- a/libnautilus-extension/meson.build
+++ b/libnautilus-extension/meson.build
@@ -83,10 +83,10 @@ if get_option('introspection')
'-DNAUTILUS_COMPILATION'
],
sources: libnautilus_extension_sources,
- nsversion: '4.0',
+ nsversion: '3.0',
namespace: 'Nautilus',
includes: [
- 'Gtk-4.0',
+ 'Gtk-3.0',
'Gio-2.0',
'GLib-2.0'
],
@@ -115,7 +115,7 @@ pkgconfig.generate(
requires: [
'gio-2.0',
'glib-2.0',
- 'gtk4'
+ 'gtk+-3.0'
],
variables: [
'exec_prefix=${prefix}',
diff --git a/meson.build b/meson.build
index c89bd96aa..e8a6ed8d9 100644
--- a/meson.build
+++ b/meson.build
@@ -107,14 +107,14 @@ gio_unix = dependency('gio-unix-2.0', version: glib_ver)
glib = dependency('glib-2.0', version: glib_ver)
gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.4.0')
-gnome_desktop = dependency('gnome-desktop-4', version: '>= 1.0.0')
-gtk = dependency('gtk4', version: '>= 4.6')
-libadwaita = dependency('libadwaita-1', version: '>= 1.0')
+gnome_desktop = dependency('gnome-desktop-3.0', version: '>= 3.0.0')
+gtk = dependency('gtk+-3.0', version: '>= 3.22.27')
+libhandy = dependency('libhandy-1', version: '>= 1.1.90')
libportal = []
-libportal_gtk4 = []
+libportal_gtk3 = []
if get_option('libportal')
libportal = dependency('libportal', version: '>= 0.5')
- libportal_gtk4 = dependency('libportal-gtk4', version: '>= 0.5')
+ libportal_gtk3 = dependency('libportal-gtk3', version: '>= 0.5')
endif
selinux = []
if get_option('selinux')
diff --git a/src/gtk/gtk-code-generator.sh b/src/gtk/gtk-code-generator.sh
index 4effdc33d..e6f2ac0d0 100755
--- a/src/gtk/gtk-code-generator.sh
+++ b/src/gtk/gtk-code-generator.sh
@@ -5,9 +5,9 @@
# action.
# Also remove/add the neccesary bits to make it work inside nautilus
-URL=https://gitlab.gnome.org/GNOME/gtk/raw/master/gtk/
-URLUI=https://gitlab.gnome.org/GNOME/gtk/raw/master/gtk/ui/
-SUFIX=?h=master
+URL=https://gitlab.gnome.org/GNOME/gtk/raw/gtk-3-24/gtk/
+URLUI=https://gitlab.gnome.org/GNOME/gtk/raw/gtk-3-24/gtk/ui/
+SUFIX=?h=gtk-3-24
# Since comments are not allowed inside the sed line, this is what it will do
# by order:
@@ -24,22 +24,27 @@ SUFIX=?h=master
# use local sidebar header instead of private gtk one
# in-line replace private gtkfilesystem.h helper function
# ignore shadowed variable which we would treat as compile error
-# use local header instead of private gtk one
-# replace private macros with their expansion
-# replace private enum type with our own equivalent
update_file () {
_source="$1"
_dest="$2"
curl "${_source}" | sed \
- -e 's/gtkplaces/nautilusgtkplaces/g' \
- -e 's/gtk_places_/nautilus_gtk_places_/g' \
- -e 's/GtkPlaces/NautilusGtkPlaces/g' \
- -e 's/GTK_PLACES_/NAUTILUS_GTK_PLACES_/g' \
- -e 's/GTK_TYPE_PLACES_/NAUTILUS_TYPE_GTK_PLACES_/g' \
- -e 's/GTK_IS_PLACES_/NAUTILUS_IS_GTK_PLACES_/g' \
+ -e 's/gtkplacesview/nautilusgtkplacesview/g' \
+ -e 's/gtk_places_view/nautilus_gtk_places_view/g' \
+ -e 's/GtkPlacesView/NautilusGtkPlacesView/g' \
+ -e 's/GTK_PLACES_VIEW/NAUTILUS_GTK_PLACES_VIEW/g' \
+ -e 's/GTK_TYPE_PLACES_VIEW/NAUTILUS_TYPE_GTK_PLACES_VIEW/g' \
+ -e 's/GTK_IS_PLACES_VIEW/NAUTILUS_IS_GTK_PLACES_VIEW/g' \
-e 's/G_DECLARE_FINAL_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, GTK,
PLACES_VIEW_ROW, GtkListBoxRow/ G_DECLARE_FINAL_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row,
NAUTILUS, GTK_PLACES_VIEW_ROW, GtkListBoxRow/g' \
+ -e 's/gtkplacessidebar/nautilusgtkplacessidebar/g' \
+ -e 's/gtk_places_sidebar/nautilus_gtk_places_sidebar/g' \
+ -e 's/GtkPlacesSidebar/NautilusGtkPlacesSidebar/g' \
+ -e 's/GTK_PLACES_SIDEBAR/NAUTILUS_GTK_PLACES_SIDEBAR/g' \
+ -e 's/GTK_TYPE_PLACES_SIDEBAR/NAUTILUS_TYPE_GTK_PLACES_SIDEBAR/g' \
+ -e 's/GTK_IS_PLACES_SIDEBAR/NAUTILUS_IS_GTK_PLACES_SIDEBAR/g' \
+ -e 's/GtkPlacesOpen/NautilusGtkPlacesOpen/g' \
+ -e 's/GTK_PLACES_OPEN/NAUTILUS_GTK_PLACES_OPEN/g' \
-e 's/gtkbookmarksmanager/nautilusgtkbookmarksmanager/g' \
-e 's/gtk_bookmarks_manager/nautilus_gtk_bookmarks_manager/g' \
-e 's/GtkBookmarksManager/NautilusGtkBookmarksManager/g' \
@@ -70,8 +75,6 @@ update_file () {
-e "s/P_(\(.*\))/\1/" \
-e "s/I_(\(.*\))/\1/" \
-e '/"config.h"/a #include <gtk\/gtk.h>' \
- -e 's/<gtk\/gtkwidget.h>/<gtk\/gtk.h>/g' \
- -e '/gtkenums.h/d' \
-e '/gtktypebuiltins.h/d' \
-e '/gtkintl.h/d' \
-e '/<gtk\/gtkbox.h>/d' \
@@ -85,9 +88,7 @@ update_file () {
-e '/"gtki\(.*\).h"/d' \
-e '/"gtkl\(.*\).h"/d' \
-e '/"gtkm\(.*\).h"/d' \
- -e '/"gtkn\(.*\).h"/d' \
-e '/"gtkpo\(.*\).h"/d' \
- -e '/"gtkpr\(.*\).h"/d' \
-e '/"gtkr\(.*\).h"/d' \
-e '/"gtksc\(.*\).h"/d' \
-e '/"gtkse\(.*\).h"/d' \
@@ -98,14 +99,9 @@ update_file () {
-e '/"gtkw\(.*\).h"/d' \
-e '/#error/d' \
-e 's/gtk\/libgtk/gnome\/nautilus\/gtk/g' \
- -e 's/<gtk\/nautilusgtkplacessidebarprivate.h>/"nautilusgtkplacessidebarprivate.h"'/g \
+ -e 's/<gtk\/nautilusgtkplacessidebar.h>/"nautilusgtkplacessidebar.h"'/g \
-e 's/_gtk_file_info_consider_as_directory (info)/(g_file_info_get_file_type (info) ==
G_FILE_TYPE_DIRECTORY || g_file_info_get_file_type (info) == G_FILE_TYPE_MOUNTABLE ||
g_file_info_get_file_type (info) == G_FILE_TYPE_SHORTCUT)/g' \
-e '/#include "nautilus-trash-monitor.h"/a #pragma GCC diagnostic ignored "-Wshadow"' \
- -e 's/gtk_drag_check_threshold_double/gtk_drag_check_threshold/g' \
- -e 's/NAUTILUS_TYPE_GTK_PLACES_OPEN_FLAGS/NAUTILUS_TYPE_OPEN_FLAGS/g' \
- -e '/"config.h"/a #include "nautilus-enum-types.h"' \
- -e
's/GTK_PARAM_READABLE/G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB/g' \
- -e
's/GTK_PARAM_READWRITE/G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB/g' \
> "${_dest}"
}
@@ -114,8 +110,9 @@ update_file "${URL}/gtkplacesviewprivate.h${SUFIX}" "nautilusgtkplacesviewprivat
update_file "${URLUI}/gtkplacesview.ui${SUFIX}" "nautilusgtkplacesview.ui"
update_file "${URL}/gtkplacessidebar.c${SUFIX}" "nautilusgtkplacessidebar.c"
update_file "${URL}/gtkplacessidebarprivate.h${SUFIX}" "nautilusgtkplacessidebarprivate.h"
+update_file "${URL}/gtkplacessidebar.h${SUFIX}" "nautilusgtkplacessidebar.h"
update_file "${URL}/gtkbookmarksmanager.c${SUFIX}" "nautilusgtkbookmarksmanager.c"
-update_file "${URL}/gtkbookmarksmanagerprivate.h${SUFIX}" "nautilusgtkbookmarksmanagerprivate.h"
+update_file "${URL}/gtkbookmarksmanager.h${SUFIX}" "nautilusgtkbookmarksmanager.h"
update_file "${URL}/gtkplacesviewrow.c${SUFIX}" "nautilusgtkplacesviewrow.c"
update_file "${URL}/gtkplacesviewrowprivate.h${SUFIX}" "nautilusgtkplacesviewrowprivate.h"
update_file "${URLUI}/gtkplacesviewrow.ui${SUFIX}" "nautilusgtkplacesviewrow.ui"
diff --git a/src/gtk/nautilusgtkbookmarksmanager.c b/src/gtk/nautilusgtkbookmarksmanager.c
index 3563fc2f1..385d58635 100644
--- a/src/gtk/nautilusgtkbookmarksmanager.c
+++ b/src/gtk/nautilusgtkbookmarksmanager.c
@@ -24,13 +24,12 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "nautilus-enum-types.h"
#include <string.h>
#include <glib/gi18n-lib.h>
-#include "nautilusgtkbookmarksmanagerprivate.h"
+#include "nautilusgtkbookmarksmanager.h"
static void
_gtk_bookmark_free (gpointer data)
@@ -45,7 +44,7 @@ _gtk_bookmark_free (gpointer data)
static void
set_error_bookmark_doesnt_exist (GFile *file, GError **error)
{
- char *uri = g_file_get_uri (file);
+ gchar *uri = g_file_get_uri (file);
g_set_error (error,
GTK_FILE_CHOOSER_ERROR,
@@ -60,7 +59,7 @@ static GFile *
get_legacy_bookmarks_file (void)
{
GFile *file;
- char *filename;
+ gchar *filename;
filename = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
file = g_file_new_for_path (filename);
@@ -73,12 +72,8 @@ static GFile *
get_bookmarks_file (void)
{
GFile *file;
- char *filename;
+ gchar *filename;
- /* Use gtk-3.0's bookmarks file as the format didn't change.
- * Add the 3.0 file format to get_legacy_bookmarks_file() when
- * the format does change.
- */
filename = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "bookmarks", NULL);
file = g_file_new_for_path (filename);
g_free (filename);
@@ -87,11 +82,16 @@ get_bookmarks_file (void)
}
static GSList *
-parse_bookmarks (const char *contents)
+read_bookmarks (GFile *file)
{
- char **lines, *space;
+ gchar *contents;
+ gchar **lines, *space;
GSList *bookmarks = NULL;
- int i;
+ gint i;
+
+ if (!g_file_load_contents (file, NULL, &contents,
+ NULL, NULL, NULL))
+ return NULL;
lines = g_strsplit (contents, "\n", -1);
@@ -119,60 +119,11 @@ parse_bookmarks (const char *contents)
bookmarks = g_slist_reverse (bookmarks);
g_strfreev (lines);
-
- return bookmarks;
-}
-
-static GSList *
-read_bookmarks (GFile *file)
-{
- char *contents;
- GSList *bookmarks = NULL;
-
- if (!g_file_load_contents (file, NULL, &contents,
- NULL, NULL, NULL))
- return NULL;
-
- bookmarks = parse_bookmarks (contents);
-
g_free (contents);
return bookmarks;
}
-static void
-notify_changed (NautilusGtkBookmarksManager *manager)
-{
- if (manager->changed_func)
- manager->changed_func (manager->changed_func_data);
-}
-
-static void
-read_bookmarks_finish (GObject *source,
- GAsyncResult *result,
- gpointer data)
-{
- GFile *file = G_FILE (source);
- NautilusGtkBookmarksManager *manager = data;
- char *contents = NULL;
- GError *error = NULL;
-
- if (!g_file_load_contents_finish (file, result, &contents, NULL, NULL, &error))
- {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Failed to load '%s': %s", g_file_peek_path (file), error->message);
- g_error_free (error);
- return;
- }
-
- g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
- manager->bookmarks = parse_bookmarks (contents);
-
- g_free (contents);
-
- notify_changed (manager);
-}
-
static void
save_bookmarks (GFile *bookmarks_file,
GSList *bookmarks)
@@ -187,7 +138,7 @@ save_bookmarks (GFile *bookmarks_file,
for (l = bookmarks; l; l = l->next)
{
GtkBookmark *bookmark = l->data;
- char *uri;
+ gchar *uri;
uri = g_file_get_uri (bookmark->file);
if (!uri)
@@ -227,6 +178,13 @@ save_bookmarks (GFile *bookmarks_file,
g_string_free (contents, TRUE);
}
+static void
+notify_changed (NautilusGtkBookmarksManager *manager)
+{
+ if (manager->changed_func)
+ manager->changed_func (manager->changed_func_data);
+}
+
static void
bookmarks_file_changed (GFileMonitor *monitor,
GFile *file,
@@ -241,17 +199,15 @@ bookmarks_file_changed (GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_CHANGED:
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
- g_file_load_contents_async (file, manager->cancellable, read_bookmarks_finish, manager);
+ case G_FILE_MONITOR_EVENT_DELETED:
+ g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
+ manager->bookmarks = read_bookmarks (file);
+
+ gdk_threads_enter ();
+ notify_changed (manager);
+ gdk_threads_leave ();
break;
- case G_FILE_MONITOR_EVENT_DELETED:
- case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
- case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
- case G_FILE_MONITOR_EVENT_UNMOUNTED:
- case G_FILE_MONITOR_EVENT_MOVED:
- case G_FILE_MONITOR_EVENT_RENAMED:
- case G_FILE_MONITOR_EVENT_MOVED_IN:
- case G_FILE_MONITOR_EVENT_MOVED_OUT:
default:
/* ignore at the moment */
break;
@@ -270,10 +226,9 @@ _nautilus_gtk_bookmarks_manager_new (GtkBookmarksChangedFunc changed_func, gpoin
manager->changed_func = changed_func;
manager->changed_func_data = changed_func_data;
- manager->cancellable = g_cancellable_new ();
-
bookmarks_file = get_bookmarks_file ();
- if (!g_file_query_exists (bookmarks_file, NULL))
+ manager->bookmarks = read_bookmarks (bookmarks_file);
+ if (!manager->bookmarks)
{
GFile *legacy_bookmarks_file;
@@ -285,8 +240,6 @@ _nautilus_gtk_bookmarks_manager_new (GtkBookmarksChangedFunc changed_func, gpoin
g_object_unref (legacy_bookmarks_file);
}
- else
- g_file_load_contents_async (bookmarks_file, manager->cancellable, read_bookmarks_finish, manager);
error = NULL;
manager->bookmarks_monitor = g_file_monitor_file (bookmarks_file,
@@ -301,7 +254,6 @@ _nautilus_gtk_bookmarks_manager_new (GtkBookmarksChangedFunc changed_func, gpoin
manager->bookmarks_monitor_changed_id = g_signal_connect (manager->bookmarks_monitor, "changed",
G_CALLBACK (bookmarks_file_changed), manager);
-
g_object_unref (bookmarks_file);
return manager;
@@ -312,9 +264,6 @@ _nautilus_gtk_bookmarks_manager_free (NautilusGtkBookmarksManager *manager)
{
g_return_if_fail (manager != NULL);
- g_cancellable_cancel (manager->cancellable);
- g_object_unref (manager->cancellable);
-
if (manager->bookmarks_monitor)
{
g_file_monitor_cancel (manager->bookmarks_monitor);
@@ -390,7 +339,7 @@ _nautilus_gtk_bookmarks_manager_has_bookmark (NautilusGtkBookmarksManager *manag
gboolean
_nautilus_gtk_bookmarks_manager_insert_bookmark (NautilusGtkBookmarksManager *manager,
GFile *file,
- int position,
+ gint position,
GError **error)
{
GSList *link;
@@ -404,7 +353,7 @@ _nautilus_gtk_bookmarks_manager_insert_bookmark (NautilusGtkBookmarksManager *ma
if (link)
{
- char *uri;
+ gchar *uri;
bookmark = link->data;
uri = g_file_get_uri (bookmark->file);
@@ -474,7 +423,7 @@ _nautilus_gtk_bookmarks_manager_remove_bookmark (NautilusGtkBookmarksManager *ma
gboolean
_nautilus_gtk_bookmarks_manager_reorder_bookmark (NautilusGtkBookmarksManager *manager,
GFile *file,
- int new_position,
+ gint new_position,
GError **error)
{
GSList *link;
@@ -519,12 +468,12 @@ _nautilus_gtk_bookmarks_manager_reorder_bookmark (NautilusGtkBookmarksManager *m
return TRUE;
}
-char *
+gchar *
_nautilus_gtk_bookmarks_manager_get_bookmark_label (NautilusGtkBookmarksManager *manager,
GFile *file)
{
GSList *bookmarks;
- char *label = NULL;
+ gchar *label = NULL;
g_return_val_if_fail (manager != NULL, NULL);
g_return_val_if_fail (file != NULL, NULL);
@@ -551,7 +500,7 @@ _nautilus_gtk_bookmarks_manager_get_bookmark_label (NautilusGtkBookmarksManager
gboolean
_nautilus_gtk_bookmarks_manager_set_bookmark_label (NautilusGtkBookmarksManager *manager,
GFile *file,
- const char *label,
+ const gchar *label,
GError **error)
{
GFile *bookmarks_file;
@@ -583,7 +532,7 @@ _nautilus_gtk_bookmarks_manager_set_bookmark_label (NautilusGtkBookmarksManager
return TRUE;
}
-static gboolean
+gboolean
_nautilus_gtk_bookmarks_manager_get_xdg_type (NautilusGtkBookmarksManager *manager,
GFile *file,
GUserDirectory *directory)
@@ -591,7 +540,7 @@ _nautilus_gtk_bookmarks_manager_get_xdg_type (NautilusGtkBookmarksManager *manag
GSList *link;
gboolean match;
GFile *location;
- const char *path;
+ const gchar *path;
GUserDirectory dir;
GtkBookmark *bookmark;
diff --git a/src/gtk/nautilusgtkbookmarksmanagerprivate.h b/src/gtk/nautilusgtkbookmarksmanager.h
similarity index 86%
rename from src/gtk/nautilusgtkbookmarksmanagerprivate.h
rename to src/gtk/nautilusgtkbookmarksmanager.h
index 99890a331..229c61370 100644
--- a/src/gtk/nautilusgtkbookmarksmanagerprivate.h
+++ b/src/gtk/nautilusgtkbookmarksmanager.h
@@ -38,14 +38,12 @@ typedef struct
gpointer changed_func_data;
GtkBookmarksChangedFunc changed_func;
-
- GCancellable *cancellable;
} NautilusGtkBookmarksManager;
typedef struct
{
GFile *file;
- char *label;
+ gchar *label;
} GtkBookmark;
NautilusGtkBookmarksManager *_nautilus_gtk_bookmarks_manager_new (GtkBookmarksChangedFunc changed_func,
@@ -58,7 +56,7 @@ GSList *_nautilus_gtk_bookmarks_manager_list_bookmarks (NautilusGtkBookmarksMana
gboolean _nautilus_gtk_bookmarks_manager_insert_bookmark (NautilusGtkBookmarksManager *manager,
GFile *file,
- int position,
+ gint position,
GError **error);
gboolean _nautilus_gtk_bookmarks_manager_remove_bookmark (NautilusGtkBookmarksManager *manager,
@@ -67,20 +65,23 @@ gboolean _nautilus_gtk_bookmarks_manager_remove_bookmark (NautilusGtkBookmarksMa
gboolean _nautilus_gtk_bookmarks_manager_reorder_bookmark (NautilusGtkBookmarksManager *manager,
GFile *file,
- int new_position,
+ gint new_position,
GError **error);
gboolean _nautilus_gtk_bookmarks_manager_has_bookmark (NautilusGtkBookmarksManager *manager,
GFile *file);
-char * _nautilus_gtk_bookmarks_manager_get_bookmark_label (NautilusGtkBookmarksManager *manager,
+gchar * _nautilus_gtk_bookmarks_manager_get_bookmark_label (NautilusGtkBookmarksManager *manager,
GFile *file);
gboolean _nautilus_gtk_bookmarks_manager_set_bookmark_label (NautilusGtkBookmarksManager *manager,
GFile *file,
- const char *label,
+ const gchar *label,
GError **error);
+gboolean _nautilus_gtk_bookmarks_manager_get_xdg_type (NautilusGtkBookmarksManager *manager,
+ GFile *file,
+ GUserDirectory *directory);
gboolean _nautilus_gtk_bookmarks_manager_get_is_builtin (NautilusGtkBookmarksManager *manager,
GFile *file);
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c
index 254bfe93e..71c320d7d 100644
--- a/src/gtk/nautilusgtkplacessidebar.c
+++ b/src/gtk/nautilusgtkplacessidebar.c
@@ -24,26 +24,31 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "nautilus-enum-types.h"
#include <gio/gio.h>
#ifdef HAVE_CLOUDPROVIDERS
-#include <cloudproviders.h>
+#include <cloudproviders/cloudproviderscollector.h>
+#include <cloudproviders/cloudprovidersaccount.h>
+#include <cloudproviders/cloudprovidersprovider.h>
#endif
#include "nautilusgtkplacessidebarprivate.h"
#include "nautilusgtksidebarrowprivate.h"
#include "gdk/gdkkeysyms.h"
-#include "nautilusgtkbookmarksmanagerprivate.h"
+#include "nautilusgtkbookmarksmanager.h"
+#include "nautilusgtkplacessidebar.h"
#include "nautilus-trash-monitor.h"
#pragma GCC diagnostic ignored "-Wshadow"
-/*< private >
- * NautilusGtkPlacesSidebar:
+/**
+ * SECTION:nautilusgtkplacessidebar
+ * @Short_description: Sidebar that displays frequently-used places in the file system
+ * @Title: NautilusGtkPlacesSidebar
+ * @See_also: #GtkFileChooser
*
- * NautilusGtkPlacesSidebar is a widget that displays a list of frequently-used places in the
+ * #NautilusGtkPlacesSidebar is a widget that displays a list of frequently-used places in the
* file system: the user’s home directory, the user’s bookmarks, and volumes and drives.
- * This widget is used as a sidebar in GtkFileChooser and may be used by file managers
+ * This widget is used as a sidebar in #GtkFileChooser and may be used by file managers
* and similar programs.
*
* The places sidebar displays drives and volumes, and will automatically mount
@@ -59,7 +64,7 @@
* for a Clipart folder. You can do this with nautilus_gtk_places_sidebar_add_shortcut().
*
* To make use of the places sidebar, an application at least needs to connect
- * to the NautilusGtkPlacesSidebar::open-location signal. This is emitted when the
+ * to the #NautilusGtkPlacesSidebar::open-location signal. This is emitted when the
* user selects in the sidebar a location to open. The application should also
* call nautilus_gtk_places_sidebar_set_location() when it changes the currently-viewed
* location.
@@ -90,16 +95,13 @@ typedef enum {
} DropState;
struct _NautilusGtkPlacesSidebar {
- GtkWidget parent;
+ GtkScrolledWindow parent;
- GtkWidget *swin;
GtkWidget *list_box;
GtkWidget *new_bookmark_row;
NautilusGtkBookmarksManager *bookmarks_manager;
- GActionGroup *row_actions;
-
#ifdef HAVE_CLOUDPROVIDERS
CloudProvidersCollector *cloud_manager;
GList *unready_accounts;
@@ -114,19 +116,25 @@ struct _NautilusGtkPlacesSidebar {
GtkWidget *rename_entry;
GtkWidget *rename_button;
GtkWidget *rename_error;
- char *rename_uri;
+ gchar *rename_uri;
gulong trash_monitor_changed_id;
GtkWidget *trash_row;
/* DND */
+ GList *drag_list; /* list of GFile */
+ gint drag_data_info;
gboolean dragging_over;
+ GtkTargetList *source_targets;
GtkWidget *drag_row;
- int drag_row_height;
- int drag_row_x;
- int drag_row_y;
+ gint drag_row_height;
+ gint drag_row_x;
+ gint drag_row_y;
+ gint drag_root_x;
+ gint drag_root_y;
GtkWidget *row_placeholder;
DropState drop_state;
+ GtkGesture *long_press_gesture;
/* volume mounting - delayed open process */
NautilusGtkPlacesOpenFlags go_to_after_mount_open_flags;
@@ -134,37 +142,50 @@ struct _NautilusGtkPlacesSidebar {
GtkWidget *popover;
NautilusGtkSidebarRow *context_row;
- GListStore *shortcuts;
+ GSList *shortcuts;
GDBusProxy *hostnamed_proxy;
GCancellable *hostnamed_cancellable;
- char *hostname;
+ gchar *hostname;
NautilusGtkPlacesOpenFlags open_flags;
+ GActionGroup *action_group;
+
guint mounting : 1;
+ guint drag_data_received : 1;
+ guint drop_occurred : 1;
guint show_recent_set : 1;
guint show_recent : 1;
guint show_desktop_set : 1;
guint show_desktop : 1;
+ guint show_connect_to_server : 1;
guint show_enter_location : 1;
guint show_other_locations : 1;
guint show_trash : 1;
guint show_starred_location : 1;
+ guint local_only : 1;
+ guint populate_all : 1;
};
struct _NautilusGtkPlacesSidebarClass {
- GtkWidgetClass parent_class;
+ GtkScrolledWindowClass parent;
void (* open_location) (NautilusGtkPlacesSidebar *sidebar,
GFile *location,
NautilusGtkPlacesOpenFlags open_flags);
+ void (* populate_popup) (NautilusGtkPlacesSidebar *sidebar,
+ GtkMenu *menu,
+ GFile *selected_item,
+ GVolume *selected_volume);
void (* show_error_message) (NautilusGtkPlacesSidebar *sidebar,
- const char *primary,
- const char *secondary);
+ const gchar *primary,
+ const gchar *secondary);
+ void (* show_connect_to_server) (NautilusGtkPlacesSidebar *sidebar);
GdkDragAction (* drag_action_requested) (NautilusGtkPlacesSidebar *sidebar,
+ GdkDragContext *context,
GFile *dest_file,
- GSList *source_file_list);
+ GList *source_file_list);
GdkDragAction (* drag_action_ask) (NautilusGtkPlacesSidebar *sidebar,
GdkDragAction actions);
void (* drag_perform_drop) (NautilusGtkPlacesSidebar *sidebar,
@@ -173,6 +194,8 @@ struct _NautilusGtkPlacesSidebarClass {
GdkDragAction action);
void (* show_enter_location) (NautilusGtkPlacesSidebar *sidebar);
+ void (* show_other_locations) (NautilusGtkPlacesSidebar *sidebar);
+
void (* show_other_locations_with_flags) (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkPlacesOpenFlags open_flags);
@@ -186,11 +209,14 @@ struct _NautilusGtkPlacesSidebarClass {
enum {
OPEN_LOCATION,
+ POPULATE_POPUP,
SHOW_ERROR_MESSAGE,
+ SHOW_CONNECT_TO_SERVER,
SHOW_ENTER_LOCATION,
DRAG_ACTION_REQUESTED,
DRAG_ACTION_ASK,
DRAG_PERFORM_DROP,
+ SHOW_OTHER_LOCATIONS,
SHOW_OTHER_LOCATIONS_WITH_FLAGS,
SHOW_STARRED_LOCATION,
MOUNT,
@@ -203,10 +229,13 @@ enum {
PROP_OPEN_FLAGS,
PROP_SHOW_RECENT,
PROP_SHOW_DESKTOP,
+ PROP_SHOW_CONNECT_TO_SERVER,
PROP_SHOW_ENTER_LOCATION,
PROP_SHOW_TRASH,
PROP_SHOW_STARRED_LOCATION,
+ PROP_LOCAL_ONLY,
PROP_SHOW_OTHER_LOCATIONS,
+ PROP_POPULATE_ALL,
NUM_PROPERTIES
};
@@ -241,32 +270,40 @@ static void check_unmount_and_eject (GMount *mount,
GDrive *drive,
gboolean *show_unmount,
gboolean *show_eject);
-static void on_row_pressed (GtkGestureClick *gesture,
- int n_press,
- double x,
- double y,
- NautilusGtkSidebarRow *row);
-static void on_row_released (GtkGestureClick *gesture,
- int n_press,
- double x,
- double y,
- NautilusGtkSidebarRow *row);
-static void on_row_dragged (GtkGestureDrag *gesture,
- double x,
- double y,
- NautilusGtkSidebarRow *row);
-
+static gboolean on_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ NautilusGtkSidebarRow *sidebar);
+static gboolean on_button_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ NautilusGtkSidebarRow *sidebar);
static void popup_menu_cb (NautilusGtkSidebarRow *row);
static void long_press_cb (GtkGesture *gesture,
- double x,
- double y,
+ gdouble x,
+ gdouble y,
NautilusGtkPlacesSidebar *sidebar);
static void stop_drop_feedback (NautilusGtkPlacesSidebar *sidebar);
static GMountOperation * get_mount_operation (NautilusGtkPlacesSidebar *sidebar);
static GMountOperation * get_unmount_operation (NautilusGtkPlacesSidebar *sidebar);
-G_DEFINE_TYPE (NautilusGtkPlacesSidebar, nautilus_gtk_places_sidebar, GTK_TYPE_WIDGET);
+/* Identifiers for target types */
+enum {
+ DND_UNKNOWN,
+ DND_NAUTILUS_GTK_SIDEBAR_ROW,
+ DND_TEXT_URI_LIST
+};
+
+/* Target types for dragging from the shortcuts list */
+static const GtkTargetEntry dnd_source_targets[] = {
+ { "DND_NAUTILUS_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_NAUTILUS_GTK_SIDEBAR_ROW }
+};
+
+/* Target types for dropping into the shortcuts list */
+static const GtkTargetEntry dnd_drop_targets [] = {
+ { "DND_NAUTILUS_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_NAUTILUS_GTK_SIDEBAR_ROW }
+};
+
+G_DEFINE_TYPE (NautilusGtkPlacesSidebar, nautilus_gtk_places_sidebar, GTK_TYPE_SCROLLED_WINDOW);
static void
emit_open_location (NautilusGtkPlacesSidebar *sidebar,
@@ -282,19 +319,31 @@ emit_open_location (NautilusGtkPlacesSidebar *sidebar,
static void
emit_show_error_message (NautilusGtkPlacesSidebar *sidebar,
- const char *primary,
- const char *secondary)
+ const gchar *primary,
+ const gchar *secondary)
{
g_signal_emit (sidebar, places_sidebar_signals[SHOW_ERROR_MESSAGE], 0,
primary, secondary);
}
+static void
+emit_show_connect_to_server (NautilusGtkPlacesSidebar *sidebar)
+{
+ g_signal_emit (sidebar, places_sidebar_signals[SHOW_CONNECT_TO_SERVER], 0);
+}
+
static void
emit_show_enter_location (NautilusGtkPlacesSidebar *sidebar)
{
g_signal_emit (sidebar, places_sidebar_signals[SHOW_ENTER_LOCATION], 0);
}
+static void
+emit_show_other_locations (NautilusGtkPlacesSidebar *sidebar)
+{
+ g_signal_emit (sidebar, places_sidebar_signals[SHOW_OTHER_LOCATIONS], 0);
+}
+
static void
emit_show_other_locations_with_flags (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkPlacesOpenFlags open_flags)
@@ -328,13 +377,26 @@ emit_unmount_operation (NautilusGtkPlacesSidebar *sidebar,
static GdkDragAction
emit_drag_action_requested (NautilusGtkPlacesSidebar *sidebar,
+ GdkDragContext *context,
GFile *dest_file,
- GSList *source_file_list)
+ GList *source_file_list)
{
GdkDragAction ret_action = 0;
g_signal_emit (sidebar, places_sidebar_signals[DRAG_ACTION_REQUESTED], 0,
- dest_file, source_file_list, &ret_action);
+ context, dest_file, source_file_list, &ret_action);
+
+ return ret_action;
+}
+
+static GdkDragAction
+emit_drag_action_ask (NautilusGtkPlacesSidebar *sidebar,
+ GdkDragAction actions)
+{
+ GdkDragAction ret_action = 0;
+
+ g_signal_emit (sidebar, places_sidebar_signals[DRAG_ACTION_ASK], 0,
+ actions, &ret_action);
return ret_action;
}
@@ -342,7 +404,7 @@ emit_drag_action_requested (NautilusGtkPlacesSidebar *sidebar,
static void
emit_drag_perform_drop (NautilusGtkPlacesSidebar *sidebar,
GFile *dest_file,
- GSList *source_file_list,
+ GList *source_file_list,
GdkDragAction action)
{
g_signal_emit (sidebar, places_sidebar_signals[DRAG_PERFORM_DROP], 0,
@@ -353,8 +415,8 @@ list_box_header_func (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
- NautilusGtkPlacesSectionType row_section_type;
- NautilusGtkPlacesSectionType before_section_type;
+ NautilusGtkPlacesSidebarSectionType row_section_type;
+ NautilusGtkPlacesSidebarSectionType before_section_type;
GtkWidget *separator;
gtk_list_box_row_set_header (row, NULL);
@@ -366,24 +428,27 @@ list_box_header_func (GtkListBoxRow *row,
}
else
{
- before_section_type = NAUTILUS_GTK_PLACES_SECTION_INVALID;
+ before_section_type = SECTION_INVALID;
+ gtk_widget_set_margin_top (GTK_WIDGET (row), 4);
}
if (before && before_section_type != row_section_type)
{
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_set_margin_top (separator, 4);
+ gtk_widget_set_margin_bottom (separator, 4);
gtk_list_box_row_set_header (row, separator);
}
}
static GtkWidget*
add_place (NautilusGtkPlacesSidebar *sidebar,
- NautilusGtkPlacesPlaceType place_type,
- NautilusGtkPlacesSectionType section_type,
- const char *name,
+ NautilusGtkPlacesSidebarPlaceType place_type,
+ NautilusGtkPlacesSidebarSectionType section_type,
+ const gchar *name,
GIcon *start_icon,
GIcon *end_icon,
- const char *uri,
+ const gchar *uri,
GDrive *drive,
GVolume *volume,
GMount *mount,
@@ -392,20 +457,20 @@ add_place (NautilusGtkPlacesSidebar *sidebar,
#else
gpointer *cloud_provider_account,
#endif
- const int index,
- const char *tooltip)
+ const gint index,
+ const gchar *tooltip)
{
gboolean show_eject, show_unmount;
gboolean show_eject_button;
GtkWidget *row;
GtkWidget *eject_button;
- GtkGesture *gesture;
+ GtkWidget *event_box;
check_unmount_and_eject (mount, volume, drive,
&show_unmount, &show_eject);
if (show_unmount || show_eject)
- g_assert (place_type != NAUTILUS_GTK_PLACES_BOOKMARK);
+ g_assert (place_type != PLACES_BOOKMARK);
show_eject_button = (show_unmount || show_eject);
@@ -429,24 +494,17 @@ add_place (NautilusGtkPlacesSidebar *sidebar,
NULL);
eject_button = nautilus_gtk_sidebar_row_get_eject_button (NAUTILUS_GTK_SIDEBAR_ROW (row));
+ event_box = nautilus_gtk_sidebar_row_get_event_box (NAUTILUS_GTK_SIDEBAR_ROW (row));
g_signal_connect_swapped (eject_button, "clicked",
G_CALLBACK (eject_or_unmount_bookmark), row);
+ g_signal_connect (event_box, "button-press-event",
+ G_CALLBACK (on_button_press_event), row);
+ g_signal_connect (event_box, "button-release-event",
+ G_CALLBACK (on_button_release_event), row);
- gesture = gtk_gesture_click_new ();
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
- g_signal_connect (gesture, "pressed",
- G_CALLBACK (on_row_pressed), row);
- g_signal_connect (gesture, "released",
- G_CALLBACK (on_row_released), row);
- gtk_widget_add_controller (row, GTK_EVENT_CONTROLLER (gesture));
-
- gesture = gtk_gesture_drag_new ();
- g_signal_connect (gesture, "drag-update",
- G_CALLBACK (on_row_dragged), row);
- gtk_widget_add_controller (row, GTK_EVENT_CONTROLLER (gesture));
-
- gtk_list_box_insert (GTK_LIST_BOX (sidebar->list_box), GTK_WIDGET (row), -1);
+ gtk_container_add (GTK_CONTAINER (sidebar->list_box), GTK_WIDGET (row));
+ gtk_widget_show_all (row);
return row;
}
@@ -470,7 +528,6 @@ special_directory_get_gicon (GUserDirectory directory)
ICON_CASE (TEMPLATES);
ICON_CASE (VIDEOS);
- case G_USER_N_DIRECTORIES:
default:
return g_themed_icon_new_with_default_fallbacks (ICON_NAME_FOLDER);
}
@@ -493,7 +550,7 @@ recent_files_setting_is_enabled (NautilusGtkPlacesSidebar *sidebar)
static gboolean
recent_scheme_is_supported (void)
{
- const char * const *supported;
+ const gchar * const *supported;
supported = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
if (supported != NULL)
@@ -511,11 +568,11 @@ should_show_recent (NautilusGtkPlacesSidebar *sidebar)
}
static gboolean
-path_is_home_dir (const char *path)
+path_is_home_dir (const gchar *path)
{
GFile *home_dir;
GFile *location;
- const char *home_path;
+ const gchar *home_path;
gboolean res;
home_path = g_get_home_dir ();
@@ -535,7 +592,7 @@ path_is_home_dir (const char *path)
static void
open_home (NautilusGtkPlacesSidebar *sidebar)
{
- const char *home_path;
+ const gchar *home_path;
GFile *home_dir;
home_path = g_get_home_dir ();
@@ -552,17 +609,17 @@ static void
add_special_dirs (NautilusGtkPlacesSidebar *sidebar)
{
GList *dirs;
- int index;
+ gint index;
dirs = NULL;
for (index = 0; index < G_USER_N_DIRECTORIES; index++)
{
- const char *path;
+ const gchar *path;
GFile *root;
GIcon *start_icon;
- char *name;
- char *mount_uri;
- char *tooltip;
+ gchar *name;
+ gchar *mount_uri;
+ gchar *tooltip;
if (!_nautilus_gtk_bookmarks_manager_get_is_xdg_dir_builtin (index))
continue;
@@ -588,8 +645,8 @@ add_special_dirs (NautilusGtkPlacesSidebar *sidebar)
mount_uri = g_file_get_uri (root);
tooltip = g_file_get_parse_name (root);
- add_place (sidebar, NAUTILUS_GTK_PLACES_XDG_DIR,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ add_place (sidebar, PLACES_XDG_DIR,
+ SECTION_COMPUTER,
name, start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, 0,
tooltip);
@@ -599,16 +656,16 @@ add_special_dirs (NautilusGtkPlacesSidebar *sidebar)
g_free (mount_uri);
g_free (tooltip);
- dirs = g_list_prepend (dirs, (char *)path);
+ dirs = g_list_prepend (dirs, (gchar *)path);
}
g_list_free (dirs);
}
-static char *
+static gchar *
get_home_directory_uri (void)
{
- const char *home;
+ const gchar *home;
home = g_get_home_dir ();
if (!home)
@@ -617,10 +674,10 @@ get_home_directory_uri (void)
return g_filename_to_uri (home, NULL, NULL);
}
-static char *
+static gchar *
get_desktop_directory_uri (void)
{
- const char *name;
+ const gchar *name;
name = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
@@ -633,22 +690,39 @@ get_desktop_directory_uri (void)
return g_filename_to_uri (name, NULL, NULL);
}
+static gboolean
+should_show_file (NautilusGtkPlacesSidebar *sidebar,
+ GFile *file)
+{
+ gchar *path;
+
+ if (!sidebar->local_only)
+ return TRUE;
+
+ path = g_file_get_path (file);
+ if (path)
+ {
+ g_free (path);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
file_is_shown (NautilusGtkPlacesSidebar *sidebar,
GFile *file)
{
- char *uri;
- GtkWidget *row;
+ gchar *uri;
+ GList *rows;
+ GList *l;
gboolean found = FALSE;
- for (row = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box));
- row != NULL && !found;
- row = gtk_widget_get_next_sibling (row))
+ rows = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
+ l = rows;
+ while (l != NULL && !found)
{
- if (!GTK_IS_LIST_BOX_ROW (row))
- continue;
-
- g_object_get (row, "uri", &uri, NULL);
+ g_object_get (l->data, "uri", &uri, NULL);
if (uri)
{
GFile *other;
@@ -657,46 +731,47 @@ file_is_shown (NautilusGtkPlacesSidebar *sidebar,
g_object_unref (other);
g_free (uri);
}
+ l = l->next;
}
+ g_list_free (rows);
+
return found;
}
-typedef struct
-{
- NautilusGtkPlacesSidebar *sidebar;
- guint position;
-} ShortcutData;
-
static void
on_app_shortcuts_query_complete (GObject *source,
GAsyncResult *result,
gpointer data)
{
- ShortcutData *sdata = data;
- NautilusGtkPlacesSidebar *sidebar = sdata->sidebar;
- guint pos = sdata->position;
+ NautilusGtkPlacesSidebar *sidebar = data;
GFile *file = G_FILE (source);
GFileInfo *info;
- g_free (sdata);
-
info = g_file_query_info_finish (file, result, NULL);
if (info)
{
- char *uri;
- char *tooltip;
- const char *name;
+ gchar *uri;
+ gchar *tooltip;
+ const gchar *name;
GIcon *start_icon;
+ int pos = 0;
name = g_file_info_get_display_name (info);
start_icon = g_file_info_get_symbolic_icon (info);
uri = g_file_get_uri (file);
tooltip = g_file_get_parse_name (file);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ /* XXX: we could avoid this by using an ancillary closure
+ * with the index coming from add_application_shortcuts(),
+ * but in terms of algorithmic overhead, the application
+ * shortcuts is not going to be really big
+ */
+ pos = g_slist_index (sidebar->shortcuts, file);
+
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
name, start_icon, NULL, uri,
NULL, NULL, NULL, NULL,
pos,
@@ -712,29 +787,25 @@ on_app_shortcuts_query_complete (GObject *source,
static void
add_application_shortcuts (NautilusGtkPlacesSidebar *sidebar)
{
- guint i, n;
+ GSList *l;
- n = g_list_model_get_n_items (G_LIST_MODEL (sidebar->shortcuts));
- for (i = 0; i < n; i++)
+ for (l = sidebar->shortcuts; l; l = l->next)
{
- GFile *file = g_list_model_get_item (G_LIST_MODEL (sidebar->shortcuts), i);
- ShortcutData *data;
+ GFile *file = l->data;
- g_object_unref (file);
+ if (!should_show_file (sidebar, file))
+ continue;
if (file_is_shown (sidebar, file))
continue;
- data = g_new (ShortcutData, 1);
- data->sidebar = sidebar;
- data->position = i;
g_file_query_info_async (file,
"standard::display-name,standard::symbolic-icon",
G_FILE_QUERY_INFO_NONE,
G_PRIORITY_DEFAULT,
sidebar->cancellable,
on_app_shortcuts_query_complete,
- data);
+ sidebar);
}
}
@@ -754,9 +825,9 @@ on_bookmark_query_info_complete (GObject *source,
GFile *root = G_FILE (source);
GError *error = NULL;
GFileInfo *info;
- char *bookmark_name;
- char *mount_uri;
- char *tooltip;
+ gchar *bookmark_name;
+ gchar *mount_uri;
+ gchar *tooltip;
GIcon *start_icon;
info = g_file_query_info_finish (root, result, &error);
@@ -770,9 +841,6 @@ on_bookmark_query_info_complete (GObject *source,
{
/* Don't add non-UTF-8 bookmarks */
bookmark_name = g_file_get_basename (root);
- if (bookmark_name == NULL)
- goto out;
-
if (!g_utf8_validate (bookmark_name, -1, NULL))
{
g_free (bookmark_name);
@@ -788,8 +856,8 @@ on_bookmark_query_info_complete (GObject *source,
mount_uri = g_file_get_uri (root);
tooltip = g_file_get_parse_name (root);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BOOKMARK,
- NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS,
+ add_place (sidebar, PLACES_BOOKMARK,
+ SECTION_BOOKMARKS,
bookmark_name, start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, clos->index,
tooltip);
@@ -810,7 +878,7 @@ is_external_volume (GVolume *volume)
{
gboolean is_external;
GDrive *drive;
- char *id;
+ gchar *id;
drive = g_volume_get_drive (volume);
id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
@@ -850,20 +918,19 @@ create_cloud_provider_account_row (NautilusGtkPlacesSidebar *sidebar,
{
GIcon *end_icon;
GIcon *start_icon;
- const char *mount_path;
- const char *name;
- char *mount_uri;
- char *tooltip;
+ gchar *mount_uri;
+ gchar *name;
+ gchar *tooltip;
guint provider_account_status;
start_icon = cloud_providers_account_get_icon (account);
name = cloud_providers_account_get_name (account);
provider_account_status = cloud_providers_account_get_status (account);
- mount_path = cloud_providers_account_get_path (account);
+ mount_uri = cloud_providers_account_get_path (account);
if (start_icon != NULL
&& name != NULL
&& provider_account_status != CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID
- && mount_path != NULL)
+ && mount_uri != NULL)
{
switch (provider_account_status)
{
@@ -883,20 +950,17 @@ create_cloud_provider_account_row (NautilusGtkPlacesSidebar *sidebar,
return FALSE;
}
- mount_uri = g_strconcat ("file://", mount_path, NULL);
+ mount_uri = g_strconcat ("file://", mount_uri, NULL);
/* translators: %s is the name of a cloud provider for files */
tooltip = g_strdup_printf (_("Open %s"), name);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_CLOUD,
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_CLOUD,
name, start_icon, end_icon, mount_uri,
NULL, NULL, NULL, account, 0,
tooltip);
- g_free (tooltip);
- g_free (mount_uri);
- g_object_unref (end_icon);
return TRUE;
}
else
@@ -933,22 +997,22 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
GList *volumes;
GVolume *volume;
GSList *bookmarks, *sl;
- int index;
- char *original_uri, *name, *identifier;
+ gint index;
+ gchar *original_uri, *mount_uri, *name, *identifier;
GtkListBoxRow *selected;
- char *home_uri;
+ gchar *home_uri;
GIcon *start_icon;
GFile *root;
- char *tooltip;
+ gchar *tooltip;
GList *network_mounts, *network_volumes;
GIcon *new_bookmark_icon;
- GtkWidget *child;
#ifdef HAVE_CLOUDPROVIDERS
GList *cloud_providers;
GList *cloud_providers_accounts;
CloudProvidersAccount *cloud_provider_account;
CloudProvidersProvider *cloud_provider;
#endif
+ GtkStyleContext *context;
/* save original selection */
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
@@ -965,18 +1029,20 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
/* Reset drag state, just in case we update the places while dragging or
* ending a drag */
stop_drop_feedback (sidebar);
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box))))
- gtk_list_box_remove (GTK_LIST_BOX (sidebar->list_box), child);
+ gtk_container_foreach (GTK_CONTAINER (sidebar->list_box),
+ (GtkCallback) gtk_widget_destroy,
+ NULL);
network_mounts = network_volumes = NULL;
/* add built-in places */
if (should_show_recent (sidebar))
{
+ mount_uri = "recent:///";
start_icon = g_themed_icon_new_with_default_fallbacks ("document-open-recent-symbolic");
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
- _("Recent"), start_icon, NULL, "recent:///",
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
+ _("Recent"), start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, 0,
_("Recent files"));
g_object_unref (start_icon);
@@ -984,20 +1050,22 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
if (sidebar->show_starred_location)
{
+ mount_uri = "starred:///";
start_icon = g_themed_icon_new_with_default_fallbacks ("starred-symbolic");
- add_place (sidebar, NAUTILUS_GTK_PLACES_STARRED_LOCATION,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
- _("Starred"), start_icon, NULL, "starred:///",
+ add_place (sidebar, PLACES_STARRED_LOCATION,
+ SECTION_COMPUTER,
+ _("Starred"), start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, 0,
- _("Starred files"));
+ /* TODO: Rename to 'Starred files' */
+ _("Favorite files"));
g_object_unref (start_icon);
}
/* home folder */
home_uri = get_home_directory_uri ();
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_HOME);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
_("Home"), start_icon, NULL, home_uri,
NULL, NULL, NULL, NULL, 0,
_("Open your personal folder"));
@@ -1007,12 +1075,12 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
/* desktop */
if (sidebar->show_desktop)
{
- char *mount_uri = get_desktop_directory_uri ();
+ mount_uri = get_desktop_directory_uri ();
if (mount_uri)
{
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_DESKTOP);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
_("Desktop"), start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, 0,
_("Open the contents of your desktop in a folder"));
@@ -1027,8 +1095,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
if (sidebar->show_enter_location)
{
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_NETWORK_SERVER);
- add_place (sidebar, NAUTILUS_GTK_PLACES_ENTER_LOCATION,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ add_place (sidebar, PLACES_ENTER_LOCATION,
+ SECTION_COMPUTER,
_("Enter Location"), start_icon, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
_("Manually enter a location"));
@@ -1036,11 +1104,11 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
}
/* Trash */
- if (sidebar->show_trash)
+ if (!sidebar->local_only && sidebar->show_trash)
{
start_icon = nautilus_trash_monitor_get_symbolic_icon ();
- sidebar->trash_row = add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ sidebar->trash_row = add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
_("Trash"), start_icon, NULL, "trash:///",
NULL, NULL, NULL, NULL, 0,
_("Open the trash"));
@@ -1122,8 +1190,6 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
mount = g_volume_get_mount (volume);
if (mount != NULL)
{
- char *mount_uri;
-
/* Show mounted volume in the sidebar */
start_icon = g_mount_get_symbolic_icon (mount);
root = g_mount_get_default_location (mount);
@@ -1131,8 +1197,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
name = g_mount_get_name (mount);
tooltip = g_file_get_parse_name (root);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
name, start_icon, NULL, mount_uri,
drive, volume, mount, NULL, 0, tooltip);
g_object_unref (root);
@@ -1156,8 +1222,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
name = g_volume_get_name (volume);
tooltip = g_strdup_printf (_("Mount and open “%s”"), name);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
name, start_icon, NULL, NULL,
drive, volume, NULL, NULL, 0, tooltip);
g_object_unref (start_icon);
@@ -1184,8 +1250,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
name = g_drive_get_name (drive);
tooltip = g_strdup_printf (_("Mount and open “%s”"), name);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_MOUNTS,
name, start_icon, NULL, NULL,
drive, NULL, NULL, NULL, 0, tooltip);
g_object_unref (start_icon);
@@ -1236,14 +1302,13 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
if (mount != NULL)
{
char *mount_uri;
-
start_icon = g_mount_get_symbolic_icon (mount);
root = g_mount_get_default_location (mount);
mount_uri = g_file_get_uri (root);
tooltip = g_file_get_parse_name (root);
name = g_mount_get_name (mount);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
name, start_icon, NULL, mount_uri,
NULL, volume, mount, NULL, 0, tooltip);
g_object_unref (mount);
@@ -1258,8 +1323,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
/* see comment above in why we add an icon for an unmounted mountable volume */
start_icon = g_volume_get_symbolic_icon (volume);
name = g_volume_get_name (volume);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
name, start_icon, NULL, NULL,
NULL, volume, NULL, NULL, 0, name);
g_object_unref (start_icon);
@@ -1272,10 +1337,11 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
/* file system root */
if (!sidebar->show_other_locations)
{
+ mount_uri = "file:///"; /* No need to strdup */
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_FILESYSTEM);
- add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
- sidebar->hostname, start_icon, NULL, "file:///",
+ add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_MOUNTS,
+ sidebar->hostname, start_icon, NULL, mount_uri,
NULL, NULL, NULL, NULL, 0,
_("Open the contents of the file system"));
g_object_unref (start_icon);
@@ -1286,8 +1352,6 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
for (l = mounts; l != NULL; l = l->next)
{
- char *mount_uri;
-
mount = l->data;
if (g_mount_is_shadowed (mount))
{
@@ -1314,8 +1378,8 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
mount_uri = g_file_get_uri (root);
name = g_mount_get_name (mount);
tooltip = g_file_get_parse_name (root);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_COMPUTER,
name, start_icon, NULL, mount_uri,
NULL, NULL, mount, NULL, 0, tooltip);
g_object_unref (root);
@@ -1341,6 +1405,9 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
if (_nautilus_gtk_bookmarks_manager_get_is_builtin (sidebar->bookmarks_manager, root))
continue;
+ if (sidebar->local_only && !is_native)
+ continue;
+
clos = g_slice_new (BookmarkQueryClosure);
clos->sidebar = sidebar;
clos->index = index;
@@ -1358,65 +1425,77 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
/* Add new bookmark row */
new_bookmark_icon = g_themed_icon_new ("bookmark-new-symbolic");
- sidebar->new_bookmark_row = add_place (sidebar, NAUTILUS_GTK_PLACES_DROP_FEEDBACK,
- NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS,
+ sidebar->new_bookmark_row = add_place (sidebar, PLACES_DROP_FEEDBACK,
+ SECTION_BOOKMARKS,
_("New bookmark"), new_bookmark_icon, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
_("Add a new bookmark"));
- gtk_widget_add_css_class (sidebar->new_bookmark_row, "sidebar-new-bookmark-row");
+ context = gtk_widget_get_style_context (sidebar->new_bookmark_row);
+ gtk_style_context_add_class (context, "sidebar-new-bookmark-row");
g_object_unref (new_bookmark_icon);
/* network */
- network_volumes = g_list_reverse (network_volumes);
- for (l = network_volumes; l != NULL; l = l->next)
+ if (!sidebar->local_only)
{
- volume = l->data;
- mount = g_volume_get_mount (volume);
-
- if (mount != NULL)
+ if (sidebar->show_connect_to_server)
{
- network_mounts = g_list_prepend (network_mounts, mount);
- continue;
+ start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_NETWORK_SERVER);
+ add_place (sidebar, PLACES_CONNECT_TO_SERVER,
+ SECTION_MOUNTS,
+ _("Connect to Server"), start_icon, NULL,
+ NULL, NULL, NULL, NULL, NULL, 0,
+ _("Connect to a network server address"));
+ g_object_unref (start_icon);
}
- else
+
+ network_volumes = g_list_reverse (network_volumes);
+ for (l = network_volumes; l != NULL; l = l->next)
{
- start_icon = g_volume_get_symbolic_icon (volume);
- name = g_volume_get_name (volume);
- tooltip = g_strdup_printf (_("Mount and open “%s”"), name);
+ volume = l->data;
+ mount = g_volume_get_mount (volume);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
- name, start_icon, NULL, NULL,
- NULL, volume, NULL, NULL, 0, tooltip);
+ if (mount != NULL)
+ {
+ network_mounts = g_list_prepend (network_mounts, mount);
+ continue;
+ }
+ else
+ {
+ start_icon = g_volume_get_symbolic_icon (volume);
+ name = g_volume_get_name (volume);
+ tooltip = g_strdup_printf (_("Mount and open “%s”"), name);
+
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
+ name, start_icon, NULL, NULL,
+ NULL, volume, NULL, NULL, 0, tooltip);
+ g_object_unref (start_icon);
+ g_free (name);
+ g_free (tooltip);
+ }
+ }
+
+ network_mounts = g_list_reverse (network_mounts);
+ for (l = network_mounts; l != NULL; l = l->next)
+ {
+ mount = l->data;
+ root = g_mount_get_default_location (mount);
+ start_icon = g_mount_get_symbolic_icon (mount);
+ mount_uri = g_file_get_uri (root);
+ name = g_mount_get_name (mount);
+ tooltip = g_file_get_parse_name (root);
+ add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ SECTION_MOUNTS,
+ name, start_icon, NULL, mount_uri,
+ NULL, NULL, mount, NULL, 0, tooltip);
+ g_object_unref (root);
g_object_unref (start_icon);
g_free (name);
+ g_free (mount_uri);
g_free (tooltip);
}
}
- network_mounts = g_list_reverse (network_mounts);
- for (l = network_mounts; l != NULL; l = l->next)
- {
- char *mount_uri;
-
- mount = l->data;
- root = g_mount_get_default_location (mount);
- start_icon = g_mount_get_symbolic_icon (mount);
- mount_uri = g_file_get_uri (root);
- name = g_mount_get_name (mount);
- tooltip = g_file_get_parse_name (root);
- add_place (sidebar, NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
- name, start_icon, NULL, mount_uri,
- NULL, NULL, mount, NULL, 0, tooltip);
- g_object_unref (root);
- g_object_unref (start_icon);
- g_free (name);
- g_free (mount_uri);
- g_free (tooltip);
- }
-
-
g_list_free_full (network_volumes, g_object_unref);
g_list_free_full (network_mounts, g_object_unref);
@@ -1425,15 +1504,15 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
{
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_OTHER_LOCATIONS);
- add_place (sidebar, NAUTILUS_GTK_PLACES_OTHER_LOCATIONS,
- NAUTILUS_GTK_PLACES_SECTION_OTHER_LOCATIONS,
+ add_place (sidebar, PLACES_OTHER_LOCATIONS,
+ SECTION_OTHER_LOCATIONS,
_("Other Locations"), start_icon, NULL, "other-locations:///",
NULL, NULL, NULL, NULL, 0, _("Show other locations"));
g_object_unref (start_icon);
}
- gtk_widget_show (GTK_WIDGET (sidebar));
+ gtk_widget_show_all (GTK_WIDGET (sidebar));
/* We want this hidden by default, but need to do it after the show_all call */
nautilus_gtk_sidebar_row_hide (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->new_bookmark_row), TRUE);
@@ -1452,16 +1531,14 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
static gboolean
check_valid_drop_target (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkSidebarRow *row,
- const GValue *value)
+ GdkDragContext *context)
{
- NautilusGtkPlacesPlaceType place_type;
- NautilusGtkPlacesSectionType section_type;
+ NautilusGtkPlacesSidebarPlaceType place_type;
+ NautilusGtkPlacesSidebarSectionType section_type;
gboolean valid = FALSE;
- char *uri;
+ gchar *uri;
GFile *dest_file;
- int drag_action;
-
- g_return_val_if_fail (value != NULL, TRUE);
+ gint drag_action;
if (row == NULL)
return FALSE;
@@ -1472,26 +1549,26 @@ check_valid_drop_target (NautilusGtkPlacesSidebar *sidebar,
"uri", &uri,
NULL);
- if (place_type == NAUTILUS_GTK_PLACES_STARRED_LOCATION)
+ if (place_type == PLACES_STARRED_LOCATION)
{
g_free (uri);
return FALSE;
}
- if (place_type == NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER)
+ if (place_type == PLACES_CONNECT_TO_SERVER)
{
g_free (uri);
return FALSE;
}
- if (place_type == NAUTILUS_GTK_PLACES_DROP_FEEDBACK)
+ if (place_type == PLACES_DROP_FEEDBACK)
{
g_free (uri);
return TRUE;
}
/* Disallow drops on recent:/// */
- if (place_type == NAUTILUS_GTK_PLACES_BUILT_IN)
+ if (place_type == PLACES_BUILT_IN)
{
if (g_strcmp0 (uri, "recent:///") == 0)
{
@@ -1501,32 +1578,40 @@ check_valid_drop_target (NautilusGtkPlacesSidebar *sidebar,
}
/* Dragging a bookmark? */
- if (G_VALUE_HOLDS (value, NAUTILUS_TYPE_GTK_SIDEBAR_ROW))
+ if (sidebar->drag_data_received &&
+ sidebar->drag_data_info == DND_NAUTILUS_GTK_SIDEBAR_ROW)
{
/* Don't allow reordering bookmarks into non-bookmark areas */
- valid = section_type == NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS;
+ valid = section_type == SECTION_BOOKMARKS;
}
- else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
+ else
{
/* Dragging a file */
- if (uri != NULL)
+ if (context)
{
- dest_file = g_file_new_for_uri (uri);
- drag_action = emit_drag_action_requested (sidebar, dest_file, g_value_get_boxed (value));
- valid = drag_action > 0;
+ if (uri != NULL)
+ {
+ dest_file = g_file_new_for_uri (uri);
+ drag_action = emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list);
+ valid = drag_action > 0;
- g_object_unref (dest_file);
+ g_object_unref (dest_file);
+ }
+ else
+ {
+ valid = FALSE;
+ }
}
else
{
- valid = FALSE;
+ /* We cannot discern if it is valid or not because there is not drag
+ * context available to ask the client.
+ * Simply make insensitive the drop targets we know are not valid for
+ * files, that are the ones remaining.
+ */
+ valid = TRUE;
}
}
- else
- {
- g_assert_not_reached ();
- valid = TRUE;
- }
g_free (uri);
return valid;
@@ -1534,30 +1619,60 @@ check_valid_drop_target (NautilusGtkPlacesSidebar *sidebar,
static void
update_possible_drop_targets (NautilusGtkPlacesSidebar *sidebar,
- const GValue *value)
+ gboolean dragging,
+ GdkDragContext *context)
{
- GtkWidget *row;
+ GList *rows;
+ GList *l;
+ gboolean sensitive;
- for (row = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box));
- row != NULL;
- row = gtk_widget_get_next_sibling (row))
+ rows = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
+
+ for (l = rows; l != NULL; l = l->next)
{
- gboolean sensitive;
+ sensitive = !dragging || check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (l->data),
context);
+ gtk_widget_set_sensitive (GTK_WIDGET (l->data), sensitive);
+ }
- if (!GTK_IS_LIST_BOX_ROW (row))
- continue;
+ g_list_free (rows);
+}
+
+static gboolean
+get_drag_data (GtkWidget *list_box,
+ GdkDragContext *context,
+ guint time)
+{
+ GdkAtom target;
+
+ target = gtk_drag_dest_find_target (list_box, context, NULL);
+
+ if (target == GDK_NONE)
+ return FALSE;
+
+ gtk_drag_get_data (list_box, context, target, time);
+
+ return TRUE;
+}
+
+static void
+free_drag_data (NautilusGtkPlacesSidebar *sidebar)
+{
+ sidebar->drag_data_received = FALSE;
- sensitive = value == NULL ||
- check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (row), value);
- gtk_widget_set_sensitive (row, sensitive);
+ if (sidebar->drag_list)
+ {
+ g_list_free_full (sidebar->drag_list, g_object_unref);
+ sidebar->drag_list = NULL;
}
+
}
static void
start_drop_feedback (NautilusGtkPlacesSidebar *sidebar,
- const GValue *value)
+ NautilusGtkSidebarRow *row,
+ GdkDragContext *context)
{
- if (value && !G_VALUE_HOLDS (value, NAUTILUS_TYPE_GTK_SIDEBAR_ROW))
+ if (sidebar->drag_data_info != DND_NAUTILUS_GTK_SIDEBAR_ROW)
{
nautilus_gtk_sidebar_row_reveal (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->new_bookmark_row));
/* If the state is permanent, don't change it. The application controls it. */
@@ -1565,13 +1680,15 @@ start_drop_feedback (NautilusGtkPlacesSidebar *sidebar,
sidebar->drop_state = DROP_STATE_NEW_BOOKMARK_ARMED;
}
- update_possible_drop_targets (sidebar, value);
+ update_possible_drop_targets (sidebar, TRUE, context);
}
static void
stop_drop_feedback (NautilusGtkPlacesSidebar *sidebar)
{
- update_possible_drop_targets (sidebar, NULL);
+ update_possible_drop_targets (sidebar, FALSE, NULL);
+
+ free_drag_data (sidebar);
if (sidebar->drop_state != DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT &&
sidebar->new_bookmark_row != NULL)
@@ -1588,33 +1705,92 @@ stop_drop_feedback (NautilusGtkPlacesSidebar *sidebar)
if (sidebar->row_placeholder != NULL)
{
- if (gtk_widget_get_parent (sidebar->row_placeholder) != NULL)
- gtk_list_box_remove (GTK_LIST_BOX (sidebar->list_box), sidebar->row_placeholder);
+ gtk_widget_destroy (sidebar->row_placeholder);
sidebar->row_placeholder = NULL;
}
sidebar->dragging_over = FALSE;
+ sidebar->drag_data_info = DND_UNKNOWN;
+}
+
+static gboolean
+on_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ gpointer user_data)
+{
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
+
+ if (sidebar->drag_row == NULL || sidebar->dragging_over)
+ return FALSE;
+
+ if (!(event->state & GDK_BUTTON1_MASK))
+ return FALSE;
+
+ if (gtk_drag_check_threshold (widget,
+ sidebar->drag_root_x, sidebar->drag_root_y,
+ event->x_root, event->y_root))
+ {
+ sidebar->dragging_over = TRUE;
+
+ gtk_drag_begin_with_coordinates (widget, sidebar->source_targets, GDK_ACTION_MOVE,
+ GDK_BUTTON_PRIMARY, (GdkEvent*)event,
+ -1, -1);
+ }
+
+ return FALSE;
+}
+
+static void
+drag_begin_callback (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer user_data)
+{
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
+ GtkAllocation allocation;
+ GtkWidget *drag_widget;
+ GtkWidget *window;
+
+ gtk_widget_get_allocation (sidebar->drag_row, &allocation);
+ gtk_widget_hide (sidebar->drag_row);
+
+ drag_widget = GTK_WIDGET (nautilus_gtk_sidebar_row_clone (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->drag_row)));
+ window = gtk_window_new (GTK_WINDOW_POPUP);
+ sidebar->drag_row_height = allocation.height;
+ gtk_widget_set_size_request (window, allocation.width, allocation.height);
+
+ gtk_container_add (GTK_CONTAINER (window), drag_widget);
+ gtk_widget_show_all (window);
+ gtk_widget_set_opacity (window, 0.8);
+
+ gtk_drag_set_icon_widget (context,
+ window,
+ sidebar->drag_row_x,
+ sidebar->drag_row_y);
}
static GtkWidget *
create_placeholder_row (NautilusGtkPlacesSidebar *sidebar)
{
- return g_object_new (NAUTILUS_TYPE_GTK_SIDEBAR_ROW, "placeholder", TRUE, NULL);
+ return g_object_new (NAUTILUS_TYPE_GTK_SIDEBAR_ROW,
+ "placeholder", TRUE,
+ NULL);
}
-static GdkDragAction
-drag_motion_callback (GtkDropTarget *target,
- double x,
- double y,
- NautilusGtkPlacesSidebar *sidebar)
-{
- GdkDragAction action;
+static gboolean
+drag_motion_callback (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time,
+ gpointer user_data)
+{
+ gint action;
GtkListBoxRow *row;
- NautilusGtkPlacesPlaceType place_type;
- char *drop_target_uri = NULL;
- int row_index;
- int row_placeholder_index;
- const GValue *value;
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
+ NautilusGtkPlacesSidebarPlaceType place_type;
+ gchar *drop_target_uri = NULL;
+ gint row_index;
+ gint row_placeholder_index;
sidebar->dragging_over = TRUE;
action = 0;
@@ -1622,22 +1798,24 @@ drag_motion_callback (GtkDropTarget *target,
gtk_list_box_drag_unhighlight_row (GTK_LIST_BOX (sidebar->list_box));
- /* Nothing to do if no value yet */
- value = gtk_drop_target_get_value (target);
- if (value == NULL)
+ /* Nothing to do if no drag data */
+ if (!sidebar->drag_data_received &&
+ !get_drag_data (sidebar->list_box, context, time))
goto out;
/* Nothing to do if the target is not valid drop destination */
- if (!check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (row), value))
+ if (!check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (row), context))
goto out;
- if (G_VALUE_HOLDS (value, NAUTILUS_TYPE_GTK_SIDEBAR_ROW))
+ if (sidebar->drag_data_received &&
+ sidebar->drag_data_info == DND_NAUTILUS_GTK_SIDEBAR_ROW)
{
/* Dragging bookmarks always moves them to another position in the bookmarks list */
action = GDK_ACTION_MOVE;
if (sidebar->row_placeholder == NULL)
{
sidebar->row_placeholder = create_placeholder_row (sidebar);
+ gtk_widget_show (sidebar->row_placeholder);
g_object_ref_sink (sidebar->row_placeholder);
}
else if (GTK_WIDGET (row) == sidebar->row_placeholder)
@@ -1646,10 +1824,15 @@ drag_motion_callback (GtkDropTarget *target,
}
if (gtk_widget_get_parent (sidebar->row_placeholder) != NULL)
- gtk_list_box_remove (GTK_LIST_BOX (sidebar->list_box), sidebar->row_placeholder);
+ {
+ gtk_container_remove (GTK_CONTAINER (sidebar->list_box),
+ sidebar->row_placeholder);
+ }
if (row != NULL)
{
+ gint dest_y, dest_x;
+
g_object_get (row, "order-index", &row_index, NULL);
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
/* We order the bookmarks sections based on the bookmark index that we
@@ -1663,11 +1846,11 @@ drag_motion_callback (GtkDropTarget *target,
* of the row, we need to increase the order-index.
*/
row_placeholder_index = row_index;
- gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
+ gtk_widget_translate_coordinates (widget, GTK_WIDGET (row),
x, y,
- &x, &y);
+ &dest_x, &dest_y);
- if (y > sidebar->drag_row_height / 2 && row_index > 0)
+ if (dest_y > sidebar->drag_row_height / 2 && row_index > 0)
row_placeholder_index++;
}
else
@@ -1683,7 +1866,7 @@ drag_motion_callback (GtkDropTarget *target,
gtk_list_box_prepend (GTK_LIST_BOX (sidebar->list_box),
sidebar->row_placeholder);
}
- else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
+ else
{
gtk_list_box_drag_highlight_row (GTK_LIST_BOX (sidebar->list_box), row);
@@ -1695,42 +1878,65 @@ drag_motion_callback (GtkDropTarget *target,
* file move/copy operation itself, or if we should only try to
* create bookmarks out of the dragged URIs.
*/
- if (place_type == NAUTILUS_GTK_PLACES_DROP_FEEDBACK)
- {
- action = GDK_ACTION_COPY;
- }
- else
+ if (sidebar->drag_list != NULL)
{
- /* uri may be NULL for unmounted volumes, for example, so we don't allow drops there */
- if (drop_target_uri != NULL)
+ if (place_type == PLACES_DROP_FEEDBACK)
+ {
+ action = GDK_ACTION_COPY;
+ }
+ else
{
- GFile *dest_file = g_file_new_for_uri (drop_target_uri);
+ /* uri may be NULL for unmounted volumes, for example, so we don't allow drops there */
+ if (drop_target_uri != NULL)
+ {
+ GFile *dest_file = g_file_new_for_uri (drop_target_uri);
- action = emit_drag_action_requested (sidebar, dest_file, g_value_get_boxed (value));
+ action = emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list);
- g_object_unref (dest_file);
+ g_object_unref (dest_file);
+ }
}
}
g_free (drop_target_uri);
}
- else
+
+ out:
+ start_drop_feedback (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (row), context);
+
+ g_signal_stop_emission_by_name (sidebar->list_box, "drag-motion");
+
+ gdk_drag_status (context, action, time);
+
+ return TRUE;
+}
+
+/* Takes an array of URIs and turns it into a list of GFile */
+static GList *
+build_file_list_from_uris (const gchar **uris)
+{
+ GList *result;
+ gint i;
+
+ result = NULL;
+ for (i = 0; uris && uris[i]; i++)
{
- g_assert_not_reached ();
+ GFile *file;
+
+ file = g_file_new_for_uri (uris[i]);
+ result = g_list_prepend (result, file);
}
- out:
- start_drop_feedback (sidebar, value);
- return action;
+ return g_list_reverse (result);
}
/* Reorders the bookmark to the specified position */
static void
reorder_bookmarks (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkSidebarRow *row,
- int new_position)
+ gint new_position)
{
- char *uri;
+ gchar *uri;
GFile *file;
g_object_get (row, "uri", &uri, NULL);
@@ -1744,10 +1950,10 @@ reorder_bookmarks (NautilusGtkPlacesSidebar *sidebar,
/* Creates bookmarks for the specified files at the given position in the bookmarks list */
static void
drop_files_as_bookmarks (NautilusGtkPlacesSidebar *sidebar,
- GSList *files,
- int position)
+ GList *files,
+ gint position)
{
- GSList *l;
+ GList *l;
for (l = files; l; l = l->next)
{
@@ -1768,26 +1974,76 @@ drop_files_as_bookmarks (NautilusGtkPlacesSidebar *sidebar,
}
}
-static gboolean
-drag_drop_callback (GtkDropTarget *target,
- const GValue *value,
- double x,
- double y,
- NautilusGtkPlacesSidebar *sidebar)
+static void
+drag_data_get_callback (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ gpointer user_data)
{
- int target_order_index;
- NautilusGtkPlacesPlaceType target_place_type;
- NautilusGtkPlacesSectionType target_section_type;
- char *target_uri;
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
+ GdkAtom target = gtk_selection_data_get_target (data);
+
+ if (target == gdk_atom_intern_static_string ("DND_NAUTILUS_GTK_SIDEBAR_ROW"))
+ {
+ gtk_selection_data_set (data,
+ target,
+ 8,
+ (void*)&sidebar->drag_row,
+ sizeof (gpointer));
+ }
+}
+
+static void
+drag_data_received_callback (GtkWidget *list_box,
+ GdkDragContext *context,
+ int x,
+ int y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer user_data)
+{
+ gint target_order_index;
+ NautilusGtkPlacesSidebarPlaceType target_place_type;
+ NautilusGtkPlacesSidebarSectionType target_section_type;
+ gchar *target_uri;
+ gboolean success;
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
GtkListBoxRow *target_row;
- gboolean result;
+
+ if (!sidebar->drag_data_received)
+ {
+ if (gtk_selection_data_get_target (selection_data) != GDK_NONE &&
+ info == DND_TEXT_URI_LIST)
+ {
+ gchar **uris;
+
+ uris = gtk_selection_data_get_uris (selection_data);
+ /* Free spurious drag data from previous drags if present */
+ if (sidebar->drag_list != NULL)
+ g_list_free_full (sidebar->drag_list, g_object_unref);
+ sidebar->drag_list = build_file_list_from_uris ((const char **) uris);
+ g_strfreev (uris);
+ }
+ else
+ {
+ sidebar->drag_list = NULL;
+ }
+ sidebar->drag_data_received = TRUE;
+ sidebar->drag_data_info = info;
+ }
+
+ g_signal_stop_emission_by_name (list_box, "drag-data-received");
+
+ if (!sidebar->drop_occurred)
+ return;
target_row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (sidebar->list_box), y);
- if (target_row == NULL)
- return FALSE;
- if (!check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (target_row), value))
- return FALSE;
+ if (target_row == NULL)
+ return;
g_object_get (target_row,
"place-type", &target_place_type,
@@ -1795,67 +2051,79 @@ drag_drop_callback (GtkDropTarget *target,
"order-index", &target_order_index,
"uri", &target_uri,
NULL);
- result = FALSE;
- if (G_VALUE_HOLDS (value, NAUTILUS_TYPE_GTK_SIDEBAR_ROW))
+ success = FALSE;
+
+ if (!check_valid_drop_target (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (target_row), context))
+ goto out;
+
+ if (sidebar->drag_data_info == DND_NAUTILUS_GTK_SIDEBAR_ROW)
{
- GtkWidget *source_row;
+ GtkWidget **source_row;
/* A bookmark got reordered */
- if (target_section_type != NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS)
+ if (target_section_type != SECTION_BOOKMARKS)
goto out;
- source_row = g_value_get_object (value);
+ source_row = (void*) gtk_selection_data_get_data (selection_data);
if (sidebar->row_placeholder != NULL)
g_object_get (sidebar->row_placeholder, "order-index", &target_order_index, NULL);
- reorder_bookmarks (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (source_row), target_order_index);
- result = TRUE;
+ reorder_bookmarks (sidebar, NAUTILUS_GTK_SIDEBAR_ROW (*source_row), target_order_index);
+ success = TRUE;
}
- else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
+ else
{
/* Dropping URIs! */
- if (target_place_type == NAUTILUS_GTK_PLACES_DROP_FEEDBACK)
- {
- drop_files_as_bookmarks (sidebar, g_value_get_boxed (value), target_order_index);
- }
- else
+ GdkDragAction real_action;
+ gchar **uris;
+ GList *source_file_list;
+
+ /* file transfer requested */
+ real_action = gdk_drag_context_get_selected_action (context);
+
+ if (real_action == GDK_ACTION_ASK)
+ real_action = emit_drag_action_ask (sidebar, gdk_drag_context_get_actions (context));
+
+ if (real_action > 0)
{
- GFile *dest_file = g_file_new_for_uri (target_uri);
-
- emit_drag_perform_drop (sidebar,
- dest_file,
- g_value_get_boxed (value),
- gdk_drop_get_actions (gtk_drop_target_get_current_drop (target)));
-
- g_object_unref (dest_file);
- }
- result = TRUE;
- }
- else
- {
- g_assert_not_reached ();
- }
+ GFile *dest_file;
-out:
- stop_drop_feedback (sidebar);
- g_free (target_uri);
- return result;
-}
+ uris = gtk_selection_data_get_uris (selection_data);
+ source_file_list = build_file_list_from_uris ((const gchar **) uris);
-static void
-dnd_finished_cb (GdkDrag *drag,
- NautilusGtkPlacesSidebar *sidebar)
-{
+ if (target_place_type == PLACES_DROP_FEEDBACK)
+ {
+ drop_files_as_bookmarks (sidebar, source_file_list, target_order_index);
+ }
+ else
+ {
+ dest_file = g_file_new_for_uri (target_uri);
+
+ emit_drag_perform_drop (sidebar, dest_file, source_file_list, real_action);
+
+ g_object_unref (dest_file);
+ }
+
+ success = TRUE;
+ g_list_free_full (source_file_list, g_object_unref);
+ g_strfreev (uris);
+ }
+ }
+
+out:
+ sidebar->drop_occurred = FALSE;
+ gtk_drag_finish (context, success, FALSE, time);
stop_drop_feedback (sidebar);
+ g_free (target_uri);
}
static void
-dnd_cancel_cb (GdkDrag *drag,
- GdkDragCancelReason reason,
- NautilusGtkPlacesSidebar *sidebar)
+drag_end_callback (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer user_data)
{
- stop_drop_feedback (sidebar);
+ stop_drop_feedback (NAUTILUS_GTK_PLACES_SIDEBAR (user_data));
}
/* This functions is called every time the drag source leaves
@@ -1868,28 +2136,50 @@ dnd_cancel_cb (GdkDrag *drag,
* but that's not true, because this function is called also before drag_drop,
* which needs the data from the drag so we cannot free the drag data here.
* So now one could think we could just do nothing here, and wait for
- * drag-end or drag-cancel signals and just stop_drop_feedback there. But that
- * is also not true, since when the drag comes from a different widget than the
+ * drag-end or drag-failed signals and just stop_drop_feedback there. But that
+ * is also not true, since when the drag comes from a diferent widget than the
* sidebar, when the drag stops the last drag signal we receive is drag-leave.
* So here what we will do is restore the state of the sidebar as if no drag
- * is being done (and if the application didn't request for permanent hints with
+ * is being done (and if the application didnt request for permanent hints with
* nautilus_gtk_places_sidebar_show_drop_hints) and we will free the drag data next time
* we build new drag data in drag_data_received.
*/
static void
-drag_leave_callback (GtkDropTarget *dest,
- gpointer user_data)
+drag_leave_callback (GtkWidget *widget,
+ GdkDragContext *context,
+ guint time,
+ gpointer user_data)
{
NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
if (sidebar->drop_state != DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT)
{
- update_possible_drop_targets (sidebar, FALSE);
+ update_possible_drop_targets (sidebar, FALSE, context);
nautilus_gtk_sidebar_row_hide (NAUTILUS_GTK_SIDEBAR_ROW (sidebar->new_bookmark_row), FALSE);
sidebar->drop_state = DROP_STATE_NORMAL;
}
+ sidebar->drag_data_received = FALSE;
sidebar->dragging_over = FALSE;
+ sidebar->drag_data_info = DND_UNKNOWN;
+}
+
+static gboolean
+drag_drop_callback (GtkWidget *list_box,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time,
+ gpointer user_data)
+{
+ gboolean retval = FALSE;
+ NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
+
+ sidebar->drop_occurred = TRUE;
+ retval = get_drag_data (sidebar->list_box, context, time);
+ g_signal_stop_emission_by_name (sidebar->list_box, "drag-drop");
+
+ return retval;
}
static void
@@ -1915,6 +2205,152 @@ check_unmount_and_eject (GMount *mount,
}
}
+static void
+check_visibility (GMount *mount,
+ GVolume *volume,
+ GDrive *drive,
+ gboolean *show_mount,
+ gboolean *show_unmount,
+ gboolean *show_eject,
+ gboolean *show_rescan,
+ gboolean *show_start,
+ gboolean *show_stop)
+{
+ *show_mount = FALSE;
+ *show_rescan = FALSE;
+ *show_start = FALSE;
+ *show_stop = FALSE;
+
+ check_unmount_and_eject (mount, volume, drive, show_unmount, show_eject);
+
+ if (drive != NULL)
+ {
+ if (g_drive_is_media_removable (drive) &&
+ !g_drive_is_media_check_automatic (drive) &&
+ g_drive_can_poll_for_media (drive))
+ *show_rescan = TRUE;
+
+ *show_start = g_drive_can_start (drive) || g_drive_can_start_degraded (drive);
+ *show_stop = g_drive_can_stop (drive);
+
+ if (*show_stop)
+ *show_unmount = FALSE;
+ }
+
+ if (volume != NULL)
+ {
+ if (mount == NULL)
+ *show_mount = g_volume_can_mount (volume);
+ }
+}
+
+typedef struct {
+ GtkWidget *add_shortcut_item;
+ GtkWidget *remove_item;
+ GtkWidget *rename_item;
+ GtkWidget *separator_item;
+ GtkWidget *mount_item;
+ GtkWidget *unmount_item;
+ GtkWidget *eject_item;
+ GtkWidget *rescan_item;
+ GtkWidget *start_item;
+ GtkWidget *stop_item;
+} PopoverData;
+
+static void
+check_popover_sensitivity (NautilusGtkSidebarRow *row,
+ PopoverData *data)
+{
+ gboolean show_mount;
+ gboolean show_unmount;
+ gboolean show_eject;
+ gboolean show_rescan;
+ gboolean show_start;
+ gboolean show_stop;
+ NautilusGtkPlacesSidebarPlaceType type;
+ GDrive *drive;
+ GVolume *volume;
+ GMount *mount;
+ GtkWidget *sidebar;
+ GActionGroup *actions;
+ GAction *action;
+
+ g_object_get (row,
+ "sidebar", &sidebar,
+ "place-type", &type,
+ "drive", &drive,
+ "volume", &volume,
+ "mount", &mount,
+ NULL);
+
+ gtk_widget_set_visible (data->add_shortcut_item, (type == PLACES_MOUNTED_VOLUME));
+
+ actions = gtk_widget_get_action_group (sidebar, "row");
+ action = g_action_map_lookup_action (G_ACTION_MAP (actions), "remove");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == PLACES_BOOKMARK));
+ action = g_action_map_lookup_action (G_ACTION_MAP (actions), "rename");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == PLACES_BOOKMARK ||
+ type == PLACES_XDG_DIR));
+ action = g_action_map_lookup_action (G_ACTION_MAP (actions), "open");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW
(row)));
+
+ check_visibility (mount, volume, drive,
+ &show_mount, &show_unmount, &show_eject, &show_rescan, &show_start, &show_stop);
+
+ gtk_widget_set_visible (data->separator_item, show_mount || show_unmount || show_eject);
+ gtk_widget_set_visible (data->mount_item, show_mount);
+ gtk_widget_set_visible (data->unmount_item, show_unmount);
+ gtk_widget_set_visible (data->eject_item, show_eject);
+ gtk_widget_set_visible (data->rescan_item, show_rescan);
+ gtk_widget_set_visible (data->start_item, show_start);
+ gtk_widget_set_visible (data->stop_item, show_stop);
+
+ /* Adjust start/stop items to reflect the type of the drive */
+ g_object_set (data->start_item, "text", _("_Start"), NULL);
+ g_object_set (data->stop_item, "text", _("_Stop"), NULL);
+ if ((show_start || show_stop) && drive != NULL)
+ {
+ switch (g_drive_get_start_stop_type (drive))
+ {
+ case G_DRIVE_START_STOP_TYPE_SHUTDOWN:
+ /* start() for type G_DRIVE_START_STOP_TYPE_SHUTDOWN is normally not used */
+ g_object_set (data->start_item, "text", _("_Power On"), NULL);
+ g_object_set (data->stop_item, "text", _("_Safely Remove Drive"), NULL);
+ break;
+
+ case G_DRIVE_START_STOP_TYPE_NETWORK:
+ g_object_set (data->start_item, "text", _("_Connect Drive"), NULL);
+ g_object_set (data->stop_item, "text", _("_Disconnect Drive"), NULL);
+ break;
+
+ case G_DRIVE_START_STOP_TYPE_MULTIDISK:
+ g_object_set (data->start_item, "text", _("_Start Multi-disk Device"), NULL);
+ g_object_set (data->stop_item, "text", _("_Stop Multi-disk Device"), NULL);
+ break;
+
+ case G_DRIVE_START_STOP_TYPE_PASSWORD:
+ /* stop() for type G_DRIVE_START_STOP_TYPE_PASSWORD is normally not used */
+ g_object_set (data->start_item, "text", _("_Unlock Device"), NULL);
+ g_object_set (data->stop_item, "text", _("_Lock Device"), NULL);
+ break;
+
+ default:
+ case G_DRIVE_START_STOP_TYPE_UNKNOWN:
+ /* uses defaults set above */
+ break;
+ }
+ }
+
+ if (drive)
+ g_object_unref (drive);
+ if (volume)
+ g_object_unref (volume);
+ if (mount)
+ g_object_unref (mount);
+
+ g_object_unref (sidebar);
+}
+
static void
drive_start_from_bookmark_cb (GObject *source_object,
GAsyncResult *res,
@@ -1922,8 +2358,8 @@ drive_start_from_bookmark_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
@@ -1951,8 +2387,8 @@ volume_mount_cb (GObject *source_object,
NautilusGtkPlacesSidebar *sidebar;
GVolume *volume;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
GMount *mount;
volume = G_VOLUME (source_object);
@@ -1966,9 +2402,6 @@ volume_mount_cb (GObject *source_object,
{
name = g_volume_get_name (G_VOLUME (source_object));
if (g_str_has_prefix (error->message, "Error unlocking"))
- /* Translators: This means that unlocking an encrypted storage
- * device failed. %s is the name of the device.
- */
primary = g_strdup_printf (_("Error unlocking “%s”"), name);
else
primary = g_strdup_printf (_("Unable to access “%s”"), name);
@@ -2056,7 +2489,7 @@ open_volume (NautilusGtkSidebarRow *row,
static void
open_uri (NautilusGtkPlacesSidebar *sidebar,
- const char *uri,
+ const gchar *uri,
NautilusGtkPlacesOpenFlags open_flags)
{
GFile *location;
@@ -2070,10 +2503,10 @@ static void
open_row (NautilusGtkSidebarRow *row,
NautilusGtkPlacesOpenFlags open_flags)
{
- char *uri;
+ gchar *uri;
GDrive *drive;
GVolume *volume;
- NautilusGtkPlacesPlaceType place_type;
+ NautilusGtkPlacesSidebarPlaceType place_type;
NautilusGtkPlacesSidebar *sidebar;
g_object_get (row,
@@ -2084,11 +2517,12 @@ open_row (NautilusGtkSidebarRow *row,
"volume", &volume,
NULL);
- if (place_type == NAUTILUS_GTK_PLACES_OTHER_LOCATIONS)
+ if (place_type == PLACES_OTHER_LOCATIONS)
{
+ emit_show_other_locations (sidebar);
emit_show_other_locations_with_flags (sidebar, open_flags);
}
- else if (place_type == NAUTILUS_GTK_PLACES_STARRED_LOCATION)
+ else if (place_type == PLACES_STARRED_LOCATION)
{
emit_show_starred_location (sidebar, open_flags);
}
@@ -2096,7 +2530,11 @@ open_row (NautilusGtkSidebarRow *row,
{
open_uri (sidebar, uri, open_flags);
}
- else if (place_type == NAUTILUS_GTK_PLACES_ENTER_LOCATION)
+ else if (place_type == PLACES_CONNECT_TO_SERVER)
+ {
+ emit_show_connect_to_server (sidebar);
+ }
+ else if (place_type == PLACES_ENTER_LOCATION)
{
emit_show_enter_location (sidebar);
}
@@ -2137,8 +2575,8 @@ add_shortcut_cb (GSimpleAction *action,
gpointer data)
{
NautilusGtkPlacesSidebar *sidebar = data;
- char *uri;
- char *name;
+ gchar *uri;
+ gchar *name;
GFile *location;
g_object_get (sidebar->context_row,
@@ -2162,14 +2600,15 @@ static void
rename_entry_changed (GtkEntry *entry,
NautilusGtkPlacesSidebar *sidebar)
{
- NautilusGtkPlacesPlaceType type;
- char *name;
- char *uri;
- const char *new_name;
+ NautilusGtkPlacesSidebarPlaceType type;
+ gchar *name;
+ gchar *uri;
+ const gchar *new_name;
gboolean found = FALSE;
- GtkWidget *row;
+ GList *rows;
+ GList *l;
- new_name = gtk_editable_get_text (GTK_EDITABLE (sidebar->rename_entry));
+ new_name = gtk_entry_get_text (GTK_ENTRY (sidebar->rename_entry));
if (strcmp (new_name, "") == 0)
{
@@ -2178,20 +2617,16 @@ rename_entry_changed (GtkEntry *entry,
return;
}
- for (row = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box));
- row != NULL && !found;
- row = gtk_widget_get_next_sibling (row))
+ rows = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
+ for (l = rows; l && !found; l = l->next)
{
- if (!GTK_IS_LIST_BOX_ROW (row))
- continue;
-
- g_object_get (row,
+ g_object_get (l->data,
"place-type", &type,
"uri", &uri,
"label", &name,
NULL);
- if ((type == NAUTILUS_GTK_PLACES_XDG_DIR || type == NAUTILUS_GTK_PLACES_BOOKMARK) &&
+ if ((type == PLACES_XDG_DIR || type == PLACES_BOOKMARK) &&
strcmp (uri, sidebar->rename_uri) != 0 &&
strcmp (new_name, name) == 0)
found = TRUE;
@@ -2199,6 +2634,7 @@ rename_entry_changed (GtkEntry *entry,
g_free (uri);
g_free (name);
}
+ g_list_free (rows);
gtk_widget_set_sensitive (sidebar->rename_button, !found);
gtk_label_set_label (GTK_LABEL (sidebar->rename_error),
@@ -2209,10 +2645,10 @@ static void
do_rename (GtkButton *button,
NautilusGtkPlacesSidebar *sidebar)
{
- char *new_text;
+ gchar *new_text;
GFile *file;
- new_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (sidebar->rename_entry)));
+ new_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (sidebar->rename_entry)));
file = g_file_new_for_uri (sidebar->rename_uri);
if (!_nautilus_gtk_bookmarks_manager_has_bookmark (sidebar->bookmarks_manager, file))
@@ -2251,24 +2687,20 @@ create_rename_popover (NautilusGtkPlacesSidebar *sidebar)
GtkWidget *entry;
GtkWidget *button;
GtkWidget *error;
- char *str;
+ gchar *str;
if (sidebar->rename_popover)
return;
- popover = gtk_popover_new ();
- gtk_widget_set_parent (popover, GTK_WIDGET (sidebar));
+ popover = gtk_popover_new (GTK_WIDGET (sidebar));
/* Clean sidebar pointer when its destroyed, most of the times due to its
* relative_to associated row being destroyed */
g_signal_connect (popover, "destroy", G_CALLBACK (on_rename_popover_destroy), sidebar);
gtk_popover_set_position (GTK_POPOVER (popover), GTK_POS_RIGHT);
grid = gtk_grid_new ();
- gtk_popover_set_child (GTK_POPOVER (popover), grid);
+ gtk_container_add (GTK_CONTAINER (popover), grid);
g_object_set (grid,
- "margin-start", 10,
- "margin-end", 10,
- "margin-top", 10,
- "margin-bottom", 10,
+ "margin", 10,
"row-spacing", 6,
"column-spacing", 6,
NULL);
@@ -2282,7 +2714,8 @@ create_rename_popover (NautilusGtkPlacesSidebar *sidebar)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
g_free (str);
button = gtk_button_new_with_mnemonic (_("_Rename"));
- gtk_widget_add_css_class (button, "suggested-action");
+ gtk_widget_set_can_default (button, TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
g_signal_connect (button, "clicked", G_CALLBACK (do_rename), sidebar);
error = gtk_label_new ("");
gtk_widget_set_halign (error, GTK_ALIGN_START);
@@ -2290,6 +2723,7 @@ create_rename_popover (NautilusGtkPlacesSidebar *sidebar)
gtk_grid_attach (GTK_GRID (grid), entry, 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID (grid), button,1, 1, 1, 1);
gtk_grid_attach (GTK_GRID (grid), error, 0, 2, 2, 1);
+ gtk_widget_show_all (grid);
gtk_popover_set_default_widget (GTK_POPOVER (popover), button);
sidebar->rename_popover = popover;
@@ -2312,28 +2746,30 @@ static void
update_popover_shadowing (GtkWidget *row,
gboolean shown)
{
- int count;
+ GtkStyleContext *context;
+ gint count;
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "popover-count"));
count = shown ? count + 1 : count - 1;
g_object_set_data (G_OBJECT (row), "popover-count", GINT_TO_POINTER (count));
+ context = gtk_widget_get_style_context (row);
if (count > 0)
- gtk_widget_add_css_class (row, "has-open-popup");
+ gtk_style_context_add_class (context, "has-open-popup");
else
- gtk_widget_remove_css_class (row, "has-open-popup");
+ gtk_style_context_remove_class (context, "has-open-popup");
}
static void
set_prelight (GtkPopover *popover)
{
- update_popover_shadowing (gtk_widget_get_parent (GTK_WIDGET (popover)), TRUE);
+ update_popover_shadowing (gtk_popover_get_relative_to (popover), TRUE);
}
static void
unset_prelight (GtkPopover *popover)
{
- update_popover_shadowing (gtk_widget_get_parent (GTK_WIDGET (popover)), FALSE);
+ update_popover_shadowing (gtk_popover_get_relative_to (popover), FALSE);
}
static void
@@ -2346,8 +2782,8 @@ setup_popover_shadowing (GtkWidget *popover)
static void
show_rename_popover (NautilusGtkSidebarRow *row)
{
- char *name;
- char *uri;
+ gchar *name;
+ gchar *uri;
NautilusGtkPlacesSidebar *sidebar;
g_object_get (row,
@@ -2362,12 +2798,8 @@ show_rename_popover (NautilusGtkSidebarRow *row)
g_free (sidebar->rename_uri);
sidebar->rename_uri = g_strdup (uri);
- gtk_editable_set_text (GTK_EDITABLE (sidebar->rename_entry), name);
- g_object_ref (sidebar->rename_popover);
- gtk_widget_unparent (sidebar->rename_popover);
- gtk_widget_set_parent (sidebar->rename_popover, GTK_WIDGET (row));
- g_object_unref (sidebar->rename_popover);
-
+ gtk_entry_set_text (GTK_ENTRY (sidebar->rename_entry), name);
+ gtk_popover_set_relative_to (GTK_POPOVER (sidebar->rename_popover), GTK_WIDGET (row));
setup_popover_shadowing (sidebar->rename_popover);
gtk_popover_popup (GTK_POPOVER (sidebar->rename_popover));
@@ -2381,11 +2813,11 @@ show_rename_popover (NautilusGtkSidebarRow *row)
static void
rename_bookmark (NautilusGtkSidebarRow *row)
{
- NautilusGtkPlacesPlaceType type;
+ NautilusGtkPlacesSidebarPlaceType type;
g_object_get (row, "place-type", &type, NULL);
- if (type != NAUTILUS_GTK_PLACES_BOOKMARK && type != NAUTILUS_GTK_PLACES_XDG_DIR)
+ if (type != PLACES_BOOKMARK && type != PLACES_XDG_DIR)
return;
show_rename_popover (row);
@@ -2404,8 +2836,8 @@ rename_shortcut_cb (GSimpleAction *action,
static void
remove_bookmark (NautilusGtkSidebarRow *row)
{
- NautilusGtkPlacesPlaceType type;
- char *uri;
+ NautilusGtkPlacesSidebarPlaceType type;
+ gchar *uri;
GFile *file;
NautilusGtkPlacesSidebar *sidebar;
@@ -2415,7 +2847,7 @@ remove_bookmark (NautilusGtkSidebarRow *row)
"uri", &uri,
NULL);
- if (type == NAUTILUS_GTK_PLACES_BOOKMARK)
+ if (type == PLACES_BOOKMARK)
{
file = g_file_new_for_uri (uri);
_nautilus_gtk_bookmarks_manager_remove_bookmark (sidebar->bookmarks_manager, file, NULL);
@@ -2471,8 +2903,8 @@ unmount_mount_cb (GObject *source_object,
{
if (error->code != G_IO_ERROR_FAILED_HANDLED)
{
- char *name;
- char *primary;
+ gchar *name;
+ gchar *primary;
name = g_mount_get_name (mount);
primary = g_strdup_printf (_("Unable to unmount “%s”"), name);
@@ -2492,7 +2924,7 @@ get_mount_operation (NautilusGtkPlacesSidebar *sidebar)
{
GMountOperation *mount_op;
- mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (sidebar))));
+ mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
emit_mount_operation (sidebar, mount_op);
@@ -2504,7 +2936,7 @@ get_unmount_operation (NautilusGtkPlacesSidebar *sidebar)
{
GMountOperation *mount_op;
- mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (sidebar))));
+ mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
emit_unmount_operation (sidebar, mount_op);
@@ -2640,8 +3072,8 @@ drive_stop_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = user_data;
@@ -2669,8 +3101,8 @@ drive_eject_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = user_data;
@@ -2698,8 +3130,8 @@ volume_eject_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = user_data;
@@ -2727,8 +3159,8 @@ mount_eject_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = user_data;
@@ -2875,8 +3307,8 @@ drive_poll_for_media_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
@@ -2923,8 +3355,8 @@ drive_start_cb (GObject *source_object,
{
NautilusGtkPlacesSidebar *sidebar;
GError *error;
- char *primary;
- char *name;
+ gchar *primary;
+ gchar *name;
sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (user_data);
@@ -2996,62 +3428,64 @@ stop_shortcut_cb (GSimpleAction *action,
}
static gboolean
-on_key_pressed (GtkEventControllerKey *controller,
- guint keyval,
- guint keycode,
- GdkModifierType state,
- NautilusGtkPlacesSidebar *sidebar)
+on_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ NautilusGtkPlacesSidebar *sidebar)
{
guint modifiers;
GtkListBoxRow *row;
- row = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
- if (row)
+ if (event)
{
- modifiers = gtk_accelerator_get_default_mod_mask ();
-
- if (keyval == GDK_KEY_Return ||
- keyval == GDK_KEY_KP_Enter ||
- keyval == GDK_KEY_ISO_Enter ||
- keyval == GDK_KEY_space)
+ row = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
+ if (row)
{
- NautilusGtkPlacesOpenFlags open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
+ modifiers = gtk_accelerator_get_default_mod_mask ();
- if ((state & modifiers) == GDK_SHIFT_MASK)
- open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
- else if ((state & modifiers) == GDK_CONTROL_MASK)
- open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW;
+ if (event->keyval == GDK_KEY_Return ||
+ event->keyval == GDK_KEY_KP_Enter ||
+ event->keyval == GDK_KEY_ISO_Enter ||
+ event->keyval == GDK_KEY_space)
+ {
+ NautilusGtkPlacesOpenFlags open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
- open_row (NAUTILUS_GTK_SIDEBAR_ROW (row), open_flags);
+ if ((event->state & modifiers) == GDK_SHIFT_MASK)
+ open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
+ else if ((event->state & modifiers) == GDK_CONTROL_MASK)
+ open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW;
- return TRUE;
- }
+ open_row (NAUTILUS_GTK_SIDEBAR_ROW (row), open_flags);
- if (keyval == GDK_KEY_Down &&
- (state & modifiers) == GDK_ALT_MASK)
- return eject_or_unmount_selection (sidebar);
+ return TRUE;
+ }
- if ((keyval == GDK_KEY_Delete ||
- keyval == GDK_KEY_KP_Delete) &&
- (state & modifiers) == 0)
- {
- remove_bookmark (NAUTILUS_GTK_SIDEBAR_ROW (row));
- return TRUE;
- }
+ if (event->keyval == GDK_KEY_Down &&
+ (event->state & modifiers) == GDK_MOD1_MASK)
+ return eject_or_unmount_selection (sidebar);
- if ((keyval == GDK_KEY_F2) &&
- (state & modifiers) == 0)
- {
- rename_bookmark (NAUTILUS_GTK_SIDEBAR_ROW (row));
- return TRUE;
- }
+ if ((event->keyval == GDK_KEY_Delete ||
+ event->keyval == GDK_KEY_KP_Delete) &&
+ (event->state & modifiers) == 0)
+ {
+ remove_bookmark (NAUTILUS_GTK_SIDEBAR_ROW (row));
+ return TRUE;
+ }
- if ((keyval == GDK_KEY_Menu) ||
- ((keyval == GDK_KEY_F10) &&
- (state & modifiers) == GDK_SHIFT_MASK))
- {
- popup_menu_cb (NAUTILUS_GTK_SIDEBAR_ROW (row));
- return TRUE;
+ if ((event->keyval == GDK_KEY_F2) &&
+ (event->state & modifiers) == 0)
+ {
+ rename_bookmark (NAUTILUS_GTK_SIDEBAR_ROW (row));
+ return TRUE;
+ }
+
+ if ((event->keyval == GDK_KEY_Menu) ||
+ ((event->keyval == GDK_KEY_F10) &&
+ (event->state & modifiers) == GDK_SHIFT_MASK))
+
+ {
+ popup_menu_cb (NAUTILUS_GTK_SIDEBAR_ROW (row));
+ return TRUE;
+ }
}
}
@@ -3072,6 +3506,70 @@ static GActionEntry entries[] = {
{ "stop", stop_shortcut_cb, NULL, NULL, NULL },
};
+static void
+add_actions (NautilusGtkPlacesSidebar *sidebar)
+{
+ GActionGroup *actions;
+
+ actions = G_ACTION_GROUP (g_simple_action_group_new ());
+ g_action_map_add_action_entries (G_ACTION_MAP (actions),
+ entries, G_N_ELEMENTS (entries),
+ sidebar);
+ gtk_widget_insert_action_group (GTK_WIDGET (sidebar), "row", actions);
+ g_object_unref (actions);
+}
+
+static GtkWidget *
+append_separator (GtkWidget *box)
+{
+ GtkWidget *separator;
+
+ separator = g_object_new (GTK_TYPE_SEPARATOR,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "visible", TRUE,
+ "margin-top", 6,
+ "margin-bottom", 6,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (box), separator);
+
+ return separator;
+}
+
+static GtkWidget *
+add_button (GtkWidget *box,
+ const gchar *label,
+ const gchar *action)
+{
+ GtkWidget *item;
+
+ item = g_object_new (GTK_TYPE_MODEL_BUTTON,
+ "visible", TRUE,
+ "action-name", action,
+ "text", label,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (box), item);
+
+ return item;
+}
+
+static GtkWidget *
+add_open_button (GtkWidget *box,
+ const gchar *label,
+ NautilusGtkPlacesOpenFlags flags)
+{
+ GtkWidget *item;
+
+ item = g_object_new (GTK_TYPE_MODEL_BUTTON,
+ "visible", TRUE,
+ "action-name", flags == NAUTILUS_GTK_PLACES_OPEN_NORMAL ? "row.open" :
"row.open-other",
+ "action-target", g_variant_new_int32 (flags),
+ "text", label,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (box), item);
+
+ return item;
+}
+
static void
on_row_popover_destroy (GtkWidget *row_popover,
NautilusGtkPlacesSidebar *sidebar)
@@ -3100,8 +3598,7 @@ build_popup_menu_using_gmenu (NautilusGtkSidebarRow *row)
GMenu *menu = g_menu_new ();
GMenuItem *item;
item = g_menu_item_new (_("_Open"), "row.open");
- g_menu_item_set_action_and_target_value (item, "row.open",
- g_variant_new_int32 (NAUTILUS_GTK_PLACES_OPEN_NORMAL));
+ g_menu_item_set_action_and_target_value (item, "row.open",
g_variant_new_int32(NAUTILUS_GTK_PLACES_OPEN_NORMAL));
g_menu_append_item (menu, item);
if (sidebar->open_flags & NAUTILUS_GTK_PLACES_OPEN_NEW_TAB)
{
@@ -3124,11 +3621,12 @@ build_popup_menu_using_gmenu (NautilusGtkSidebarRow *row)
"cloudprovider",
G_ACTION_GROUP (cloud_provider_action_group));
}
+ add_actions (sidebar);
if (sidebar->popover)
- gtk_widget_unparent (sidebar->popover);
+ gtk_widget_destroy (sidebar->popover);
- sidebar->popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
- gtk_widget_set_parent (sidebar->popover, GTK_WIDGET (sidebar));
+ sidebar->popover = gtk_popover_new_from_model (GTK_WIDGET (sidebar),
+ G_MENU_MODEL (menu));
g_signal_connect (sidebar->popover, "destroy",
G_CALLBACK (on_row_popover_destroy), sidebar);
g_object_unref (sidebar);
@@ -3142,24 +3640,8 @@ static void
create_row_popover (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkSidebarRow *row)
{
- NautilusGtkPlacesPlaceType type;
- GMenu *menu, *section;
- GMenuItem *item;
- GMount *mount;
- GVolume *volume;
- GDrive *drive;
- GAction *action;
- gboolean show_unmount, show_eject;
- gboolean show_stop;
-
- g_object_get (row,
- "place-type", &type,
- "drive", &drive,
- "volume", &volume,
- "mount", &mount,
- NULL);
-
- check_unmount_and_eject (mount, volume, drive, &show_unmount, &show_eject);
+ PopoverData data;
+ GtkWidget *box;
#ifdef HAVE_CLOUDPROVIDERS
CloudProvidersAccount *cloud_provider_account;
@@ -3169,139 +3651,72 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
if (cloud_provider_account)
{
build_popup_menu_using_gmenu (row);
- return;
+ return;
}
#endif
- action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "remove");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == NAUTILUS_GTK_PLACES_BOOKMARK));
- action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "rename");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == NAUTILUS_GTK_PLACES_BOOKMARK ||
- type == NAUTILUS_GTK_PLACES_XDG_DIR));
- action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "open");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW
(row)));
-
- menu = g_menu_new ();
- section = g_menu_new ();
+ sidebar->popover = gtk_popover_new (GTK_WIDGET (sidebar));
+ /* Clean sidebar pointer when its destroyed, most of the times due to its
+ * relative_to associated row being destroyed */
+ g_signal_connect (sidebar->popover, "destroy", G_CALLBACK (on_row_popover_destroy), sidebar);
+ setup_popover_shadowing (sidebar->popover);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ g_object_set (box, "margin", 10, NULL);
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (sidebar->popover), box);
- item = g_menu_item_new (_("_Open"), "row.open");
- g_menu_item_set_action_and_target_value (item, "row.open",
- g_variant_new_int32 (NAUTILUS_GTK_PLACES_OPEN_NORMAL));
- g_menu_append_item (section, item);
- g_object_unref (item);
+ add_open_button (box, _("_Open"), NAUTILUS_GTK_PLACES_OPEN_NORMAL);
if (sidebar->open_flags & NAUTILUS_GTK_PLACES_OPEN_NEW_TAB)
- {
- item = g_menu_item_new (_("Open in New _Tab"), "row.open");
- g_menu_item_set_action_and_target_value (item, "row.open",
- g_variant_new_int32 (NAUTILUS_GTK_PLACES_OPEN_NEW_TAB));
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
+ add_open_button (box, _("Open in New _Tab"), NAUTILUS_GTK_PLACES_OPEN_NEW_TAB);
if (sidebar->open_flags & NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW)
- {
- item = g_menu_item_new (_("Open in New _Window"), "row.open");
- g_menu_item_set_action_and_target_value (item, "row.open",
- g_variant_new_int32 (NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW));
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
-
- g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
- g_object_unref (section);
+ add_open_button (box, _("Open in New _Window"), NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW);
- section = g_menu_new ();
- item = g_menu_item_new (_("_Add Bookmark"), "row.add-bookmark");
- g_menu_append_item (section, item);
- g_object_unref (item);
+ append_separator (box);
- item = g_menu_item_new (_("_Remove"), "row.remove");
- g_menu_append_item (section, item);
- g_object_unref (item);
+ data.add_shortcut_item = add_button (box, _("_Add Bookmark"), "row.bookmark");
+ data.remove_item = add_button (box, _("_Remove"), "row.remove");
+ data.rename_item = add_button (box, _("Rename…"), "row.rename");
- item = g_menu_item_new (_("_Rename"), "row.rename");
- g_menu_append_item (section, item);
- g_object_unref (item);
+ data.separator_item = append_separator (box);
- g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
- g_object_unref (section);
+ data.mount_item = add_button (box, _("_Mount"), "row.mount");
+ data.unmount_item = add_button (box, _("_Unmount"), "row.unmount");
+ data.eject_item = add_button (box, _("_Eject"), "row.eject");
+ data.rescan_item = add_button (box, _("_Detect Media"), "row.rescan");
+ data.start_item = add_button (box, _("_Start"), "row.start");
+ data.stop_item = add_button (box, _("_Stop"), "row.stop");
- section = g_menu_new ();
+ /* Update everything! */
+ check_popover_sensitivity (row, &data);
- if (volume != NULL && mount == NULL &&
- g_volume_can_mount (volume))
+ if (sidebar->populate_all)
{
- item = g_menu_item_new (_("_Mount"), "row.mount");
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
-
- show_stop = (drive != NULL && g_drive_can_stop (drive));
+ gchar *uri;
+ GVolume *volume;
+ GFile *file;
- if (show_unmount && !show_stop)
- {
- item = g_menu_item_new (_("_Unmount"), "row.unmount");
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
-
- if (show_eject)
- {
- item = g_menu_item_new (_("_Eject"), "row.eject");
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
-
- if (drive != NULL &&
- g_drive_is_media_removable (drive) &&
- !g_drive_is_media_check_automatic (drive) &&
- g_drive_can_poll_for_media (drive))
- {
- item = g_menu_item_new (_("_Detect Media"), "row.rescan");
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
-
- if (drive != NULL &&
- (g_drive_can_start (drive) || g_drive_can_start_degraded (drive)))
- {
- const guint ss_type = g_drive_get_start_stop_type (drive);
- const char *start_label = _("_Start");
-
- if (ss_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN) start_label = _("_Power On");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_NETWORK) start_label = _("_Connect Drive");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_MULTIDISK) start_label = _("_Start Multi-disk Device");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_PASSWORD) start_label = _("_Unlock Device");
+ g_object_get (row,
+ "uri", &uri,
+ "volume", &volume,
+ NULL);
- item = g_menu_item_new (start_label, "row.start");
- g_menu_append_item (section, item);
- g_object_unref (item);
- }
+ if (uri)
+ file = g_file_new_for_uri (uri);
+ else
+ file = NULL;
- if (show_stop && !show_unmount)
- {
- const guint ss_type = g_drive_get_start_stop_type (drive);
- const char *stop_label = _("_Stop");
+ g_signal_emit (sidebar, places_sidebar_signals[POPULATE_POPUP], 0,
+ box, file, volume);
- if (ss_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN) stop_label = _("_Safely Remove Drive");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_NETWORK) stop_label = _("_Disconnect Drive");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_MULTIDISK) stop_label = _("_Stop Multi-disk Device");
- else if (ss_type == G_DRIVE_START_STOP_TYPE_PASSWORD) stop_label = _("_Lock Device");
+ if (file)
+ g_object_unref (file);
- item = g_menu_item_new (stop_label, "row.stop");
- g_menu_append_item (section, item);
- g_object_unref (item);
+ g_free (uri);
+ if (volume)
+ g_object_unref (volume);
}
-
- g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
- g_object_unref (section);
-
- sidebar->popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
- g_object_unref (menu);
- g_signal_connect (sidebar->popover, "destroy", G_CALLBACK (on_row_popover_destroy), sidebar);
-
- setup_popover_shadowing (sidebar->popover);
}
static void
@@ -3311,11 +3726,12 @@ show_row_popover (NautilusGtkSidebarRow *row)
g_object_get (row, "sidebar", &sidebar, NULL);
- g_clear_pointer (&sidebar->popover, gtk_widget_unparent);
+ if (sidebar->popover)
+ gtk_widget_destroy (sidebar->popover);
create_row_popover (sidebar, row);
- gtk_widget_set_parent (sidebar->popover, GTK_WIDGET (row));
+ gtk_popover_set_relative_to (GTK_POPOVER (sidebar->popover), GTK_WIDGET (row));
sidebar->context_row = row;
gtk_popover_popup (GTK_POPOVER (sidebar->popover));
@@ -3341,154 +3757,84 @@ on_row_activated (GtkListBox *list_box,
open_row (selected_row, 0);
}
-static void
-on_row_pressed (GtkGestureClick *gesture,
- int n_press,
- double x,
- double y,
- NautilusGtkSidebarRow *row)
+static gboolean
+on_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ NautilusGtkSidebarRow *row)
{
NautilusGtkPlacesSidebar *sidebar;
- NautilusGtkPlacesSectionType section_type;
- NautilusGtkPlacesPlaceType row_type;
+ NautilusGtkPlacesSidebarSectionType section_type;
- g_object_get (row,
+ g_object_get (NAUTILUS_GTK_SIDEBAR_ROW (row),
"sidebar", &sidebar,
"section_type", §ion_type,
- "place-type", &row_type,
NULL);
- if (section_type == NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS)
+ if (section_type == SECTION_BOOKMARKS)
{
sidebar->drag_row = GTK_WIDGET (row);
- sidebar->drag_row_x = (int)x;
- sidebar->drag_row_y = (int)y;
+ sidebar->drag_row_x = (gint)event->x;
+ sidebar->drag_row_y = (gint)event->y;
+
+ sidebar->drag_root_x = event->x_root;
+ sidebar->drag_root_y = event->y_root;
}
g_object_unref (sidebar);
+
+ return FALSE;
}
-static void
-on_row_released (GtkGestureClick *gesture,
- int n_press,
- double x,
- double y,
- NautilusGtkSidebarRow *row)
+static gboolean
+on_button_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ NautilusGtkSidebarRow *row)
{
- NautilusGtkPlacesSidebar *sidebar;
- NautilusGtkPlacesSectionType section_type;
- NautilusGtkPlacesPlaceType row_type;
- guint button, state;
-
- g_object_get (row,
- "sidebar", &sidebar,
- "section_type", §ion_type,
- "place-type", &row_type,
- NULL);
+ gboolean ret = FALSE;
+ NautilusGtkPlacesSidebarPlaceType row_type;
- button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
- state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
-
- if (row)
+ if (event && row)
{
- if (button == 2)
+ g_object_get (row, "place-type", &row_type, NULL);
+
+ if (event->button == 1)
+ ret = FALSE;
+ else if (event->button == 2)
{
NautilusGtkPlacesOpenFlags open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
- open_flags = (state & GDK_CONTROL_MASK) ?
- NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW :
- NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
+ open_flags = (event->state & GDK_CONTROL_MASK) ?
+ NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW :
+ NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
open_row (NAUTILUS_GTK_SIDEBAR_ROW (row), open_flags);
- gtk_gesture_set_state (GTK_GESTURE (gesture),
- GTK_EVENT_SEQUENCE_CLAIMED);
+ ret = TRUE;
}
- else if (button == 3)
+ else if (event->button == 3)
{
- if (row_type != NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER)
+ if (row_type != PLACES_CONNECT_TO_SERVER)
show_row_popover (NAUTILUS_GTK_SIDEBAR_ROW (row));
}
}
-}
-
-static void
-on_row_dragged (GtkGestureDrag *gesture,
- double x,
- double y,
- NautilusGtkSidebarRow *row)
-{
- NautilusGtkPlacesSidebar *sidebar;
-
- g_object_get (row, "sidebar", &sidebar, NULL);
-
- if (sidebar->drag_row == NULL || sidebar->dragging_over)
- {
- g_object_unref (sidebar);
- return;
- }
-
- if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
- {
- double start_x, start_y;
- double drag_x, drag_y;
- GdkContentProvider *content;
- GdkSurface *surface;
- GdkDevice *device;
- GtkAllocation allocation;
- GtkWidget *drag_widget;
- GdkDrag *drag;
-
- gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
- gtk_widget_translate_coordinates (GTK_WIDGET (row),
- GTK_WIDGET (sidebar),
- start_x, start_y,
- &drag_x, &drag_y);
-
- sidebar->dragging_over = TRUE;
-
- content = gdk_content_provider_new_typed (NAUTILUS_TYPE_GTK_SIDEBAR_ROW, sidebar->drag_row);
-
- surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (sidebar)));
- device = gtk_gesture_get_device (GTK_GESTURE (gesture));
-
- drag = gdk_drag_begin (surface, device, content, GDK_ACTION_MOVE, drag_x, drag_y);
-
- g_object_unref (content);
-
- g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), sidebar);
- g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), sidebar);
-
- gtk_widget_get_allocation (sidebar->drag_row, &allocation);
- gtk_widget_hide (sidebar->drag_row);
-
- drag_widget = GTK_WIDGET (nautilus_gtk_sidebar_row_clone (NAUTILUS_GTK_SIDEBAR_ROW
(sidebar->drag_row)));
- sidebar->drag_row_height = allocation.height;
- gtk_widget_set_size_request (drag_widget, allocation.width, allocation.height);
- gtk_widget_set_opacity (drag_widget, 0.8);
-
- gtk_drag_icon_set_child (GTK_DRAG_ICON (gtk_drag_icon_get_for_drag (drag)), drag_widget);
-
- g_object_unref (drag);
- }
- g_object_unref (sidebar);
+ return ret;
}
static void
popup_menu_cb (NautilusGtkSidebarRow *row)
{
- NautilusGtkPlacesPlaceType row_type;
+ NautilusGtkPlacesSidebarPlaceType row_type;
g_object_get (row, "place-type", &row_type, NULL);
- if (row_type != NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER)
+ if (row_type != PLACES_CONNECT_TO_SERVER)
show_row_popover (row);
}
static void
long_press_cb (GtkGesture *gesture,
- double x,
- double y,
+ gdouble x,
+ gdouble y,
NautilusGtkPlacesSidebar *sidebar)
{
GtkWidget *row;
@@ -3498,16 +3844,16 @@ long_press_cb (GtkGesture *gesture,
popup_menu_cb (NAUTILUS_GTK_SIDEBAR_ROW (row));
}
-static int
+static gint
list_box_sort_func (GtkListBoxRow *row1,
GtkListBoxRow *row2,
gpointer user_data)
{
- NautilusGtkPlacesSectionType section_type_1, section_type_2;
- NautilusGtkPlacesPlaceType place_type_1, place_type_2;
- char *label_1, *label_2;
- int index_1, index_2;
- int retval = 0;
+ NautilusGtkPlacesSidebarSectionType section_type_1, section_type_2;
+ NautilusGtkPlacesSidebarPlaceType place_type_1, place_type_2;
+ gchar *label_1, *label_2;
+ gint index_1, index_2;
+ gint retval = 0;
g_object_get (row1,
"label", &label_1,
@@ -3523,11 +3869,11 @@ list_box_sort_func (GtkListBoxRow *row1,
NULL);
/* Always last position for "connect to server" */
- if (place_type_1 == NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER)
+ if (place_type_1 == PLACES_CONNECT_TO_SERVER)
{
retval = 1;
}
- else if (place_type_2 == NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER)
+ else if (place_type_2 == PLACES_CONNECT_TO_SERVER)
{
retval = -1;
}
@@ -3535,20 +3881,20 @@ list_box_sort_func (GtkListBoxRow *row1,
{
if (section_type_1 == section_type_2)
{
- if ((section_type_1 == NAUTILUS_GTK_PLACES_SECTION_COMPUTER &&
+ if ((section_type_1 == SECTION_COMPUTER &&
place_type_1 == place_type_2 &&
- place_type_1 == NAUTILUS_GTK_PLACES_XDG_DIR) ||
- section_type_1 == NAUTILUS_GTK_PLACES_SECTION_MOUNTS)
+ place_type_1 == PLACES_XDG_DIR) ||
+ section_type_1 == SECTION_MOUNTS)
{
retval = g_utf8_collate (label_1, label_2);
}
- else if ((place_type_1 == NAUTILUS_GTK_PLACES_BOOKMARK || place_type_2 ==
NAUTILUS_GTK_PLACES_DROP_FEEDBACK) &&
- (place_type_1 == NAUTILUS_GTK_PLACES_DROP_FEEDBACK || place_type_2 ==
NAUTILUS_GTK_PLACES_BOOKMARK))
+ else if ((place_type_1 == PLACES_BOOKMARK || place_type_2 == PLACES_DROP_FEEDBACK) &&
+ (place_type_1 == PLACES_DROP_FEEDBACK || place_type_2 == PLACES_BOOKMARK))
{
retval = index_1 - index_2;
}
/* We order the bookmarks sections based on the bookmark index that we
- * set on the row as an order-index property, but we have to deal with
+ * set on the row as a order-index property, but we have to deal with
* the placeholder row wanted to be between two consecutive bookmarks,
* with two consecutive order-index values which is the usual case.
* For that, in the list box sort func we give priority to the placeholder row,
@@ -3557,14 +3903,14 @@ list_box_sort_func (GtkListBoxRow *row1,
* the current row, for instance when the cursor is in the lower half
* of the row, we need to increase the order-index.
*/
- else if (place_type_1 == NAUTILUS_GTK_PLACES_BOOKMARK_PLACEHOLDER && place_type_2 ==
NAUTILUS_GTK_PLACES_BOOKMARK)
+ else if (place_type_1 == PLACES_BOOKMARK_PLACEHOLDER && place_type_2 == PLACES_BOOKMARK)
{
if (index_1 == index_2)
retval = index_1 - index_2 - 1;
else
retval = index_1 - index_2;
}
- else if (place_type_1 == NAUTILUS_GTK_PLACES_BOOKMARK && place_type_2 ==
NAUTILUS_GTK_PLACES_BOOKMARK_PLACEHOLDER)
+ else if (place_type_1 == PLACES_BOOKMARK && place_type_2 == PLACES_BOOKMARK_PLACEHOLDER)
{
if (index_1 == index_2)
retval = index_1 - index_2 + 1;
@@ -3591,7 +3937,7 @@ update_hostname (NautilusGtkPlacesSidebar *sidebar)
{
GVariant *variant;
gsize len;
- const char *hostname;
+ const gchar *hostname;
if (sidebar->hostnamed_proxy == NULL)
return;
@@ -3700,19 +4046,13 @@ shell_shows_desktop_changed (GtkSettings *settings,
static void
nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar)
{
- GtkDropTarget *target;
+ GtkTargetList *target_list;
gboolean show_desktop;
- GtkEventController *controller;
- GtkGesture *gesture;
+ GtkStyleContext *context;
sidebar->cancellable = g_cancellable_new ();
sidebar->show_trash = TRUE;
- sidebar->show_other_locations = TRUE;
- sidebar->show_recent = TRUE;
- sidebar->show_desktop = TRUE;
-
- sidebar->shortcuts = g_list_store_new (G_TYPE_FILE);
create_volume_monitor (sidebar);
@@ -3724,19 +4064,19 @@ nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar)
sidebar->trash_monitor_changed_id = g_signal_connect_swapped (sidebar->trash_monitor,
"trash-state-changed",
G_CALLBACK (update_trash_icon), sidebar);
- sidebar->swin = gtk_scrolled_window_new ();
- gtk_widget_set_parent (sidebar->swin, GTK_WIDGET (sidebar));
- gtk_widget_set_size_request (sidebar->swin, 140, 280);
+ gtk_widget_set_size_request (GTK_WIDGET (sidebar), 140, 280);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sidebar->swin),
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sidebar),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sidebar), GTK_SHADOW_IN);
- gtk_widget_add_css_class (GTK_WIDGET (sidebar), "sidebar");
+ context = gtk_widget_get_style_context (GTK_WIDGET (sidebar));
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_SIDEBAR);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_RIGHT | GTK_JUNCTION_LEFT);
/* list box */
sidebar->list_box = gtk_list_box_new ();
- gtk_widget_add_css_class (sidebar->list_box, "navigation-sidebar");
gtk_list_box_set_header_func (GTK_LIST_BOX (sidebar->list_box),
list_box_header_func, sidebar, NULL);
@@ -3747,33 +4087,48 @@ nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar)
g_signal_connect (sidebar->list_box, "row-activated",
G_CALLBACK (on_row_activated), sidebar);
+ g_signal_connect (sidebar->list_box, "key-press-event",
+ G_CALLBACK (on_key_press_event), sidebar);
- controller = gtk_event_controller_key_new ();
- g_signal_connect (controller, "key-pressed",
- G_CALLBACK (on_key_pressed), sidebar);
- gtk_widget_add_controller (sidebar->list_box, controller);
-
- gesture = gtk_gesture_long_press_new ();
- gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
- g_signal_connect (gesture, "pressed",
+ sidebar->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (sidebar));
+ gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (sidebar->long_press_gesture), TRUE);
+ g_signal_connect (sidebar->long_press_gesture, "pressed",
G_CALLBACK (long_press_cb), sidebar);
- gtk_widget_add_controller (GTK_WIDGET (sidebar), GTK_EVENT_CONTROLLER (gesture));
/* DND support */
- target = gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
- gtk_drop_target_set_preload (target, TRUE);
- gtk_drop_target_set_gtypes (target, (GType[2]) { NAUTILUS_TYPE_GTK_SIDEBAR_ROW, GDK_TYPE_FILE_LIST }, 2);
- g_signal_connect (target, "enter", G_CALLBACK (drag_motion_callback), sidebar);
- g_signal_connect (target, "motion", G_CALLBACK (drag_motion_callback), sidebar);
- g_signal_connect (target, "drop", G_CALLBACK (drag_drop_callback), sidebar);
- g_signal_connect (target, "leave", G_CALLBACK (drag_leave_callback), sidebar);
- gtk_widget_add_controller (sidebar->list_box, GTK_EVENT_CONTROLLER (target));
-
+ gtk_drag_dest_set (sidebar->list_box,
+ 0,
+ NULL, 0,
+ GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
+ target_list = gtk_target_list_new (dnd_drop_targets, G_N_ELEMENTS (dnd_drop_targets));
+ gtk_target_list_add_uri_targets (target_list, DND_TEXT_URI_LIST);
+ gtk_drag_dest_set_target_list (sidebar->list_box, target_list);
+ gtk_target_list_unref (target_list);
+ sidebar->source_targets = gtk_target_list_new (dnd_source_targets, G_N_ELEMENTS (dnd_source_targets));
+ gtk_target_list_add_text_targets (sidebar->source_targets, 0);
+
+ g_signal_connect (sidebar->list_box, "motion-notify-event",
+ G_CALLBACK (on_motion_notify_event), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-begin",
+ G_CALLBACK (drag_begin_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-motion",
+ G_CALLBACK (drag_motion_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-data-get",
+ G_CALLBACK (drag_data_get_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-data-received",
+ G_CALLBACK (drag_data_received_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-drop",
+ G_CALLBACK (drag_drop_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-end",
+ G_CALLBACK (drag_end_callback), sidebar);
+ g_signal_connect (sidebar->list_box, "drag-leave",
+ G_CALLBACK (drag_leave_callback), sidebar);
sidebar->drag_row = NULL;
sidebar->row_placeholder = NULL;
sidebar->dragging_over = FALSE;
+ sidebar->drag_data_info = DND_UNKNOWN;
- gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sidebar->swin), sidebar->list_box);
+ gtk_container_add (GTK_CONTAINER (sidebar), sidebar->list_box);
sidebar->hostname = g_strdup (_("Computer"));
sidebar->hostnamed_cancellable = g_cancellable_new ();
@@ -3808,11 +4163,7 @@ nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar)
/* populate the sidebar */
update_places (sidebar);
- sidebar->row_actions = G_ACTION_GROUP (g_simple_action_group_new ());
- g_action_map_add_action_entries (G_ACTION_MAP (sidebar->row_actions),
- entries, G_N_ELEMENTS (entries),
- sidebar);
- gtk_widget_insert_action_group (GTK_WIDGET (sidebar), "row", sidebar->row_actions);
+ add_actions (sidebar);
}
static void
@@ -3841,6 +4192,12 @@ nautilus_gtk_places_sidebar_set_property (GObject *obj,
nautilus_gtk_places_sidebar_set_show_desktop (sidebar, g_value_get_boolean (value));
break;
+ case PROP_SHOW_CONNECT_TO_SERVER:
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ nautilus_gtk_places_sidebar_set_show_connect_to_server (sidebar, g_value_get_boolean (value));
+G_GNUC_END_IGNORE_DEPRECATIONS
+ break;
+
case PROP_SHOW_ENTER_LOCATION:
nautilus_gtk_places_sidebar_set_show_enter_location (sidebar, g_value_get_boolean (value));
break;
@@ -3857,6 +4214,18 @@ nautilus_gtk_places_sidebar_set_property (GObject *obj,
nautilus_gtk_places_sidebar_set_show_starred_location (sidebar, g_value_get_boolean (value));
break;
+ case PROP_LOCAL_ONLY:
+ nautilus_gtk_places_sidebar_set_local_only (sidebar, g_value_get_boolean (value));
+ break;
+
+ case PROP_POPULATE_ALL:
+ if (sidebar->populate_all != g_value_get_boolean (value))
+ {
+ sidebar->populate_all = g_value_get_boolean (value);
+ g_object_notify_by_pspec (obj, pspec);
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
break;
@@ -3889,6 +4258,12 @@ nautilus_gtk_places_sidebar_get_property (GObject *obj,
g_value_set_boolean (value, nautilus_gtk_places_sidebar_get_show_desktop (sidebar));
break;
+ case PROP_SHOW_CONNECT_TO_SERVER:
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ g_value_set_boolean (value, nautilus_gtk_places_sidebar_get_show_connect_to_server (sidebar));
+G_GNUC_END_IGNORE_DEPRECATIONS
+ break;
+
case PROP_SHOW_ENTER_LOCATION:
g_value_set_boolean (value, nautilus_gtk_places_sidebar_get_show_enter_location (sidebar));
break;
@@ -3905,6 +4280,14 @@ nautilus_gtk_places_sidebar_get_property (GObject *obj,
g_value_set_boolean (value, nautilus_gtk_places_sidebar_get_show_starred_location (sidebar));
break;
+ case PROP_LOCAL_ONLY:
+ g_value_set_boolean (value, nautilus_gtk_places_sidebar_get_local_only (sidebar));
+ break;
+
+ case PROP_POPULATE_ALL:
+ g_value_set_boolean (value, sidebar->populate_all);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
break;
@@ -3928,17 +4311,23 @@ nautilus_gtk_places_sidebar_dispose (GObject *object)
sidebar->cancellable = NULL;
}
+ free_drag_data (sidebar);
+
if (sidebar->bookmarks_manager != NULL)
{
_nautilus_gtk_bookmarks_manager_free (sidebar->bookmarks_manager);
sidebar->bookmarks_manager = NULL;
}
- g_clear_pointer (&sidebar->popover, gtk_widget_unparent);
+ if (sidebar->popover)
+ {
+ gtk_widget_destroy (sidebar->popover);
+ sidebar->popover = NULL;
+ }
if (sidebar->rename_popover)
{
- gtk_widget_unparent (sidebar->rename_popover);
+ gtk_widget_destroy (sidebar->rename_popover);
sidebar->rename_popover = NULL;
sidebar->rename_entry = NULL;
sidebar->rename_button = NULL;
@@ -3984,7 +4373,17 @@ nautilus_gtk_places_sidebar_dispose (GObject *object)
g_clear_object (&sidebar->current_location);
g_clear_pointer (&sidebar->rename_uri, g_free);
- g_clear_object (&sidebar->shortcuts);
+
+ g_clear_object (&sidebar->long_press_gesture);
+
+ if (sidebar->source_targets)
+ {
+ gtk_target_list_unref (sidebar->source_targets);
+ sidebar->source_targets = NULL;
+ }
+
+ g_slist_free_full (sidebar->shortcuts, g_object_unref);
+ sidebar->shortcuts = NULL;
#ifdef HAVE_CLOUDPROVIDERS
for (l = sidebar->unready_accounts; l != NULL; l = l->next)
@@ -3993,6 +4392,7 @@ nautilus_gtk_places_sidebar_dispose (GObject *object)
}
g_list_free_full (sidebar->unready_accounts, g_object_unref);
sidebar->unready_accounts = NULL;
+
if (sidebar->cloud_manager)
{
g_signal_handlers_disconnect_by_data (sidebar->cloud_manager, sidebar);
@@ -4012,52 +4412,9 @@ nautilus_gtk_places_sidebar_dispose (GObject *object)
static void
nautilus_gtk_places_sidebar_finalize (GObject *object)
{
- NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (object);
-
- g_clear_object (&sidebar->row_actions);
-
- g_clear_pointer (&sidebar->swin, gtk_widget_unparent);
-
G_OBJECT_CLASS (nautilus_gtk_places_sidebar_parent_class)->finalize (object);
}
-static void
-nautilus_gtk_places_sidebar_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline)
-{
- NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (widget);
-
- gtk_widget_measure (sidebar->swin,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
-}
-
-static void
-nautilus_gtk_places_sidebar_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
-{
- NautilusGtkPlacesSidebar *sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (widget);
-
- gtk_widget_size_allocate (sidebar->swin,
- &(GtkAllocation) { 0, 0, width, height },
- baseline);
-
- if (sidebar->popover)
- gtk_popover_present (GTK_POPOVER (sidebar->popover));
-
- if (sidebar->rename_popover)
- gtk_popover_present (GTK_POPOVER (sidebar->rename_popover));
-}
-
static void
nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
{
@@ -4070,19 +4427,18 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
gobject_class->set_property = nautilus_gtk_places_sidebar_set_property;
gobject_class->get_property = nautilus_gtk_places_sidebar_get_property;
- widget_class->measure = nautilus_gtk_places_sidebar_measure;
- widget_class->size_allocate = nautilus_gtk_places_sidebar_size_allocate;
-
- /*
+ /**
* NautilusGtkPlacesSidebar::open-location:
* @sidebar: the object which received the signal.
- * @location: (type Gio.File): GFile to which the caller should switch.
- * @open_flags: a single value from NautilusGtkPlacesOpenFlags specifying how the @location should be
opened.
+ * @location: (type Gio.File): #GFile to which the caller should switch.
+ * @open_flags: a single value from #NautilusGtkPlacesOpenFlags specifying how the @location should be
opened.
*
* The places sidebar emits this signal when the user selects a location
* in it. The calling application should display the contents of that
* location; for example, a file manager should show a list of files in
* the specified location.
+ *
+ * Since: 3.10
*/
places_sidebar_signals [OPEN_LOCATION] =
g_signal_new ("open-location",
@@ -4093,9 +4449,58 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
NULL,
G_TYPE_NONE, 2,
G_TYPE_OBJECT,
- NAUTILUS_TYPE_OPEN_FLAGS);
+ GTK_TYPE_PLACES_OPEN_FLAGS);
+
+ /**
+ * NautilusGtkPlacesSidebar::populate-popup:
+ * @sidebar: the object which received the signal.
+ * @container: (type Gtk.Widget): a #GtkMenu or another #GtkContainer
+ * @selected_item: (type Gio.File) (nullable): #GFile with the item to which
+ * the popup should refer, or %NULL in the case of a @selected_volume.
+ * @selected_volume: (type Gio.Volume) (nullable): #GVolume if the selected
+ * item is a volume, or %NULL if it is a file.
+ *
+ * The places sidebar emits this signal when the user invokes a contextual
+ * popup on one of its items. In the signal handler, the application may
+ * add extra items to the menu as appropriate. For example, a file manager
+ * may want to add a "Properties" command to the menu.
+ *
+ * It is not necessary to store the @selected_item for each menu item;
+ * during their callbacks, the application can use nautilus_gtk_places_sidebar_get_location()
+ * to get the file to which the item refers.
+ *
+ * The @selected_item argument may be %NULL in case the selection refers to
+ * a volume. In this case, @selected_volume will be non-%NULL. In this case,
+ * the calling application will have to g_object_ref() the @selected_volume and
+ * keep it around to use it in the callback.
+ *
+ * The @container and all its contents are destroyed after the user
+ * dismisses the popup. The popup is re-created (and thus, this signal is
+ * emitted) every time the user activates the contextual menu.
+ *
+ * Before 3.18, the @container always was a #GtkMenu, and you were expected
+ * to add your items as #GtkMenuItems. Since 3.18, the popup may be implemented
+ * as a #GtkPopover, in which case @container will be something else, e.g. a
+ * #GtkBox, to which you may add #GtkModelButtons or other widgets, such as
+ * #GtkEntries, #GtkSpinButtons, etc. If your application can deal with this
+ * situation, you can set #NautilusGtkPlacesSidebar::populate-all to %TRUE to request
+ * that this signal is emitted for populating popovers as well.
+ *
+ * Since: 3.10
+ */
+ places_sidebar_signals [POPULATE_POPUP] =
+ g_signal_new ("populate-popup",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, populate_popup),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 3,
+ GTK_TYPE_WIDGET,
+ G_TYPE_FILE,
+ G_TYPE_VOLUME);
- /*
+ /**
* NautilusGtkPlacesSidebar::show-error-message:
* @sidebar: the object which received the signal.
* @primary: primary message with a summary of the error to show.
@@ -4105,6 +4510,8 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
* application to present an error message. Most of these messages
* refer to mounting or unmounting media, for example, when a drive
* cannot be started for some reason.
+ *
+ * Since: 3.10
*/
places_sidebar_signals [SHOW_ERROR_MESSAGE] =
g_signal_new ("show-error-message",
@@ -4117,14 +4524,38 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
G_TYPE_STRING,
G_TYPE_STRING);
- /*
+ /**
+ * NautilusGtkPlacesSidebar::show-connect-to-server:
+ * @sidebar: the object which received the signal.
+ *
+ * The places sidebar emits this signal when it needs the calling
+ * application to present an way to connect directly to a network server.
+ * For example, the application may bring up a dialog box asking for
+ * a URL like "sftp://ftp.example.com". It is up to the application to create
+ * the corresponding mount by using, for example, g_file_mount_enclosing_volume().
+ *
+ * Deprecated: 3.18: use the #NautilusGtkPlacesSidebar::show-other-locations signal
+ * to connect to network servers.
+ */
+ places_sidebar_signals [SHOW_CONNECT_TO_SERVER] =
+ g_signal_new ("show-connect-to-server",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, show_connect_to_server),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
+
+ /**
* NautilusGtkPlacesSidebar::show-enter-location:
* @sidebar: the object which received the signal.
*
* The places sidebar emits this signal when it needs the calling
- * application to present a way to directly enter a location.
+ * application to present an way to directly enter a location.
* For example, the application may bring up a dialog box asking for
* a URL like "http://http.example.com".
+ *
+ * Since: 3.14
*/
places_sidebar_signals [SHOW_ENTER_LOCATION] =
g_signal_new ("show-enter-location",
@@ -4135,13 +4566,13 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
NULL,
G_TYPE_NONE, 0);
- /*
+ /**
* NautilusGtkPlacesSidebar::drag-action-requested:
* @sidebar: the object which received the signal.
- * @drop: (type Gdk.Drop): GdkDrop with information about the drag operation
- * @dest_file: (type Gio.File): GFile with the tentative location that is being hovered for a drop
- * @source_file_list: (type GLib.SList) (element-type GFile) (transfer none):
- * List of GFile that are being dragged
+ * @context: (type Gdk.DragContext): #GdkDragContext with information about the drag operation
+ * @dest_file: (type Gio.File): #GFile with the tentative location that is being hovered for a drop
+ * @source_file_list: (type GLib.List) (element-type GFile) (transfer none):
+ * List of #GFile that are being dragged
*
* When the user starts a drag-and-drop operation and the sidebar needs
* to ask the application for which drag action to perform, then the
@@ -4153,9 +4584,11 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
*
* The drag action to use must be the return value of the signal handler.
*
- * Returns: The drag action to use, for example, GDK_ACTION_COPY
- * or GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
+ * Returns: The drag action to use, for example, #GDK_ACTION_COPY
+ * or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
* are not allowed in the specified @dest_file).
+ *
+ * Since: 3.10
*/
places_sidebar_signals [DRAG_ACTION_REQUESTED] =
g_signal_new ("drag-action-requested",
@@ -4164,11 +4597,12 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, drag_action_requested),
NULL, NULL,
NULL,
- GDK_TYPE_DRAG_ACTION, 2,
+ G_TYPE_INT, 3,
+ GDK_TYPE_DRAG_CONTEXT,
G_TYPE_OBJECT,
- GDK_TYPE_FILE_LIST);
+ G_TYPE_POINTER /* GList of GFile */ );
- /*
+ /**
* NautilusGtkPlacesSidebar::drag-action-ask:
* @sidebar: the object which received the signal.
* @actions: Possible drag actions that need to be asked for.
@@ -4178,6 +4612,8 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
*
* Returns: the final drag action that the sidebar should pass to the drag side
* of the drag-and-drop operation.
+ *
+ * Since: 3.10
*/
places_sidebar_signals [DRAG_ACTION_ASK] =
g_signal_new ("drag-action-ask",
@@ -4186,15 +4622,15 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, drag_action_ask),
NULL, NULL,
NULL,
- GDK_TYPE_DRAG_ACTION, 1,
- GDK_TYPE_DRAG_ACTION);
+ G_TYPE_INT, 1,
+ G_TYPE_INT);
- /*
+ /**
* NautilusGtkPlacesSidebar::drag-perform-drop:
* @sidebar: the object which received the signal.
- * @dest_file: (type Gio.File): Destination GFile.
- * @source_file_list: (type GLib.SList) (element-type GFile) (transfer none):
- * GSList of GFile that got dropped.
+ * @dest_file: (type Gio.File): Destination #GFile.
+ * @source_file_list: (type GLib.List) (element-type GFile) (transfer none):
+ * #GList of #GFile that got dropped.
* @action: Drop action to perform.
*
* The places sidebar emits this signal when the user completes a
@@ -4202,6 +4638,8 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
* destination. This item is in the @dest_file, and the
* @source_file_list has the list of files that are dropped into it and
* which should be copied/moved/etc. based on the specified @action.
+ *
+ * Since: 3.10
*/
places_sidebar_signals [DRAG_PERFORM_DROP] =
g_signal_new ("drag-perform-drop",
@@ -4212,19 +4650,46 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
NULL,
G_TYPE_NONE, 3,
G_TYPE_OBJECT,
- GDK_TYPE_FILE_LIST,
- GDK_TYPE_DRAG_ACTION);
+ G_TYPE_POINTER, /* GList of GFile */
+ G_TYPE_INT);
+
+ /**
+ * NautilusGtkPlacesSidebar::show-other-locations:
+ * @sidebar: the object which received the signal.
+ *
+ * The places sidebar emits this signal when it needs the calling
+ * application to present a way to show other locations e.g. drives
+ * and network access points.
+ * For example, the application may bring up a page showing persistent
+ * volumes and discovered network addresses.
+ *
+ * Deprecated: 3.20: use the #NautilusGtkPlacesSidebar::show-other-locations-with-flags
+ * which includes the open flags in order to allow the user to specify to open
+ * in a new tab or window, in a similar way than #NautilusGtkPlacesSidebar::open-location
+ *
+ * Since: 3.18
+ */
+ places_sidebar_signals [SHOW_OTHER_LOCATIONS] =
+ g_signal_new ("show-other-locations",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_DEPRECATED,
+ G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, show_other_locations),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
- /*
+ /**
* NautilusGtkPlacesSidebar::show-other-locations-with-flags:
* @sidebar: the object which received the signal.
- * @open_flags: a single value from NautilusGtkPlacesOpenFlags specifying how it should be opened.
+ * @open_flags: a single value from #NautilusGtkPlacesOpenFlags specifying how it should be opened.
*
* The places sidebar emits this signal when it needs the calling
* application to present a way to show other locations e.g. drives
* and network access points.
* For example, the application may bring up a page showing persistent
* volumes and discovered network addresses.
+ *
+ * Since: 3.20
*/
places_sidebar_signals [SHOW_OTHER_LOCATIONS_WITH_FLAGS] =
g_signal_new ("show-other-locations-with-flags",
@@ -4234,17 +4699,19 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
- NAUTILUS_TYPE_OPEN_FLAGS);
+ GTK_TYPE_PLACES_OPEN_FLAGS);
- /*
+ /**
* NautilusGtkPlacesSidebar::mount:
* @sidebar: the object which received the signal.
- * @mount_operation: the GMountOperation that is going to start.
+ * @mount_operation: the #GMountOperation that is going to start.
*
* The places sidebar emits this signal when it starts a new operation
* because the user clicked on some location that needs mounting.
- * In this way the application using the NautilusGtkPlacesSidebar can track the
+ * In this way the application using the #NautilusGtkPlacesSidebar can track the
* progress of the operation and, for example, show a notification.
+ *
+ * Since: 3.20
*/
places_sidebar_signals [MOUNT] =
g_signal_new ("mount",
@@ -4256,15 +4723,17 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
G_TYPE_NONE,
1,
G_TYPE_MOUNT_OPERATION);
- /*
+ /**
* NautilusGtkPlacesSidebar::unmount:
* @sidebar: the object which received the signal.
- * @mount_operation: the GMountOperation that is going to start.
+ * @mount_operation: the #GMountOperation that is going to start.
*
* The places sidebar emits this signal when it starts a new operation
* because the user for example ejected some drive or unmounted a mount.
- * In this way the application using the NautilusGtkPlacesSidebar can track the
+ * In this way the application using the #NautilusGtkPlacesSidebar can track the
* progress of the operation and, for example, show a notification.
+ *
+ * Since: 3.20
*/
places_sidebar_signals [UNMOUNT] =
g_signal_new ("unmount",
@@ -4277,15 +4746,18 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
1,
G_TYPE_MOUNT_OPERATION);
- /*
+ /**
* NautilusGtkPlacesSidebar::show-starred-location:
- * @sidebar: the object which received the signal
- * @flags: the flags for the operation
+ * @sidebar: the object which received the signal.
+ * @open_flags: a single value from #NautilusGtkPlacesOpenFlags specifying how the
+ * starred file should be opened.
*
* The places sidebar emits this signal when it needs the calling
* application to present a way to show the starred files. In GNOME,
* starred files are implemented by setting the nao:predefined-tag-favorite
* tag in the tracker database.
+ *
+ * Since: 3.22.26
*/
places_sidebar_signals [SHOW_STARRED_LOCATION] =
g_signal_new ("show-starred-location",
@@ -4295,73 +4767,103 @@ nautilus_gtk_places_sidebar_class_init (NautilusGtkPlacesSidebarClass *class)
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
- NAUTILUS_TYPE_OPEN_FLAGS);
+ GTK_TYPE_PLACES_OPEN_FLAGS);
properties[PROP_LOCATION] =
g_param_spec_object ("location",
"Location to Select",
"The location to highlight in the sidebar",
G_TYPE_FILE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
properties[PROP_OPEN_FLAGS] =
g_param_spec_flags ("open-flags",
"Open Flags",
"Modes in which the calling application can open locations selected in the
sidebar",
- NAUTILUS_TYPE_OPEN_FLAGS,
+ GTK_TYPE_PLACES_OPEN_FLAGS,
NAUTILUS_GTK_PLACES_OPEN_NORMAL,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
properties[PROP_SHOW_RECENT] =
g_param_spec_boolean ("show-recent",
"Show recent files",
"Whether the sidebar includes a builtin shortcut for recent files",
TRUE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
properties[PROP_SHOW_DESKTOP] =
g_param_spec_boolean ("show-desktop",
- "Show “Desktop”",
+ "Show 'Desktop'",
"Whether the sidebar includes a builtin shortcut to the Desktop folder",
TRUE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
+ properties[PROP_SHOW_CONNECT_TO_SERVER] =
+ g_param_spec_boolean ("show-connect-to-server",
+ "Show 'Connect to Server'",
+ "Whether the sidebar includes a builtin shortcut to a 'Connect to server'
dialog",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_DEPRECATED);
properties[PROP_SHOW_ENTER_LOCATION] =
g_param_spec_boolean ("show-enter-location",
- "Show “Enter Location”",
+ "Show 'Enter Location'",
"Whether the sidebar includes a builtin shortcut to manually enter a
location",
FALSE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
+ properties[PROP_LOCAL_ONLY] =
+ g_param_spec_boolean ("local-only",
+ "Local Only",
+ "Whether the sidebar only includes local files",
+ FALSE,
+ G_PARAM_READWRITE);
properties[PROP_SHOW_TRASH] =
g_param_spec_boolean ("show-trash",
- "Show “Trash”",
+ "Show 'Trash'",
"Whether the sidebar includes a builtin shortcut to the Trash location",
TRUE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
properties[PROP_SHOW_OTHER_LOCATIONS] =
g_param_spec_boolean ("show-other-locations",
- "Show “Other locations”",
+ "Show 'Other locations'",
"Whether the sidebar includes an item to show external locations",
- TRUE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ FALSE,
+ G_PARAM_READWRITE);
properties[PROP_SHOW_STARRED_LOCATION] =
g_param_spec_boolean ("show-starred-location",
"Show “Starred Location”",
"Whether the sidebar includes an item to show starred files",
FALSE,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
+
+
+ /**
+ * NautilusGtkPlacesSidebar:populate-all:
+ *
+ * If :populate-all is %TRUE, the #NautilusGtkPlacesSidebar::populate-popup signal
+ * is also emitted for popovers.
+ *
+ * Since: 3.18
+ */
+ properties[PROP_POPULATE_ALL] =
+ g_param_spec_boolean ("populate-all",
+ "Populate all",
+ "Whether to emit ::populate-popup for popups that are not menus",
+ FALSE,
+ G_PARAM_READWRITE);
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
gtk_widget_class_set_css_name (widget_class, "placessidebar");
}
-/*
+/**
* nautilus_gtk_places_sidebar_new:
*
- * Creates a new NautilusGtkPlacesSidebar widget.
+ * Creates a new #NautilusGtkPlacesSidebar widget.
*
* The application should connect to at least the
- * NautilusGtkPlacesSidebar::open-location signal to be notified
+ * #NautilusGtkPlacesSidebar::open-location signal to be notified
* when the user makes a selection in the sidebar.
*
- * Returns: a newly created NautilusGtkPlacesSidebar
+ * Returns: a newly created #NautilusGtkPlacesSidebar
+ *
+ * Since: 3.10
*/
GtkWidget *
nautilus_gtk_places_sidebar_new (void)
@@ -4369,7 +4871,9 @@ nautilus_gtk_places_sidebar_new (void)
return GTK_WIDGET (g_object_new (nautilus_gtk_places_sidebar_get_type (), NULL));
}
-/*
+/* Public methods for NautilusGtkPlacesSidebar */
+
+/**
* nautilus_gtk_places_sidebar_set_open_flags:
* @sidebar: a places sidebar
* @flags: Bitmask of modes in which the calling application can open locations
@@ -4383,12 +4887,14 @@ nautilus_gtk_places_sidebar_new (void)
* application can open new locations, so that the sidebar can display (or not)
* the “Open in new tab” and “Open in new window” menu items as appropriate.
*
- * When the NautilusGtkPlacesSidebar::open-location signal is emitted, its flags
+ * When the #NautilusGtkPlacesSidebar::open-location signal is emitted, its flags
* argument will be set to one of the @flags that was passed in
* nautilus_gtk_places_sidebar_set_open_flags().
*
- * Passing 0 for @flags will cause NAUTILUS_GTK_PLACES_OPEN_NORMAL to always be sent
+ * Passing 0 for @flags will cause #NAUTILUS_GTK_PLACES_OPEN_NORMAL to always be sent
* to callbacks for the “open-location” signal.
+ *
+ * Since: 3.10
*/
void
nautilus_gtk_places_sidebar_set_open_flags (NautilusGtkPlacesSidebar *sidebar,
@@ -4403,13 +4909,15 @@ nautilus_gtk_places_sidebar_set_open_flags (NautilusGtkPlacesSidebar *sidebar,
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_open_flags:
- * @sidebar: a NautilusGtkPlacesSidebar
+ * @sidebar: a #NautilusGtkPlacesSidebar
*
* Gets the open flags.
*
- * Returns: the NautilusGtkPlacesOpenFlags of @sidebar
+ * Returns: the #NautilusGtkPlacesOpenFlags of @sidebar
+ *
+ * Since: 3.10
*/
NautilusGtkPlacesOpenFlags
nautilus_gtk_places_sidebar_get_open_flags (NautilusGtkPlacesSidebar *sidebar)
@@ -4419,7 +4927,7 @@ nautilus_gtk_places_sidebar_get_open_flags (NautilusGtkPlacesSidebar *sidebar)
return sidebar->open_flags;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_location:
* @sidebar: a places sidebar
* @location: (nullable): location to select, or %NULL for no current path
@@ -4429,14 +4937,17 @@ nautilus_gtk_places_sidebar_get_open_flags (NautilusGtkPlacesSidebar *sidebar)
* @sidebar will highlight that location if it is being shown in the list of
* places, or it will unhighlight everything if the @location is not among the
* places in the list.
+ *
+ * Since: 3.10
*/
void
nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar *sidebar,
GFile *location)
{
- GtkWidget *row;
- char *row_uri;
- char *uri;
+ GList *children;
+ GList *child;
+ gchar *row_uri;
+ gchar *uri;
gboolean found = FALSE;
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
@@ -4454,18 +4965,14 @@ nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar *sidebar,
uri = g_file_get_uri (location);
- for (row = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box));
- row != NULL && !found;
- row = gtk_widget_get_next_sibling (row))
+ children = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
+ for (child = children; child != NULL && !found; child = child->next)
{
- if (!GTK_IS_LIST_BOX_ROW (row))
- continue;
-
- g_object_get (row, "uri", &row_uri, NULL);
+ g_object_get (child->data, "uri", &row_uri, NULL);
if (row_uri != NULL && g_strcmp0 (row_uri, uri) == 0)
{
gtk_list_box_select_row (GTK_LIST_BOX (sidebar->list_box),
- GTK_LIST_BOX_ROW (row));
+ GTK_LIST_BOX_ROW (child->data));
found = TRUE;
}
@@ -4473,12 +4980,13 @@ nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar *sidebar,
}
g_free (uri);
+ g_list_free (children);
out:
g_object_notify_by_pspec (G_OBJECT (sidebar), properties[PROP_LOCATION]);
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_location:
* @sidebar: a places sidebar
*
@@ -4487,10 +4995,15 @@ nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar *sidebar,
* been called with a location that is not among the sidebar’s list of places to
* show.
*
- * You can use this function to get the selection in the @sidebar.
+ * You can use this function to get the selection in the @sidebar. Also, if you
+ * connect to the #NautilusGtkPlacesSidebar::populate-popup signal, you can use this
+ * function to get the location that is being referred to during the callbacks
+ * for your menu items.
*
- * Returns: (nullable) (transfer full): a GFile with the selected location, or
+ * Returns: (nullable) (transfer full): a #GFile with the selected location, or
* %NULL if nothing is visually selected.
+ *
+ * Since: 3.10
*/
GFile *
nautilus_gtk_places_sidebar_get_location (NautilusGtkPlacesSidebar *sidebar)
@@ -4505,7 +5018,7 @@ nautilus_gtk_places_sidebar_get_location (NautilusGtkPlacesSidebar *sidebar)
if (selected)
{
- char *uri;
+ gchar *uri;
g_object_get (selected, "uri", &uri, NULL);
file = g_file_new_for_uri (uri);
@@ -4515,11 +5028,11 @@ nautilus_gtk_places_sidebar_get_location (NautilusGtkPlacesSidebar *sidebar)
return file;
}
-char *
+gchar *
nautilus_gtk_places_sidebar_get_location_title (NautilusGtkPlacesSidebar *sidebar)
{
GtkListBoxRow *selected;
- char *title;
+ gchar *title;
g_return_val_if_fail (sidebar != NULL, NULL);
@@ -4532,7 +5045,7 @@ nautilus_gtk_places_sidebar_get_location_title (NautilusGtkPlacesSidebar *sideba
return title;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_show_recent:
* @sidebar: a places sidebar
* @show_recent: whether to show an item for recent files
@@ -4541,6 +5054,8 @@ nautilus_gtk_places_sidebar_get_location_title (NautilusGtkPlacesSidebar *sideba
* The default value for this option is determined by the desktop
* environment, but this function can be used to override it on a
* per-application basis.
+ *
+ * Since: 3.18
*/
void
nautilus_gtk_places_sidebar_set_show_recent (NautilusGtkPlacesSidebar *sidebar,
@@ -4559,13 +5074,15 @@ nautilus_gtk_places_sidebar_set_show_recent (NautilusGtkPlacesSidebar *sidebar,
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_recent:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_recent()
*
* Returns: %TRUE if the sidebar will display a builtin shortcut for recent files
+ *
+ * Since: 3.18
*/
gboolean
nautilus_gtk_places_sidebar_get_show_recent (NautilusGtkPlacesSidebar *sidebar)
@@ -4575,7 +5092,7 @@ nautilus_gtk_places_sidebar_get_show_recent (NautilusGtkPlacesSidebar *sidebar)
return sidebar->show_recent;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_show_desktop:
* @sidebar: a places sidebar
* @show_desktop: whether to show an item for the Desktop folder
@@ -4584,6 +5101,8 @@ nautilus_gtk_places_sidebar_get_show_recent (NautilusGtkPlacesSidebar *sidebar)
* The default value for this option is determined by the desktop
* environment and the user’s configuration, but this function can be
* used to override it on a per-application basis.
+ *
+ * Since: 3.10
*/
void
nautilus_gtk_places_sidebar_set_show_desktop (NautilusGtkPlacesSidebar *sidebar,
@@ -4606,13 +5125,15 @@ nautilus_gtk_places_sidebar_set_show_desktop (NautilusGtkPlacesSidebar *sidebar,
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_desktop:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_desktop()
*
* Returns: %TRUE if the sidebar will display a builtin shortcut to the desktop folder.
+ *
+ * Since: 3.10
*/
gboolean
nautilus_gtk_places_sidebar_get_show_desktop (NautilusGtkPlacesSidebar *sidebar)
@@ -4622,7 +5143,58 @@ nautilus_gtk_places_sidebar_get_show_desktop (NautilusGtkPlacesSidebar *sidebar)
return sidebar->show_desktop;
}
-/*
+/**
+ * nautilus_gtk_places_sidebar_set_show_connect_to_server:
+ * @sidebar: a places sidebar
+ * @show_connect_to_server: whether to show an item for the Connect to Server command
+ *
+ * Sets whether the @sidebar should show an item for connecting to a network server;
+ * this is off by default. An application may want to turn this on if it implements
+ * a way for the user to connect to network servers directly.
+ *
+ * If you enable this, you should connect to the
+ * #NautilusGtkPlacesSidebar::show-connect-to-server signal.
+ *
+ * Since: 3.10
+ *
+ * Deprecated: 3.18: It is recommended to group this functionality with the drives
+ * and network location under the new 'Other Location' item
+ */
+void
+nautilus_gtk_places_sidebar_set_show_connect_to_server (NautilusGtkPlacesSidebar *sidebar,
+ gboolean show_connect_to_server)
+{
+ g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
+
+ show_connect_to_server = !!show_connect_to_server;
+ if (sidebar->show_connect_to_server != show_connect_to_server)
+ {
+ sidebar->show_connect_to_server = show_connect_to_server;
+ update_places (sidebar);
+ g_object_notify_by_pspec (G_OBJECT (sidebar), properties[PROP_SHOW_CONNECT_TO_SERVER]);
+ }
+}
+
+/**
+ * nautilus_gtk_places_sidebar_get_show_connect_to_server:
+ * @sidebar: a places sidebar
+ *
+ * Returns the value previously set with nautilus_gtk_places_sidebar_set_show_connect_to_server()
+ *
+ * Returns: %TRUE if the sidebar will display a “Connect to Server” item.
+ *
+ * Deprecated: 3.18: It is recommended to group this functionality with the drives
+ * and network location under the new 'Other Location' item
+ */
+gboolean
+nautilus_gtk_places_sidebar_get_show_connect_to_server (NautilusGtkPlacesSidebar *sidebar)
+{
+ g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar), FALSE);
+
+ return sidebar->show_connect_to_server;
+}
+
+/**
* nautilus_gtk_places_sidebar_set_show_enter_location:
* @sidebar: a places sidebar
* @show_enter_location: whether to show an item to enter a location
@@ -4632,7 +5204,9 @@ nautilus_gtk_places_sidebar_get_show_desktop (NautilusGtkPlacesSidebar *sidebar)
* entering URLs is an expected user action.
*
* If you enable this, you should connect to the
- * NautilusGtkPlacesSidebar::show-enter-location signal.
+ * #NautilusGtkPlacesSidebar::show-enter-location signal.
+ *
+ * Since: 3.14
*/
void
nautilus_gtk_places_sidebar_set_show_enter_location (NautilusGtkPlacesSidebar *sidebar,
@@ -4649,13 +5223,15 @@ nautilus_gtk_places_sidebar_set_show_enter_location (NautilusGtkPlacesSidebar *s
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_enter_location:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_enter_location()
*
* Returns: %TRUE if the sidebar will display an “Enter Location” item.
+ *
+ * Since: 3.14
*/
gboolean
nautilus_gtk_places_sidebar_get_show_enter_location (NautilusGtkPlacesSidebar *sidebar)
@@ -4665,7 +5241,7 @@ nautilus_gtk_places_sidebar_get_show_enter_location (NautilusGtkPlacesSidebar *s
return sidebar->show_enter_location;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_show_other_locations:
* @sidebar: a places sidebar
* @show_other_locations: whether to show an item for the Other Locations view
@@ -4677,7 +5253,9 @@ nautilus_gtk_places_sidebar_get_show_enter_location (NautilusGtkPlacesSidebar *s
* see and interact with drives and network servers directly.
*
* If you enable this, you should connect to the
- * NautilusGtkPlacesSidebar::show-other-locations-with-flags signal.
+ * #NautilusGtkPlacesSidebar::show-other-locations signal.
+ *
+ * Since: 3.18
*/
void
nautilus_gtk_places_sidebar_set_show_other_locations (NautilusGtkPlacesSidebar *sidebar,
@@ -4694,13 +5272,15 @@ nautilus_gtk_places_sidebar_set_show_other_locations (NautilusGtkPlacesSidebar *
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_other_locations:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_other_locations()
*
* Returns: %TRUE if the sidebar will display an “Other Locations” item.
+ *
+ * Since: 3.18
*/
gboolean
nautilus_gtk_places_sidebar_get_show_other_locations (NautilusGtkPlacesSidebar *sidebar)
@@ -4710,12 +5290,14 @@ nautilus_gtk_places_sidebar_get_show_other_locations (NautilusGtkPlacesSidebar *
return sidebar->show_other_locations;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_show_trash:
* @sidebar: a places sidebar
* @show_trash: whether to show an item for the Trash location
*
* Sets whether the @sidebar should show an item for the Trash location.
+ *
+ * Since: 3.18
*/
void
nautilus_gtk_places_sidebar_set_show_trash (NautilusGtkPlacesSidebar *sidebar,
@@ -4732,13 +5314,15 @@ nautilus_gtk_places_sidebar_set_show_trash (NautilusGtkPlacesSidebar *sidebar,
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_trash:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_trash()
*
* Returns: %TRUE if the sidebar will display a “Trash” item.
+ *
+ * Since: 3.18
*/
gboolean
nautilus_gtk_places_sidebar_get_show_trash (NautilusGtkPlacesSidebar *sidebar)
@@ -4748,7 +5332,67 @@ nautilus_gtk_places_sidebar_get_show_trash (NautilusGtkPlacesSidebar *sidebar)
return sidebar->show_trash;
}
-/*
+/**
+ * nautilus_gtk_places_sidebar_set_local_only:
+ * @sidebar: a places sidebar
+ * @local_only: whether to show only local files
+ *
+ * Sets whether the @sidebar should only show local files.
+ *
+ * Since: 3.12
+ */
+void
+nautilus_gtk_places_sidebar_set_local_only (NautilusGtkPlacesSidebar *sidebar,
+ gboolean local_only)
+{
+ g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
+
+ local_only = !!local_only;
+ if (sidebar->local_only != local_only)
+ {
+ sidebar->local_only = local_only;
+ update_places (sidebar);
+ g_object_notify_by_pspec (G_OBJECT (sidebar), properties[PROP_LOCAL_ONLY]);
+ }
+}
+
+/**
+ * nautilus_gtk_places_sidebar_get_local_only:
+ * @sidebar: a places sidebar
+ *
+ * Returns the value previously set with nautilus_gtk_places_sidebar_set_local_only().
+ *
+ * Returns: %TRUE if the sidebar will only show local files.
+ *
+ * Since: 3.12
+ */
+gboolean
+nautilus_gtk_places_sidebar_get_local_only (NautilusGtkPlacesSidebar *sidebar)
+{
+ g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar), FALSE);
+
+ return sidebar->local_only;
+}
+
+static GSList *
+find_shortcut_link (NautilusGtkPlacesSidebar *sidebar,
+ GFile *location)
+{
+ GSList *l;
+
+ for (l = sidebar->shortcuts; l; l = l->next)
+ {
+ GFile *shortcut;
+
+ shortcut = G_FILE (l->data);
+ if (g_file_equal (shortcut, location))
+ return l;
+ }
+
+ return NULL;
+}
+
+/**
* nautilus_gtk_places_sidebar_add_shortcut:
* @sidebar: a places sidebar
* @location: location to add as an application-specific shortcut
@@ -4763,6 +5407,8 @@ nautilus_gtk_places_sidebar_get_show_trash (NautilusGtkPlacesSidebar *sidebar)
* across applications, and they are not persistent. If this function
* is called multiple times with different locations, then they are added
* to the sidebar’s list in the same order as the function is called.
+ *
+ * Since: 3.10
*/
void
nautilus_gtk_places_sidebar_add_shortcut (NautilusGtkPlacesSidebar *sidebar,
@@ -4771,12 +5417,13 @@ nautilus_gtk_places_sidebar_add_shortcut (NautilusGtkPlacesSidebar *sidebar,
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
g_return_if_fail (G_IS_FILE (location));
- g_list_store_append (sidebar->shortcuts, location);
+ g_object_ref (location);
+ sidebar->shortcuts = g_slist_append (sidebar->shortcuts, location);
update_places (sidebar);
}
-/*
+/**
* nautilus_gtk_places_sidebar_remove_shortcut:
* @sidebar: a places sidebar
* @location: location to remove
@@ -4784,93 +5431,95 @@ nautilus_gtk_places_sidebar_add_shortcut (NautilusGtkPlacesSidebar *sidebar,
* Removes an application-specific shortcut that has been previously been
* inserted with nautilus_gtk_places_sidebar_add_shortcut(). If the @location is not a
* shortcut in the sidebar, then nothing is done.
+ *
+ * Since: 3.10
*/
void
nautilus_gtk_places_sidebar_remove_shortcut (NautilusGtkPlacesSidebar *sidebar,
GFile *location)
{
- guint i, n;
+ GSList *link;
+ GFile *shortcut;
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
g_return_if_fail (G_IS_FILE (location));
- n = g_list_model_get_n_items (G_LIST_MODEL (sidebar->shortcuts));
- for (i = 0; i < n; i++)
- {
- GFile *shortcut = g_list_model_get_item (G_LIST_MODEL (sidebar->shortcuts), i);
+ link = find_shortcut_link (sidebar, location);
+ if (!link)
+ return;
- if (shortcut == location)
- {
- g_list_store_remove (sidebar->shortcuts, i);
- g_object_unref (shortcut);
- update_places (sidebar);
- return;
- }
+ shortcut = G_FILE (link->data);
+ g_object_unref (shortcut);
- g_object_unref (shortcut);
- }
+ sidebar->shortcuts = g_slist_delete_link (sidebar->shortcuts, link);
+ update_places (sidebar);
}
-/*
+/**
* nautilus_gtk_places_sidebar_list_shortcuts:
* @sidebar: a places sidebar
*
- * Gets the list of shortcuts, as a list model containing GFile objects.
+ * Gets the list of shortcuts.
*
- * You should not modify the returned list model. Future changes to
- * @sidebar may or may not affect the returned model.
+ * Returns: (element-type GFile) (transfer full):
+ * A #GSList of #GFile of the locations that have been added as
+ * application-specific shortcuts with nautilus_gtk_places_sidebar_add_shortcut().
+ * To free this list, you can use
+ * |[<!-- language="C" -->
+ * g_slist_free_full (list, (GDestroyNotify) g_object_unref);
+ * ]|
*
- * Returns: (transfer full): a list model of GFiles that have been added as
- * application-specific shortcuts with nautilus_gtk_places_sidebar_add_shortcut()
+ * Since: 3.10
*/
-GListModel *
-nautilus_gtk_places_sidebar_get_shortcuts (NautilusGtkPlacesSidebar *sidebar)
+GSList *
+nautilus_gtk_places_sidebar_list_shortcuts (NautilusGtkPlacesSidebar *sidebar)
{
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar), NULL);
- return G_LIST_MODEL (g_object_ref (sidebar->shortcuts));
+ return g_slist_copy_deep (sidebar->shortcuts, (GCopyFunc) g_object_ref, NULL);
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_nth_bookmark:
* @sidebar: a places sidebar
* @n: index of the bookmark to query
*
* This function queries the bookmarks added by the user to the places sidebar,
- * and returns one of them. This function is used by GtkFileChooser to implement
- * the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the corresponding bookmark.
+ * and returns one of them. This function is used by #GtkFileChooser to implement
+ * the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
*
* Returns: (nullable) (transfer full): The bookmark specified by the index @n, or
* %NULL if no such index exist. Note that the indices start at 0, even though
* the file chooser starts them with the keyboard shortcut "Alt-1".
+ *
+ * Since: 3.10
*/
GFile *
nautilus_gtk_places_sidebar_get_nth_bookmark (NautilusGtkPlacesSidebar *sidebar,
- int n)
+ gint n)
{
- GtkWidget *row;
+ GList *rows;
+ GList *l;
int k;
GFile *file;
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar), NULL);
file = NULL;
+ rows = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
+ l = rows;
+
k = 0;
- for (row = gtk_widget_get_first_child (GTK_WIDGET (sidebar->list_box));
- row != NULL;
- row = gtk_widget_get_next_sibling (row))
+ while (l != NULL)
{
- NautilusGtkPlacesPlaceType place_type;
- char *uri;
+ NautilusGtkPlacesSidebarPlaceType place_type;
+ gchar *uri;
- if (!GTK_IS_LIST_BOX_ROW (row))
- continue;
-
- g_object_get (row,
+ g_object_get (l->data,
"place-type", &place_type,
"uri", &uri,
NULL);
- if (place_type == NAUTILUS_GTK_PLACES_BOOKMARK)
+ if (place_type == PLACES_BOOKMARK)
{
if (k == n)
{
@@ -4881,15 +5530,20 @@ nautilus_gtk_places_sidebar_get_nth_bookmark (NautilusGtkPlacesSidebar *sidebar,
k++;
}
g_free (uri);
+ l = l->next;
}
+ g_list_free (rows);
+
return file;
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_drop_targets_visible:
* @sidebar: a places sidebar.
* @visible: whether to show the valid targets or not.
+ * @context: drag context used to ask the source about the action that wants to
+ * perform, so hints are more accurate.
*
* Make the NautilusGtkPlacesSidebar show drop targets, so it can show the available
* drop targets and a "new bookmark" row. This improves the Drag-and-Drop
@@ -4900,17 +5554,18 @@ nautilus_gtk_places_sidebar_get_nth_bookmark (NautilusGtkPlacesSidebar *sidebar,
* that might target the sidebar. The drop-targets-visible state will be unset
* automatically if the drag finishes in the NautilusGtkPlacesSidebar. You only need
* to unset the state when the drag ends on some other widget on your application.
+ *
+ * Since: 3.18
*/
void
nautilus_gtk_places_sidebar_set_drop_targets_visible (NautilusGtkPlacesSidebar *sidebar,
- gboolean visible)
+ gboolean visible,
+ GdkDragContext *context)
{
- g_return_if_fail (NAUTILUS_IS_GTK_PLACES_SIDEBAR (sidebar));
-
if (visible)
{
sidebar->drop_state = DROP_STATE_NEW_BOOKMARK_ARMED_PERMANENT;
- start_drop_feedback (sidebar, NULL);
+ start_drop_feedback (sidebar, NULL, context);
}
else
{
@@ -4934,13 +5589,15 @@ nautilus_gtk_places_sidebar_set_drop_targets_visible (NautilusGtkPlacesSidebar *
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_set_show_starred_location:
* @sidebar: a places sidebar
* @show_starred_location: whether to show an item for Starred files
*
* If you enable this, you should connect to the
- * NautilusGtkPlacesSidebar::show-starred-location signal.
+ * #NautilusGtkPlacesSidebar::show-starred-location signal.
+ *
+ * Since: 3.22.26
*/
void
nautilus_gtk_places_sidebar_set_show_starred_location (NautilusGtkPlacesSidebar *sidebar,
@@ -4957,13 +5614,15 @@ nautilus_gtk_places_sidebar_set_show_starred_location (NautilusGtkPlacesSidebar
}
}
-/*
+/**
* nautilus_gtk_places_sidebar_get_show_starred_location:
* @sidebar: a places sidebar
*
* Returns the value previously set with nautilus_gtk_places_sidebar_set_show_starred_location()
*
* Returns: %TRUE if the sidebar will display a Starred item.
+ *
+ * Since: 3.22.26
*/
gboolean
nautilus_gtk_places_sidebar_get_show_starred_location (NautilusGtkPlacesSidebar *sidebar)
diff --git a/src/gtk/nautilusgtkplacessidebar.h b/src/gtk/nautilusgtkplacessidebar.h
new file mode 100644
index 000000000..e7111ecf6
--- /dev/null
+++ b/src/gtk/nautilusgtkplacessidebar.h
@@ -0,0 +1,159 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* NautilusGtkPlacesSidebar - sidebar widget for places in the filesystem
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * This code comes from Nautilus, GNOME’s file manager.
+ *
+ * Authors : Mr Jamie McCracken (jamiemcc at blueyonder dot co dot uk)
+ * Federico Mena Quintero <federico gnome org>
+ */
+
+#ifndef __NAUTILUS_GTK_PLACES_SIDEBAR_H__
+#define __NAUTILUS_GTK_PLACES_SIDEBAR_H__
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#endif
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_GTK_PLACES_SIDEBAR (nautilus_gtk_places_sidebar_get_type ())
+#define NAUTILUS_GTK_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebar))
+#define NAUTILUS_GTK_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebarClass))
+#define NAUTILUS_IS_GTK_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR))
+#define NAUTILUS_IS_GTK_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR))
+#define NAUTILUS_GTK_PLACES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebarClass))
+
+typedef struct _NautilusGtkPlacesSidebar NautilusGtkPlacesSidebar;
+typedef struct _NautilusGtkPlacesSidebarClass NautilusGtkPlacesSidebarClass;
+
+/**
+ * NautilusGtkPlacesOpenFlags:
+ * @NAUTILUS_GTK_PLACES_OPEN_NORMAL: This is the default mode that #NautilusGtkPlacesSidebar uses if no
other flags
+ * are specified. It indicates that the calling application should open the selected location
+ * in the normal way, for example, in the folder view beside the sidebar.
+ * @NAUTILUS_GTK_PLACES_OPEN_NEW_TAB: When passed to nautilus_gtk_places_sidebar_set_open_flags(), this
indicates
+ * that the application can open folders selected from the sidebar in new tabs. This value
+ * will be passed to the #NautilusGtkPlacesSidebar::open-location signal when the user selects
+ * that a location be opened in a new tab instead of in the standard fashion.
+ * @NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW: Similar to @NAUTILUS_GTK_PLACES_OPEN_NEW_TAB, but indicates that
the application
+ * can open folders in new windows.
+ *
+ * These flags serve two purposes. First, the application can call
nautilus_gtk_places_sidebar_set_open_flags()
+ * using these flags as a bitmask. This tells the sidebar that the application is able to open
+ * folders selected from the sidebar in various ways, for example, in new tabs or in new windows in
+ * addition to the normal mode.
+ *
+ * Second, when one of these values gets passed back to the application in the
+ * #NautilusGtkPlacesSidebar::open-location signal, it means that the application should
+ * open the selected location in the normal way, in a new tab, or in a new
+ * window. The sidebar takes care of determining the desired way to open the location,
+ * based on the modifier keys that the user is pressing at the time the selection is made.
+ *
+ * If the application never calls nautilus_gtk_places_sidebar_set_open_flags(), then the sidebar will only
+ * use #NAUTILUS_GTK_PLACES_OPEN_NORMAL in the #NautilusGtkPlacesSidebar::open-location signal. This is the
+ * default mode of operation.
+ */
+typedef enum {
+ NAUTILUS_GTK_PLACES_OPEN_NORMAL = 1 << 0,
+ NAUTILUS_GTK_PLACES_OPEN_NEW_TAB = 1 << 1,
+ NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW = 1 << 2
+} NautilusGtkPlacesOpenFlags;
+
+GDK_AVAILABLE_IN_3_10
+GType nautilus_gtk_places_sidebar_get_type (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_3_10
+GtkWidget * nautilus_gtk_places_sidebar_new (void);
+
+GDK_AVAILABLE_IN_3_10
+NautilusGtkPlacesOpenFlags nautilus_gtk_places_sidebar_get_open_flags (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_10
+void nautilus_gtk_places_sidebar_set_open_flags (NautilusGtkPlacesSidebar
*sidebar,
+ NautilusGtkPlacesOpenFlags flags);
+
+GDK_AVAILABLE_IN_3_10
+GFile * nautilus_gtk_places_sidebar_get_location (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_10
+void nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar
*sidebar,
+ GFile *location);
+
+GDK_AVAILABLE_IN_3_18
+gboolean nautilus_gtk_places_sidebar_get_show_recent (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_18
+void nautilus_gtk_places_sidebar_set_show_recent (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean show_recent);
+
+GDK_AVAILABLE_IN_3_10
+gboolean nautilus_gtk_places_sidebar_get_show_desktop (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_10
+void nautilus_gtk_places_sidebar_set_show_desktop (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean show_desktop);
+
+GDK_DEPRECATED_IN_3_18
+gboolean nautilus_gtk_places_sidebar_get_show_connect_to_server (NautilusGtkPlacesSidebar
*sidebar);
+GDK_DEPRECATED_IN_3_18
+void nautilus_gtk_places_sidebar_set_show_connect_to_server (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean
show_connect_to_server);
+GDK_AVAILABLE_IN_3_14
+gboolean nautilus_gtk_places_sidebar_get_show_enter_location (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_14
+void nautilus_gtk_places_sidebar_set_show_enter_location (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean show_enter_location);
+
+GDK_AVAILABLE_IN_3_12
+void nautilus_gtk_places_sidebar_set_local_only (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean local_only);
+GDK_AVAILABLE_IN_3_12
+gboolean nautilus_gtk_places_sidebar_get_local_only (NautilusGtkPlacesSidebar
*sidebar);
+
+
+GDK_AVAILABLE_IN_3_10
+void nautilus_gtk_places_sidebar_add_shortcut (NautilusGtkPlacesSidebar
*sidebar,
+ GFile *location);
+GDK_AVAILABLE_IN_3_10
+void nautilus_gtk_places_sidebar_remove_shortcut (NautilusGtkPlacesSidebar
*sidebar,
+ GFile *location);
+GDK_AVAILABLE_IN_3_10
+GSList * nautilus_gtk_places_sidebar_list_shortcuts (NautilusGtkPlacesSidebar
*sidebar);
+
+GDK_AVAILABLE_IN_3_10
+GFile * nautilus_gtk_places_sidebar_get_nth_bookmark (NautilusGtkPlacesSidebar
*sidebar,
+ gint n);
+GDK_AVAILABLE_IN_3_18
+void nautilus_gtk_places_sidebar_set_drop_targets_visible (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean visible,
+ GdkDragContext *context);
+GDK_AVAILABLE_IN_3_18
+gboolean nautilus_gtk_places_sidebar_get_show_trash (NautilusGtkPlacesSidebar
*sidebar);
+GDK_AVAILABLE_IN_3_18
+void nautilus_gtk_places_sidebar_set_show_trash (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean show_trash);
+
+GDK_AVAILABLE_IN_3_18
+void nautilus_gtk_places_sidebar_set_show_other_locations (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean show_other_locations);
+GDK_AVAILABLE_IN_3_18
+gboolean nautilus_gtk_places_sidebar_get_show_other_locations (NautilusGtkPlacesSidebar
*sidebar);
+
+GDK_AVAILABLE_IN_3_22
+void nautilus_gtk_places_sidebar_set_show_starred_location (NautilusGtkPlacesSidebar
*sidebar,
+ gboolean
show_starred_location);
+GDK_AVAILABLE_IN_3_22
+gboolean nautilus_gtk_places_sidebar_get_show_starred_location (NautilusGtkPlacesSidebar
*sidebar);
+G_END_DECLS
+
+#endif /* __NAUTILUS_GTK_PLACES_SIDEBAR_H__ */
diff --git a/src/gtk/nautilusgtkplacessidebarprivate.h b/src/gtk/nautilusgtkplacessidebarprivate.h
index c1503ad70..6c6dd3daa 100644
--- a/src/gtk/nautilusgtkplacessidebarprivate.h
+++ b/src/gtk/nautilusgtkplacessidebarprivate.h
@@ -22,126 +22,38 @@
#define __NAUTILUS_GTK_PLACES_SIDEBAR_PRIVATE_H__
#include <glib.h>
-#include <gtk/gtk.h>
+#include "nautilusgtkplacessidebar.h"
G_BEGIN_DECLS
-#define NAUTILUS_TYPE_GTK_PLACES_SIDEBAR (nautilus_gtk_places_sidebar_get_type ())
-#define NAUTILUS_GTK_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebar))
-#define NAUTILUS_GTK_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebarClass))
-#define NAUTILUS_IS_GTK_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR))
-#define NAUTILUS_IS_GTK_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR))
-#define NAUTILUS_GTK_PLACES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
NAUTILUS_TYPE_GTK_PLACES_SIDEBAR, NautilusGtkPlacesSidebarClass))
-
-typedef struct _NautilusGtkPlacesSidebar NautilusGtkPlacesSidebar;
-typedef struct _NautilusGtkPlacesSidebarClass NautilusGtkPlacesSidebarClass;
-
-/*
- * NautilusGtkPlacesOpenFlags:
- * @NAUTILUS_GTK_PLACES_OPEN_NORMAL: This is the default mode that NautilusGtkPlacesSidebar uses if no other
flags
- * are specified. It indicates that the calling application should open the selected location
- * in the normal way, for example, in the folder view beside the sidebar.
- * @NAUTILUS_GTK_PLACES_OPEN_NEW_TAB: When passed to nautilus_gtk_places_sidebar_set_open_flags(), this
indicates
- * that the application can open folders selected from the sidebar in new tabs. This value
- * will be passed to the NautilusGtkPlacesSidebar::open-location signal when the user selects
- * that a location be opened in a new tab instead of in the standard fashion.
- * @NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW: Similar to @NAUTILUS_GTK_PLACES_OPEN_NEW_TAB, but indicates that
the application
- * can open folders in new windows.
- *
- * These flags serve two purposes. First, the application can call
nautilus_gtk_places_sidebar_set_open_flags()
- * using these flags as a bitmask. This tells the sidebar that the application is able to open
- * folders selected from the sidebar in various ways, for example, in new tabs or in new windows in
- * addition to the normal mode.
- *
- * Second, when one of these values gets passed back to the application in the
- * NautilusGtkPlacesSidebar::open-location signal, it means that the application should
- * open the selected location in the normal way, in a new tab, or in a new
- * window. The sidebar takes care of determining the desired way to open the location,
- * based on the modifier keys that the user is pressing at the time the selection is made.
- *
- * If the application never calls nautilus_gtk_places_sidebar_set_open_flags(), then the sidebar will only
- * use NAUTILUS_GTK_PLACES_OPEN_NORMAL in the NautilusGtkPlacesSidebar::open-location signal. This is the
- * default mode of operation.
- */
-typedef enum {
- NAUTILUS_GTK_PLACES_OPEN_NORMAL = 1 << 0,
- NAUTILUS_GTK_PLACES_OPEN_NEW_TAB = 1 << 1,
- NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW = 1 << 2
-} NautilusGtkPlacesOpenFlags;
-
-GType nautilus_gtk_places_sidebar_get_type (void) G_GNUC_CONST;
-GtkWidget * nautilus_gtk_places_sidebar_new (void);
-
-NautilusGtkPlacesOpenFlags nautilus_gtk_places_sidebar_get_open_flags (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_open_flags (NautilusGtkPlacesSidebar
*sidebar,
- NautilusGtkPlacesOpenFlags flags);
-
-GFile * nautilus_gtk_places_sidebar_get_location (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar
*sidebar,
- GFile *location);
-
-gboolean nautilus_gtk_places_sidebar_get_show_recent (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_show_recent (NautilusGtkPlacesSidebar
*sidebar,
- gboolean show_recent);
-
-gboolean nautilus_gtk_places_sidebar_get_show_desktop (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_show_desktop (NautilusGtkPlacesSidebar
*sidebar,
- gboolean show_desktop);
-
-gboolean nautilus_gtk_places_sidebar_get_show_enter_location (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_show_enter_location (NautilusGtkPlacesSidebar
*sidebar,
- gboolean show_enter_location);
-
-void nautilus_gtk_places_sidebar_add_shortcut (NautilusGtkPlacesSidebar
*sidebar,
- GFile *location);
-void nautilus_gtk_places_sidebar_remove_shortcut (NautilusGtkPlacesSidebar
*sidebar,
- GFile *location);
-GListModel * nautilus_gtk_places_sidebar_get_shortcuts (NautilusGtkPlacesSidebar
*sidebar);
-
-GFile * nautilus_gtk_places_sidebar_get_nth_bookmark (NautilusGtkPlacesSidebar
*sidebar,
- int n);
-void nautilus_gtk_places_sidebar_set_drop_targets_visible (NautilusGtkPlacesSidebar
*sidebar,
- gboolean visible);
-gboolean nautilus_gtk_places_sidebar_get_show_trash (NautilusGtkPlacesSidebar
*sidebar);
-void nautilus_gtk_places_sidebar_set_show_trash (NautilusGtkPlacesSidebar
*sidebar,
- gboolean show_trash);
-
-void nautilus_gtk_places_sidebar_set_show_other_locations (NautilusGtkPlacesSidebar
*sidebar,
- gboolean show_other_locations);
-gboolean nautilus_gtk_places_sidebar_get_show_other_locations (NautilusGtkPlacesSidebar
*sidebar);
-
-void nautilus_gtk_places_sidebar_set_show_starred_location (NautilusGtkPlacesSidebar
*sidebar,
- gboolean
show_starred_location);
-gboolean nautilus_gtk_places_sidebar_get_show_starred_location (NautilusGtkPlacesSidebar
*sidebar);
-
/* Keep order, since it's used for the sort functions */
typedef enum {
- NAUTILUS_GTK_PLACES_SECTION_INVALID,
- NAUTILUS_GTK_PLACES_SECTION_COMPUTER,
- NAUTILUS_GTK_PLACES_SECTION_MOUNTS,
- NAUTILUS_GTK_PLACES_SECTION_CLOUD,
- NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS,
- NAUTILUS_GTK_PLACES_SECTION_OTHER_LOCATIONS,
- NAUTILUS_GTK_PLACES_N_SECTIONS
-} NautilusGtkPlacesSectionType;
+ SECTION_INVALID,
+ SECTION_COMPUTER,
+ SECTION_MOUNTS,
+ SECTION_CLOUD,
+ SECTION_BOOKMARKS,
+ SECTION_OTHER_LOCATIONS,
+ N_SECTIONS
+} NautilusGtkPlacesSidebarSectionType;
typedef enum {
- NAUTILUS_GTK_PLACES_INVALID,
- NAUTILUS_GTK_PLACES_BUILT_IN,
- NAUTILUS_GTK_PLACES_XDG_DIR,
- NAUTILUS_GTK_PLACES_MOUNTED_VOLUME,
- NAUTILUS_GTK_PLACES_BOOKMARK,
- NAUTILUS_GTK_PLACES_HEADING,
- NAUTILUS_GTK_PLACES_CONNECT_TO_SERVER,
- NAUTILUS_GTK_PLACES_ENTER_LOCATION,
- NAUTILUS_GTK_PLACES_DROP_FEEDBACK,
- NAUTILUS_GTK_PLACES_BOOKMARK_PLACEHOLDER,
- NAUTILUS_GTK_PLACES_OTHER_LOCATIONS,
- NAUTILUS_GTK_PLACES_STARRED_LOCATION,
- NAUTILUS_GTK_PLACES_N_PLACES
-} NautilusGtkPlacesPlaceType;
-
-char *nautilus_gtk_places_sidebar_get_location_title (NautilusGtkPlacesSidebar *sidebar);
+ PLACES_INVALID,
+ PLACES_BUILT_IN,
+ PLACES_XDG_DIR,
+ PLACES_MOUNTED_VOLUME,
+ PLACES_BOOKMARK,
+ PLACES_HEADING,
+ PLACES_CONNECT_TO_SERVER,
+ PLACES_ENTER_LOCATION,
+ PLACES_DROP_FEEDBACK,
+ PLACES_BOOKMARK_PLACEHOLDER,
+ PLACES_OTHER_LOCATIONS,
+ PLACES_STARRED_LOCATION,
+ N_PLACES
+} NautilusGtkPlacesSidebarPlaceType;
+
+gchar *nautilus_gtk_places_sidebar_get_location_title (NautilusGtkPlacesSidebar *sidebar);
G_END_DECLS
diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c
index 04fdb9fa4..62505c0e1 100644
--- a/src/gtk/nautilusgtkplacesview.c
+++ b/src/gtk/nautilusgtkplacesview.c
@@ -19,7 +19,6 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "nautilus-enum-types.h"
#include <gio/gio.h>
#include <gio/gvfs.h>
@@ -28,11 +27,14 @@
#include "nautilusgtkplacesviewprivate.h"
#include "nautilusgtkplacesviewrowprivate.h"
-/*< private >
- * NautilusGtkPlacesView:
+/**
+ * SECTION:nautilusgtkplacesview
+ * @Short_description: Widget that displays persistent drives and manages mounted networks
+ * @Title: NautilusGtkPlacesView
+ * @See_also: #GtkFileChooser
*
- * NautilusGtkPlacesView is a widget that displays a list of persistent drives
- * such as harddisk partitions and networks. NautilusGtkPlacesView does not monitor
+ * #NautilusGtkPlacesView is a stock widget that displays a list of persistent drives
+ * such as harddisk partitions and networks. #NautilusGtkPlacesView does not monitor
* removable devices.
*
* The places view displays drives and networks, and will automatically mount
@@ -41,27 +43,12 @@
* shown at the network list.
*
* To make use of the places view, an application at least needs to connect
- * to the NautilusGtkPlacesView::open-location signal. This is emitted when the user
+ * to the #NautilusGtkPlacesView::open-location signal. This is emitted when the user
* selects a location to open in the view.
*/
-struct _NautilusGtkPlacesViewClass
+struct _NautilusGtkPlacesViewPrivate
{
- GtkBoxClass parent_class;
-
- void (* open_location) (NautilusGtkPlacesView *view,
- GFile *location,
- NautilusGtkPlacesOpenFlags open_flags);
-
- void (* show_error_message) (NautilusGtkPlacesSidebar *sidebar,
- const char *primary,
- const char *secondary);
-};
-
-struct _NautilusGtkPlacesView
-{
- GtkBox parent_instance;
-
GVolumeMonitor *volume_monitor;
NautilusGtkPlacesOpenFlags open_flags;
NautilusGtkPlacesOpenFlags current_open_flags;
@@ -72,7 +59,7 @@ struct _NautilusGtkPlacesView
GCancellable *cancellable;
- char *search_query;
+ gchar *search_query;
GtkWidget *actionbar;
GtkWidget *address_entry;
@@ -96,8 +83,7 @@ struct _NautilusGtkPlacesView
GCancellable *networks_fetching_cancellable;
- NautilusGtkPlacesViewRow *row_for_action;
-
+ guint local_only : 1;
guint should_open_location : 1;
guint should_pulse_entry : 1;
guint entry_pulse_timeout_id;
@@ -112,18 +98,13 @@ struct _NautilusGtkPlacesView
static void mount_volume (NautilusGtkPlacesView *view,
GVolume *volume);
+static gboolean on_button_press_event (NautilusGtkPlacesViewRow *row,
+ GdkEventButton *event);
+
static void on_eject_button_clicked (GtkWidget *widget,
NautilusGtkPlacesViewRow *row);
-static gboolean on_row_popup_menu (GtkWidget *widget,
- GVariant *args,
- gpointer user_data);
-
-static void click_cb (GtkGesture *gesture,
- int n_press,
- double x,
- double y,
- gpointer user_data);
+static gboolean on_row_popup_menu (NautilusGtkPlacesViewRow *row);
static void populate_servers (NautilusGtkPlacesView *view);
@@ -137,11 +118,12 @@ static void nautilus_gtk_places_view_set_loading (Nauti
static void update_loading (NautilusGtkPlacesView *view);
-G_DEFINE_TYPE (NautilusGtkPlacesView, nautilus_gtk_places_view, GTK_TYPE_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (NautilusGtkPlacesView, nautilus_gtk_places_view, GTK_TYPE_BOX)
/* NautilusGtkPlacesView properties & signals */
enum {
PROP_0,
+ PROP_LOCAL_ONLY,
PROP_OPEN_FLAGS,
PROP_FETCHING_NETWORKS,
PROP_LOADING,
@@ -154,7 +136,7 @@ enum {
LAST_SIGNAL
};
-const char *unsupported_protocols [] =
+const gchar *unsupported_protocols [] =
{
"file", "afc", "obex", "http",
"trash", "burn", "computer",
@@ -170,7 +152,11 @@ emit_open_location (NautilusGtkPlacesView *view,
GFile *location,
NautilusGtkPlacesOpenFlags open_flags)
{
- if ((open_flags & view->open_flags) == 0)
+ NautilusGtkPlacesViewPrivate *priv;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if ((open_flags & priv->open_flags) == 0)
open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
g_signal_emit (view, places_view_signals[OPEN_LOCATION], 0, location, open_flags);
@@ -178,8 +164,8 @@ emit_open_location (NautilusGtkPlacesView *view,
static void
emit_show_error_message (NautilusGtkPlacesView *view,
- char *primary_message,
- char *secondary_message)
+ gchar *primary_message,
+ gchar *secondary_message)
{
g_signal_emit (view, places_view_signals[SHOW_ERROR_MESSAGE],
0, primary_message, secondary_message);
@@ -194,13 +180,15 @@ server_file_changed_cb (NautilusGtkPlacesView *view)
static GBookmarkFile *
server_list_load (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
GBookmarkFile *bookmarks;
GError *error = NULL;
- char *datadir;
- char *filename;
+ gchar *datadir;
+ gchar *filename;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
bookmarks = g_bookmark_file_new ();
- datadir = g_build_filename (g_get_user_config_dir (), "gtk-4.0", NULL);
+ datadir = g_build_filename (g_get_user_config_dir (), "gtk-3.0", NULL);
filename = g_build_filename (datadir, "servers", NULL);
g_mkdir_with_parents (datadir, 0700);
@@ -219,13 +207,13 @@ server_list_load (NautilusGtkPlacesView *view)
}
/* Monitor the file in case it's modified outside this code */
- if (!view->server_list_monitor)
+ if (!priv->server_list_monitor)
{
- view->server_list_file = g_file_new_for_path (filename);
+ priv->server_list_file = g_file_new_for_path (filename);
- if (view->server_list_file)
+ if (priv->server_list_file)
{
- view->server_list_monitor = g_file_monitor_file (view->server_list_file,
+ priv->server_list_monitor = g_file_monitor_file (priv->server_list_file,
G_FILE_MONITOR_NONE,
NULL,
&error);
@@ -237,14 +225,14 @@ server_list_load (NautilusGtkPlacesView *view)
}
else
{
- g_signal_connect_swapped (view->server_list_monitor,
+ g_signal_connect_swapped (priv->server_list_monitor,
"changed",
G_CALLBACK (server_file_changed_cb),
view);
}
}
- g_clear_object (&view->server_list_file);
+ g_clear_object (&priv->server_list_file);
}
g_free (datadir);
@@ -256,9 +244,9 @@ server_list_load (NautilusGtkPlacesView *view)
static void
server_list_save (GBookmarkFile *bookmarks)
{
- char *filename;
+ gchar *filename;
- filename = g_build_filename (g_get_user_config_dir (), "gtk-4.0", "servers", NULL);
+ filename = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "servers", NULL);
g_bookmark_file_to_file (bookmarks, filename, NULL);
g_free (filename);
}
@@ -270,9 +258,8 @@ server_list_add_server (NautilusGtkPlacesView *view,
GBookmarkFile *bookmarks;
GFileInfo *info;
GError *error;
- char *title;
- char *uri;
- GDateTime *now;
+ gchar *title;
+ gchar *uri;
error = NULL;
bookmarks = server_list_load (view);
@@ -290,9 +277,7 @@ server_list_add_server (NautilusGtkPlacesView *view,
title = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
g_bookmark_file_set_title (bookmarks, uri, title);
- now = g_date_time_new_now_utc ();
- g_bookmark_file_set_visited_date_time (bookmarks, uri, now);
- g_date_time_unref (now);
+ g_bookmark_file_set_visited (bookmarks, uri, -1);
g_bookmark_file_add_application (bookmarks, uri, NULL, NULL);
server_list_save (bookmarks);
@@ -305,7 +290,7 @@ server_list_add_server (NautilusGtkPlacesView *view,
static void
server_list_remove_server (NautilusGtkPlacesView *view,
- const char *uri)
+ const gchar *uri)
{
GBookmarkFile *bookmarks;
@@ -326,11 +311,11 @@ get_toplevel (GtkWidget *widget)
{
GtkWidget *toplevel;
- toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
- if (GTK_IS_WINDOW (toplevel))
- return GTK_WINDOW (toplevel);
- else
+ toplevel = gtk_widget_get_toplevel (widget);
+ if (!gtk_widget_is_toplevel (toplevel))
return NULL;
+ else
+ return GTK_WINDOW (toplevel);
}
static void
@@ -339,16 +324,26 @@ set_busy_cursor (NautilusGtkPlacesView *view,
{
GtkWidget *widget;
GtkWindow *toplevel;
+ GdkDisplay *display;
+ GdkCursor *cursor;
toplevel = get_toplevel (GTK_WIDGET (view));
widget = GTK_WIDGET (toplevel);
if (!toplevel || !gtk_widget_get_realized (widget))
return;
+ display = gtk_widget_get_display (widget);
+
if (busy)
- gtk_widget_set_cursor_from_name (widget, "progress");
+ cursor = gdk_cursor_new_from_name (display, "progress");
else
- gtk_widget_set_cursor (widget, NULL);
+ cursor = NULL;
+
+ gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
+ gdk_display_flush (display);
+
+ if (cursor)
+ g_object_unref (cursor);
}
/* Activates the given row, with the given flags as parameter */
@@ -357,10 +352,12 @@ activate_row (NautilusGtkPlacesView *view,
NautilusGtkPlacesViewRow *row,
NautilusGtkPlacesOpenFlags flags)
{
+ NautilusGtkPlacesViewPrivate *priv;
GVolume *volume;
GMount *mount;
GFile *file;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
mount = nautilus_gtk_places_view_row_get_mount (row);
volume = nautilus_gtk_places_view_row_get_volume (row);
file = nautilus_gtk_places_view_row_get_file (row);
@@ -383,7 +380,7 @@ activate_row (NautilusGtkPlacesView *view,
* When the row is activated, the unmounted volume shall
* be mounted and opened right after.
*/
- view->should_open_location = TRUE;
+ priv->should_open_location = TRUE;
nautilus_gtk_places_view_row_set_busy (row, TRUE);
mount_volume (view, volume);
@@ -393,46 +390,47 @@ activate_row (NautilusGtkPlacesView *view,
static void update_places (NautilusGtkPlacesView *view);
static void
-nautilus_gtk_places_view_finalize (GObject *object)
+nautilus_gtk_places_view_destroy (GtkWidget *widget)
{
- NautilusGtkPlacesView *view = (NautilusGtkPlacesView *)object;
+ NautilusGtkPlacesView *self = NAUTILUS_GTK_PLACES_VIEW (widget);
+ NautilusGtkPlacesViewPrivate *priv = nautilus_gtk_places_view_get_instance_private (self);
- if (view->entry_pulse_timeout_id > 0)
- g_source_remove (view->entry_pulse_timeout_id);
+ priv->destroyed = 1;
- g_clear_pointer (&view->search_query, g_free);
- g_clear_object (&view->server_list_file);
- g_clear_object (&view->server_list_monitor);
- g_clear_object (&view->volume_monitor);
- g_clear_object (&view->network_monitor);
- g_clear_object (&view->cancellable);
- g_clear_object (&view->networks_fetching_cancellable);
- g_clear_object (&view->path_size_group);
- g_clear_object (&view->space_size_group);
+ g_signal_handlers_disconnect_by_func (priv->volume_monitor, update_places, widget);
- G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->finalize (object);
-}
+ if (priv->network_monitor)
+ g_signal_handlers_disconnect_by_func (priv->network_monitor, update_places, widget);
-static void
-nautilus_gtk_places_view_dispose (GObject *object)
-{
- NautilusGtkPlacesView *view = (NautilusGtkPlacesView *)object;
+ if (priv->server_list_monitor)
+ g_signal_handlers_disconnect_by_func (priv->server_list_monitor, server_file_changed_cb, widget);
- view->destroyed = 1;
+ g_cancellable_cancel (priv->cancellable);
+ g_cancellable_cancel (priv->networks_fetching_cancellable);
- g_signal_handlers_disconnect_by_func (view->volume_monitor, update_places, object);
+ GTK_WIDGET_CLASS (nautilus_gtk_places_view_parent_class)->destroy (widget);
+}
- if (view->network_monitor)
- g_signal_handlers_disconnect_by_func (view->network_monitor, update_places, object);
+static void
+nautilus_gtk_places_view_finalize (GObject *object)
+{
+ NautilusGtkPlacesView *self = (NautilusGtkPlacesView *)object;
+ NautilusGtkPlacesViewPrivate *priv = nautilus_gtk_places_view_get_instance_private (self);
- if (view->server_list_monitor)
- g_signal_handlers_disconnect_by_func (view->server_list_monitor, server_file_changed_cb, object);
+ if (priv->entry_pulse_timeout_id > 0)
+ g_source_remove (priv->entry_pulse_timeout_id);
- g_cancellable_cancel (view->cancellable);
- g_cancellable_cancel (view->networks_fetching_cancellable);
- g_clear_pointer (&view->popup_menu, gtk_widget_unparent);
+ g_clear_pointer (&priv->search_query, g_free);
+ g_clear_object (&priv->server_list_file);
+ g_clear_object (&priv->server_list_monitor);
+ g_clear_object (&priv->volume_monitor);
+ g_clear_object (&priv->network_monitor);
+ g_clear_object (&priv->cancellable);
+ g_clear_object (&priv->networks_fetching_cancellable);
+ g_clear_object (&priv->path_size_group);
+ g_clear_object (&priv->space_size_group);
- G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->dispose (object);
+ G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->finalize (object);
}
static void
@@ -445,12 +443,12 @@ nautilus_gtk_places_view_get_property (GObject *object,
switch (prop_id)
{
- case PROP_LOADING:
- g_value_set_boolean (value, nautilus_gtk_places_view_get_loading (self));
+ case PROP_LOCAL_ONLY:
+ g_value_set_boolean (value, nautilus_gtk_places_view_get_local_only (self));
break;
- case PROP_OPEN_FLAGS:
- g_value_set_flags (value, nautilus_gtk_places_view_get_open_flags (self));
+ case PROP_LOADING:
+ g_value_set_boolean (value, nautilus_gtk_places_view_get_loading (self));
break;
case PROP_FETCHING_NETWORKS:
@@ -472,8 +470,8 @@ nautilus_gtk_places_view_set_property (GObject *object,
switch (prop_id)
{
- case PROP_OPEN_FLAGS:
- nautilus_gtk_places_view_set_open_flags (self, g_value_get_flags (value));
+ case PROP_LOCAL_ONLY:
+ nautilus_gtk_places_view_set_local_only (self, g_value_get_boolean (value));
break;
default:
@@ -486,7 +484,7 @@ is_external_volume (GVolume *volume)
{
gboolean is_external;
GDrive *drive;
- char *id;
+ gchar *id;
drive = g_volume_get_drive (volume);
id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
@@ -507,7 +505,7 @@ is_external_volume (GVolume *volume)
typedef struct
{
- char *uri;
+ gchar *uri;
NautilusGtkPlacesView *view;
} RemoveServerData;
@@ -522,12 +520,14 @@ on_remove_server_button_clicked (RemoveServerData *data)
static void
populate_servers (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
GBookmarkFile *server_list;
- GtkWidget *child;
- char **uris;
+ GList *children;
+ gchar **uris;
gsize num_uris;
- int i;
+ gint i;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
server_list = server_list_load (view);
if (!server_list)
@@ -535,7 +535,7 @@ populate_servers (NautilusGtkPlacesView *view)
uris = g_bookmark_file_get_uris (server_list, &num_uris);
- gtk_stack_set_visible_child_name (GTK_STACK (view->recent_servers_stack),
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->recent_servers_stack),
num_uris > 0 ? "list" : "empty");
if (!uris)
@@ -545,10 +545,10 @@ populate_servers (NautilusGtkPlacesView *view)
}
/* clear previous items */
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->recent_servers_listbox))))
- gtk_list_box_remove (GTK_LIST_BOX (view->recent_servers_listbox), child);
+ children = gtk_container_get_children (GTK_CONTAINER (priv->recent_servers_listbox));
+ g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
- gtk_list_store_clear (view->completion_store);
+ gtk_list_store_clear (priv->completion_store);
for (i = 0; i < num_uris; i++)
{
@@ -558,15 +558,15 @@ populate_servers (NautilusGtkPlacesView *view)
GtkWidget *grid;
GtkWidget *button;
GtkWidget *label;
- char *name;
- char *dup_uri;
+ gchar *name;
+ gchar *dup_uri;
name = g_bookmark_file_get_title (server_list, uris[i], NULL);
dup_uri = g_strdup (uris[i]);
/* add to the completion list */
- gtk_list_store_append (view->completion_store, &iter);
- gtk_list_store_set (view->completion_store,
+ gtk_list_store_append (priv->completion_store, &iter);
+ gtk_list_store_set (priv->completion_store,
&iter,
0, name,
1, uris[i],
@@ -577,6 +577,7 @@ populate_servers (NautilusGtkPlacesView *view)
grid = g_object_new (GTK_TYPE_GRID,
"orientation", GTK_ORIENTATION_VERTICAL,
+ "border-width", 3,
NULL);
/* name of the connected uri, if any */
@@ -584,26 +585,26 @@ populate_servers (NautilusGtkPlacesView *view)
gtk_widget_set_hexpand (label, TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
+ gtk_container_add (GTK_CONTAINER (grid), label);
/* the uri itself */
label = gtk_label_new (uris[i]);
gtk_widget_set_hexpand (label, TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_widget_add_css_class (label, "dim-label");
- gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
+ gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
+ gtk_container_add (GTK_CONTAINER (grid), label);
/* remove button */
- button = gtk_button_new_from_icon_name ("window-close-symbolic");
+ button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
- gtk_widget_add_css_class (button, "sidebar-button");
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (button), "sidebar-button");
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2);
- gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid);
- gtk_list_box_insert (GTK_LIST_BOX (view->recent_servers_listbox), row, -1);
+ gtk_container_add (GTK_CONTAINER (row), grid);
+ gtk_container_add (GTK_CONTAINER (priv->recent_servers_listbox), row);
/* custom data */
data = g_new0 (RemoveServerData, 1);
@@ -618,6 +619,8 @@ populate_servers (NautilusGtkPlacesView *view)
G_CALLBACK (on_remove_server_button_clicked),
data);
+ gtk_widget_show_all (row);
+
g_free (name);
}
@@ -628,33 +631,38 @@ populate_servers (NautilusGtkPlacesView *view)
static void
update_view_mode (NautilusGtkPlacesView *view)
{
- GtkWidget *child;
+ NautilusGtkPlacesViewPrivate *priv;
+ GList *children;
+ GList *l;
gboolean show_listbox;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
show_listbox = FALSE;
/* drives */
- for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox));
- child != NULL;
- child = gtk_widget_get_next_sibling (child))
+ children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
+
+ for (l = children; l; l = l->next)
{
/* GtkListBox filter rows by changing their GtkWidget::child-visible property */
- if (gtk_widget_get_child_visible (child))
+ if (gtk_widget_get_child_visible (l->data))
{
show_listbox = TRUE;
break;
}
}
+ g_list_free (children);
+
if (!show_listbox &&
- view->search_query &&
- view->search_query[0] != '\0')
+ priv->search_query &&
+ priv->search_query[0] != '\0')
{
- gtk_stack_set_visible_child_name (GTK_STACK (view->stack), "empty-search");
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "empty-search");
}
else
{
- gtk_stack_set_visible_child_name (GTK_STACK (view->stack), "browse");
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "browse");
}
}
@@ -663,36 +671,31 @@ insert_row (NautilusGtkPlacesView *view,
GtkWidget *row,
gboolean is_network)
{
- GtkEventController *controller;
- GtkShortcutTrigger *trigger;
- GtkShortcutAction *action;
- GtkShortcut *shortcut;
- GtkGesture *gesture;
+ NautilusGtkPlacesViewPrivate *priv;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
g_object_set_data (G_OBJECT (row), "is-network", GINT_TO_POINTER (is_network));
- controller = gtk_shortcut_controller_new ();
- trigger = gtk_alternative_trigger_new (gtk_keyval_trigger_new (GDK_KEY_F10, GDK_SHIFT_MASK),
- gtk_keyval_trigger_new (GDK_KEY_Menu, 0));
- action = gtk_callback_action_new (on_row_popup_menu, row, NULL);
- shortcut = gtk_shortcut_new (trigger, action);
- gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
- gtk_widget_add_controller (GTK_WIDGET (row), controller);
+ g_signal_connect_swapped (nautilus_gtk_places_view_row_get_event_box (NAUTILUS_GTK_PLACES_VIEW_ROW (row)),
+ "button-press-event",
+ G_CALLBACK (on_button_press_event),
+ row);
- gesture = gtk_gesture_click_new ();
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
- g_signal_connect (gesture, "pressed", G_CALLBACK (click_cb), row);
- gtk_widget_add_controller (row, GTK_EVENT_CONTROLLER (gesture));
+ g_signal_connect (row,
+ "popup-menu",
+ G_CALLBACK (on_row_popup_menu),
+ row);
g_signal_connect (nautilus_gtk_places_view_row_get_eject_button (NAUTILUS_GTK_PLACES_VIEW_ROW (row)),
"clicked",
G_CALLBACK (on_eject_button_clicked),
row);
- nautilus_gtk_places_view_row_set_path_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row),
view->path_size_group);
- nautilus_gtk_places_view_row_set_space_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row),
view->space_size_group);
+ nautilus_gtk_places_view_row_set_path_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row),
priv->path_size_group);
+ nautilus_gtk_places_view_row_set_space_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row),
priv->space_size_group);
- gtk_list_box_insert (GTK_LIST_BOX (view->listbox), row, -1);
+ gtk_container_add (GTK_CONTAINER (priv->listbox), row);
}
static void
@@ -703,9 +706,9 @@ add_volume (NautilusGtkPlacesView *view,
GMount *mount;
GFile *root;
GIcon *icon;
- char *identifier;
- char *name;
- char *path;
+ gchar *identifier;
+ gchar *name;
+ gchar *path;
if (is_external_volume (volume))
return;
@@ -751,10 +754,10 @@ add_mount (NautilusGtkPlacesView *view,
gboolean is_network;
GFile *root;
GIcon *icon;
- char *name;
- char *path;
- char *uri;
- char *schema;
+ gchar *name;
+ gchar *path;
+ gchar *uri;
+ gchar *schema;
icon = g_mount_get_icon (mount);
name = g_mount_get_name (mount);
@@ -811,8 +814,8 @@ static void
add_file (NautilusGtkPlacesView *view,
GFile *file,
GIcon *icon,
- const char *display_name,
- const char *path,
+ const gchar *display_name,
+ const gchar *path,
gboolean is_network)
{
GtkWidget *row;
@@ -832,46 +835,55 @@ add_file (NautilusGtkPlacesView *view,
static gboolean
has_networks (NautilusGtkPlacesView *view)
{
- GtkWidget *child;
+ GList *l;
+ NautilusGtkPlacesViewPrivate *priv;
+ GList *children;
gboolean has_network = FALSE;
- for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox));
- child != NULL;
- child = gtk_widget_get_next_sibling (child))
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
+ for (l = children; l != NULL; l = l->next)
{
- if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-network")) &&
- g_object_get_data (G_OBJECT (child), "is-placeholder") == NULL)
+ if (GPOINTER_TO_INT (g_object_get_data (l->data, "is-network")) == TRUE &&
+ g_object_get_data (l->data, "is-placeholder") == NULL)
{
has_network = TRUE;
break;
}
}
+ g_list_free (children);
+
return has_network;
}
static void
update_network_state (NautilusGtkPlacesView *view)
{
- if (view->network_placeholder == NULL)
+ NautilusGtkPlacesViewPrivate *priv;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->network_placeholder == NULL)
{
- view->network_placeholder = gtk_list_box_row_new ();
- view->network_placeholder_label = gtk_label_new ("");
- gtk_label_set_xalign (GTK_LABEL (view->network_placeholder_label), 0.0);
- gtk_widget_set_margin_start (view->network_placeholder_label, 12);
- gtk_widget_set_margin_end (view->network_placeholder_label, 12);
- gtk_widget_set_margin_top (view->network_placeholder_label, 6);
- gtk_widget_set_margin_bottom (view->network_placeholder_label, 6);
- gtk_widget_set_hexpand (view->network_placeholder_label, TRUE);
- gtk_widget_set_sensitive (view->network_placeholder, FALSE);
- gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (view->network_placeholder),
- view->network_placeholder_label);
- g_object_set_data (G_OBJECT (view->network_placeholder),
+ priv->network_placeholder = gtk_list_box_row_new ();
+ priv->network_placeholder_label = gtk_label_new ("");
+ gtk_label_set_xalign (GTK_LABEL (priv->network_placeholder_label), 0.0);
+ gtk_widget_set_margin_start (priv->network_placeholder_label, 12);
+ gtk_widget_set_margin_end (priv->network_placeholder_label, 12);
+ gtk_widget_set_margin_top (priv->network_placeholder_label, 6);
+ gtk_widget_set_margin_bottom (priv->network_placeholder_label, 6);
+ gtk_widget_set_hexpand (priv->network_placeholder_label, TRUE);
+ gtk_widget_set_sensitive (priv->network_placeholder, FALSE);
+ gtk_container_add (GTK_CONTAINER (priv->network_placeholder),
+ priv->network_placeholder_label);
+ g_object_set_data (G_OBJECT (priv->network_placeholder),
"is-network", GINT_TO_POINTER (TRUE));
/* mark the row as placeholder, so it always goes first */
- g_object_set_data (G_OBJECT (view->network_placeholder),
+ g_object_set_data (G_OBJECT (priv->network_placeholder),
"is-placeholder", GINT_TO_POINTER (TRUE));
- gtk_list_box_insert (GTK_LIST_BOX (view->listbox), view->network_placeholder, -1);
+ gtk_container_add (GTK_CONTAINER (priv->listbox), priv->network_placeholder);
}
if (nautilus_gtk_places_view_get_fetching_networks (view))
@@ -880,35 +892,38 @@ update_network_state (NautilusGtkPlacesView *view)
* otherwise just show the spinner in the header */
if (!has_networks (view))
{
- gtk_widget_show (view->network_placeholder);
- gtk_label_set_text (GTK_LABEL (view->network_placeholder_label),
+ gtk_widget_show_all (priv->network_placeholder);
+ gtk_label_set_text (GTK_LABEL (priv->network_placeholder_label),
_("Searching for network locations"));
}
}
else if (!has_networks (view))
{
- gtk_widget_show (view->network_placeholder);
- gtk_label_set_text (GTK_LABEL (view->network_placeholder_label),
+ gtk_widget_show_all (priv->network_placeholder);
+ gtk_label_set_text (GTK_LABEL (priv->network_placeholder_label),
_("No network locations found"));
}
else
{
- gtk_widget_hide (view->network_placeholder);
+ gtk_widget_hide (priv->network_placeholder);
}
}
static void
-monitor_network (NautilusGtkPlacesView *view)
+monitor_network (NautilusGtkPlacesView *self)
{
+ NautilusGtkPlacesViewPrivate *priv;
GFile *network_file;
GError *error;
- if (view->network_monitor)
+ priv = nautilus_gtk_places_view_get_instance_private (self);
+
+ if (priv->network_monitor)
return;
error = NULL;
network_file = g_file_new_for_uri ("network:///");
- view->network_monitor = g_file_monitor (network_file,
+ priv->network_monitor = g_file_monitor (network_file,
G_FILE_MONITOR_NONE,
NULL,
&error);
@@ -922,10 +937,10 @@ monitor_network (NautilusGtkPlacesView *view)
return;
}
- g_signal_connect_swapped (view->network_monitor,
+ g_signal_connect_swapped (priv->network_monitor,
"changed",
G_CALLBACK (update_places),
- view);
+ self);
}
static void
@@ -936,10 +951,10 @@ populate_networks (NautilusGtkPlacesView *view,
GList *l;
GFile *file;
GFile *activatable_file;
- char *uri;
+ gchar *uri;
GFileType type;
GIcon *icon;
- char *display_name;
+ gchar *display_name;
for (l = detected_networks; l != NULL; l = l->next)
{
@@ -967,11 +982,13 @@ network_enumeration_next_files_finished (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
+ NautilusGtkPlacesViewPrivate *priv;
NautilusGtkPlacesView *view;
GList *detected_networks;
GError *error;
view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ priv = nautilus_gtk_places_view_get_instance_private (view);
error = NULL;
detected_networks = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source_object),
@@ -979,14 +996,9 @@ network_enumeration_next_files_finished (GObject *source_object,
if (error)
{
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- {
- g_clear_error (&error);
- g_object_unref (view);
- return;
- }
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Failed to fetch network locations: %s", error->message);
- g_warning ("Failed to fetch network locations: %s", error->message);
g_clear_error (&error);
}
else
@@ -997,11 +1009,16 @@ network_enumeration_next_files_finished (GObject *source_object,
g_list_free_full (detected_networks, g_object_unref);
}
- update_network_state (view);
- monitor_network (view);
- update_loading (view);
-
g_object_unref (view);
+
+ /* avoid to update widgets if we are already destroyed
+ (and got cancelled s a result of that) */
+ if (!priv->destroyed)
+ {
+ update_network_state (view);
+ monitor_network (view);
+ update_loading (view);
+ }
}
static void
@@ -1009,7 +1026,7 @@ network_enumeration_finished (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ NautilusGtkPlacesViewPrivate *priv;
GFileEnumerator *enumerator;
GError *error;
@@ -1023,14 +1040,15 @@ network_enumeration_finished (GObject *source_object,
g_warning ("Failed to fetch network locations: %s", error->message);
g_clear_error (&error);
- g_object_unref (view);
+ g_object_unref (NAUTILUS_GTK_PLACES_VIEW (user_data));
}
else
{
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data));
g_file_enumerator_next_files_async (enumerator,
G_MAXINT32,
G_PRIORITY_DEFAULT,
- view->networks_fetching_cancellable,
+ priv->networks_fetching_cancellable,
network_enumeration_next_files_finished,
user_data);
g_object_unref (enumerator);
@@ -1040,10 +1058,12 @@ network_enumeration_finished (GObject *source_object,
static void
fetch_networks (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
GFile *network_file;
- const char * const *supported_uris;
+ const gchar * const *supported_uris;
gboolean found;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
supported_uris = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
for (found = FALSE; !found && supported_uris && supported_uris[0]; supported_uris++)
@@ -1055,9 +1075,9 @@ fetch_networks (NautilusGtkPlacesView *view)
network_file = g_file_new_for_uri ("network:///");
- g_cancellable_cancel (view->networks_fetching_cancellable);
- g_clear_object (&view->networks_fetching_cancellable);
- view->networks_fetching_cancellable = g_cancellable_new ();
+ g_cancellable_cancel (priv->networks_fetching_cancellable);
+ g_clear_object (&priv->networks_fetching_cancellable);
+ priv->networks_fetching_cancellable = g_cancellable_new ();
nautilus_gtk_places_view_set_fetching_networks (view, TRUE);
update_network_state (view);
@@ -1066,7 +1086,7 @@ fetch_networks (NautilusGtkPlacesView *view)
"standard::type,standard::target-uri,standard::name,standard::display-name,standard::icon",
G_FILE_QUERY_INFO_NONE,
G_PRIORITY_DEFAULT,
- view->networks_fetching_cancellable,
+ priv->networks_fetching_cancellable,
network_enumeration_finished,
view);
@@ -1076,19 +1096,21 @@ fetch_networks (NautilusGtkPlacesView *view)
static void
update_places (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
+ GList *children;
GList *mounts;
GList *volumes;
GList *drives;
GList *l;
GIcon *icon;
GFile *file;
- GtkWidget *child;
- /* Clear all previously added items */
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox))))
- gtk_list_box_remove (GTK_LIST_BOX (view->listbox), child);
+ priv = nautilus_gtk_places_view_get_instance_private (view);
- view->network_placeholder = NULL;
+ /* Clear all previously added items */
+ children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
+ g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
+ priv->network_placeholder = NULL;
/* Inform clients that we started loading */
nautilus_gtk_places_view_set_loading (view, TRUE);
@@ -1102,7 +1124,7 @@ update_places (NautilusGtkPlacesView *view)
g_clear_object (&icon);
/* Add currently connected drives */
- drives = g_volume_monitor_get_connected_drives (view->volume_monitor);
+ drives = g_volume_monitor_get_connected_drives (priv->volume_monitor);
for (l = drives; l != NULL; l = l->next)
add_drive (view, l->data);
@@ -1114,7 +1136,7 @@ update_places (NautilusGtkPlacesView *view)
* add_drive before, add all volumes that aren't associated with a
* drive.
*/
- volumes = g_volume_monitor_get_volumes (view->volume_monitor);
+ volumes = g_volume_monitor_get_volumes (priv->volume_monitor);
for (l = volumes; l != NULL; l = l->next)
{
@@ -1139,7 +1161,7 @@ update_places (NautilusGtkPlacesView *view)
* Now that all necessary drives and volumes were already added, add mounts
* that have no volume, such as /etc/mtab mounts, ftp, sftp, etc.
*/
- mounts = g_volume_monitor_get_mounts (view->volume_monitor);
+ mounts = g_volume_monitor_get_mounts (priv->volume_monitor);
for (l = mounts; l != NULL; l = l->next)
{
@@ -1176,7 +1198,8 @@ server_mount_ready_cb (GObject *source_file,
GAsyncResult *res,
gpointer user_data)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ NautilusGtkPlacesViewPrivate *priv;
+ NautilusGtkPlacesView *view;
gboolean should_show;
GError *error;
GFile *location;
@@ -1185,6 +1208,8 @@ server_mount_ready_cb (GObject *source_file,
should_show = TRUE;
error = NULL;
+ view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+
g_file_mount_enclosing_volume_finish (location, res, &error);
if (error)
{
@@ -1211,19 +1236,19 @@ server_mount_ready_cb (GObject *source_file,
g_clear_error (&error);
}
- if (view->destroyed)
- {
- g_object_unref (view);
- return;
- }
+ priv = nautilus_gtk_places_view_get_instance_private (view);
- view->should_pulse_entry = FALSE;
- gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0);
+ if (priv->destroyed) {
+ g_object_unref (view);
+ return;
+ }
+
+ priv->should_pulse_entry = FALSE;
/* Restore from Cancel to Connect */
- gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Con_nect"));
- gtk_widget_set_sensitive (view->address_entry, TRUE);
- view->connecting_to_server = FALSE;
+ gtk_button_set_label (GTK_BUTTON (priv->connect_button), _("Con_nect"));
+ gtk_widget_set_sensitive (priv->address_entry, TRUE);
+ priv->connecting_to_server = FALSE;
if (should_show)
{
@@ -1234,9 +1259,9 @@ server_mount_ready_cb (GObject *source_file,
* Otherwise, the user would lost the typed address even if it fails
* to connect.
*/
- gtk_editable_set_text (GTK_EDITABLE (view->address_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), "");
- if (view->should_open_location)
+ if (priv->should_open_location)
{
GMount *mount;
GFile *root;
@@ -1246,19 +1271,19 @@ server_mount_ready_cb (GObject *source_file,
* invisible, which happens e.g for smb-browse, but the location
* should be opened anyway...
*/
- mount = g_file_find_enclosing_mount (location, view->cancellable, NULL);
+ mount = g_file_find_enclosing_mount (location, priv->cancellable, NULL);
if (mount)
{
root = g_mount_get_default_location (mount);
- emit_open_location (view, root, view->open_flags);
+ emit_open_location (view, root, priv->open_flags);
g_object_unref (root);
g_object_unref (mount);
}
else
{
- emit_open_location (view, location, view->open_flags);
+ emit_open_location (view, location, priv->open_flags);
}
}
}
@@ -1272,7 +1297,8 @@ volume_mount_ready_cb (GObject *source_volume,
GAsyncResult *res,
gpointer user_data)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ NautilusGtkPlacesViewPrivate *priv;
+ NautilusGtkPlacesView *view;
gboolean should_show;
GVolume *volume;
GError *error;
@@ -1309,13 +1335,16 @@ volume_mount_ready_cb (GObject *source_volume,
g_clear_error (&error);
}
- if (view->destroyed)
+ view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->destroyed)
{
g_object_unref(view);
return;
}
- view->mounting_volume = FALSE;
+ priv->mounting_volume = FALSE;
update_loading (view);
if (should_show)
@@ -1326,8 +1355,8 @@ volume_mount_ready_cb (GObject *source_volume,
mount = g_volume_get_mount (volume);
root = g_mount_get_default_location (mount);
- if (view->should_open_location)
- emit_open_location (NAUTILUS_GTK_PLACES_VIEW (user_data), root, view->open_flags);
+ if (priv->should_open_location)
+ emit_open_location (NAUTILUS_GTK_PLACES_VIEW (user_data), root, priv->open_flags);
g_object_unref (mount);
g_object_unref (root);
@@ -1343,6 +1372,7 @@ unmount_ready_cb (GObject *source_mount,
gpointer user_data)
{
NautilusGtkPlacesView *view;
+ NautilusGtkPlacesViewPrivate *priv;
GMount *mount;
GError *error;
@@ -1365,12 +1395,14 @@ unmount_ready_cb (GObject *source_mount,
g_clear_error (&error);
}
- if (view->destroyed) {
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->destroyed) {
g_object_unref (view);
return;
}
- view->unmounting_mount = FALSE;
+ priv->unmounting_mount = FALSE;
update_loading (view);
g_object_unref (view);
@@ -1379,24 +1411,27 @@ unmount_ready_cb (GObject *source_mount,
static gboolean
pulse_entry_cb (gpointer user_data)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ NautilusGtkPlacesViewPrivate *priv;
- if (view->destroyed)
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data));
+
+ if (priv->destroyed)
{
- view->entry_pulse_timeout_id = 0;
+ priv->entry_pulse_timeout_id = 0;
return G_SOURCE_REMOVE;
}
- else if (view->should_pulse_entry)
+ else if (priv->should_pulse_entry)
{
- gtk_entry_progress_pulse (GTK_ENTRY (view->address_entry));
+ gtk_entry_progress_pulse (GTK_ENTRY (priv->address_entry));
return G_SOURCE_CONTINUE;
}
else
{
- gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0);
- view->entry_pulse_timeout_id = 0;
+ gtk_entry_set_progress_pulse_step (GTK_ENTRY (priv->address_entry), 0.0);
+ gtk_entry_set_progress_fraction (GTK_ENTRY (priv->address_entry), 0.0);
+ priv->entry_pulse_timeout_id = 0;
return G_SOURCE_REMOVE;
}
@@ -1406,16 +1441,18 @@ static void
unmount_mount (NautilusGtkPlacesView *view,
GMount *mount)
{
+ NautilusGtkPlacesViewPrivate *priv;
GMountOperation *operation;
GtkWidget *toplevel;
- toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
- g_cancellable_cancel (view->cancellable);
- g_clear_object (&view->cancellable);
- view->cancellable = g_cancellable_new ();
+ g_cancellable_cancel (priv->cancellable);
+ g_clear_object (&priv->cancellable);
+ priv->cancellable = g_cancellable_new ();
- view->unmounting_mount = TRUE;
+ priv->unmounting_mount = TRUE;
update_loading (view);
g_object_ref (view);
@@ -1424,7 +1461,7 @@ unmount_mount (NautilusGtkPlacesView *view,
g_mount_unmount_with_operation (mount,
0,
operation,
- view->cancellable,
+ priv->cancellable,
unmount_ready_cb,
view);
g_object_unref (operation);
@@ -1434,30 +1471,32 @@ static void
mount_server (NautilusGtkPlacesView *view,
GFile *location)
{
+ NautilusGtkPlacesViewPrivate *priv;
GMountOperation *operation;
GtkWidget *toplevel;
- g_cancellable_cancel (view->cancellable);
- g_clear_object (&view->cancellable);
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ g_cancellable_cancel (priv->cancellable);
+ g_clear_object (&priv->cancellable);
/* User cliked when the operation was ongoing, so wanted to cancel it */
- if (view->connecting_to_server)
+ if (priv->connecting_to_server)
return;
- view->cancellable = g_cancellable_new ();
- toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
+ priv->cancellable = g_cancellable_new ();
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
- view->should_pulse_entry = TRUE;
- gtk_entry_set_progress_pulse_step (GTK_ENTRY (view->address_entry), 0.1);
- gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0.1);
+ priv->should_pulse_entry = TRUE;
+ gtk_entry_set_progress_pulse_step (GTK_ENTRY (priv->address_entry), 0.1);
/* Allow to cancel the operation */
- gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Cance_l"));
- gtk_widget_set_sensitive (view->address_entry, FALSE);
- view->connecting_to_server = TRUE;
+ gtk_button_set_label (GTK_BUTTON (priv->connect_button), _("Cance_l"));
+ gtk_widget_set_sensitive (priv->address_entry, FALSE);
+ priv->connecting_to_server = TRUE;
update_loading (view);
- if (view->entry_pulse_timeout_id == 0)
- view->entry_pulse_timeout_id = g_timeout_add (100, (GSourceFunc) pulse_entry_cb, view);
+ if (priv->entry_pulse_timeout_id == 0)
+ priv->entry_pulse_timeout_id = g_timeout_add (100, (GSourceFunc) pulse_entry_cb, view);
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
@@ -1467,7 +1506,7 @@ mount_server (NautilusGtkPlacesView *view,
g_file_mount_enclosing_volume (location,
0,
operation,
- view->cancellable,
+ priv->cancellable,
server_mount_ready_cb,
view);
@@ -1479,17 +1518,19 @@ static void
mount_volume (NautilusGtkPlacesView *view,
GVolume *volume)
{
+ NautilusGtkPlacesViewPrivate *priv;
GMountOperation *operation;
GtkWidget *toplevel;
- toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
- g_cancellable_cancel (view->cancellable);
- g_clear_object (&view->cancellable);
- view->cancellable = g_cancellable_new ();
+ g_cancellable_cancel (priv->cancellable);
+ g_clear_object (&priv->cancellable);
+ priv->cancellable = g_cancellable_new ();
- view->mounting_volume = TRUE;
+ priv->mounting_volume = TRUE;
update_loading (view);
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
@@ -1500,7 +1541,7 @@ mount_volume (NautilusGtkPlacesView *view,
g_volume_mount (volume,
0,
operation,
- view->cancellable,
+ priv->cancellable,
volume_mount_ready_cb,
view);
@@ -1508,73 +1549,89 @@ mount_volume (NautilusGtkPlacesView *view,
g_object_unref (operation);
}
+/* Callback used when the file list's popup menu is detached */
static void
-open_cb (GtkWidget *widget,
- const char *action_name,
- GVariant *parameter)
+popup_menu_detach_cb (GtkWidget *attach_widget,
+ GtkMenu *menu)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (widget);
- NautilusGtkPlacesOpenFlags flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
+ NautilusGtkPlacesViewPrivate *priv;
- if (view->row_for_action == NULL)
- return;
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (attach_widget));
+ priv->popup_menu = NULL;
+}
- if (strcmp (action_name, "location.open") == 0)
- flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
- else if (strcmp (action_name, "location.open-tab") == 0)
- flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
- else if (strcmp (action_name, "location.open-window") == 0)
- flags = NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW;
+static void
+open_cb (GtkMenuItem *item,
+ NautilusGtkPlacesViewRow *row)
+{
+ NautilusGtkPlacesView *self;
- activate_row (view, view->row_for_action, flags);
+ self = NAUTILUS_GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row),
NAUTILUS_TYPE_GTK_PLACES_VIEW));
+ activate_row (self, row, NAUTILUS_GTK_PLACES_OPEN_NORMAL);
}
static void
-mount_cb (GtkWidget *widget,
- const char *action_name,
- GVariant *parameter)
+open_in_new_tab_cb (GtkMenuItem *item,
+ NautilusGtkPlacesViewRow *row)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (widget);
- GVolume *volume;
+ NautilusGtkPlacesView *self;
- if (view->row_for_action == NULL)
- return;
+ self = NAUTILUS_GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row),
NAUTILUS_TYPE_GTK_PLACES_VIEW));
+ activate_row (self, row, NAUTILUS_GTK_PLACES_OPEN_NEW_TAB);
+}
+
+static void
+open_in_new_window_cb (GtkMenuItem *item,
+ NautilusGtkPlacesViewRow *row)
+{
+ NautilusGtkPlacesView *self;
- volume = nautilus_gtk_places_view_row_get_volume (view->row_for_action);
+ self = NAUTILUS_GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row),
NAUTILUS_TYPE_GTK_PLACES_VIEW));
+ activate_row (self, row, NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW);
+}
+
+static void
+mount_cb (GtkMenuItem *item,
+ NautilusGtkPlacesViewRow *row)
+{
+ NautilusGtkPlacesViewPrivate *priv;
+ GtkWidget *view;
+ GVolume *volume;
+
+ view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW);
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (view));
+ volume = nautilus_gtk_places_view_row_get_volume (row);
/*
* When the mount item is activated, it's expected that
* the volume only gets mounted, without opening it after
* the operation is complete.
*/
- view->should_open_location = FALSE;
+ priv->should_open_location = FALSE;
- nautilus_gtk_places_view_row_set_busy (view->row_for_action, TRUE);
- mount_volume (view, volume);
+ nautilus_gtk_places_view_row_set_busy (row, TRUE);
+ mount_volume (NAUTILUS_GTK_PLACES_VIEW (view), volume);
}
static void
-unmount_cb (GtkWidget *widget,
- const char *action_name,
- GVariant *parameter)
+unmount_cb (GtkMenuItem *item,
+ NautilusGtkPlacesViewRow *row)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (widget);
+ GtkWidget *view;
GMount *mount;
- if (view->row_for_action == NULL)
- return;
-
- mount = nautilus_gtk_places_view_row_get_mount (view->row_for_action);
+ view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW);
+ mount = nautilus_gtk_places_view_row_get_mount (row);
- nautilus_gtk_places_view_row_set_busy (view->row_for_action, TRUE);
+ nautilus_gtk_places_view_row_set_busy (row, TRUE);
- unmount_mount (view, mount);
+ unmount_mount (NAUTILUS_GTK_PLACES_VIEW (view), mount);
}
static void
attach_protocol_row_to_grid (GtkGrid *grid,
- const char *protocol_name,
- const char *protocol_prefix)
+ const gchar *protocol_name,
+ const gchar *protocol_prefix)
{
GtkWidget *name_label;
GtkWidget *prefix_label;
@@ -1591,238 +1648,212 @@ attach_protocol_row_to_grid (GtkGrid *grid,
static void
populate_available_protocols_grid (GtkGrid *grid)
{
- const char * const *supported_protocols;
- gboolean has_any = FALSE;
+ const gchar* const *supported_protocols;
supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
if (g_strv_contains (supported_protocols, "afp"))
- {
- attach_protocol_row_to_grid (grid, _("AppleTalk"), "afp://");
- has_any = TRUE;
- }
+ attach_protocol_row_to_grid (grid, _("AppleTalk"), "afp://");
if (g_strv_contains (supported_protocols, "ftp"))
- {
- attach_protocol_row_to_grid (grid, _("File Transfer Protocol"),
- /* Translators: do not translate ftp:// and ftps:// */
- _("ftp:// or ftps://"));
- has_any = TRUE;
- }
+ /* Translators: do not translate ftp:// and ftps:// */
+ attach_protocol_row_to_grid (grid, _("File Transfer Protocol"), _("ftp:// or ftps://"));
if (g_strv_contains (supported_protocols, "nfs"))
- {
- attach_protocol_row_to_grid (grid, _("Network File System"), "nfs://");
- has_any = TRUE;
- }
+ attach_protocol_row_to_grid (grid, _("Network File System"), "nfs://");
if (g_strv_contains (supported_protocols, "smb"))
- {
- attach_protocol_row_to_grid (grid, _("Samba"), "smb://");
- has_any = TRUE;
- }
+ attach_protocol_row_to_grid (grid, _("Samba"), "smb://");
if (g_strv_contains (supported_protocols, "ssh"))
- {
- attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"),
- /* Translators: do not translate sftp:// and ssh:// */
- _("sftp:// or ssh://"));
- has_any = TRUE;
- }
+ /* Translators: do not translate sftp:// and ssh:// */
+ attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"), _("sftp:// or ssh://"));
if (g_strv_contains (supported_protocols, "dav"))
- {
- attach_protocol_row_to_grid (grid, _("WebDAV"),
- /* Translators: do not translate dav:// and davs:// */
- _("dav:// or davs://"));
- has_any = TRUE;
- }
-
- if (!has_any)
- gtk_widget_hide (GTK_WIDGET (grid));
-}
-
-static GMenuModel *
-get_menu_model (void)
-{
- GMenu *menu;
- GMenu *section;
- GMenuItem *item;
-
- menu = g_menu_new ();
- section = g_menu_new ();
- item = g_menu_item_new (_("_Open"), "location.open");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
- item = g_menu_item_new (_("Open in New _Tab"), "location.open-tab");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
- item = g_menu_item_new (_("Open in New _Window"), "location.open-window");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
- g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
- g_object_unref (section);
-
- section = g_menu_new ();
- item = g_menu_item_new (_("_Disconnect"), "location.disconnect");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
+ /* Translators: do not translate dav:// and davs:// */
+ attach_protocol_row_to_grid (grid, _("WebDAV"), _("dav:// or davs://"));
- item = g_menu_item_new (_("_Unmount"), "location.unmount");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
-
- item = g_menu_item_new (_("_Connect"), "location.connect");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
- item = g_menu_item_new (_("_Mount"), "location.mount");
- g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
- g_menu_append_item (section, item);
- g_object_unref (item);
-
- g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
- g_object_unref (section);
-
- return G_MENU_MODEL (menu);
+ gtk_widget_show_all (GTK_WIDGET (grid));
}
-static gboolean
-on_row_popup_menu (GtkWidget *widget,
- GVariant *args,
- gpointer user_data)
+/* Constructs the popup menu if needed */
+static void
+build_popup_menu (NautilusGtkPlacesView *view,
+ NautilusGtkPlacesViewRow *row)
{
- NautilusGtkPlacesViewRow *row = NAUTILUS_GTK_PLACES_VIEW_ROW (widget);
- NautilusGtkPlacesView *view;
+ NautilusGtkPlacesViewPrivate *priv;
+ GtkWidget *item;
GMount *mount;
GFile *file;
gboolean is_network;
- view = NAUTILUS_GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row),
NAUTILUS_TYPE_GTK_PLACES_VIEW));
-
+ priv = nautilus_gtk_places_view_get_instance_private (view);
mount = nautilus_gtk_places_view_row_get_mount (row);
file = nautilus_gtk_places_view_row_get_file (row);
is_network = nautilus_gtk_places_view_row_get_is_network (row);
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.disconnect",
- !file && mount && is_network);
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.unmount",
- !file && mount && !is_network);
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.connect",
- !file && !mount && is_network);
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.mount",
- !file && !mount && !is_network);
+ priv->popup_menu = gtk_menu_new ();
+ gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_menu),
+ GTK_STYLE_CLASS_CONTEXT_MENU);
+
+ gtk_menu_attach_to_widget (GTK_MENU (priv->popup_menu),
+ GTK_WIDGET (view),
+ popup_menu_detach_cb);
- if (!view->popup_menu)
+ /* Open item is always present */
+ item = gtk_menu_item_new_with_mnemonic (_("_Open"));
+ g_signal_connect (item,
+ "activate",
+ G_CALLBACK (open_cb),
+ row);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
+
+ if (priv->open_flags & NAUTILUS_GTK_PLACES_OPEN_NEW_TAB)
{
- GMenuModel *model = get_menu_model ();
+ item = gtk_menu_item_new_with_mnemonic (_("Open in New _Tab"));
+ g_signal_connect (item,
+ "activate",
+ G_CALLBACK (open_in_new_tab_cb),
+ row);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
+ }
- view->popup_menu = gtk_popover_menu_new_from_model (model);
- gtk_popover_set_position (GTK_POPOVER (view->popup_menu), GTK_POS_BOTTOM);
+ if (priv->open_flags & NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW)
+ {
+ item = gtk_menu_item_new_with_mnemonic (_("Open in New _Window"));
+ g_signal_connect (item,
+ "activate",
+ G_CALLBACK (open_in_new_window_cb),
+ row);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
+ }
- gtk_popover_set_has_arrow (GTK_POPOVER (view->popup_menu), FALSE);
- gtk_widget_set_halign (view->popup_menu, GTK_ALIGN_CENTER);
+ /*
+ * The only item that contains a file up to now is the Computer
+ * item, which cannot be mounted or unmounted.
+ */
+ if (file)
+ return;
- g_object_unref (model);
+ /* Separator */
+ item = gtk_separator_menu_item_new ();
+ gtk_widget_show (item);
+ gtk_menu_shell_insert (GTK_MENU_SHELL (priv->popup_menu), item, -1);
+
+ /* Mount/Unmount items */
+ if (mount)
+ {
+ item = gtk_menu_item_new_with_mnemonic (is_network ? _("_Disconnect") : _("_Unmount"));
+ g_signal_connect (item,
+ "activate",
+ G_CALLBACK (unmount_cb),
+ row);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
+ }
+ else
+ {
+ item = gtk_menu_item_new_with_mnemonic (is_network ? _("_Connect") : _("_Mount"));
+ g_signal_connect (item,
+ "activate",
+ G_CALLBACK (mount_cb),
+ row);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), item);
}
+}
+
+static void
+popup_menu (NautilusGtkPlacesViewRow *row,
+ GdkEventButton *event)
+{
+ NautilusGtkPlacesViewPrivate *priv;
+ GtkWidget *view;
- if (view->row_for_action)
- g_object_set_data (G_OBJECT (view->row_for_action), "menu", NULL);
+ view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW);
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (view));
- g_object_ref (view->popup_menu);
- gtk_widget_unparent (view->popup_menu);
- gtk_widget_set_parent (view->popup_menu, GTK_WIDGET (row));
- g_object_unref (view->popup_menu);
+ g_clear_pointer (&priv->popup_menu, gtk_widget_destroy);
- view->row_for_action = row;
- if (view->row_for_action)
- g_object_set_data (G_OBJECT (view->row_for_action), "menu", view->popup_menu);
+ build_popup_menu (NAUTILUS_GTK_PLACES_VIEW (view), row);
- gtk_popover_popup (GTK_POPOVER (view->popup_menu));
+ gtk_menu_popup_at_pointer (GTK_MENU (priv->popup_menu), (GdkEvent *) event);
+}
+static gboolean
+on_row_popup_menu (NautilusGtkPlacesViewRow *row)
+{
+ popup_menu (row, NULL);
return TRUE;
}
-static void
-click_cb (GtkGesture *gesture,
- int n_press,
- double x,
- double y,
- gpointer user_data)
+static gboolean
+on_button_press_event (NautilusGtkPlacesViewRow *row,
+ GdkEventButton *event)
{
- on_row_popup_menu (GTK_WIDGET (user_data), NULL, NULL);
+ if (row &&
+ gdk_event_triggers_context_menu ((GdkEvent*) event) &&
+ event->type == GDK_BUTTON_PRESS)
+ {
+ popup_menu (row, event);
+
+ return TRUE;
+ }
+
+ return FALSE;
}
static gboolean
-on_key_press_event (GtkEventController *controller,
- guint keyval,
- guint keycode,
- GdkModifierType state,
- NautilusGtkPlacesView *view)
+on_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ NautilusGtkPlacesView *view)
{
- GdkModifierType modifiers;
+ NautilusGtkPlacesViewPrivate *priv;
- modifiers = gtk_accelerator_get_default_mod_mask ();
+ priv = nautilus_gtk_places_view_get_instance_private (view);
- if (keyval == GDK_KEY_Return ||
- keyval == GDK_KEY_KP_Enter ||
- keyval == GDK_KEY_ISO_Enter ||
- keyval == GDK_KEY_space)
+ if (event)
{
- GtkWidget *focus_widget;
- GtkWindow *toplevel;
-
- view->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
- toplevel = get_toplevel (GTK_WIDGET (view));
+ guint modifiers;
- if (!toplevel)
- return FALSE;
+ modifiers = gtk_accelerator_get_default_mod_mask ();
- focus_widget = gtk_root_get_focus (GTK_ROOT (toplevel));
+ if (event->keyval == GDK_KEY_Return ||
+ event->keyval == GDK_KEY_KP_Enter ||
+ event->keyval == GDK_KEY_ISO_Enter ||
+ event->keyval == GDK_KEY_space)
+ {
+ GtkWidget *focus_widget;
+ GtkWindow *toplevel;
- if (!NAUTILUS_IS_GTK_PLACES_VIEW_ROW (focus_widget))
- return FALSE;
+ priv->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
+ toplevel = get_toplevel (GTK_WIDGET (view));
- if ((state & modifiers) == GDK_SHIFT_MASK)
- view->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
- else if ((state & modifiers) == GDK_CONTROL_MASK)
- view->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW;
+ if (!toplevel)
+ return FALSE;
- activate_row (view, NAUTILUS_GTK_PLACES_VIEW_ROW (focus_widget), view->current_open_flags);
+ focus_widget = gtk_window_get_focus (toplevel);
- return TRUE;
- }
+ if (!NAUTILUS_IS_GTK_PLACES_VIEW_ROW (focus_widget))
+ return FALSE;
- return FALSE;
-}
+ if ((event->state & modifiers) == GDK_SHIFT_MASK)
+ priv->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
+ else if ((event->state & modifiers) == GDK_CONTROL_MASK)
+ priv->current_open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW;
-static void
-on_middle_click_row_event (GtkGestureClick *gesture,
- guint n_press,
- double x,
- double y,
- NautilusGtkPlacesView *view)
-{
- GtkListBoxRow *row;
+ activate_row (view, NAUTILUS_GTK_PLACES_VIEW_ROW (focus_widget), priv->current_open_flags);
- if (n_press != 1)
- return;
+ return TRUE;
+ }
+ }
- row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (view->listbox), y);
- if (row != NULL && gtk_widget_is_sensitive (GTK_WIDGET (row)))
- activate_row (view, NAUTILUS_GTK_PLACES_VIEW_ROW (row), NAUTILUS_GTK_PLACES_OPEN_NEW_TAB);
+ return FALSE;
}
-
static void
on_eject_button_clicked (GtkWidget *widget,
NautilusGtkPlacesViewRow *row)
@@ -1838,9 +1869,11 @@ on_eject_button_clicked (GtkWidget *widget,
static void
on_connect_button_clicked (NautilusGtkPlacesView *view)
{
- const char *uri;
+ NautilusGtkPlacesViewPrivate *priv;
+ const gchar *uri;
GFile *file;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
file = NULL;
/*
@@ -1848,17 +1881,17 @@ on_connect_button_clicked (NautilusGtkPlacesView *view)
* address changes, it is sufficient to check if it's sensitive
* or not, in order to determine if the given address is valid.
*/
- if (!gtk_widget_get_sensitive (view->connect_button))
+ if (!gtk_widget_get_sensitive (priv->connect_button))
return;
- uri = gtk_editable_get_text (GTK_EDITABLE (view->address_entry));
+ uri = gtk_entry_get_text (GTK_ENTRY (priv->address_entry));
if (uri != NULL && uri[0] != '\0')
file = g_file_new_for_commandline_arg (uri);
if (file)
{
- view->should_open_location = TRUE;
+ priv->should_open_location = TRUE;
mount_server (view, file);
}
@@ -1871,13 +1904,15 @@ on_connect_button_clicked (NautilusGtkPlacesView *view)
static void
on_address_entry_text_changed (NautilusGtkPlacesView *view)
{
- const char * const *supported_protocols;
- char *address, *scheme;
+ NautilusGtkPlacesViewPrivate *priv;
+ const gchar* const *supported_protocols;
+ gchar *address, *scheme;
gboolean supported;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
supported = FALSE;
supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
- address = g_strdup (gtk_editable_get_text (GTK_EDITABLE (view->address_entry)));
+ address = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->address_entry)));
scheme = g_uri_parse_scheme (address);
if (!supported_protocols)
@@ -1890,11 +1925,13 @@ on_address_entry_text_changed (NautilusGtkPlacesView *view)
!g_strv_contains (unsupported_protocols, scheme);
out:
- gtk_widget_set_sensitive (view->connect_button, supported);
+ gtk_widget_set_sensitive (priv->connect_button, supported);
if (scheme && !supported)
- gtk_widget_add_css_class (view->address_entry, "error");
+ gtk_style_context_add_class (gtk_widget_get_style_context (priv->address_entry),
+ GTK_STYLE_CLASS_ERROR);
else
- gtk_widget_remove_css_class (view->address_entry, "error");
+ gtk_style_context_remove_class (gtk_widget_get_style_context (priv->address_entry),
+ GTK_STYLE_CLASS_ERROR);
g_free (address);
g_free (scheme);
@@ -1903,22 +1940,21 @@ out:
static void
on_address_entry_show_help_pressed (NautilusGtkPlacesView *view,
GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
GtkEntry *entry)
{
+ NautilusGtkPlacesViewPrivate *priv;
GdkRectangle rect;
- double x, y;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
/* Setup the auxiliary popover's rectangle */
- gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
+ gtk_entry_get_icon_area (GTK_ENTRY (priv->address_entry),
GTK_ENTRY_ICON_SECONDARY,
&rect);
- gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
- rect.x, rect.y, &x, &y);
- rect.x = x;
- rect.y = y;
- gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
- gtk_widget_set_visible (view->server_adresses_popover, TRUE);
+ gtk_popover_set_pointing_to (GTK_POPOVER (priv->server_adresses_popover), &rect);
+ gtk_widget_set_visible (priv->server_adresses_popover, TRUE);
}
static void
@@ -1926,13 +1962,15 @@ on_recent_servers_listbox_row_activated (NautilusGtkPlacesView *view,
NautilusGtkPlacesViewRow *row,
GtkWidget *listbox)
{
- char *uri;
+ NautilusGtkPlacesViewPrivate *priv;
+ gchar *uri;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
uri = g_object_get_data (G_OBJECT (row), "uri");
- gtk_editable_set_text (GTK_EDITABLE (view->address_entry), uri);
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), uri);
- gtk_widget_hide (view->recent_servers_popover);
+ gtk_widget_hide (priv->recent_servers_popover);
}
static void
@@ -1940,25 +1978,84 @@ on_listbox_row_activated (NautilusGtkPlacesView *view,
NautilusGtkPlacesViewRow *row,
GtkWidget *listbox)
{
- activate_row (view, row, view->current_open_flags);
+ NautilusGtkPlacesViewPrivate *priv;
+ GdkEvent *event;
+ guint button;
+ NautilusGtkPlacesOpenFlags open_flags;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ event = gtk_get_current_event ();
+ gdk_event_get_button (event, &button);
+
+ if (gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE && button == GDK_BUTTON_MIDDLE)
+ open_flags = NAUTILUS_GTK_PLACES_OPEN_NEW_TAB;
+ else
+ open_flags = priv->current_open_flags;
+
+ activate_row (view, row, open_flags);
+}
+
+static gboolean
+is_mount_locally_accessible (GMount *mount)
+{
+ GFile *base_file;
+ gchar *path;
+
+ if (mount == NULL)
+ return FALSE;
+
+ base_file = g_mount_get_root (mount);
+
+ if (base_file == NULL)
+ return FALSE;
+
+ path = g_file_get_path (base_file);
+ g_object_unref (base_file);
+
+ if (path == NULL)
+ return FALSE;
+
+ g_free (path);
+ return TRUE;
}
static gboolean
listbox_filter_func (GtkListBoxRow *row,
gpointer user_data)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (user_data);
+ NautilusGtkPlacesViewPrivate *priv;
+ gboolean is_network;
gboolean is_placeholder;
+ gboolean is_local = FALSE;
gboolean retval;
gboolean searching;
- char *name;
- char *path;
+ gchar *name;
+ gchar *path;
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data));
retval = FALSE;
- searching = view->search_query && view->search_query[0] != '\0';
+ searching = priv->search_query && priv->search_query[0] != '\0';
+ is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-network"));
is_placeholder = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-placeholder"));
+ if (NAUTILUS_IS_GTK_PLACES_VIEW_ROW (row))
+ {
+ NautilusGtkPlacesViewRow *placesviewrow;
+ GMount *mount;
+
+ placesviewrow = NAUTILUS_GTK_PLACES_VIEW_ROW (row);
+ g_object_get(G_OBJECT (placesviewrow), "mount", &mount, NULL);
+
+ is_local = is_mount_locally_accessible (mount);
+
+ g_clear_object (&mount);
+ }
+
+ if (is_network && priv->local_only && !is_local)
+ return FALSE;
+
if (is_placeholder && searching)
return FALSE;
@@ -1971,22 +2068,10 @@ listbox_filter_func (GtkListBoxRow *row,
NULL);
if (name)
- {
- char *lowercase_name = g_utf8_strdown (name, -1);
-
- retval |= strstr (lowercase_name, view->search_query) != NULL;
-
- g_free (lowercase_name);
- }
+ retval |= strstr (name, priv->search_query) != NULL;
if (path)
- {
- char *lowercase_path = g_utf8_strdown (path, -1);
-
- retval |= strstr (lowercase_path, view->search_query) != NULL;
-
- g_free (lowercase_path);
- }
+ retval |= strstr (path, priv->search_query) != NULL;
g_free (name);
g_free (path);
@@ -2000,7 +2085,7 @@ listbox_header_func (GtkListBoxRow *row,
gpointer user_data)
{
gboolean row_is_network;
- char *text;
+ gchar *text;
text = NULL;
row_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-network"));
@@ -2041,29 +2126,36 @@ listbox_header_func (GtkListBoxRow *row,
GtkWidget *header_name;
GtkWidget *network_header_spinner;
- gtk_widget_set_margin_end (label, 6);
+ g_object_set (label,
+ "margin-end", 6,
+ NULL);
header_name = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
network_header_spinner = gtk_spinner_new ();
- gtk_widget_set_margin_end (network_header_spinner, 12);
+ g_object_set (network_header_spinner,
+ "margin-end", 12,
+ NULL);
g_object_bind_property (NAUTILUS_GTK_PLACES_VIEW (user_data),
"fetching-networks",
network_header_spinner,
- "spinning",
+ "active",
G_BINDING_SYNC_CREATE);
- gtk_box_append (GTK_BOX (header_name), label);
- gtk_box_append (GTK_BOX (header_name), network_header_spinner);
- gtk_box_append (GTK_BOX (header), header_name);
+ gtk_container_add (GTK_CONTAINER (header_name), label);
+ gtk_container_add (GTK_CONTAINER (header_name), network_header_spinner);
+ gtk_container_add (GTK_CONTAINER (header), header_name);
}
else
{
- gtk_widget_set_hexpand (label, TRUE);
- gtk_widget_set_margin_end (label, 12);
- gtk_box_append (GTK_BOX (header), label);
+ g_object_set (label,
+ "hexpand", TRUE,
+ "margin-end", 12,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (header), label);
}
- gtk_box_append (GTK_BOX (header), separator);
+ gtk_container_add (GTK_CONTAINER (header), separator);
+ gtk_widget_show_all (header);
gtk_list_box_row_set_header (row, header);
@@ -2075,18 +2167,18 @@ listbox_header_func (GtkListBoxRow *row,
}
}
-static int
+static gint
listbox_sort_func (GtkListBoxRow *row1,
GtkListBoxRow *row2,
gpointer user_data)
{
gboolean row1_is_network;
gboolean row2_is_network;
- char *path1;
- char *path2;
+ gchar *path1;
+ gchar *path2;
gboolean *is_placeholder1;
gboolean *is_placeholder2;
- int retval;
+ gint retval;
row1_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row1), "is-network"));
row2_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row2), "is-network"));
@@ -2121,47 +2213,49 @@ listbox_sort_func (GtkListBoxRow *row1,
static void
nautilus_gtk_places_view_constructed (GObject *object)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (object);
+ NautilusGtkPlacesViewPrivate *priv;
+
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (object));
G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->constructed (object);
- gtk_list_box_set_sort_func (GTK_LIST_BOX (view->listbox),
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->listbox),
listbox_sort_func,
object,
NULL);
- gtk_list_box_set_filter_func (GTK_LIST_BOX (view->listbox),
+ gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->listbox),
listbox_filter_func,
object,
NULL);
- gtk_list_box_set_header_func (GTK_LIST_BOX (view->listbox),
+ gtk_list_box_set_header_func (GTK_LIST_BOX (priv->listbox),
listbox_header_func,
object,
NULL);
/* load drives */
- update_places (view);
+ update_places (NAUTILUS_GTK_PLACES_VIEW (object));
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"mount-added",
G_CALLBACK (update_places),
object);
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"mount-changed",
G_CALLBACK (update_places),
object);
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"mount-removed",
G_CALLBACK (update_places),
object);
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"volume-added",
G_CALLBACK (update_places),
object);
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"volume-changed",
G_CALLBACK (update_places),
object);
- g_signal_connect_swapped (view->volume_monitor,
+ g_signal_connect_swapped (priv->volume_monitor,
"volume-removed",
G_CALLBACK (update_places),
object);
@@ -2170,9 +2264,11 @@ nautilus_gtk_places_view_constructed (GObject *object)
static void
nautilus_gtk_places_view_map (GtkWidget *widget)
{
- NautilusGtkPlacesView *view = NAUTILUS_GTK_PLACES_VIEW (widget);
+ NautilusGtkPlacesViewPrivate *priv;
+
+ priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (widget));
- gtk_editable_set_text (GTK_EDITABLE (view->address_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), "");
GTK_WIDGET_CLASS (nautilus_gtk_places_view_parent_class)->map (widget);
}
@@ -2184,24 +2280,26 @@ nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = nautilus_gtk_places_view_finalize;
- object_class->dispose = nautilus_gtk_places_view_dispose;
object_class->constructed = nautilus_gtk_places_view_constructed;
object_class->get_property = nautilus_gtk_places_view_get_property;
object_class->set_property = nautilus_gtk_places_view_set_property;
+ widget_class->destroy = nautilus_gtk_places_view_destroy;
widget_class->map = nautilus_gtk_places_view_map;
- /*
+ /**
* NautilusGtkPlacesView::open-location:
* @view: the object which received the signal.
- * @location: (type Gio.File): GFile to which the caller should switch.
- * @open_flags: a single value from NautilusGtkPlacesOpenFlags specifying how the @location
+ * @location: (type Gio.File): #GFile to which the caller should switch.
+ * @open_flags: a single value from #NautilusGtkPlacesOpenFlags specifying how the @location
* should be opened.
*
* The places view emits this signal when the user selects a location
* in it. The calling application should display the contents of that
* location; for example, a file manager should show a list of files in
* the specified location.
+ *
+ * Since: 3.18
*/
places_view_signals [OPEN_LOCATION] =
g_signal_new ("open-location",
@@ -2212,9 +2310,9 @@ nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass)
NULL,
G_TYPE_NONE, 2,
G_TYPE_OBJECT,
- NAUTILUS_TYPE_OPEN_FLAGS);
+ GTK_TYPE_PLACES_OPEN_FLAGS);
- /*
+ /**
* NautilusGtkPlacesView::show-error-message:
* @view: the object which received the signal.
* @primary: primary message with a summary of the error to show.
@@ -2224,6 +2322,8 @@ nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass)
* application to present an error message. Most of these messages
* refer to mounting or unmounting media, for example, when a drive
* cannot be started for some reason.
+ *
+ * Since: 3.18
*/
places_view_signals [SHOW_ERROR_MESSAGE] =
g_signal_new ("show-error-message",
@@ -2236,147 +2336,92 @@ nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass)
G_TYPE_STRING,
G_TYPE_STRING);
+ properties[PROP_LOCAL_ONLY] =
+ g_param_spec_boolean ("local-only",
+ "Local Only",
+ "Whether the sidebar only includes local files",
+ FALSE,
+ G_PARAM_READWRITE);
+
properties[PROP_LOADING] =
g_param_spec_boolean ("loading",
"Loading",
"Whether the view is loading locations",
FALSE,
-
G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READABLE);
properties[PROP_FETCHING_NETWORKS] =
g_param_spec_boolean ("fetching-networks",
"Fetching networks",
"Whether the view is fetching networks",
FALSE,
-
G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READABLE);
properties[PROP_OPEN_FLAGS] =
g_param_spec_flags ("open-flags",
"Open Flags",
"Modes in which the calling application can open locations selected in the
sidebar",
- NAUTILUS_TYPE_OPEN_FLAGS,
+ GTK_TYPE_PLACES_OPEN_FLAGS,
NAUTILUS_GTK_PLACES_OPEN_NORMAL,
-
G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ G_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/* Bind class to template */
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/nautilus/gtk/ui/nautilusgtkplacesview.ui");
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, actionbar);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, address_entry);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, address_entry_completion);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, completion_store);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, connect_button);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, listbox);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, recent_servers_listbox);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, recent_servers_popover);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, recent_servers_stack);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, stack);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, server_adresses_popover);
- gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesView, available_protocols_grid);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, actionbar);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, address_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView,
address_entry_completion);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, completion_store);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, connect_button);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, listbox);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_listbox);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_popover);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_stack);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, stack);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView,
server_adresses_popover);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView,
available_protocols_grid);
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed);
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_show_help_pressed);
gtk_widget_class_bind_template_callback (widget_class, on_connect_button_clicked);
+ gtk_widget_class_bind_template_callback (widget_class, on_key_press_event);
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
gtk_widget_class_bind_template_callback (widget_class, on_recent_servers_listbox_row_activated);
- /**
- * NautilusGtkPlacesView|location.open:
- *
- * Opens the location in the current window.
- */
- gtk_widget_class_install_action (widget_class, "location.open", NULL, open_cb);
-
- /**
- * NautilusGtkPlacesView|location.open-tab:
- *
- * Opens the location in a new tab.
- */
- gtk_widget_class_install_action (widget_class, "location.open-tab", NULL, open_cb);
-
- /**
- * NautilusGtkPlacesView|location.open-window:
- *
- * Opens the location in a new window.
- */
- gtk_widget_class_install_action (widget_class, "location.open-window", NULL, open_cb);
-
- /**
- * NautilusGtkPlacesView|location.mount:
- *
- * Mount the location.
- */
- gtk_widget_class_install_action (widget_class, "location.mount", NULL, mount_cb);
-
- /**
- * NautilusGtkPlacesView|location.connect:
- *
- * Connect the location.
- */
- gtk_widget_class_install_action (widget_class, "location.connect", NULL, mount_cb);
-
- /**
- * NautilusGtkPlacesView|location.unmount:
- *
- * Unmount the location.
- */
- gtk_widget_class_install_action (widget_class, "location.unmount", NULL, unmount_cb);
-
- /**
- * NautilusGtkPlacesView|location.disconnect:
- *
- * Disconnect the location.
- */
- gtk_widget_class_install_action (widget_class, "location.disconnect", NULL, unmount_cb);
-
gtk_widget_class_set_css_name (widget_class, "placesview");
}
static void
nautilus_gtk_places_view_init (NautilusGtkPlacesView *self)
{
- GtkEventController *controller;
+ NautilusGtkPlacesViewPrivate *priv;
- self->volume_monitor = g_volume_monitor_get ();
- self->open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
- self->path_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- self->space_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ priv = nautilus_gtk_places_view_get_instance_private (self);
- gtk_widget_action_set_enabled (GTK_WIDGET (self), "location.open-tab", FALSE);
- gtk_widget_action_set_enabled (GTK_WIDGET (self), "location.open-window", FALSE);
+ priv->volume_monitor = g_volume_monitor_get ();
+ priv->open_flags = NAUTILUS_GTK_PLACES_OPEN_NORMAL;
+ priv->path_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ priv->space_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_widget_set_parent (self->server_adresses_popover, GTK_WIDGET (self));
- controller = gtk_event_controller_key_new ();
- g_signal_connect (controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
- gtk_widget_add_controller (GTK_WIDGET (self), controller);
-
- /* We need an additional controller because GtkListBox only
- * activates rows for GDK_BUTTON_PRIMARY clicks
- */
- controller = (GtkEventController *) gtk_gesture_click_new ();
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_MIDDLE);
- g_signal_connect (controller, "released",
- G_CALLBACK (on_middle_click_row_event), self);
- gtk_widget_add_controller (self->listbox, controller);
-
- populate_available_protocols_grid (GTK_GRID (self->available_protocols_grid));
+ populate_available_protocols_grid (GTK_GRID (priv->available_protocols_grid));
}
-/*
+/**
* nautilus_gtk_places_view_new:
*
- * Creates a new NautilusGtkPlacesView widget.
+ * Creates a new #NautilusGtkPlacesView widget.
*
* The application should connect to at least the
- * NautilusGtkPlacesView::open-location signal to be notified
+ * #NautilusGtkPlacesView::open-location signal to be notified
* when the user makes a selection in the view.
*
- * Returns: a newly created NautilusGtkPlacesView
+ * Returns: a newly created #NautilusGtkPlacesView
+ *
+ * Since: 3.18
*/
GtkWidget *
nautilus_gtk_places_view_new (void)
@@ -2384,9 +2429,9 @@ nautilus_gtk_places_view_new (void)
return g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW, NULL);
}
-/*
+/**
* nautilus_gtk_places_view_set_open_flags:
- * @view: a NautilusGtkPlacesView
+ * @view: a #NautilusGtkPlacesView
* @flags: Bitmask of modes in which the calling application can open locations
*
* Sets the way in which the calling application can open new locations from
@@ -2398,67 +2443,77 @@ nautilus_gtk_places_view_new (void)
* application can open new locations, so that the view can display (or not)
* the “Open in new tab” and “Open in new window” menu items as appropriate.
*
- * When the NautilusGtkPlacesView::open-location signal is emitted, its flags
+ * When the #NautilusGtkPlacesView::open-location signal is emitted, its flags
* argument will be set to one of the @flags that was passed in
* nautilus_gtk_places_view_set_open_flags().
*
- * Passing 0 for @flags will cause NAUTILUS_GTK_PLACES_OPEN_NORMAL to always be sent
+ * Passing 0 for @flags will cause #NAUTILUS_GTK_PLACES_OPEN_NORMAL to always be sent
* to callbacks for the “open-location” signal.
+ *
+ * Since: 3.18
*/
void
nautilus_gtk_places_view_set_open_flags (NautilusGtkPlacesView *view,
NautilusGtkPlacesOpenFlags flags)
{
- g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
+ NautilusGtkPlacesViewPrivate *priv;
- if (view->open_flags == flags)
- return;
-
- view->open_flags = flags;
+ g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.open-tab",
- (flags & NAUTILUS_GTK_PLACES_OPEN_NEW_TAB) != 0);
- gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.open-window",
- (flags & NAUTILUS_GTK_PLACES_OPEN_NEW_WINDOW) != 0);
+ priv = nautilus_gtk_places_view_get_instance_private (view);
- g_object_notify_by_pspec (G_OBJECT (view), properties[PROP_OPEN_FLAGS]);
+ if (priv->open_flags != flags)
+ {
+ priv->open_flags = flags;
+ g_object_notify_by_pspec (G_OBJECT (view), properties[PROP_OPEN_FLAGS]);
+ }
}
-/*
+/**
* nautilus_gtk_places_view_get_open_flags:
- * @view: a NautilusGtkPlacesSidebar
+ * @view: a #NautilusGtkPlacesSidebar
*
* Gets the open flags.
*
- * Returns: the NautilusGtkPlacesOpenFlags of @view
+ * Returns: the #NautilusGtkPlacesOpenFlags of @view
+ *
+ * Since: 3.18
*/
NautilusGtkPlacesOpenFlags
nautilus_gtk_places_view_get_open_flags (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view), 0);
- return view->open_flags;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ return priv->open_flags;
}
-/*
+/**
* nautilus_gtk_places_view_get_search_query:
- * @view: a NautilusGtkPlacesView
+ * @view: a #NautilusGtkPlacesView
*
* Retrieves the current search query from @view.
*
* Returns: (transfer none): the current search query.
*/
-const char *
+const gchar*
nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view), NULL);
- return view->search_query;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ return priv->search_query;
}
-/*
+/**
* nautilus_gtk_places_view_set_search_query:
- * @view: a NautilusGtkPlacesView
+ * @view: a #NautilusGtkPlacesView
* @query_text: the query, or NULL.
*
* Sets the search query of @view. The search is immediately performed
@@ -2466,45 +2521,57 @@ nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view)
*/
void
nautilus_gtk_places_view_set_search_query (NautilusGtkPlacesView *view,
- const char *query_text)
+ const gchar *query_text)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
- if (g_strcmp0 (view->search_query, query_text) != 0)
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (g_strcmp0 (priv->search_query, query_text) != 0)
{
- g_clear_pointer (&view->search_query, g_free);
- view->search_query = g_utf8_strdown (query_text, -1);
+ g_clear_pointer (&priv->search_query, g_free);
+ priv->search_query = g_strdup (query_text);
- gtk_list_box_invalidate_filter (GTK_LIST_BOX (view->listbox));
- gtk_list_box_invalidate_headers (GTK_LIST_BOX (view->listbox));
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->listbox));
+ gtk_list_box_invalidate_headers (GTK_LIST_BOX (priv->listbox));
update_view_mode (view);
}
}
-/*
+/**
* nautilus_gtk_places_view_get_loading:
- * @view: a NautilusGtkPlacesView
+ * @view: a #NautilusGtkPlacesView
*
* Returns %TRUE if the view is loading locations.
+ *
+ * Since: 3.18
*/
gboolean
nautilus_gtk_places_view_get_loading (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view), FALSE);
- return view->loading;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ return priv->loading;
}
static void
update_loading (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
gboolean loading;
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
- loading = view->fetching_networks || view->connecting_to_server ||
- view->mounting_volume || view->unmounting_mount;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+ loading = priv->fetching_networks || priv->connecting_to_server ||
+ priv->mounting_volume || priv->unmounting_mount;
set_busy_cursor (view, loading);
nautilus_gtk_places_view_set_loading (view, loading);
@@ -2514,11 +2581,15 @@ static void
nautilus_gtk_places_view_set_loading (NautilusGtkPlacesView *view,
gboolean loading)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
- if (view->loading != loading)
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->loading != loading)
{
- view->loading = loading;
+ priv->loading = loading;
g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_LOADING]);
}
}
@@ -2526,20 +2597,83 @@ nautilus_gtk_places_view_set_loading (NautilusGtkPlacesView *view,
static gboolean
nautilus_gtk_places_view_get_fetching_networks (NautilusGtkPlacesView *view)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view), FALSE);
- return view->fetching_networks;
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ return priv->fetching_networks;
}
static void
nautilus_gtk_places_view_set_fetching_networks (NautilusGtkPlacesView *view,
gboolean fetching_networks)
{
+ NautilusGtkPlacesViewPrivate *priv;
+
g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
- if (view->fetching_networks != fetching_networks)
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->fetching_networks != fetching_networks)
{
- view->fetching_networks = fetching_networks;
+ priv->fetching_networks = fetching_networks;
g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_FETCHING_NETWORKS]);
}
}
+
+/**
+ * nautilus_gtk_places_view_get_local_only:
+ * @view: a #NautilusGtkPlacesView
+ *
+ * Returns %TRUE if only local volumes are shown, i.e. no networks
+ * are displayed.
+ *
+ * Returns: %TRUE if only local volumes are shown, %FALSE otherwise.
+ *
+ * Since: 3.18
+ */
+gboolean
+nautilus_gtk_places_view_get_local_only (NautilusGtkPlacesView *view)
+{
+ NautilusGtkPlacesViewPrivate *priv;
+
+ g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view), FALSE);
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ return priv->local_only;
+}
+
+/**
+ * nautilus_gtk_places_view_set_local_only:
+ * @view: a #NautilusGtkPlacesView
+ * @local_only: %TRUE to hide remote locations, %FALSE to show.
+ *
+ * Sets the #NautilusGtkPlacesView::local-only property to @local_only.
+ *
+ * Since: 3.18
+ */
+void
+nautilus_gtk_places_view_set_local_only (NautilusGtkPlacesView *view,
+ gboolean local_only)
+{
+ NautilusGtkPlacesViewPrivate *priv;
+
+ g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW (view));
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ if (priv->local_only != local_only)
+ {
+ priv->local_only = local_only;
+
+ gtk_widget_set_visible (priv->actionbar, !local_only);
+ update_places (view);
+
+ update_view_mode (view);
+
+ g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_LOCAL_ONLY]);
+ }
+}
diff --git a/src/gtk/nautilusgtkplacesview.ui b/src/gtk/nautilusgtkplacesview.ui
index a7d5bdf21..c5e785854 100644
--- a/src/gtk/nautilusgtkplacesview.ui
+++ b/src/gtk/nautilusgtkplacesview.ui
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<interface domain="gtk40">
+<interface domain="gtk30">
+ <requires lib="gtk+" version="3.16"/>
<object class="GtkListStore" id="completion_store">
<columns>
+ <!-- column-name name -->
<column type="gchararray"/>
+ <!-- column-name uri -->
<column type="gchararray"/>
</columns>
</object>
@@ -13,21 +16,20 @@
<property name="popup-completion">0</property>
</object>
<object class="GtkPopover" id="server_adresses_popover">
- <property name="position">2</property>
+ <property name="relative-to">address_entry</property>
<child>
<object class="GtkBox">
- <property name="orientation">1</property>
+ <property name="visible">1</property>
+ <property name="border-width">18</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
- <property name="margin-start">18</property>
- <property name="margin-end">18</property>
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
<child>
<object class="GtkLabel">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
- <property name="label" translatable="1">Server Addresses</property>
+ <property name="label" translatable="yes">Server Addresses</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
<style>
<class name="dim-label"/>
@@ -36,16 +38,21 @@
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
- <property name="label" translatable="1">Server addresses are made up of a protocol prefix and an
address. Examples:</property>
+ <property name="label" translatable="yes">Server addresses are made up of a protocol prefix and
an address. Examples:</property>
<property name="wrap">1</property>
<property name="width-chars">40</property>
<property name="max-width-chars">40</property>
<property name="xalign">0</property>
</object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
<property name="label">smb://gnome.org, ssh://192.168.0.1, ftp://[2001:db8::1]</property>
<property name="wrap">1</property>
@@ -53,41 +60,50 @@
<property name="max-width-chars">40</property>
<property name="xalign">0</property>
</object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
</child>
<child>
<object class="GtkGrid" id="available_protocols_grid">
+ <property name="visible">1</property>
<property name="margin-top">12</property>
<property name="hexpand">1</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
- <property name="label" translatable="1">Available Protocols</property>
+ <property name="label" translatable="yes">Available Protocols</property>
<property name="xalign">0</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="label" translatable="1">Prefix</property>
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Prefix</property>
<property name="xalign">0</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
</child>
@@ -95,186 +111,233 @@
<object class="GtkPopover" id="recent_servers_popover">
<child>
<object class="GtkStack" id="recent_servers_stack">
+ <property name="visible">1</property>
<child>
- <object class="GtkStackPage">
- <property name="name">empty</property>
- <property name="child">
- <object class="GtkBox">
- <property name="vexpand">1</property>
- <property name="valign">3</property>
- <property name="orientation">1</property>
- <property name="spacing">18</property>
- <child>
- <object class="GtkImage">
- <property name="pixel-size">48</property>
- <property name="icon-name">network-server-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1" comments="Translators: Server as any
successfully connected network address">No recent servers found</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="vexpand">1</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="pixel-size">48</property>
+ <property name="icon-name">network-server-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes" comments="Translators: Server as any successfully
connected network address">No recent servers found</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
- </property>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="name">empty</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">list</property>
- <property name="child">
- <object class="GtkBox">
- <property name="orientation">1</property>
- <property name="spacing">12</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">Recent Servers</property>
- <attributes>
- <attribute name="weight" value="bold"></attribute>
- </attributes>
- </object>
- </child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="border-width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Recent Servers</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
+ <property name="vexpand">1</property>
+ <property name="shadow-type">in</property>
+ <property name="min-content-width">250</property>
+ <property name="min-content-height">200</property>
<child>
- <object class="GtkScrolledWindow">
- <property name="vexpand">1</property>
- <property name="has-frame">1</property>
- <property name="min-content-width">250</property>
- <property name="min-content-height">200</property>
+ <object class="GtkViewport">
+ <property name="visible">1</property>
+ <property name="shadow-type">none</property>
<child>
- <object class="GtkViewport">
- <child>
- <object class="GtkListBox" id="recent_servers_listbox">
- <property name="selection-mode">0</property>
- <signal name="row-activated" handler="on_recent_servers_listbox_row_activated"
object="NautilusGtkPlacesView" swapped="yes"/>
- </object>
- </child>
+ <object class="GtkListBox" id="recent_servers_listbox">
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="on_recent_servers_listbox_row_activated"
object="NautilusGtkPlacesView" swapped="yes"/>
</object>
</child>
</object>
</child>
</object>
- </property>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="name">list</property>
+ </packing>
</child>
</object>
</child>
</object>
<template class="NautilusGtkPlacesView" parent="GtkBox">
- <property name="orientation">1</property>
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <signal name="key-press-event" handler="on_key_press_event" object="NautilusGtkPlacesView" swapped="no"/>
<child>
<object class="GtkStack" id="stack">
+ <property name="visible">1</property>
<property name="vhomogeneous">0</property>
- <property name="transition-type">1</property>
+ <property name="transition-type">crossfade</property>
<child>
- <object class="GtkStackPage">
- <property name="name">browse</property>
- <property name="child">
+ <object class="GtkFrame">
+ <property name="visible">1</property>
+ <property name="shadow-type">none</property>
+ <child>
<object class="GtkScrolledWindow">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkViewport">
+ <property name="visible">1</property>
+ <property name="shadow-type">none</property>
<child>
<object class="GtkListBox" id="listbox">
- <property name="selection-mode">0</property>
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
+ <property name="selection-mode">none</property>
<signal name="row-activated" handler="on_listbox_row_activated"
object="NautilusGtkPlacesView" swapped="yes"/>
</object>
</child>
</object>
</child>
</object>
- </property>
+ </child>
</object>
+ <packing>
+ <property name="name">browse</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">empty-search</property>
- <property name="child">
- <object class="GtkBox">
- <property name="halign">3</property>
- <property name="valign">3</property>
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- <property name="orientation">1</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage">
- <property name="pixel-size">72</property>
- <property name="icon-name">edit-find-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">No results found</property>
- <attributes>
- <attribute name="weight" value="bold"></attribute>
- <attribute name="scale" value="1.44"></attribute>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">Try a different search</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="pixel-size">72</property>
+ <property name="icon-name">edit-find-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
- </property>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">No results found</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.44"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Try a different search</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="name">empty-search</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkActionBar" id="actionbar">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
<style>
<class name="background"/>
</style>
<child>
<object class="GtkLabel">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
<property name="xalign">0</property>
- <property name="label" translatable="1">Connect to _Server</property>
+ <property name="label" translatable="yes">Connect to _Server</property>
<property name="mnemonic-widget">address_entry</property>
<property name="use-underline">1</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
- <child type="end">
+ <child>
<object class="GtkButton" id="connect_button">
- <property name="label" translatable="1">Con_nect</property>
+ <property name="label" translatable="yes">Con_nect</property>
<property name="use-underline">1</property>
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
<property name="sensitive">0</property>
<property name="receives-default">1</property>
- <property name="valign">3</property>
+ <property name="valign">center</property>
<signal name="clicked" handler="on_connect_button_clicked" object="NautilusGtkPlacesView"
swapped="yes"/>
</object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
</child>
- <child type="end">
+ <child>
<object class="GtkBox">
+ <property name="visible">1</property>
<property name="hexpand">1</property>
<child>
<object class="GtkEntry" id="address_entry">
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="width-chars">20</property>
- <property name="placeholder-text" translatable="1">Enter server address…</property>
+ <property name="placeholder-text" translatable="yes">Enter server address…</property>
<property name="secondary-icon-name">dialog-question-symbolic</property>
<property name="completion">address_entry_completion</property>
<signal name="notify::text" handler="on_address_entry_text_changed"
object="NautilusGtkPlacesView" swapped="yes"/>
@@ -284,21 +347,36 @@
</child>
<child>
<object class="GtkMenuButton" id="server_list_button">
+ <property name="visible">1</property>
+ <property name="can-focus">1</property>
<property name="receives-default">1</property>
- <property name="direction">0</property>
+ <property name="direction">up</property>
<property name="popover">recent_servers_popover</property>
- <property name="icon-name">pan-down-symbolic</property>
<style>
<class name="server-list-button"/>
</style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">pan-down-symbolic</property>
+ </object>
+ </child>
</object>
</child>
<style>
<class name="linked"/>
</style>
</object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</template>
</interface>
diff --git a/src/gtk/nautilusgtkplacesviewprivate.h b/src/gtk/nautilusgtkplacesviewprivate.h
index 4cf6e3e17..b821476cf 100644
--- a/src/gtk/nautilusgtkplacesviewprivate.h
+++ b/src/gtk/nautilusgtkplacesviewprivate.h
@@ -22,7 +22,7 @@
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#endif
-#include "nautilusgtkplacessidebarprivate.h"
+#include "nautilusgtkplacessidebar.h"
G_BEGIN_DECLS
@@ -35,6 +35,30 @@ G_BEGIN_DECLS
typedef struct _NautilusGtkPlacesView NautilusGtkPlacesView;
typedef struct _NautilusGtkPlacesViewClass NautilusGtkPlacesViewClass;
+typedef struct _NautilusGtkPlacesViewPrivate NautilusGtkPlacesViewPrivate;
+
+struct _NautilusGtkPlacesViewClass
+{
+ GtkBoxClass parent_class;
+
+ void (* open_location) (NautilusGtkPlacesView *view,
+ GFile *location,
+ NautilusGtkPlacesOpenFlags open_flags);
+
+ void (* show_error_message) (NautilusGtkPlacesSidebar *sidebar,
+ const gchar *primary,
+ const gchar *secondary);
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ gpointer reserved[10];
+};
+
+struct _NautilusGtkPlacesView
+{
+ GtkBox parent_instance;
+};
GType nautilus_gtk_places_view_get_type (void) G_GNUC_CONST;
@@ -42,9 +66,14 @@ NautilusGtkPlacesOpenFlags nautilus_gtk_places_view_get_open_flags
void nautilus_gtk_places_view_set_open_flags (NautilusGtkPlacesView *view,
NautilusGtkPlacesOpenFlags flags);
-const char * nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view);
+const gchar* nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view);
void nautilus_gtk_places_view_set_search_query (NautilusGtkPlacesView *view,
- const char *query_text);
+ const gchar *query_text);
+
+gboolean nautilus_gtk_places_view_get_local_only (NautilusGtkPlacesView
*view);
+
+void nautilus_gtk_places_view_set_local_only (NautilusGtkPlacesView
*view,
+ gboolean local_only);
gboolean nautilus_gtk_places_view_get_loading (NautilusGtkPlacesView
*view);
diff --git a/src/gtk/nautilusgtkplacesviewrow.c b/src/gtk/nautilusgtkplacesviewrow.c
index 0fe87ec10..f07dd4e70 100644
--- a/src/gtk/nautilusgtkplacesviewrow.c
+++ b/src/gtk/nautilusgtkplacesviewrow.c
@@ -19,7 +19,6 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "nautilus-enum-types.h"
#include <gio/gio.h>
@@ -43,6 +42,7 @@ struct _NautilusGtkPlacesViewRow
GtkSpinner *busy_spinner;
GtkButton *eject_button;
GtkImage *eject_icon;
+ GtkEventBox *event_box;
GtkImage *icon_image;
GtkLabel *name_label;
GtkLabel *path_label;
@@ -53,7 +53,7 @@ struct _NautilusGtkPlacesViewRow
GCancellable *cancellable;
- int is_network : 1;
+ gint is_network : 1;
};
G_DEFINE_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, GTK_TYPE_LIST_BOX_ROW)
@@ -82,9 +82,9 @@ measure_available_space_finished (GObject *object,
GError *error;
guint64 free_space;
guint64 total_space;
- char *formatted_free_size;
- char *formatted_total_size;
- char *label;
+ gchar *formatted_free_size;
+ gchar *formatted_total_size;
+ gchar *label;
guint plural_form;
error = NULL;
@@ -210,13 +210,16 @@ nautilus_gtk_places_view_row_get_property (GObject *object,
GParamSpec *pspec)
{
NautilusGtkPlacesViewRow *self;
+ GIcon *icon;
self = NAUTILUS_GTK_PLACES_VIEW_ROW (object);
+ icon = NULL;
switch (prop_id)
{
case PROP_ICON:
- g_value_set_object (value, gtk_image_get_gicon (self->icon_image));
+ gtk_image_get_gicon (self->icon_image, &icon, NULL);
+ g_value_set_object (value, icon);
break;
case PROP_NAME:
@@ -259,7 +262,9 @@ nautilus_gtk_places_view_row_set_property (GObject *object,
switch (prop_id)
{
case PROP_ICON:
- gtk_image_set_from_gicon (self->icon_image, g_value_get_object (value));
+ gtk_image_set_from_gicon (self->icon_image,
+ g_value_get_object (value),
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
break;
case PROP_NAME:
@@ -303,19 +308,6 @@ nautilus_gtk_places_view_row_set_property (GObject *object,
}
}
-static void
-nautilus_gtk_places_view_row_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
-{
- GtkWidget *menu = GTK_WIDGET (g_object_get_data (G_OBJECT (widget), "menu"));
-
- GTK_WIDGET_CLASS (nautilus_gtk_places_view_row_parent_class)->size_allocate (widget, width, height,
baseline);
- if (menu)
- gtk_popover_present (GTK_POPOVER (menu));
-}
-
static void
nautilus_gtk_places_view_row_class_init (NautilusGtkPlacesViewRowClass *klass)
{
@@ -326,8 +318,6 @@ nautilus_gtk_places_view_row_class_init (NautilusGtkPlacesViewRowClass *klass)
object_class->get_property = nautilus_gtk_places_view_row_get_property;
object_class->set_property = nautilus_gtk_places_view_row_set_property;
- widget_class->size_allocate = nautilus_gtk_places_view_row_size_allocate;
-
properties[PROP_ICON] =
g_param_spec_object ("icon",
"Icon of the row",
@@ -386,6 +376,7 @@ nautilus_gtk_places_view_row_class_init (NautilusGtkPlacesViewRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, busy_spinner);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_button);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_icon);
+ gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, event_box);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, icon_image);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, name_label);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, path_label);
@@ -439,6 +430,14 @@ nautilus_gtk_places_view_row_get_eject_button (NautilusGtkPlacesViewRow *row)
return GTK_WIDGET (row->eject_button);
}
+GtkWidget*
+nautilus_gtk_places_view_row_get_event_box (NautilusGtkPlacesViewRow *row)
+{
+ g_return_val_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW_ROW (row), NULL);
+
+ return GTK_WIDGET (row->event_box);
+}
+
void
nautilus_gtk_places_view_row_set_busy (NautilusGtkPlacesViewRow *row,
gboolean is_busy)
@@ -449,12 +448,10 @@ nautilus_gtk_places_view_row_set_busy (NautilusGtkPlacesViewRow *row,
{
gtk_stack_set_visible_child (row->mount_stack, GTK_WIDGET (row->busy_spinner));
gtk_widget_set_child_visible (GTK_WIDGET (row->mount_stack), TRUE);
- gtk_spinner_start (row->busy_spinner);
}
else
{
gtk_widget_set_child_visible (GTK_WIDGET (row->mount_stack), FALSE);
- gtk_spinner_stop (row->busy_spinner);
}
}
@@ -474,7 +471,7 @@ nautilus_gtk_places_view_row_set_is_network (NautilusGtkPlacesViewRow *row,
{
row->is_network = is_network;
- gtk_image_set_from_icon_name (row->eject_icon, "media-eject-symbolic");
+ gtk_image_set_from_icon_name (row->eject_icon, "media-eject-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_tooltip_text (GTK_WIDGET (row->eject_button), is_network ? _("Disconnect") :
_("Unmount"));
}
}
diff --git a/src/gtk/nautilusgtkplacesviewrow.ui b/src/gtk/nautilusgtkplacesviewrow.ui
index 231d65975..99d2dcb42 100644
--- a/src/gtk/nautilusgtkplacesviewrow.ui
+++ b/src/gtk/nautilusgtkplacesviewrow.ui
@@ -1,59 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
-<interface domain="gtk40">
+<interface domain="gtk30">
+ <requires lib="gtk+" version="3.16"/>
<template class="NautilusGtkPlacesViewRow" parent="GtkListBoxRow">
<property name="width-request">100</property>
- <property name="child">
- <object class="GtkBox" id="box">
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-top">6</property>
- <property name="margin-bottom">6</property>
- <property name="spacing">18</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <child>
+ <object class="GtkEventBox" id="event_box">
+ <property name="visible">1</property>
<child>
- <object class="GtkImage" id="icon_image">
- <property name="pixel-size">32</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="name_label">
- <property name="hexpand">1</property>
- <property name="xalign">0</property>
- <property name="ellipsize">3</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="available_space_label">
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="path_label">
- <property name="justify">1</property>
- <property name="ellipsize">2</property>
- <property name="xalign">0</property>
- <property name="max-width-chars">15</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="mount_stack">
+ <object class="GtkBox" id="box">
+ <property name="visible">1</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="spacing">18</property>
<child>
- <object class="GtkStackPage">
- <property name="name">button</property>
- <property name="child">
+ <object class="GtkImage" id="icon_image">
+ <property name="visible">1</property>
+ <property name="pixel-size">32</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="name_label">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="xalign">0</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="available_space_label">
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="path_label">
+ <property name="visible">1</property>
+ <property name="justify">right</property>
+ <property name="ellipsize">middle</property>
+ <property name="xalign">0</property>
+ <property name="max-width-chars">15</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStack" id="mount_stack">
+ <property name="visible">1</property>
+ <property name="hhomogeneous">1</property>
+ <property name="vhomogeneous">1</property>
+ <child>
<object class="GtkButton" id="eject_button">
- <property name="visible">0</property>
- <property name="halign">3</property>
- <property name="valign">3</property>
- <property name="tooltip-text" translatable="1">Unmount</property>
+ <property name="visible">1</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="tooltip-text" translatable="yes">Unmount</property>
<child>
<object class="GtkImage" id="eject_icon">
+ <property name="visible">1</property>
<property name="icon-name">media-eject-symbolic</property>
+ <property name="icon-size">1</property>
</object>
</child>
<style>
@@ -61,23 +82,23 @@
<class name="sidebar-button"/>
</style>
</object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">spinner</property>
- <property name="child">
+ </child>
+ <child>
<object class="GtkSpinner" id="busy_spinner">
- <property name="halign">3</property>
- <property name="valign">3</property>
+ <property name="visible">1</property>
+ <property name="active">1</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
</object>
- </property>
+ </child>
</object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
</child>
</object>
</child>
</object>
- </property>
+ </child>
</template>
</interface>
diff --git a/src/gtk/nautilusgtkplacesviewrowprivate.h b/src/gtk/nautilusgtkplacesviewrowprivate.h
index d54b918c0..fb32e1c67 100644
--- a/src/gtk/nautilusgtkplacesviewrowprivate.h
+++ b/src/gtk/nautilusgtkplacesviewrowprivate.h
@@ -34,6 +34,8 @@ GtkWidget* nautilus_gtk_places_view_row_new (GVolu
GtkWidget* nautilus_gtk_places_view_row_get_eject_button (NautilusGtkPlacesViewRow *row);
+GtkWidget* nautilus_gtk_places_view_row_get_event_box (NautilusGtkPlacesViewRow *row);
+
GMount* nautilus_gtk_places_view_row_get_mount (NautilusGtkPlacesViewRow *row);
GVolume* nautilus_gtk_places_view_row_get_volume (NautilusGtkPlacesViewRow *row);
diff --git a/src/gtk/nautilusgtksidebarrow.c b/src/gtk/nautilusgtksidebarrow.c
index 0b0d6103f..7cc24b09f 100644
--- a/src/gtk/nautilusgtksidebarrow.c
+++ b/src/gtk/nautilusgtksidebarrow.c
@@ -19,14 +19,14 @@
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "nautilus-enum-types.h"
#include "nautilusgtksidebarrowprivate.h"
/* For section and place type enums */
#include "nautilusgtkplacessidebarprivate.h"
+#include "nautilusgtkplacessidebar.h"
#ifdef HAVE_CLOUDPROVIDERS
-#include <cloudproviders.h>
+#include <cloudproviders/cloudprovidersaccount.h>
#endif
struct _NautilusGtkSidebarRow
@@ -36,21 +36,22 @@ struct _NautilusGtkSidebarRow
GIcon *end_icon;
GtkWidget *start_icon_widget;
GtkWidget *end_icon_widget;
- char *label;
- char *tooltip;
+ gchar *label;
+ gchar *tooltip;
GtkWidget *label_widget;
gboolean ejectable;
GtkWidget *eject_button;
- int order_index;
- NautilusGtkPlacesSectionType section_type;
- NautilusGtkPlacesPlaceType place_type;
- char *uri;
+ gint order_index;
+ NautilusGtkPlacesSidebarSectionType section_type;
+ NautilusGtkPlacesSidebarPlaceType place_type;
+ gchar *uri;
GDrive *drive;
GVolume *volume;
GMount *mount;
GObject *cloud_provider_account;
gboolean placeholder;
NautilusGtkPlacesSidebar *sidebar;
+ GtkWidget *event_box;
GtkWidget *revealer;
GtkWidget *busy_spinner;
};
@@ -87,7 +88,7 @@ cloud_row_update (NautilusGtkSidebarRow *self)
{
CloudProvidersAccount *account;
GIcon *end_icon;
- int provider_status;
+ gint provider_status;
account = CLOUD_PROVIDERS_ACCOUNT (self->cloud_provider_account);
provider_status = cloud_providers_account_get_status (account);
@@ -164,11 +165,11 @@ nautilus_gtk_sidebar_row_get_property (GObject *object,
break;
case PROP_SECTION_TYPE:
- g_value_set_enum (value, self->section_type);
+ g_value_set_int (value, self->section_type);
break;
case PROP_PLACE_TYPE:
- g_value_set_enum (value, self->place_type);
+ g_value_set_int (value, self->place_type);
break;
case PROP_URI:
@@ -207,6 +208,7 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
GParamSpec *pspec)
{
NautilusGtkSidebarRow *self = NAUTILUS_GTK_SIDEBAR_ROW (object);
+ GtkStyleContext *context;
switch (prop_id)
{
@@ -221,7 +223,9 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
if (object != NULL)
{
self->start_icon = G_ICON (g_object_ref (object));
- gtk_image_set_from_gicon (GTK_IMAGE (self->start_icon_widget), self->start_icon);
+ gtk_image_set_from_gicon (GTK_IMAGE (self->start_icon_widget),
+ self->start_icon,
+ GTK_ICON_SIZE_MENU);
}
else
{
@@ -237,7 +241,9 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
if (object != NULL)
{
self->end_icon = G_ICON (g_object_ref (object));
- gtk_image_set_from_gicon (GTK_IMAGE (self->end_icon_widget), self->end_icon);
+ gtk_image_set_from_gicon (GTK_IMAGE (self->end_icon_widget),
+ self->end_icon,
+ GTK_ICON_SIZE_MENU);
gtk_widget_show (self->end_icon_widget);
}
else
@@ -273,16 +279,16 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
break;
case PROP_SECTION_TYPE:
- self->section_type = g_value_get_enum (value);
- if (self->section_type == NAUTILUS_GTK_PLACES_SECTION_COMPUTER ||
- self->section_type == NAUTILUS_GTK_PLACES_SECTION_OTHER_LOCATIONS)
+ self->section_type = g_value_get_int (value);
+ if (self->section_type == SECTION_COMPUTER ||
+ self->section_type == SECTION_OTHER_LOCATIONS)
gtk_label_set_ellipsize (GTK_LABEL (self->label_widget), PANGO_ELLIPSIZE_NONE);
else
gtk_label_set_ellipsize (GTK_LABEL (self->label_widget), PANGO_ELLIPSIZE_END);
break;
case PROP_PLACE_TYPE:
- self->place_type = g_value_get_enum (value);
+ self->place_type = g_value_get_int (value);
break;
case PROP_URI:
@@ -334,8 +340,8 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
self->tooltip = NULL;
gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
self->ejectable = FALSE;
- self->section_type = NAUTILUS_GTK_PLACES_SECTION_BOOKMARKS;
- self->place_type = NAUTILUS_GTK_PLACES_BOOKMARK_PLACEHOLDER;
+ self->section_type = SECTION_BOOKMARKS;
+ self->place_type = PLACES_BOOKMARK_PLACEHOLDER;
g_free (self->uri);
self->uri = NULL;
g_clear_object (&self->drive);
@@ -343,9 +349,12 @@ nautilus_gtk_sidebar_row_set_property (GObject *object,
g_clear_object (&self->mount);
g_clear_object (&self->cloud_provider_account);
- gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (self), NULL);
+ gtk_container_foreach (GTK_CONTAINER (self),
+ (GtkCallback) gtk_widget_destroy,
+ NULL);
- gtk_widget_add_css_class (GTK_WIDGET (self), "sidebar-placeholder-row");
+ context = gtk_widget_get_style_context (GTK_WIDGET (self));
+ gtk_style_context_add_class (context, "sidebar-placeholder-row");
}
break;
@@ -371,18 +380,18 @@ on_child_revealed (GObject *self,
void
nautilus_gtk_sidebar_row_reveal (NautilusGtkSidebarRow *self)
{
- gtk_widget_show (GTK_WIDGET (self));
+ gtk_widget_show_all (GTK_WIDGET (self));
gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer), TRUE);
}
void
nautilus_gtk_sidebar_row_hide (NautilusGtkSidebarRow *self,
- gboolean immediate)
+ gboolean inmediate)
{
guint transition_duration;
transition_duration = gtk_revealer_get_transition_duration (GTK_REVEALER (self->revealer));
- if (immediate)
+ if (inmediate)
gtk_revealer_set_transition_duration (GTK_REVEALER (self->revealer), 0);
gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer), FALSE);
@@ -400,7 +409,8 @@ nautilus_gtk_sidebar_row_set_start_icon (NautilusGtkSidebarRow *self,
{
g_set_object (&self->start_icon, icon);
if (self->start_icon != NULL)
- gtk_image_set_from_gicon (GTK_IMAGE (self->start_icon_widget), self->start_icon);
+ gtk_image_set_from_gicon (GTK_IMAGE (self->start_icon_widget), self->start_icon,
+ GTK_ICON_SIZE_MENU);
else
gtk_image_clear (GTK_IMAGE (self->start_icon_widget));
@@ -418,7 +428,8 @@ nautilus_gtk_sidebar_row_set_end_icon (NautilusGtkSidebarRow *self,
{
g_set_object (&self->end_icon, icon);
if (self->end_icon != NULL)
- gtk_image_set_from_gicon (GTK_IMAGE (self->end_icon_widget), self->end_icon);
+ gtk_image_set_from_gicon (GTK_IMAGE (self->end_icon_widget), self->end_icon,
+ GTK_ICON_SIZE_MENU);
else
if (self->end_icon_widget != NULL)
gtk_image_clear (GTK_IMAGE (self->end_icon_widget));
@@ -456,8 +467,6 @@ static void
nautilus_gtk_sidebar_row_init (NautilusGtkSidebarRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
-
- gtk_widget_set_focus_on_click (GTK_WIDGET (self), FALSE);
}
static void
@@ -528,24 +537,22 @@ nautilus_gtk_sidebar_row_class_init (NautilusGtkSidebarRowClass *klass)
G_PARAM_STATIC_STRINGS));
properties [PROP_SECTION_TYPE] =
- g_param_spec_enum ("section-type",
- "section type",
- "The section type.",
- NAUTILUS_TYPE_GTK_PLACES_SECTION_TYPE,
- NAUTILUS_GTK_PLACES_SECTION_INVALID,
- (G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_CONSTRUCT_ONLY));
+ g_param_spec_int ("section-type",
+ "section type",
+ "The section type.",
+ SECTION_INVALID, N_SECTIONS, SECTION_INVALID,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
properties [PROP_PLACE_TYPE] =
- g_param_spec_enum ("place-type",
- "place type",
- "The place type.",
- NAUTILUS_TYPE_GTK_PLACES_PLACE_TYPE,
- NAUTILUS_GTK_PLACES_INVALID,
- (G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_CONSTRUCT_ONLY));
+ g_param_spec_int ("place-type",
+ "place type",
+ "The place type.",
+ PLACES_INVALID, N_PLACES, PLACES_INVALID,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
properties [PROP_URI] =
g_param_spec_string ("uri",
@@ -609,6 +616,7 @@ nautilus_gtk_sidebar_row_class_init (NautilusGtkSidebarRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, end_icon_widget);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, label_widget);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, eject_button);
+ gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, event_box);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, revealer);
gtk_widget_class_bind_template_child (widget_class, NautilusGtkSidebarRow, busy_spinner);
@@ -643,6 +651,12 @@ nautilus_gtk_sidebar_row_get_eject_button (NautilusGtkSidebarRow *self)
return self->eject_button;
}
+GtkWidget*
+nautilus_gtk_sidebar_row_get_event_box (NautilusGtkSidebarRow *self)
+{
+ return self->event_box;
+}
+
void
nautilus_gtk_sidebar_row_set_busy (NautilusGtkSidebarRow *row,
gboolean is_busy)
diff --git a/src/gtk/nautilusgtksidebarrow.ui b/src/gtk/nautilusgtksidebarrow.ui
index 956ea63cb..26265fcb3 100644
--- a/src/gtk/nautilusgtksidebarrow.ui
+++ b/src/gtk/nautilusgtksidebarrow.ui
@@ -1,70 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
-<interface domain="gtk40">
+<interface domain="gtk30">
<template class="NautilusGtkSidebarRow" parent="GtkListBoxRow">
- <property name="focus-on-click">0</property>
+ <property name="visible">True</property>
+ <property name="margin-top">1</property>
+ <property name="margin-bottom">1</property>
+ <property name="focus-on-click">False</property>
<style>
<class name="sidebar-row"/>
</style>
- <property name="child">
+ <child>
<object class="GtkRevealer" id="revealer">
+ <property name="visible">1</property>
<property name="reveal-child">1</property>
<signal name="notify::child-revealed" handler="on_child_revealed"/>
<style>
<class name="sidebar-revealer"/>
</style>
<child>
- <object class="GtkBox">
+ <object class="GtkEventBox" id="event_box">
+ <property name="visible">1</property>
<child>
- <object class="GtkImage" id="start_icon_widget">
- <style>
- <class name="sidebar-icon"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="label_widget">
- <property name="hexpand">1</property>
- <property name="xalign">0</property>
- <style>
- <class name="sidebar-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkImage" id="end_icon_widget">
- <property name="visible">0</property>
- <property name="hexpand">1</property>
- <property name="halign">2</property>
- <property name="valign">3</property>
- <style>
- <class name="sidebar-icon"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="eject_button">
- <property name="halign">3</property>
- <property name="valign">3</property>
- <property name="margin-start">4px</property>
- <property name="icon-name">media-eject-symbolic</property>
- <property name="tooltip-text" translatable="1">Unmount</property>
- <style>
- <class name="sidebar-button"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkSpinner" id="busy_spinner">
- <property name="spinning">1</property>
- <property name="halign">3</property>
- <property name="valign">3</property>
- <property name="margin-start">4px</property>
- <property name="visible">0</property>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <child>
+ <object class="GtkImage" id="start_icon_widget">
+ <property name="visible">True</property>
+ <style>
+ <class name="sidebar-icon"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_widget">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="sidebar-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="end_icon_widget">
+ <property name="visible">False</property>
+ <property name="hexpand">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="no-show-all">1</property>
+ <style>
+ <class name="sidebar-icon"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="eject_button">
+ <property name="visible">1</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="margin-start">4px</property>
+ <property name="no-show-all">1</property>
+ <property name="tooltip-text" translatable="yes">Unmount</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">media-eject-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ <class name="sidebar-button"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSpinner" id="busy_spinner">
+ <property name="active">1</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="margin-start">4px</property>
+ <property name="no-show-all">1</property>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
- </property>
+ </child>
</template>
</interface>
diff --git a/src/gtk/nautilusgtksidebarrowprivate.h b/src/gtk/nautilusgtksidebarrowprivate.h
index 0bd9355af..437384954 100644
--- a/src/gtk/nautilusgtksidebarrowprivate.h
+++ b/src/gtk/nautilusgtksidebarrowprivate.h
@@ -44,10 +44,11 @@ NautilusGtkSidebarRow *nautilus_gtk_sidebar_row_clone (NautilusGtkSidebarRow *s
/* Use these methods instead of gtk_widget_hide/show to use an animation */
void nautilus_gtk_sidebar_row_hide (NautilusGtkSidebarRow *self,
- gboolean immediate);
+ gboolean inmediate);
void nautilus_gtk_sidebar_row_reveal (NautilusGtkSidebarRow *self);
GtkWidget *nautilus_gtk_sidebar_row_get_eject_button (NautilusGtkSidebarRow *self);
+GtkWidget *nautilus_gtk_sidebar_row_get_event_box (NautilusGtkSidebarRow *self);
void nautilus_gtk_sidebar_row_set_start_icon (NautilusGtkSidebarRow *self,
GIcon *icon);
void nautilus_gtk_sidebar_row_set_end_icon (NautilusGtkSidebarRow *self,
diff --git a/src/meson.build b/src/meson.build
index 4c171bd6d..4a11e4ed8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,7 +14,6 @@ libnautilus_sources = [
c_template: 'nautilus-enum-types.c.template',
h_template: 'nautilus-enum-types.h.template',
sources: [
- 'gtk/nautilusgtkplacessidebarprivate.h',
'nautilus-enums.h',
'nautilus-search-popover.h',
'nautilus-special-location-bar.h',
@@ -56,15 +55,18 @@ libnautilus_sources = [
namespace: 'Nautilus'
),
'gtk/nautilusgtkbookmarksmanager.c',
- 'gtk/nautilusgtkbookmarksmanagerprivate.h',
+ 'gtk/nautilusgtkbookmarksmanager.h',
'gtk/nautilusgtkplacessidebar.c',
'gtk/nautilusgtkplacessidebarprivate.h',
+ 'gtk/nautilusgtkplacessidebar.h',
'gtk/nautilusgtksidebarrow.c',
'gtk/nautilusgtksidebarrowprivate.h',
'gtk/nautilusgtkplacesview.c',
'gtk/nautilusgtkplacesviewprivate.h',
'gtk/nautilusgtkplacesviewrow.c',
'gtk/nautilusgtkplacesviewrowprivate.h',
+ 'nautilus-gtk4-helpers.c',
+ 'nautilus-gtk4-helpers.h',
'nautilus-application.c',
'nautilus-application.h',
'nautilus-bookmark-list.c',
@@ -263,9 +265,9 @@ nautilus_deps = [
gmodule,
gnome_autoar,
gnome_desktop,
- libadwaita,
+ libhandy,
libportal,
- libportal_gtk4,
+ libportal_gtk3,
nautilus_extension,
selinux,
tracker_sparql,
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 505001f1a..e254c6513 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -33,7 +33,7 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#include <nautilus-extension.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -65,6 +65,7 @@
#include "nautilus-view.h"
#include "nautilus-window-slot.h"
#include "nautilus-window.h"
+#include "nautilus-gtk4-helpers.h"
typedef struct
{
@@ -634,7 +635,7 @@ static int
do_perform_self_checks (void)
{
#ifndef NAUTILUS_OMIT_SELF_CHECK
- gtk_init ();
+ gtk_init (NULL, NULL);
nautilus_profile_start (NULL);
/* Run the checks (each twice) for nautilus and libnautilus-private. */
@@ -764,7 +765,8 @@ action_help (GSimpleAction *action,
GError *error = NULL;
window = gtk_application_get_active_window (application);
- gtk_show_uri (window, "help:gnome-help/files", GDK_CURRENT_TIME);
+ gtk_show_uri_on_window (window, "help:gnome-help/files",
+ gtk_get_current_event_time (), &error);
if (error)
{
@@ -775,7 +777,7 @@ action_help (GSimpleAction *action,
_("There was an error displaying help: \n%s"),
error->message);
g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (gtk_window_destroy),
+ G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
@@ -1131,7 +1133,7 @@ theme_changed (GtkSettings *settings)
{
provider = gtk_css_provider_new ();
file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/Adwaita.css");
- gtk_css_provider_load_from_file (provider, file);
+ gtk_css_provider_load_from_file (provider, file, NULL);
g_object_unref (file);
}
@@ -1151,7 +1153,7 @@ theme_changed (GtkSettings *settings)
{
permanent_provider = gtk_css_provider_new ();
file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/nautilus.css");
- gtk_css_provider_load_from_file (permanent_provider, file);
+ gtk_css_provider_load_from_file (permanent_provider, file, NULL);
/* The behavior of two style providers with the same priority is
* undefined and gtk happens to prefer the provider that got added last.
* Use a higher priority here to avoid this problem.
@@ -1271,7 +1273,7 @@ nautilus_application_startup_common (NautilusApplication *self)
*/
G_APPLICATION_CLASS (nautilus_application_parent_class)->startup (G_APPLICATION (self));
- adw_init ();
+ hdy_init ();
gtk_window_set_default_icon_name (APPLICATION_ID);
@@ -1304,7 +1306,7 @@ nautilus_application_startup_common (NautilusApplication *self)
g_signal_connect (self, "shutdown", G_CALLBACK (on_application_shutdown), NULL);
- g_signal_connect_object (gtk_icon_theme_get_for_display (gdk_display_get_default ()),
+ g_signal_connect_object (gtk_icon_theme_get_default (),
"changed",
G_CALLBACK (icon_theme_changed_callback),
NULL, 0);
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index cf2007a61..0496be5b5 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -47,7 +47,7 @@ autorun_software_dialog_destroy (AutorunSoftwareDialogData *data)
G_CALLBACK (autorun_software_dialog_mount_unmounted),
data);
- gtk_window_destroy (GTK_WINDOW (data->dialog));
+ gtk_widget_destroy (GTK_WIDGET (data->dialog));
g_object_unref (data->mount);
g_free (data);
}
@@ -159,10 +159,10 @@ out:
g_signal_connect (dialog,
"response",
- G_CALLBACK (gtk_window_destroy),
+ G_CALLBACK (gtk_widget_destroy),
NULL);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
}
@@ -171,7 +171,7 @@ autorun_software_dialog_response (GtkDialog *dialog,
gint response_id,
GMount *mount)
{
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
if (response_id == GTK_RESPONSE_OK)
{
@@ -236,7 +236,7 @@ present_autorun_for_software_dialog (GMount *mount)
G_CALLBACK (autorun_software_dialog_response),
mount);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
int
@@ -252,7 +252,7 @@ main (int argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- gtk_init ();
+ gtk_init (&argc, &argv);
if (argc != 2)
{
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 514be8879..9bb16e0c1 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -63,6 +63,8 @@ struct _NautilusBatchRenameDialog
GList *listbox_icons;
GtkSizeGroup *size_group;
+ GList *motion_controllers;
+
GList *selection;
GList *new_names;
NautilusBatchRenameDialogMode mode;
@@ -427,14 +429,14 @@ batch_rename_dialog_get_new_names (NautilusBatchRenameDialog *dialog)
if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_REPLACE)
{
- entry_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->find_entry)));
+ entry_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->find_entry)));
}
else
{
- entry_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->name_entry)));
+ entry_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->name_entry)));
}
- replace_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->replace_entry)));
+ replace_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->replace_entry)));
if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_REPLACE)
{
@@ -472,7 +474,7 @@ begin_batch_rename (NautilusBatchRenameDialog *dialog,
/* do the actual rename here */
nautilus_file_batch_rename (dialog->selection, new_names, NULL, NULL);
- gtk_widget_set_cursor (GTK_WIDGET (dialog->window), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog->window)), NULL);
}
static void
@@ -582,7 +584,7 @@ create_original_name_label (NautilusBatchRenameDialog *dialog,
dialog->listbox_labels_old = g_list_prepend (dialog->listbox_labels_old, label_old);
- gtk_widget_show (label_old);
+ gtk_widget_show_all (label_old);
return label_old;
}
@@ -601,7 +603,7 @@ create_result_label (NautilusBatchRenameDialog *dialog,
dialog->listbox_labels_new = g_list_prepend (dialog->listbox_labels_new, label_new);
- gtk_widget_show (label_new);
+ gtk_widget_show_all (label_new);
return label_new;
}
@@ -627,7 +629,7 @@ create_arrow (NautilusBatchRenameDialog *dialog,
dialog->listbox_icons = g_list_prepend (dialog->listbox_icons, icon);
- gtk_widget_show (icon);
+ gtk_widget_show_all (icon);
return icon;
}
@@ -635,6 +637,9 @@ create_arrow (NautilusBatchRenameDialog *dialog,
static void
prepare_batch_rename (NautilusBatchRenameDialog *dialog)
{
+ GdkCursor *cursor;
+ GdkDisplay *display;
+
/* wait for checking conflicts to finish, to be sure that
* the rename can actually take place */
if (dialog->directories_pending_conflict_check != NULL)
@@ -648,14 +653,22 @@ prepare_batch_rename (NautilusBatchRenameDialog *dialog)
return;
}
- gtk_widget_set_cursor_from_name (GTK_WIDGET (dialog->window), "progress");
+ display = gtk_widget_get_display (GTK_WIDGET (dialog->window));
+ cursor = gdk_cursor_new_from_name (display, "progress");
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog->window)),
+ cursor);
+ g_object_unref (cursor);
- gtk_widget_set_cursor_from_name (GTK_WIDGET (dialog), "progress");
+ display = gtk_widget_get_display (GTK_WIDGET (dialog));
+ cursor = gdk_cursor_new_from_name (display, "progress");
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog)),
+ cursor);
+ g_object_unref (cursor);
gtk_widget_hide (GTK_WIDGET (dialog));
begin_batch_rename (dialog, dialog->new_names);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -674,7 +687,7 @@ batch_rename_dialog_on_response (NautilusBatchRenameDialog *dialog,
cancel_conflict_check (dialog);
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
}
@@ -926,7 +939,7 @@ update_listbox (NautilusBatchRenameDialog *dialog)
else
{
new_name = batch_rename_replace_label_text (old_name,
- gtk_editable_get_text (GTK_EDITABLE
(dialog->find_entry)));
+ gtk_entry_get_text (GTK_ENTRY (dialog->find_entry)));
gtk_label_set_markup (GTK_LABEL (label), new_name->str);
g_string_free (new_name, TRUE);
@@ -1214,11 +1227,11 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_FORMAT)
{
- entry_text = gtk_editable_get_text (GTK_EDITABLE (dialog->name_entry));
+ entry_text = gtk_entry_get_text (GTK_ENTRY (dialog->name_entry));
}
else
{
- entry_text = gtk_editable_get_text (GTK_EDITABLE (dialog->replace_entry));
+ entry_text = gtk_entry_get_text (GTK_ENTRY (dialog->replace_entry));
}
if (strstr (entry_text, "/") != NULL)
@@ -1373,7 +1386,7 @@ update_display_text (NautilusBatchRenameDialog *dialog)
static void
batch_rename_dialog_mode_changed (NautilusBatchRenameDialog *dialog)
{
- if (gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->format_mode_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->format_mode_button)))
{
gtk_stack_set_visible_child_name (GTK_STACK (dialog->mode_stack), "format");
@@ -1846,6 +1859,7 @@ nautilus_batch_rename_dialog_finalize (GObject *object)
nautilus_directory_list_free (dialog->distinct_parent_directories);
g_object_unref (dialog->size_group);
+ g_clear_list (&dialog->motion_controllers, g_object_unref);
g_hash_table_destroy (dialog->tag_info_table);
@@ -1980,7 +1994,7 @@ nautilus_batch_rename_dialog_new (GList *selection,
fill_display_listbox (dialog);
- gtk_widget_set_cursor (GTK_WIDGET (window), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
g_string_free (dialog_title, TRUE);
@@ -1993,13 +2007,15 @@ connect_to_pointer_motion_events (NautilusBatchRenameDialog *self,
{
GtkEventController *controller;
- controller = gtk_event_controller_motion_new ();
- gtk_widget_add_controller (listbox, controller);
+ controller = gtk_event_controller_motion_new (listbox);
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
g_signal_connect (controller, "leave",
G_CALLBACK (on_event_controller_motion_leave), self);
g_signal_connect (controller, "motion",
G_CALLBACK (on_event_controller_motion_motion), self);
+
+ self->motion_controllers = g_list_prepend (self->motion_controllers,
+ controller);
}
static void
diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c
index 17a5be4b7..687cb5558 100644
--- a/src/nautilus-compress-dialog-controller.c
+++ b/src/nautilus-compress-dialog-controller.c
@@ -19,7 +19,7 @@
#include <glib/gi18n.h>
#include <gnome-autoar/gnome-autoar.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#include <eel/eel-vfs-extensions.h>
@@ -203,7 +203,7 @@ update_selected_format (NautilusCompressDialogController *self,
gtk_widget_set_visible (self->passphrase_entry, show_passphrase);
if (!show_passphrase)
{
- gtk_editable_set_text (GTK_EDITABLE (self->passphrase_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (self->passphrase_entry), "");
gtk_entry_set_visibility (GTK_ENTRY (self->passphrase_entry), FALSE);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->passphrase_entry),
GTK_ENTRY_ICON_SECONDARY,
@@ -213,11 +213,21 @@ update_selected_format (NautilusCompressDialogController *self,
gtk_stack_set_visible_child (GTK_STACK (self->extension_stack),
active_label);
- gtk_image_set_from_icon_name (GTK_IMAGE (self->zip_checkmark), NULL);
- gtk_image_set_from_icon_name (GTK_IMAGE (self->encrypted_zip_checkmark), NULL);
- gtk_image_set_from_icon_name (GTK_IMAGE (self->tar_xz_checkmark), NULL);
- gtk_image_set_from_icon_name (GTK_IMAGE (self->seven_zip_checkmark), NULL);
- gtk_image_set_from_icon_name (GTK_IMAGE (active_checkmark), "object-select-symbolic");
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->zip_checkmark),
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->encrypted_zip_checkmark),
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->tar_xz_checkmark),
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->seven_zip_checkmark),
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (active_checkmark),
+ "object-select-symbolic",
+ GTK_ICON_SIZE_BUTTON);
g_settings_set_enum (nautilus_compression_preferences,
NAUTILUS_PREFERENCES_DEFAULT_COMPRESSION_FORMAT,
@@ -230,7 +240,7 @@ update_selected_format (NautilusCompressDialogController *self,
}
static void
-zip_row_on_activated (AdwActionRow *row,
+zip_row_on_activated (HdyActionRow *row,
gpointer user_data)
{
NautilusCompressDialogController *controller;
@@ -243,7 +253,7 @@ zip_row_on_activated (AdwActionRow *row,
}
static void
-encrypted_zip_row_on_activated (AdwActionRow *row,
+encrypted_zip_row_on_activated (HdyActionRow *row,
gpointer user_data)
{
NautilusCompressDialogController *controller;
@@ -256,7 +266,7 @@ encrypted_zip_row_on_activated (AdwActionRow *row,
}
static void
-tar_xz_row_on_activated (AdwActionRow *row,
+tar_xz_row_on_activated (HdyActionRow *row,
gpointer user_data)
{
NautilusCompressDialogController *controller;
@@ -269,7 +279,7 @@ tar_xz_row_on_activated (AdwActionRow *row,
}
static void
-seven_zip_row_on_activated (AdwActionRow *row,
+seven_zip_row_on_activated (HdyActionRow *row,
gpointer user_data)
{
NautilusCompressDialogController *controller;
@@ -291,7 +301,7 @@ passphrase_entry_on_changed (GtkEditable *editable,
self = NAUTILUS_COMPRESS_DIALOG_CONTROLLER (user_data);
g_free (self->passphrase);
- self->passphrase = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->passphrase_entry)));
+ self->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->passphrase_entry)));
/* Simulate a change of the name_entry to ensure the correct sensitivity of
* the activate_button, but only if the name_entry is valid in order to
@@ -498,10 +508,10 @@ nautilus_compress_dialog_controller_new (GtkWindow *parent_window,
if (initial_name != NULL)
{
- gtk_editable_set_text (GTK_EDITABLE (name_entry), initial_name);
+ gtk_entry_set_text (GTK_ENTRY (name_entry), initial_name);
}
- gtk_widget_show (compress_dialog);
+ gtk_widget_show_all (compress_dialog);
update_selected_format (self, format);
@@ -523,7 +533,7 @@ nautilus_compress_dialog_controller_finalize (GObject *object)
if (self->compress_dialog != NULL)
{
g_clear_signal_handler (&self->response_handler_id, self->compress_dialog);
- gtk_window_destroy (GTK_WINDOW (self->compress_dialog));
+ gtk_widget_destroy (self->compress_dialog);
self->compress_dialog = NULL;
}
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index a1e9ff128..4803d52fa 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -27,6 +27,7 @@
#include "nautilus-dnd.h"
#include "nautilus-program-choosing.h"
+#include "nautilus-gtk4-helpers.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
@@ -413,7 +414,7 @@ nautilus_drag_get_source_data (GdkDragContext *context)
NautilusWindowSlot *active_slot;
NautilusView *view;
- window = NAUTILUS_WINDOW (gtk_widget_get_root (source_widget));
+ window = NAUTILUS_WINDOW (gtk_widget_get_toplevel (source_widget));
active_slot = nautilus_window_get_active_slot (window);
view = nautilus_window_slot_get_current_view (active_slot);
if (NAUTILUS_IS_LIST_VIEW (view))
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index 327c5c69b..0adc39142 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -69,11 +69,11 @@ nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd,
void
nautilus_file_conflict_dialog_set_images (NautilusFileConflictDialog *fcd,
- GdkPaintable *destination_paintable,
- GdkPaintable *source_paintable)
+ GdkPixbuf *destination_pixbuf,
+ GdkPixbuf *source_pixbuf)
{
- gtk_image_set_from_paintable (GTK_IMAGE (fcd->dest_image), destination_paintable);
- gtk_image_set_from_paintable (GTK_IMAGE (fcd->src_image), source_paintable);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->dest_image), destination_pixbuf);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->src_image), source_pixbuf);
}
void
@@ -97,7 +97,7 @@ nautilus_file_conflict_dialog_set_suggested_name (NautilusFileConflictDialog *fc
gchar *suggested_name)
{
fcd->suggested_name = g_strdup (suggested_name);
- gtk_editable_set_text (GTK_EDITABLE (fcd->entry), suggested_name);
+ gtk_entry_set_text (GTK_ENTRY (fcd->entry), suggested_name);
}
void
@@ -129,8 +129,8 @@ static void
entry_text_changed_cb (GtkEditable *entry,
NautilusFileConflictDialog *dialog)
{
- if (g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (entry)), "") != 0 &&
- g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (entry)), dialog->conflict_name) != 0)
+ if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (entry)), "") != 0 &&
+ g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (entry)), dialog->conflict_name) != 0)
{
gtk_widget_set_sensitive (dialog->rename_button, TRUE);
}
@@ -171,7 +171,7 @@ on_expanded_notify (GtkExpander *w,
gtk_widget_set_sensitive (dialog->checkbox, FALSE);
gtk_widget_grab_focus (dialog->entry);
- if (g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (dialog->entry)), dialog->suggested_name) == 0)
+ if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (dialog->entry)), dialog->suggested_name) == 0)
{
/* The suggested name is in the form "original (1).txt", if the
* the conflicting name was "original.txt". The user may want to
@@ -198,10 +198,10 @@ on_expanded_notify (GtkExpander *w,
}
static void
-checkbox_toggled_cb (GtkCheckButton *t,
+checkbox_toggled_cb (GtkToggleButton *t,
NautilusFileConflictDialog *dialog)
{
- gtk_widget_set_sensitive (dialog->expander, !gtk_check_button_get_active (t));
+ gtk_widget_set_sensitive (dialog->expander, !gtk_toggle_button_get_active (t));
}
static void
@@ -210,7 +210,7 @@ reset_button_clicked_cb (GtkButton *w,
{
int start_pos, end_pos;
- gtk_editable_set_text (GTK_EDITABLE (dialog->entry), dialog->conflict_name);
+ gtk_entry_set_text (GTK_ENTRY (dialog->entry), dialog->conflict_name);
gtk_widget_grab_focus (dialog->entry);
eel_filename_get_rename_region (dialog->conflict_name, &start_pos, &end_pos);
gtk_editable_select_region (GTK_EDITABLE (dialog->entry), start_pos, end_pos);
@@ -288,13 +288,13 @@ nautilus_file_conflict_dialog_delay_buttons_activation (NautilusFileConflictDial
char *
nautilus_file_conflict_dialog_get_new_name (NautilusFileConflictDialog *dialog)
{
- return g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->entry)));
+ return g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->entry)));
}
gboolean
nautilus_file_conflict_dialog_get_apply_to_all (NautilusFileConflictDialog *dialog)
{
- return gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->checkbox));
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbox));
}
NautilusFileConflictDialog *
diff --git a/src/nautilus-file-conflict-dialog.h b/src/nautilus-file-conflict-dialog.h
index 70f81d0b3..c62b43018 100644
--- a/src/nautilus-file-conflict-dialog.h
+++ b/src/nautilus-file-conflict-dialog.h
@@ -38,8 +38,8 @@ void nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd,
gchar *primary_text,
gchar *secondary_text);
void nautilus_file_conflict_dialog_set_images (NautilusFileConflictDialog *fcd,
- GdkPaintable *source_paintable,
- GdkPaintable *destination_paintable);
+ GdkPixbuf *source_pixbuf,
+ GdkPixbuf *destination_pixbuf);
void nautilus_file_conflict_dialog_set_file_labels (NautilusFileConflictDialog *fcd,
gchar *destination_label,
gchar *source_label);
diff --git a/src/nautilus-file-name-widget-controller.c b/src/nautilus-file-name-widget-controller.c
index db048b7f8..308ab51f2 100644
--- a/src/nautilus-file-name-widget-controller.c
+++ b/src/nautilus-file-name-widget-controller.c
@@ -122,7 +122,7 @@ real_get_new_name (NautilusFileNameWidgetController *self)
priv = nautilus_file_name_widget_controller_get_instance_private (self);
- return g_strstrip (g_strdup (gtk_editable_get_text (GTK_EDITABLE (priv->name_entry))));
+ return g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->name_entry))));
}
static gboolean
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index a6ab32905..7af3865aa 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -59,13 +59,14 @@
#include "nautilus-file-undo-operations.h"
#include "nautilus-file-undo-manager.h"
#include "nautilus-ui-utilities.h"
+#include "nautilus-gtk4-helpers.h"
#ifdef GDK_WINDOWING_X11
-#include <gdk/x11/gdkx.h>
+#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_WAYLAND
-#include <gdk/wayland/gdkwayland.h>
+#include <gdk/gdkwayland.h>
#endif
typedef struct
@@ -1242,13 +1243,13 @@ typedef struct
} RunSimpleDialogData;
static void
-set_transient_for (GdkSurface *child_surface,
+set_transient_for (GdkWindow *child_window,
const char *parent_handle)
{
GdkDisplay *display;
const char *prefix;
- display = gdk_surface_get_display (child_surface);
+ display = gdk_window_get_display (child_window);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
@@ -1258,14 +1259,15 @@ set_transient_for (GdkSurface *child_surface,
if (g_str_has_prefix (parent_handle, prefix))
{
const char *handle;
- GdkSurface *surface;
+ GdkWindow *window;
handle = parent_handle + strlen (prefix);
- surface = gdk_x11_surface_lookup_for_display (display, strtol (handle, NULL, 16));
+ window = gdk_x11_window_foreign_new_for_display (display, strtol (handle, NULL, 16));
- if (surface != NULL)
+ if (window != NULL)
{
- gdk_toplevel_set_transient_for (GDK_TOPLEVEL (child_surface), surface);
+ gdk_window_set_transient_for (child_window, window);
+ g_object_unref (window);
}
}
}
@@ -1282,7 +1284,7 @@ set_transient_for (GdkSurface *child_surface,
handle = parent_handle + strlen (prefix);
- gdk_wayland_toplevel_set_transient_for_exported (GDK_TOPLEVEL (child_surface), (char *) handle);
+ gdk_wayland_window_set_transient_for_exported (child_window, (char *) handle);
}
}
#endif
@@ -1296,7 +1298,7 @@ dialog_realize_cb (GtkWidget *widget,
const char *parent_handle;
parent_handle = nautilus_file_operations_dbus_data_get_parent_handle (dbus_data);
- set_transient_for (gtk_native_get_surface (gtk_widget_get_native (widget)), parent_handle);
+ set_transient_for (gtk_widget_get_window (widget), parent_handle);
}
static gboolean
@@ -1325,7 +1327,7 @@ simple_dialog_cb (GtkDialog *dialog,
return;
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
data->result = response_id;
data->completed = TRUE;
@@ -1393,7 +1395,7 @@ do_run_simple_dialog (gpointer _data)
content_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
label = gtk_label_new (data->details_text);
- gtk_label_set_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
/* Ideally, we shouldn’t do this.
@@ -1429,7 +1431,7 @@ do_run_simple_dialog (gpointer _data)
/* Run it. */
g_signal_connect (dialog, "response", G_CALLBACK (simple_dialog_cb), data);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
return FALSE;
}
@@ -3078,7 +3080,7 @@ empty_trash_prompt_cb (GtkDialog *dialog,
unmount_data_free (data);
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
void
@@ -3114,7 +3116,7 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *parent_win
dialog = create_empty_trash_prompt (parent_window);
g_signal_connect (dialog, "response", G_CALLBACK (empty_trash_prompt_cb), data);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
return;
}
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 36c1462e4..011842bd1 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5378,30 +5378,17 @@ out:
return icon;
}
-GdkTexture *
-nautilus_file_get_icon_texture (NautilusFile *file,
- int size,
- int scale,
- NautilusFileIconFlags flags)
+GdkPixbuf *
+nautilus_file_get_icon_pixbuf (NautilusFile *file,
+ int size,
+ int scale,
+ NautilusFileIconFlags flags)
{
g_autoptr (NautilusIconInfo) info = NULL;
info = nautilus_file_get_icon (file, size, scale, flags);
- return nautilus_icon_info_get_texture (info);
-}
-
-GdkPaintable *
-nautilus_file_get_icon_paintable (NautilusFile *file,
- int size,
- int scale,
- NautilusFileIconFlags flags)
-{
- g_autoptr (NautilusIconInfo) info = NULL;
-
- info = nautilus_file_get_icon (file, size, scale, flags);
-
- return nautilus_icon_info_get_paintable (info);
+ return nautilus_icon_info_get_pixbuf_at_size (info, size);
}
gboolean
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index e2af19e94..a50d27df0 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -473,11 +473,7 @@ NautilusIconInfo * nautilus_file_get_icon (Nautilu
int size,
int
scale,
NautilusFileIconFlags
flags);
-GdkTexture * nautilus_file_get_icon_texture (NautilusFile
*file,
- int size,
- int
scale,
- NautilusFileIconFlags
flags);
-GdkPaintable * nautilus_file_get_icon_paintable (NautilusFile
*file,
+GdkPixbuf * nautilus_file_get_icon_pixbuf (NautilusFile
*file,
int size,
int
scale,
NautilusFileIconFlags
flags);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index c815e8c74..ac2c0525b 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -87,10 +87,11 @@
#include "nautilus-view-icon-controller.h"
#include "nautilus-window.h"
#include "nautilus-tracker-utilities.h"
+#include "nautilus-gtk4-helpers.h"
#ifdef HAVE_LIBPORTAL
#include <libportal/portal.h>
-#include <libportal-gtk4/portal-gtk4.h>
+#include <libportal-gtk3/portal-gtk3.h>
#endif
/* Minimum starting update inverval */
@@ -520,7 +521,8 @@ remove_floating_bar_passthrough (gpointer data)
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (NAUTILUS_FILES_VIEW (data));
- gtk_widget_set_can_target (priv->floating_bar, TRUE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->floating_bar, FALSE);
priv->floating_bar_set_passthrough_timeout_id = 0;
return G_SOURCE_REMOVE;
@@ -544,7 +546,7 @@ set_floating_bar_status (NautilusFilesView *view,
priv->floating_bar_set_status_timeout_id = 0;
}
- settings = gtk_settings_get_for_display (gtk_widget_get_display (GTK_WIDGET (view)));
+ settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (view)));
g_object_get (settings,
"gtk-double-click-time", &double_click_time,
NULL);
@@ -561,7 +563,8 @@ set_floating_bar_status (NautilusFilesView *view,
}
/* Activate passthrough on the floating bar just long enough for a
* potential double click to happen, so to not interfere with it */
- gtk_widget_set_can_target (priv->floating_bar, FALSE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->floating_bar, TRUE);
priv->floating_bar_set_passthrough_timeout_id = g_timeout_add ((guint) double_click_time,
remove_floating_bar_passthrough,
view);
@@ -1433,7 +1436,7 @@ app_chooser_dialog_response_cb (GtkDialog *dialog,
g_object_unref (info);
out:
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -1688,7 +1691,7 @@ pattern_select_response_cb (GtkWidget *dialog,
entry = g_object_get_data (G_OBJECT (dialog), "entry");
directory = nautilus_files_view_get_model (view);
selection = nautilus_directory_match_pattern (directory,
- gtk_editable_get_text (GTK_EDITABLE (entry)));
+ gtk_entry_get_text (GTK_ENTRY (entry)));
nautilus_files_view_call_set_selection (view, selection);
nautilus_files_view_reveal_selection (view);
@@ -1704,7 +1707,7 @@ pattern_select_response_cb (GtkWidget *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
{
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
break;
@@ -3120,7 +3123,7 @@ slot_active_changed (NautilusWindowSlot *slot,
}
}
-static gboolean
+static void
nautilus_files_view_grab_focus (GtkWidget *widget)
{
/* focus the child of the scrolled window if it exists */
@@ -3132,12 +3135,12 @@ nautilus_files_view_grab_focus (GtkWidget *widget)
priv = nautilus_files_view_get_instance_private (view);
child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (priv->scrolled_window));
- if (child != NULL)
+ GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->grab_focus (widget);
+
+ if (child)
{
- return gtk_widget_grab_focus (GTK_WIDGET (child));
+ gtk_widget_grab_focus (GTK_WIDGET (child));
}
-
- return GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->grab_focus (widget);
}
static void
@@ -3188,9 +3191,6 @@ nautilus_files_view_dispose (GObject *object)
priv->in_destruction = TRUE;
nautilus_files_view_stop_loading (view);
- g_clear_pointer (&priv->selection_menu, gtk_widget_unparent);
- g_clear_pointer (&priv->background_menu, gtk_widget_unparent);
-
if (priv->model)
{
nautilus_directory_unref (priv->model);
@@ -4872,13 +4872,13 @@ nautilus_files_view_get_directory_as_file (NautilusFilesView *view)
return priv->directory_as_file;
}
-static GdkTexture *
+static GdkPixbuf *
get_menu_icon_for_file (NautilusFile *file,
GtkWidget *widget)
{
int scale = gtk_widget_get_scale_factor (widget);
- return nautilus_file_get_icon_texture (file, 16, scale, 0);
+ return nautilus_file_get_icon_pixbuf (file, 16, scale, 0);
}
static GList *
@@ -5284,7 +5284,7 @@ add_script_to_scripts_menus (NautilusFilesView *view,
gchar *name;
g_autofree gchar *uri = NULL;
g_autofree gchar *escaped_uri = NULL;
- GdkTexture *mimetype_icon;
+ GdkPixbuf *mimetype_icon;
gchar *action_name, *detailed_action_name;
ScriptLaunchParameters *launch_parameters;
GAction *action;
@@ -5529,7 +5529,7 @@ add_template_to_templates_menus (NautilusFilesView *view,
NautilusFilesViewPrivate *priv;
char *tmp, *uri, *name;
g_autofree gchar *escaped_uri = NULL;
- GdkTexture *mimetype_icon;
+ GdkPixbuf *mimetype_icon;
char *action_name, *detailed_action_name;
CreateTemplateParameters *parameters;
GAction *action;
@@ -5862,7 +5862,7 @@ on_destination_dialog_response (GtkDialog *dialog,
}
copy_data_free (copy_data);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -5896,6 +5896,7 @@ copy_or_move_selection (NautilusFilesView *view,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Select"), GTK_RESPONSE_OK,
NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
@@ -5922,12 +5923,12 @@ copy_or_move_selection (NautilusFilesView *view,
location = nautilus_directory_get_location (priv->model);
}
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), location, NULL);
+ gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog), location, NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (on_destination_dialog_response),
copy_data);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
static void
@@ -6114,14 +6115,18 @@ real_action_rename (NautilusFilesView *view)
/* If there is more than one file selected, invoke a batch renamer */
if (selection->next != NULL)
{
- NautilusWindow *window;
+ GdkCursor *cursor;
+ GdkDisplay *display;
- window = nautilus_files_view_get_window (view);
- gtk_widget_set_cursor_from_name (GTK_WIDGET (window), "progress");
+ display = gtk_widget_get_display (GTK_WIDGET (nautilus_files_view_get_window (view)));
+ cursor = gdk_cursor_new_from_name (display, "progress");
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (nautilus_files_view_get_window
(view))),
+ cursor);
+ g_object_unref (cursor);
dialog = nautilus_batch_rename_dialog_new (selection,
nautilus_files_view_get_model (view),
- window);
+ nautilus_files_view_get_window (view));
gtk_widget_show (GTK_WIDGET (dialog));
}
@@ -6314,7 +6319,7 @@ on_extract_destination_dialog_response (GtkDialog *dialog,
extract_files (data->view, data->files, destination_directory);
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
nautilus_file_list_free (data->files);
g_free (data);
}
@@ -6343,6 +6348,7 @@ extract_files_to_chosen_location (NautilusFilesView *view,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Select"), GTK_RESPONSE_OK,
NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
@@ -6368,7 +6374,7 @@ extract_files_to_chosen_location (NautilusFilesView *view,
location = nautilus_directory_get_location (priv->model);
}
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), location, NULL);
+ gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog), location, NULL);
data->view = view;
data->files = nautilus_file_list_copy (files);
@@ -6377,7 +6383,7 @@ extract_files_to_chosen_location (NautilusFilesView *view,
G_CALLBACK (on_extract_destination_dialog_response),
data);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
static void
@@ -8263,13 +8269,12 @@ nautilus_files_view_pop_up_selection_context_menu (NautilusFilesView *view,
if (NULL == priv->selection_menu)
{
- priv->selection_menu = gtk_popover_menu_new_from_model (NULL);
- gtk_widget_set_parent (priv->selection_menu, GTK_WIDGET (view));
- g_signal_connect (priv->selection_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL);
+ priv->selection_menu = gtk_popover_new (GTK_WIDGET (view));
}
- gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (priv->selection_menu),
- G_MENU_MODEL (priv->selection_menu_model));
+ gtk_popover_bind_model (GTK_POPOVER (priv->selection_menu),
+ G_MENU_MODEL (priv->selection_menu_model),
+ NULL);
if (x == -1 && y == -1)
{
/* If triggered from the keyboard, popup at selection, not pointer */
@@ -8311,16 +8316,13 @@ nautilus_files_view_pop_up_background_context_menu (NautilusFilesView *view,
*/
update_context_menus_if_pending (view);
-
if (NULL == priv->background_menu)
{
- priv->background_menu = gtk_popover_menu_new_from_model (NULL);
- gtk_widget_set_parent (priv->background_menu, GTK_WIDGET (view));
- g_signal_connect (priv->background_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL);
+ priv->background_menu = gtk_popover_new (GTK_WIDGET (view));
}
- gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (priv->background_menu),
- G_MENU_MODEL (priv->background_menu_model));
-
+ gtk_popover_bind_model (GTK_POPOVER (priv->background_menu),
+ G_MENU_MODEL (priv->background_menu_model),
+ NULL);
gtk_popover_set_pointing_to (GTK_POPOVER (priv->background_menu),
&(GdkRectangle){x, y, 0, 0});
gtk_popover_popup (GTK_POPOVER (priv->background_menu));
@@ -9116,26 +9118,42 @@ nautilus_files_view_set_property (GObject *object,
/* handle Ctrl+Scroll, which will cause a zoom-in/out */
static gboolean
-on_scroll (GtkEventControllerScroll *scroll,
- gdouble dx,
- gdouble dy,
- gpointer user_data)
+on_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
NautilusFilesView *directory_view;
+ static gdouble total_delta_y = 0;
GdkModifierType state;
+ GdkScrollDirection direction;
+ gdouble delta_x, delta_y;
- directory_view = NAUTILUS_FILES_VIEW (user_data);
+ directory_view = NAUTILUS_FILES_VIEW (widget);
- state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (scroll));
- if (state & GDK_CONTROL_MASK)
+ if (gdk_event_get_event_type (event) != GDK_SCROLL)
{
- if (dy <= -1)
+ return GDK_EVENT_PROPAGATE;
+ }
+
+ if (!gdk_event_get_state (event, &state))
+ {
+ return GDK_EVENT_PROPAGATE;
+ }
+
+ if (!(state & GDK_CONTROL_MASK))
+ {
+ return GDK_EVENT_PROPAGATE;
+ }
+
+ if (gdk_event_get_scroll_direction (event, &direction))
+ {
+ if (direction == GDK_SCROLL_UP)
{
/* Zoom In */
nautilus_files_view_bump_zoom_level (directory_view, 1);
return GDK_EVENT_STOP;
}
- else if (dy >= 1)
+ else if (direction == GDK_SCROLL_DOWN)
{
/* Zoom Out */
nautilus_files_view_bump_zoom_level (directory_view, -1);
@@ -9143,6 +9161,32 @@ on_scroll (GtkEventControllerScroll *scroll,
}
}
+ if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
+ {
+ /* try to emulate a normal scrolling event by summing deltas */
+ total_delta_y += delta_y;
+
+ if (total_delta_y >= 1)
+ {
+ total_delta_y = 0;
+ /* emulate scroll down */
+ nautilus_files_view_bump_zoom_level (directory_view, -1);
+ return GDK_EVENT_STOP;
+ }
+ else if (total_delta_y <= -1)
+ {
+ total_delta_y = 0;
+ /* emulate scroll up */
+ nautilus_files_view_bump_zoom_level (directory_view, 1);
+ return GDK_EVENT_STOP;
+ }
+ else
+ {
+ /* eat event */
+ return GDK_EVENT_STOP;
+ }
+ }
+
return GDK_EVENT_PROPAGATE;
}
@@ -9464,7 +9508,6 @@ nautilus_files_view_init (NautilusFilesView *view)
#endif
NautilusDirectory *scripts_directory;
NautilusDirectory *templates_directory;
- GtkEventController *controller;
gchar *templates_uri;
#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
GtkClipboard *clipboard;
@@ -9551,18 +9594,24 @@ nautilus_files_view_init (NautilusFilesView *view)
gtk_grid_attach_next_to (GTK_GRID (view), priv->overlay, NULL, GTK_POS_BOTTOM, 1, 1);
gtk_widget_show (priv->overlay);
+ /* NautilusFloatingBar listen to its parent's 'event' signal
+ * and GtkOverlay doesn't have it enabled by default, so we have to add them
+ * here.
+ */
+ gtk_widget_add_events (GTK_WIDGET (priv->overlay),
+ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
+
/* Scrolled Window */
- priv->scrolled_window = gtk_scrolled_window_new ();
+ priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_show (priv->scrolled_window);
- controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
- GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
- gtk_widget_add_controller (priv->scrolled_window, controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- g_signal_connect (controller, "scroll", G_CALLBACK (on_scroll), view);
+ g_signal_connect_swapped (priv->scrolled_window,
+ "event",
+ G_CALLBACK (on_event),
+ view);
gtk_overlay_set_child (GTK_OVERLAY (priv->overlay), priv->scrolled_window);
@@ -9570,25 +9619,33 @@ nautilus_files_view_init (NautilusFilesView *view)
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-no-search-results.ui");
priv->no_search_results_widget = GTK_WIDGET (gtk_builder_get_object (builder, "no_search_results"));
gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->no_search_results_widget);
- gtk_widget_set_can_target (priv->no_search_results_widget, FALSE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->no_search_results_widget,
+ TRUE);
g_object_unref (builder);
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-folder-is-empty.ui");
priv->folder_is_empty_widget = GTK_WIDGET (gtk_builder_get_object (builder, "folder_is_empty"));
gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->folder_is_empty_widget);
- gtk_widget_set_can_target (priv->folder_is_empty_widget, FALSE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->folder_is_empty_widget,
+ TRUE);
g_object_unref (builder);
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-starred-is-empty.ui");
priv->starred_is_empty_widget = GTK_WIDGET (gtk_builder_get_object (builder, "starred_is_empty"));
gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->starred_is_empty_widget);
- gtk_widget_set_can_target (priv->starred_is_empty_widget, FALSE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->starred_is_empty_widget,
+ TRUE);
g_object_unref (builder);
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-trash-is-empty.ui");
priv->trash_is_empty_widget = GTK_WIDGET (gtk_builder_get_object (builder, "trash_is_empty"));
gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->trash_is_empty_widget);
- gtk_widget_set_can_target (priv->trash_is_empty_widget, FALSE);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (priv->overlay),
+ priv->trash_is_empty_widget,
+ TRUE);
g_object_unref (builder);
/* Floating bar */
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index ef545e6f3..095e7288b 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "nautilus-floating-bar.h"
+#include "nautilus-gtk4-helpers.h"
#define HOVER_HIDE_TIMEOUT_INTERVAL 100
@@ -245,7 +246,7 @@ on_event_controller_motion_enter (GtkEventControllerMotion *controller,
NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (user_data);
GtkWidget *parent;
CheckPointerData *data;
- gdouble y_pos;
+ gint y_pos;
self->pointer_y_in_parent_coordinates = y;
@@ -309,25 +310,11 @@ on_parent_changed (GObject *object,
parent = gtk_widget_get_parent (GTK_WIDGET (object));
- if (self->motion_controller != NULL)
- {
- GtkWidget *old_parent;
-
- old_parent = gtk_event_controller_get_widget (self->motion_controller);
- g_warn_if_fail (old_parent != NULL);
- if (old_parent != NULL)
- {
- gtk_widget_remove_controller (old_parent, self->motion_controller);
- }
-
- g_object_unref (self->motion_controller);
- self->motion_controller = NULL;
- }
+ g_clear_object (&self->motion_controller);
if (parent != NULL)
{
- self->motion_controller = g_object_ref (gtk_event_controller_motion_new ());
- gtk_widget_add_controller (parent, self->motion_controller);
+ self->motion_controller = gtk_event_controller_motion_new (parent);
gtk_event_controller_set_propagation_phase (self->motion_controller,
GTK_PHASE_CAPTURE);
@@ -358,7 +345,7 @@ nautilus_floating_bar_constructed (GObject *obj)
* ensure the spinner animates if and only if it's visible, to reduce CPU
* usage. */
g_object_bind_property (obj, "show-spinner",
- w, "spinning",
+ w, "active",
G_BINDING_SYNC_CREATE);
self->spinner = w;
@@ -389,7 +376,7 @@ nautilus_floating_bar_constructed (GObject *obj)
self->details_label_widget = w;
gtk_widget_show (w);
- w = gtk_button_new_from_icon_name ("process-stop-symbolic");
+ w = gtk_button_new_from_icon_name ("process-stop-symbolic", GTK_ICON_SIZE_MENU);
context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, "circular");
gtk_style_context_add_class (context, "flat");
@@ -397,6 +384,7 @@ nautilus_floating_bar_constructed (GObject *obj)
gtk_box_append (GTK_BOX (self), w);
self->stop_button = w;
gtk_widget_set_visible (w, FALSE);
+ gtk_widget_set_no_show_all (w, TRUE);
g_signal_connect (self->stop_button, "clicked",
G_CALLBACK (stop_button_clicked_cb), self);
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
new file mode 100644
index 000000000..8f9c7bd35
--- /dev/null
+++ b/src/nautilus-gtk4-helpers.c
@@ -0,0 +1,218 @@
+#include "nautilus-gtk4-helpers.h"
+
+void
+adw_bin_set_child (AdwBin *bin,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_BIN (bin));
+
+ gtk_container_add (GTK_CONTAINER (bin), child);
+}
+
+void
+gtk_button_set_child (GtkButton *button,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_BUTTON (button));
+
+ gtk_container_add (GTK_CONTAINER (button), child);
+}
+
+void
+gtk_menu_button_set_child (GtkMenuButton *menu_button,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_MENU_BUTTON (menu_button));
+
+ gtk_container_add (GTK_CONTAINER (menu_button), child);
+}
+
+void
+gtk_box_append (GtkBox *box,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_BOX (box));
+
+ gtk_container_add (GTK_CONTAINER (box), child);
+}
+
+void
+gtk_box_remove (GtkBox *box,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_BOX (box));
+
+ gtk_container_remove (GTK_CONTAINER (box), child);
+}
+
+void
+gtk_overlay_set_child (GtkOverlay *overlay,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_OVERLAY (overlay));
+
+ gtk_container_add (GTK_CONTAINER (overlay), child);
+}
+
+void
+gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_SCROLLED_WINDOW (scrolled_window));
+
+ gtk_container_add (GTK_CONTAINER (scrolled_window), child);
+}
+
+void
+gtk_list_box_row_set_child (GtkListBoxRow *row,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_LIST_BOX_ROW (row));
+
+ gtk_container_add (GTK_CONTAINER (row), child);
+}
+
+void
+gtk_info_bar_add_child (GtkInfoBar *info_bar,
+ GtkWidget *widget)
+{
+ g_assert (GTK_IS_INFO_BAR (info_bar));
+
+ gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (info_bar)),
+ widget);
+}
+
+void
+gtk_revealer_set_child (GtkRevealer *revealer,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_REVEALER (revealer));
+
+ gtk_container_add (GTK_CONTAINER (revealer), child);
+}
+
+void
+gtk_popover_set_child (GtkPopover *popover,
+ GtkWidget *child)
+{
+ g_assert (GTK_IS_POPOVER (popover));
+
+ gtk_container_add (GTK_CONTAINER (popover), child);
+}
+
+void
+gtk_check_button_set_active (GtkCheckButton *button,
+ gboolean setting)
+{
+ g_assert (GTK_IS_CHECK_BUTTON (button));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), setting);
+}
+
+
+void
+gtk_center_box_set_start_widget (GtkCenterBox *center_box,
+ GtkWidget *widget)
+{
+ g_assert (GTK_IS_BOX (center_box));
+
+ gtk_box_pack_start (GTK_BOX (center_box), widget, FALSE, TRUE, 0);
+}
+
+void
+gtk_center_box_set_center_widget (GtkCenterBox *center_box,
+ GtkWidget *widget)
+{
+ g_assert (GTK_IS_BOX (center_box));
+
+ gtk_box_set_center_widget (GTK_BOX (center_box), widget);
+}
+void
+gtk_center_box_set_end_widget (GtkCenterBox *center_box,
+ GtkWidget *widget)
+{
+ g_assert (GTK_IS_BOX (center_box));
+
+ gtk_box_pack_end (GTK_BOX (center_box), widget, FALSE, TRUE, 0);
+}
+
+GtkWidget *
+gtk_center_box_new (void)
+{
+ return gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+}
+
+gboolean
+gtk_check_button_get_active (GtkCheckButton *button)
+{
+ g_assert (GTK_IS_CHECK_BUTTON (button));
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+}
+
+GtkWidget *
+gtk_widget_get_first_child (GtkWidget *widget)
+{
+ g_autoptr (GList) children = NULL;
+
+ g_assert (GTK_IS_CONTAINER (widget));
+
+ children = gtk_container_get_children (GTK_CONTAINER (widget));
+ if (children != NULL)
+ {
+ return GTK_WIDGET (children->data);
+ }
+
+ return NULL;
+}
+
+GtkWidget *
+gtk_widget_get_focus_child (GtkWidget *widget)
+{
+ g_assert (GTK_IS_CONTAINER (widget));
+
+ return gtk_container_get_focus_child (GTK_CONTAINER (widget));
+}
+
+GtkWidget *
+gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled)
+{
+ g_assert (GTK_IS_SCROLLED_WINDOW (scrolled));
+
+ return gtk_bin_get_child (GTK_BIN (scrolled));
+}
+
+GdkDisplay *
+gtk_root_get_display (GtkRoot *root)
+{
+ g_assert (GTK_IS_WINDOW (root));
+
+ return gdk_screen_get_display (gtk_window_get_screen (GTK_WINDOW (root)));
+}
+
+void
+gtk_window_set_display (GtkWindow *window,
+ GdkDisplay *display)
+{
+ g_assert (GTK_IS_WINDOW (window));
+
+ gtk_window_set_screen (window, gdk_display_get_default_screen (display));
+}
+
+void
+gtk_style_context_add_provider_for_display (GdkDisplay *display,
+ GtkStyleProvider *provider,
+ guint priority)
+{
+ gtk_style_context_add_provider_for_screen (gdk_display_get_default_screen (display),
+ provider,
+ priority);
+}
+
+void
+gtk_style_context_remove_provider_for_display (GdkDisplay *display,
+ GtkStyleProvider *provider)
+{
+ gtk_style_context_remove_provider_for_screen (gdk_display_get_default_screen (display),
+ provider);
+}
diff --git a/src/nautilus-gtk4-helpers.h b/src/nautilus-gtk4-helpers.h
new file mode 100644
index 000000000..77bf8089d
--- /dev/null
+++ b/src/nautilus-gtk4-helpers.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+#if GTK_MAJOR_VERSION < 4
+
+#define AdwBin GtkBin
+#define ADW_BIN GTK_BIN
+#define GtkCenterBox GtkBox
+#define GTK_CENTER_BOX GTK_BOX
+
+void adw_bin_set_child (AdwBin *bin,
+ GtkWidget *child);
+void gtk_button_set_child (GtkButton *button,
+ GtkWidget *child);
+void gtk_menu_button_set_child (GtkMenuButton *menu_button,
+ GtkWidget *child);
+void gtk_box_append (GtkBox *box,
+ GtkWidget *child);
+void gtk_box_remove (GtkBox *box,
+ GtkWidget *child);
+void gtk_overlay_set_child (GtkOverlay *overlay,
+ GtkWidget *child);
+void gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
+ GtkWidget *child);
+void gtk_list_box_row_set_child (GtkListBoxRow *row,
+ GtkWidget *child);
+void gtk_info_bar_add_child (GtkInfoBar *info_bar,
+ GtkWidget *widget);
+void gtk_revealer_set_child (GtkRevealer *revealer,
+ GtkWidget *child);
+void gtk_popover_set_child (GtkPopover *popover,
+ GtkWidget *child);
+void gtk_check_button_set_active (GtkCheckButton *button,
+ gboolean setting);
+void gtk_center_box_set_start_widget (GtkCenterBox *center_box,
+ GtkWidget *widget);
+void gtk_center_box_set_center_widget (GtkCenterBox *center_box,
+ GtkWidget *widget);
+void gtk_center_box_set_end_widget (GtkCenterBox *center_box,
+ GtkWidget *widget);
+
+GtkWidget *gtk_center_box_new (void);
+
+gboolean gtk_check_button_get_active (GtkCheckButton *button);
+GtkWidget *gtk_widget_get_first_child (GtkWidget *widget);
+GtkWidget *gtk_widget_get_focus_child (GtkWidget *widget);
+GtkWidget *gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled);
+
+void gtk_style_context_add_provider_for_display (GdkDisplay *display,
+ GtkStyleProvider *provider,
+ guint priority);
+void gtk_style_context_remove_provider_for_display (GdkDisplay *display,
+ GtkStyleProvider *provider);
+
+#define GTK_ROOT(root) ((GtkRoot *) GTK_WINDOW (root))
+typedef GtkWindow GtkRoot;
+GdkDisplay *gtk_root_get_display (GtkRoot *root);
+void gtk_window_set_display (GtkWindow *window,
+ GdkDisplay *display);
+
+#endif
+G_END_DECLS
diff --git a/src/nautilus-icon-info.c b/src/nautilus-icon-info.c
index 0831ae168..fee560806 100644
--- a/src/nautilus-icon-info.c
+++ b/src/nautilus-icon-info.c
@@ -25,7 +25,7 @@ struct _NautilusIconInfo
gboolean sole_owner;
gint64 last_use_time;
- GdkPaintable *paintable;
+ GdkPixbuf *pixbuf;
char *icon_name;
@@ -48,13 +48,13 @@ nautilus_icon_info_init (NautilusIconInfo *icon)
gboolean
nautilus_icon_info_is_fallback (NautilusIconInfo *icon)
{
- return icon->paintable == NULL;
+ return icon->pixbuf == NULL;
}
static void
-paintable_toggle_notify (gpointer info,
- GObject *object,
- gboolean is_last_ref)
+pixbuf_toggle_notify (gpointer info,
+ GObject *object,
+ gboolean is_last_ref)
{
NautilusIconInfo *icon = info;
@@ -62,7 +62,7 @@ paintable_toggle_notify (gpointer info,
{
icon->sole_owner = TRUE;
g_object_remove_toggle_ref (object,
- paintable_toggle_notify,
+ pixbuf_toggle_notify,
info);
icon->last_use_time = g_get_monotonic_time ();
schedule_reap_cache ();
@@ -76,16 +76,16 @@ nautilus_icon_info_finalize (GObject *object)
icon = NAUTILUS_ICON_INFO (object);
- if (!icon->sole_owner && icon->paintable)
+ if (!icon->sole_owner && icon->pixbuf)
{
- g_object_remove_toggle_ref (G_OBJECT (icon->paintable),
- paintable_toggle_notify,
+ g_object_remove_toggle_ref (G_OBJECT (icon->pixbuf),
+ pixbuf_toggle_notify,
icon);
}
- if (icon->paintable)
+ if (icon->pixbuf)
{
- g_object_unref (icon->paintable);
+ g_object_unref (icon->pixbuf);
}
g_free (icon->icon_name);
@@ -112,7 +112,7 @@ nautilus_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
if (pixbuf)
{
- icon->paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
+ icon->pixbuf = g_object_ref (pixbuf);
}
icon->orig_scale = scale;
@@ -121,21 +121,21 @@ nautilus_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
}
static NautilusIconInfo *
-nautilus_icon_info_new_for_icon_paintable (GtkIconPaintable *icon_paintable,
- gint scale)
+nautilus_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
+ gint scale)
{
NautilusIconInfo *icon;
- g_autoptr (GFile) file = NULL;
+ const char *filename;
char *basename, *p;
icon = g_object_new (NAUTILUS_TYPE_ICON_INFO, NULL);
- icon->paintable = GDK_PAINTABLE (g_object_ref (icon_paintable));
+ icon->pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
- file = gtk_icon_paintable_get_file (icon_paintable);
- if (file != NULL)
+ filename = gtk_icon_info_get_filename (icon_info);
+ if (filename != NULL)
{
- basename = g_file_get_basename (file);
+ basename = g_path_get_basename (filename);
p = strrchr (basename, '.');
if (p)
{
@@ -143,10 +143,6 @@ nautilus_icon_info_new_for_icon_paintable (GtkIconPaintable *icon_paintable,
}
icon->icon_name = basename;
}
- else
- {
- icon->icon_name = g_strdup (gtk_icon_paintable_get_icon_name (icon_paintable));
- }
icon->orig_scale = scale;
@@ -163,7 +159,7 @@ typedef struct
typedef struct
{
- char *icon_name;
+ char *filename;
int scale;
int size;
} ThemedIconKey;
@@ -300,7 +296,7 @@ loadable_icon_key_free (LoadableIconKey *key)
static guint
themed_icon_key_hash (ThemedIconKey *key)
{
- return g_str_hash (key->icon_name) ^ key->size;
+ return g_str_hash (key->filename) ^ key->size;
}
static gboolean
@@ -309,18 +305,18 @@ themed_icon_key_equal (const ThemedIconKey *a,
{
return a->size == b->size &&
a->scale == b->scale &&
- g_str_equal (a->icon_name, b->icon_name);
+ g_str_equal (a->filename, b->filename);
}
static ThemedIconKey *
-themed_icon_key_new (const char *icon_name,
+themed_icon_key_new (const char *filename,
int scale,
int size)
{
ThemedIconKey *key;
key = g_slice_new (ThemedIconKey);
- key->icon_name = g_strdup (icon_name);
+ key->filename = g_strdup (filename);
key->scale = scale;
key->size = size;
@@ -330,7 +326,7 @@ themed_icon_key_new (const char *icon_name,
static void
themed_icon_key_free (ThemedIconKey *key)
{
- g_free (key->icon_name);
+ g_free (key->filename);
g_slice_free (ThemedIconKey, key);
}
@@ -340,7 +336,7 @@ nautilus_icon_info_lookup (GIcon *icon,
int scale)
{
NautilusIconInfo *icon_info;
- g_autoptr (GtkIconPaintable) icon_paintable = NULL;
+ g_autoptr (GtkIconInfo) gtkicon_info = NULL;
if (G_IS_LOADABLE_ICON (icon))
{
@@ -390,9 +386,9 @@ nautilus_icon_info_lookup (GIcon *icon,
return g_object_ref (icon_info);
}
- icon_paintable = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_for_display (gdk_display_get_default
()),
- icon, size, scale, GTK_TEXT_DIR_NONE, 0);
- if (icon_paintable == NULL)
+ gtkicon_info = gtk_icon_theme_lookup_by_gicon_for_scale (gtk_icon_theme_get_default (),
+ icon, size, scale, 0);
+ if (gtkicon_info == NULL)
{
return nautilus_icon_info_new_for_pixbuf (NULL, scale);
}
@@ -401,7 +397,7 @@ nautilus_icon_info_lookup (GIcon *icon,
{
ThemedIconKey lookup_key;
ThemedIconKey *key;
- const char *icon_name;
+ const char *filename;
if (themed_icon_cache == NULL)
{
@@ -412,18 +408,23 @@ nautilus_icon_info_lookup (GIcon *icon,
(GDestroyNotify) g_object_unref);
}
- icon_name = gtk_icon_paintable_get_icon_name (icon_paintable);
+ filename = gtk_icon_info_get_filename (gtkicon_info);
+ if (filename == NULL)
+ {
+ g_object_unref (gtkicon_info);
+ return nautilus_icon_info_new_for_pixbuf (NULL, scale);
+ }
- lookup_key.icon_name = (char *) icon_name;
+ lookup_key.filename = (char *) filename;
lookup_key.scale = scale;
lookup_key.size = size;
icon_info = g_hash_table_lookup (themed_icon_cache, &lookup_key);
if (!icon_info)
{
- icon_info = nautilus_icon_info_new_for_icon_paintable (icon_paintable, scale);
+ icon_info = nautilus_icon_info_new_for_icon_info (gtkicon_info, scale);
- key = themed_icon_key_new (icon_name, scale, size);
+ key = themed_icon_key_new (filename, scale, size);
g_hash_table_insert (themed_icon_cache, key, icon_info);
}
@@ -431,28 +432,31 @@ nautilus_icon_info_lookup (GIcon *icon,
}
else
{
- return nautilus_icon_info_new_for_icon_paintable (icon_paintable, scale);
+ g_autoptr (GdkPixbuf) pixbuf = NULL;
+
+ pixbuf = gtk_icon_info_load_icon (gtkicon_info, NULL);
+ return nautilus_icon_info_new_for_pixbuf (pixbuf, scale);
}
}
-static GdkPaintable *
-nautilus_icon_info_get_paintable_nodefault (NautilusIconInfo *icon)
+static GdkPixbuf *
+nautilus_icon_info_get_pixbuf_nodefault (NautilusIconInfo *icon)
{
- GdkPaintable *res;
+ GdkPixbuf *res;
- if (icon->paintable == NULL)
+ if (icon->pixbuf == NULL)
{
res = NULL;
}
else
{
- res = g_object_ref (icon->paintable);
+ res = g_object_ref (icon->pixbuf);
if (icon->sole_owner)
{
icon->sole_owner = FALSE;
g_object_add_toggle_ref (G_OBJECT (res),
- paintable_toggle_notify,
+ pixbuf_toggle_notify,
icon);
}
}
@@ -460,37 +464,51 @@ nautilus_icon_info_get_paintable_nodefault (NautilusIconInfo *icon)
return res;
}
-GdkPaintable *
-nautilus_icon_info_get_paintable (NautilusIconInfo *icon)
+
+GdkPixbuf *
+nautilus_icon_info_get_pixbuf (NautilusIconInfo *icon)
{
- GdkPaintable *res;
+ GdkPixbuf *res;
- res = nautilus_icon_info_get_paintable_nodefault (icon);
+ res = nautilus_icon_info_get_pixbuf_nodefault (icon);
if (res == NULL)
{
- res = GDK_PAINTABLE (gdk_texture_new_from_resource ("/org/gnome/nautilus/text-x-preview.png"));
+ res = gdk_pixbuf_new_from_resource ("/org/gnome/nautilus/text-x-preview.png",
+ NULL);
}
return res;
}
-GdkTexture *
-nautilus_icon_info_get_texture (NautilusIconInfo *icon)
+GdkPixbuf *
+nautilus_icon_info_get_pixbuf_at_size (NautilusIconInfo *icon,
+ gsize forced_size)
{
- g_autoptr (GdkPaintable) paintable = NULL;
- GdkTexture *res;
+ GdkPixbuf *pixbuf, *scaled_pixbuf;
+ int w, h, s;
+ double scale;
- paintable = nautilus_icon_info_get_paintable_nodefault (icon);
- if (GDK_IS_TEXTURE (paintable))
- {
- res = GDK_TEXTURE (g_steal_pointer (&paintable));
- }
- else
+ pixbuf = nautilus_icon_info_get_pixbuf (icon);
+
+ w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale;
+ h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale;
+ s = MAX (w, h);
+ if (s == forced_size)
{
- res = gdk_texture_new_from_resource ("/org/gnome/nautilus/text-x-preview.png");
+ return pixbuf;
}
- return res;
+ scale = (double) forced_size / s;
+
+ /* Neither of these can be 0. */
+ w = MAX (w * scale, 1);
+ h = MAX (h * scale, 1);
+
+ scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
+ w, h,
+ GDK_INTERP_BILINEAR);
+ g_object_unref (pixbuf);
+ return scaled_pixbuf;
}
const char *
diff --git a/src/nautilus-icon-info.h b/src/nautilus-icon-info.h
index e5fab7a6b..518db76a9 100644
--- a/src/nautilus-icon-info.h
+++ b/src/nautilus-icon-info.h
@@ -23,8 +23,9 @@ NautilusIconInfo * nautilus_icon_info_lookup (GIcon
int size,
int scale);
gboolean nautilus_icon_info_is_fallback (NautilusIconInfo *icon);
-GdkPaintable * nautilus_icon_info_get_paintable (NautilusIconInfo *icon);
-GdkTexture * nautilus_icon_info_get_texture (NautilusIconInfo *icon);
+GdkPixbuf * nautilus_icon_info_get_pixbuf (NautilusIconInfo *icon);
+GdkPixbuf * nautilus_icon_info_get_pixbuf_at_size (NautilusIconInfo *icon,
+ gsize forced_size);
const char * nautilus_icon_info_get_used_name (NautilusIconInfo *icon);
void nautilus_icon_info_clear_caches (void);
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index dba6b99e4..701fc3eaf 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -176,7 +176,7 @@ nautilus_list_model_get_column_type (GtkTreeModel *tree_model,
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
{
- return GDK_TYPE_TEXTURE;
+ return GDK_TYPE_PIXBUF;
}
case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
@@ -302,7 +302,7 @@ nautilus_list_model_get_icon_scale (NautilusListModel *model)
if (retval == -1)
{
- retval = gdk_monitor_get_scale_factor (g_list_model_get_item (gdk_display_get_monitors
(gdk_display_get_default ()), 0));
+ retval = gdk_monitor_get_scale_factor (gdk_display_get_monitor (gdk_display_get_default (), 0));
}
/* FIXME: Temporary regression: HiDPI icons not supported, ignore scale. */
@@ -350,7 +350,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
FileEntry *file_entry;
NautilusFile *file;
char *str;
- GdkTexture *icon;
+ GdkPixbuf *icon, *rendered_icon;
int icon_size, icon_scale;
NautilusListZoomLevel zoom_level;
NautilusFileIconFlags flags;
@@ -387,7 +387,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
{
- g_value_init (value, GDK_TYPE_TEXTURE);
+ g_value_init (value, GDK_TYPE_PIXBUF);
if (file != NULL)
{
@@ -421,9 +421,8 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
}
}
- icon = nautilus_file_get_icon_texture (file, icon_size, icon_scale, flags);
+ icon = nautilus_file_get_icon_pixbuf (file, icon_size, icon_scale, flags);
-#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
if (priv->highlight_files != NULL &&
g_list_find_custom (priv->highlight_files,
file, (GCompareFunc) nautilus_file_compare_location))
@@ -436,7 +435,6 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
icon = rendered_icon;
}
}
-#endif
g_value_set_object (value, icon);
g_object_unref (icon);
diff --git a/src/nautilus-list-view-dnd.c b/src/nautilus-list-view-dnd.c
index cef6192c5..9941642bd 100644
--- a/src/nautilus-list-view-dnd.c
+++ b/src/nautilus-list-view-dnd.c
@@ -273,7 +273,7 @@ void
nautilus_list_view_dnd_drag_begin (NautilusListView *list_view,
gdouble offset_x,
gdouble offset_y,
- GdkEvent *event)
+ const GdkEvent *event)
{
if (list_view->details->drag_button == 0)
{
diff --git a/src/nautilus-list-view-dnd.h b/src/nautilus-list-view-dnd.h
index 88ade6770..97a7d2112 100644
--- a/src/nautilus-list-view-dnd.h
+++ b/src/nautilus-list-view-dnd.h
@@ -29,7 +29,7 @@ void nautilus_list_view_dnd_init (NautilusListView *list_view);
void nautilus_list_view_dnd_drag_begin (NautilusListView *list_view,
gdouble offset_x,
gdouble offset_y,
- GdkEvent *event);
+ const GdkEvent *event);
NautilusDragInfo *
nautilus_list_view_dnd_get_drag_source_data (NautilusListView *list_view,
GdkDragContext *context);
diff --git a/src/nautilus-list-view-private.h b/src/nautilus-list-view-private.h
index 2c83860cc..de9fa5635 100644
--- a/src/nautilus-list-view-private.h
+++ b/src/nautilus-list-view-private.h
@@ -77,5 +77,11 @@ struct NautilusListViewDetails {
NautilusTagManager *tag_manager;
GCancellable *starred_cancellable;
+
+ GtkGesture *tree_view_drag_gesture;
+ GtkGesture *tree_view_multi_press_gesture;
+ GtkEventController *motion_controller;
+ GtkEventController *key_controller;
+ GtkGesture *long_press_gesture;
};
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 5c6d66771..74c8e6f4d 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -54,6 +54,7 @@
#include "nautilus-ui-utilities.h"
#include "nautilus-view.h"
#include "nautilus-tracker-utilities.h"
+#include "nautilus-gtk4-helpers.h"
struct SelectionForeachData
{
@@ -229,11 +230,11 @@ activate_selected_items_alternate (NautilusListView *view,
}
static gboolean
-button_event_modifies_selection (GdkEvent *event)
+button_event_modifies_selection (const GdkEvent *event)
{
GdkModifierType state;
- state = gdk_event_get_modifier_state (event);
+ gdk_event_get_state (event, &state);
return (state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
}
@@ -278,11 +279,11 @@ on_event_controller_motion_motion (GtkEventControllerMotion *controller,
{
if (view->details->hover_path != NULL)
{
- gtk_widget_set_cursor (widget, hand_cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), hand_cursor);
}
else
{
- gtk_widget_set_cursor (widget, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
}
}
@@ -343,7 +344,7 @@ on_event_controller_motion_enter (GtkEventControllerMotion *controller,
if (view->details->hover_path != NULL)
{
- gtk_widget_set_cursor (widget, hand_cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), hand_cursor);
}
}
@@ -448,11 +449,11 @@ on_star_cell_renderer_clicked (GtkTreePath *path,
}
static void
-on_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer callback_data)
+on_tree_view_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer callback_data)
{
NautilusListView *view;
GtkWidget *widget;
@@ -464,7 +465,7 @@ on_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
gint bin_x;
gint bin_y;
GdkEventSequence *sequence;
- GdkEvent *event;
+ const GdkEvent *event;
gboolean on_expander, show_expanders;
gboolean is_simple_click, path_selected;
NautilusFile *file;
@@ -619,7 +620,7 @@ on_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
g_autoptr (GtkTreePath) cursor = NULL;
GList *selected_rows = NULL;
- state = gdk_event_get_modifier_state (event);
+ gdk_event_get_state (event, &state);
/* We cannot easily match the expected behavior of Shift+click, so we
* must fall back to GtkTreeView's default event handling.
@@ -713,16 +714,16 @@ on_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
}
static void
-on_tree_view_click_gesture_released (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer callback_data)
+on_tree_view_multi_press_gesture_released (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer callback_data)
{
NautilusListView *view;
guint button;
GdkEventSequence *sequence;
- GdkEvent *event;
+ const GdkEvent *event;
GtkTreeView *tree_view;
GtkTreeSelection *selection;
gint x_in_bin;
@@ -770,7 +771,7 @@ on_tree_view_click_gesture_released (GtkGestureClick *gesture,
return;
}
- state = gdk_event_get_modifier_state (event);
+ gdk_event_get_state (event, &state);
if ((button == GDK_BUTTON_PRIMARY || button == GDK_BUTTON_MIDDLE)
&& ((state & GDK_CONTROL_MASK) != 0 ||
@@ -1467,7 +1468,7 @@ popup_column_header_menu (NautilusListView *list_view,
G_CALLBACK (column_header_menu_use_default),
list_view);
- gtk_widget_show (menu);
+ gtk_widget_show_all (menu);
gtk_popover_set_pointing_to (popover, &(GdkRectangle){x, y, 0, 0});
gtk_popover_popup (popover);
@@ -1955,7 +1956,7 @@ on_tree_view_drag_gesture_drag_update (GtkGestureDrag *gesture,
{
#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
GdkEventSequence *sequence;
- GdkEvent *event;
+ const GdkEvent *event;
NautilusListView *list_view;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
@@ -1989,6 +1990,7 @@ create_and_set_up_tree_view (NautilusListView *view)
GList *l;
gchar **default_column_order, **default_visible_columns;
GtkWidget *content_widget;
+ GtkGesture *gesture;
GtkEventController *controller;
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (view));
@@ -2038,29 +2040,33 @@ create_and_set_up_tree_view (NautilusListView *view)
"changed",
G_CALLBACK (list_selection_changed_callback), view, 0);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
- gtk_widget_add_controller (GTK_WIDGET (view->details->tree_view), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
+ gesture = gtk_gesture_drag_new (GTK_WIDGET (view->details->tree_view));
+ view->details->tree_view_drag_gesture = gesture;
+
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
- g_signal_connect (controller, "drag-begin",
+ g_signal_connect (gesture, "drag-begin",
G_CALLBACK (on_tree_view_drag_gesture_drag_begin), view);
- g_signal_connect (controller, "drag-update",
+ g_signal_connect (gesture, "drag-update",
G_CALLBACK (on_tree_view_drag_gesture_drag_update), view);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (GTK_WIDGET (view->details->tree_view), controller);
+ gesture = gtk_gesture_multi_press_new (GTK_WIDGET (view->details->tree_view));
+ view->details->tree_view_multi_press_gesture = gesture;
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
+
+ g_signal_connect (gesture, "pressed",
+ G_CALLBACK (on_tree_view_multi_press_gesture_pressed), view);
+ g_signal_connect (gesture, "released",
+ G_CALLBACK (on_tree_view_multi_press_gesture_released), view);
- g_signal_connect (controller, "pressed",
- G_CALLBACK (on_tree_view_click_gesture_pressed), view);
- g_signal_connect (controller, "released",
- G_CALLBACK (on_tree_view_click_gesture_released), view);
+ controller = gtk_event_controller_motion_new (GTK_WIDGET (view->details->tree_view));
+ view->details->motion_controller = controller;
- controller = gtk_event_controller_motion_new ();
- gtk_widget_add_controller (GTK_WIDGET (view->details->tree_view), controller);
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
g_signal_connect (controller, "enter",
@@ -2070,8 +2076,8 @@ create_and_set_up_tree_view (NautilusListView *view)
g_signal_connect (controller, "motion",
G_CALLBACK (on_event_controller_motion_motion), view);
- controller = gtk_event_controller_key_new ();
- gtk_widget_add_controller (GTK_WIDGET (view->details->tree_view), controller);
+ controller = gtk_event_controller_key_new (GTK_WIDGET (view->details->tree_view));
+ view->details->key_controller = controller;
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
@@ -2108,12 +2114,16 @@ create_and_set_up_tree_view (NautilusListView *view)
g_signal_connect_object (view->details->model, "get-icon-scale",
G_CALLBACK (get_icon_scale_callback), view, 0);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_long_press_new ());
- gtk_widget_add_controller (GTK_WIDGET (content_widget), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (controller), TRUE);
- g_signal_connect (controller, "pressed",
- (GCallback) on_longpress_gesture_pressed_event, view);
+ gesture = gtk_gesture_long_press_new (GTK_WIDGET (content_widget));
+ view->details->long_press_gesture = gesture;
+
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
+ g_signal_connect (gesture,
+ "pressed",
+ (GCallback) on_longpress_gesture_pressed_event,
+ view);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view->details->tree_view),
GTK_SELECTION_MULTIPLE);
@@ -2181,7 +2191,7 @@ create_and_set_up_tree_view (NautilusListView *view)
gtk_tree_view_column_pack_start (view->details->file_name_column, cell, FALSE);
gtk_tree_view_column_set_attributes (view->details->file_name_column,
cell,
- "texture",
nautilus_list_model_get_column_id_from_zoom_level (view->details->zoom_level),
+ "pixbuf", nautilus_list_model_get_column_id_from_zoom_level
(view->details->zoom_level),
NULL);
cell = gtk_cell_renderer_text_new ();
@@ -3276,7 +3286,7 @@ create_column_editor (NautilusListView *view)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_transient_for (GTK_WINDOW (window),
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (view))));
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))));
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (view));
name = nautilus_file_get_display_name (file);
@@ -3354,7 +3364,7 @@ nautilus_list_view_set_zoom_level (NautilusListView *view,
column = nautilus_list_model_get_column_id_from_zoom_level (new_level);
gtk_tree_view_column_set_attributes (view->details->file_name_column,
GTK_CELL_RENDERER (view->details->pixbuf_cell),
- "texture", column,
+ "pixbuf", column,
NULL);
set_up_pixbuf_size (view);
}
@@ -3429,6 +3439,7 @@ nautilus_list_view_is_zoom_level_default (NautilusFilesView *view)
static void
nautilus_list_view_click_policy_changed (NautilusFilesView *directory_view)
{
+ GdkWindow *win;
GdkDisplay *display;
NautilusListView *view;
GtkTreeIter iter;
@@ -3456,7 +3467,8 @@ nautilus_list_view_click_policy_changed (NautilusFilesView *directory_view)
tree = view->details->tree_view;
if (gtk_widget_get_realized (GTK_WIDGET (tree)))
{
- gtk_widget_set_cursor (GTK_WIDGET (tree), NULL);
+ win = gtk_widget_get_window (GTK_WIDGET (tree));
+ gdk_window_set_cursor (win, NULL);
if (display != NULL)
{
@@ -3470,7 +3482,7 @@ nautilus_list_view_click_policy_changed (NautilusFilesView *directory_view)
{
if (hand_cursor == NULL)
{
- hand_cursor = gdk_cursor_new_from_name ("pointer", NULL);
+ hand_cursor = gdk_cursor_new_from_name (display, "pointer");
}
}
}
@@ -3565,7 +3577,11 @@ nautilus_list_view_dispose (GObject *object)
default_column_order_changed_callback,
list_view);
- g_clear_pointer (&list_view->details->columns_popover, gtk_widget_unparent);
+ g_clear_object (&list_view->details->tree_view_drag_gesture);
+ g_clear_object (&list_view->details->tree_view_multi_press_gesture);
+ g_clear_object (&list_view->details->motion_controller);
+ g_clear_object (&list_view->details->key_controller);
+ g_clear_object (&list_view->details->long_press_gesture);
G_OBJECT_CLASS (nautilus_list_view_parent_class)->dispose (object);
}
@@ -3599,7 +3615,7 @@ nautilus_list_view_finalize (GObject *object)
if (list_view->details->column_editor != NULL)
{
- gtk_window_destroy (GTK_WINDOW (list_view->details->column_editor));
+ gtk_widget_destroy (list_view->details->column_editor);
}
g_regex_unref (list_view->details->regex);
@@ -3992,11 +4008,7 @@ nautilus_list_view_init (NautilusListView *list_view)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (list_view)),
"nautilus-list-view");
- list_view->details->columns_popover = gtk_popover_new ();
- gtk_widget_set_parent (list_view->details->columns_popover,
- GTK_WIDGET (list_view));
- g_signal_connect (list_view->details->columns_popover, "destroy", G_CALLBACK (gtk_widget_unparent),
NULL);
-
+ list_view->details->columns_popover = gtk_popover_new (GTK_WIDGET (list_view));
list_view->details->columns_popover_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_set_margin_top (list_view->details->columns_popover_box, 6);
gtk_widget_set_margin_bottom (list_view->details->columns_popover_box, 6);
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 73fda840f..5d3e3643c 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -134,7 +134,7 @@ nautilus_location_entry_update_action (NautilusLocationEntry *entry)
return;
}
- current_text = gtk_editable_get_text (GTK_EDITABLE (entry));
+ current_text = gtk_entry_get_text (GTK_ENTRY (entry));
location = g_file_parse_name (current_text);
if (g_file_equal (priv->last_location, location))
@@ -184,7 +184,7 @@ nautilus_location_entry_update_current_uri (NautilusLocationEntry *entry,
g_free (priv->current_directory);
priv->current_directory = g_strdup (uri);
- gtk_editable_set_text (GTK_EDITABLE (entry), uri);
+ gtk_entry_set_text (GTK_ENTRY (entry), uri);
set_position_and_selection_to_end (GTK_EDITABLE (entry));
}
@@ -284,7 +284,7 @@ confirm_multiple_windows_cb (GtkDialog *dialog,
open_multiple = (response_id == GTK_RESPONSE_OK);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
do_open_windows (data, open_multiple);
gtk_drag_finish (data->context, open_multiple, FALSE, data->time);
}
@@ -301,7 +301,7 @@ drag_data_received_callback (GtkWidget *widget,
{
char **names;
int name_count;
- GtkRoot *window;
+ GtkWidget *window;
char *prompt;
char *detail;
GtkDialog *dialog;
@@ -320,7 +320,7 @@ drag_data_received_callback (GtkWidget *widget,
return;
}
- window = gtk_widget_get_root (widget);
+ window = gtk_widget_get_toplevel (widget);
op_data = g_new0 (OpenWindowsOnDragData, 1);
op_data->self = g_object_ref (self);
@@ -578,6 +578,8 @@ finalize (GObject *object)
g_clear_object (&priv->completions_store);
g_free (priv->current_directory);
+ g_clear_object (&priv->controller);
+
G_OBJECT_CLASS (nautilus_location_entry_parent_class)->finalize (object);
}
@@ -620,7 +622,7 @@ on_has_focus_changed (GObject *object,
if (priv->has_special_text)
{
priv->setting_special_text = TRUE;
- gtk_editable_set_text (GTK_EDITABLE (entry), "");
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
priv->setting_special_text = FALSE;
}
}
@@ -663,7 +665,7 @@ nautilus_location_entry_icon_release (GtkEntry *gentry,
case NAUTILUS_LOCATION_ENTRY_ACTION_CLEAR:
{
- gtk_editable_set_text (GTK_EDITABLE (gentry), "");
+ gtk_entry_set_text (gentry, "");
}
break;
@@ -707,7 +709,7 @@ nautilus_location_entry_key_pressed (GtkEventControllerKey *controller,
{
int position;
- position = strlen (gtk_editable_get_text (GTK_EDITABLE (editable)));
+ position = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
gtk_editable_select_region (editable, position, position);
}
else
@@ -780,7 +782,7 @@ nautilus_location_entry_activate (GtkEntry *entry)
loc_entry = NAUTILUS_LOCATION_ENTRY (entry);
priv = nautilus_location_entry_get_instance_private (loc_entry);
- entry_text = gtk_editable_get_text (GTK_EDITABLE (entry));
+ entry_text = gtk_entry_get_text (entry);
path = g_strdup (entry_text);
path = g_strchug (path);
path = g_strchomp (path);
@@ -793,7 +795,7 @@ nautilus_location_entry_activate (GtkEntry *entry)
{
/* Fix non absolute paths */
full_path = g_build_filename (priv->current_directory, path, NULL);
- gtk_editable_set_text (GTK_EDITABLE (entry), full_path);
+ gtk_entry_set_text (entry, full_path);
g_free (full_path);
}
@@ -818,7 +820,8 @@ nautilus_location_entry_class_init (NautilusLocationEntryClass *class)
{
GObjectClass *gobject_class;
GtkEntryClass *entry_class;
- g_autoptr (GtkShortcut) shortcut = NULL;
+ GtkBindingSet *binding_set;
+
gobject_class = G_OBJECT_CLASS (class);
gobject_class->dispose = nautilus_location_entry_dispose;
@@ -847,9 +850,8 @@ nautilus_location_entry_class_init (NautilusLocationEntryClass *class)
g_cclosure_marshal_generic,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
- shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_Escape, 0),
- gtk_signal_action_new ("cancel"));
- gtk_widget_class_add_shortcut (GTK_WIDGET_CLASS (class), shortcut);
+ binding_set = gtk_binding_set_by_class (class);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "cancel", 0);
}
void
@@ -899,14 +901,14 @@ editable_activate_callback (GtkEntry *entry,
const char *entry_text;
g_autofree gchar *path = NULL;
- entry_text = gtk_editable_get_text (GTK_EDITABLE (entry));
+ entry_text = gtk_entry_get_text (entry);
path = g_strdup (entry_text);
path = g_strchug (path);
path = g_strchomp (path);
if (path != NULL && *path != '\0')
{
- gtk_editable_set_text (GTK_EDITABLE (entry), path);
+ gtk_entry_set_text (entry, path);
emit_location_changed (self);
}
}
@@ -922,7 +924,6 @@ static void
nautilus_location_entry_init (NautilusLocationEntry *entry)
{
NautilusLocationEntryPrivate *priv;
- GtkEventController *controller;
priv = nautilus_location_entry_get_instance_private (entry);
@@ -963,15 +964,15 @@ nautilus_location_entry_init (NautilusLocationEntry *entry)
g_signal_connect_object (entry, "changed",
G_CALLBACK (editable_changed_callback), entry, 0);
- controller = gtk_event_controller_key_new ();
- gtk_widget_add_controller (GTK_WIDGET (entry), controller);
+ priv->controller = gtk_event_controller_key_new (GTK_WIDGET (entry));
/* In GTK3, the Tab key binding (for focus change) happens in the bubble
* phase, and we want to stop that from happening. After porting to GTK4
* we need to check whether this is still correct. */
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
- g_signal_connect (controller, "key-pressed",
- G_CALLBACK (nautilus_location_entry_key_pressed), NULL);
-
+ gtk_event_controller_set_propagation_phase (priv->controller, GTK_PHASE_BUBBLE);
+ g_signal_connect (priv->controller,
+ "key-pressed",
+ G_CALLBACK (nautilus_location_entry_key_pressed),
+ NULL);
g_signal_connect_after (entry,
"insert-text",
G_CALLBACK (on_after_insert_text),
@@ -1025,6 +1026,6 @@ nautilus_location_entry_set_special_text (NautilusLocationEntry *entry,
priv->special_text = g_strdup (special_text);
priv->setting_special_text = TRUE;
- gtk_editable_set_text (GTK_EDITABLE (entry), special_text);
+ gtk_entry_set_text (GTK_ENTRY (entry), special_text);
priv->setting_special_text = FALSE;
}
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 9adebffc3..255055b7d 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -563,7 +563,7 @@ trash_symbolic_link_cb (GtkDialog *dialog,
GList file_as_list;
data = user_data;
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
if (response_id == GTK_RESPONSE_YES)
{
@@ -1023,7 +1023,7 @@ on_confirm_multiple_windows_response (GtkDialog *dialog,
int response_id,
ActivateParameters *parameters)
{
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
if (response_id == GTK_RESPONSE_YES)
{
@@ -1109,7 +1109,7 @@ open_with_response_cb (GtkDialog *dialog,
if (response_id != GTK_RESPONSE_OK)
{
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
@@ -1117,7 +1117,7 @@ open_with_response_cb (GtkDialog *dialog,
file = g_object_get_data (G_OBJECT (dialog), "mime-action:file");
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
g_signal_emit_by_name (nautilus_signaller_get_current (), "mime-data-changed");
@@ -1143,7 +1143,7 @@ choose_program (GtkDialog *message_dialog,
if (response != GTK_RESPONSE_ACCEPT)
{
- gtk_window_destroy (GTK_WINDOW (message_dialog));
+ gtk_widget_destroy (GTK_WIDGET (message_dialog));
activate_parameters_install_free (parameters);
return;
}
@@ -1156,7 +1156,7 @@ choose_program (GtkDialog *message_dialog,
nautilus_file_ref (file);
/* Destroy the message dialog after ref:ing the file */
- gtk_window_destroy (GTK_WINDOW (message_dialog));
+ gtk_widget_destroy (GTK_WIDGET (message_dialog));
dialog = gtk_app_chooser_dialog_new (parameters->parent_window,
GTK_DIALOG_MODAL,
@@ -1280,7 +1280,7 @@ search_for_application_mime_type (ActivateParametersInstall *parameters_install,
g_assert (parameters_install->proxy != NULL);
- desktop_startup_id = g_strdup_printf ("_TIME%i", (guint32) GDK_CURRENT_TIME);
+ desktop_startup_id = g_strdup_printf ("_TIME%i", gtk_get_current_event_time ());
g_dbus_proxy_call (parameters_install->proxy,
"InstallMimeTypes",
@@ -1306,7 +1306,7 @@ application_unhandled_file_install (GtkDialog *dialog,
{
char *mime_type;
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
parameters_install->dialog = NULL;
if (response_id == GTK_RESPONSE_YES)
@@ -1377,7 +1377,7 @@ pk_proxy_appeared_cb (GObject *source,
g_signal_connect (dialog, "response",
G_CALLBACK (application_unhandled_file_install),
parameters_install);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
g_free (mime_type);
}
diff --git a/src/nautilus-new-folder-dialog-controller.c b/src/nautilus-new-folder-dialog-controller.c
index 9638c8787..17406a016 100644
--- a/src/nautilus-new-folder-dialog-controller.c
+++ b/src/nautilus-new-folder-dialog-controller.c
@@ -139,14 +139,14 @@ nautilus_new_folder_dialog_controller_new (GtkWindow *parent_window,
if (initial_name != NULL)
{
- gtk_editable_set_text (GTK_EDITABLE (name_entry), initial_name);
+ gtk_entry_set_text (GTK_ENTRY (name_entry), initial_name);
}
gtk_button_set_label (GTK_BUTTON (activate_button), _("Create"));
gtk_label_set_text (GTK_LABEL (name_label), _("Folder name"));
gtk_window_set_title (GTK_WINDOW (new_folder_dialog), _("New Folder"));
- gtk_widget_show (new_folder_dialog);
+ gtk_widget_show_all (new_folder_dialog);
return self;
}
@@ -172,7 +172,7 @@ nautilus_new_folder_dialog_controller_finalize (GObject *object)
if (self->new_folder_dialog != NULL)
{
g_clear_signal_handler (&self->response_handler_id, self->new_folder_dialog);
- gtk_window_destroy (GTK_WINDOW (self->new_folder_dialog));
+ gtk_widget_destroy (self->new_folder_dialog);
self->new_folder_dialog = NULL;
}
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index 96a8ca97b..f36c722ee 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -29,6 +29,7 @@
#include "nautilus-window.h"
#include "nautilus-window-slot.h"
#include "nautilus-window-slot-dnd.h"
+#include "nautilus-gtk4-helpers.h"
#include <eel/eel-vfs-extensions.h>
#include <glib/gi18n.h>
@@ -168,7 +169,7 @@ nautilus_notebook_sync_loading (GtkNotebook *notebook,
g_return_if_fail (spinner != NULL && icon != NULL);
active = FALSE;
- g_object_get (spinner, "spinning", &active, NULL);
+ g_object_get (spinner, "active", &active, NULL);
allow_stop = nautilus_window_slot_get_allow_stop (slot);
if (active == allow_stop)
@@ -269,7 +270,7 @@ build_tab_label (GtkNotebook *notebook,
gtk_widget_show (label);
/* Tab close button */
- close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
+ close_button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (close_button)),
"flat");
/* don't allow focus on the close button */
@@ -314,11 +315,11 @@ nautilus_notebook_add_tab (GtkNotebook *notebook,
tab_label,
position);
- g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook),
- GTK_WIDGET (slot)),
- "tab-expand", TRUE,
- "detachable", FALSE,
- NULL);
+ gtk_container_child_set (GTK_CONTAINER (notebook),
+ GTK_WIDGET (slot),
+ "tab-expand", TRUE,
+ "detachable", FALSE,
+ NULL);
nautilus_notebook_sync_tab_label (notebook, slot);
nautilus_notebook_sync_loading (notebook, slot);
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index 2371339a5..7d4225785 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -223,25 +223,25 @@ set_copy_move_dialog_text (FileConflictDialogData *data)
static void
set_images (FileConflictDialogData *data)
{
- GdkPaintable *source_paintable;
- GdkPaintable *destination_paintable;
+ GdkPixbuf *source_pixbuf;
+ GdkPixbuf *destination_pixbuf;
- destination_paintable = nautilus_file_get_icon_paintable (data->destination,
- NAUTILUS_GRID_ICON_SIZE_SMALL,
- 1,
- NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+ destination_pixbuf = nautilus_file_get_icon_pixbuf (data->destination,
+ NAUTILUS_GRID_ICON_SIZE_SMALL,
+ 1,
+ NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
- source_paintable = nautilus_file_get_icon_paintable (data->source,
- NAUTILUS_GRID_ICON_SIZE_SMALL,
- 1,
- NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+ source_pixbuf = nautilus_file_get_icon_pixbuf (data->source,
+ NAUTILUS_GRID_ICON_SIZE_SMALL,
+ 1,
+ NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
nautilus_file_conflict_dialog_set_images (data->dialog,
- destination_paintable,
- source_paintable);
+ destination_pixbuf,
+ source_pixbuf);
- g_object_unref (destination_paintable);
- g_object_unref (source_paintable);
+ g_object_unref (destination_pixbuf);
+ g_object_unref (source_pixbuf);
}
static void
@@ -463,7 +463,7 @@ on_conflict_dialog_response (GtkDialog *dialog,
data->response->id = response_id;
- gtk_window_destroy (GTK_WINDOW (data->dialog));
+ gtk_widget_destroy (GTK_WIDGET (data->dialog));
nautilus_file_unref (data->source);
nautilus_file_unref (data->destination);
@@ -561,7 +561,7 @@ on_app_chooser_response (GtkDialog *dialog,
application = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
if (application != NULL)
{
@@ -638,10 +638,10 @@ on_request_passphrase_cb (GtkDialog *dialog,
if (response_id != GTK_RESPONSE_CANCEL &&
response_id != GTK_RESPONSE_DELETE_EVENT)
{
- data->passphrase = g_strdup (gtk_editable_get_text (GTK_EDITABLE (data->passphrase_entry)));
+ data->passphrase = g_strdup (gtk_entry_get_text (data->passphrase_entry));
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
invoke_main_context_completed (data);
}
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 644fc9d0e..dbe30162e 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -33,6 +33,7 @@
#include "nautilus-icon-names.h"
#include "nautilus-trash-monitor.h"
#include "nautilus-ui-utilities.h"
+#include "nautilus-gtk4-helpers.h"
#include "nautilus-window-slot-dnd.h"
@@ -77,6 +78,8 @@ typedef struct
NautilusPathBar *path_bar;
+ GtkGesture *multi_press_gesture;
+
guint ignore_changes : 1;
guint is_root : 1;
} ButtonData;
@@ -96,7 +99,7 @@ struct _NautilusPathBar
GActionGroup *action_group;
NautilusFile *context_menu_file;
- GtkPopoverMenu *current_view_menu_popover;
+ GtkPopover *current_view_menu_popover;
GtkWidget *current_view_menu_button;
GtkWidget *button_menu_popover;
GMenu *current_view_menu;
@@ -211,8 +214,9 @@ on_adjustment_changed (GtkAdjustment *adjustment)
static gboolean
bind_current_view_menu_model_to_popover (NautilusPathBar *self)
{
- gtk_popover_menu_set_menu_model (self->current_view_menu_popover,
- G_MENU_MODEL (self->current_view_menu));
+ gtk_popover_bind_model (self->current_view_menu_popover,
+ G_MENU_MODEL (self->current_view_menu),
+ NULL);
return G_SOURCE_REMOVE;
}
@@ -223,7 +227,7 @@ nautilus_path_bar_init (NautilusPathBar *self)
GtkBuilder *builder;
g_autoptr (GError) error = NULL;
- self->scrolled = gtk_scrolled_window_new ();
+ self->scrolled = gtk_scrolled_window_new (NULL, NULL);
/* Scroll horizontally only and don't use internal scrollbar. */
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled),
/* hscrollbar-policy */ GTK_POLICY_EXTERNAL,
@@ -239,7 +243,8 @@ nautilus_path_bar_init (NautilusPathBar *self)
self->current_view_menu_button = gtk_menu_button_new ();
gtk_menu_button_set_child (GTK_MENU_BUTTON (self->current_view_menu_button),
- gtk_image_new_from_icon_name ("view-more-symbolic"));
+ gtk_image_new_from_icon_name ("view-more-symbolic",
+ GTK_ICON_SIZE_MENU));
gtk_box_append (GTK_BOX (self), self->current_view_menu_button);
builder = gtk_builder_new ();
@@ -253,8 +258,8 @@ nautilus_path_bar_init (NautilusPathBar *self)
g_error ("Failed to add pathbar-context-menu.ui: %s", error->message);
}
self->button_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder, "button-menu")));
- self->button_menu_popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (self->button_menu));
- gtk_widget_set_parent (self->button_menu_popover, GTK_WIDGET (self));
+ self->button_menu_popover = g_object_ref_sink (gtk_popover_new_from_model (NULL,
+ G_MENU_MODEL
(self->button_menu)));
/* Add current location menu, which matches the view's background context menu */
gtk_builder_add_from_resource (builder,
@@ -267,7 +272,7 @@ nautilus_path_bar_init (NautilusPathBar *self)
self->current_view_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder,
"background-menu")));
self->extensions_section = g_object_ref (G_MENU (gtk_builder_get_object (builder,
"background-extensions-section")));
self->templates_submenu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "templates-submenu")));
- self->current_view_menu_popover = g_object_ref_sink (GTK_POPOVER_MENU (gtk_popover_menu_new_from_model
(NULL)));
+ self->current_view_menu_popover = g_object_ref_sink (GTK_POPOVER (gtk_popover_new (NULL)));
g_object_unref (builder);
@@ -305,7 +310,7 @@ nautilus_path_bar_finalize (GObject *object)
g_clear_object (&self->extensions_section);
g_clear_object (&self->templates_submenu);
g_clear_object (&self->button_menu);
- g_clear_pointer (&self->button_menu_popover, gtk_widget_unparent);
+ g_clear_object (&self->button_menu_popover);
g_clear_object (&self->current_view_menu_popover);
unschedule_pop_up_context_menu (NAUTILUS_PATH_BAR (object));
@@ -373,6 +378,8 @@ button_data_free (ButtonData *button_data)
nautilus_file_unref (button_data->file);
}
+ g_clear_object (&button_data->multi_press_gesture);
+
g_free (button_data);
}
@@ -418,7 +425,7 @@ nautilus_path_bar_set_templates_menu (NautilusPathBar *self,
* templates menu is set. Unbinding the model is the only way to clear
* all children. After that's done, on idle, we rebind it.
* See https://gitlab.gnome.org/GNOME/nautilus/-/issues/1705 */
- gtk_popover_menu_set_menu_model (self->current_view_menu_popover, NULL);
+ gtk_popover_bind_model (self->current_view_menu_popover, NULL, NULL);
}
nautilus_gmenu_set_from_model (self->templates_submenu, menu);
@@ -553,11 +560,11 @@ pop_up_pathbar_context_menu (NautilusPathBar *self,
static void
-on_click_gesture_pressed (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
ButtonData *button_data;
NautilusPathBar *self;
@@ -572,7 +579,7 @@ on_click_gesture_pressed (GtkGestureClick *gesture,
button_data = BUTTON_DATA (user_data);
self = button_data->path_bar;
current_button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
- state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
+ gtk_get_current_event_state (&state);
switch (current_button)
{
@@ -595,15 +602,8 @@ on_click_gesture_pressed (GtkGestureClick *gesture,
}
else
{
- /* Hold a reference to keep the popover from destroying itself
- * when unparented. */
- g_object_ref (self->button_menu_popover);
- gtk_widget_unparent (self->button_menu_popover);
- gtk_widget_set_parent (self->button_menu_popover,
- button_data->button);
- gtk_popover_present (GTK_POPOVER (self->button_menu_popover));
- g_object_unref (self->button_menu_popover);
-
+ gtk_popover_set_relative_to (GTK_POPOVER (self->button_menu_popover),
+ button_data->button);
pop_up_pathbar_context_menu (self, button_data->file);
}
}
@@ -755,7 +755,7 @@ nautilus_path_bar_update_button_appearance (ButtonData *button_data,
icon = get_gicon (button_data);
if (icon != NULL)
{
- gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), icon);
+ gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), icon, GTK_ICON_SIZE_MENU);
gtk_widget_show (GTK_WIDGET (button_data->image));
g_object_unref (icon);
}
@@ -976,7 +976,6 @@ make_button_data (NautilusPathBar *self,
{
GFile *path;
GtkWidget *child = NULL;
- GtkEventController *controller;
ButtonData *button_data;
path = nautilus_file_get_location (file);
@@ -1078,7 +1077,7 @@ make_button_data (NautilusPathBar *self,
}
gtk_button_set_child (GTK_BUTTON (button_data->button), child);
- gtk_widget_show (button_data->container);
+ gtk_widget_show_all (button_data->container);
nautilus_path_bar_update_button_state (button_data, current_dir);
@@ -1089,11 +1088,12 @@ make_button_data (NautilusPathBar *self,
/* A gesture is needed here, because GtkButton doesn’t react to middle- or
* secondary-clicking.
*/
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (button_data->button, controller);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
- g_signal_connect (controller, "pressed",
- G_CALLBACK (on_click_gesture_pressed), button_data);
+ button_data->multi_press_gesture = gtk_gesture_multi_press_new (button_data->button);
+
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (button_data->multi_press_gesture), 0);
+
+ g_signal_connect (button_data->multi_press_gesture, "pressed",
+ G_CALLBACK (on_multi_press_gesture_pressed), button_data);
#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
nautilus_drag_slot_proxy_init (button_data->button, button_data->file, NULL);
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index a704c4e33..a2edbfc85 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -26,6 +26,7 @@
#include "nautilus-toolbar-menu-sections.h"
#include "nautilus-view.h"
#include "nautilus-window-slot.h"
+#include "nautilus-gtk4-helpers.h"
typedef struct
{
@@ -71,20 +72,20 @@ open_location_cb (NautilusPlacesView *view,
switch (open_flags)
{
- case NAUTILUS_OPEN_FLAG_NEW_TAB:
+ case GTK_PLACES_OPEN_NEW_TAB:
{
flags = NAUTILUS_OPEN_FLAG_NEW_TAB |
NAUTILUS_OPEN_FLAG_DONT_MAKE_ACTIVE;
}
break;
- case NAUTILUS_OPEN_FLAG_NEW_WINDOW:
+ case GTK_PLACES_OPEN_NEW_WINDOW:
{
flags = NAUTILUS_OPEN_FLAG_NEW_WINDOW;
}
break;
- case NAUTILUS_OPEN_FLAG_NORMAL: /* fall-through */
+ case GTK_PLACES_OPEN_NORMAL: /* fall-through */
default:
{
flags = 0;
@@ -95,12 +96,12 @@ open_location_cb (NautilusPlacesView *view,
if (slot)
{
NautilusFile *file;
- GtkRoot *window;
+ GtkWidget *window;
char *path;
path = "other-locations:///";
file = nautilus_file_get (location);
- window = gtk_widget_get_root (GTK_WIDGET (view));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (view));
nautilus_mime_activate_file (GTK_WINDOW (window),
NAUTILUS_WINDOW_SLOT (slot),
@@ -123,9 +124,9 @@ show_error_message_cb (NautilusGtkPlacesView *view,
const gchar *secondary)
{
GtkWidget *dialog;
- GtkRoot *window;
+ GtkWidget *window;
- window = gtk_widget_get_root (GTK_WIDGET (view));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (view));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
@@ -135,8 +136,8 @@ show_error_message_cb (NautilusGtkPlacesView *view,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", secondary);
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
- gtk_widget_show (dialog);
+ g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ gtk_widget_show_all (dialog);
}
static void
@@ -385,7 +386,7 @@ nautilus_places_view_init (NautilusPlacesView *self)
/* Places view */
priv->places_view = nautilus_gtk_places_view_new ();
nautilus_gtk_places_view_set_open_flags (NAUTILUS_GTK_PLACES_VIEW (priv->places_view),
- NAUTILUS_OPEN_FLAG_NEW_TAB | NAUTILUS_OPEN_FLAG_NEW_WINDOW |
NAUTILUS_OPEN_FLAG_NORMAL);
+ GTK_PLACES_OPEN_NEW_TAB | GTK_PLACES_OPEN_NEW_WINDOW |
GTK_PLACES_OPEN_NORMAL);
gtk_widget_set_hexpand (priv->places_view, TRUE);
gtk_widget_set_vexpand (priv->places_view, TRUE);
gtk_widget_show (priv->places_view);
diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c
index b3a701927..996ba559a 100644
--- a/src/nautilus-preferences-window.c
+++ b/src/nautilus-preferences-window.c
@@ -27,7 +27,7 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#include <glib/gi18n.h>
@@ -74,7 +74,7 @@ static GtkWidget *preferences_window = NULL;
static void list_store_append_string (GListStore *list_store,
const gchar *string)
{
- g_autoptr (GtkStringObject) obj = gtk_string_object_new (string);
+ g_autoptr (HdyValueObject) obj = hdy_value_object_new_string (string);
g_list_store_append (list_store, obj);
}
@@ -84,10 +84,10 @@ static void free_column_names_array(GPtrArray *column_names)
g_ptr_array_free (column_names, TRUE);
}
-static void create_icon_caption_combo_row_items(AdwComboRow *combo_row,
+static void create_icon_caption_combo_row_items(HdyComboRow *combo_row,
GList *columns)
{
- GListStore *list_store = g_list_store_new (GTK_TYPE_STRING_OBJECT);
+ GListStore *list_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT);
GList *l;
GPtrArray *column_names;
@@ -120,12 +120,14 @@ static void create_icon_caption_combo_row_items(AdwComboRow *combo_row,
g_free (label);
}
- adw_combo_row_set_model (combo_row, G_LIST_MODEL (list_store));
+ hdy_combo_row_bind_name_model (combo_row, G_LIST_MODEL (list_store),
+ (HdyComboRowGetNameFunc) hdy_value_object_dup_string,
+ NULL, NULL);
g_object_set_data_full (G_OBJECT (combo_row), "column_names", column_names,
(GDestroyNotify) free_column_names_array);
}
-static void icon_captions_changed_callback(AdwComboRow *widget,
+static void icon_captions_changed_callback(HdyComboRow *widget,
GParamSpec *pspec,
gpointer user_data)
{
@@ -146,7 +148,7 @@ static void icon_captions_changed_callback(AdwComboRow *widget,
combo_row = GTK_WIDGET (
gtk_builder_get_object (builder, icon_captions_components[i]));
- selected_index = adw_combo_row_get_selected (ADW_COMBO_ROW (combo_row));
+ selected_index = hdy_combo_row_get_selected_index (HDY_COMBO_ROW (combo_row));
column_names = g_object_get_data (G_OBJECT (combo_row), "column_names");
@@ -180,7 +182,7 @@ static void update_caption_combo_row(GtkBuilder *builder,
{
if (!strcmp (name, g_ptr_array_index (column_names, i)))
{
- adw_combo_row_set_selected (ADW_COMBO_ROW (combo_row), i);
+ hdy_combo_row_set_selected_index (HDY_COMBO_ROW (combo_row), i);
break;
}
}
@@ -240,11 +242,11 @@ nautilus_preferences_window_setup_icon_caption_page (GtkBuilder *builder)
combo_row = GTK_WIDGET (
gtk_builder_get_object (builder, icon_captions_components[i]));
- create_icon_caption_combo_row_items (ADW_COMBO_ROW (combo_row), columns);
+ create_icon_caption_combo_row_items (HDY_COMBO_ROW (combo_row), columns);
gtk_widget_set_sensitive (combo_row, writable);
g_signal_connect_data (
- combo_row, "notify::selected", G_CALLBACK (icon_captions_changed_callback),
+ combo_row, "notify::selected-index", G_CALLBACK (icon_captions_changed_callback),
g_object_ref (builder), (GClosureNotify) g_object_unref, 0);
}
@@ -300,7 +302,7 @@ static void bind_builder_combo_row(GtkBuilder *builder,
const char **values)
{
g_settings_bind_with_mapping (settings, prefs, gtk_builder_get_object (builder, widget_name),
- "selected", G_SETTINGS_BIND_DEFAULT,
+ "selected-index", G_SETTINGS_BIND_DEFAULT,
combo_row_mapping_get, combo_row_mapping_set,
(gpointer) values, NULL);
}
@@ -309,20 +311,20 @@ static void setup_combo (GtkBuilder *builder,
const char *widget_name,
const char **strings)
{
- AdwComboRow *combo_row;
+ HdyComboRow *combo_row;
GListStore *list_store;
- combo_row = (AdwComboRow *) gtk_builder_get_object (builder, widget_name);
- g_assert (ADW_IS_COMBO_ROW (combo_row));
+ combo_row = (HdyComboRow *) gtk_builder_get_object (builder, widget_name);
+ g_assert (HDY_IS_COMBO_ROW (combo_row));
- list_store = g_list_store_new (GTK_TYPE_STRING_OBJECT);
+ list_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT);
for (gsize i = 0; strings[i]; i++)
{
list_store_append_string (list_store, strings[i]);
}
- adw_combo_row_set_model (combo_row, G_LIST_MODEL (list_store));
+ hdy_combo_row_bind_name_model (combo_row, G_LIST_MODEL (list_store), (HdyComboRowGetNameFunc)
hdy_value_object_dup_string, NULL, NULL);
}
static void nautilus_preferences_window_setup(GtkBuilder *builder,
diff --git a/src/nautilus-progress-info-widget.c b/src/nautilus-progress-info-widget.c
index d2b4a3ff4..fd70d9781 100644
--- a/src/nautilus-progress-info-widget.c
+++ b/src/nautilus-progress-info-widget.c
@@ -49,7 +49,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (NautilusProgressInfoWidget, nautilus_progress_info_w
static void
info_finished (NautilusProgressInfoWidget *self)
{
- gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image), "object-select-symbolic");
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image),
+ "object-select-symbolic",
+ GTK_ICON_SIZE_BUTTON);
gtk_widget_set_sensitive (self->priv->button, FALSE);
}
@@ -125,7 +127,9 @@ nautilus_progress_info_widget_constructed (GObject *obj)
if (nautilus_progress_info_get_is_finished (self->priv->info))
{
- gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image), "object-select-symbolic");
+ gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image),
+ "object-select-symbolic",
+ GTK_ICON_SIZE_BUTTON);
}
gtk_widget_set_sensitive (self->priv->button,
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index a359a2101..c01c471ce 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -47,6 +47,7 @@
#include "nautilus-signaller.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-signaller.h"
+#include "nautilus-gtk4-helpers.h"
static GHashTable *windows;
static GHashTable *pending_lists;
@@ -71,7 +72,7 @@ typedef struct
struct _NautilusPropertiesWindow
{
- AdwWindow parent_instance;
+ HdyWindow parent_instance;
GList *original_files;
GList *target_files;
@@ -287,7 +288,7 @@ static void schedule_directory_contents_update (NautilusPropertiesWindow *self);
static void directory_contents_value_field_update (NautilusPropertiesWindow *self);
static void file_changed_callback (NautilusFile *file,
gpointer user_data);
-static void permission_button_update (GtkCheckButton *button,
+static void permission_button_update (GtkToggleButton *button,
NautilusPropertiesWindow *self);
static void permission_combo_update (GtkComboBox *combo,
NautilusPropertiesWindow *self);
@@ -315,7 +316,7 @@ static void name_field_activate (GtkWidget *name_field,
gpointer user_data);
static void setup_pie_widget (NautilusPropertiesWindow *self);
-G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, ADW_TYPE_WINDOW);
+G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, HDY_TYPE_WINDOW);
static gboolean
is_multi_file_window (NautilusPropertiesWindow *self)
@@ -395,7 +396,7 @@ get_target_file (NautilusPropertiesWindow *self)
static void
get_image_for_properties_window (NautilusPropertiesWindow *self,
char **icon_name,
- GdkPaintable **icon_paintable)
+ GdkPixbuf **icon_pixbuf)
{
g_autoptr (NautilusIconInfo) icon = NULL;
GList *l;
@@ -444,9 +445,9 @@ get_image_for_properties_window (NautilusPropertiesWindow *self,
*icon_name = g_strdup (nautilus_icon_info_get_used_name (icon));
}
- if (icon_paintable != NULL)
+ if (icon_pixbuf != NULL)
{
- *icon_paintable = nautilus_icon_info_get_paintable (icon);
+ *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_GRID_ICON_SIZE_STANDARD);
}
}
@@ -454,18 +455,18 @@ get_image_for_properties_window (NautilusPropertiesWindow *self,
static void
update_properties_window_icon (NautilusPropertiesWindow *self)
{
- g_autoptr (GdkPaintable) paintable = NULL;
+ g_autoptr (GdkPixbuf) pixbuf = NULL;
g_autofree char *name = NULL;
- get_image_for_properties_window (self, &name, &paintable);
+ get_image_for_properties_window (self, &name, &pixbuf);
if (name != NULL)
{
gtk_window_set_icon_name (GTK_WINDOW (self), name);
}
- gtk_image_set_from_paintable (GTK_IMAGE (self->icon_image), paintable);
- gtk_image_set_from_paintable (GTK_IMAGE (self->icon_button_image), paintable);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon_image), pixbuf);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon_button_image), pixbuf);
}
#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
@@ -526,7 +527,7 @@ nautilus_properties_window_drag_data_received (GtkWidget *widget,
GtkWindow *window;
image = GTK_IMAGE (widget);
- window = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (image)));
+ window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (image)));
uris = g_strsplit ((const gchar *) gtk_selection_data_get_data (selection_data), "\r\n", 0);
exactly_one = uris[0] != NULL && (uris[1] == NULL || uris[1][0] == '\0');
@@ -633,7 +634,7 @@ set_name_field (NautilusPropertiesWindow *self,
g_autofree gchar *displayed_name = gtk_editable_get_chars (GTK_EDITABLE (self->name_field), 0,
-1);
if (strcmp (displayed_name, name) != 0)
{
- gtk_editable_set_text (GTK_EDITABLE (self->name_field), name);
+ gtk_entry_set_text (GTK_ENTRY (self->name_field), name);
}
}
}
@@ -742,7 +743,7 @@ name_field_restore_original_name (GtkWidget *name_field)
if (strcmp (original_name, displayed_name) != 0)
{
- gtk_editable_set_text (GTK_EDITABLE (name_field), original_name);
+ gtk_entry_set_text (GTK_ENTRY (name_field), original_name);
}
gtk_editable_select_region (GTK_EDITABLE (name_field), 0, -1);
}
@@ -1185,7 +1186,7 @@ update_files_callback (gpointer data)
if (self->original_files == NULL)
{
/* Close the window if no files are left */
- gtk_window_destroy (GTK_WINDOW (self));
+ gtk_widget_destroy (GTK_WIDGET (self));
}
else
{
@@ -2400,13 +2401,10 @@ should_show_volume_usage (NautilusPropertiesWindow *self)
}
static void
-paint_legend (GtkDrawingArea *drawing_area,
- cairo_t *cr,
- int width,
- int height,
- gpointer data)
+paint_legend (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
- GtkWidget *widget = GTK_WIDGET (drawing_area);
GtkStyleContext *context;
GtkAllocation allocation;
@@ -2430,6 +2428,7 @@ paint_slice (GtkWidget *widget,
double offset = G_PI / 2.0;
GdkRGBA fill;
GdkRGBA stroke;
+ GtkStateFlags state;
GtkBorder border;
GtkStyleContext *context;
double x, y, radius;
@@ -2441,13 +2440,14 @@ paint_slice (GtkWidget *widget,
}
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_border (context, &border);
+ state = gtk_style_context_get_state (context);
+ gtk_style_context_get_border (context, state, &border);
gtk_style_context_save (context);
gtk_style_context_add_class (context, style_class);
- gtk_style_context_get_color (context, &fill);
+ gtk_style_context_get_color (context, state, &fill);
gtk_style_context_add_class (context, "border");
- gtk_style_context_get_color (context, &stroke);
+ gtk_style_context_get_color (context, state, &stroke);
gtk_style_context_restore (context);
width = gtk_widget_get_allocated_width (widget);
@@ -2489,14 +2489,11 @@ paint_slice (GtkWidget *widget,
}
static void
-paint_pie_chart (GtkDrawingArea *drawing_area,
- cairo_t *cr,
- int width,
- int height,
- gpointer data)
+paint_pie_chart (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
NautilusPropertiesWindow *self;
- GtkWidget *widget = GTK_WIDGET (drawing_area);
double free, used, reserved;
self = NAUTILUS_PROPERTIES_WINDOW (data);
@@ -2556,12 +2553,12 @@ setup_pie_widget (NautilusPropertiesWindow *self)
}
}
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->pie_chart),
- paint_pie_chart, self, NULL);
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->used_color),
- paint_legend, self, NULL);
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->free_color),
- paint_legend, self, NULL);
+ g_signal_connect (self->pie_chart, "draw",
+ G_CALLBACK (paint_pie_chart), self);
+ g_signal_connect (self->used_color, "draw",
+ G_CALLBACK (paint_legend), self);
+ g_signal_connect (self->free_color, "draw",
+ G_CALLBACK (paint_legend), self);
}
static void
@@ -2875,7 +2872,12 @@ start_long_operation (NautilusPropertiesWindow *self)
if (self->long_operation_underway == 0)
{
/* start long operation */
- gtk_widget_set_cursor_from_name (GTK_WIDGET (self), "wait");
+ GdkDisplay *display;
+ g_autoptr (GdkCursor) cursor = NULL;
+
+ display = gtk_widget_get_display (GTK_WIDGET (self));
+ cursor = gdk_cursor_new_from_name (display, "wait");
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), cursor);
}
self->long_operation_underway++;
}
@@ -2883,11 +2885,11 @@ start_long_operation (NautilusPropertiesWindow *self)
static void
end_long_operation (NautilusPropertiesWindow *self)
{
- if (gtk_native_get_surface (GTK_NATIVE (self)) != NULL &&
+ if (gtk_widget_get_window (GTK_WIDGET (self)) != NULL &&
self->long_operation_underway == 1)
{
/* finished !! */
- gtk_widget_set_cursor (GTK_WIDGET (self), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), NULL);
}
self->long_operation_underway--;
}
@@ -3011,7 +3013,7 @@ initial_permission_state_consistent (NautilusPropertiesWindow *self,
}
static void
-permission_button_toggled (GtkCheckButton *button,
+permission_button_toggled (GtkToggleButton *button,
NautilusPropertiesWindow *self)
{
gboolean is_folder, is_special;
@@ -3026,8 +3028,8 @@ permission_button_toggled (GtkCheckButton *button,
is_special = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
"is-special"));
- if (gtk_check_button_get_active (button)
- && !gtk_check_button_get_inconsistent (button))
+ if (gtk_toggle_button_get_active (button)
+ && !gtk_toggle_button_get_inconsistent (button))
{
/* Go to the initial state unless the initial state was
* consistent, or we support recursive apply */
@@ -3040,8 +3042,8 @@ permission_button_toggled (GtkCheckButton *button,
on = TRUE;
}
}
- else if (gtk_check_button_get_inconsistent (button)
- && !gtk_check_button_get_active (button))
+ else if (gtk_toggle_button_get_inconsistent (button)
+ && !gtk_toggle_button_get_active (button))
{
inconsistent = FALSE;
on = TRUE;
@@ -3056,8 +3058,8 @@ permission_button_toggled (GtkCheckButton *button,
G_CALLBACK (permission_button_toggled),
self);
- gtk_check_button_set_active (button, on);
- gtk_check_button_set_inconsistent (button, inconsistent);
+ gtk_toggle_button_set_active (button, on);
+ gtk_toggle_button_set_inconsistent (button, inconsistent);
g_signal_handlers_unblock_by_func (G_OBJECT (button),
G_CALLBACK (permission_button_toggled),
@@ -3072,7 +3074,7 @@ permission_button_toggled (GtkCheckButton *button,
}
static void
-permission_button_update (GtkCheckButton *button,
+permission_button_update (GtkToggleButton *button,
NautilusPropertiesWindow *self)
{
GList *l;
@@ -3144,12 +3146,12 @@ permission_button_update (GtkCheckButton *button,
G_CALLBACK (permission_button_toggled),
self);
- gtk_check_button_set_active (button, !all_unset);
+ gtk_toggle_button_set_active (button, !all_unset);
/* if actually inconsistent, or default value for file buttons
* if no files are selected. (useful for recursive apply) */
- gtk_check_button_set_inconsistent (button,
- (!all_unset && !all_set) ||
- (!is_folder && no_match));
+ gtk_toggle_button_set_inconsistent (button,
+ (!all_unset && !all_set) ||
+ (!is_folder && no_match));
gtk_widget_set_sensitive (GTK_WIDGET (button), sensitive);
g_signal_handlers_unblock_by_func (G_OBJECT (button),
@@ -3898,7 +3900,7 @@ on_change_permissions_response (GtkDialog *dialog,
if (response != GTK_RESPONSE_OK)
{
g_clear_pointer (&self->change_permission_combos, g_list_free);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
@@ -3976,7 +3978,7 @@ on_change_permissions_response (GtkDialog *dialog,
}
}
g_clear_pointer (&self->change_permission_combos, g_list_free);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -4131,7 +4133,7 @@ on_change_permissions_clicked (GtkWidget *button,
set_active_from_umask (combo, PERMISSION_OTHER, TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (on_change_permissions_response), self);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
static void
@@ -4171,7 +4173,7 @@ setup_permissions_page (NautilusPropertiesWindow *self)
if (self->has_recursive_apply)
{
- gtk_widget_show (self->change_permissions_button_box);
+ gtk_widget_show_all (self->change_permissions_button_box);
g_signal_connect (self->change_permissions_button, "clicked",
G_CALLBACK (on_change_permissions_clicked),
self);
@@ -4232,10 +4234,10 @@ append_extension_pages (NautilusPropertiesWindow *self)
gtk_notebook_append_page (self->notebook,
page_widget, label);
- g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (self->notebook),
- GTK_WIDGET (page_widget)),
- "tab-expand", TRUE,
- NULL);
+ gtk_container_child_set (GTK_CONTAINER (self->notebook),
+ page_widget,
+ "tab-expand", TRUE,
+ NULL);
g_object_set_data (G_OBJECT (page_widget),
"is-extension-page",
@@ -4439,7 +4441,7 @@ add_clicked_cb (GtkButton *button,
g_app_info_get_display_name (info), error->message);
show_dialog (_("Could not add application"),
message,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
GTK_MESSAGE_ERROR);
}
else
@@ -4467,7 +4469,7 @@ forget_clicked_cb (GtkButton *button,
{
show_dialog (_("Could not forget association"),
error->message,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
GTK_MESSAGE_ERROR);
}
@@ -4512,7 +4514,7 @@ set_as_default_clicked_cb (GtkButton *button,
g_app_info_get_display_name (info), error->message);
show_dialog (_("Could not set as default"),
message,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
GTK_MESSAGE_ERROR);
}
@@ -4700,8 +4702,8 @@ create_properties_window (StartupData *startup_data)
if (startup_data->parent_widget)
{
- gtk_window_set_display (GTK_WINDOW (window),
- gtk_widget_get_display (startup_data->parent_widget));
+ gtk_window_set_screen (GTK_WINDOW (window),
+ gtk_widget_get_screen (startup_data->parent_widget));
}
if (startup_data->parent_window)
@@ -4995,8 +4997,8 @@ nautilus_properties_window_present (GList *original_f
{
if (parent_widget)
{
- gtk_window_set_display (GTK_WINDOW (existing_window),
- gtk_widget_get_display (parent_widget));
+ gtk_window_set_screen (GTK_WINDOW (existing_window),
+ gtk_widget_get_screen (parent_widget));
}
else if (startup_id)
{
@@ -5236,16 +5238,14 @@ select_image_button_callback (GtkWidget *widget,
if (dialog == NULL)
{
- g_autoptr (GFile) pictures_location = NULL;
dialog = gtk_file_chooser_dialog_new (_("Select Custom Icon"), GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Revert"), GTK_RESPONSE_NO,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_OK,
NULL);
- pictures_location = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_PICTURES));
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
- pictures_location,
+ g_get_user_special_dir (G_USER_DIRECTORY_PICTURES),
NULL);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
@@ -5273,9 +5273,9 @@ select_image_button_callback (GtkWidget *widget,
if (image_location != NULL)
{
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
- image_location,
- NULL);
+ gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog),
+ image_location,
+ NULL);
}
}
}
@@ -5304,6 +5304,7 @@ select_image_button_callback (GtkWidget *widget,
static void
nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
{
+ GtkBindingSet *binding_set;
GtkWidgetClass *widget_class;
GObjectClass *oclass;
@@ -5312,9 +5313,15 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
oclass->dispose = real_dispose;
oclass->finalize = real_finalize;
- gtk_widget_class_add_binding (widget_class,
- GDK_KEY_Escape, 0,
- (GtkShortcutFunc) gtk_window_close, NULL);
+ binding_set = gtk_binding_set_by_class (klass);
+ g_signal_new ("close",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
+ "close", 0);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/nautilus/ui/nautilus-properties-window.ui");
@@ -5407,4 +5414,5 @@ static void
nautilus_properties_window_init (NautilusPropertiesWindow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
+ g_signal_connect (self, "close", G_CALLBACK (gtk_window_close), NULL);
}
diff --git a/src/nautilus-properties-window.h b/src/nautilus-properties-window.h
index 4b769bd1a..84f8166a9 100644
--- a/src/nautilus-properties-window.h
+++ b/src/nautilus-properties-window.h
@@ -24,13 +24,13 @@
#pragma once
#include <gtk/gtk.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#define NAUTILUS_TYPE_PROPERTIES_WINDOW (nautilus_properties_window_get_type ())
G_DECLARE_FINAL_TYPE (NautilusPropertiesWindow, nautilus_properties_window,
NAUTILUS, PROPERTIES_WINDOW,
- AdwWindow)
+ HdyWindow)
typedef void (* NautilusPropertiesWindowCallback) (gpointer callback_data);
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 15bcd1f57..c88010920 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -35,6 +35,7 @@
#include "nautilus-search-popover.h"
#include "nautilus-mime-actions.h"
#include "nautilus-ui-utilities.h"
+#include "nautilus-gtk4-helpers.h"
struct _NautilusQueryEditor
{
@@ -145,7 +146,7 @@ nautilus_query_editor_dispose (GObject *object)
G_OBJECT_CLASS (nautilus_query_editor_parent_class)->dispose (object);
}
-static gboolean
+static void
nautilus_query_editor_grab_focus (GtkWidget *widget)
{
NautilusQueryEditor *editor;
@@ -155,10 +156,9 @@ nautilus_query_editor_grab_focus (GtkWidget *widget)
if (gtk_widget_get_visible (widget) && !gtk_widget_is_focus (editor->entry))
{
/* avoid selecting the entry text */
- return gtk_entry_grab_focus_without_selecting (GTK_ENTRY (editor->entry));
+ gtk_widget_grab_focus (editor->entry);
+ gtk_editable_set_position (GTK_EDITABLE (editor->entry), -1);
}
-
- return FALSE;
}
static void
@@ -243,7 +243,6 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class)
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
- g_autoptr (GtkShortcut) shortcut = NULL;
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = nautilus_query_editor_finalize;
@@ -290,9 +289,11 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_Down, 0),
- gtk_signal_action_new ("focus-view"));
- gtk_widget_class_add_shortcut (widget_class, shortcut);
+ gtk_binding_entry_add_signal (gtk_binding_set_by_class (class),
+ GDK_KEY_Down,
+ 0,
+ "focus-view",
+ 0);
/**
* NautilusQueryEditor::location:
@@ -351,7 +352,7 @@ create_query (NautilusQueryEditor *editor)
nautilus_query_set_search_content (query, fts_enabled);
- nautilus_query_set_text (query, gtk_editable_get_text (GTK_EDITABLE (editor->entry)));
+ nautilus_query_set_text (query, gtk_entry_get_text (GTK_ENTRY (editor->entry)));
nautilus_query_set_location (query, editor->location);
/* We only set the query using the global setting for recursivity here,
@@ -386,7 +387,7 @@ entry_changed_cb (GtkWidget *entry,
{
g_autofree gchar *text = NULL;
- text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (editor->entry)));
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->entry)));
text = g_strstrip (text);
nautilus_query_set_text (editor->query, text);
@@ -636,7 +637,7 @@ setup_widgets (NautilusQueryEditor *editor)
G_CALLBACK (search_popover_fts_changed_cb), editor);
/* show everything */
- gtk_widget_show (vbox);
+ gtk_widget_show_all (vbox);
}
static void
@@ -739,11 +740,11 @@ nautilus_query_editor_set_query (NautilusQueryEditor *self,
self->change_frozen = TRUE;
- current_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->entry)));
+ current_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->entry)));
current_text = g_strstrip (current_text);
if (!g_str_equal (current_text, text))
{
- gtk_editable_set_text (GTK_EDITABLE (self->entry), text);
+ gtk_entry_set_text (GTK_ENTRY (self->entry), text);
}
if (g_set_object (&self->query, query))
@@ -762,7 +763,7 @@ nautilus_query_editor_set_text (NautilusQueryEditor *self,
g_return_if_fail (text != NULL);
/* The handler of the entry will take care of everything */
- gtk_editable_set_text (GTK_EDITABLE (self->entry), text);
+ gtk_entry_set_text (GTK_ENTRY (self->entry), text);
}
static gboolean
@@ -778,7 +779,7 @@ nautilus_gtk_search_entry_is_keynav_event (guint keyval,
keyval == GDK_KEY_End || keyval == GDK_KEY_KP_End ||
keyval == GDK_KEY_Page_Up || keyval == GDK_KEY_KP_Page_Up ||
keyval == GDK_KEY_Page_Down || keyval == GDK_KEY_KP_Page_Down ||
- ((state & (GDK_CONTROL_MASK | GDK_ALT_MASK)) != 0))
+ ((state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) != 0))
{
return TRUE;
}
diff --git a/src/nautilus-rename-file-popover-controller.c b/src/nautilus-rename-file-popover-controller.c
index b5fdbc48c..b2491404b 100644
--- a/src/nautilus-rename-file-popover-controller.c
+++ b/src/nautilus-rename-file-popover-controller.c
@@ -44,6 +44,8 @@ struct _NautilusRenameFilePopoverController
gulong closed_handler_id;
gulong file_changed_handler_id;
gulong key_press_event_handler_id;
+
+ GtkEventController *key_controller;
};
G_DEFINE_TYPE (NautilusRenameFilePopoverController, nautilus_rename_file_popover_controller,
NAUTILUS_TYPE_FILE_NAME_WIDGET_CONTROLLER)
@@ -206,7 +208,7 @@ name_entry_on_f2_pressed (GtkWidget *widget,
gint end_offset;
/* Select the name part without the file extension */
- eel_filename_get_rename_region (gtk_editable_get_text (GTK_EDITABLE (widget)),
+ eel_filename_get_rename_region (gtk_entry_get_text (GTK_ENTRY (widget)),
&start_offset, &end_offset);
gtk_editable_select_region (GTK_EDITABLE (widget),
start_offset, end_offset);
@@ -223,7 +225,7 @@ name_entry_on_undo (GtkWidget *widget,
edit_name = nautilus_file_get_edit_name (self->target_file);
- gtk_editable_set_text (GTK_EDITABLE (widget), edit_name);
+ gtk_entry_set_text (GTK_ENTRY (widget), edit_name);
gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
@@ -322,7 +324,6 @@ nautilus_rename_file_popover_controller_show_for_file (NautilusRenameFilePopov
GtkWidget *relative_to)
{
g_autoptr (NautilusDirectory) containing_directory = NULL;
- GtkEventController *controller;
g_autofree gchar *edit_name = NULL;
gint n_chars;
@@ -360,10 +361,11 @@ nautilus_rename_file_popover_controller_show_for_file (NautilusRenameFilePopov
G_CALLBACK (target_file_on_changed),
self);
- controller = gtk_event_controller_key_new ();
- gtk_widget_add_controller (self->name_entry, controller);
- g_signal_connect (controller, "key-pressed",
- G_CALLBACK (on_event_controller_key_key_pressed), self);
+ self->key_controller = gtk_event_controller_key_new (self->name_entry);
+ g_signal_connect (self->key_controller,
+ "key-pressed",
+ G_CALLBACK (on_event_controller_key_key_pressed),
+ self);
gtk_label_set_text (GTK_LABEL (self->title_label),
self->target_is_folder ? _("Rename Folder") :
@@ -371,10 +373,10 @@ nautilus_rename_file_popover_controller_show_for_file (NautilusRenameFilePopov
edit_name = nautilus_file_get_edit_name (self->target_file);
- gtk_editable_set_text (GTK_EDITABLE (self->name_entry), edit_name);
+ gtk_entry_set_text (GTK_ENTRY (self->name_entry), edit_name);
gtk_popover_set_pointing_to (GTK_POPOVER (self->rename_file_popover), pointing_to);
- gtk_widget_set_parent (self->rename_file_popover, relative_to);
+ gtk_popover_set_relative_to (GTK_POPOVER (self->rename_file_popover), relative_to);
gtk_popover_popup (GTK_POPOVER (self->rename_file_popover));
@@ -391,9 +393,9 @@ nautilus_rename_file_popover_controller_show_for_file (NautilusRenameFilePopov
}
n_chars = g_utf8_strlen (edit_name, -1);
- gtk_editable_set_width_chars (GTK_EDITABLE (self->name_entry),
- MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS),
- RENAME_ENTRY_MAX_CHARS));
+ gtk_entry_set_width_chars (GTK_ENTRY (self->name_entry),
+ MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS),
+ RENAME_ENTRY_MAX_CHARS));
}
static void
@@ -421,7 +423,10 @@ nautilus_rename_file_popover_controller_finalize (GObject *object)
reset_state (self);
- g_clear_pointer (&self->rename_file_popover, gtk_widget_unparent);
+ gtk_widget_destroy (self->rename_file_popover);
+ g_clear_object (&self->rename_file_popover);
+
+ g_clear_object (&self->key_controller);
G_OBJECT_CLASS (nautilus_rename_file_popover_controller_parent_class)->finalize (object);
}
diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c
index d2204d163..6082e4a1a 100644
--- a/src/nautilus-search-engine-recent.c
+++ b/src/nautilus-search-engine-recent.c
@@ -232,8 +232,9 @@ recent_thread_func (gpointer user_data)
if (rank > 0)
{
NautilusSearchHit *hit;
- GDateTime *modified;
- GDateTime *visited;
+ time_t modified, visited;
+ g_autoptr (GDateTime) gmodified = NULL;
+ g_autoptr (GDateTime) gvisited = NULL;
if (gtk_recent_info_is_local (info))
{
@@ -280,6 +281,9 @@ recent_thread_func (gpointer user_data)
modified = gtk_recent_info_get_modified (info);
visited = gtk_recent_info_get_visited (info);
+ gmodified = g_date_time_new_from_unix_local (modified);
+ gvisited = g_date_time_new_from_unix_local (visited);
+
if (date_range != NULL)
{
NautilusQuerySearchType type;
@@ -293,11 +297,11 @@ recent_thread_func (gpointer user_data)
if (type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS)
{
- target_time = g_date_time_to_unix (visited);
+ target_time = visited;
}
else if (type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_MODIFIED)
{
- target_time = g_date_time_to_unix (modified);
+ target_time = modified;
}
if (!nautilus_file_date_in_between (target_time,
@@ -309,8 +313,8 @@ recent_thread_func (gpointer user_data)
hit = nautilus_search_hit_new (uri);
nautilus_search_hit_set_fts_rank (hit, rank);
- nautilus_search_hit_set_modification_time (hit, modified);
- nautilus_search_hit_set_access_time (hit, visited);
+ nautilus_search_hit_set_modification_time (hit, gmodified);
+ nautilus_search_hit_set_access_time (hit, gvisited);
hits = g_list_prepend (hits, hit);
}
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index 20559fa9e..20fde2753 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -24,6 +24,7 @@
#include "nautilus-file.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-global-preferences.h"
+#include "nautilus-gtk4-helpers.h"
#define SEARCH_FILTER_MAX_YEARS 5
@@ -91,9 +92,12 @@ calendar_day_selected (GtkCalendar *calendar,
NautilusSearchPopover *popover)
{
GDateTime *date;
+ guint year, month, day;
GPtrArray *date_range;
- date = gtk_calendar_get_date (calendar);
+ gtk_calendar_get_date (calendar, &year, &month, &day);
+
+ date = g_date_time_new_local (year, month + 1, day, 0, 0, 0);
date_range = g_ptr_array_new_full (2, (GDestroyNotify) g_date_time_unref);
g_ptr_array_add (date_range, g_date_time_ref (date));
@@ -123,7 +127,12 @@ setup_date (NautilusSearchPopover *popover,
g_signal_handlers_block_by_func (popover->calendar, calendar_day_selected, popover);
- gtk_calendar_select_day (GTK_CALENDAR (popover->calendar), date_initial);
+ gtk_calendar_select_month (GTK_CALENDAR (popover->calendar),
+ g_date_time_get_month (date_initial) - 1,
+ g_date_time_get_year (date_initial));
+
+ gtk_calendar_select_day (GTK_CALENDAR (popover->calendar),
+ g_date_time_get_day_of_month (date_initial));
update_date_label (popover, date_range);
@@ -157,7 +166,7 @@ date_entry_activate (GtkEntry *entry,
GDate *date;
date = g_date_new ();
- g_date_set_parse (date, gtk_editable_get_text (GTK_EDITABLE (entry)));
+ g_date_set_parse (date, gtk_entry_get_text (entry));
/* Invalid date silently does nothing */
if (!g_date_valid (date))
@@ -334,16 +343,16 @@ types_listbox_row_activated (GtkListBox *listbox,
}
static void
-search_time_type_changed (GtkCheckButton *button,
+search_time_type_changed (GtkToggleButton *button,
NautilusSearchPopover *popover)
{
NautilusQuerySearchType type = -1;
- if (gtk_check_button_get_active (GTK_CHECK_BUTTON (popover->last_modified_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (popover->last_modified_button)))
{
type = NAUTILUS_QUERY_SEARCH_TYPE_LAST_MODIFIED;
}
- else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (popover->last_used_button)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (popover->last_used_button)))
{
type = NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS;
}
@@ -398,7 +407,7 @@ create_row_for_label (const gchar *text,
NULL);
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), label);
- gtk_widget_show (row);
+ gtk_widget_show_all (row);
return row;
}
@@ -566,7 +575,7 @@ on_other_types_dialog_response (GtkDialog *dialog,
}
g_clear_object (&popover->treeview);
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -578,7 +587,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
GtkListStore *store;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- GtkRoot *toplevel;
+ GtkWidget *toplevel;
GtkTreeSelection *selection;
mime_infos = g_content_types_get_registered ();
@@ -607,7 +616,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
}
g_list_free (mime_infos);
- toplevel = gtk_widget_get_root (GTK_WIDGET (popover));
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (popover));
dialog = gtk_dialog_new_with_buttons (_("Select type"),
GTK_WINDOW (toplevel),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT |
GTK_DIALOG_USE_HEADER_BAR,
@@ -616,7 +625,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
NULL);
gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 600);
- scrolled = gtk_scrolled_window_new ();
+ scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
@@ -646,7 +655,7 @@ show_other_types_dialog (NautilusSearchPopover *popover)
popover->treeview = GTK_TREE_VIEW (g_object_ref (treeview));
g_signal_connect (dialog, "response", G_CALLBACK (on_other_types_dialog_response), popover);
- gtk_widget_show (dialog);
+ gtk_widget_show_all (dialog);
}
static void
@@ -668,7 +677,7 @@ update_date_label (NautilusSearchPopover *popover,
label = get_text_for_date_range (date_range, TRUE);
- gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), days < 1 ? label : "");
+ gtk_entry_set_text (GTK_ENTRY (popover->date_entry), days < 1 ? label : "");
gtk_widget_show (popover->clear_date_button);
gtk_label_set_label (GTK_LABEL (popover->select_date_button_label), label);
@@ -680,7 +689,7 @@ update_date_label (NautilusSearchPopover *popover,
{
gtk_label_set_label (GTK_LABEL (popover->select_date_button_label),
_("Select Dates…"));
- gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (popover->date_entry), "");
gtk_widget_hide (popover->clear_date_button);
}
}
@@ -716,7 +725,12 @@ nautilus_search_popover_closed (GtkPopover *popover)
/* Reselect today at the calendar */
g_signal_handlers_block_by_func (self->calendar, calendar_day_selected, self);
- gtk_calendar_select_day (GTK_CALENDAR (self->calendar), now);
+ gtk_calendar_select_month (GTK_CALENDAR (self->calendar),
+ g_date_time_get_month (now) - 1,
+ g_date_time_get_year (now));
+
+ gtk_calendar_select_day (GTK_CALENDAR (self->calendar),
+ g_date_time_get_day_of_month (now));
g_signal_handlers_unblock_by_func (self->calendar, calendar_day_selected, self);
}
@@ -912,21 +926,21 @@ nautilus_search_popover_init (NautilusSearchPopover *self)
filter_time_type = g_settings_get_enum (nautilus_preferences, "search-filter-time-type");
if (filter_time_type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_MODIFIED)
{
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_modified_button), TRUE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_used_button), FALSE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->created_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_modified_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_used_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->created_button), FALSE);
}
else if (filter_time_type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS)
{
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_modified_button), FALSE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_used_button), TRUE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->created_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_modified_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_used_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->created_button), FALSE);
}
else
{
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_modified_button), FALSE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->last_used_button), FALSE);
- gtk_check_button_set_active (GTK_CHECK_BUTTON (self->created_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_modified_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->last_used_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->created_button), TRUE);
}
self->fts_enabled = g_settings_get_boolean (nautilus_preferences,
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 55e9e1aff..82850dafc 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -619,7 +619,7 @@ result_list_attributes_ready_cb (GList *file_list,
GVariant *meta_variant;
gint icon_scale;
- icon_scale = gdk_monitor_get_scale_factor (g_list_model_get_item (gdk_display_get_monitors
(gdk_display_get_default ()), 0));
+ icon_scale = gdk_monitor_get_scale_factor (gdk_display_get_monitor (gdk_display_get_default (), 0));
for (l = file_list; l != NULL; l = l->next)
{
@@ -658,9 +658,9 @@ result_list_attributes_ready_cb (GList *file_list,
if (gicon == NULL)
{
- gicon = G_ICON (nautilus_file_get_icon_texture (file, 128,
- icon_scale,
- NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS));
+ gicon = G_ICON (nautilus_file_get_icon_pixbuf (file, 128,
+ icon_scale,
+ NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS));
}
g_variant_builder_add (&meta, "{sv}",
@@ -739,13 +739,12 @@ typedef struct
} ShowURIData;
static void
-show_uri_callback (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+show_uri_callback (gboolean res,
+ gpointer user_data)
{
ShowURIData *data = user_data;
- if (!gtk_show_uri_full_finish (NULL, result, NULL))
+ if (!res)
{
g_application_open (g_application_get_default (), &data->file, 1, "");
}
@@ -765,13 +764,16 @@ handle_activate_result (NautilusShellSearchProvider2 *skeleton,
gpointer user_data)
{
ShowURIData *data;
+ gboolean res;
data = g_new (ShowURIData, 1);
data->file = g_file_new_for_uri (result);
data->skeleton = skeleton;
data->invocation = invocation;
- gtk_show_uri_full (NULL, result, timestamp, NULL, show_uri_callback, data);
+ res = gtk_show_uri_on_window (NULL, result, timestamp, NULL);
+
+ show_uri_callback (res, data);
return TRUE;
}
diff --git a/src/nautilus-special-location-bar.c b/src/nautilus-special-location-bar.c
index 4e81ff3b5..d2a559726 100644
--- a/src/nautilus-special-location-bar.c
+++ b/src/nautilus-special-location-bar.c
@@ -24,10 +24,11 @@
#include "nautilus-special-location-bar.h"
#include "nautilus-enum-types.h"
+#include "nautilus-gtk4-helpers.h"
struct _NautilusSpecialLocationBar
{
- AdwBin parent_instance;
+ GtkBin parent_instance;
GtkWidget *label;
GtkWidget *learn_more_label;
@@ -40,7 +41,7 @@ enum
PROP_SPECIAL_LOCATION,
};
-G_DEFINE_TYPE (NautilusSpecialLocationBar, nautilus_special_location_bar, ADW_TYPE_BIN)
+G_DEFINE_TYPE (NautilusSpecialLocationBar, nautilus_special_location_bar, GTK_TYPE_BIN)
static void
set_special_location (NautilusSpecialLocationBar *bar,
diff --git a/src/nautilus-special-location-bar.h b/src/nautilus-special-location-bar.h
index 58928d9f8..3d07c7171 100644
--- a/src/nautilus-special-location-bar.h
+++ b/src/nautilus-special-location-bar.h
@@ -20,12 +20,11 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include <libadwaita-1/adwaita.h>
G_BEGIN_DECLS
#define NAUTILUS_TYPE_SPECIAL_LOCATION_BAR (nautilus_special_location_bar_get_type ())
-G_DECLARE_FINAL_TYPE (NautilusSpecialLocationBar, nautilus_special_location_bar, NAUTILUS,
SPECIAL_LOCATION_BAR, AdwBin)
+G_DECLARE_FINAL_TYPE (NautilusSpecialLocationBar, nautilus_special_location_bar, NAUTILUS,
SPECIAL_LOCATION_BAR, GtkBin)
typedef enum {
NAUTILUS_SPECIAL_LOCATION_TEMPLATES,
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 670508933..c6f03517c 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -37,6 +37,7 @@
#include "nautilus-toolbar-menu-sections.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-window.h"
+#include "nautilus-gtk4-helpers.h"
#define OPERATION_MINIMUM_TIME 2 /*s */
#define NEEDS_ATTENTION_ANIMATION_TIMEOUT 2000 /*ms */
@@ -53,7 +54,7 @@ typedef enum
struct _NautilusToolbar
{
- AdwBin parent_instance;
+ GtkBin parent_instance;
NautilusWindow *window;
@@ -88,9 +89,13 @@ struct _NautilusToolbar
GtkWidget *forward_button;
GtkWidget *forward_menu;
+ GtkGesture *forward_button_longpress_gesture;
+ GtkGesture *forward_button_multi_press_gesture;
GtkWidget *back_button;
GtkWidget *back_menu;
+ GtkGesture *back_button_longpress_gesture;
+ GtkGesture *back_button_multi_press_gesture;
GtkWidget *search_button;
@@ -116,7 +121,7 @@ enum
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
-G_DEFINE_TYPE (NautilusToolbar, nautilus_toolbar, ADW_TYPE_BIN);
+G_DEFINE_TYPE (NautilusToolbar, nautilus_toolbar, GTK_TYPE_BIN);
static void nautilus_toolbar_set_window_slot_real (NautilusToolbar *self,
NautilusWindowSlot *slot);
@@ -181,7 +186,7 @@ show_menu (NautilusToolbar *self,
{
g_autoptr (GMenu) menu = NULL;
NautilusNavigationDirection direction;
- GtkPopoverMenu *popover;
+ GtkPopover *popover;
menu = g_menu_new ();
@@ -193,14 +198,14 @@ show_menu (NautilusToolbar *self,
case NAUTILUS_NAVIGATION_DIRECTION_FORWARD:
{
fill_menu (self, menu, FALSE);
- popover = GTK_POPOVER_MENU (self->forward_menu);
+ popover = GTK_POPOVER (self->forward_menu);
}
break;
case NAUTILUS_NAVIGATION_DIRECTION_BACK:
{
fill_menu (self, menu, TRUE);
- popover = GTK_POPOVER_MENU (self->back_menu);
+ popover = GTK_POPOVER (self->back_menu);
}
break;
@@ -211,16 +216,16 @@ show_menu (NautilusToolbar *self,
break;
}
- gtk_popover_menu_set_menu_model (popover, G_MENU_MODEL (menu));
- gtk_popover_popup (GTK_POPOVER (popover));
+ gtk_popover_bind_model (popover, G_MENU_MODEL (menu), NULL);
+ gtk_popover_popup (popover);
}
static void
-navigation_button_press_cb (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+navigation_button_press_cb (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
NautilusToolbar *self;
GtkWidget *widget;
@@ -570,26 +575,25 @@ on_new_progress_info (NautilusProgressInfoManager *manager,
}
static void
-on_operations_icon_draw (GtkDrawingArea *drawing_area,
+on_operations_icon_draw (GtkWidget *widget,
cairo_t *cr,
- int width,
- int height,
NautilusToolbar *self)
{
- GtkWidget *widget = GTK_WIDGET (drawing_area);
gfloat elapsed_progress = 0;
gint remaining_progress = 0;
gint total_progress;
gdouble ratio;
GList *progress_infos;
GList *l;
+ guint width;
+ guint height;
gboolean all_cancelled;
GdkRGBA background;
GdkRGBA foreground;
GtkStyleContext *style_context;
style_context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (style_context, &foreground);
+ gtk_style_context_get_color (style_context, gtk_style_context_get_state (style_context), &foreground);
background = foreground;
background.alpha *= 0.3;
@@ -784,7 +788,7 @@ operations_list_create_widget (GObject *item,
GtkWidget *widget;
widget = nautilus_progress_info_widget_new (info);
- gtk_widget_show (widget);
+ gtk_widget_show_all (widget);
return widget;
}
@@ -793,7 +797,6 @@ static void
nautilus_toolbar_constructed (GObject *object)
{
NautilusToolbar *self = NAUTILUS_TOOLBAR (object);
- GtkEventController *controller;
self->path_bar = GTK_WIDGET (g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL));
gtk_box_append (GTK_BOX (self->path_bar_container),
@@ -802,7 +805,8 @@ nautilus_toolbar_constructed (GObject *object)
self->location_entry = nautilus_location_entry_new ();
gtk_box_append (GTK_BOX (self->location_entry_container),
self->location_entry);
- self->location_entry_close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
+ self->location_entry_close_button = gtk_button_new_from_icon_name ("window-close-symbolic",
+ GTK_ICON_SIZE_BUTTON);
gtk_box_append (GTK_BOX (self->location_entry_container),
self->location_entry_close_button);
g_signal_connect (self->location_entry_close_button, "clicked",
@@ -822,14 +826,12 @@ nautilus_toolbar_constructed (GObject *object)
NULL);
update_operations (self);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_long_press_new ());
- gtk_widget_add_controller (self->back_button, controller);
- g_signal_connect (controller, "pressed",
+ self->back_button_longpress_gesture = gtk_gesture_long_press_new (self->back_button);
+ g_signal_connect (self->back_button_longpress_gesture, "pressed",
G_CALLBACK (back_button_longpress_cb), self);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_long_press_new ());
- gtk_widget_add_controller (self->forward_button, controller);
- g_signal_connect (controller, "pressed",
+ self->forward_button_longpress_gesture = gtk_gesture_long_press_new (self->forward_button);
+ g_signal_connect (self->forward_button_longpress_gesture, "pressed",
G_CALLBACK (forward_button_longpress_cb), self);
g_object_set_data (G_OBJECT (self->back_button), "nav-direction",
@@ -837,16 +839,17 @@ nautilus_toolbar_constructed (GObject *object)
g_object_set_data (G_OBJECT (self->forward_button), "nav-direction",
GUINT_TO_POINTER (NAUTILUS_NAVIGATION_DIRECTION_FORWARD));
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (self->back_button, controller);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_SECONDARY);
- g_signal_connect (controller, "pressed",
+
+ self->back_button_multi_press_gesture = gtk_gesture_multi_press_new (self->back_button);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->back_button_multi_press_gesture),
+ GDK_BUTTON_SECONDARY);
+ g_signal_connect (self->back_button_multi_press_gesture, "pressed",
G_CALLBACK (navigation_button_press_cb), self);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (self->forward_button, controller);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_SECONDARY);
- g_signal_connect (controller, "pressed",
+ self->forward_button_multi_press_gesture = gtk_gesture_multi_press_new (self->forward_button);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->forward_button_multi_press_gesture),
+ GDK_BUTTON_SECONDARY);
+ g_signal_connect (self->forward_button_multi_press_gesture, "pressed",
G_CALLBACK (navigation_button_press_cb), self);
g_signal_connect (self->operations_popover, "show",
@@ -858,9 +861,9 @@ nautilus_toolbar_constructed (GObject *object)
/* Setting a max width on one entry to effectively set a max expansion for
* the whole title widget. */
- gtk_editable_set_max_width_chars (GTK_EDITABLE (self->location_entry), 88);
+ gtk_entry_set_max_width_chars (GTK_ENTRY (self->location_entry), 88);
- gtk_widget_show (GTK_WIDGET (self));
+ gtk_widget_show_all (GTK_WIDGET (self));
toolbar_update_appearance (self);
}
@@ -868,16 +871,6 @@ static void
nautilus_toolbar_init (NautilusToolbar *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
-
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->operations_icon),
- (GtkDrawingAreaDrawFunc) on_operations_icon_draw,
- self,
- NULL);
-
- gtk_widget_set_parent (self->back_menu, self->back_button);
- g_signal_connect (self->back_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL);
- gtk_widget_set_parent (self->forward_menu, self->forward_button);
- g_signal_connect (self->forward_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL);
}
void
@@ -1038,10 +1031,10 @@ nautilus_toolbar_dispose (GObject *object)
self = NAUTILUS_TOOLBAR (object);
+ g_clear_object (&self->forward_button_multi_press_gesture);
+ g_clear_object (&self->back_button_multi_press_gesture);
g_clear_pointer (&self->icon_binding, g_binding_unbind);
g_clear_pointer (&self->search_binding, g_binding_unbind);
- g_clear_pointer (&self->back_menu, gtk_widget_unparent);
- g_clear_pointer (&self->forward_menu, gtk_widget_unparent);
G_OBJECT_CLASS (nautilus_toolbar_parent_class)->dispose (object);
}
@@ -1073,6 +1066,9 @@ nautilus_toolbar_finalize (GObject *obj)
g_signal_handlers_disconnect_by_func (self->window,
on_window_focus_changed, self);
+ g_clear_object (&self->back_button_longpress_gesture);
+ g_clear_object (&self->forward_button_longpress_gesture);
+
G_OBJECT_CLASS (nautilus_toolbar_parent_class)->finalize (obj);
}
@@ -1146,6 +1142,7 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, search_button);
+ gtk_widget_class_bind_template_callback (widget_class, on_operations_icon_draw);
gtk_widget_class_bind_template_callback (widget_class, on_operations_popover_notify_visible);
}
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index e67aeedba..6f49acee1 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -24,7 +24,7 @@
#pragma once
#include <gtk/gtk.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#include "nautilus-window-slot.h"
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define NAUTILUS_TYPE_TOOLBAR nautilus_toolbar_get_type()
-G_DECLARE_FINAL_TYPE (NautilusToolbar, nautilus_toolbar, NAUTILUS, TOOLBAR, AdwBin)
+G_DECLARE_FINAL_TYPE (NautilusToolbar, nautilus_toolbar, NAUTILUS, TOOLBAR, GtkBin)
GtkWidget *nautilus_toolbar_new (void);
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index 08631f571..af87dbdf1 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -32,6 +32,7 @@
#include "nautilus-file.h"
#include "nautilus-trash-monitor.h"
#include "nautilus-ui-utilities.h"
+#include "nautilus-gtk4-helpers.h"
enum
{
@@ -48,13 +49,13 @@ enum
struct _NautilusTrashBar
{
- AdwBin parent_instance;
+ GtkBin parent_instance;
NautilusFilesView *view;
gulong selection_handler_id;
};
-G_DEFINE_TYPE (NautilusTrashBar, nautilus_trash_bar, ADW_TYPE_BIN)
+G_DEFINE_TYPE (NautilusTrashBar, nautilus_trash_bar, GTK_TYPE_BIN)
static void
selection_changed_cb (NautilusFilesView *view,
@@ -67,7 +68,7 @@ selection_changed_cb (NautilusFilesView *view,
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
count = g_list_length (selection);
- info_bar = adw_bin_get_child (ADW_BIN (bar));
+ info_bar = gtk_bin_get_child (GTK_BIN (bar));
gtk_info_bar_set_response_sensitive (GTK_INFO_BAR (info_bar),
TRASH_BAR_RESPONSE_RESTORE,
(count > 0));
@@ -129,7 +130,7 @@ nautilus_trash_bar_trash_state_changed (NautilusTrashMonitor *trash_monitor,
bar = NAUTILUS_TRASH_BAR (data);
- info_bar = adw_bin_get_child (ADW_BIN (bar));
+ info_bar = gtk_bin_get_child (GTK_BIN (bar));
gtk_info_bar_set_response_sensitive (GTK_INFO_BAR (info_bar),
TRASH_BAR_RESPONSE_EMPTY,
!nautilus_trash_monitor_is_empty ());
@@ -162,10 +163,10 @@ trash_bar_response_cb (GtkInfoBar *infobar,
gpointer user_data)
{
NautilusTrashBar *bar;
- GtkRoot *window;
+ GtkWidget *window;
bar = NAUTILUS_TRASH_BAR (user_data);
- window = gtk_widget_get_root (GTK_WIDGET (bar));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (bar));
switch (response_id)
{
@@ -193,7 +194,7 @@ trash_bar_response_cb (GtkInfoBar *infobar,
case TRASH_BAR_RESPONSE_EMPTY:
{
- nautilus_file_operations_empty_trash (GTK_WIDGET (window), TRUE, NULL);
+ nautilus_file_operations_empty_trash (window, TRUE, NULL);
}
break;
diff --git a/src/nautilus-trash-bar.h b/src/nautilus-trash-bar.h
index 4f03f2edc..9fc4ffa50 100644
--- a/src/nautilus-trash-bar.h
+++ b/src/nautilus-trash-bar.h
@@ -23,13 +23,12 @@
#include "nautilus-files-view.h"
#include <gtk/gtk.h>
-#include <libadwaita-1/adwaita.h>
G_BEGIN_DECLS
#define NAUTILUS_TYPE_TRASH_BAR (nautilus_trash_bar_get_type ())
-G_DECLARE_FINAL_TYPE (NautilusTrashBar, nautilus_trash_bar, NAUTILUS, TRASH_BAR, AdwBin)
+G_DECLARE_FINAL_TYPE (NautilusTrashBar, nautilus_trash_bar, NAUTILUS, TRASH_BAR, GtkBin)
GtkWidget *nautilus_trash_bar_new (NautilusFilesView *view);
diff --git a/src/nautilus-ui-utilities.c b/src/nautilus-ui-utilities.c
index 6153d3f1f..60d667a57 100644
--- a/src/nautilus-ui-utilities.c
+++ b/src/nautilus-ui-utilities.c
@@ -333,7 +333,7 @@ show_dialog (const gchar *primary_text,
gtk_widget_show (dialog);
g_signal_connect (GTK_DIALOG (dialog), "response",
- G_CALLBACK (gtk_window_destroy), NULL);
+ G_CALLBACK (gtk_widget_destroy), NULL);
return GTK_DIALOG (dialog);
}
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index ffd12e432..f56797771 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -9,6 +9,7 @@
#include "nautilus-directory.h"
#include "nautilus-global-preferences.h"
#include "nautilus-thumbnails.h"
+#include "nautilus-gtk4-helpers.h"
struct _NautilusViewIconController
{
@@ -24,6 +25,7 @@ struct _NautilusViewIconController
gboolean single_click_mode;
gboolean activate_on_release;
+ GtkGesture *multi_press_gesture;
guint scroll_to_file_handle_id;
guint prioritize_thumbnailing_handle_id;
@@ -427,8 +429,8 @@ static void
reveal_item_ui (NautilusViewIconController *self,
GtkWidget *item_ui)
{
- gdouble item_y;
- gdouble item_height;
+ int item_y;
+ int item_height;
gtk_widget_translate_coordinates (item_ui, GTK_WIDGET (self->view_ui),
0, 0,
@@ -767,17 +769,17 @@ activate_selection_on_click (NautilusViewIconController *self,
}
static void
-on_button_press_event (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+on_button_press_event (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
NautilusViewIconController *self;
guint button;
GdkModifierType modifiers = 0;
- gdouble view_x;
- gdouble view_y;
+ gint view_x;
+ gint view_y;
GtkFlowBoxChild *child_at_pos;
self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
@@ -854,11 +856,11 @@ on_button_press_event (GtkGestureClick *gesture,
}
static void
-on_click_released (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+on_click_released (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
@@ -871,8 +873,8 @@ on_click_released (GtkGestureClick *gesture,
}
static void
-on_click_stopped (GtkGestureClick *gesture,
- gpointer user_data)
+on_click_stopped (GtkGestureMultiPress *gesture,
+ gpointer user_data)
{
NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
@@ -887,8 +889,8 @@ on_longpress_gesture_pressed_callback (GtkGestureLongPress *gesture,
{
NautilusViewIconController *self;
GtkFlowBoxChild *child_at_pos;
- gdouble view_x;
- gdouble view_y;
+ gint view_x;
+ gint view_y;
self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
@@ -942,9 +944,9 @@ static GtkFlowBoxChild *
get_first_visible_item_ui (NautilusViewIconController *self)
{
GtkFlowBoxChild *child_at_0;
- gdouble x0;
- gdouble y0;
- gdouble scrolled_y;
+ gint x0;
+ gint y0;
+ gint scrolled_y;
child_at_0 = gtk_flow_box_get_child_at_index (self->view_ui, 0);
if (child_at_0 == NULL)
@@ -999,7 +1001,7 @@ scroll_to_file_on_idle (ScrollToFileData *data)
g_autoptr (NautilusFile) file = NULL;
NautilusViewItemModel *item;
GtkWidget *item_ui;
- gdouble item_y;
+ int item_y;
file = nautilus_file_get_existing_by_uri (data->uri);
item = nautilus_view_model_get_item_from_file (self->model, file);
@@ -1189,6 +1191,7 @@ dispose (GObject *object)
self = NAUTILUS_VIEW_ICON_CONTROLLER (object);
+ g_clear_object (&self->multi_press_gesture);
g_clear_handle_id (&self->scroll_to_file_handle_id, g_source_remove);
g_clear_handle_id (&self->prioritize_thumbnailing_handle_id, g_source_remove);
@@ -1211,7 +1214,7 @@ prioritize_thumbnailing_on_idle (NautilusViewIconController *self)
GtkFlowBoxChild *next_child;
gint first_index;
gint next_index;
- gdouble y;
+ gint y;
gint last_index;
gpointer item;
NautilusFile *file;
@@ -1305,7 +1308,7 @@ setup_item_ui (GtkWidget **child,
nautilus_view_item_ui_set_caption_attributes (item_ui, self->caption_attributes);
*child = GTK_WIDGET (item_ui);
- gtk_widget_show (*child);
+ gtk_widget_show_all (*child);
}
static GtkWidget *
@@ -1328,7 +1331,7 @@ create_view_ui (NautilusViewIconController *self)
GtkFlowBox *flowbox;
widget = gtk_flow_box_new ();
- gtk_widget_set_focusable (widget, TRUE);
+ gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_set_valign (widget, GTK_ALIGN_START);
flowbox = GTK_FLOW_BOX (widget);
@@ -1362,7 +1365,7 @@ constructed (GObject *object)
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
GActionGroup *view_action_group;
- GtkEventController *controller;
+ GtkGesture *longpress_gesture;
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (self));
hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (content_widget));
@@ -1388,23 +1391,26 @@ constructed (GObject *object)
self->view_icon = g_themed_icon_new ("view-grid-symbolic");
/* Compensating for the lack of event boxen to allow clicks outside the flow box. */
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (GTK_WIDGET (content_widget), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
- g_signal_connect (controller, "pressed",
+ self->multi_press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (content_widget));
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->multi_press_gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->multi_press_gesture),
+ 0);
+ g_signal_connect (self->multi_press_gesture, "pressed",
G_CALLBACK (on_button_press_event), self);
- g_signal_connect (controller, "stopped",
+ g_signal_connect (self->multi_press_gesture, "stopped",
G_CALLBACK (on_click_stopped), self);
- g_signal_connect (controller, "released",
+ g_signal_connect (self->multi_press_gesture, "released",
G_CALLBACK (on_click_released), self);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_long_press_new ());
- gtk_widget_add_controller (GTK_WIDGET (self->view_ui), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (controller), TRUE);
- g_signal_connect (controller, "pressed",
- (GCallback) on_longpress_gesture_pressed_callback, self);
+ longpress_gesture = gtk_gesture_long_press_new (GTK_WIDGET (self->view_ui));
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (longpress_gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (longpress_gesture),
+ TRUE);
+ g_signal_connect (longpress_gesture, "pressed",
+ (GCallback) on_longpress_gesture_pressed_callback,
+ self);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (content_widget),
GTK_WIDGET (self->view_ui));
@@ -1415,7 +1421,7 @@ constructed (GObject *object)
G_N_ELEMENTS (view_icon_actions),
self);
- gtk_widget_show (GTK_WIDGET (self));
+ gtk_widget_show_all (GTK_WIDGET (self));
view_action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (self));
g_action_map_add_action_entries (G_ACTION_MAP (view_action_group),
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index 344e0fc2a..29a4a1bd2 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -33,7 +33,7 @@ static void
update_icon (NautilusViewIconItemUi *self)
{
NautilusFileIconFlags flags;
- g_autoptr (GdkPaintable) icon_paintable = NULL;
+ g_autoptr (GdkPixbuf) icon_pixbuf = NULL;
GtkStyleContext *style_context;
NautilusFile *file;
guint icon_size;
@@ -46,8 +46,8 @@ update_icon (NautilusViewIconItemUi *self)
NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS |
NAUTILUS_FILE_ICON_FLAGS_USE_ONE_EMBLEM;
- icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
- gtk_image_set_from_paintable (GTK_IMAGE (self->icon), icon_paintable);
+ icon_pixbuf = nautilus_file_get_icon_pixbuf (file, icon_size, 1, flags);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon), icon_pixbuf);
gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size);
if (icon_size < NAUTILUS_GRID_ICON_SIZE_LARGEST)
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index ccec73b60..254084cb1 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -83,14 +83,14 @@ static void
switch_location (NautilusDragSlotProxyInfo *drag_info)
{
GFile *location;
- GtkRoot *window;
+ GtkWidget *window;
if (drag_info->target_file == NULL)
{
return;
}
- window = gtk_widget_get_root (drag_info->widget);
+ window = gtk_widget_get_toplevel (drag_info->widget);
g_assert (NAUTILUS_IS_WINDOW (window));
location = nautilus_file_get_location (drag_info->target_file);
@@ -153,7 +153,7 @@ slot_proxy_drag_motion (GtkWidget *widget,
{
NautilusDragSlotProxyInfo *drag_info;
NautilusWindowSlot *target_slot;
- GtkRoot *window;
+ GtkWidget *window;
GdkAtom target;
int action;
char *target_uri;
@@ -172,7 +172,7 @@ slot_proxy_drag_motion (GtkWidget *widget,
goto out;
}
- window = gtk_widget_get_root (widget);
+ window = gtk_widget_get_toplevel (widget);
g_assert (NAUTILUS_IS_WINDOW (window));
if (!drag_info->have_data)
@@ -360,7 +360,7 @@ slot_proxy_handle_drop (GtkWidget *widget,
unsigned int time,
NautilusDragSlotProxyInfo *drag_info)
{
- GtkRoot *window;
+ GtkWidget *window;
NautilusWindowSlot *target_slot;
NautilusFilesView *target_view;
char *target_uri;
@@ -375,7 +375,7 @@ slot_proxy_handle_drop (GtkWidget *widget,
return;
}
- window = gtk_widget_get_root (widget);
+ window = gtk_widget_get_toplevel (widget);
g_assert (NAUTILUS_IS_WINDOW (window));
if (drag_info->target_slot != NULL)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 7e94ffcab..16ae23a4a 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -48,6 +48,7 @@
#include <nautilus-extension.h>
#include "nautilus-ui-utilities.h"
#include <eel/eel-vfs-extensions.h>
+#include "nautilus-gtk4-helpers.h"
enum
{
@@ -1862,13 +1863,13 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
}
else
{
- gtk_window_destroy (GTK_WINDOW (window));
+ gtk_widget_destroy (GTK_WIDGET (window));
}
}
else
{
/* Since this is a window, destroying it will also unref it. */
- gtk_window_destroy (GTK_WINDOW (window));
+ gtk_widget_destroy (GTK_WIDGET (window));
}
}
else
@@ -2944,26 +2945,25 @@ nautilus_window_slot_finalize (GObject *object)
G_OBJECT_CLASS (nautilus_window_slot_parent_class)->finalize (object);
}
-static gboolean
+static void
nautilus_window_slot_grab_focus (GtkWidget *widget)
{
NautilusWindowSlot *self;
self = NAUTILUS_WINDOW_SLOT (widget);
+ GTK_WIDGET_CLASS (nautilus_window_slot_parent_class)->grab_focus (widget);
if (nautilus_window_slot_get_search_visible (self))
{
- return gtk_widget_grab_focus (GTK_WIDGET (self->query_editor));
+ gtk_widget_grab_focus (GTK_WIDGET (self->query_editor));
}
- else if (self->content_view != NULL)
+ else if (self->content_view)
{
- return gtk_widget_grab_focus (GTK_WIDGET (self->content_view));
+ gtk_widget_grab_focus (GTK_WIDGET (self->content_view));
}
- else if (self->new_content_view != NULL)
+ else if (self->new_content_view)
{
- return gtk_widget_grab_focus (GTK_WIDGET (self->new_content_view));
+ gtk_widget_grab_focus (GTK_WIDGET (self->new_content_view));
}
-
- return GTK_WIDGET_CLASS (nautilus_window_slot_parent_class)->grab_focus (widget);
}
static void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 93d3b56ff..c40175275 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -36,17 +36,17 @@
#include <sys/time.h>
#ifdef GDK_WINDOWING_WAYLAND
-#include <gdk/wayland/gdkwayland.h>
+#include <gdk/gdkwayland.h>
#endif
#ifdef GDK_WINDOWING_X11
-#include <gdk/x11/gdkx.h>
+#include <gdk/gdkx.h>
#endif
#define DEBUG_FLAG NAUTILUS_DEBUG_WINDOW
#include "nautilus-debug.h"
-#include "gtk/nautilusgtkplacessidebarprivate.h"
+#include "gtk/nautilusgtkplacessidebar.h"
#include "nautilus-application.h"
#include "nautilus-bookmark-list.h"
@@ -70,6 +70,7 @@
#include "nautilus-trash-monitor.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-window-slot.h"
+#include "nautilus-gtk4-helpers.h"
/* Forward and back buttons on the mouse */
static gboolean mouse_extra_buttons = TRUE;
@@ -98,7 +99,7 @@ static void nautilus_window_back_or_forward (NautilusWindow *window,
struct _NautilusWindow
{
- AdwApplicationWindow parent_instance;
+ HdyApplicationWindow parent_instance;
GtkWidget *notebook;
@@ -150,6 +151,13 @@ struct _NautilusWindow
GMenuModel *tab_menu_model;
GQueue *tab_data_queue;
+
+ GtkPadController *pad_controller;
+
+ GtkGesture *multi_press_gesture;
+ GtkGesture *notebook_multi_press_gesture;
+ GtkEventController *key_capture_controller;
+ GtkEventController *key_bubble_controller;
};
enum
@@ -161,7 +169,7 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (NautilusWindow, nautilus_window, ADW_TYPE_APPLICATION_WINDOW);
+G_DEFINE_TYPE (NautilusWindow, nautilus_window, HDY_TYPE_APPLICATION_WINDOW);
static const GtkPadActionEntry pad_actions[] =
{
@@ -632,19 +640,19 @@ remember_focus_widget (NautilusWindow *window)
}
}
-static gboolean
+static void
nautilus_window_grab_focus (GtkWidget *widget)
{
NautilusWindowSlot *slot;
slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (widget));
- if (slot != NULL)
+ GTK_WIDGET_CLASS (nautilus_window_parent_class)->grab_focus (widget);
+
+ if (slot)
{
- return gtk_widget_grab_focus (GTK_WIDGET (slot));
+ gtk_widget_grab_focus (GTK_WIDGET (slot));
}
-
- return GTK_WIDGET_CLASS (nautilus_window_parent_class)->grab_focus (widget);
}
static void
@@ -748,11 +756,16 @@ update_cursor (NautilusWindow *window)
if (slot != NULL &&
nautilus_window_slot_get_allow_stop (slot))
{
- gtk_widget_set_cursor_from_name (GTK_WIDGET (window), "progress");
+ GdkDisplay *display;
+ g_autoptr (GdkCursor) cursor = NULL;
+
+ display = gtk_widget_get_display (GTK_WIDGET (window));
+ cursor = gdk_cursor_new_from_name (display, "progress");
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
}
else
{
- gtk_widget_set_cursor (GTK_WIDGET (window), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
}
}
@@ -1189,8 +1202,8 @@ get_window_xid (NautilusWindow *window)
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
{
- GdkSurface *gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
- return (guint) gdk_x11_surface_get_xid (gdk_surface);
+ GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ return (guint) gdk_x11_window_get_xid (gdk_window);
}
#endif
return 0;
@@ -1234,7 +1247,6 @@ add_menu_separator (GtkWidget *menu)
gtk_widget_show (separator);
}
-#if 0 && SIDEBAR_MENU_ITEMS_NEEDS_GTK4_REIMPLEMENTATION
static void
places_sidebar_populate_popup_cb (NautilusGtkPlacesSidebar *sidebar,
GtkWidget *menu,
@@ -1307,7 +1319,6 @@ places_sidebar_populate_popup_cb (NautilusGtkPlacesSidebar *sidebar,
}
}
}
-#endif
static void
nautilus_window_set_up_sidebar (NautilusWindow *window)
@@ -1335,10 +1346,8 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
g_signal_connect (window->places_sidebar, "drag-perform-drop",
G_CALLBACK (places_sidebar_drag_perform_drop_cb), window);
#endif
-#if 0 && SIDEBAR_MENU_ITEMS_NEEDS_GTK4_REIMPLEMENTATION
g_signal_connect (window->places_sidebar, "populate-popup",
G_CALLBACK (places_sidebar_populate_popup_cb), window);
-#endif
g_signal_connect (window->places_sidebar, "unmount",
G_CALLBACK (places_sidebar_unmount_operation_cb), window);
}
@@ -1767,18 +1776,18 @@ notebook_popup_menu_show (NautilusWindow *window,
}
static void
-notebook_button_press_cb (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+notebook_button_press_cb (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
NautilusWindow *window;
GtkNotebook *notebook;
gint tab_clicked;
guint button;
GdkEventSequence *sequence;
- GdkEvent *event;
+ const GdkEvent *event;
GdkModifierType state;
if (n_press != 1)
@@ -1797,7 +1806,7 @@ notebook_button_press_cb (GtkGestureClick *gesture,
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- state = gdk_event_get_modifier_state (event);
+ gdk_event_get_state (event, &state);
if (button == GDK_BUTTON_SECONDARY &&
(state & gtk_accelerator_get_default_mod_mask ()) == 0)
@@ -1932,8 +1941,6 @@ notebook_create_window_cb (GtkNotebook *notebook,
static void
setup_notebook (NautilusWindow *window)
{
- GtkEventController *controller;
-
g_signal_connect (window->notebook, "switch-page",
G_CALLBACK (notebook_switch_page_cb),
window);
@@ -1947,12 +1954,9 @@ setup_notebook (NautilusWindow *window)
G_CALLBACK (notebook_page_removed_cb),
window);
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (GTK_WIDGET (window->notebook), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
- g_signal_connect (controller, "pressed",
- G_CALLBACK (notebook_button_press_cb), window);
+ g_signal_connect (window->notebook_multi_press_gesture, "pressed",
+ G_CALLBACK (notebook_button_press_cb),
+ window);
}
const GActionEntry win_entries[] =
@@ -2137,8 +2141,6 @@ nautilus_window_dispose (GObject *object)
DEBUG ("Destroying window");
- g_clear_pointer (&window->tab_menu, gtk_widget_unparent);
-
/* close all slots safely */
slots_copy = g_list_copy (window->slots);
if (window->active_slot != NULL)
@@ -2165,6 +2167,11 @@ nautilus_window_dispose (GObject *object)
nautilus_window_unexport_handle (window);
+ g_clear_object (&window->notebook_multi_press_gesture);
+
+ g_clear_object (&window->key_capture_controller);
+ g_clear_object (&window->key_bubble_controller);
+
G_OBJECT_CLASS (nautilus_window_parent_class)->dispose (object);
}
@@ -2202,6 +2209,8 @@ nautilus_window_finalize (GObject *object)
g_queue_free_full (window->tab_data_queue, free_navigation_state);
+ g_object_unref (window->pad_controller);
+
/* nautilus_window_close() should have run */
g_assert (window->slots == NULL);
@@ -2211,11 +2220,29 @@ nautilus_window_finalize (GObject *object)
static void
nautilus_window_save_geometry (NautilusWindow *window)
{
+ GdkWindow *gdk_window;
+ GdkWindowState window_state;
gint width;
gint height;
GVariant *initial_size;
- gtk_window_get_default_size (GTK_WINDOW (window), &width, &height);
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ if (!gdk_window)
+ {
+ return;
+ }
+ window_state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
+ if (window_state & (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_MAXIMIZED))
+ {
+ /* Don't save the window state for tiled or maximized windows. In GTK
+ * gtk_window_get_default_size() is going to do this for us.
+ */
+ return;
+ }
+
+ gtk_window_get_size (GTK_WINDOW (window), &width, &height);
initial_size = g_variant_new_parsed ("(%i, %i)", width, height);
g_settings_set_value (nautilus_window_state,
@@ -2231,7 +2258,7 @@ nautilus_window_close (NautilusWindow *window)
nautilus_window_save_geometry (window);
nautilus_window_set_active_slot (window, NULL);
- gtk_window_destroy (GTK_WINDOW (window));
+ gtk_widget_destroy (GTK_WIDGET (window));
}
void
@@ -2356,9 +2383,9 @@ typedef struct
} WaylandWindowHandleExportedData;
static void
-wayland_window_handle_exported (GdkToplevel *toplevel,
- const char *wayland_handle_str,
- gpointer user_data)
+wayland_window_handle_exported (GdkWindow *window,
+ const char *wayland_handle_str,
+ gpointer user_data)
{
WaylandWindowHandleExportedData *data = user_data;
@@ -2392,7 +2419,7 @@ nautilus_window_export_handle (NautilusWindow *window,
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
{
- GdkSurface *gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
+ GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
WaylandWindowHandleExportedData *data;
data = g_new0 (WaylandWindowHandleExportedData, 1);
@@ -2400,10 +2427,10 @@ nautilus_window_export_handle (NautilusWindow *window,
data->callback = callback;
data->user_data = user_data;
- if (!gdk_wayland_toplevel_export_handle (GDK_WAYLAND_TOPLEVEL (gdk_surface),
- wayland_window_handle_exported,
- data,
- g_free))
+ if (!gdk_wayland_window_export_handle (gdk_window,
+ wayland_window_handle_exported,
+ data,
+ g_free))
{
g_free (data);
return FALSE;
@@ -2431,10 +2458,10 @@ nautilus_window_unexport_handle (NautilusWindow *window)
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
{
- GdkSurface *gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
- if (GDK_IS_WAYLAND_TOPLEVEL (gdk_surface))
+ GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ if (gdk_window != NULL)
{
- gdk_wayland_toplevel_unexport_handle (GDK_WAYLAND_TOPLEVEL (gdk_surface));
+ gdk_wayland_window_unexport_handle (gdk_window);
}
}
#endif
@@ -2485,9 +2512,10 @@ on_is_maximized_changed (GObject *object,
}
static gboolean
-nautilus_window_close_request (GtkWindow *window)
+nautilus_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event)
{
- nautilus_window_close (NAUTILUS_WINDOW (window));
+ nautilus_window_close (NAUTILUS_WINDOW (widget));
return FALSE;
}
@@ -2507,11 +2535,11 @@ nautilus_window_back_or_forward (NautilusWindow *window,
}
static void
-on_click_gesture_pressed (GtkGestureClick *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
GtkWidget *widget;
NautilusWindow *window;
@@ -2573,8 +2601,6 @@ static void
nautilus_window_init (NautilusWindow *window)
{
GtkWindowGroup *window_group;
- GtkPadController *pad_controller;
- GtkEventController *controller;
g_type_ensure (NAUTILUS_TYPE_TOOLBAR);
gtk_widget_init_template (GTK_WIDGET (window));
@@ -2584,6 +2610,7 @@ nautilus_window_init (NautilusWindow *window)
g_object_set (window->places_sidebar,
"vexpand", TRUE,
"visible", TRUE,
+ "populate-all", TRUE,
"show-other-locations", TRUE,
"show-starred-location", TRUE,
NULL);
@@ -2600,9 +2627,9 @@ nautilus_window_init (NautilusWindow *window)
window,
G_CONNECT_SWAPPED);
- gtk_widget_set_parent (window->tab_menu, GTK_WIDGET (window));
- gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (window->tab_menu),
- G_MENU_MODEL (window->tab_menu_model));
+ gtk_popover_bind_model (GTK_POPOVER (window->tab_menu),
+ window->tab_menu_model,
+ NULL);
g_signal_connect (window, "notify::is-maximized",
G_CALLBACK (on_is_maximized_changed), NULL);
@@ -2624,30 +2651,41 @@ nautilus_window_init (NautilusWindow *window)
window->tab_data_queue = g_queue_new ();
- pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (window), NULL);
- gtk_pad_controller_set_action_entries (pad_controller,
+ window->pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
+ G_ACTION_GROUP (window),
+ NULL);
+ gtk_pad_controller_set_action_entries (window->pad_controller,
pad_actions, G_N_ELEMENTS (pad_actions));
- gtk_widget_add_controller (GTK_WIDGET (window),
- GTK_EVENT_CONTROLLER (pad_controller));
- controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
- gtk_widget_add_controller (GTK_WIDGET (window), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
- g_signal_connect (controller, "pressed",
- G_CALLBACK (on_click_gesture_pressed), NULL);
+ window->multi_press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (window));
+
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (window->multi_press_gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (window->multi_press_gesture), 0);
- controller = gtk_event_controller_key_new ();
- gtk_widget_add_controller (GTK_WIDGET (window), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
- g_signal_connect (controller, "key-pressed",
- G_CALLBACK (nautilus_window_key_capture), NULL);
+ g_signal_connect (window->multi_press_gesture, "pressed",
+ G_CALLBACK (on_multi_press_gesture_pressed), NULL);
- controller = gtk_event_controller_key_new ();
- gtk_widget_add_controller (GTK_WIDGET (window), controller);
- gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
- g_signal_connect (controller, "key-pressed",
- G_CALLBACK (nautilus_window_key_bubble), NULL);
+ window->notebook_multi_press_gesture = gtk_gesture_multi_press_new (window->notebook);
+
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (window->notebook_multi_press_gesture),
+ GTK_PHASE_CAPTURE);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (window->notebook_multi_press_gesture),
+ 0);
+
+ window->key_capture_controller = gtk_event_controller_key_new (GTK_WIDGET (window));
+ gtk_event_controller_set_propagation_phase (window->key_capture_controller,
+ GTK_PHASE_CAPTURE);
+ g_signal_connect (window->key_capture_controller,
+ "key-pressed", G_CALLBACK (nautilus_window_key_capture),
+ NULL);
+
+ window->key_bubble_controller = gtk_event_controller_key_new (GTK_WIDGET (window));
+ gtk_event_controller_set_propagation_phase (window->key_bubble_controller,
+ GTK_PHASE_BUBBLE);
+ g_signal_connect (window->key_bubble_controller,
+ "key-pressed", G_CALLBACK (nautilus_window_key_bubble),
+ NULL);
}
static void
@@ -2655,7 +2693,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
{
GObjectClass *oclass = G_OBJECT_CLASS (class);
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (class);
- GtkWindowClass *winclass = GTK_WINDOW_CLASS (class);
oclass->dispose = nautilus_window_dispose;
oclass->finalize = nautilus_window_finalize;
@@ -2663,10 +2700,9 @@ nautilus_window_class_init (NautilusWindowClass *class)
wclass->show = nautilus_window_show;
wclass->realize = nautilus_window_realize;
+ wclass->delete_event = nautilus_window_delete_event;
wclass->grab_focus = nautilus_window_grab_focus;
- winclass->close_request = nautilus_window_close_request;
-
gtk_widget_class_set_template_from_resource (wclass,
"/org/gnome/nautilus/ui/nautilus-window.ui");
gtk_widget_class_bind_template_child (wclass, NautilusWindow, toolbar);
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 72fc5d987..af38441f1 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -27,14 +27,14 @@
#pragma once
#include <gtk/gtk.h>
-#include <libadwaita-1/adwaita.h>
+#include <libhandy-1/handy.h>
#include "nautilus-types.h"
G_BEGIN_DECLS
#define NAUTILUS_TYPE_WINDOW (nautilus_window_get_type ())
-G_DECLARE_FINAL_TYPE (NautilusWindow, nautilus_window, NAUTILUS, WINDOW, AdwApplicationWindow);
+G_DECLARE_FINAL_TYPE (NautilusWindow, nautilus_window, NAUTILUS, WINDOW, HdyApplicationWindow);
typedef gboolean (* NautilusWindowGoToCallback) (NautilusWindow *window,
GFile *location,
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index fe4b61578..03fa0cade 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -30,10 +30,11 @@
#include "nautilus-icon-info.h"
#include "nautilus-file-utilities.h"
#include "nautilus-program-choosing.h"
+#include "nautilus-gtk4-helpers.h"
struct _NautilusXContentBar
{
- AdwBin parent_instance;
+ GtkBin parent_instance;
GtkWidget *label;
char **x_content_types;
@@ -78,7 +79,7 @@ content_bar_response_cb (GtkInfoBar *infobar,
if (default_app != NULL)
{
nautilus_launch_application_for_mount (default_app, bar->mount,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (bar))));
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (bar))));
g_object_unref (default_app);
}
}
@@ -181,7 +182,7 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar,
icon = g_app_info_get_icon (default_app);
if (icon != NULL)
{
- image = gtk_image_new_from_gicon (icon);
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_BUTTON);
}
else
{
@@ -189,7 +190,7 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar,
}
name = g_app_info_get_name (default_app);
- info_bar = adw_bin_get_child (ADW_BIN (bar));
+ info_bar = gtk_bin_get_child (GTK_BIN (bar));
button = gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), name, n);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
diff --git a/src/nautilus-x-content-bar.h b/src/nautilus-x-content-bar.h
index 11f05ec91..af7bcaefe 100644
--- a/src/nautilus-x-content-bar.h
+++ b/src/nautilus-x-content-bar.h
@@ -24,13 +24,12 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include <libadwaita-1/adwaita.h>
G_BEGIN_DECLS
#define NAUTILUS_TYPE_X_CONTENT_BAR (nautilus_x_content_bar_get_type ())
-G_DECLARE_FINAL_TYPE (NautilusXContentBar, nautilus_x_content_bar, NAUTILUS, X_CONTENT_BAR, AdwBin)
+G_DECLARE_FINAL_TYPE (NautilusXContentBar, nautilus_x_content_bar, NAUTILUS, X_CONTENT_BAR, GtkBin)
GtkWidget *nautilus_x_content_bar_new (GMount *mount,
const char * const *x_content_types);
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui
b/src/resources/ui/nautilus-batch-rename-dialog.ui
index fd373c676..b10248128 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
<menu id="add_tag_menu">
<section>
<attribute name="label" translatable="yes">Automatic Numbers</attribute>
@@ -92,21 +91,26 @@
</section>
</menu>
<template class="NautilusBatchRenameDialog" parent="GtkDialog">
+ <property name="resizable">True</property>
<property name="modal">True</property>
<property name="height-request">563</property>
+ <property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<signal name="response" handler="batch_rename_dialog_on_response"/>
<child type="action">
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="use_underline">True</property>
- <property name="focusable">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="rename_button">
<property name="label" translatable="yes">_Rename</property>
+ <property name="visible">True</property>
<property name="use_underline">True</property>
+ <property name="can_default">True</property>
<style>
<class name="suggested-action"/>
</style>
@@ -116,16 +120,19 @@
<action-widget response="ok" default="true">rename_button</action-widget>
<action-widget response="cancel">cancel_button</action-widget>
</action-widgets>
- <child internal-child="content_area">
- <object class="GtkBox" id="content_area">
+ <child internal-child="vbox">
+ <object class="GtkBox" id="vbox">
<child>
<object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="hexpand">True</property>
<child>
<object class="GtkBox">
+ <property name="orientation">horizontal</property>
<property name="spacing">15</property>
+ <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">center</property>
<property name="margin-top">20</property>
@@ -133,263 +140,304 @@
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<child>
- <object class="GtkCheckButton" id="format_mode_button">
+ <object class="GtkRadioButton" id="format_mode_button">
<property name="label" translatable="yes">Rename _using a template</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="batch_rename_dialog_mode_changed" swapped="yes" />
</object>
</child>
<child>
- <object class="GtkCheckButton" id="replace_mode_button">
+ <object class="GtkRadioButton" id="replace_mode_button">
<property name="label" translatable="yes">Find and replace _text</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="use_underline">True</property>
+ <property name="active">True</property>
<property name="group">format_mode_button</property>
- <signal name="toggled" handler="batch_rename_dialog_mode_changed" swapped="yes"/>
+ <signal name="toggled" handler="batch_rename_dialog_mode_changed" swapped="yes" />
</object>
</child>
- <layout>
- <property name="column">3</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkStack" id="mode_stack">
+ <property name="visible">True</property>
<property name="vhomogeneous">False</property>
<property name="hhomogeneous">True</property>
<property name="transition_type">crossfade</property>
<property name="transition_duration">100</property>
<child>
- <object class="GtkStackPage">
- <property name="name">format</property>
- <property name="title" translatable="yes" comments="Translators: This is a noun, not a
verb">Format</property>
- <property name="child">
- <object class="GtkGrid" id="format_stack_child">
- <property name="margin-start">40</property>
- <property name="margin-end">40</property>
- <property name="margin-bottom">10</property>
- <property name="row-spacing">15</property>
- <property name="column-spacing">6</property>
+ <object class="GtkGrid" id="format_stack_child">
+ <property name="visible">True</property>
+ <property name="margin-start">40</property>
+ <property name="margin-end">40</property>
+ <property name="margin-top">0</property>
+ <property name="margin-bottom">10</property>
+ <property name="row-spacing">15</property>
+ <property name="column-spacing">6</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="visible">True</property>
+ <property name="halign">center</property>
<child>
- <object class="GtkBox">
- <property name="halign">center</property>
+ <object class="GtkEntry" id="name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="width_request">400</property>
+ <property name="hexpand">True</property>
+ <property name="activates-default">True</property>
+ <signal name="activate" handler="file_names_widget_on_activate" swapped="yes" />
+ <signal name="insert-text" handler="on_insert_text" swapped="no" />
+ <signal name="delete-text" handler="on_delete_text" swapped="no" />
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="visible">True</property>
+ <property name="menu_model">add_tag_menu</property>
<child>
- <object class="GtkEntry" id="name_entry">
- <property name="focusable">True</property>
- <property name="width_request">400</property>
- <property name="hexpand">True</property>
- <property name="activates-default">True</property>
- <signal name="activate" handler="file_names_widget_on_activate"
swapped="yes"/>
- <signal name="insert-text" handler="on_insert_text" swapped="no"/>
- <signal name="delete-text" handler="on_delete_text" swapped="no"/>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">list-add-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Add</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ <property name="width">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="numbering_revealer">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkBox" id="numbering_box">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="numbering_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Automatic Numbering
Order</property>
</object>
</child>
<child>
<object class="GtkMenuButton">
- <property name="menu_model">add_tag_menu</property>
+ <property name="visible">True</property>
+ <property name="menu-model">numbering_order_menu</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">15</property>
<child>
- <object class="GtkImage">
- <property name="icon-name">list-add-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id="numbering_order_label">
+ <property name="visible">True</property>
+ <property name="width-request">180</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Add</property>
+ <property name="label" translatable="yes">Original Name
(Ascending)</property>
</object>
</child>
- </object>
- </child>
- </object>
- </child>
- <style>
- <class name="linked"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="column-span">5</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkRevealer" id="numbering_revealer">
- <property name="halign">center</property>
- <property name="child">
- <object class="GtkBox" id="numbering_box">
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel" id="numbering_label">
- <property name="label" translatable="yes">Automatic Numbering
Order</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton">
- <property name="menu-model">numbering_order_menu</property>
<child>
- <object class="GtkBox">
- <property name="spacing">15</property>
- <child>
- <object class="GtkLabel" id="numbering_order_label">
- <property name="width-request">180</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Original Name
(Ascending)</property>
- </object>
- </child>
- <child>
- <object class="GtkImage" id="action_icon">
- <property name="icon-name">pan-down-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
+ <object class="GtkImage" id="action_icon">
+ <property name="visible">True</property>
+ <property name="icon-name">pan-down-symbolic</property>
+ <property name="icon-size">1</property>
</object>
</child>
</object>
</child>
</object>
- </property>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- <property name="column-span">5</property>
- </layout>
+ </child>
</object>
</child>
</object>
- </property>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ <property name="width">5</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="name">format</property>
+ <property name="title" translatable="yes" comments="Translators: This is a noun, not a
verb">Format</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">replace</property>
- <property name="title" translatable="yes" context="title">Replace</property>
- <property name="child">
- <object class="GtkGrid" id="replace_stack_child">
- <property name="margin-start">40</property>
- <property name="margin-end">40</property>
- <property name="margin-bottom">10</property>
- <property name="hexpand">True</property>
- <property name="halign">center</property>
- <property name="row-spacing">15</property>
- <property name="column-spacing">6</property>
- <child>
- <object class="GtkLabel" id="existing_text_label">
- <property name="label" translatable="yes">Existing Text</property>
- <property name="sensitive">False</property>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkEntry" id="find_entry">
- <property name="focusable">True</property>
- <property name="width_request">375</property>
- <property name="activates-default">True</property>
- <signal name="changed" handler="file_names_widget_entry_on_changed"
swapped="yes"/>
- <signal name="activate" handler="file_names_widget_on_activate" swapped="yes"/>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- <property name="column-span">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="replace_label">
- <property name="label" translatable="yes">Replace With</property>
- <property name="sensitive">False</property>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkEntry" id="replace_entry">
- <property name="focusable">True</property>
- <property name="width_request">375</property>
- <signal name="changed" handler="file_names_widget_entry_on_changed"
swapped="yes"/>
- <signal name="activate" handler="file_names_widget_on_activate" swapped="yes"/>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- <property name="column-span">3</property>
- </layout>
- </object>
- </child>
+ <object class="GtkGrid" id="replace_stack_child">
+ <property name="visible">True</property>
+ <property name="margin-start">40</property>
+ <property name="margin-end">40</property>
+ <property name="margin-top">0</property>
+ <property name="margin-bottom">10</property>
+ <property name="hexpand">True</property>
+ <property name="halign">center</property>
+ <property name="row-spacing">15</property>
+ <property name="column-spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="existing_text_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Existing Text</property>
+ <property name="sensitive">False</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="find_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="width_request">375</property>
+ <property name="activates-default">True</property>
+ <signal name="changed" handler="file_names_widget_entry_on_changed" swapped="yes" />
+ <signal name="activate" handler="file_names_widget_on_activate" swapped="yes" />
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ <property name="width">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="replace_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Replace With</property>
+ <property name="sensitive">False</property>
</object>
- </property>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="replace_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="width_request">375</property>
+ <signal name="changed" handler="file_names_widget_entry_on_changed" swapped="yes" />
+ <signal name="activate" handler="file_names_widget_on_activate" swapped="yes" />
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ <property name="width">3</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="name">replace</property>
+ <property name="title" translatable="yes" context="title">Replace</property>
+ </packing>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- <property name="column-span">8</property>
- </layout>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ <property name="width">8</property>
+ </packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
+ <property name="visible">True</property>
<property name="hexpand">False</property>
<property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
<property name="max-content-height">250</property>
<property name="min-content-height">250</property>
<property name="max-content-width">600</property>
<property name="min-content-width">600</property>
- <property name="child">
+ <child>
<object class="GtkViewport">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkBox" id="a_box">
+ <property name="visible">True</property>
<child>
<object class="GtkListBox" id="original_name_listbox">
+ <property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_NONE</property>
</object>
</child>
<child>
<object class="GtkListBox" id="arrow_listbox">
+ <property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_NONE</property>
</object>
</child>
<child>
<object class="GtkListBox" id="result_listbox">
+ <property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_NONE</property>
</object>
</child>
</object>
- </property>
+ </child>
</object>
- </property>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- <property name="column-span">8</property>
- </layout>
+ </child>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
+ <property name="width">8</property>
+ </packing>
</child>
<child>
<object class="GtkBox" id="conflict_box">
+ <property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="visible">False</property>
<property name="margin-start">6</property>
<child>
<object class="GtkLabel" id="conflict_label">
+ <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="visible">True</property>
<child>
<object class="GtkButton" id="conflict_down">
- <signal name="clicked" handler="select_next_conflict_down" swapped="yes"/>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="select_next_conflict_down" swapped="yes" />
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon-name">go-down-symbolic</property>
<property name="icon-size">1</property>
</object>
@@ -401,9 +449,11 @@
</child>
<child>
<object class="GtkButton" id="conflict_up">
- <signal name="clicked" handler="select_next_conflict_up" swapped="yes"/>
+ <property name="visible">True</property>
+ <signal name="clicked" handler="select_next_conflict_up" swapped="yes" />
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon-name">go-up-symbolic</property>
<property name="icon-size">1</property>
</object>
@@ -414,13 +464,16 @@
</object>
</child>
</object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- <property name="column-span">8</property>
- </layout>
</object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
+ <property name="width">8</property>
+ </packing>
</child>
</object>
</child>
@@ -428,6 +481,7 @@
</child>
</template>
<object class="GtkImage" id="done_image">
+ <property name="visible">True</property>
<property name="icon_name">object-select-symbolic</property>
</object>
</interface>
diff --git a/src/resources/ui/nautilus-column-chooser.ui b/src/resources/ui/nautilus-column-chooser.ui
index da545224d..82eb3c22e 100644
--- a/src/resources/ui/nautilus-column-chooser.ui
+++ b/src/resources/ui/nautilus-column-chooser.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="store">
<columns>
<!-- column-name COLUMN_VISIBLE -->
@@ -14,12 +15,16 @@
</columns>
</object>
<template class="NautilusColumnChooser" parent="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkTreeView" id="view">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
<property name="vexpand">True</property>
<property name="model">store</property>
<property name="headers-visible">False</property>
@@ -55,7 +60,7 @@
</object>
</child>
</object>
- </property>
+ </child>
<style>
<class name="frame"/>
</style>
@@ -63,15 +68,19 @@
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<child>
<object class="GtkButton" id="move_up_button">
+ <property name="visible">True</property>
<property name="sensitive">False</property>
- <property name="focusable">True</property>
+ <property name="can-focus">True</property>
<signal name="clicked" handler="move_up_clicked_callback" swapped="no"/>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon-name">go-up-symbolic</property>
</object>
</child>
@@ -79,11 +88,13 @@
</child>
<child>
<object class="GtkButton" id="move_down_button">
+ <property name="visible">True</property>
<property name="sensitive">False</property>
- <property name="focusable">True</property>
+ <property name="can-focus">True</property>
<signal name="clicked" handler="move_down_clicked_callback" swapped="no"/>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon-name">go-down-symbolic</property>
</object>
</child>
@@ -96,10 +107,12 @@
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<child>
<object class="GtkButton" id="use_default_button">
<property name="label" translatable="yes">Reset to De_fault</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Replace the current List Columns settings
with the default settings</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="use_default_clicked_callback" swapped="no"/>
diff --git a/src/resources/ui/nautilus-compress-dialog.ui b/src/resources/ui/nautilus-compress-dialog.ui
index ce2e6760c..050a1360c 100644
--- a/src/resources/ui/nautilus-compress-dialog.ui
+++ b/src/resources/ui/nautilus-compress-dialog.ui
@@ -1,22 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.14"/>
<object class="GtkPopover" id="extension_popover">
+ <property name="position">bottom</property>
+ <property name="constrain-to">none</property>
<child>
- <object class="AdwPreferencesGroup">
+ <object class="HdyPreferencesGroup">
<property name="visible">True</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
- <object class="AdwActionRow" id="zip_row">
+ <object class="HdyActionRow" id="zip_row">
<property name="visible">True</property>
<property name="activatable">True</property>
<property name="title" translatable="no">.zip</property>
<property name="subtitle" translatable="yes">Compatible with all operating systems.</property>
<child>
<object class="GtkImage" id="zip_checkmark">
+ <property name="visible">True</property>
<property name="width-request">16</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
@@ -25,7 +28,7 @@
</object>
</child>
<child>
- <object class="AdwActionRow" id="encrypted_zip_row">
+ <object class="HdyActionRow" id="encrypted_zip_row">
<property name="visible">True</property>
<property name="activatable">True</property>
<property name="title" translatable="no">.zip</property>
@@ -35,6 +38,7 @@
</style>
<child>
<object class="GtkImage" id="encrypted_zip_checkmark">
+ <property name="visible">True</property>
<property name="width-request">16</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
@@ -43,13 +47,14 @@
</object>
</child>
<child>
- <object class="AdwActionRow" id="tar_xz_row">
+ <object class="HdyActionRow" id="tar_xz_row">
<property name="visible">True</property>
<property name="activatable">True</property>
<property name="title" translatable="no">.tar.xz</property>
<property name="subtitle" translatable="yes">Smaller archives but Linux and Mac only.</property>
<child>
<object class="GtkImage" id="tar_xz_checkmark">
+ <property name="visible">True</property>
<property name="width-request">16</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
@@ -58,13 +63,14 @@
</object>
</child>
<child>
- <object class="AdwActionRow" id="seven_zip_row">
+ <object class="HdyActionRow" id="seven_zip_row">
<property name="visible">True</property>
<property name="activatable">True</property>
<property name="title" translatable="no">.7z</property>
<property name="subtitle" translatable="yes">Smaller archives but must be installed on Windows
and Mac.</property>
<child>
<object class="GtkImage" id="seven_zip_checkmark">
+ <property name="visible">True</property>
<property name="width-request">16</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
@@ -79,12 +85,14 @@
<property name="title" translatable="yes">Create Archive</property>
<property name="resizable">False</property>
<property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
<property name="use-header-bar">1</property>
<property name="default-width">500</property>
<property name="default-height">210</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="content_area">
+ <child internal-child="vbox">
+ <object class="GtkBox" id="vbox">
<property name="orientation">vertical</property>
<property name="margin-top">30</property>
<property name="margin-bottom">30</property>
@@ -96,18 +104,21 @@
<child>
<object class="GtkLabel" id="name_label">
<property name="label" translatable="yes">Archive name</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkBox">
+ <property name="orientation">horizontal</property>
<property name="spacing">12</property>
<child>
<object class="GtkEntry" id="name_entry">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width-chars">30</property>
</object>
@@ -117,6 +128,7 @@
<property name="popover">extension_popover</property>
<child>
<object class="GtkBox">
+ <property name="orientation">horizontal</property>
<property name="spacing">6</property>
<child>
<object class="GtkStack" id="extension_stack">
@@ -163,18 +175,18 @@
</child>
<child>
<object class="GtkRevealer" id="error_revealer">
- <property name="child">
+ <child>
<object class="GtkLabel" id="error_label">
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
</object>
- </property>
+ </child>
</object>
</child>
<child>
<object class="GtkLabel" id="passphrase_label">
- <property name="visible">False</property>
<property name="label" translatable="yes">Password</property>
<property name="margin-top">6</property>
<property name="xalign">0</property>
@@ -182,7 +194,6 @@
</child>
<child>
<object class="GtkEntry" id="passphrase_entry">
- <property name="visible">False</property>
<property name="placeholder-text" translatable="yes">Enter a password here.</property>
<property name="input-purpose">password</property>
<property name="visibility">False</property>
@@ -194,14 +205,17 @@
<child type="action">
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">Cancel</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="activate_button">
<property name="label" translatable="yes">Create</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="sensitive">False</property>
</object>
diff --git a/src/resources/ui/nautilus-create-folder-dialog.ui
b/src/resources/ui/nautilus-create-folder-dialog.ui
index 91f27683c..1f53b7c5c 100644
--- a/src/resources/ui/nautilus-create-folder-dialog.ui
+++ b/src/resources/ui/nautilus-create-folder-dialog.ui
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.14"/>
<object class="GtkDialog" id="create_folder_dialog">
<property name="resizable">False</property>
<property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
<property name="use-header-bar">1</property>
<property name="width_request">450</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="content_area">
+ <child internal-child="vbox">
+ <object class="GtkBox" id="vbox">
<property name="orientation">vertical</property>
<property name="margin_top">18</property>
<property name="margin_bottom">12</property>
@@ -17,23 +19,26 @@
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="name_label">
+ <property name="visible">True</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkEntry" id="name_entry">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
</object>
</child>
<child>
<object class="GtkRevealer" id="error_revealer">
- <property name="child">
+ <child>
<object class="GtkLabel" id="error_label">
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
</object>
- </property>
+ </child>
</object>
</child>
</object>
@@ -41,13 +46,16 @@
<child type="action">
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">Cancel</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="ok_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="sensitive">False</property>
</object>
diff --git a/src/resources/ui/nautilus-file-conflict-dialog.ui
b/src/resources/ui/nautilus-file-conflict-dialog.ui
index cfbafb481..ded27ec72 100644
--- a/src/resources/ui/nautilus-file-conflict-dialog.ui
+++ b/src/resources/ui/nautilus-file-conflict-dialog.ui
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<template class="NautilusFileConflictDialog" parent="GtkDialog">
<property name="modal">True</property>
<property name="resizable">False</property>
- <child internal-child="content_area">
+ <child internal-child="vbox">
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
@@ -13,10 +14,12 @@
<property name="spacing">12</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="primary_label">
+ <property name="visible">True</property>
<property name="justify">center</property>
<property name="halign">center</property>
<property name="max-width-chars">50</property>
@@ -29,6 +32,7 @@
</child>
<child>
<object class="GtkLabel" id="secondary_label">
+ <property name="visible">True</property>
<property name="justify">center</property>
<property name="halign">center</property>
<property name="max-width-chars">50</property>
@@ -38,44 +42,58 @@
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="halign">start</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="dest_image"/>
+ <object class="GtkImage" id="dest_image">
+ <property name="visible">True</property>
+ </object>
</child>
<child>
- <object class="GtkLabel" id="dest_label"/>
+ <object class="GtkLabel" id="dest_label">
+ <property name="visible">True</property>
+ </object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="src_image"/>
+ <object class="GtkImage" id="src_image">
+ <property name="visible">True</property>
+ </object>
</child>
<child>
- <object class="GtkLabel" id="src_label"/>
+ <object class="GtkLabel" id="src_label">
+ <property name="visible">True</property>
+ </object>
</child>
</object>
</child>
<child>
<object class="GtkExpander" id="expander">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Select a new name for the
destination</property>
<property name="use-underline">True</property>
<signal name="notify::expanded" handler="on_expanded_notify"/>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin-top">6</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkEntry" id="entry">
+ <property name="visible">True</property>
<property name="activates-default">True</property>
<property name="hexpand">True</property>
<signal name="changed" handler="entry_text_changed_cb"/>
@@ -83,6 +101,7 @@
</child>
<child>
<object class="GtkButton">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Reset</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="reset_button_clicked_cb"/>
@@ -96,9 +115,11 @@
</child>
<child>
<object class="GtkCheckButton" id="checkbox">
+ <property name="visible">True</property>
<signal name="toggled" handler="checkbox_toggled_cb"/>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Apply this action to all files and
folders</property>
<property name="use-underline">True</property>
</object>
@@ -111,6 +132,7 @@
</child>
<child type="action">
<object class="GtkButton" id="cancel_button">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">True</property>
</object>
@@ -118,18 +140,22 @@
<child type="action">
<object class="GtkButton" id="rename_button">
<property name="visible">False</property>
+ <property name="can-default">True</property>
<property name="label" translatable="yes">Re_name</property>
<property name="use-underline">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="replace_button">
+ <property name="visible">True</property>
+ <property name="can-default">True</property>
<property name="label" translatable="yes">Re_place</property>
<property name="use-underline">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="skip_button">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Skip</property>
<property name="use-underline">True</property>
</object>
diff --git a/src/resources/ui/nautilus-file-properties-change-permissions.ui
b/src/resources/ui/nautilus-file-properties-change-permissions.ui
index 623b7db4a..fe9c21c29 100644
--- a/src/resources/ui/nautilus-file-properties-change-permissions.ui
+++ b/src/resources/ui/nautilus-file-properties-change-permissions.ui
@@ -1,24 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="change_permissions_dialog">
<property name="title" translatable="yes">Change Permissions for Enclosed Files</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
<property name="use-header-bar">1</property>
<child type="action">
<object class="GtkButton" id="cancel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use_underline">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="change">
+ <property name="visible">True</property>
<property name="label" translatable="yes">C_hange</property>
<property name="use_underline">True</property>
</object>
</child>
- <child internal-child="content_area">
+ <child internal-child="vbox">
<object class="GtkBox">
<property name="orientation">vertical</property>
<style>
@@ -26,6 +29,7 @@
</style>
<child>
<object class="GtkGrid" id="change_permissions_grid">
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
@@ -36,114 +40,125 @@
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Files</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Folders</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">2</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Owner</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="file_owner_combo">
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="folder_owner_combo">
- <layout>
- <property name="column">2</property>
- <property name="row">1</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Group</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="file_group_combo">
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="folder_group_combo">
- <layout>
- <property name="column">2</property>
- <property name="row">2</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="file_other_combo">
- <layout>
- <property name="column">1</property>
- <property name="row">3</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
<child>
<object class="GtkComboBox" id="folder_other_combo">
- <layout>
- <property name="column">2</property>
- <property name="row">3</property>
- </layout>
+ <property name="visible">True</property>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Others</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
</object>
</child>
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui
b/src/resources/ui/nautilus-files-view-context-menus.ui
index 299fd8f95..a951549ab 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<interface>
- <requires lib="gtk" version="4.0"/>
<menu id="background-menu">
<item>
<attribute name="label" translatable="yes">New _Folder</attribute>
@@ -32,7 +31,8 @@
<attribute name="action">view.select-all</attribute>
</item>
</section>
- <section id="background-extensions-section"/>
+ <section id="background-extensions-section">
+ </section>
<section>
<item>
<attribute name="label" translatable="yes">P_roperties</attribute>
@@ -42,7 +42,8 @@
</section>
</menu>
<menu id="selection-menu">
- <section id="new-folder-with-selection-section"/>
+ <section id="new-folder-with-selection-section">
+ </section>
<section id="open-with-application-section">
<item>
<attribute name="label" translatable="yes">Open With Other _Application</attribute>
@@ -54,7 +55,7 @@
<attribute name="label" translatable="yes">_Scripts</attribute>
<attribute name="action">view.scripts</attribute>
<attribute name="hidden-when">action-disabled</attribute>
- <section id="scripts-submenu-section"/>
+ <section id="scripts-submenu-section" />
<section>
<item>
<attribute name="label" translatable="yes">_Open Scripts Folder</attribute>
@@ -216,7 +217,8 @@
<attribute name="hidden-when">action-disabled</attribute>
</item>
</section>
- <section id="selection-extensions-section"/>
+ <section id="selection-extensions-section">
+ </section>
<section>
<item>
<attribute name="label" translatable="yes">Tags</attribute>
diff --git a/src/resources/ui/nautilus-files-view-select-items.ui
b/src/resources/ui/nautilus-files-view-select-items.ui
index c376cfdca..1d195b609 100644
--- a/src/resources/ui/nautilus-files-view-select-items.ui
+++ b/src/resources/ui/nautilus-files-view-select-items.ui
@@ -1,23 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="select_items_dialog">
<property name="title" translatable="yes">Select Items Matching</property>
<property name="modal">True</property>
<property name="use-header-bar">1</property>
<child type="action">
<object class="GtkButton" id="cancel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="select">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Select</property>
<property name="use-underline">True</property>
+ <property name="can-default">True</property>
</object>
</child>
- <child internal-child="content_area">
+ <child internal-child="vbox">
<object class="GtkBox">
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
@@ -26,22 +29,25 @@
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Pattern</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
+ <attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkEntry" id="pattern_entry">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="example">
+ <property name="visible">True</property>
<property name="halign">start</property>
</object>
</child>
diff --git a/src/resources/ui/nautilus-folder-is-empty.ui b/src/resources/ui/nautilus-folder-is-empty.ui
index 8417d823e..2ef07674d 100644
--- a/src/resources/ui/nautilus-folder-is-empty.ui
+++ b/src/resources/ui/nautilus-folder-is-empty.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkGrid" id="folder_is_empty">
<property name="halign">center</property>
<property name="valign">center</property>
@@ -10,29 +11,31 @@
<property name="visible">False</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="pixel_size">128</property>
<property name="icon_name">folder-symbolic</property>
<style>
<class name="dim-label"/>
<class name="nautilus-empty-state-icon"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Folder is Empty</property>
<style>
<class name="large-title"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
</object>
</interface>
diff --git a/src/resources/ui/nautilus-list-view-column-editor.ui
b/src/resources/ui/nautilus-list-view-column-editor.ui
index b71a55772..be24516da 100644
--- a/src/resources/ui/nautilus-list-view-column-editor.ui
+++ b/src/resources/ui/nautilus-list-view-column-editor.ui
@@ -1,18 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
<interface>
- <requires lib="gtk" version="4.0"/>
- <object class="AdwWindow" id="window">
+ <object class="HdyWindow" id="window">
<property name="modal">True</property>
+ <property name="type-hint">dialog</property>
<property name="default-width">300</property>
<property name="default-height">400</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="AdwHeaderBar"/>
+ <object class="HdyHeaderBar">
+ <property name="visible">True</property>
+ <property name="title" bind-source="window" bind-property="title" bind-flags="sync-create"/>
+ <property name="show-close-button">True</property>
+ </object>
</child>
<child>
<object class="GtkBox" id="box">
+ <property name="visible">True</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
@@ -22,6 +29,7 @@
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Choose the order of information to appear in this
folder:</property>
+ <property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="wrap">True</property>
diff --git a/src/resources/ui/nautilus-no-search-results.ui b/src/resources/ui/nautilus-no-search-results.ui
index d4242a163..e36904707 100644
--- a/src/resources/ui/nautilus-no-search-results.ui
+++ b/src/resources/ui/nautilus-no-search-results.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkGrid" id="no_search_results">
<property name="halign">center</property>
<property name="valign">center</property>
@@ -10,41 +11,44 @@
<property name="visible">False</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="pixel_size">80</property>
<property name="icon_name">edit-find-symbolic</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">No Results Found</property>
<attributes>
- <attribute name="weight" value="bold"></attribute>
- <attribute name="scale" value="1.44"></attribute>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.4399999999999999"/>
</attributes>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Try a different search</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<style>
<class name="dim-label"/>
diff --git a/src/resources/ui/nautilus-operations-ui-manager-request-passphrase.ui
b/src/resources/ui/nautilus-operations-ui-manager-request-passphrase.ui
index 8c87ed135..c66c9cd6c 100644
--- a/src/resources/ui/nautilus-operations-ui-manager-request-passphrase.ui
+++ b/src/resources/ui/nautilus-operations-ui-manager-request-passphrase.ui
@@ -1,25 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="request_passphrase_dialog">
<property name="title" translatable="yes">Password Required</property>
<property name="modal">True</property>
<property name="destroy-with-parent">True</property>
<property name="use-header-bar">1</property>
- <child internal-child="content_area">
+ <child internal-child="vbox">
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<child>
<object class="GtkLabel" id="label">
+ <property name="visible">True</property>
<property name="max-width-chars">60</property>
<property name="wrap">True</property>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
+ <property name="visible">True</property>
<property name="activates-default">True</property>
<property name="valign">end</property>
<property name="vexpand">True</property>
@@ -32,12 +35,15 @@
</child>
<child type="action">
<object class="GtkButton" id="cancel_button">
+ <property name="visible">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">True</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="extract_button">
+ <property name="visible">True</property>
+ <property name="can-default">True</property>
<property name="label" translatable="yes">Extract</property>
</object>
</child>
diff --git a/src/resources/ui/nautilus-pathbar-context-menu.ui
b/src/resources/ui/nautilus-pathbar-context-menu.ui
index 5abbcce61..462bb659b 100644
--- a/src/resources/ui/nautilus-pathbar-context-menu.ui
+++ b/src/resources/ui/nautilus-pathbar-context-menu.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk" version="4.0"/>
<menu id="button-menu">
<item>
<attribute name="label" translatable="yes">Open in New _Window</attribute>
diff --git a/src/resources/ui/nautilus-preferences-window.ui b/src/resources/ui/nautilus-preferences-window.ui
index baf53a569..04b04d2b9 100644
--- a/src/resources/ui/nautilus-preferences-window.ui
+++ b/src/resources/ui/nautilus-preferences-window.ui
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
- <object class="AdwPreferencesWindow" id="preferences_window">
+ <requires lib="gtk+" version="3.22"/>
+ <object class="HdyPreferencesWindow" id="preferences_window">
<property name="search_enabled">False</property>
<child>
- <object class="AdwPreferencesPage">
+ <object class="HdyPreferencesPage">
<property name="title" translatable="yes">General</property>
<property name="visible">True</property>
<child>
- <object class="AdwPreferencesGroup">
+ <object class="HdyPreferencesGroup">
<property name="title" translatable="yes">General</property>
<property name="visible">True</property>
<child>
- <object class="AdwActionRow">
+ <object class="HdyActionRow">
<property name="activatable_widget">sort_folders_first_switch</property>
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Sort _Folders Before Files</property>
@@ -22,12 +23,13 @@
<child>
<object class="GtkSwitch" id="sort_folders_first_switch">
<property name="valign">center</property>
+ <property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
- <object class="AdwActionRow">
+ <object class="HdyActionRow">
<property name="activatable_widget">use_tree_view_switch</property>
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">_Expandable Folders in List View</property>
@@ -37,12 +39,13 @@
<child>
<object class="GtkSwitch" id="use_tree_view_switch">
<property name="valign">center</property>
+ <property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
- <object class="AdwComboRow" id="open_action_row">
+ <object class="HdyComboRow" id="open_action_row">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Action to Open Items</property>
<property name="title_lines">0</property>
@@ -53,12 +56,12 @@
</object>
</child>
<child>
- <object class="AdwPreferencesGroup">
+ <object class="HdyPreferencesGroup">
<property name="title" translatable="yes">Optional Context Menu Actions</property>
<property name="description" translatable="yes">Show more actions in the menus. Keyboard
shortcuts can be used even if the actions are not shown.</property>
<property name="visible">True</property>
<child>
- <object class="AdwActionRow">
+ <object class="HdyActionRow">
<property name="activatable_widget">show_create_link_switch</property>
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Create _Link</property>
@@ -68,12 +71,13 @@
<child>
<object class="GtkSwitch" id="show_create_link_switch">
<property name="valign">center</property>
+ <property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
- <object class="AdwActionRow">
+ <object class="HdyActionRow">
<property name="activatable_widget">show_delete_permanently_switch</property>
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">_Delete Permanently</property>
@@ -83,6 +87,7 @@
<child>
<object class="GtkSwitch" id="show_delete_permanently_switch">
<property name="valign">center</property>
+ <property name="visible">True</property>
</object>
</child>
</object>
@@ -90,12 +95,12 @@
</object>
</child>
<child>
- <object class="AdwPreferencesGroup">
+ <object class="HdyPreferencesGroup">
<property name="title" translatable="yes">Performance</property>
<property name="description" translatable="yes">These features may cause slowdowns and excess
network usage, especially when browsing files outside this computer, such as on a remote server.</property>
<property name="visible">True</property>
<child>
- <object class="AdwComboRow" id="search_recursive_row">
+ <object class="HdyComboRow" id="search_recursive_row">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Search in Subfolders</property>
<property name="title_lines">0</property>
@@ -104,7 +109,7 @@
</object>
</child>
<child>
- <object class="AdwComboRow" id="thumbnails_row">
+ <object class="HdyComboRow" id="thumbnails_row">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Show Thumbnails</property>
<property name="title_lines">0</property>
@@ -113,7 +118,7 @@
</object>
</child>
<child>
- <object class="AdwComboRow" id="count_row">
+ <object class="HdyComboRow" id="count_row">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes">Count Number of Files in Folders</property>
<property name="title_lines">0</property>
@@ -124,12 +129,12 @@
</object>
</child>
<child>
- <object class="AdwPreferencesGroup">
+ <object class="HdyPreferencesGroup">
<property name="description" translatable="yes">Add information to be displayed beneath file and
folder names. More information will appear when zooming closer.</property>
<property name="title" translatable="yes">Icon View Captions</property>
<property name="visible">True</property>
<child>
- <object class="AdwComboRow" id="captions_0_comborow">
+ <object class="HdyComboRow" id="captions_0_comborow">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes" context="the n-th position of an icon caption"
comments="Translators: This is an ordinal number">First</property>
<property name="title_lines">0</property>
@@ -138,7 +143,7 @@
</object>
</child>
<child>
- <object class="AdwComboRow" id="captions_1_comborow">
+ <object class="HdyComboRow" id="captions_1_comborow">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes" context="the n-th position of an icon caption"
comments="Translators: This is an ordinal number">Second</property>
<property name="title_lines">0</property>
@@ -147,7 +152,7 @@
</object>
</child>
<child>
- <object class="AdwComboRow" id="captions_2_comborow">
+ <object class="HdyComboRow" id="captions_2_comborow">
<property name="subtitle_lines">0</property>
<property name="title" translatable="yes" context="the n-th position of an icon caption"
comments="Translators: This is an ordinal number">Third</property>
<property name="title_lines">0</property>
diff --git a/src/resources/ui/nautilus-progress-info-widget.ui
b/src/resources/ui/nautilus-progress-info-widget.ui
index 6d78a5fa3..064f57431 100644
--- a/src/resources/ui/nautilus-progress-info-widget.ui
+++ b/src/resources/ui/nautilus-progress-info-widget.ui
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="cancel_image">
+ <property name="visible">True</property>
<property name="icon_name">window-close-symbolic</property>
</object>
<template class="NautilusProgressInfoWidget" parent="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -12,34 +16,37 @@
<child>
<object class="GtkLabel" id="status">
<property name="width_request">300</property>
+ <property name="visible">True</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="label">status</property>
<property name="ellipsize">middle</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkProgressBar" id="progress_bar">
+ <property name="visible">True</property>
<property name="valign">center</property>
<property name="margin_start">2</property>
<property name="margin_bottom">4</property>
<property name="hexpand">True</property>
<property name="pulse_step">0.050000000000000003</property>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
<object class="GtkButton" id="button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="margin_start">20</property>
@@ -52,15 +59,16 @@
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- <property name="row-span">3</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="height">3</property>
+ </packing>
</child>
<child>
<object class="GtkLabel" id="details">
+ <property name="visible">True</property>
<property name="label">label</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
@@ -70,13 +78,13 @@
<class name="dim-label"/>
</style>
<attributes>
- <attribute name="font-features" value="tnum"></attribute>
+ <attribute name="font-features" value="tnum"/>
</attributes>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
</template>
</interface>
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index d53f40325..b546fdcfe 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -1,1192 +1,1183 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.36.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
- <template class="NautilusPropertiesWindow" parent="AdwWindow">
- <property name="focusable">False</property>
+ <requires lib="gtk+" version="3.20"/>
+ <template class="NautilusPropertiesWindow" parent="HdyWindow">
+ <property name="can_focus">False</property>
<property name="modal">True</property>
+ <property name="type_hint">dialog</property>
<child>
<object class="GtkBox" id="content_box">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="AdwHeaderBar"/>
+ <object class="HdyHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">True</property>
+ <property name="title" bind-source="NautilusPropertiesWindow" bind-property="title"
bind-flags="sync-create"/>
+ </object>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="hexpand">True</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="show_border">False</property>
<child>
- <object class="GtkNotebookPage">
- <property name="tab_expand">True</property>
- <property name="child">
- <object class="GtkBox" id="basic_box">
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
- <property name="margin-start">18</property>
- <property name="margin-end">18</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <object class="GtkBox" id="basic_box">
+ <property name="visible">True</property>
+ <property name="margin-top">18</property>
+ <property name="margin-bottom">18</property>
+ <property name="margin-start">18</property>
+ <property name="margin-end">18</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkStack" id="icon_stack">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
<child>
- <object class="GtkStack" id="icon_stack">
- <property name="halign">center</property>
- <property name="valign">start</property>
- <child>
- <object class="GtkStackPage">
- <property name="name">icon_image</property>
- <property name="child">
- <object class="GtkImage" id="icon_image">
- <property name="icon-name">image-missing</property>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">icon_button</property>
- <property name="child">
- <object class="GtkButton" id="icon_button">
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="icon_button_image">
- <property name="icon-name">image-missing</property>
- </object>
- </child>
- </object>
- </property>
- </object>
- </child>
+ <object class="GtkImage" id="icon_image">
+ <property name="visible">True</property>
+ <property name="icon-name">image-missing</property>
</object>
+ <packing>
+ <property name="name">icon_image</property>
+ </packing>
</child>
<child>
- <object class="GtkBox" id="grid_box">
- <property name="orientation">vertical</property>
+ <object class="GtkButton" id="icon_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
<child>
- <object class="GtkGrid" id="basic_grid">
- <property name="orientation">vertical</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="name_title_label">
- <property name="label" translatable="yes">_Name</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">name_field</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="name_stack">
- <child>
- <object class="GtkStackPage">
- <property name="name">name_value_label</property>
- <property name="child">
- <object class="GtkLabel" id="name_value_label">
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">name_value_entry</property>
- <property name="child">
- <object class="GtkEntry" id="name_field">
- <property name="focusable">True</property>
- </object>
- </property>
- </object>
- </child>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="type_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Type</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="type_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="link_target_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Link target</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="link_target_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="contents_title_label">
- <property name="visible">False</property>
- <property name="valign">start</property>
- <property name="label" translatable="yes">Contents</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="contents_value_label">
- <property name="visible">False</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkSpinner" id="contents_spinner">
- <property name="visible">False</property>
- <layout>
- <property name="column">2</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="size_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Size</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">4</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="size_value_label">
- <property name="visible">False</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">4</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="parent_folder_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Parent folder</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">6</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="parent_folder_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">6</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="created_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Created</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">11</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="created_value_label">
- <property name="visible">False</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">11</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="original_folder_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Original folder</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">12</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="original_folder_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">12</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="volume_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Volume</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">7</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="volume_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">7</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="trashed_on_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Trashed on</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">13</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="trashed_on_value_label">
- <property name="visible">False</property>
- <property name="hexpand">True</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">13</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="accessed_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Accessed</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">9</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="accessed_value_label">
- <property name="visible">False</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">9</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="modified_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Modified</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">10</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="modified_value_label">
- <property name="visible">False</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">10</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="free_space_title_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Free space</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">15</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="free_space_value_label">
- <property name="visible">False</property>
- <property name="selectable">True</property>
- <property name="max_width_chars">24</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">15</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="volume_widget_box">
- <property name="visible">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkGrid" id="volume_grid">
- <property name="hexpand">False</property>
- <property name="margin-top">5</property>
- <property name="margin-bottom">5</property>
- <property name="margin-start">5</property>
- <property name="margin-end">5</property>
- <property name="row_spacing">10</property>
- <property name="column_spacing">10</property>
- <child>
- <object class="GtkDrawingArea" id="pie_chart">
- <property name="width_request">200</property>
- <property name="height_request">200</property>
- <style>
- <class name="disk-space-display"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="row-span">5</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="spacer_label">
- <property name="vexpand">True</property>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkDrawingArea" id="used_color">
- <property name="width_request">20</property>
- <property name="height_request">20</property>
- <property name="halign">end</property>
- <style>
- <class name="disk-space-display"/>
- <class name="used"/>
- </style>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkDrawingArea" id="free_color">
- <property name="width_request">20</property>
- <property name="height_request">20</property>
- <property name="halign">end</property>
- <property name="vexpand">False</property>
- <style>
- <class name="disk-space-display"/>
- <class name="free"/>
- </style>
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="halign">end</property>
- <property name="label" translatable="yes">Total capacity</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">1</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="halign">end</property>
- <property name="label" translatable="yes">Filesystem type</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">1</property>
- <property name="row">4</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="total_capacity_value">
- <property name="halign">start</property>
- <property name="label">0</property>
- <layout>
- <property name="column">2</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="file_system_value">
- <property name="halign">start</property>
- <property name="label">0</property>
- <layout>
- <property name="column">2</property>
- <property name="row">4</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="used_value">
- <property name="halign">end</property>
- <property name="vexpand">False</property>
- <property name="label">0</property>
- <layout>
- <property name="column">2</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="free_value">
- <property name="halign">end</property>
- <property name="label">0</property>
- <layout>
- <property name="column">2</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Refers to the
capacity of the filesystem">used</property>
- <layout>
- <property name="column">3</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Refers to the
capacity of the filesystem">free</property>
- <layout>
- <property name="column">3</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- </object>
- </child>
- <layout>
- <property name="column">0</property>
- <property name="row">16</property>
- <property name="column-span">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="open_in_disks_button">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Open in Disks</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <layout>
- <property name="column">0</property>
- <property name="row">17</property>
- <property name="column-span">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="spacer_1">
- <property name="height_request">6</property>
- <property name="orientation">vertical</property>
- <layout>
- <property name="column">0</property>
- <property name="row">5</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="spacer_2">
- <property name="visible">False</property>
- <property name="height_request">6</property>
- <property name="orientation">vertical</property>
- <layout>
- <property name="column">0</property>
- <property name="row">8</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="spacer_3">
- <property name="visible">False</property>
- <property name="height_request">6</property>
- <property name="orientation">vertical</property>
- <layout>
- <property name="column">0</property>
- <property name="row">14</property>
- </layout>
- </object>
- </child>
+ <object class="GtkImage" id="icon_button_image">
+ <property name="visible">True</property>
+ <property name="icon-name">image-missing</property>
</object>
</child>
</object>
+ <packing>
+ <property name="name">icon_button</property>
+ </packing>
</child>
</object>
- </property>
- <property name="tab">
- <object class="GtkLabel" id="basic_label">
- <property name="label" translatable="yes">Basic</property>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkNotebookPage">
- <property name="tab_expand">True</property>
- <property name="child">
- <object class="GtkBox" id="permissions_box">
- <property name="visible">False</property>
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
- <property name="margin-start">18</property>
- <property name="margin-end">18</property>
+ </child>
+ <child>
+ <object class="GtkBox" id="grid_box">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="not_the_owner_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">You are not the owner, so you cannot
change these permissions.</property>
- <property name="justify">center</property>
- <property name="wrap">1</property>
- <property name="max_width_chars">40</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparator" id="bottom_prompt_seperator">
- <property name="visible">False</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="permission_indeterminable_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">The permissions of the selected file could
not be determined.</property>
- <property name="justify">center</property>
- <property name="wrap">1</property>
- <property name="max_width_chars">40</property>
- </object>
- </child>
- <child>
- <object class="GtkGrid" id="permissions_grid">
- <property name="visible">False</property>
- <property name="halign">center</property>
- <property name="vexpand">True</property>
+ <object class="GtkGrid" id="basic_grid">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkLabel" id="owner_label">
- <property name="label" translatable="yes">_Owner</property>
+ <object class="GtkLabel" id="name_title_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Name</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">owner_combo_box</property>
+ <property name="mnemonic_widget">name_field</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
- <object class="GtkStack" id="owner_value_stack">
+ <object class="GtkStack" id="name_stack">
+ <property name="visible">True</property>
<child>
- <object class="GtkStackPage">
- <property name="name">combo_box</property>
- <property name="title">page0</property>
- <property name="child">
- <object class="GtkComboBox" id="owner_combo_box">
- <property name="halign">start</property>
- </object>
- </property>
+ <object class="GtkLabel" id="name_value_label">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="name">name_value_label</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">label</property>
- <property name="title">page0</property>
- <property name="child">
- <object class="GtkLabel" id="owner_value_label">
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- </object>
- </property>
+ <object class="GtkEntry" id="name_field">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
</object>
+ <packing>
+ <property name="name">name_value_entry</property>
+ </packing>
</child>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="owner_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Access</property>
+ <object class="GtkLabel" id="type_title_label">
+ <property name="label" translatable="yes">Type</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="owner_folder_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Folder access</property>
+ <object class="GtkLabel" id="type_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="link_target_title_label">
+ <property name="label" translatable="yes">Link target</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="link_target_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="owner_file_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">File access</property>
+ <object class="GtkLabel" id="contents_title_label">
+ <property name="valign">start</property>
+ <property name="label" translatable="yes">Contents</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkComboBox" id="owner_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="owner_folder_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- </layout>
+ <object class="GtkLabel" id="contents_value_label">
+ <property name="wrap">True</property>
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="owner_file_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">3</property>
- </layout>
+ <object class="GtkSpinner" id="contents_spinner">
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="group_label">
- <property name="margin_top">12</property>
- <property name="label" translatable="yes">_Group</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">group_combo_box</property>
+ <object class="GtkLabel" id="size_title_label">
+ <property name="label" translatable="yes">Size</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">5</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
</child>
<child>
- <object class="GtkStack" id="group_value_stack">
- <child>
- <object class="GtkStackPage">
- <property name="name">combo_box</property>
- <property name="title">page0</property>
- <property name="child">
- <object class="GtkComboBoxText" id="group_combo_box">
- <property name="halign">start</property>
- <property name="margin_top">12</property>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">label</property>
- <property name="title">page1</property>
- <property name="child">
- <object class="GtkLabel" id="group_value_label">
- <property name="margin_top">12</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- </object>
- </property>
- </object>
- </child>
- <layout>
- <property name="column">1</property>
- <property name="row">5</property>
- </layout>
+ <object class="GtkLabel" id="size_value_label">
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="group_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Access</property>
+ <object class="GtkLabel" id="parent_folder_title_label">
+ <property name="label" translatable="yes">Parent folder</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">6</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="group_folder_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Folder access</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">7</property>
- </layout>
+ <object class="GtkLabel" id="parent_folder_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="group_file_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">File access</property>
+ <object class="GtkLabel" id="created_title_label">
+ <property name="label" translatable="yes">Created</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">8</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkComboBox" id="group_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">6</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkComboBox" id="group_folder_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">7</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="group_file_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">8</property>
- </layout>
+ <object class="GtkLabel" id="created_value_label">
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">11</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="others_label">
- <property name="margin_top">12</property>
- <property name="label" translatable="yes">Others</property>
+ <object class="GtkLabel" id="original_folder_title_label">
+ <property name="label" translatable="yes">Original folder</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">10</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">12</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="others_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Access</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">11</property>
- </layout>
+ <object class="GtkLabel" id="original_folder_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">12</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="others_folder_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Folder access</property>
+ <object class="GtkLabel" id="volume_title_label">
+ <property name="label" translatable="yes">Volume</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">12</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="volume_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="others_file_access_label">
- <property name="visible">False</property>
- <property name="label" translatable="yes">File access</property>
+ <object class="GtkLabel" id="trashed_on_title_label">
+ <property name="label" translatable="yes">Trashed on</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">13</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">13</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="others_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">11</property>
- </layout>
+ <object class="GtkLabel" id="trashed_on_value_label">
+ <property name="hexpand">True</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">13</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="others_folder_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">12</property>
- </layout>
+ <object class="GtkLabel" id="accessed_title_label">
+ <property name="label" translatable="yes">Accessed</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">9</property>
+ </packing>
</child>
<child>
- <object class="GtkComboBox" id="others_file_access_combo">
- <property name="visible">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">13</property>
- </layout>
+ <object class="GtkLabel" id="accessed_value_label">
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">9</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="execute_label">
- <property name="visible">False</property>
- <property name="margin_top">12</property>
- <property name="label" translatable="yes">Execute</property>
+ <object class="GtkLabel" id="modified_title_label">
+ <property name="label" translatable="yes">Modified</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">15</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">10</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="security_context_title_label">
- <property name="visible">False</property>
- <property name="margin_top">12</property>
- <property name="label" translatable="yes">Security context</property>
+ <object class="GtkLabel" id="modified_value_label">
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="free_space_title_label">
+ <property name="label" translatable="yes">Free space</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">17</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">15</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel" id="security_context_value_label">
- <property name="visible">False</property>
- <property name="margin_top">12</property>
+ <object class="GtkLabel" id="free_space_value_label">
<property name="selectable">True</property>
<property name="max_width_chars">24</property>
<property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">17</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">15</property>
+ </packing>
</child>
<child>
- <object class="GtkBox" id="change_permissions_button_box">
- <property name="visible">False</property>
- <property name="margin_top">12</property>
+ <object class="GtkBox" id="volume_widget_box">
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="change_permissions_button">
- <property name="label" translatable="yes">Change Permissions for Enclosed
Files…</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
+ <object class="GtkGrid" id="volume_grid">
+ <property name="visible">True</property>
+ <property name="hexpand">False</property>
+ <property name="margin-top">5</property>
+ <property name="margin-bottom">5</property>
+ <property name="margin-start">5</property>
+ <property name="margin-end">5</property>
+ <property name="row_spacing">10</property>
+ <property name="column_spacing">10</property>
+ <child>
+ <object class="GtkDrawingArea" id="pie_chart">
+ <property name="width_request">200</property>
+ <property name="height_request">200</property>
+ <property name="visible">True</property>
+ <style>
+ <class name="disk-space-display"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="height">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="spacer_label">
+ <property name="visible">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkDrawingArea" id="used_color">
+ <property name="width_request">20</property>
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <style>
+ <class name="disk-space-display"/>
+ <class name="used"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkDrawingArea" id="free_color">
+ <property name="width_request">20</property>
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="vexpand">False</property>
+ <style>
+ <class name="disk-space-display"/>
+ <class name="free"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">Total capacity</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">Filesystem type</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="total_capacity_value">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="label">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="file_system_value">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="label">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="used_value">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="vexpand">False</property>
+ <property name="label">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="free_value">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Refers to the
capacity of the filesystem">used</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Refers to the
capacity of the filesystem">free</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
</object>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">19</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">16</property>
+ <property name="width">3</property>
+ </packing>
</child>
<child>
- <object class="GtkCheckButton" id="execute_checkbox">
- <property name="visible">False</property>
- <property name="label" translatable="yes">Allow _executing file as
program</property>
- <property name="use_underline">True</property>
- <property name="focusable">True</property>
- <property name="margin_top">12</property>
- <layout>
- <property name="column">1</property>
- <property name="row">15</property>
- </layout>
+ <object class="GtkButton" id="open_in_disks_button">
+ <property name="label" translatable="yes">Open in Disks</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">17</property>
+ <property name="width">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="spacer_1">
+ <property name="height_request">6</property>
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="spacer_2">
+ <property name="height_request">6</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="spacer_3">
+ <property name="height_request">6</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">14</property>
+ </packing>
</child>
</object>
</child>
</object>
- </property>
- <property name="tab">
- <object class="GtkLabel" id="permissions_label">
- <property name="label" translatable="yes">Permissions</property>
- </object>
- </property>
+ </child>
+ </object>
+ <packing>
+ <property name="tab_expand">True</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="basic_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Basic</property>
</object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
</child>
<child>
- <object class="GtkNotebookPage">
- <property name="tab_expand">True</property>
- <property name="child">
- <object class="GtkBox" id="open_with_box">
- <property name="visible">False</property>
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
- <property name="margin-start">18</property>
- <property name="margin-end">18</property>
+ <object class="GtkBox" id="permissions_box">
+ <property name="margin-top">18</property>
+ <property name="margin-bottom">18</property>
+ <property name="margin-start">18</property>
+ <property name="margin-end">18</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="not_the_owner_label">
+ <property name="label" translatable="yes">You are not the owner, so you cannot change
these permissions.</property>
+ <property name="justify">center</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">40</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="bottom_prompt_seperator">
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="permission_indeterminable_label">
+ <property name="label" translatable="yes">The permissions of the selected file could not
be determined.</property>
+ <property name="justify">center</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">40</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkGrid" id="permissions_grid">
+ <property name="halign">center</property>
+ <property name="vexpand">True</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="open_with_label">
- <property name="wrap">1</property>
- <property name="wrap_mode">word-char</property>
- <property name="max_width_chars">30</property>
- <property name="xalign">0</property>
- </object>
- </child>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
<child>
- <object class="GtkBox" id="app_chooser_widget_box">
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
+ <object class="GtkLabel" id="owner_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Owner</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">owner_combo_box</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
- <object class="GtkBox">
- <property name="spacing">6</property>
+ <object class="GtkStack" id="owner_value_stack">
+ <property name="visible">True</property>
<child>
- <object class="GtkButton" id="reset_button">
- <property name="label" translatable="yes">Reset</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="hexpand">True</property>
+ <object class="GtkComboBox" id="owner_combo_box">
+ <property name="visible">True</property>
<property name="halign">start</property>
</object>
+ <packing>
+ <property name="name">combo_box</property>
+ <property name="title">page0</property>
+ </packing>
</child>
<child>
- <object class="GtkButton" id="forget_button">
- <property name="label" translatable="yes">_Forget</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <object class="GtkLabel" id="owner_value_label">
+ <property name="visible">True</property>
+ <property name="selectable">True</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="name">label</property>
+ <property name="title">page0</property>
+ </packing>
</child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="owner_access_label">
+ <property name="label" translatable="yes">Access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="owner_folder_access_label">
+ <property name="label" translatable="yes">Folder access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="owner_file_access_label">
+ <property name="label" translatable="yes">File access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="owner_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="owner_folder_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="owner_file_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="group_label">
+ <property name="visible">True</property>
+ <property name="margin_top">12</property>
+ <property name="label" translatable="yes">_Group</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">group_combo_box</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStack" id="group_value_stack">
+ <property name="visible">True</property>
<child>
- <object class="GtkButton" id="add_button">
- <property name="label" translatable="yes">_Add</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <object class="GtkComboBoxText" id="group_combo_box">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="margin_top">12</property>
</object>
+ <packing>
+ <property name="name">combo_box</property>
+ <property name="title">page0</property>
+ </packing>
</child>
<child>
- <object class="GtkButton" id="set_as_default_button">
- <property name="label" translatable="yes">Set as default</property>
- <property name="focusable">True</property>
+ <object class="GtkLabel" id="group_value_label">
+ <property name="visible">True</property>
+ <property name="margin_top">12</property>
+ <property name="selectable">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="name">label</property>
+ <property name="title">page1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="group_access_label">
+ <property name="label" translatable="yes">Access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="group_folder_access_label">
+ <property name="label" translatable="yes">Folder access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="group_file_access_label">
+ <property name="label" translatable="yes">File access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="group_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="group_folder_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="group_file_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="others_label">
+ <property name="visible">True</property>
+ <property name="margin_top">12</property>
+ <property name="label" translatable="yes">Others</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="others_access_label">
+ <property name="label" translatable="yes">Access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="others_folder_access_label">
+ <property name="label" translatable="yes">Folder access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="others_file_access_label">
+ <property name="label" translatable="yes">File access</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">13</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="others_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="others_folder_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="others_file_access_combo">
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">13</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="execute_label">
+ <property name="margin_top">12</property>
+ <property name="label" translatable="yes">Execute</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">15</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="security_context_title_label">
+ <property name="margin_top">12</property>
+ <property name="label" translatable="yes">Security context</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">17</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="security_context_value_label">
+ <property name="margin_top">12</property>
+ <property name="selectable">True</property>
+ <property name="max_width_chars">24</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">17</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="change_permissions_button_box">
+ <property name="margin_top">12</property>
+ <child>
+ <object class="GtkButton" id="change_permissions_button">
+ <property name="label" translatable="yes">Change Permissions for Enclosed
Files…</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">19</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="execute_checkbox">
+ <property name="label" translatable="yes">Allow _executing file as program</property>
+ <property name="use_underline">True</property>
+ <property name="can_focus">True</property>
+ <property name="margin_top">12</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">15</property>
+ </packing>
</child>
</object>
- </property>
- <property name="tab">
- <object class="GtkLabel">
- <property name="label" translatable="yes">Open With</property>
+ </child>
+ </object>
+ <packing>
+ <property name="tab_expand">True</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="permissions_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Permissions</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="open_with_box">
+ <property name="margin-top">18</property>
+ <property name="margin-bottom">18</property>
+ <property name="margin-start">18</property>
+ <property name="margin-end">18</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="open_with_label">
+ <property name="visible">True</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">word-char</property>
+ <property name="max_width_chars">30</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="app_chooser_widget_box">
+ <property name="vexpand">True</property>
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
</object>
- </property>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="reset_button">
+ <property name="label" translatable="yes">Reset</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">start</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="forget_button">
+ <property name="label" translatable="yes">_Forget</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_button">
+ <property name="label" translatable="yes">_Add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="set_as_default_button">
+ <property name="label" translatable="yes">Set as default</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="tab_expand">True</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Open With</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child type="tab">
</child>
</object>
</child>
diff --git a/src/resources/ui/nautilus-rename-file-popover.ui
b/src/resources/ui/nautilus-rename-file-popover.ui
index 766433a2c..253d2fed2 100644
--- a/src/resources/ui/nautilus-rename-file-popover.ui
+++ b/src/resources/ui/nautilus-rename-file-popover.ui
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkPopover" id="rename_file_popover">
- <property name="child">
+ <property name="position">bottom</property>
+ <child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-top">18</property>
@@ -11,6 +14,7 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
<property name="margin-bottom">12</property>
<style>
<class name="title-2"/>
@@ -19,27 +23,32 @@
</child>
<child>
<object class="GtkEntry" id="name_entry">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkRevealer" id="error_revealer">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkLabel" id="error_label">
+ <property name="visible">True</property>
<property name="margin-bottom">12</property>
<property name="max-width-chars">0</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
</object>
- </property>
+ </child>
</object>
</child>
<child>
<object class="GtkButton" id="rename_button">
<property name="label" translatable="yes">_Rename</property>
+ <property name="visible">True</property>
<property name="sensitive">False</property>
- <property name="focusable">True</property>
+ <property name="can-focus">True</property>
<property name="halign">end</property>
<property name="use-underline">True</property>
<style>
@@ -48,6 +57,6 @@
</object>
</child>
</object>
- </property>
+ </child>
</object>
</interface>
diff --git a/src/resources/ui/nautilus-search-popover.ui b/src/resources/ui/nautilus-search-popover.ui
index 9efaac63e..3ec0da3cf 100644
--- a/src/resources/ui/nautilus-search-popover.ui
+++ b/src/resources/ui/nautilus-search-popover.ui
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.16"/>
<template class="NautilusSearchPopover" parent="GtkPopover">
- <property name="child">
- <object class="GtkGrid">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <child>
+ <object class="GtkGrid" >
+ <property name="visible">True</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="margin-start">20</property>
@@ -12,272 +15,296 @@
<property name="column_spacing">18</property>
<child>
<object class="GtkLabel" id="when_dim_label">
+ <property name="visible">True</property>
<property name="label" translatable="yes">When</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkStack" id="date_stack">
+ <property name="visible">True</property>
<property name="transition_type">crossfade</property>
<property name="transition_duration">250</property>
<child>
- <object class="GtkStackPage">
- <property name="name">date-button</property>
- <property name="child">
- <object class="GtkBox">
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="select_date_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Select a date</property>
+ <property name="hexpand">True</property>
<child>
- <object class="GtkButton" id="select_date_button">
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Select a date</property>
- <property name="hexpand">True</property>
- <child>
- <object class="GtkLabel" id="select_date_button_label">
- <property name="label" translatable="yes">Select Dates…</property>
- <property name="xalign">0</property>
- </object>
- </child>
- <signal name="clicked" handler="select_date_button_clicked"
object="NautilusSearchPopover" swapped="no"/>
+ <object class="GtkLabel" id="select_date_button_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select Dates…</property>
+ <property name="xalign">0</property>
</object>
</child>
+ <signal name="clicked" handler="select_date_button_clicked"
object="NautilusSearchPopover" swapped="no" />
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="clear_date_button">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Clear the currently selected
date</property>
+ <signal name="clicked" handler="clear_date_button_clicked"
object="NautilusSearchPopover" swapped="no" />
<child>
- <object class="GtkButton" id="clear_date_button">
- <property name="visible">False</property>
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Clear the currently selected
date</property>
- <signal name="clicked" handler="clear_date_button_clicked"
object="NautilusSearchPopover" swapped="no"/>
- <child>
- <object class="GtkImage" id="clear_date_button_image">
- <property name="icon_name">edit-clear-symbolic</property>
- </object>
- </child>
+ <object class="GtkImage" id="clear_date_button_image">
+ <property name="visible">True</property>
+ <property name="icon_name">edit-clear-symbolic</property>
</object>
</child>
- <style>
- <class name="linked"/>
- </style>
</object>
- </property>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
</object>
+ <packing>
+ <property name="name">date-button</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">date-entry</property>
- <property name="child">
- <object class="GtkEntry" id="date_entry">
- <property name="focusable">True</property>
- <property name="secondary_icon_name">x-office-calendar-symbolic</property>
- <property name="secondary_icon_tooltip_text" translatable="yes">Show a calendar to
select the date</property>
- <signal name="icon-release" handler="toggle_calendar_icon_clicked"
object="NautilusSearchPopover" swapped="no"/>
- <signal name="activate" handler="date_entry_activate" object="NautilusSearchPopover"
swapped="no"/>
- </object>
- </property>
+ <object class="GtkEntry" id="date_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="secondary_icon_name">x-office-calendar-symbolic</property>
+ <property name="secondary_icon_tooltip_text" translatable="yes">Show a calendar to select
the date</property>
+ <signal name="icon-release" handler="toggle_calendar_icon_clicked"
object="NautilusSearchPopover" swapped="no" />
+ <signal name="activate" handler="date_entry_activate" object="NautilusSearchPopover"
swapped="no" />
</object>
+ <packing>
+ <property name="name">date-entry</property>
+ </packing>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkRevealer" id="around_revealer">
- <property name="child">
+ <property name="transition_type">slide-down</property>
+ <child>
<object class="GtkGrid">
+ <property name="visible">True</property>
<property name="row_spacing">8</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="around_dim_label">
+ <property name="visible">True</property>
<property name="margin_top">10</property>
<property name="label" translatable="yes">Since…</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkStack" id="around_stack">
+ <property name="visible">True</property>
<property name="vhomogeneous">False</property>
<property name="transition_type">crossfade</property>
<property name="transition_duration">250</property>
<child>
- <object class="GtkStackPage">
- <property name="name">date-list</property>
- <property name="child">
- <object class="GtkScrolledWindow">
- <property name="height_request">200</property>
- <property name="focusable">True</property>
- <property name="hexpand">True</property>
- <property name="child">
- <object class="GtkViewport">
- <property name="child">
- <object class="GtkListBox" id="dates_listbox">
- <property name="selection_mode">none</property>
- <signal name="row-activated" handler="dates_listbox_row_activated"
object="NautilusSearchPopover" swapped="no"/>
- </object>
- </property>
+ <object class="GtkScrolledWindow">
+ <property name="height_request">200</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkListBox" id="dates_listbox">
+ <property name="visible">True</property>
+ <property name="selection_mode">none</property>
+ <signal name="row-activated" handler="dates_listbox_row_activated"
object="NautilusSearchPopover" swapped="no" />
</object>
- </property>
+ </child>
</object>
- </property>
+ </child>
</object>
+ <packing>
+ <property name="name">date-list</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">date-calendar</property>
- <property name="child">
- <object class="GtkCalendar" id="calendar">
- <property name="focusable">True</property>
- <property name="valign">start</property>
- <property name="show_week_numbers">True</property>
- </object>
- </property>
+ <object class="GtkCalendar" id="calendar">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">start</property>
+ <property name="show_week_numbers">True</property>
</object>
+ <packing>
+ <property name="name">date-calendar</property>
+ </packing>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
- <object class="GtkCheckButton" id="last_modified_button">
+ <object class="GtkRadioButton" id="last_modified_button">
<property name="label" translatable="yes">Last _modified</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="use_underline">True</property>
<property name="active">True</property>
- <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover"
swapped="no"/>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover"
swapped="no" />
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
<child>
- <object class="GtkCheckButton" id="last_used_button">
+ <object class="GtkRadioButton" id="last_used_button">
<property name="label" translatable="yes">Last _used</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
<property name="group">last_modified_button</property>
- <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover"
swapped="no"/>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- </layout>
+ <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover"
swapped="no" />
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
</child>
- <child>
- <object class="GtkCheckButton" id="created_button">
- <property name="label" translatable="yes">Created</property>
- <property name="use-underline">True</property>
- <property name="group">last_modified_button</property>
- <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover"
swapped="no"/>
- <layout>
- <property name="column">0</property>
- <property name="row">4</property>
- </layout>
- </object>
+ <child>
+ <object class="GtkRadioButton" id="created_button">
+ <property name="label" translatable="yes">Created</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="use-underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw-indicator">True</property>
+ <property name="group">last_modified_button</property>
+ <signal name="toggled" handler="search_time_type_changed"
object="NautilusSearchPopover" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ </packing>
</child>
</object>
- </property>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- <property name="column-span">2</property>
- </layout>
+ </child>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkLabel" id="what_dim_label">
+ <property name="visible">True</property>
<property name="margin_top">10</property>
<property name="label" translatable="yes">What</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkStack" id="type_stack">
+ <property name="visible">True</property>
<property name="vhomogeneous">False</property>
<property name="transition_type">crossfade</property>
<property name="transition_duration">250</property>
<child>
- <object class="GtkStackPage">
- <property name="name">type-button</property>
- <property name="child">
- <object class="GtkButton" id="select_type_button">
- <property name="focusable">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Which file types will be
searched</property>
- <signal name="clicked" handler="select_type_button_clicked"
object="NautilusSearchPopover" swapped="no"/>
+ <object class="GtkButton" id="select_type_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Which file types will be searched</property>
+ <signal name="clicked" handler="select_type_button_clicked" object="NautilusSearchPopover"
swapped="no" />
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
<child>
- <object class="GtkBox">
- <child>
- <object class="GtkLabel" id="type_label">
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Anything</property>
- <property name="width_chars">30</property>
- <property name="xalign">0</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="icon_name">pan-down-symbolic</property>
- </object>
- </child>
+ <object class="GtkLabel" id="type_label">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Anything</property>
+ <property name="width_chars">30</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">pan-down-symbolic</property>
</object>
</child>
</object>
- </property>
+ </child>
</object>
+ <packing>
+ <property name="name">type-button</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">type-list</property>
- <property name="child">
- <object class="GtkScrolledWindow">
- <property name="height_request">250</property>
- <property name="focusable">True</property>
- <property name="child">
- <object class="GtkViewport">
- <property name="child">
- <object class="GtkListBox" id="type_listbox">
- <signal name="row-activated" handler="types_listbox_row_activated"
object="NautilusSearchPopover" swapped="no"/>
- </object>
- </property>
+ <object class="GtkScrolledWindow">
+ <property name="height_request">250</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkListBox" id="type_listbox">
+ <property name="visible">True</property>
+ <property name="selection_mode">single</property>
+ <signal name="row-activated" handler="types_listbox_row_activated"
object="NautilusSearchPopover" swapped="no" />
</object>
- </property>
+ </child>
</object>
- </property>
+ </child>
</object>
+ <packing>
+ <property name="name">type-list</property>
+ </packing>
</child>
- <layout>
- <property name="column">0</property>
- <property name="row">4</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkLabel" id="search_dim_label">
@@ -287,47 +314,54 @@
<style>
<class name="dim-label"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">5</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">2</property>
+ </packing>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
+ <property name="visible">True</property>
<child>
- <object class="GtkToggleButton" id="full_text_search_button">
+ <object class="GtkRadioButton" id="full_text_search_button">
<property name="label" translatable="yes">Full Text</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Search on the file content and
name</property>
<property name="hexpand">True</property>
<property name="active">True</property>
+ <property name="draw_indicator">False</property>
<signal name="toggled" handler="search_fts_mode_changed" object="NautilusSearchPopover"
swapped="no" />
</object>
</child>
<child>
- <object class="GtkToggleButton" id="filename_search_button">
+ <object class="GtkRadioButton" id="filename_search_button">
<property name="label" translatable="yes">File Name</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Search only on the file name</property>
<property name="hexpand">True</property>
+ <property name="draw_indicator">False</property>
<property name="group">full_text_search_button</property>
<property name="active">True</property>
- <signal name="toggled" handler="search_fts_mode_changed" object="NautilusSearchPopover"
swapped="no"/>
+ <signal name="toggled" handler="search_fts_mode_changed" object="NautilusSearchPopover"
swapped="no" />
</object>
</child>
<style>
<class name="linked"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">6</property>
- <property name="column-span">2</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">2</property>
+ </packing>
</child>
</object>
- </property>
+ </child>
</template>
<object class="GtkSizeGroup">
<property name="mode">vertical</property>
@@ -339,6 +373,7 @@
</widgets>
</object>
<object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
<widgets>
<widget name="search_dim_label"/>
<widget name="when_dim_label"/>
diff --git a/src/resources/ui/nautilus-starred-is-empty.ui b/src/resources/ui/nautilus-starred-is-empty.ui
index 8747fcbb3..b91ceb30c 100644
--- a/src/resources/ui/nautilus-starred-is-empty.ui
+++ b/src/resources/ui/nautilus-starred-is-empty.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkGrid" id="starred_is_empty">
<property name="halign">center</property>
<property name="valign">center</property>
@@ -10,29 +11,31 @@
<property name="visible">False</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="pixel_size">128</property>
<property name="icon_name">starred-symbolic</property>
<style>
<class name="dim-label"/>
<class name="nautilus-empty-state-icon"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Starred files will appear here</property>
<style>
<class name="large-title"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
</object>
</interface>
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index a951047cf..265aec606 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
<menu id="zoom_section">
<item>
<attribute name="label" translatable="yes">Zoom out</attribute>
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index e9a101029..4fd29b400 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -1,8 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
- <object class="GtkPopoverMenu" id="back_menu"/>
- <object class="GtkPopoverMenu" id="forward_menu"/>
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkPopover" id="back_menu">
+ <property name="position">bottom</property>
+ <property name="relative-to">back_button</property>
+ </object>
+ <object class="GtkPopover" id="forward_menu">
+ <property name="position">bottom</property>
+ <property name="relative-to">forward_button</property>
+ </object>
<menu id="view_menu">
<section>
<attribute name="display-hint">horizontal-buttons</attribute>
@@ -102,13 +109,16 @@
</section>
</menu>
<object class="GtkPopover" id="operations_popover">
- <property name="child">
+ <property name="can_focus">False</property>
+ <child>
<object class="GtkScrolledWindow">
+ <property name="visible">True</property>
<property name="hscrollbar_policy">never</property>
<property name="max_content_height">270</property>
<property name="propagate_natural_height">True</property>
- <property name="child">
+ <child>
<object class="GtkListBox" id="operations_list">
+ <property name="visible">True</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -119,66 +129,68 @@
<class name="operations-list"/>
</style>
</object>
- </property>
+ </child>
</object>
- </property>
+ </child>
<signal name="notify::visible" handler="on_operations_popover_notify_visible" object="NautilusToolbar"
swapped="yes"/>
</object>
- <template class="NautilusToolbar" parent="AdwBin">
+ <template class="NautilusToolbar" parent="GtkBin">
+ <property name="visible">True</property>
<child>
- <object class="AdwHeaderBar">
- <property name="focusable">False</property>
+ <object class="HdyHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">True</property>
<child type="title">
<object class="GtkBox" id="header_toolbar">
<property name="width_request">270</property>
+ <property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkStack" id="toolbar_switcher">
+ <property name="visible">True</property>
<property name="valign">center</property>
<property name="transition_type">crossfade</property>
<child>
- <object class="GtkStackPage">
- <property name="name">pathbar</property>
- <property name="child">
- <object class="GtkBox" id="path_bar_container">
- <property name="valign">center</property>
- </object>
- </property>
+ <object class="GtkBox" id="path_bar_container">
+ <property name="valign">center</property>
</object>
+ <packing>
+ <property name="name">pathbar</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">location</property>
- <property name="child">
- <object class="GtkBox" id="location_entry_container">
- <style>
- <class name="linked"/>
- </style>
- </object>
- </property>
+ <object class="GtkBox" id="location_entry_container">
+ <style>
+ <class name="linked"/>
+ </style>
</object>
+ <packing>
+ <property name="name">location</property>
+ </packing>
</child>
<child>
- <object class="GtkStackPage">
- <property name="name">search</property>
- <property name="child">
- <object class="GtkBox" id="search_container">
- <property name="orientation">vertical</property>
- </object>
- </property>
+ <object class="GtkBox" id="search_container">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
</object>
+ <packing>
+ <property name="name">search</property>
+ </packing>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="search_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Search</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action_name">slot.search-visible</property>
<child>
<object class="GtkImage" id="search_icon">
+ <property name="visible">True</property>
<property name="icon_name">edit-find-symbolic</property>
<property name="icon_size">1</property>
</object>
@@ -190,17 +202,20 @@
</child>
</object>
</child>
- <child type="start">
+ <child>
<object class="GtkBox" id="navigation_box">
+ <property name="visible">True</property>
<child>
<object class="GtkButton" id="back_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Go back</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action_name">win.back</property>
<child>
<object class="GtkImage" id="back_icon">
+ <property name="visible">True</property>
<property name="icon_name">go-previous-symbolic</property>
<property name="icon_size">1</property>
</object>
@@ -212,13 +227,15 @@
</child>
<child>
<object class="GtkButton" id="forward_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Go forward</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action_name">win.forward</property>
<child>
<object class="GtkImage" id="forward_icon">
+ <property name="visible">True</property>
<property name="icon_name">go-next-symbolic</property>
<property name="icon_size">1</property>
</object>
@@ -234,17 +251,19 @@
</style>
</object>
</child>
- <child type="end">
+ <child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin_start">72</property>
<child>
<object class="GtkRevealer" id="operations_revealer">
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="transition_type">slide-right</property>
- <property name="child">
+ <child>
<object class="GtkMenuButton" id="operations_button">
- <property name="focusable">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Show operations</property>
<property name="margin_end">6</property>
<property name="popover">operations_popover</property>
@@ -252,29 +271,34 @@
<object class="GtkDrawingArea" id="operations_icon">
<property name="width_request">16</property>
<property name="height_request">16</property>
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
+ <signal name="draw" handler="on_operations_icon_draw" object="NautilusToolbar"
swapped="no"/>
</object>
</child>
<style>
<class name="button"/>
</style>
</object>
- </property>
+ </child>
</object>
</child>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_end">6</property>
<child>
<object class="GtkButton" id="view_toggle_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Toggle view</property>
<property name="action_name">slot.files-view-mode-toggle</property>
<child>
<object class="GtkImage" id="view_toggle_icon">
+ <property name="visible">True</property>
<property name="icon_size">1</property>
</object>
</child>
@@ -285,13 +309,16 @@
</child>
<child>
<object class="GtkMenuButton" id="view_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes" comments="“View” is a noun">View
options</property>
<property name="halign">start</property>
+ <property name="action_name">win.view-menu</property>
<property name="menu-model">view_menu</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon_name">pan-down-symbolic</property>
</object>
</child>
@@ -307,12 +334,14 @@
</child>
<child>
<object class="GtkMenuButton" id="app_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="menu-model">app_menu</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon_name">open-menu-symbolic</property>
<property name="icon_size">1</property>
</object>
@@ -323,6 +352,9 @@
</object>
</child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
</object>
</child>
diff --git a/src/resources/ui/nautilus-trash-is-empty.ui b/src/resources/ui/nautilus-trash-is-empty.ui
index 1818fba55..bbc387aea 100644
--- a/src/resources/ui/nautilus-trash-is-empty.ui
+++ b/src/resources/ui/nautilus-trash-is-empty.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkGrid" id="trash_is_empty">
<property name="halign">center</property>
<property name="valign">center</property>
@@ -10,29 +11,31 @@
<property name="visible">False</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="pixel_size">128</property>
<property name="icon_name">user-trash-symbolic</property>
<style>
<class name="dim-label"/>
<class name="nautilus-empty-state-icon"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
<object class="GtkLabel">
+ <property name="visible">True</property>
<property name="label" translatable="yes">Trash is Empty</property>
<style>
<class name="large-title"/>
</style>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
</object>
</interface>
diff --git a/src/resources/ui/nautilus-view-icon-item-ui.ui b/src/resources/ui/nautilus-view-icon-item-ui.ui
index fa1fe25e1..6e6121f0b 100644
--- a/src/resources/ui/nautilus-view-icon-item-ui.ui
+++ b/src/resources/ui/nautilus-view-icon-item-ui.ui
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='UTF-8'?>
<interface>
- <requires lib="gtk" version="4.0"/>
+ <requires lib="gtk+" version="3.0"/>
<template class="NautilusViewIconItemUi" parent="GtkFlowBoxChild">
<property name="halign">center</property>
<property name="valign">start</property>
- <property name="child">
+ <child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">center</property>
@@ -42,7 +42,7 @@
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<attributes>
- <attribute name="insert-hyphens" value="false"></attribute>
+ <attribute name="insert-hyphens" value="false"/>
</attributes>
</object>
</child>
@@ -91,6 +91,6 @@
</object>
</child>
</object>
- </property>
+ </child>
</template>
</interface>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index cc033a153..2b905dbee 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk" version="4.0"/>
- <object class="GtkPopoverMenu" id="tab_menu"/>
+ <object class="GtkPopover" id="tab_menu">
+ <property name="position">bottom</property>
+ <property name="relative-to">notebook</property>
+ </object>
<menu id="tab_menu_model">
<section>
<item>
@@ -26,50 +28,58 @@
</item>
</section>
</menu>
- <template class="NautilusWindow" parent="AdwApplicationWindow">
+ <template class="NautilusWindow" parent="HdyApplicationWindow">
<property name="show-menubar">False</property>
<property name="title" translatable="yes">_Files</property>
<child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="NautilusToolbar" id="toolbar"/>
</child>
<child>
<object class="GtkPaned" id="content_paned">
- <property name="shrink-end-child">False</property>
- <property name="shrink-start-child">False</property>
- <property name="resize-start-child">False</property>
+ <property name="visible">True</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<child>
<object class="GtkBox" id="sidebar">
- <property name="visible">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
</object>
+ <packing>
+ <property name="resize">False</property>
+ <property name="shrink">False</property>
+ </packing>
</child>
<child>
<object class="GtkOverlay" id="main_view">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
<property name="show-tabs">False</property>
<property name="show-border">False</property>
</object>
- </property>
+ </child>
<child type="overlay">
<object class="GtkRevealer" id="in_app_notification_undo">
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="transition_duration">100</property>
- <property name="child">
+ <child>
<object class="GtkFrame">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin_start">12</property>
<property name="margin_end">4</property>
<child>
<object class="GtkLabel" id="in_app_notification_undo_label">
+ <property name="visible">True</property>
<property name="max_width_chars">50</property>
<property name="ellipsize">middle</property>
<property name="margin_end">30</property>
@@ -78,8 +88,10 @@
<child>
<object class="GtkButton" id="in_app_notification_undo_undo_button">
<property name="label" translatable="yes">Undo</property>
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
<property name="margin_end">6</property>
<style>
<class name="text-button"/>
@@ -88,11 +100,13 @@
</child>
<child>
<object class="GtkButton" id="in_app_notification_undo_close_button">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon_name">window-close-symbolic</property>
<property name="icon_size">2</property>
</object>
@@ -104,27 +118,31 @@
</object>
</child>
</object>
- </property>
+ </child>
<style>
<class name="app-notification"/>
</style>
</object>
- </property>
+ </child>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="notification_operation">
+ <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="transition_duration">100</property>
- <property name="child">
+ <child>
<object class="GtkFrame">
- <property name="child">
+ <property name="visible">True</property>
+ <child>
<object class="GtkBox">
+ <property name="visible">True</property>
<property name="margin_start">12</property>
<property name="margin_end">4</property>
<child>
<object class="GtkLabel" id="notification_operation_label">
+ <property name="visible">True</property>
<property name="max_width_chars">50</property>
<property name="ellipsize">middle</property>
<property name="margin_end">30</property>
@@ -132,8 +150,10 @@
</child>
<child>
<object class="GtkButton" id="notification_operation_open">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
<property name="margin_end">6</property>
<signal name="clicked" handler="on_notification_operation_open_clicked"
object="NautilusWindow" swapped="no"/>
<style>
@@ -143,12 +163,14 @@
</child>
<child>
<object class="GtkButton" id="notification_operation_close">
- <property name="focusable">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_notification_operation_close_clicked"
object="NautilusWindow" swapped="no"/>
<child>
<object class="GtkImage">
+ <property name="visible">True</property>
<property name="icon_name">window-close-symbolic</property>
<property name="icon_size">2</property>
</object>
@@ -160,15 +182,18 @@
</object>
</child>
</object>
- </property>
+ </child>
<style>
<class name="app-notification"/>
</style>
</object>
- </property>
+ </child>
</object>
</child>
</object>
+ <packing>
+ <property name="shrink">False</property>
+ </packing>
</child>
</object>
</child>
diff --git a/test/automated/display/test-nautilus-mime-actions-set.c
b/test/automated/display/test-nautilus-mime-actions-set.c
index 9d364b69c..11e9ddc0d 100644
--- a/test/automated/display/test-nautilus-mime-actions-set.c
+++ b/test/automated/display/test-nautilus-mime-actions-set.c
@@ -118,7 +118,7 @@ main (int argc,
NautilusFile *file;
NautilusFileAttributes attributes;
- gtk_init ();
+ gtk_init (&argc, &argv);
if (argc < 3)
{
diff --git a/test/automated/display/test-nautilus-mime-actions.c
b/test/automated/display/test-nautilus-mime-actions.c
index 052e9c719..a6818adbc 100644
--- a/test/automated/display/test-nautilus-mime-actions.c
+++ b/test/automated/display/test-nautilus-mime-actions.c
@@ -112,7 +112,7 @@ main (int argc,
NautilusFile *file;
NautilusFileAttributes attributes;
- gtk_init ();
+ gtk_init (&argc, &argv);
if (argc != 2)
{
diff --git a/test/interactive/test.c b/test/interactive/test.c
index 0f1662e02..34a5fa8c4 100644
--- a/test/interactive/test.c
+++ b/test/interactive/test.c
@@ -6,7 +6,7 @@ void
test_init (int *argc,
char ***argv)
{
- gtk_init ();
+ gtk_init (argc, argv);
eel_make_warnings_and_criticals_stop_in_debugger ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]