Commit Graph

270 Commits

Author SHA1 Message Date
Matthias Clasen
e08c5262b7 places sidebar: Use a popover for the context menu
Use a popover for the context menu, and add a long press gesture
to allow opening it with touch.
2015-07-17 08:57:39 -04:00
Georges Basile Stavracas Neto
3b41daca78 placessidebar: show persistent drives when not showing Other Locations
Previous commits changes the behavior of GtkPlacesSidebar, as it stops
handling persistent devices and only manages mounted networks, XDG
directories and bookmarks.

By radically breaking the previous behavior, we may have trouble
since we provide no alternatives to that besides the private widget
GtkPlacesView.

Fix that by showing the persistent devices when not showing Other
Locations item.
2015-07-16 11:41:03 -03:00
Georges Basile Stavracas Neto
a39b8f67ba placessidebar: fix Connect to Server position
Commit 7db399d975 introduces
the Other Locations item, as well as some behavioral changes
to GtkPlacesSidebar. It, howevers, wrongly changes the section
of code that handles the Connect to Server item, with various
side effects depending on the environment setup.

Fix that by adding the Connect to Server at the right section
of code.
2015-07-16 09:37:56 -03:00
Georges Basile Stavracas Neto
7db399d975 placessidebar: add Other Locations item
Places sidebar is a widget that enabled the user to select
XDG directories, bookmarks and mounted network locations,
as well as manages permanent and removable devices.

The new design that aims to look less clutered makes the
sidebar display only removable devices, as well as mounted
networks, bookmarks and XDG directories, and delegates the
management of permanent devices such as hard drive partitions
to GtkPlacesView, a newly introduced widget for this specific
purpose.

To delegate it, add an "Other Locations..." item to notify
when the permanent devices manager is required. Besides that,
don't show these fixes devices on the sidebar itself, as they
are not supposed to be handled by the sidebar anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-15 23:11:52 -03:00
Matthias Clasen
24e1323eb3 places sidebar: Handle menu key
It is good practice to handle the menu key and Shift-F10 to
allow keyboard-driven use of context menus.
2015-07-15 12:46:06 -04:00
Matthias Clasen
8e53a01188 places sidebar: Fix rows getting 'lost' when dnd fails
There was some code that lead to the places sidebar loosing track
of the row being dragged if a motion event came in between letting
go of the button and the drag snap-back animation ending. This would
cause us to not show the row again, giving the appearance that it
was 'lost'.

https://bugzilla.gnome.org/show_bug.cgi?id=751448
2015-07-08 06:10:00 -04:00
Matthias Clasen
fb316156e2 place sidebar: Make removing bookmarks work again
This was accidentally broken in ae8c07c67c when I
forgot to switch the sense of a condition.
2015-07-06 23:21:51 -04:00
Matthias Clasen
3cbe6d86af place sidebar: minor change
We generally prefer for loops to iterate over lists.
2015-07-06 21:59:10 -04:00
Matthias Clasen
8b90c79037 places sidebar: Fix memory handling of rename popover
We were freeing the same string twice here, leading to
badness.
2015-07-04 22:38:29 -04:00
Matthias Clasen
78db92df7e GtkPlacesSidebar: Allow hiding Trash
We will use this in the filechooser in save mode.
2015-07-04 00:29:26 -04:00
Matthias Clasen
715aba650e places sidebar: Add private api to get title
The places sidebar already does all the work to determine the
right label to use for the current location of the filechooser.
We want to use the same label in the headerbar subtitle, so
add some private API to get it.
2015-07-04 00:29:24 -04:00
Carlos Garnacho
8c9e426dc5 placessidebar: Do not set as a "track motion" DnD site
It has the unintended effect of picking the suggested action from the
context, which conflicts with the (possibly 0) status we set on our
::drag-motion handler.

Given this widget is not interested in listening to DnD from every
possible target, it is safe to just disable it.
2015-07-01 19:37:42 +02:00
Matthias Clasen
ae8c07c67c GktPlacesSidebar: Plug a ton of leaks
If you don't keep in mind that g_object_get() returns references to
objects and copies fo strings, things leak all over the place.
2015-06-23 16:35:17 -04:00
Matthias Clasen
f2a8ddfecf sidebarrow: Avoid object-valued properties
They tend to leak...as these do.
2015-06-23 16:35:17 -04:00
Carlos Soriano
569e59b2c5 gtkplacessidebar: improve variable name 2015-06-16 16:54:24 +02:00
Carlos Soriano
0bb82bf1de gtkplacessidebar: Remove some old comments
We didn't made up our minds until now from some of them, and for
the others no progress has been made or bugs reported, so probably
they are fine.
2015-06-16 16:25:33 +02:00
Carlos Soriano
fbbad5deec gtkplacesidebar: use GtkListBox
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.
2015-06-16 16:19:37 +02:00
Carlos Soriano
4499174e32 gtkplacessidebar: make insensitive invalid drop targets
https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano
fb034f38b3 gtkplacessidebar: add new bookmark icon
Following design mockups

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano
a9b698b265 gtkplacesidebar: remove obsolete drop state
We didn't use those for some time now.
2015-06-16 16:19:37 +02:00
Carlos Soriano
91e1e80862 gtkplacessidebar: add API for show drop hints
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
2015-06-16 16:19:37 +02:00
Carlos Soriano
4371cc8f01 gtkplacessidebar: new bookmark row only at first position
Following the new mockups, put the new bookmark row always
in the first position, so it's easier to drop an item.

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:36 +02:00
Matthias Clasen
1bba3b0a38 Avoid uninitialized variables
clang complains that these may be used uninitialized.
2015-06-13 21:10:26 -04:00
Matthias Clasen
a8191e7113 places sidebar: Make 'recent' work on other platforms
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
2015-06-06 17:13:22 -04:00
Matthias Clasen
4de444ca61 placessidebar: Simplify some code
Use existing functions, instead of open-coding manipulation
of string arrays.
2015-05-30 09:20:27 -04:00
Cosimo Cecchi
e0b1ea11cc placessidebar: escape tooltip text before setting it
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
2015-05-24 12:04:22 -07:00
Matthias Clasen
adb58b2c84 file chooser: Set default widget in create folder popover
This is using the new default widget functionality for
popovers to make Enter in the entry activate the Create
button.

