Commit Graph

299 Commits

Author SHA1 Message Date
Emmanuele Bassi
1ddf204745 Fix the licensing blurb in GtkPlacesSidebar
The code is released under the terms of the LGPL v2.1+, as is the rest
of the GTK+ code.
2015-11-19 12:52:46 +00:00
Matthias Clasen
cd798d5aed places sidebar: Document style classes
Document the style classes that GtkPlacesSidebar uses on its rows.
2015-11-05 12:56:16 -05:00
Matthias Clasen
de3ad3781c placessidebar: Use an element name
Set the element name placessidebar.
2015-11-05 10:43:02 -05:00
Dominique Leuenberger
4f24c8569c placessidebar: do not crash if uris is NULL
On Drag'n'Drop actions across system boundaries (VM host to guest), the
happen to be null.

https://bugzilla.gnome.org/show_bug.cgi?id=757298
2015-10-29 17:32:13 +01:00
Carlos Soriano
0cd4e7ec43 gtkplacessidebar: improve heuristics for external drives
Since the change to use GtkPlacesView we don't want to show
internal storage on the sidebar.

In our case we were checking for drive_can_eject and
drive_is_media_removable.

However for some external hard drives it's reported that they
are not ejectable nor the have removable media. So the only
attribute that they have different from internal drives is that
they can be stopped.
So check for if the drive can be stopped to decide if it is
external or internal.

On the way realized we don't need to check for the mounts associated
with the volume to know if the volume can be ejected or not. So remove
that code.

https://bugzilla.gnome.org/show_bug.cgi?id=756589
2015-10-15 19:16:56 +02:00
Ross Lagerwall
f2b848a531 gtkplacessidebar: Show drives with removable media
Some drives have removable media that is not ejectable (e.g. a laptop's
SD card reader). Show volumes on these drives in the sidebar.

https://bugzilla.gnome.org/show_bug.cgi?id=755654
2015-10-14 17:38:25 +01:00
Carlos Soriano
ecc698a282 gtkplacessidebar: avoid to use a freed string
The string we were using is the representation of the internal text
in the popover entry. However that can be freed before setting the
bookmark label, if i.e. the row is destroyed and therefore the popover
as well.
To avoid that, duplicate the label in a local variable.

One of the consequences is that for those people using development version
we migth screwed its bookmarks file, since the bookmark manager wrote
garbage from the already freed label.

https://bugzilla.gnome.org/show_bug.cgi?id=755215
2015-09-25 16:10:32 +02:00
Carlos Soriano
5c0447fa44 gtkplacessidebar: avoid accessing destroyed popover
The row and rename popovers are always relative_to a row.
We also keep a pointer to them so we can interact with them in
callbacks.

However, if the row is destroyed its associated popovers will be
destroyed as well as relative_to destroyes and frees memory of its
associated widget when its relative_to widget is destroyed.
If we, for example, update the places while the popover is shown we are
going to access and invalid widget on the next time.

To avoid that, connect to the destroy signal of the popovers and clean
the sidebar pointers when that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=755444
2015-09-23 23:29:22 -04:00
Matthias Clasen
0db331d244 file chooser: make rows with popovers visible
Without this, the popovers are just dangling in the middle of
nowhere.

https://bugzilla.gnome.org/show_bug.cgi?id=754411
2015-09-13 22:53:42 -04:00
Matthias Clasen
0175cd8ae7 places sidebar: keep open variants sensitive
Add a separate action for "Open in Tab" and "Open in new window"
so we can keep them enabled when we disable "Open" for the selected
row.

https://bugzilla.gnome.org/show_bug.cgi?id=754410
2015-09-13 12:44:17 -04:00
Matthias Clasen
90bcde5951 places sidebar: Disable 'Open' for selected rows
If the row is selected, it is already opened, so we should not
offer the Open action anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=754410
2015-09-01 22:05:46 -04:00
Carlos Soriano
6d0edd0056 gtkplacessidebar: order mounts by label
We were not ordering them at all, and therefore they were
jumping around

