Commit Graph

216 Commits

Author SHA1 Message Date
Matthias Clasen
053223bf65 pathbar: Stop using GtkFileSystem
This is just a thin wrapper around some gio functionality
these days, and we want to get rid of it.
2020-07-12 09:12:43 -04:00
Matthias Clasen
f1ad883e00 pathbar: Drop the Private struct 2020-07-11 17:23:55 -04:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00
Matthias Clasen
af6e0ee2b3 Use gtk_button_set_child throughout
Replace all uses of gtk_container_add on buttons
by gtk_button_set_child.
2020-05-04 22:53:07 -04:00
Benjamin Otte
394955cceb pathbar: Don't do the same thing twice.
Don't do the same thing twice.
2020-03-06 05:53:20 +01:00
Benjamin Otte
e356d59a92 build: Add -Wnull-dereference
Sprinkle various g_assert() around the code where gcc cannot figure out
on its own that a variable is not NULL and too much refactoring would be
needed to make it do that.

Also fix usage of g_assert_nonnull(x) to use g_assert(x) because the
first is not marked as G_GNUC_NORETURN because of course GTester
supports not aborting on aborts.
2020-03-05 08:14:37 +01:00
Timm Bäder
b1d4d24c7b pathbar: Inherit from GtkWidget 2020-02-25 11:08:25 +01:00
Timm Bäder
e1ca83ddbd pathbar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Matthias Clasen
b2226ea1e3 gtk: Stop using GtkEventButton
Same as the previous commit. All events are
just GdkEvents now.
2020-02-21 00:51:03 -05:00
Benjamin Otte
8d2ed36a1b contentprovider: Add gdk_content_provider_new_typed()
Gets around the boilerplate required to create and initialize a GValue
by having this function doing it via G_VALUE_COLLECT().
2020-02-16 20:10:30 +01: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
Timm Bäder
b7ee2cbc28 Start using GtkWidget's new style class API 2020-02-07 13:16:32 -05:00
Benjamin Otte
8722837e67 pathbar: Remove unneeded code
The icons here are GIcons, they don't depend on the theme.
2020-02-05 00:18:41 +01:00
Benjamin Otte
af6128b3ab Remove gtkwidgetpath.h include where no longer needed 2020-01-28 02:17:02 +01:00
Matthias Clasen
c3f1ff7db4 pathbar: Use a css name insead of a style class
Use pathbar for GtkPathBar in css, instead of the
previous .path-bar. Update Adwaita to match.
2020-01-22 23:56:22 -05:00
Matthias Clasen
134fca47e3 pathbar: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
e8b830a3dd dragsource: Reshuffle api a bit
Remove arguments from the constructor.

For actions, we now default to COPY, which is the most common one
that we should enable by default (MOVE requires handling deletion
on the the source side, and ASK only makes sense if we have
multiple actions).

For the content provider, we add a new ::prepare signal where
it should be provided just-in-time.
2020-01-08 18:48:21 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
24ef9df0f1 pathbar: Convert to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
965d0e04d1 gtk: Use root/unroot instead of display-changed
The display-changed signal is going away
2019-05-02 01:33:41 +00:00
Timm Bäder
bd71e744d2 Stop using gtk_box_pack_end
It might soon go away!
2019-01-23 19:30:46 -05:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Ernestas Kulik
edc4b2f7d0 eventcontrollerscroll: Conditionally propagate ::scroll
Currently, gtk_event_controller_scroll_handle_event() always returns
TRUE if it is handled, which stops the propagation of the event. If
there’s a single GtkEventControllerScroll in the widget hierarchy, that
means that no others will run, depending on the propagation phase. In
Nautilus, this can be observed when adding a scroll controller to the
GtkScrolledWindow (ctrl-scrolling controls the zoom level) - either the
scrolling or the zooming breaks.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/45
2018-11-12 10:35:37 +01:00
Timm Bäder
ff2ba52bc6 pathbar: Remove priv pointer 2018-08-05 10:22:10 +02:00
Matthias Clasen
7733f646d6 gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop.

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Timm Bäder
417b1d8335 pathbar: Remove unused define 2018-06-20 07:48:54 +02:00
Benjamin Otte
9a91d3739d widget: Remove time argument from drag_data_get() vfunc 2018-06-18 23:49:53 +02:00
Benjamin Otte
74dbb057ed eventcontrollerscroll: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Matthias Clasen
2f6f8a7e6f path bar: Drop non-functional hold-to-scroll code
Scrolling a path bar is of marginal usefulness - you need to
find a really deep place in your filesystem hierarchy in order
to scroll one or two places at best. And the code we had for
this was not working. And it was using legacy event handlers.
Instead of fixing it, remove it.
2017-12-12 20:49:31 -05:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Matthias Clasen
dbfaa99107 image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.

Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
2017-11-15 19:07:17 +01:00
Benjamin Otte
648d040395 widget: Remove gtk_widget_get_screen()
Replace the remaining users with "correct" code that does not need that
function anymore.
2017-10-31 08:25:37 +01:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
Federico Mena Quintero
559d32420c GtkPathBar: Centralize handling of outstanding cancellables
The path bar would crash if we disposed it before all pending I/O
operations had finished.  Now we remember all the outstanding
operations directly in the GtkPathBarPrivate, and deal with them
consistently.
2017-10-27 17:18:38 -05:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
f3474645c4 gtkpathbar: Use scroll event controller 2017-09-19 18:40:49 +02:00
Matthias Clasen
3b266de66c path bar: Use GdkEvent API 2017-09-19 18:39:03 +02:00
Carlos Garnacho
c48a196d77 filechooser: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
6b9d10039d pathbar: Compute widget clip directly
Instead of relying on gtk_widge_set_simple_clip
2017-07-19 21:27:14 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Carlos Garnacho
28b1c9cc3d gtkpathbar: Remove event window
This is not necessary anymore to receive scroll events.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Timm Bäder
c92b7d4224 box: Remove fill child property
GtkWidget:halign and GtkWidget:valign are sufficient
2017-04-25 20:30:37 +02:00