Commit Graph

48 Commits

Author SHA1 Message Date
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Matthias Clasen
79d6a77d58 gtkapplication: Drop app menu support
Drop apis and code related to appmenus from
both GtkApplication and GtkApplicationWindow.

We still keep the menubar support, since it
is needed for system integration on OS X.

Fixes: #2731
2020-05-22 17:31:05 -04:00
Matthias Clasen
bd6c4a0dec Padding review
Ensure that the class structs of all subclassable
types have sufficient padding (standardizing on 8
slots, here).

GtkApplication
GtkWidget
GtkContainer
GtkWindow
GtkDialog
GtkApplicationWindow
GtkToolItem
GtkBin
2019-05-19 16:24:44 +00:00
Timm Bäder
6b4709ea3c GtkApplication: Remove priv pointer 2018-07-08 09:41:15 +02: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
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
Timm Bäder
e0d50233f6 gtkapplication: Remove deprecated API 2016-10-18 00:29:19 +02:00
Emmanuele Bassi
9ebe95f4a9 Remove introspection scanner guards around autocleanups
They are not needed.
2015-11-11 12:02:43 +00:00
Emmanuele Bassi
93369788c9 Start recursively moving autocleanups macros to their headers
* Cover letter

Having a single header file for all autocleanups definitions was a
reasonable stop-gap measure, but now GTK+ is starting to use G_DECLARE_*
macros. This means that every class using a G_DECLARE_* macro will need
to include "gtk.h" to avoid compiler warnings, which is not acceptable.

By moving the G_DEFINE_AUTO* use to the header that defines the type we
allow using the G_DECLARE_* macros without sacrificing the ability to
include only the needed files when deriving from a class.

* Commit

This commit changes all includes relative to GtkWindow to define their
own autocleanup macros.
2015-11-10 13:59:36 +00:00
Ryan Lortie
7d81d0a3bb Add gtk_application_get_actions_for_accel()
This counterpart to gtk_application_get_accels_for_action() lets you
find out if a particular accelerator has one or more actions associated
with it. This might be useful from an accelerator editor or plugin
system to prevent the the installation of conflicting accelerators.

https://bugzilla.gnome.org/show_bug.cgi?id=721367
2014-08-03 20:27:51 +02:00
Ryan Lortie
868ee07f49 GtkApplication: use resources for loading menus
Use the new ::resource-base-path property on #GApplication to attempt to
load the menu layout of the application.

We look first at gtk/menus-appmenu.ui or gtk/menus-traditional.ui
depending on the setting of gtk_application_prefers_app_menu().  Failing
that, we fall back to the common case of gtk/menus.ui (which should
always be given).  This provides a convenient way for application
authors to provide a different set of menus, depending on the desktop
environment they find themselves in.

As is the intention with other resources, if the resource base path is
unset, nothing will be loaded.  Additionally, if the expected files are not
found, it is not an error -- just nothing happens.

https://bugzilla.gnome.org/show_bug.cgi?id=722092
2014-07-07 14:46:27 -04:00
Ryan Lortie
d3b34d3cf2 Add gtk_application_prefers_app_menu()
Applications can call this to determine if they should an app menu.
This will be %FALSE on desktop environments that do not have an
application menu like the one in gnome-shell.  It is %FALSE on Windows
and Mac OS.

Applications are completely free to totally ignore this API -- it is
only provided as a hint to help applications that may be interested in
supporting non-GNOME platforms with a more native 'look and feel'.

https://bugzilla.gnome.org/show_bug.cgi?id=722092
2014-07-02 20:17:34 -04:00
Matthias Clasen
7d5bb09b88 Deprecate gtk_application_add_accelerator
The new gtk_application_set_accels_for_action api is more flexible
and better.
2014-04-06 02:13:06 -04:00
William Jon McCann
add1ca00f4 docs: add Gtk*Class docs
https://bugzilla.gnome.org/show_bug.cgi?id=81006
2014-01-20 12:31:21 -05:00
Matthias Clasen
85bfbebd08 Fix since tags
Mark 3.12 api as such.
2013-10-16 23:45:23 -04:00
Ryan Lortie
9a6ee36e9c GtkApplication: a new approach to accels
Rework how accels are handled on GtkApplicationWindow.

