diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 89a26615f15e41f043fd1763171f27cf60c4c775..76ac83fea3aa37dcc351629ba6f3ab357cd24ab2 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -66,6 +66,7 @@
#include "nautilus-view.h"
#include "nautilus-window-slot.h"
#include "nautilus-window.h"
+#include "nautilus-gtk4-helpers.h"
typedef struct
{
@@ -240,8 +241,7 @@ menu_provider_init_callback (void)
}
NautilusWindow *
-nautilus_application_create_window (NautilusApplication *self,
- GdkScreen *screen)
+nautilus_application_create_window (NautilusApplication *self)
{
NautilusWindow *window;
gboolean maximized;
@@ -252,7 +252,7 @@ nautilus_application_create_window (NautilusApplication *self,
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (self), NULL);
nautilus_profile_start (NULL);
- window = nautilus_window_new (screen);
+ window = nautilus_window_new ();
maximized = g_settings_get_boolean
(nautilus_window_state, NAUTILUS_WINDOW_STATE_MAXIMIZED);
@@ -369,7 +369,7 @@ real_open_location_full (NautilusApplication *self,
GFile *old_location = NULL;
char *old_uri, *new_uri;
gboolean use_same;
- GdkScreen *screen;
+ GdkDisplay *display;
use_same = TRUE;
/* FIXME: We are having problems on getting the current focused window with
@@ -441,12 +441,13 @@ real_open_location_full (NautilusApplication *self,
}
else
{
- screen = active_window != NULL ?
- gtk_window_get_screen (GTK_WINDOW (active_window)) :
- gdk_screen_get_default ();
+ display = active_window != NULL ?
+ gtk_root_get_display (GTK_ROOT (active_window)) :
+ gdk_display_get_default ();
- target_window = nautilus_application_create_window (self, screen);
+ target_window = nautilus_application_create_window (self);
/* Whatever the caller says, the slot won't be the same */
+ gtk_window_set_display (GTK_WINDOW (target_window), display);
target_slot = NULL;
}
@@ -465,7 +466,7 @@ open_window (NautilusApplication *self,
NautilusWindow *window;
nautilus_profile_start (NULL);
- window = nautilus_application_create_window (self, gdk_screen_get_default ());
+ window = nautilus_application_create_window (self);
if (location != NULL)
{
@@ -506,7 +507,7 @@ nautilus_application_open_location (NautilusApplication *self,
if (!slot)
{
- window = nautilus_application_create_window (self, gdk_screen_get_default ());
+ window = nautilus_application_create_window (self);
}
else
{
@@ -1120,11 +1121,11 @@ theme_changed (GtkSettings *settings)
static GtkCssProvider *provider = NULL;
static GtkCssProvider *permanent_provider = NULL;
gchar *theme;
- GdkScreen *screen;
+ GdkDisplay *display;
GFile *file;
g_object_get (settings, "gtk-theme-name", &theme, NULL);
- screen = gdk_screen_get_default ();
+ display = gdk_display_get_default ();
/* CSS that themes can override */
if (g_str_equal (theme, "Adwaita") || g_str_equal (theme, "Adwaita-dark"))
@@ -1137,14 +1138,14 @@ theme_changed (GtkSettings *settings)
g_object_unref (file);
}
- gtk_style_context_add_provider_for_screen (screen,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_provider_for_display (display,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
else if (provider != NULL)
{
- gtk_style_context_remove_provider_for_screen (screen,
- GTK_STYLE_PROVIDER (provider));
+ gtk_style_context_remove_provider_for_display (display,
+ GTK_STYLE_PROVIDER (provider));
g_clear_object (&provider);
}
@@ -1158,9 +1159,9 @@ theme_changed (GtkSettings *settings)
* undefined and gtk happens to prefer the provider that got added last.
* Use a higher priority here to avoid this problem.
*/
- gtk_style_context_add_provider_for_screen (screen,
- GTK_STYLE_PROVIDER (permanent_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
+ gtk_style_context_add_provider_for_display (display,
+ GTK_STYLE_PROVIDER (permanent_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
g_object_unref (file);
}
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index cbef1231200b31a8e4a4331b14eae63a63431fd0..76d741a5014199fdad9f47f0d66b6c64004742dd 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -43,8 +43,7 @@ struct _NautilusApplicationClass {
NautilusApplication * nautilus_application_new (void);
-NautilusWindow * nautilus_application_create_window (NautilusApplication *application,
- GdkScreen *screen);
+NautilusWindow * nautilus_application_create_window (NautilusApplication *application);
void nautilus_application_set_accelerator (GApplication *app,
const gchar *action_name,
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index edf0a35fb2fc9353f24c72b7e4effb0f2f875420..0496be5b56ae99f0c8f9ffc91094e98da3b0fe32 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -156,10 +156,6 @@ out:
GTK_BUTTONS_OK,
_("Oops! There was a problem running this software."));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error_string);
- /* This is required because we don't show dialogs in the
- * window picker and if the window pops under another window
- * there is no way to get it back. */
- gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
g_signal_connect (dialog,
"response",
@@ -203,11 +199,6 @@ present_autorun_for_software_dialog (GMount *mount)
"%s",
_("If you don’t trust this location or aren’t sure, press Cancel."));
- /* This is required because we don't show dialogs in the
- * window picker and if the window pops under another window
- * there is no way to get it back. */
- gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
-
/* TODO: in a star trek future add support for verifying
* software on media (e.g. if it has a certificate, check it
* etc.)
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 746ac295679fc89697a0e92458c4b9957c4e9b73..7af3865aa602997b3e2eb5a546a7ce39dcf6c6e2 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1418,13 +1418,6 @@ do_run_simple_dialog (gpointer _data)
timestamp = nautilus_file_operations_dbus_data_get_timestamp (data->dbus_data);
- /* Assuming this is used for desktop implementations, we want the
- * dialog to be centered on the screen rather than the parent window,
- * which could extend to all monitors. This is the case for
- * gnome-flashback.
- */
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-
if (nautilus_file_operations_dbus_data_get_parent_handle (data->dbus_data) != NULL)
{
g_signal_connect (dialog, "realize", G_CALLBACK (dialog_realize_cb), data->dbus_data);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 0d7e012f4a330ec74708d303e35ec7896d5bbfa4..05c1bc090669ac446edf5f14683ddc27a1882cd5 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3134,7 +3134,7 @@ nautilus_files_view_grab_focus (GtkWidget *widget)
view = NAUTILUS_FILES_VIEW (widget);
priv = nautilus_files_view_get_instance_private (view);
- child = gtk_bin_get_child (GTK_BIN (priv->scrolled_window));
+ child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (priv->scrolled_window));
GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->grab_focus (widget);
@@ -5253,7 +5253,7 @@ run_script (GSimpleAction *action,
g_autofree gchar *old_working_dir = NULL;
g_autolist (NautilusFile) selection = NULL;
g_auto (GStrv) parameters = NULL;
- GdkScreen *screen;
+ GdkDisplay *display;
launch_parameters = (ScriptLaunchParameters *) user_data;
priv = nautilus_files_view_get_instance_private (launch_parameters->directory_view);
@@ -5270,12 +5270,12 @@ run_script (GSimpleAction *action,
parameters = get_file_names_as_parameter_array (selection, priv->model);
- screen = gtk_widget_get_screen (GTK_WIDGET (launch_parameters->directory_view));
+ display = gtk_widget_get_display (GTK_WIDGET (launch_parameters->directory_view));
DEBUG ("run_script, script_path=“%s” (omitting script parameters)",
local_file_path);
- nautilus_launch_application_from_command_array (screen, quoted_path, FALSE,
+ nautilus_launch_application_from_command_array (display, quoted_path, FALSE,
(const char * const *) parameters);
unset_script_environment_variables ();
@@ -6483,7 +6483,7 @@ action_run_in_terminal (GSimpleAction *action,
g_autofree char *executable_path = NULL;
g_autofree char *quoted_path = NULL;
GtkWindow *parent_window;
- GdkScreen *screen;
+ GdkDisplay *display;
g_assert (NAUTILUS_IS_FILES_VIEW (user_data));
@@ -6503,11 +6503,11 @@ action_run_in_terminal (GSimpleAction *action,
quoted_path = g_shell_quote (executable_path);
parent_window = nautilus_files_view_get_containing_window (view);
- screen = gtk_widget_get_screen (GTK_WIDGET (parent_window));
+ display = gtk_widget_get_display (GTK_WIDGET (parent_window));
DEBUG ("Launching in terminal %s", quoted_path);
- nautilus_launch_application_from_command (screen, quoted_path, TRUE, NULL);
+ nautilus_launch_application_from_command (display, quoted_path, TRUE, NULL);
g_chdir (old_working_dir);
}
@@ -8942,7 +8942,7 @@ nautilus_files_view_move_copy_items (NautilusFilesView *view,
{
char *command, *quoted_uri, *tmp;
const GList *l;
- GdkScreen *screen;
+ GdkDisplay *display;
/* Handle dropping onto a file-roller archiver file, instead of starting a move/copy */
@@ -8963,13 +8963,13 @@ nautilus_files_view_move_copy_items (NautilusFilesView *view,
g_free (quoted_uri);
}
- screen = gtk_widget_get_screen (GTK_WIDGET (view));
- if (screen == NULL)
+ display = gtk_widget_get_display (GTK_WIDGET (view));
+ if (display == NULL)
{
- screen = gdk_screen_get_default ();
+ display = gdk_display_get_default ();
}
- nautilus_launch_application_from_command (screen, command, FALSE, NULL);
+ nautilus_launch_application_from_command (display, command, FALSE, NULL);
g_free (command);
return;
@@ -9317,13 +9317,11 @@ on_parent_changed (GObject *object,
else
{
remove_update_context_menus_timeout_callback (view);
- /* Only remove the action group if it matchs the current view
- * action group. If not, we can remove an action group set by
- * a different view i.e. if the slot_active function is called
- * before this one
+ /* Only remove the action group if this is still the active view.
+ * Otherwise we might be removing an action group set by a different
+ * view i.e. if slot_active_changed() is called before this one.
*/
- if (gtk_widget_get_action_group (GTK_WIDGET (window), "view") ==
- priv->view_action_group)
+ if (priv->active)
{
gtk_widget_insert_action_group (GTK_WIDGET (nautilus_files_view_get_window (view)),
"view",
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index 10fa19773dd79b62f6cbdb6f8056a8ed5e912e85..88157a9658a46a4db8b2cf0b12261ab7ba89bcbd 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -327,97 +327,6 @@ on_parent_changed (GObject *object,
}
}
-static void
-get_padding_and_border (GtkWidget *widget,
- GtkBorder *border)
-{
- GtkStyleContext *context;
- GtkStateFlags state;
- GtkBorder tmp;
-
- context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
-
- gtk_style_context_get_padding (context, state, border);
- gtk_style_context_get_border (context, state, &tmp);
- border->top += tmp.top;
- border->right += tmp.right;
- border->bottom += tmp.bottom;
- border->left += tmp.left;
-}
-
-static void
-nautilus_floating_bar_get_preferred_width (GtkWidget *widget,
- gint *minimum_size,
- gint *natural_size)
-{
- GtkBorder border;
-
- get_padding_and_border (widget, &border);
-
- GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_width (widget,
- minimum_size,
- natural_size);
-
- *minimum_size += border.left + border.right;
- *natural_size += border.left + border.right;
-}
-
-static void
-nautilus_floating_bar_get_preferred_width_for_height (GtkWidget *widget,
- gint height,
- gint *minimum_size,
- gint *natural_size)
-{
- GtkBorder border;
-
- get_padding_and_border (widget, &border);
-
- GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_width_for_height (widget,
- height,
- minimum_size,
- natural_size);
-
- *minimum_size += border.left + border.right;
- *natural_size += border.left + border.right;
-}
-
-static void
-nautilus_floating_bar_get_preferred_height (GtkWidget *widget,
- gint *minimum_size,
- gint *natural_size)
-{
- GtkBorder border;
-
- get_padding_and_border (widget, &border);
-
- GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_height (widget,
- minimum_size,
- natural_size);
-
- *minimum_size += border.top + border.bottom;
- *natural_size += border.top + border.bottom;
-}
-
-static void
-nautilus_floating_bar_get_preferred_height_for_width (GtkWidget *widget,
- gint width,
- gint *minimum_size,
- gint *natural_size)
-{
- GtkBorder border;
-
- get_padding_and_border (widget, &border);
-
- GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_height_for_width (widget,
- width,
- minimum_size,
- natural_size);
-
- *minimum_size += border.top + border.bottom;
- *natural_size += border.top + border.bottom;
-}
-
static void
nautilus_floating_bar_constructed (GObject *obj)
{
@@ -502,18 +411,12 @@ static void
nautilus_floating_bar_class_init (NautilusFloatingBarClass *klass)
{
GObjectClass *oclass = G_OBJECT_CLASS (klass);
- GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
oclass->constructed = nautilus_floating_bar_constructed;
oclass->set_property = nautilus_floating_bar_set_property;
oclass->get_property = nautilus_floating_bar_get_property;
oclass->finalize = nautilus_floating_bar_finalize;
- wclass->get_preferred_width = nautilus_floating_bar_get_preferred_width;
- wclass->get_preferred_width_for_height = nautilus_floating_bar_get_preferred_width_for_height;
- wclass->get_preferred_height = nautilus_floating_bar_get_preferred_height;
- wclass->get_preferred_height_for_width = nautilus_floating_bar_get_preferred_height_for_width;
-
properties[PROP_PRIMARY_LABEL] =
g_param_spec_string ("primary-label",
"Bar's primary label",
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
index b81c955dcdbd0ad5a63bd041a6628a211d763b18..78071ee43a80288d64078de3f9fc90df0d688397 100644
--- a/src/nautilus-gtk4-helpers.c
+++ b/src/nautilus-gtk4-helpers.c
@@ -97,3 +97,54 @@ gtk_widget_get_first_child (GtkWidget *widget)
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
index ff1e0049fd6b79c7cf162bbe43424d005b46fcaf..4f269afda27ac4d278df28d56a8b8baccdf07d7a 100644
--- a/src/nautilus-gtk4-helpers.h
+++ b/src/nautilus-gtk4-helpers.h
@@ -27,6 +27,20 @@ void gtk_revealer_set_child (GtkRevealer *revealer,
GtkWidget *child);
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-list-view.c b/src/nautilus-list-view.c
index 5951f4a62488c4a23ba380490e94c35e85dbc816..7740f5739dbfc991b8b4291920394a1191601096 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -3486,7 +3486,7 @@ nautilus_list_view_click_policy_changed (NautilusFilesView *directory_view)
{
if (hand_cursor == NULL)
{
- hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+ hand_cursor = gdk_cursor_new_from_name (display, "pointer");
}
}
}
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 4c2fede9a8b9cc934be238390fe192ef2a424c5f..255055b7d0a55e97c1751745a77e4b8605280fbd 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -1605,7 +1605,7 @@ activate_files_internal (ActivateParameters *parameters)
NautilusFile *file;
ApplicationLaunchParameters *one_parameters;
g_autofree char *old_working_dir = NULL;
- GdkScreen *screen;
+ GdkDisplay *display;
GList *l;
if (parameters->activation_directory &&
@@ -1616,7 +1616,7 @@ activate_files_internal (ActivateParameters *parameters)
g_chdir (parameters->activation_directory);
}
- screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window));
+ display = gtk_widget_get_display (GTK_WIDGET (parameters->parent_window));
for (l = g_queue_peek_head_link (parameters->launch_files); l != NULL; l = l->next)
{
g_autofree char *uri = NULL;
@@ -1631,7 +1631,7 @@ activate_files_internal (ActivateParameters *parameters)
DEBUG ("Launching file path %s", quoted_path);
- nautilus_launch_application_from_command (screen, quoted_path, FALSE, NULL);
+ nautilus_launch_application_from_command (display, quoted_path, FALSE, NULL);
}
for (l = g_queue_peek_head_link (parameters->launch_in_terminal_files); l != NULL; l = l->next)
@@ -1648,7 +1648,7 @@ activate_files_internal (ActivateParameters *parameters)
DEBUG ("Launching in terminal file quoted path %s", quoted_path);
- nautilus_launch_application_from_command (screen, quoted_path, TRUE, NULL);
+ nautilus_launch_application_from_command (display, quoted_path, TRUE, NULL);
}
if (old_working_dir != NULL)
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index ad4945d656c19cce63ad5fd70605c469348a6dc9..ffde9a899961ae8aeb5964c8d7aa6e35066b6c52 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -374,8 +374,8 @@ build_tab_label (NautilusNotebook *notebook,
/* Tab close button */
close_button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
- gtk_button_set_relief (GTK_BUTTON (close_button),
- GTK_RELIEF_NONE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (close_button)),
+ "flat");
/* don't allow focus on the close button */
gtk_widget_set_focus_on_click (close_button, FALSE);
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 93842c5eba1dc0d4eabf12389132ddda96db7f75..9c95f67de629d8731b523dfccaed7b33698e52bf 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -95,7 +95,6 @@ struct _NautilusPathBar
gpointer current_button_data;
GList *button_list;
- gulong settings_signal_id;
GActionGroup *action_group;
@@ -111,9 +110,6 @@ struct _NautilusPathBar
G_DEFINE_TYPE (NautilusPathBar, nautilus_path_bar, GTK_TYPE_BOX);
-static void nautilus_path_bar_check_icon_theme (NautilusPathBar *self);
-static void nautilus_path_bar_update_button_appearance (ButtonData *button_data,
- gboolean current_dir);
static void nautilus_path_bar_update_button_state (ButtonData *button_data,
gboolean current_dir);
static void nautilus_path_bar_update_path (NautilusPathBar *self,
@@ -322,27 +318,9 @@ nautilus_path_bar_finalize (GObject *object)
G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
}
-/* Removes the settings signal handler. It's safe to call multiple times */
-static void
-remove_settings_signal (NautilusPathBar *self,
- GdkScreen *screen)
-{
- GtkSettings *settings;
-
- settings = gtk_settings_get_for_screen (screen);
-
- g_clear_signal_handler (&self->settings_signal_id, settings);
-}
-
static void
nautilus_path_bar_dispose (GObject *object)
{
- NautilusPathBar *self;
-
- self = NAUTILUS_PATH_BAR (object);
-
- remove_settings_signal (self, gtk_widget_get_screen (GTK_WIDGET (object)));
-
G_OBJECT_CLASS (nautilus_path_bar_parent_class)->dispose (object);
}
@@ -387,30 +365,6 @@ get_dir_name (ButtonData *button_data)
}
}
-static void
-nautilus_path_bar_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->style_updated (widget);
-
- nautilus_path_bar_check_icon_theme (NAUTILUS_PATH_BAR (widget));
-}
-
-static void
-nautilus_path_bar_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen)
-{
- if (GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->screen_changed)
- {
- GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->screen_changed (widget, previous_screen);
- }
- /* We might nave a new settings, so we remove the old one */
- if (previous_screen)
- {
- remove_settings_signal (NAUTILUS_PATH_BAR (widget), previous_screen);
- }
- nautilus_path_bar_check_icon_theme (NAUTILUS_PATH_BAR (widget));
-}
-
static void
button_data_free (ButtonData *button_data)
{
@@ -433,17 +387,12 @@ static void
nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class)
{
GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
gobject_class = (GObjectClass *) path_bar_class;
- widget_class = (GtkWidgetClass *) path_bar_class;
gobject_class->finalize = nautilus_path_bar_finalize;
gobject_class->dispose = nautilus_path_bar_dispose;
- widget_class->style_updated = nautilus_path_bar_style_updated;
- widget_class->screen_changed = nautilus_path_bar_screen_changed;
-
path_bar_signals [OPEN_LOCATION] =
g_signal_new ("open-location",
G_OBJECT_CLASS_TYPE (path_bar_class),
@@ -483,57 +432,6 @@ nautilus_path_bar_set_templates_menu (NautilusPathBar *self,
g_idle_add ((GSourceFunc) bind_current_view_menu_model_to_popover, self);
}
-/* Changes the icons wherever it is needed */
-static void
-reload_icons (NautilusPathBar *self)
-{
- GList *list;
-
- for (list = self->button_list; list; list = list->next)
- {
- ButtonData *button_data;
-
- button_data = BUTTON_DATA (list->data);
- if (button_data->type != NORMAL_BUTTON || button_data->is_root)
- {
- nautilus_path_bar_update_button_appearance (button_data,
- list->next == NULL);
- }
- }
-}
-
-/* Callback used when a GtkSettings value changes */
-static void
-settings_notify_cb (GObject *object,
- GParamSpec *pspec,
- NautilusPathBar *self)
-{
- const char *name;
-
- name = g_param_spec_get_name (pspec);
-
- if (!strcmp (name, "gtk-icon-theme-name") || !strcmp (name, "gtk-icon-sizes"))
- {
- reload_icons (self);
- }
-}
-
-static void
-nautilus_path_bar_check_icon_theme (NautilusPathBar *self)
-{
- GtkSettings *settings;
-
- if (self->settings_signal_id)
- {
- return;
- }
-
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (self)));
- self->settings_signal_id = g_signal_connect (settings, "notify", G_CALLBACK (settings_notify_cb), self);
-
- reload_icons (self);
-}
-
/* Public functions and their helpers */
static void
nautilus_path_bar_clear_buttons (NautilusPathBar *self)
diff --git a/src/nautilus-program-choosing.c b/src/nautilus-program-choosing.c
index 47362a3f7ecc2fb0c57eb0301e78b55ee1c69e6c..ceaee0a63ebfd59b606a980641a5d05fb532d602 100644
--- a/src/nautilus-program-choosing.c
+++ b/src/nautilus-program-choosing.c
@@ -143,12 +143,6 @@ get_launch_context (GtkWindow *parent_window)
launch_context = gdk_display_get_app_launch_context (display);
- if (parent_window != NULL)
- {
- gdk_app_launch_context_set_screen (launch_context,
- gtk_window_get_screen (parent_window));
- }
-
return launch_context;
}
@@ -237,7 +231,7 @@ nautilus_launch_application_by_uri (GAppInfo *application,
static void
launch_application_from_command_internal (const gchar *full_command,
- GdkScreen *screen,
+ GdkDisplay *display,
gboolean use_terminal)
{
GAppInfoCreateFlags flags;
@@ -251,14 +245,11 @@ launch_application_from_command_internal (const gchar *full_command,
}
app = g_app_info_create_from_commandline (full_command, NULL, flags, &error);
- if (app != NULL && !(use_terminal && screen == NULL))
+ if (app != NULL && !(use_terminal && display == NULL))
{
- GdkDisplay *display;
g_autoptr (GdkAppLaunchContext) context = NULL;
- display = gdk_screen_get_display (screen);
context = gdk_display_get_app_launch_context (display);
- gdk_app_launch_context_set_screen (context, screen);
g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (context), &error);
}
@@ -280,7 +271,7 @@ launch_application_from_command_internal (const gchar *full_command,
* @...: Passed as parameters to the application after quoting each of them.
*/
void
-nautilus_launch_application_from_command (GdkScreen *screen,
+nautilus_launch_application_from_command (GdkDisplay *display,
const char *command_string,
gboolean use_terminal,
...)
@@ -306,7 +297,7 @@ nautilus_launch_application_from_command (GdkScreen *screen,
va_end (ap);
- launch_application_from_command_internal (full_command, screen, use_terminal);
+ launch_application_from_command_internal (full_command, display, use_terminal);
g_free (full_command);
}
@@ -322,7 +313,7 @@ nautilus_launch_application_from_command (GdkScreen *screen,
* @parameters: Passed as parameters to the application after quoting each of them.
*/
void
-nautilus_launch_application_from_command_array (GdkScreen *screen,
+nautilus_launch_application_from_command_array (GdkDisplay *display,
const char *command_string,
gboolean use_terminal,
const char * const *parameters)
@@ -346,14 +337,13 @@ nautilus_launch_application_from_command_array (GdkScreen *screen,
}
}
- launch_application_from_command_internal (full_command, screen, use_terminal);
+ launch_application_from_command_internal (full_command, display, use_terminal);
g_free (full_command);
}
void
-nautilus_launch_desktop_file (GdkScreen *screen,
- const char *desktop_file_uri,
+nautilus_launch_desktop_file (const char *desktop_file_uri,
const GList *parameter_uris,
GtkWindow *parent_window)
{
@@ -442,8 +432,6 @@ nautilus_launch_desktop_file (GdkScreen *screen,
context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (parent_window)));
/* TODO: Ideally we should accept a timestamp here instead of using GDK_CURRENT_TIME */
gdk_app_launch_context_set_timestamp (context, GDK_CURRENT_TIME);
- gdk_app_launch_context_set_screen (context,
- gtk_window_get_screen (parent_window));
if (count == total)
{
/* All files are local, so we can use g_app_info_launch () with
diff --git a/src/nautilus-program-choosing.h b/src/nautilus-program-choosing.h
index 51881ff17d237b788983497a1d57967e9acaa834..00ac6fe3ba2efabd5bea62db1bbbf6de9199c53d 100644
--- a/src/nautilus-program-choosing.h
+++ b/src/nautilus-program-choosing.h
@@ -39,16 +39,15 @@ void nautilus_launch_application_by_uri (GAppInfo
void nautilus_launch_application_for_mount (GAppInfo *app_info,
GMount *mount,
GtkWindow *parent_window);
-void nautilus_launch_application_from_command (GdkScreen *screen,
+void nautilus_launch_application_from_command (GdkDisplay *display,
const char *command_string,
gboolean use_terminal,
...) G_GNUC_NULL_TERMINATED;
-void nautilus_launch_application_from_command_array (GdkScreen *screen,
+void nautilus_launch_application_from_command_array (GdkDisplay *display,
const char *command_string,
gboolean use_terminal,
const char * const * parameters);
-void nautilus_launch_desktop_file (GdkScreen *screen,
- const char *desktop_file_uri,
+void nautilus_launch_desktop_file (const char *desktop_file_uri,
const GList *parameter_uris,
GtkWindow *parent_window);
void nautilus_launch_default_for_uri_async (const char *uri,
@@ -57,4 +56,4 @@ void nautilus_launch_default_for_uri_async (const char
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean nautilus_launch_default_for_uri_finish (GAsyncResult *result,
- GError **error);
\ No newline at end of file
+ GError **error);
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index d1ec6393465bc3a5abd82d8abdfd29d930808d1b..40f819cffe15030c2387b8d8f857acd895cb8a23 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2875,7 +2875,7 @@ start_long_operation (NautilusPropertiesWindow *self)
g_autoptr (GdkCursor) cursor = NULL;
display = gtk_widget_get_display (GTK_WIDGET (self));
- cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
+ cursor = gdk_cursor_new_from_name (display, "wait");
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self)), cursor);
}
self->long_operation_underway++;
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index cee8aa25081ed8d58d2854bd28c8f51a469459c8..2f1987d75eb6c126e55d6a6f70d17e4e9af6752b 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -809,20 +809,6 @@ on_location_entry_close (GtkWidget *close_button,
nautilus_toolbar_set_show_location_entry (self, FALSE);
}
-static gboolean
-on_location_entry_populate_popup (GtkEntry *entry,
- GtkWidget *widget,
- gpointer user_data)
-{
- NautilusToolbar *toolbar;
-
- toolbar = user_data;
-
- toolbar->location_entry_should_auto_hide = FALSE;
-
- return GDK_EVENT_PROPAGATE;
-}
-
static void
on_location_entry_focus_changed (GObject *object,
GParamSpec *pspec,
@@ -918,8 +904,6 @@ nautilus_toolbar_constructed (GObject *object)
(GCallback) gtk_widget_grab_focus, NULL);
g_signal_connect_swapped (self->operations_popover, "closed",
(GCallback) gtk_widget_grab_focus, self);
- g_signal_connect (self->location_entry, "populate-popup",
- G_CALLBACK (on_location_entry_populate_popup), self);
g_signal_connect (self->location_entry, "notify::has-focus",
G_CALLBACK (on_location_entry_focus_changed), self);
@@ -1467,5 +1451,5 @@ nautilus_toolbar_is_menu_visible (NautilusToolbar *self)
gboolean
nautilus_toolbar_is_operations_button_active (NautilusToolbar *self)
{
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->operations_button));
+ return gtk_widget_is_visible (GTK_WIDGET (self->operations_popover));
}
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index d85bb28059e2484a12e170cf1f85fb1ac0e801c9..98599862c4d92da1e23db42e8b7a10dba0462842 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
{
@@ -718,7 +719,7 @@ real_reveal_for_selection_context_menu (NautilusFilesView *files_view)
/* Get the focused item_ui, if selected.
* Otherwise, get the selected item_ui which is sorted the lowest.*/
- item_ui = gtk_container_get_focus_child (GTK_CONTAINER (self->view_ui));
+ item_ui = gtk_widget_get_focus_child (GTK_WIDGET (self->view_ui));
if (item_ui == NULL || !gtk_flow_box_child_is_selected (GTK_FLOW_BOX_CHILD (item_ui)))
{
g_autoptr (GList) list = gtk_flow_box_get_selected_children (self->view_ui);
@@ -1420,7 +1421,8 @@ constructed (GObject *object)
(GCallback) on_longpress_gesture_pressed_callback,
self);
- gtk_container_add (GTK_CONTAINER (content_widget), GTK_WIDGET (self->view_ui));
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (content_widget),
+ GTK_WIDGET (self->view_ui));
self->action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (self));
g_action_map_add_action_entries (G_ACTION_MAP (self->action_group),
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 25b5826108ba034358ed6cc08316aad34a8fd5fa..e1d3ae810d2a866483812029d986d76d70964c79 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2817,7 +2817,7 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *self)
g_binding_unbind (self->extensions_background_menu_binding);
g_binding_unbind (self->templates_menu_binding);
widget = GTK_WIDGET (self->content_view);
- gtk_widget_destroy (widget);
+ gtk_box_remove (GTK_BOX (self), widget);
g_clear_object (&self->content_view);
}
@@ -2903,13 +2903,13 @@ nautilus_window_slot_dispose (GObject *object)
if (self->content_view)
{
- gtk_widget_destroy (GTK_WIDGET (self->content_view));
+ gtk_box_remove (GTK_BOX (self), GTK_WIDGET (self->content_view));
g_clear_object (&self->content_view);
}
if (self->new_content_view)
{
- gtk_widget_destroy (GTK_WIDGET (self->new_content_view));
+ gtk_box_remove (GTK_BOX (self), GTK_WIDGET (self->new_content_view));
g_clear_object (&self->new_content_view);
}
@@ -2928,7 +2928,6 @@ nautilus_window_slot_dispose (GObject *object)
if (self->query_editor)
{
- gtk_widget_destroy (GTK_WIDGET (self->query_editor));
g_clear_object (&self->query_editor);
}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index c99bbc98db3fa5ae345dd1036df7d13391205d97..eefb60dcbfa25e8a1f9208f7c42b6bee262ca95f 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1977,15 +1977,14 @@ notebook_create_window_cb (GtkNotebook *notebook,
}
app = NAUTILUS_APPLICATION (g_application_get_default ());
- new_window = nautilus_application_create_window
- (app, gtk_widget_get_screen (GTK_WIDGET (notebook)));
+ new_window = nautilus_application_create_window (app);
+ gtk_window_set_display (GTK_WINDOW (new_window),
+ gtk_widget_get_display (GTK_WIDGET (notebook)));
slot = NAUTILUS_WINDOW_SLOT (page);
g_object_set_data (G_OBJECT (slot), "dnd-window-slot",
GINT_TO_POINTER (TRUE));
- gtk_window_set_position (GTK_WINDOW (new_window), GTK_WIN_POS_MOUSE);
-
return GTK_NOTEBOOK (new_window->notebook);
}
@@ -2277,49 +2276,32 @@ nautilus_window_save_geometry (NautilusWindow *window)
{
GdkWindow *gdk_window;
GdkWindowState window_state;
- gboolean is_maximized;
+ gint width;
+ gint height;
+ GVariant *initial_size;
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)));
-
- /* Don't save the window state for tiled windows. This is a special case,
- * where the geometry only makes sense in combination with other tiled
- * windows, that we can't possibly restore. */
- if (window_state & GDK_WINDOW_STATE_TILED)
+ 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;
}
- is_maximized = window_state & GDK_WINDOW_STATE_MAXIMIZED;
+ gtk_window_get_size (GTK_WINDOW (window), &width, &height);
+ initial_size = g_variant_new_parsed ("(%i, %i)", width, height);
- /* Only save the initial size when the window is not maximized. If the
- * window is maximized, a previously stored initial size will be more
- * appropriate when unmaximizing the window in the future. */
- if (!is_maximized)
- {
- gint width;
- gint height;
- GVariant *initial_size;
-
- 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,
- NAUTILUS_WINDOW_STATE_INITIAL_SIZE,
- initial_size);
- }
-
- g_settings_set_boolean (nautilus_window_state,
- NAUTILUS_WINDOW_STATE_MAXIMIZED,
- is_maximized);
+ g_settings_set_value (nautilus_window_state,
+ NAUTILUS_WINDOW_STATE_INITIAL_SIZE,
+ initial_size);
}
void
@@ -2824,11 +2806,10 @@ nautilus_window_class_init (NautilusWindowClass *class)
}
NautilusWindow *
-nautilus_window_new (GdkScreen *screen)
+nautilus_window_new (void)
{
return g_object_new (NAUTILUS_TYPE_WINDOW,
"icon-name", APPLICATION_ID,
- "screen", screen,
NULL);
}
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index dfb810ae52f1ab5242db61783fe7aac2d887f52f..af38441f1c6ee091bd72ecb6f8fbdf182746bd8e 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -57,7 +57,7 @@ typedef void (* NautilusWindowHandleExported) (NautilusWindow *window,
#define NAUTILUS_WINDOW_DEFAULT_WIDTH 890
#define NAUTILUS_WINDOW_DEFAULT_HEIGHT 550
-NautilusWindow * nautilus_window_new (GdkScreen *screen);
+NautilusWindow * nautilus_window_new (void);
void nautilus_window_close (NautilusWindow *window);
void nautilus_window_open_location_full (NautilusWindow *window,
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 0e2f302f03024e81b1010f3da70e2213ff7aaaef..8a0bb9c0129b7cc8cb29a0ed4926fd5c550694c9 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -106,7 +106,7 @@ entry.search > * {
/* Floating status bar */
.floating-bar {
- padding: 1px;
+ padding: 3px;
background-color: @theme_base_color;
border-width: 1px;
border-style: solid solid none;
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui b/src/resources/ui/nautilus-batch-rename-dialog.ui
index 025628d9a733ed6dc0038a9a7eab334a9ab23602..8920e4b20aee662b996fe95d96b5126cf2d7ebf1 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -369,7 +369,6 @@
True
- GTK_RELIEF_NONE
@@ -392,6 +393,9 @@
1
+
diff --git a/src/resources/ui/nautilus-column-chooser.ui b/src/resources/ui/nautilus-column-chooser.ui
index 21af73ae2386d5faeaa2ab5933bc3458e800503f..5f44ea8f98d070ef439f533d1fbe062d4c455c43 100644
--- a/src/resources/ui/nautilus-column-chooser.ui
+++ b/src/resources/ui/nautilus-column-chooser.ui
@@ -22,7 +22,6 @@
True
False
- in
True
@@ -63,6 +62,9 @@
+
False
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 407014ecc6c7b15a175a847e8b246ebd97aa5877..472ee7fcee71d43ddd4b6c6fd5f820722d4faa69 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -80,7 +80,6 @@
True
True
True
- none
False
@@ -92,6 +91,7 @@
@@ -148,7 +148,6 @@
True
True
True
- none
False
@@ -161,6 +160,7 @@