https://bugzilla.gnome.org/show_bug.cgi?id=753925
2015-08-21 15:01:22 +02:00
Georges Basile Stavracas Neto
88edada0d9 placessidebar: set Other Locations uri
By assigning an URI to Other Locations item, we
can programaticaly select it. Fixes a bug in Nautilus,
where the Other Locations item is unselected imediately
after being clicked.
2015-08-18 19:34:21 -03:00
Matthias Clasen
9ecfffa830 Formatting fixes 2015-08-08 23:10:00 +02:00
Matthias Clasen
9f24b54786 Code cleanup
Use g_slist_free_full more consistently. This commit just converts
the obvious cases where g_slist_forall is directly followed by
g_slist_free.
2015-07-31 22:23:35 -04:00
Georges Basile Stavracas Neto
ea3a80c19f placessidebar: fix documentation
Use the same explanation of why GtkPlacesSidebar::show-connect-server
was deprecated and its replacements on getter and setter.

Also, fix a mistakenly deprecated function.
2015-07-28 07:03:09 -03:00
Georges Basile Stavracas Neto
e0339c5244 placessidebar: show Computer item when not in Other Locations
Previous commits removed from places sidebar the code related
to displaying the Computer item, which should be shown when
the sidebar is not displaying the Other Locations item.

Add back the item when the sidebar is not in Other Locations'
mode.
2015-07-27 12:21:36 -03:00
Matthias Clasen
69d90d4f50 places view: Documentation fixups
Rewrite gtk_places_sidebar_set_show_enter_location docs, add
references to the relevant signals, remove mentions of
GtkPlacesView from the docs, since it is not public at this point.

https://bugzilla.gnome.org/show_bug.cgi?id=752633
2015-07-25 12:11:05 -04:00
Matthias Clasen
a8512e097a Fix a typo
https://bugzilla.gnome.org/show_bug.cgi?id=752810
2015-07-24 11:28:59 -04:00
Chun-wei Fan
d9985dad5b gtk/gtkplacessidebar.c: Fix Build on C89
Ensure variables are declared at the top of the block, and remove a ';;',
which C89 compilers don't like.
2015-07-24 16:25:01 +08:00
Matthias Clasen
3243ae6e08 places sidebar: Don't leak shortcuts
Poined out by valgrind.
2015-07-21 21:00:12 -04:00
Matthias Clasen
3e6177d2dd places sidebar: Plug a memory leak 2015-07-21 19:52:54 -04:00
Matthias Clasen
1e981790de places sidebar: Improve docs
Clarify the deprecation note for ::show-connect-to-server.
https://bugzilla.gnome.org/show_bug.cgi?id=752633
2015-07-21 15:07:37 -04:00
Matthias Clasen
7a84c26d0b places sidebar: Improve the docs
Reword the docs of gtk_places_sidebar_set_drop_targets_visible().
2015-07-21 15:07:37 -04:00
Matthias Clasen
b4b46b74e5 places sidebar: Fix a copy-paste leftover
The ::populate-all nick and blurb where not referrering to this
property at all.
https://bugzilla.gnome.org/show_bug.cgi?id=752633
2015-07-21 15:07:37 -04:00
Matthias Clasen
55652b6b09 places sidebar: Improve keynav
Remove the code in the sidebar keypress handler that imperfectly
reproduces what GtkListBox already does: moving selection and
focus in response to arrow keys.
2015-07-19 22:07:21 -04:00
Matthias Clasen
bd41c92b28 trivial: Some reformatting 2015-07-19 17:39:23 -04:00
Matthias Clasen
5b5b4de495 places sidebar: Remove pointless code
No need to set or unset adjustments explicitly.
2015-07-19 17:37:39 -04:00
Matthias Clasen
7627ed8000 places sidebar: Preserve ::populate-popup functionality
We "fix" this signal the same way we did for GtkEntry and
GtkTextView: slightly change the signature so that the passed
widget may be a container other than a GtkMenu, and add a
property to explicitly opt in to receiving the signal in
this case.
2015-07-17 08:57:39 -04:00
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