Instead of having GtkApplication fill the GtkAccelMap which is then used
by GtkApplicationWindow to create a GtkAccelGroup filled with closures
that is then associated with the window, do it directly.

GtkApplication now keeps a list of accels and their actions.
Accelerators on a GtkApplicationWindow ask GtkApplication to execute the
appropriate action.

This saves a fair bit of complexity and memory use (due to not having to
create all those closures and accelmap entries).  The new approach also
supports multiple accels per action (although there is not yet a public
API for it).

This patch (and the ones before) Reviewed and ACK'd by Matthias Clasen.
2013-10-15 09:24:12 -04:00
Matthias Clasen
20c8c8b91c Add annotations to gtk headers
Add annotations to all exported functions in GTK+ headers.
2013-05-05 15:38:47 -04:00
Matthias Clasen
5adecf183b Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-28 09:57:56 -05:00
Ryan Lortie
2e57819477 GtkApplication: add 'active-window' property 2012-08-20 13:08:17 -04:00
Christian Persch
ff66d0d8e5 application: Add unique IDs for GtkApplicationWindow
This will allow to refer to specific GtkApplicationWindows remotely by ID.

https://bugzilla.gnome.org/show_bug.cgi?id=674409
2012-05-03 17:45:46 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
2c25bd85b8 gtk: Use versioned deprecations
This patch changes all uses of GDK_DEPRECATED(_FOR) in gtk headers
by the versioned variants, GDK_DEPRECATED_IN_3_x(_FOR). At the same
time, we add GDK_AVAILABLE_IN_3_x annotations for all API additions
in 3.2 and 3.4.
2012-02-27 07:11:43 -05:00
Ryan Lortie
ef2df583f2 GtkApplication: simplify session quit handling
Instead of firing a 'quit' signal and expecting the application to do
something that will cause it to quit, just call the new
g_application_quit() API for ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=670485
2012-02-21 01:23:01 +01:00
Ryan Lortie
659c7130f0 GtkApplication: remove end session API
This seems a bit "too powerful" and unlikely to be used by most
applications.  Remove it from now, until someone comes up with a strong
desire for it.

https://bugzilla.gnome.org/show_bug.cgi?id=670485
2012-02-21 01:23:01 +01:00
Ryan Lortie
60317cbf1a move menus over from GLib
App menu and menubar are now properties of GtkApplication and their bus
location is exported using X window properties.

https://bugzilla.gnome.org/show_bug.cgi?id=668118
2012-01-18 13:40:05 -05:00
Matthias Clasen
7c0c65ec8d Rename GtkApplicationEndStyle
Call it EndSession to make it clearer what this is about.
2012-01-10 22:16:01 -05:00
Matthias Clasen
1c486fb8b8 Simplify logout notification api
We don't expose ::quit-requested as API anymore. Instead, we expect
users to register inhibitors when needed. Without quit-requested,
there is no need for ::quit-cancelled and gtk_application_quit_response
anymore.

We still emit ::quit when the application is about to quit.
2012-01-10 21:45:30 -05:00
Matthias Clasen
3142d13972 Add gtk_application_end_session
This function allows applications to request that
the user session be ended by logout/shutdown/reboot.
2012-01-07 03:20:56 -05:00
Matthias Clasen
bdd7e15c84 GtkApplication: Add an inhibit api
This lets applications block logout and similar actions ahead
of time. Currently only implemented for D-Bus, but Windows has
very similar API since Vista.
2012-01-07 03:20:56 -05:00
Matthias Clasen
3133791302 GtkApplication: Add logout notification
This is fairly basic, allowing applications to learn when
the session manager is about to end the session, and possibly
block this. The only implementation at this point is using the
org.gnome.SessionManager D-Bus interface of gnome-session. It should
be straightforward to port the EggSMClient implementations for
Windows and OS X.
2012-01-07 03:20:56 -05:00
Ryan Lortie
8578fefaa5 GtkApplication: add menu API
We add the app-menu and menubar public APIs to GtkApplication while
leaving the implementation in GApplication.