https://bugzilla.gnome.org/show_bug.cgi?id=747664
2015-05-02 20:34:28 -04:00
Matthias Clasen
3fbaf3231e GtkPlacesSidebar: Use a popover for renaming bookmarks
This is following the example in gnome-builder.
2015-05-02 02:48:46 -04:00
Matthias Clasen
59a901e285 places sidebar: Stop using follow-state
It is no longer needed.
2015-03-15 22:44:33 -04:00
Georges Basile Stavracas Neto
ce9a5a3fec places sidebar: compare bookmarks by index
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
2015-03-04 17:20:40 -03:00
Matthias Clasen
f211031a9f places sidebar: Make a function NULL-safe
gtk_places_sidebar_set_location's location argument is documented
as allow-none, but if one actually passes NULL, a warning results.
Fix that.
2015-01-28 18:25:32 -05:00
Matthias Clasen
00e08a0159 places sidebar: Drop the top margin
This looks odd in combination with the top underflow.
2015-01-19 09:37:04 -05:00
Nelson Benítez León
f26986a50a gtkplacessidebar: insert bookmark by dnd in correct position
Add needed COLUMN INDEX to "new bookmark" row based on previous
bookmark index plus one.

Fixes bug 742727
2015-01-13 19:01:46 -05:00
Matthias Clasen
a3e37abb38 GtkPlacesSidebar: Don't return FALSE as a pointer
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=741250
2014-12-08 09:15:07 -05:00
Matthias Clasen
39c0ba59bc places sidebar: Fix the sort function
When returning 1 for a pair (a,b), a sort function must
return -1 for the pair (b,a), otherwise things can go
badly.

https://bugzilla.gnome.org/show_bug.cgi?id=739729
2014-12-04 22:26:14 -05:00
Matias De Lellis
bd71849e26 GtkPlacesSidebar: Fix Home and Desktop on Windows.
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
2014-12-01 14:57:32 -06:00
Cosimo Cecchi
94f412622e GtkPlacesSidebar: add support for unmount notifications
Now that we can use GNotification from here, send a notification when
umounting from GtkPlacesSidebar.

https://bugzilla.gnome.org/show_bug.cgi?id=740896
2014-11-30 09:59:54 -08:00
Matthias Clasen
041ccd7f87 GtkPlacesSidebar: Don't crash on dnd
gtk_get_current_event() can return NULL. Don't crash if it does.

https://bugzilla.gnome.org/show_bug.cgi?id=739150
2014-10-25 16:00:00 -04:00
Matthias Clasen
c26b2c9209 GtkPlacesSidebar: Don't leak an icon
Found in valgrind.
2014-10-14 23:59:51 -04:00
Carlos Soriano
975d9d4314 gtkplacessidebar: Fix commit f6870e5b79
Commit f6870e5b79 introduced a some memory leaks and could be
improved in some areas.

Fix the memory leaks and apply the improvements.

https://bugzilla.gnome.org/show_bug.cgi?id=737983
2014-10-12 04:16:44 +02:00
Carlos Soriano
f6870e5b79 gtkplacessidebar: Open $HOME after unmounting or ejecting
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
2014-10-10 18:17:41 +02:00
Carlos Soriano
3c29212ce3 gtkplacessidebar: Don't change location if clicked on eject button
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
2014-10-10 18:17:41 +02:00
Matthias Clasen
d1fd8267ef Cosmetic formatting fix 2014-10-05 13:39:37 -04:00
Matthias Clasen
b858d45e3c GtkPlacesSidebar: Don't pile up duplicate bookmarks
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
2014-10-05 13:39:37 -04:00
Matthias Clasen
4866f0cec4 GtkPlacesSidebar: Be consistent in messages
Always quote drive/volume names.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:22 -04:00
Ross Lagerwall
08e1c8e30a GtkPlacesSidebar: Fix a memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=736512
2014-09-12 08:08:09 +01:00
Ross Lagerwall
0c12d3afcc GtkPlacesSidebar: Don't update bookmark if cancelled
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
2014-09-12 08:08:09 +01:00
Ross Lagerwall
94ed54f8ad GtkPlacesSidebar: Only add shortcut if query succeeds
https://bugzilla.gnome.org/show_bug.cgi?id=736512
2014-09-12 08:08:09 +01:00
Matthias Clasen
768c0c21b5 GtkPlacesSidebar: Cancel async ops when finalized
This is the common practice for objects that start async operations.
https://bugzilla.gnome.org/show_bug.cgi?id=735953
2014-09-03 23:30:43 -04:00
Emmanuele Bassi
c68fc27719 places-sidebar: Use asynchronous API for querying bookmarks
Removes two FIXMEs, and ensures that the places sidebar does not block
while enumerating bookmarks or application shortcuts to remote volumes.

https://bugzilla.gnome.org/show_bug.cgi?id=735953
2014-09-03 23:30:43 -04:00