We were using GTkTreeView in a simple list. Also, as we know,
GtkCellRenderers are not the best way to theme and manipulate
widgets.
So instead use a GtkListBox to modernize the GtkPlacesSidebar,
and in the way clean up some parts of the code (like headings)
which were not used anymore.
Also we don't use a model anymore, since the data is simple
enough to manage it in a subclass of the row itself.
It is convenient to allow applications to show all the drop
targets at once. This improves the user experience with drag
an drop.
The new API allows the application to set the gtkplacessidebar
in a mode where invalid drop targets are insensitive and it
adds a "new bookmark" row. This mode is intended to be set
when the application is aware of a dnd operation and needs to
be stopped kwhen the application is aware that dnd operation
was cancelled or ended in a different part than gtkplacesisdebar.
The context parameter is unused in this patch, but will be
used in next patches when the sidebar will use a GtkListBox.
The reason of being unused now is just convenience.
https://bugzilla.gnome.org/show_bug.cgi?id=747793
Since nautilus merge, we were not showing 'Recent' in the sidebar
if GIO did not support the recent: scheme. But the file chooser
can show recent files independent of gvfs - it loads the recent
files manually. This is relevant on Windows and OS X, where gvfs
is typically not used.
This commit adds a show-recent property which can be used to override
the recent: scheme check. We use it in the file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=750068
gtk_tree_view_set_tooltip_column() specifies that markup in the text
should be escaped.
This fixes critical warnings when hovering over items in the sidebar for
bookmarks that have markup characters in their names.
https://bugzilla.gnome.org/show_bug.cgi?id=719683
GtkPlacesSidebar applies a sorting function on
the tree model that does not consider the case
of bookmarks, which are sorted by their indexes.
By adding the bookmarks corner case and comparing
then by their indexes, GtkPlacesSidebar can sort
the bookmarks properly in the order they're saved.
https://bugzilla.gnome.org/show_bug.cgi?id=744589
We were concatenating "file://" to the result of g_get_user_special_dir() to build
a URI, but this is not enough on Windows. Use g_filename_to_uri() instead.
See https://bugzilla.gnome.org/show_bug.cgi?id=739453
When a drive is ejected or a volume unmounted the current directory
doesn't change most of the times being empty or being a directory that
user shouldn't take care about, like /run/media
Seems more useful to change to $HOME directory in that case so the user
can see something useful and familiar just after unmounting.
https://bugzilla.gnome.org/show_bug.cgi?id=737983
Currently we change the current location if we click the eject button of
a mount.
Check whether the user actually clicked the eject button and don't
change location in that case.
https://bugzilla.gnome.org/show_bug.cgi?id=737983
We get multiple notifications from the bookmark manager when
something changes. Every time, we reconstruct the sidebar contents
completely, by clearing the store. The bookmarks are added with
async calls though, and the code was forgetting to cancel outstanding
async requests, leading to multiple instances of the same bookmark
getting added. Use the cancellable we already have to prevent that.
This could be made much more efficient by not recreating the entire
sidebar quite so often (3-5 times for a single bookmark rename).
https://bugzilla.gnome.org/show_bug.cgi?id=737679
If the query fails because it has been cancelled, it means that
dispose() has been called, so don't try and update anything.
This fixes a segfault with Nautilus in certain situations.
https://bugzilla.gnome.org/show_bug.cgi?id=736512
This was silently broken - the code was just assuming that the
text cell renderer is item no. 6 on the list of all cells. That
doesn't work so well if the cell renderers are set up elsewhere
and get rearranged.
Fix this by keeping an explicit pointer to the the text cell.
Removable USB drives or memory sticks should be powered down
when the eject button is pressed. For this, we need to call
g_drive_stop() instead of g_drive_eject(), provided the drive
can be stopped.
https://bugzilla.gnome.org/show_bug.cgi?id=723121
We go to extra length to set the desktop_uri to NULL when
desktop == home, but then we were adding the (non-functional)
place item anyway. Don't do that.
Change the GtkSettings default for "shell-shows-desktop" back to TRUE
and also change the default value of the "show-desktop" property on
GtkPlacesSidebar so that the defaultvalue test passes.
https://bugzilla.gnome.org/show_bug.cgi?id=712302
Previously, the "Places" sidebar was populated by the update_places()
call from within gtk_places_sidebar_style_set(). After
742a2f11a9, update_places() is never called
and the sidebar is never populated unless gtk_places_sidebar_add_shortcut()
happens to be called. This commit fixes this by calling update_places()
at the end of gtk_places_sidebar_init().
https://bugzilla.gnome.org/show_bug.cgi?id=709522
Attached widgets inherit from the style of the widget they are
attached to. This can sometimes have unintended consequences,
like a context menu in the main view of gedit inheriting the font
that is configured for documents, or the context menu of the preview
in the font chooser coming up with humongous font size.
To fix this problem, we introduce a context menu style class
and use it for all menus that are used like that. The theme
can then set a font for this style class.
https://bugzilla.gnome.org/show_bug.cgi?id=697127
We've recently a number of classes wholly. For these cases,
move the headers and sources to gtk/deprecated/ and adjust
Makefiles and includes accordingly.
Affected classes:
GtkAction
GtkActionGroup
GtkActivatable
GtkIconFactory
GtkImageMenuItem
GtkRadioAction
GtkRecentAction
GtkStock
GtkToggleAction
GtkUIManager
Do not unref mount has we grabbed its pointer without taking
a reference.
Otherwise the following call to g_list_free_full on network_mounts
frees it a second time. Segfault in nautilus ensue.
https://bugzilla.gnome.org/show_bug.cgi?id=700979
Since ::drag-leave gets emitted before ::drag-drop, we can't just remove the drop feedback row
in drag-leave, as we *need* it during drag-drop. So, we use the same trick as in testdnd.c - we
install a timeout handler in our drag-leave callback, and remove the feedback in the timeout callback.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This lets us keep the new_bookmark_index untouched even when the drop state goes from armed to unarmed.
That will in turn let us drop in the right place...
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This makes the feedback accurate and without hysteresis. Haven't I written this code ten times before?
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
For now it is the old, simple call to gtk_tree_view_set_drag_dest_row(). We'll do something
fancier in the following commits.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We want to show a little animation when a DnD operation is happening and the user hovers
between existing bookmarks. The animation should indicate the user that he's about to
create a new bookmark from the file right there.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The creation is async, and the sidebar could be destroyed while the D-Bus proxy is being created.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
It's not friendly to bindings, and we didn't need an inout parameter anyway.
We use a simple return value from the signal handler now.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Unmounted volumes don't have a URI yet, so we can use that to distinguish them
from within the DnD code.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Instead of having an accept_uri_drops flag, we'll always advertise as accepting URI drops.
However, we'll see if the caller actually handles the drag-action-requested signal. If it
does, we'll indeed allow performing file operations when URIs are dropped. Otherwise,
we'll only allow creating bookmarks from dragged URIs.
Dragging URIs directly into a places item will cause the sidebar to check if the caller
allows file operations. Dragging URIs between places items will cause the sidebar
to create bookmarks for those URIs instead.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This keeps the drop indicator line from 'sticking' if you drag a bookmark above
the Bookmarks heading.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The rest of the public API works in terms of GFile, so remove this last remnant
of passing URIs around.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We used to have set_current_location() and get_selected_location(), with confusing
semantics. Now they are symmetric, with the exception that if set_location() is
called with a location that is not shown in the sidebar, then it will both clear
the selection in the list and make get_selection() return NULL.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This lets us handle the 'Open in new tab' and 'Open in new window' menu items
on our own, and allows callers to have less code to deal with each mode.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This lets us remove two entry points, gtk_places_sidebar_set_show_trash(),
and gtk_places_sidebar_set_trash_is_full().
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Instead of conditionally creating contextual menu items like 'Show file properties',
we'll instead let the caller populate the popup menu, as is done for GtkEntry.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The file chooser will not accept dropping URIs in a shortcut item. However, Nautilus will,
to perform normal DnD for files.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We'll use this signal to ask the caller about what drag action to indicate
when something is being hovered on an item in the places sidebar.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Per the gtk-devel meeting on 2012/11/29, we'll not have a UI in the file chooser dialog
to select between those modes. Instead, we'll show that key in gtweaktool.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This is so that the sidebar will already know the URI of the location it is showing. When
the caller asks the sidebar to change back to the same location, the call will be idempotent.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
To be consistent with the ::location-selected signal, which emits a GFile, we now also use a GFile
instead of a string URI in the inbound API.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Instead of having a nested-callback scheme (to preserve internal API compatibility),
we use a direct callback from g_volume_mount().
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We add a method to say whether the trash is full/empty (to use the appropriate icon),
and a signal that the sidebar can use to request that the trash be emptied when
the user selects 'Empty trash' from the context menu.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Currently they default to false. This also fixes warnings with uninitialized widgets
in bookmarks_check_popup_sensitivity().
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We query the file info for display name and icon synchronously. If it becomes a problem,
we'll make it async, more in line with NautilusBookmark.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This syncs the code up to commit 4b6abf644b from Nautilus.
This only refers to nautilus-places-sidebar.[ch].
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We use the normal gtk_style_context_set_state() machinery to set a
prelighted state. Hopefully even symbolic icons will be rendered
prelighted properly.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We need to ask the caller to pop up error messages for us, so it can do
it with its own conventions: pick the right transient window, use a status
bar rather than a dialog, etc.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
It sucks to have this as an app-settable option. Maybe we should
make this a standard GSetting thing and be done with it.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The file chooser will leave these off by default; file managers
like Nautilus will turn them on.
These control whether the places sidebar shows 'open in new tab' and similar
items in its context menu.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Don't try to decide if the URIs are acceptable / not duplicates; the
idea is to let the user bookmark whatever he pleases.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This signal just carries a boolean initiated_unmount argument, which
is meant to say True when the unmount/eject starts, and False when
the operation finishes.
We may want to rename all of this to unmount_started / stopped, etc.
I don't know if the caller needs to know about the mount_op in question,
or if it can be inferred from what the caller knows to be the current
shown location on the GtkPlacesSidebar.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Now we just need to see if we need to replace calls to
nautilus_window_set_initiated_unmount() with a signal.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
There are still some missing pieces to get the bookmark's icon,
and *maybe* to cull the list of bookmarks based on some criteria.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Instead of directly calling the Nautilus machinery to open locations
in tabs or windows, we emit a signal which the caller must handle.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Nautilus lets you open things in the same tab, in a new tab, or in
a new window. We will expose these semantics through an enum, as
part of an 'open' signal.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>