Commit Graph

219 Commits

Author SHA1 Message Date
Matthias Clasen
9be0b3d76f application: Stop extracting accels from menus
This functionality has been superseded by
gtk_application_set_accels_for_action in GTK3,
and we don't want to carry it forward in GTK4.
2019-06-21 22:47:40 -04:00
Matthias Clasen
ef031e1a9d Allow registering actions per-class
Add a facility to register and install actions
at class init time. The intended use for these
actions is for

a) context and other model-based menus
b) key bindings

Most of these actions are going to be stateless,
so add separate apis for the simple and stateful
cases.

We avoid creating an action group for these by
teaching the action muxer about these actions.
The action muxer also maintains the enabled
state for these actions.
2019-06-18 14:47:33 -04:00
Matthias Clasen
9b62da10e6 Give the action muxer a widget
This will be used in the future to obtain
widget class actions.
2019-06-18 06:12:50 -04:00
Christian Hergert
4a954a9a1c gtkapplication: track changes to profiler D-Bus API
Recently, to make things more forward-portable, Sysprof and Mutter altered
the API for org.gnome.Sysprof3.Profiler. This tracks those changes.
2019-06-06 17:24:33 -07:00
Christian Hergert
bd26cce812 gtk: rely on default marshallers
Similar to previous removals of g_cclosure_marshal_VOID__VOID we can remove
other marshallers for which are a simple G_TYPE_NONE with single parameter.
In those cases, GLib will setup both a c_marshaller and va_marshaller for
us. Before this commit, we would not get a va_marshaller because the
c_marshaller is set.

Related to GNOME/Initiatives#10
2019-05-30 20:56:50 -07:00
Matthias Clasen
68f2cd1f09 Trivial: Remove a few +'s 2019-05-19 15:29:04 +00:00
Matthias Clasen
599806ca82 Try again to fix profiler setup
We were trying to store the profiler_id
in a struct that does not exist at the time.
Store it somewhere else.
2019-05-14 20:09:44 +00:00
Matthias Clasen
c009611401 Fix registration of profiler DBus api 2019-05-14 12:06:55 +00:00
Matthias Clasen
cb51699098 profiler: Update the D-Bus interface name
Sysprof is bumping its name to Sysprof3, so
lets change to that before this gets used.
2019-05-08 16:49:47 +00:00
Matthias Clasen
18127be3bd GtkApplication: Add a profiler dbus api
Implement the org.gnome.Sysprof2.Profiler D-Bus
api to let sysprof start and stop tracing at runtime,
and get the data directly, via a passed fd.
2019-05-07 09:37:59 -07:00
Matthias Clasen
d006ee65f5 application: Add a query-end signal
This lets us take just-in-time inhibitors, and makes
the session support a little more real.
2019-02-19 00:56:31 -05:00
Emmanuele Bassi
1668496359 docs: Fix GTK links and locations 2019-02-06 10:39:27 +01:00
Timm Bäder
8de1ba2cc4 application: Remove dead assignment 2018-12-04 06:30:47 +01:00
Matthias Clasen
2bb97bc136 GtkApplication: Improve the docs
Expand the docs for ::register-session a bit.
2018-08-31 13:38:01 -04:00
Matthias Clasen
b82a32676b GtkApplication: track screensaver state
A number of applications want to track the state of the screensaver.
Make this information available as a boolean property. We only listen
for state changes when ::register-session is set to TRUE.

This is implemented for unsandboxed D-Bus access by talking
directly to org.gnome.ScreenSaver or org.freedesktop.ScreenSaver,
and for sandboxed D-Bus by using a (new) portal API.
A Quartz implementation is missing.
2018-08-30 22:53:36 -04:00
Timm Bäder
6b4709ea3c GtkApplication: Remove priv pointer 2018-07-08 09:41:15 +02:00
Mario Sanchez Prada
07d6c53346 application: Complete startup notification sequence for remote invocations
When a remote instance of a GTK application implementing the Startup
Notification protocol gets spawned it will pass the startup sequence
ID as "platform data" to the main instance. Thus, we need to make sure
that the startup sequence gets completed in that case, since the remote
instance won't do it by itself, since it won't map any top level window.

