Commit Graph

158 Commits

Author SHA1 Message Date
Matthias Clasen
d55e3b25a7 Fix various compiler warnings
Mostly missing declarations and missing statics.
2014-09-05 21:21:49 -04:00
Paolo Borelli
db3a01b589 GtkApplication: fix annotation of get_menu_by_id
https://bugzilla.gnome.org/show_bug.cgi?id=735034
2014-08-19 18:28:19 +02: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
ffbfee0738 GtkApplication: load gtk/menus-common.ui resource
Allow the app to install a resource called gtk/menus-common.ui which
will always be loaded, regardless of which type of menus we are using.

https://bugzilla.gnome.org/show_bug.cgi?id=733925
2014-07-30 09:57:33 +02:00
Matthias Clasen
d1099b1759 Document gtk_application_get_menu_by_id 2014-07-07 19:44:39 -04:00
Ryan Lortie
4948516100 GtkApplication: document icon path setup
https://bugzilla.gnome.org/show_bug.cgi?id=722092
2014-07-07 14:46:28 -04:00
Ryan Lortie
687a846923 GtkAppliation: setup icon theme resource path
If we have a resource base path for the application, set up an icon
theme search path based on it (within the default icon theme).

https://bugzilla.gnome.org/show_bug.cgi?id=722092
2014-07-07 14:46:27 -04: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
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