Commit Graph

457 Commits

Author SHA1 Message Date
Matthias Clasen
a6a7799dc5 placessidebar: Remove SECTION
Its private, no need.
2021-03-11 16:37:37 +00:00
Alexander Mikhaylenko
f63e6394ac dragsource: Use double coordinates for checking drag threshold
If multiple nested widgets have drag sources on them, both using bubble
phase, we need to reliably pick the inner one. Both of them will try to
start dragging, and we need to make sure there are no situations where the
outer widget starts drag earlier and cancels the inner one.

Currently, this can easily happen via integer rounding: start and current
coordinates passed into gtk_drag_check_threshold() are initially doubles
(other than in GtkNotebook and GtkIconView), and are casted to ints. Then
those rounded values are used to calculate deltas to compare to the drag
threshold, losing quite a lot of precision along the way, and often
resulting in the outer widget getting larger deltas.

To avoid it, just don't round it. Introduce a variant of the function that
operates on doubles: gtk_drag_check_threshold_double() and use it instead
of the original everywhere.
2021-01-29 12:01:34 +05:00
Jonas Ådahl
2cddec7798 gtk/popover: Use gtk_popover_present() instead of going via GtkNative
This makes it more explicit that managers of popovers make it "present".
2020-12-07 20:37:29 +01:00
Matthias Clasen
ddbea8feda Remove GtkPlacesOpenFlags from public headers
The GtkPlacesOpenFlags enum is only used in private
API, so move it to private headers. Since we still need
a GType for it, add gtkplacessidebarprivate.h to the
headers we use for generating private enum types. In turn,
this registers the other private enums in that header, so
take the opportunity to fix their naming, and use the
generated types for the corresponding sidebarrow properties.

Fixes: #3337
2020-11-09 08:45:36 -05:00
Timm Bäder
eca3eab96f Remove unneeded gtkstylecontext.h includes 2020-10-14 15:06:12 -04:00
Jan Alexander Steffens (heftig)
fb0c062506 gtkplacessidebar: Disconnect and unref cloud_manager in dispose
The manager's providers-changed signal can fire after the sidebar has
been freed. Make sure we disconnect the sidebar from the manager.

https://bugs.archlinux.org/task/57984
https://bugs.archlinux.org/task/68123
2020-10-07 15:16:31 -04:00
Matthias Clasen
22257b124a placessidebar: Remove a pointless restriction
The sidebar was refusing to show shortcuts for
things that don't have a local path, for no
good reason.
2020-09-13 01:14:00 -04:00
nana-4
1948f8a07f placessidebar: Remove unused frame
We've always removed this with Adwaita.
2020-08-22 09:23:52 +09:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
nana-4
19c2cc1296 placessidebar: Replace hard-coded margins with theme
So we can easily adjust the widget sizing in the theme.
2020-08-15 22:46:31 +09:00
Matthias Clasen
cce3ff6f04 placessidebar: Use the .navigation-sidebar style class 2020-08-13 16:30:21 -04:00
Matthias Clasen
dbbc9b5c58 placessidebar: Fix dnd cancellation
When the drag is canceled by being dropped outside,
we get a ::cancel emission, that we want to handle
just like ::dnd-finished.

Fixes: #3037
2020-08-08 14:26:31 -04:00
Matthias Clasen
e18de295c6 placessidebar: Fix the bookmark drag icon
Just use the widget; a paintable only works if the
widget it is based on actually gets drawn, the
clone we create here wasn't.
2020-08-08 14:24:45 -04:00
Matthias Clasen
4eaf08e964 placessidebar: Fix bookmarks dnd
We were not handling drops of bookmarks correctly,
leading to criticals during DND.

Fixes: #3037
2020-08-08 14:11:29 -04:00
Matthias Clasen
2d5b44703c placessidebar: We're not a listbox anymore
The placessidebar used to derive from GtkListBox,
but it doesn't anymore. There was one case leftover,
leading to criticals during bookmark DND.
2020-08-08 14:11:29 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
c55dd104d4 placessidebar: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
0210850e86 Reduce includes of gtkfilesystem.h
Move a few non-filesystem helpers to gtkfileutils.h,
and drop the include in all the places where it isn't needed.
2020-07-12 09:12:43 -04:00
Matthias Clasen
57a225681c filechooser: Add gtk_file_chooser_get_shortcuts
Replace gtk_file_chooser_list_shortcuts with a new
api that returns a list model.

Update all callers.
2020-07-06 11:03:48 -04:00
Matthias Clasen
386b63b85d scrolledwindow: Don't take adjustments in new()
In 99.9% of all cases, these are just NULL, NULL.
So just do away with these arguments, people can
use the setters for the rare cases where they want
the scrolled window to use a different adjustment.
2020-06-24 11:25:09 -04:00
Matthias Clasen
e5d6bb68ce Fix another cloudprovider include 2020-06-17 16:19:55 -04:00
Corentin Noël
27925fcb0e placessidebar: Fix build with libcloudproviders
Make it build with cloudproviders=true as the GtkPopover API for menus is now in GtkPopoverMenu.

