Commit Graph

149 Commits

Author SHA1 Message Date
Kalev Lember
750f6b9913 GtkApplication: Fix two muxer-related memory leaks
Drop the ref on the action muxer in finalize, and also make sure
shutdown() tears down the muxer setup done in startup().

When GtkApplication adds itself to a muxer, it causes the muxer to take
a ref on the GtkApplication. This has to be undone in shutdown() to make
sure the GtkApplication doesn't end up holding a ref on itself.

https://bugzilla.gnome.org/show_bug.cgi?id=730383
2014-05-25 10:49:27 +02:00
Matthias Clasen
1a6dd9fcd2 GtkApplication: implement the active-window property
This was apparently just forgotten.
First bug found by GtkInspector.
2014-05-10 22:04:26 -04:00
Matthias Clasen
7e8703918b Small documentation fixes
Pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=729461
2014-05-05 07:25:27 -04:00
Matthias Clasen
3e80ce39e1 GtkApplication: Clarify docs a bit
Explicitly mention how gtk_application_set_accels_for_action can
be used to remove all accelerators for an action.

https://bugzilla.gnome.org/show_bug.cgi?id=729451
2014-05-05 07:25:27 -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
Murray Cumming
4ee775ebf9 docs: Tiny GtkApplication typo fixes. 2014-03-18 12:29:49 +01:00
William Jon McCann
a9ecde45ec docs: don't show bloatpad images in the docs
They are too large and out of date.
2014-02-12 19:28:51 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
Ryan Lortie
974c843253 GtkApplication: install gtk option group
Install Gtk's GOptionGroup in GApplication just before commandline
arguments are parsed.
2014-02-06 17:42:33 +00:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
b4d4ffcf38 docs: Don't use <xi:include> 2014-02-05 12:32:20 -05:00
William Jon McCann
bf7afa48f8 docs: replace all figures with headings and images 2014-02-04 17:20:43 -05:00
William Jon McCann
63e887e165 docs: replace all <examples> with markdown headings 2014-02-04 16:58:54 -05:00
William Jon McCann
a479ee5de5 docs: use markdown for <envar> tags 2014-02-04 16:58:53 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
7c1b573209 docs: fix signal link syntax 2014-01-21 22:40:55 -05:00
Ryan Lortie
6da7b11ff6 application: new 'insert action group' private api
Add a new private API to GtkApplication akin to
gtk_widget_insert_action_group().

We'll use this to insert a few extra actions at the app level with a
separate namespace for the special items in the Mac OS application menu.

https://bugzilla.gnome.org/show_bug.cgi?id=720552
2014-01-17 22:40:50 -05:00
Ignacio Casal Quinteiro
99ee1875ab gtkapplication: add missing annotation for set_accels_for_action 2014-01-10 15:19:05 +01:00
Chun-wei Fan
adb0d2adac gtk/gtkapplication.c: Don't Include unistd.h Unconditionally
This header, which is not universally available, is accidently made to be
included unconditionally during the refactoring of gtkapplication.c,
so restore the #ifdef check.
2013-12-26 16:15:10 +08:00
Ryan Lortie
7fd81cf111 Refactor GtkApplication
gtkapplication.c has turned into a bit of an #ifdef mess over time, and
many of the current checks are incorrect.  As an example, if you build
Gtk for wayland, and exclude the X11 backend, much of the functionality
required by wayland (such as exporting menu models) will be disabled.

Solve that by introducing a backend mechanism to GtkApplication (named
GtkApplicationImpl) similar to the one in GApplication.  Add backends
for Wayland, X11 and Quartz, with X11 and Wayland sharing a common
'DBus' superclass.

                             GtkApplicationImpl
                                      |
                       /--------------+-------------------\
                       |                                  |
            GtkApplicationImplDBus              GtkApplicationImplQuartz
                       |
           /-----------+-----------------\
           |                             |
  GtkApplicationImplX11      GtkApplicationImplWayland

GtkApplicationImpl itself is essentially a bunch of vfuncs that serve as
hooks for various things that the platform-specific backends may be
interested in doing (startup, shutdown, managing windows, inhibit, etc.)

With this change, all platform specific code has been removed from
gtkapplication.c and gtkapplicationwindow.c (both of which are now free
of #ifdefs, except for a UNIX-specific use of GDesktopAppInfo in
gtkapplicationwindow.c).

Additionally, because of the movement of the property-setting code out
of GtkApplicationWindow, the _GTK_APPLICATION_ID properties (and
friends) will be set on non-GtkApplicationWindows, such as dialogs.

https://bugzilla.gnome.org/show_bug.cgi?id=720550
2013-12-16 13:51:54 -05:00
Daniel Svensson
4d41903548 Use g_return_val_if_fail where return value needed.
https://bugzilla.gnome.org/show_bug.cgi?id=710987
2013-10-29 17:12:23 -04:00
Matthias Clasen
9bd87b37bc Add docs for new API 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
Ryan Lortie
abcddd3ae0 GtkWindow: change muxer setup with application
Previously, GtkWindow would add the "app" action group to its own
toplevel muxer.