Checking for this "platform data" in the implementation of the after_emit()
virtual method in the primary instance should be a good place to do so, since
the existence of such data proves that a remote instance has been spawned.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Mario Sanchez Prada
479c341545 application: Use the new API to get the startup notification ID
The DESKTOP_STARTUP_ID gets cleared early after the process is spawned,
meaning that it's too late at add_platform_data() to pick it up and send
it over to the primary instance, as it will be always unset at that point.

To solve this, we use the new gdk_display_get_startup_notification_id()
method to pull the startup notification ID for the application, if present,
out of the display and pass it over to that primary instance.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +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
Matthias Clasen
b12371e1b0 application: Stop using ::focus-in-event
We are really interested in the active window, so use
that property directly.
2018-01-16 14:14:10 -05:00
Benjamin Otte
2d5c82b4ec gtk: Remove GtkClipboard 2017-12-03 05:46:49 +01:00
Benjamin Otte
4cce109e16 application: Put shared code into a common function 2017-12-03 05:46:48 +01:00
Matthias Clasen
65808418e1 Drop gtk_application_is_inhibited
This function returns global session state that may
not be available to applications (e.g. in sandboxed
environments), and is not needed by applications,
so just drop it, instead of keeping a function around
that can't be guaranteed to work.
2017-11-28 23:02:58 -05:00
Matthias Clasen
4371f370bc Improve the docs
Document that gtk_application_is_inhibited can't
be guaranteed to work.
2017-11-28 22:52:44 -05:00
Matthias Clasen
2ff175938d application: Append a / to the icon resource path
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting  a '/' there to begin with.
2017-11-13 07:35:18 -05:00
Arun Raghavan
4b1853b32f gtkapplication: Mark gtk_application_get_active_window() as nullable
https://bugzilla.gnome.org/show_bug.cgi?id=784888
2017-07-18 14:03:59 -04:00
Matthias Clasen
2c7e567f05 Update callers
Adapt all our tests and examples to the new initialization api.
2017-01-19 13:50:17 -05:00
Matthias Clasen
63d6e2d8e2 Don't export gtk_get_option_group
We want to get rid of commandline option handling in GTK+.
This is a step in that direction.
2017-01-19 13:21:12 -05:00
Timm Bäder
e0d50233f6 gtkapplication: Remove deprecated API 2016-10-18 00:29:19 +02:00
Sébastien Wilmet
554de0be2a app: replace private accels functions by get_application_accels()
It's like gtk_application_get_action_muxer().

https://bugzilla.gnome.org/show_bug.cgi?id=764879
2016-04-22 12:43:27 +02:00
Sébastien Wilmet
3b988ce523 app: share function to normalise detailed action name
Put the function in gtkactionmuxer.c, where
gtk_print_action_and_target() is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=764879
2016-04-22 12:40:08 +02:00
Sébastien Wilmet
bce4a0abde app: extract GtkApplicationAccels private class
This has several benefits:
- Less code in GtkApplication. The accels handling is something
  self-contained, and GtkApplication now delegates the work.
- For the accels functions, there is now a distinction between static
  functions and functions in the gtkapplicationaccelsprivate.h header,
  which makes the code easier to understand, because we have a good
  overview just by reading the header.
- The struct _GtkApplicationPrivate is now easier to find instead of
  being in the middle of the file.

https://bugzilla.gnome.org/show_bug.cgi?id=764879
2016-04-22 12:39:18 +02:00
Sébastien Wilmet
e0c34fd028 app: write higher-level gtk_application_accels static functions
These will become the functions present in the
gtkapplicationaccelsprivate.h header.

The gtk_application_accels functions deal with detailed_action_name's
instead of action_and_target's. action_and_target is an implementation
detail of Accels.