Fix some leaks while looking at the code.
2020-06-08 10:40:46 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
75d9310986 Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
2020-05-17 17:17:31 -04:00
Matthias Clasen
88141103cd Don't use container api on GtkListBox 2020-05-11 22:21:39 -04:00
Matthias Clasen
d06cdf6318 droptarget: Fix confusion around ::leave signal
The leave signal should not take any arguments,
don't pass the GdkDrop. Update the documentation,
fix the emission and update users to match.

This was showing up as crash when dragging files
over the places sidebar.
2020-05-08 08:50:44 -04:00
Matthias Clasen
67759d4c3e Use gtk_scrolled_window_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_scrolled_window_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
8e261056b9 Use gtk_popover_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_popover_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
0ee58e9ef4 gtk: Port widgets away from gtk_get_current_ apis
Use the event controller equivalents where needed.
This commit covers the simple cases.
2020-04-11 17:29:27 -04:00
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Matthias Clasen
a197b202b8 places sidebar: Fix the popovers
We need to check-resize the popovers.
2020-03-21 18:28:57 -04:00
Benjamin Otte
a411959c91 droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.

Highlights:

- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
  GtkDropTarget is the simple one that only works with GTypes and offers
  a synchronous interface.
  GtkDropTargetAsync retains the full old functionality and allows
  handling mime types.

- Drop events are handled differently
  Instead of picking a single drop target and sending all DND events to
  it, every event is sent to every drop target. The first one to handle
  the event gets to call gdk_drop_status(), further handlers do not
  interact with the GdkDrop.
  Of course, for the ultimate GDK_DROP_STARTING event, only the first
  one to accept the drop gets to handle it.
  This allows stacking DND event controllers that aren't necessarily
  interested in handling the event or that might decide later to drop
  it.

- Port all widgets to either of those
  Both have a somewhat changed API due to the new event handling.
  For the ones who should use the sync version, lots of cleanup was
  involved to operate on a sync API.
2020-03-02 03:18:55 +01:00
Benjamin Otte
f4ac74795c placessidebar: Don't use the GdkDrag
First, it should have been a GdkDrop, but even then, proper DND code
should not rely on internals.

It's only been used in an unused signal emission anyway.
2020-03-02 03:18:55 +01:00
Piotr Drąg
810d567cc9 placessidebar: Fix a couple of typos and thinkos in menu labels 2020-03-01 15:05:28 +01:00
Krzesimir Nowak
8df045537e Fix a typo in gtkplacessidebar.c
Some mistyped vim command got into the code in commit 60d2813247.
2020-02-27 10:02:56 +00:00
Matthias Clasen
b5bacb3be6 Drop the margin property
Replace it with margin-start, -end, -top, -bottom throughout.
2020-02-25 20:59:04 -05:00
Timm Bäder
60d2813247 placessidebar: Convert popover menu to proper GtkPopoverMenu 2020-02-25 11:08:23 +01:00
Timm Bäder
995277f57d placessidebar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Matthias Clasen
a43d13aa74 popover: Drop ::relative-to
It is enough to just set the parent (and make the parent
call gtk_native_check_resize in size_allocate).

This commit removes the relative_to argument to the
constructors of GtkPopover and GtkPopoverMenu, and
updates all callers.
2020-02-24 20:46:41 -05:00
Matthias Clasen
7f46b25c04 Merge branch 'wip/ebassi/filechooser-new' into 'master'
Clean up the GtkFileChooser API

Closes #2455

See merge request GNOME/gtk!1454
2020-02-24 00:32:23 +00:00
Benjamin Otte
a62d78bf70 selection: Remove GtkSelectionData 2020-02-23 01:59:00 +01:00
Emmanuele Bassi
ebd23737c0 Remove GtkPlacesSidebar:local-only
We don't use it any more in GtkFileChooserWidget.
2020-02-22 15:22:06 +00:00
Benjamin Otte
1145da3ea5 placessidebar: Modernize DND
No more shooting pointers through pipes
2020-02-17 21:56:16 +01:00
Benjamin Otte
f5e3584b5b placessidebar: Don't claim to support text dnd
Because you don't. And never did.
2020-02-17 04:04:21 +01:00
Benjamin Otte
80ba7fd682 dragdest: Make gtk_drop_target_new() args be transfer full
Saves tons of code.
2020-02-17 04:04:21 +01:00
Emmanuele Bassi
cdd7e4c5ec Add a notify function to GdkContentProvider
The callback-based content providers need a GDestroyNotify function to
free the data passed to them on construction, otherwise they are going
to leak.
2020-02-13 14:53:25 +00:00
Timm Bäder
655711fef2 Rename gtk_widget{get,set,has}_style_class to _css_class
We want to use css instead of style everywhere now.
2020-02-07 13:16:45 -05:00