Commit Graph

277 Commits

Author SHA1 Message Date
Matthias Clasen
133461581f Merge branch 'BUG_filechooserbutton_remote_GTK4' into 'master'
FileChooserButton: query 'display name' also for unbookmarked files

Closes #1966

See merge request GNOME/gtk!1725
2020-05-22 21:37:40 +00: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
cd0081d08a Use gtk_window_destroy
Replace calls to gtk_widget_destroy on windows
with gtk_window_destroy.
2020-05-11 12:20:57 -04:00
Matthias Clasen
03f145e868 filechooserbutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -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
Matthias Clasen
2ddff872cd css: Drop the -gtk-icon-theme property
We want to always use the current icon theme, and only
have the minimum amount of custom properties.
2020-04-22 12:35:30 -04:00
Matthias Clasen
98611735ec Stop using the -gtk-icon-theme style property
We want to just use the current icon theme, always.
2020-04-22 12:35:22 -04:00
Nelson Benítez León
13506e36aa FileChooserButton: query 'display name' also for unbookmarked files
Do also the async file info query for remote files when they
are not bookmarked, because otherwise "None" will be shown as
file name (and fallback text generic icon will be used).

The remote file was already browsed by the file chooser
instance when selecting it, so querying the display name
again should be using gio cache and not be slow.

Even if it's were slow it's better than showing 'None'
which makes it seem as if nothing was selected.

Fixes #1966
2020-04-19 16:59:33 -04:00
Matthias Clasen
d53f3a54b1 filechooser: Cosmetic doc changes 2020-04-17 20:08:21 -04:00
Matthias Clasen
61f21fc9e9 filechooserbutton: Make dialog modal by default
This is the expected behavior, so default to it.
2020-04-13 00:12:30 -04:00
Matthias Clasen
9e068d3a46 filechooserbutton: Drop the Private struct 2020-04-12 23:57:49 -04:00
Matthias Clasen
2aa136a19c Add a GtkFileChooserButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-12 23:45:03 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -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
Emmanuele Bassi
ff6772fd98 Remove preview widget from GtkFileChooser
The preview widget harks from a platform before time, when we didn't
have GIO, or a thumbnail specification.

Very few applications use it correctly, if at all; it has an horrid hack
to deal with the ownership of the widget's instance when accessed
through the getter function; it messes up the layout of the widget and
its label is less than useful when it comes to file names longer than a
dozen characters; it's a poor substitute for a proper thumbnail view.
2020-02-22 16:39:01 +00:00
Emmanuele Bassi
4a3742979d Remove GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
We don't need a whole separate action, now that the file chooser widget
can create folders; we can create use SELECT_FOLDER and create one.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
b09e7df81b Remove GtkFileChooser:local-only
Now that the whole API goes through GFile we don't have the weird split
between local-only and non-local-only modes.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
516eab5c43 Remove GtkFileChooser:show-hidden
This is a user setting and a user action, not something that ought to be
programmatically set via the file selection API.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
063ad28b1a Remove overwrite confirmation machinery from GtkFileChooser
Overwrite confirmation should not be optional, and it should not loop
into application code to create their own dialog and user response.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
d505573ee6 Drop GtkFileChooser:extra-widget
We have "choices" as a more rational (and portable) API; additionally,
the ownership semantics of the extra widget property getter are a hack.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
5f070ff233 Remove filename/URI API from GtkFileChooser
GtkFileChooser's API predates GIO by a few years, so it started off with
filenames and URI as character arrays. After introducing GIO as a
dependency, the API included GFile-based entry points.

It's much more appropriate to use GFile everywhere, as we want to
encourage people to use GIO instead of passing random bytes to low level
POSIX API.

See: #2455
2020-02-22 15:22:06 +00: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
Benjamin Otte
546a748cd8 widget: Replace style-updated signal with css_changed vfunc
1. Rename the thing
2. Turn it from a signal to a vfunc
3. Pass the GtkCssStyleChange to it

We don't export any public API about the GtkCssStyleChange yet, it's
just a boring opaque struct.
2020-02-05 02:46:13 +01:00
Matthias Clasen
5206a92522 Update all callers 2020-01-08 18:48:22 -05:00
Matthias Clasen
b59c70aaeb filechooserbutton: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
e9067ae2db Replace gtk_drop_target_attach/detach
Since drop targets are now just event controller,
gtk_widget_add/remove_controller works just fine
for them.
2020-01-08 18:48:21 -05:00
Matthias Clasen
46f42fc53d droptarget: Drop defaults flags
These no longer have any effect.

Update all callers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
17131f1137 filechoserbutton: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
6255dcd8ec filechooserbutton: Be smarter about 'None'
Don't refilter the model while the combo box is popped up,
that wreaks havoc with layout and does not really work.
Instead, repurpose one of the separator rows for the 'none'
case. This works because the row separator function is not
consulted for the cellview in the button.
2019-12-29 17:10:16 -05:00
Timm Bäder
49887d4c81 filechooserbutton: Only destroy existing native dialogs 2019-10-09 16:57:22 +02:00
Timm Bäder
d032396031 filechooserbutton: Add icon to default (None) combo box item
See #2118
2019-09-25 17:51:52 +02:00
Timm Bäder
12438b30a0 filechooserbutton: Remove priv->child
We never use it except when updating the state flags, but we can as well
do that for both children.
2019-09-25 17:51:52 +02:00
Timm Bäder
ea1ff9c482 filechooserbutton: Remove an outdated comment
The path used is wrong but the string isn't used in the testsuite
anyway.
2019-09-25 17:51:52 +02:00
Timm Bäder
ce72154913 Rename gtkbookmarkmanager.h to gtkbookmarksmanagerprivate.h
It's a private type, so gets a private header file name.
2019-09-11 08:12:31 +02:00
Daniel Boles
a03e531772 FileChooserButton: Document the CSS nodes & class
The only glancing mention of this we had was that GtkButton mentioned it
in passing when discussing how `button` could get contextual classes,
and even that's not relevant in master anymore... so drop it from there.
2019-06-20 20:51:37 +01:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
948347afa9 Stop using gtk_widget_is_toplevel 2019-05-28 20:25:16 +00: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
6a7bf78b15 file chooser button: Make final 2019-05-28 02:40:08 +00:00
Emmanuele Bassi
59c6862a03 Use gtk_widget_class_set_layout_manager_type()
Instead of manually creating the layout manager inside the instance
initialization function, we can let GtkWidget do that for us.
2019-05-06 12:06:27 +01:00
Timm Bäder
d702bfe7b7 filechooserbutton: Clean up finalize & destroy 2019-05-03 20:06:25 +02:00
Timm Bäder
596c9a3c0b filechooserbutton: Clear model in destroy()
Since we're destroying priv->chooser right after. We can't wait until
finalize() since clearing the model will try to work with priv->chooser.
2019-05-03 20:06:23 +02:00
Timm Bäder
c675d1c9e1 filechooserbutton: Use a bin layout 2019-05-03 20:06:10 +02: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
Bastien Nocera
5a6a7b50af all: Don't warn about deprecated gtk_window_present usage
Avoid compilation warnings about internal users of gtk_window_present().
2019-02-25 17:38:08 +01:00
Emmanuele Bassi
1668496359 docs: Fix GTK links and locations 2019-02-06 10:39:27 +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
Benjamin Otte
6d7cb2b781 dnd: Make drag-data-received use a GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
5b0a6a52c1 dnd: Get rid of gtk_drag_finish()
It's just a wrapper around gdk_drag_finish(), so use that one instead.
2018-06-18 23:49:20 +02:00