The actual implementation will be moved soon.
2011-12-19 12:51:12 -05:00
Matthias Clasen
153cc818db GtkApplication: Add API to install accelerators for actions 2011-12-19 12:51:11 -05:00
Matthias Clasen
7ef340fb87 Clean up includes 2011-12-19 12:51:10 -05:00
Matthias Clasen
0683f086bb Whitespace fixes 2011-12-19 12:51:09 -05:00
Matthias Clasen
6d0475df4f Remove no-longer existing function 2011-12-19 12:51:09 -05:00
Matthias Clasen
cc24dbe9c7 GtkApplication: add a way to get the appmenu
This function either returns a GtkMenu or NULL.
Still to do: detect if the app menu is externally handled.
2011-12-19 12:45:51 -05:00
Matthias Clasen
3b2f77e2c6 Remove an unneeded include 2011-12-19 12:45:51 -05:00
Matthias Clasen
8143ce69eb GtkApplication: Add window-added/-removed signals
This is useful to let unrelated parts of an application (or
plugins) learn about the windows of an application. Based
on a patch by Matt Barnes,
https://bugzilla.gnome.org/show_bug.cgi?id=641087
2011-05-31 19:12:13 -04:00
Michael Natterer
3933f99ed7 gtk: add missing class padding
Sorry for this late ABI break, but the newly added style classes
definitely need padding, so I can just as well add missing padding
globally.
2011-01-25 22:29:00 +01:00
Matthias Clasen
1be9b7f782 Some GtkApplication cleanups
Remove no-longer-needed vfuncs, no longer existing functions,
and improve the docs here and there.
2010-10-23 21:24:24 +02:00
Ryan Lortie
c5ebb61b6f GtkApplication: add gtk_application_get_windows()
Return a GList of the GtkWindow objects for each window that has the
application set as its "application" property.
2010-10-19 21:10:02 +02:00
Ryan Lortie
ab5fb5dee5 GtkApplication rewrite 2010-10-19 01:31:09 +02:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Jonh Wendell
9125ccb1cb [GtkApplication] Add gtk_application_get_windows()
Closes #623598.
2010-07-05 17:12:53 -03:00
Emmanuele Bassi
4f357dbf95 application: Allow sub-classes to override the Window creation
Sub-classes of GtkApplication might want to override the way an
application window is created - for instance, to hook into GtkBuilder
or to set up some basic UI or state.

A new GtkApplication::create_window() virtual function is added to the
GtkApplicationClass vtable, which returns the newly created GtkWindow.
The gtk_application_create_window() function calls the vfunc and adds
the returned window to the list of windows managed by the application
instance.

Calling gtk_application_add_window() will also set the default window,
if one is not already set.

This commit also removes a spurious g_object_ref_sink() on the newly
created GtkWindow.
2010-06-17 15:41:12 +01:00
Colin Walters
bdaefd7efe [GtkApplication] Update for GApplication API changes
Move appid parameter first to match GApplication.
2010-06-16 11:02:39 -04:00
Colin Walters
6c71da01cc [GtkApplication] Update for GApplication API changes
We now implement "quit" and "action" signals here.

https://bugzilla.gnome.org/show_bug.cgi?id=621003
2010-06-14 18:30:51 -04:00
Matthias Clasen
1ae257d00a Add GtkApplication
This is a work in progress to stub out an application class. The
primary goal is to provide a mechanism for applications to export
GtkActions, and there is a standard "Quit" action.

This is based on GApplication.

Future work:
 * Add a way to say "This is my application menubar", which gets
   put into all toplevel windows on non-OS-X, and into the top
   on OS X.
 * Support session management.
 * Support application settings.

https://bugzilla.gnome.org/show_bug.cgi?id=127958
2010-06-07 16:46:30 -04:00