Commit Graph

347 Commits

Author SHA1 Message Date
Timm Bäder
0f6d83bb5f filechooserbutton: Remove some dead code 2019-04-28 11:02:59 +02:00
Matthias Clasen
eea1388cf4 file chooser: Fix Ctrl-L
We were forwarding key events to the search entry
and unconditionally considered search started
afterwards. That is not correct, since things
like a Ctrl key press should not trigger search.
Fix this by only switching to search mode when
the event was actually consumed.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1829
2019-04-27 17:43:59 +00:00
Matthias Clasen
285293ac17 file chooser: Fix some compiler warnings 2019-04-05 05:10:26 +00:00
Carlos Garnacho
e59c6abd91 filechooserwidget: Drop usage of gtk_search_entry_handle_event()
Just use gtk_event_controller_key_forward() to let know the search
entry of the Esc key being pressed.
2019-04-03 13:23:34 +02:00
Matthias Clasen
5b5a68c5db Fix filechooser search
This makes the search entry show up again
when I type. There is still some misbehavior
where the entry loses focus again, and Escape
does not work to exit search.
2019-03-31 23:06:42 -04:00
Matthias Clasen
2ed533c3e1 file chooser: Stop using gtk_window_get_position
It is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
f13e6179e8 filechooser: Stop using ::set-focus
We can achieve the same with the focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Timm Bäder
f35b8a7541 Fix compile time warnings 2019-03-02 05:28:55 +01:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Matthias Clasen
55337c588c file chooser: Stop using ::hierarchy-changed
Use the root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
08bd6904b9 file chooser: Use editable api on the search entry 2019-02-19 00:25:59 -05:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Matthias Clasen
f3f5a896de box: Avoid position in the reorder api
Change the reorder api to insert after a sibling,
so that moving to first place becomes reorder (... NULL).

And add a insert_after api that can replace the common
container_add / reorder_after (... NULL) combination.

Update all callers.
2019-01-23 19:30:47 -05: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
fae6113ce3 filechooserwidget: Show spinner when searching
This was lost it seems
2019-01-18 19:43:49 +01: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
Matthias Clasen
b904fc6ee0 Add a missing cast
This fixes a warning introduced in the previous commit.
2018-08-29 19:55:58 -04:00
Matthias Clasen
3b8d206143 The file chooser is no box anymore
Don't treat it as one, it does not like it.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1297
2018-08-29 13:11:06 -04:00
Kai Willadsen
ba6c5ef201 FileChooserWidget: Don't show recent items with private hint set 2018-08-28 16:15:45 -04:00
Benjamin Otte
813957a92f gdk: Remove gdk_event_get_string()
You want to use an IM module to get strings out of keypresses, not some
crude hack that only works on X11 and Wayland anyway.
2018-07-30 19:32:38 +02:00
Ernestas Kulik
4b2d63167e placessidebar: Take a GdkDrag in _set_drop_targets_visible()
Since the function is usually called from GtkWidget::drag-{begin,end} handlers,
taking a GdkDrop does not work, especially given that
::drag-action-requested is emitted without checking the type.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1220
2018-07-17 19:19:14 +03:00
Carlos Garnacho
686116ba61 gtkfilechooserwidget: Forward events to filechooser through key controller
Instead of manually calling gtk_binding_set_activate_event() on an ::event
callback in the save entry.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
4186a85359 gtkfilechooserwidget: Drop usage of ::event vmethod
Use a key controller set up in the UI file instead.
2018-06-21 12:50:57 +02:00
Timm Bäder
99099a1053 Remove some unnecessary snapshot implementations 2018-06-20 20:47:18 +02:00
Benjamin Otte
b00609c21c dnd: Make drag-motion and drag-drop signals use GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
6d7cb2b781 dnd: Make drag-data-received use a GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
314eaf7d10 widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
Drag Contexts are on their way out!
2018-06-18 23:49:20 +02:00
Timm Bäder
7f9cd9f9d9 filechooserwidget: Don't chain up in ::event
GtkWidgetClass.event is NULL.
2018-05-27 16:20:55 +02:00
Matthias Clasen
c78166e190 file chooser widget: Stop using ::key-press-event
Use a generic ::event handler instead.
2018-05-21 20:20:18 -04:00
Benjamin Otte
31de97749a filechooser: Put event controllers into ui file 2018-04-26 17:59:41 +02:00
Matthias Clasen
19bd57ed1f file chooser: Use a key event controller
We want to get rid of ::key-press-event.
2018-04-05 19:26:53 +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
Daniel Boles
9aedafa39e FileChooserWidget: Fix leaks in .get_subtitle()
Now that subtitle's default value "Searching" for OPERATION_MODE_SEARCH
is duplicated as it should be, we cannot reassign other strings to it
anymore, as that resulted in the original dupe of "Searching" leaking.