The added function prototype is temporary, it'll be removed in a later
commit.

https://bugzilla.gnome.org/show_bug.cgi?id=764879
2016-04-22 12:38:56 +02:00
Sébastien Wilmet
f9ba55eaad app: add missing g_returns
And have the g_returns in the same order as the function parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-12 20:32:49 +02:00
Sébastien Wilmet
ee58a52a61 app: minor code improvements
- use GDK_EVENT_PROPAGATE
- pass better zero-values to gtk_init(), since the parameters are
  pointers.

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
1f87c1cc0b app: improve code of extract_accels_from_menu()
sub_model is clearer than "m". And we don't use the key, so we can pass
NULL instead.

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
687d3eb48f app: use g_set_object()
https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
29971b0cc9 app: don't use deprecated function
gtk_application_add_accelerator() is deprecated, but was still used
inside IGNORE_DEPRECATIONS's.

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
399e8db336 app: improve doc of gtk_application_get_window_by_id()
https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
40e40b7ffc app: improve doc of gtk_application_set_accels_for_action()
When reading the API for the first time I didn't know what was the
"detailed" action name.

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:07 +02:00
Sébastien Wilmet
48afd8a5f0 app: avoid code duplication for setting accels
The implementation of the deprecated functions is now based on the
non-deprecated gtk_application_set_accels_for_action().

https://bugzilla.gnome.org/show_bug.cgi?id=764846
2016-04-10 16:54:06 +02:00
Sébastien Wilmet
6db7de3f7b app: fix indentation
And add missing curly braces.
2016-04-09 18:54:42 +02:00
Sébastien Wilmet
b3dc473057 docs: trivial fixes in GtkApplication-related documentation 2016-04-09 09:45:33 +02:00
Timm Bäder
aeed695e26 gtkapplication: _get_app_menu can return NULL 2016-03-28 18:18:20 +02:00
Matthias Clasen
cb738bc201 Remove private clipboard api from public headers 2016-03-26 23:17:53 -04:00
Phillip Wood
934b3f6865 Document that GtkApplication loads gtk/menus-common.ui
Add a comment about the resource gtk/menus-common.ui to the
documentation of the other resources loaded by GtkApplication.

https://bugzilla.gnome.org/show_bug.cgi?id=761432
2016-02-18 14:11:14 +00:00
Phillip Wood
c38c3361ca Document help overlay action name in GtkApplication
This means all the information needed to automatically load a
shortcuts window and create a menu item to show it is in one place.

https://bugzilla.gnome.org/show_bug.cgi?id=761431
2016-02-18 14:11:14 +00:00
Allison Ryan Lortie
0d109867d2 Tweak startup-notification after the first window
Presently, Gtk will only send a startup notification completion message
for the first window that is shown.  This is not good for the case of
GtkApplication, where we are expected to participate in
startup-notification for all windows.

We have avoided this problem by manually emitting the startup complete
message from after_emit in GtkApplication.

Unfortunately, this causes problems for windows that are shown with a
delay.  It is also a dirty hack.

The reason for the original behaviour is simple: there is a static
boolean in gtkwindow.c which controls it.  We remove this.

Instead, clear the startup notification ID stored in GDK when sending
the completion message.  GtkApplication will re-set this the next time
an event comes in which needs startup-notification handling.  In the
non-GtkApplication case, newly shown windows will still not send the
message, since the cookie will have been cleared.

Finally, we remove the hack from GtkApplication's after_emit.

This will probably cause some regressions in terms of lingering startup
notification messages.  The correct solution here is to always use
gtk_window_present(), including when merely opening a new document (with
a new tab, for example).

https://bugzilla.gnome.org/show_bug.cgi?id=690791
2016-01-27 18:14:40 +01:00
Matthias Clasen
0049be4e58 application: Protect against double shutdown
It is not something that can happen normally.
But if it does, we shouldn't crash.

https://bugzilla.gnome.org/show_bug.cgi?id=760680
2016-01-15 17:37:55 -05:00