Change the setup so that GtkApplication creates the toplevel muxer and
adds itself to it as "app".  Use this muxer as the parent muxer of any
GtkWindow associated with the application.

This saves a small amount of memory and will allow for accels to be
propagated from the application through to all of the windows.
2013-10-15 09:24:11 -04:00
Mario Sanchez Prada
8d83d989bb a11y: don't shutdown accessibility, so the atk bridge is always valid
This will fix issues in applications that for some reason make
several and not nested calls to gtk_main() during their lifetime,
effectively initializing a11y when the first, top most, main loop
is being run and shutting it down then that loop is quit.

https://bugzilla.gnome.org/show_bug.cgi?id=708024

https://bugzilla.gnome.org/show_bug.cgi?id=684076
2013-09-25 20:14:04 -04:00
Matthias Clasen
e5317f0f9a Improve struct packing in various places 2013-09-21 23:50:55 -04:00
Matt Barnes
0e350eeea6 GtkApplication: Do not assert sm_proxy != NULL in inhibit functions
Applications have no way of finding out if a session manager proxy was
successfully created in gtk_application_startup_session_dbus(), so it's not
appropriate for certain public GtkApplication functions to be asserting the
presence of a session manager proxy as if it were a programmer error.

This affects:

   gtk_application_inhibit()
   gtk_application_is_inhibited()

If sm_proxy is NULL, the function should just return silently.

In the case of gtk_application_uninhibit(), the application should only be
calling this if it obtained a valid cookie, which implies the presence of a
session manager proxy.  I noted that with a comment.

https://bugzilla.gnome.org/show_bug.cgi?id=701365
2013-07-28 16:09:58 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Bastien Nocera
ee44ed75ca GtkApplication: Allow passing windows on non-X11 targets
It's not the application's fault that we don't do anything
with the passed GtkWindow on non-X11, so don't try to get an XID
on non-X11.

https://bugzilla.gnome.org/show_bug.cgi?id=695783
2013-03-14 17:48:20 +01:00
William Jon McCann
8e96488bb2 Don't crash if inhibit is called with an unrealized window 2013-02-15 16:56:06 -05:00
Andrew Potter
00795e8d05 GtkApplication: properly unexport x11 menus
https://bugzilla.gnome.org/show_bug.cgi?id=688362
2013-01-04 15:50:10 +01:00
Matthias Clasen
9ebeb4e68a Bump GLib dependency to 2.35
And drop deprecated g_type_init() calls.
2012-11-04 13:01:38 -05:00
Matthias Clasen
cfb6da9b55 Document gtk_application_get_window_by_id 2012-09-23 21:15:27 -04:00
Ryan Lortie
85700627aa gtkapplication: fix some crashing "leak fixes"
https://bugzilla.gnome.org/show_bug.cgi?id=684258
2012-09-20 14:22:52 -04:00
William Jon McCann
5debed5ae2 Shut down a11y when an app shuts down
https://bugzilla.gnome.org/show_bug.cgi?id=684076
2012-09-16 19:31:23 -04:00
Ryan Lortie
fd9b7bbfac Remove #include for muxer from gtkapplication.c 2012-08-20 13:13:49 -04:00
William Hua
fe48e077bd Action helper support in Mac OS menus. 2012-08-20 13:13:49 -04:00
Ryan Lortie
2e57819477 GtkApplication: add 'active-window' property 2012-08-20 13:08:17 -04:00
Matthias Clasen
f7683b05b1 GtkApplication: Fix unsetting menu models
Pointed out by Zachary Dovel in
http://bugzilla.gnome.org/show_bug.cgi?id=679705
2012-07-10 21:25:58 -04:00
Cosimo Cecchi
f22226b3c9 application: fix double free of app_id
This is fallout from commit 257b42e2f9 -
those fields were already getting freed in
gtk_application_shutdown_x11() and my commit caused crashes on quit
instead.

Thanks to Rico Tzschichholz for reporting the bug and testing this fix.
2012-07-05 16:40:23 -04:00
Cosimo Cecchi
257b42e2f9 application: plug some memory leaks 2012-07-02 10:41:29 -04:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Cosimo Cecchi
9992026ca6 application: fix a typo in introspection annotation
https://bugzilla.gnome.org/show_bug.cgi?id=677127
2012-06-25 14:49:11 -04:00
Christian Persch
75331c0ac2 application: Really allow NULL application-id
While the docs were adjusted to claim that NULL application-id is allowed,
the code actually segfaulted on it.
2012-06-12 16:15:12 +02:00
Murray Cumming
b3f2583a46 gtk_application_new(): Docs: application_id may now be null.
https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-05-28 16:16:56 +02:00
John Ralls
b5bcdbc10f Rename gtkquartz-menu to gtkmodelmenu-quartz
Makes name consistent with other quartz-only modules and makes it clear that this works with the GMenuModel system rather than the older GtkMenu system.
2012-05-07 14:59:06 -07:00
Christian Persch
4b4ec4472c application: Fix build without x11 2012-05-03 18:47:58 +02: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