Fix this by only assigning the dup'd "Searching" after trying to get
more specific values, not before. We therefore need to set it to NULL
during its declaration, and that means we needn't in the final else.
2018-03-13 00:20:17 +00:00
Daniel Boles
fc9dc97430 FileChooserWidget: Avoid crash freeing static str
Having a FileChooserDialog in location-entry mode then pressing
<primary>f to move to search mode would crash with an invalid free().

In that case, FileChooserWidget.get_subtitle() returned a static string
straight from gettext. This crashed when the GBinding from :subtitle to
FileChooserDialog’s HeaderBar:subtitle shortly tried to free the string.

Fix by duplicating the string before returning it, like all other paths.

https://bugzilla.gnome.org/show_bug.cgi?id=791004
2018-03-12 23:07:50 +00:00
Timm Bäder
94493414b5 filechooserwidget: Make the location entry hexpand 2018-02-25 16:47:20 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Matthias Clasen
270b6d3a84 file chooser: Use a multipress gesture
This replaces the use of ::button-press-event. There's two
issues with this commit:
1) We don't have a good way to do the equivalent of
   gdk_event_triggers_context_menu with gestures
2) We have to defer to and idle to avoid ordering
   issues with the treeviews own gestures
2018-01-16 14:14:10 -05:00
Matthias Clasen
c8a6a1138b Revert "file chooser: Allow activating without double-click"
This reverts commit fb0a13b7f0.

It is getting in the way of gesture conversion, and didn't
really make anybody happy anyway.
2018-01-16 14:14:10 -05:00
Matthias Clasen
4908b5ef54 Fix file chooser
Now that the places sidebar is private, we need to
ensure the type is known.
2018-01-09 17:20:23 -05:00
Matthias Clasen
9a3b61ec9d Drop GtkPlacesSidebar from public API
This is a bit of filechooser internals that gets shared with
nautilus, which is fine, but it shouldn't be part of our
public API. There are no other users than nautilus.
2018-01-08 14:38:55 -05:00
Benjamin Otte
234d34366a clipboard: Add the useful stuff from reverted commit
This is the parts of dc50e0637f that
should have been committed but were reverted in
b5c62cf86f to unbreak the build.
2017-12-10 01:09:14 +01:00
Matthias Clasen
b5c62cf86f Revert "clipboard: Add gdk_clipboard_set()"
This reverts commit dc50e0637f.

This broke the build.
2017-12-04 23:09:54 -08:00
Benjamin Otte
dc50e0637f clipboard: Add gdk_clipboard_set()
This API allows specifying a GType and va_args of a value of that type
to set the clipboard contents. This massively simplifies setting weird
object types into the clipboard.
2 example patches included in this patch are the GtkTextBuffer and the
file list in the file chooser.

Using gobject-introspection, this should work without specifying the
type, so that you can literlally say
  clipboard.set ("Hello World")
or
  clipboard.set (pixbuf)
which is why I've also marked all other setters as (skip). They just
exist in C as wrappers for type safety reasons.
2017-12-05 05:29:03 +01:00
Benjamin Otte
4658d7ea54 dnd: Remove x/y coordinates from drag-data-received
This is in preparation of using input streams to show that these
coordinates aren't needed most of the time and can otherwise be saved
during GtkWidget::drag-drop.
2017-12-05 05:29:00 +01:00
Benjamin Otte
ca96fac488 filechooserwidget: Port to new clipboard
We use the new GDK_TYPE_FILE_LIST here.
2017-12-03 05:46:48 +01:00