1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-30 23:46:35 +00:00

placessidebar: Drop ::show-starred-location

The public GtkPlacesSidebar in GTK3 couldn't make assumptions about a
place that was private to nautilus, so it would emit a specific signal
instead of regular ::open-location.

Now that it's all nautilus-internal, there is no reason not to use the
regular ::open-location signal. This way NautilusWindow doesn't have
to handle the special signal, which makes the upcoming FileChooser
implementation simpler.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
This commit is contained in:
António Fernandes 2024-06-09 18:25:23 +01:00
parent 24d4307b61
commit ccf81c1b0d
3 changed files with 2 additions and 58 deletions

View File

@ -179,8 +179,6 @@ struct _NautilusGtkPlacesSidebarClass {
GList *source_file_list,
GdkDragAction action);
void (* show_starred_location) (NautilusGtkPlacesSidebar *sidebar);
void (* mount) (NautilusGtkPlacesSidebar *sidebar,
GMountOperation *mount_operation);
void (* unmount) (NautilusGtkPlacesSidebar *sidebar,
@ -193,7 +191,6 @@ enum {
DRAG_ACTION_REQUESTED,
DRAG_ACTION_ASK,
DRAG_PERFORM_DROP,
SHOW_STARRED_LOCATION,
MOUNT,
UNMOUNT,
LAST_SIGNAL
@ -271,15 +268,6 @@ emit_show_error_message (NautilusGtkPlacesSidebar *sidebar,
primary, secondary);
}
static void
emit_show_starred_location (NautilusGtkPlacesSidebar *sidebar,
NautilusGtkPlacesOpenFlags open_flags)
{
g_signal_emit (sidebar, places_sidebar_signals[SHOW_STARRED_LOCATION], 0,
open_flags);
}
static void
emit_mount_operation (NautilusGtkPlacesSidebar *sidebar,
GMountOperation *mount_op)
@ -703,7 +691,7 @@ update_places (NautilusGtkPlacesSidebar *sidebar)
}
start_icon = g_themed_icon_new_with_default_fallbacks ("starred-symbolic");
add_place (sidebar, NAUTILUS_GTK_PLACES_STARRED_LOCATION,
add_place (sidebar, NAUTILUS_GTK_PLACES_BUILT_IN,
NAUTILUS_GTK_PLACES_SECTION_DEFAULT_LOCATIONS,
_("Starred"), start_icon, NULL, SCHEME_STARRED ":///",
NULL, NULL, NULL, NULL, 0,
@ -1802,11 +1790,7 @@ open_row (NautilusGtkSidebarRow *row,
"volume", &volume,
NULL);
if (place_type == NAUTILUS_GTK_PLACES_STARRED_LOCATION)
{
emit_show_starred_location (sidebar, open_flags);
}
else if (uri != NULL)
if (uri != NULL)
{
open_uri (sidebar, uri, open_flags);
}
@ -3865,26 +3849,6 @@ 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
*
* 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.
*/
places_sidebar_signals [SHOW_STARRED_LOCATION] =
g_signal_new ("show-starred-location",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NautilusGtkPlacesSidebarClass, show_starred_location),
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
NAUTILUS_TYPE_OPEN_FLAGS);
properties[PROP_LOCATION] =
g_param_spec_object ("location",
"Location to Select",

View File

@ -104,7 +104,6 @@ typedef enum {
NAUTILUS_GTK_PLACES_HEADING,
NAUTILUS_GTK_PLACES_DROP_FEEDBACK,
NAUTILUS_GTK_PLACES_BOOKMARK_PLACEHOLDER,
NAUTILUS_GTK_PLACES_STARRED_LOCATION,
NAUTILUS_GTK_PLACES_N_PLACES
} NautilusGtkPlacesPlaceType;

View File

@ -752,19 +752,6 @@ places_sidebar_show_error_message_cb (NautilusGtkPlacesSidebar *sidebar,
show_dialog (primary, secondary, GTK_WINDOW (window), GTK_MESSAGE_ERROR);
}
static void
places_sidebar_show_starred_location (NautilusWindow *window,
NautilusGtkPlacesOpenFlags open_flags)
{
GFile *location;
location = g_file_new_for_uri (SCHEME_STARRED ":///");
open_location_cb (window, location, open_flags);
g_object_unref (location);
}
/* Callback used when the places sidebar needs to know the drag action to suggest */
static GdkDragAction
places_sidebar_drag_action_requested_cb (NautilusGtkPlacesSidebar *sidebar,
@ -1938,12 +1925,6 @@ nautilus_window_init (NautilusWindow *window)
g_type_ensure (NAUTILUS_TYPE_SHORTCUT_MANAGER);
gtk_widget_init_template (GTK_WIDGET (window));
g_signal_connect_object (window->places_sidebar,
"show-starred-location",
G_CALLBACK (places_sidebar_show_starred_location),
window,
G_CONNECT_SWAPPED);
g_signal_connect (window, "notify::maximized",
G_CALLBACK (on_is_maximized_changed), NULL);