Commit Graph

215 Commits

Author SHA1 Message Date
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Matthias Clasen
e16f82854a Add return-if-fail checks to g_application_hold/release
This is our common practice for public API.
https://bugzilla.gnome.org/show_bug.cgi?id=685208
2012-10-15 19:34:36 -04:00
Ryan Lortie
ce3dddb622 GApplication: document differences from libunique
People implementing GApplication often waste a lot of time by trying to
use it as if it were libunique.  Add a note to the docs about the
difference.
2012-09-18 10:14:35 -04:00
Christian Persch
4979c1d075 application: Add dbus register/unregister hooks
When the application is using its D-Bus backend, it is useful to be able
to export extra D-Bus objects at the right time, i.e. *before* the application
tries to own the bus name. This is accomplished here by adding a hook
in GApplicationClass for this; and a corresponding hook that will be called
on unregistration to undo whatever the register hook did.

Bug #675509.
2012-05-29 19:01:42 +02:00
Christian Persch
4b456635e4 Revert "application: Don't print a critical warning here"
This reverts commit 1541478bac.
2012-05-24 17:51:35 +02:00
Christian Persch
1541478bac application: Don't print a critical warning here
It's a runtime error, not a programming error.
2012-05-24 17:33:37 +02:00
Christian Persch
486d563049 application: Clarification about 'primary instance'
For non-unique applications, the 'primary instance' is the current
instance.
2012-05-02 20:15:39 +02:00
Ryan Lortie
eb5381b862 GApplication: add accessor for DBus information
Provide public access to the GDBusConnect and object path that
GApplication is using.  Prevents others from having to guess these
things for themselves based on the application ID.

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:43:06 -04:00
Ryan Lortie
16f92a33ac GApplication: allow null application_id
GApplication application ID is now permitted to be NULL, in which case
G_APPLICATION_NON_UNIQUE will be implicitly enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:38:15 -04:00
Robert Ancell
4143842eb4 Add missing allow-none annotations for function parameters.
Found using:
find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-03-31 20:34:28 +11:00
Ryan Lortie
ed51975899 GApplication: add g_application_quit()
A long requested feature; this quits the application immediately,
ignoring the hold count.

https://bugzilla.gnome.org/show_bug.cgi?id=670485
2012-02-21 01:20:39 +01:00
David King
c490a75a18 docs: Fix GApplicationCommandLine typo 2012-02-21 01:10:54 +01:00
David King
69ecc4b496 docs: Fix define typos in GApplication 2012-02-21 01:10:54 +01:00
David King
87c76bdbb6 docs: Remove some old GMenu documentation 2012-02-21 01:10:54 +01:00
Murray Cumming
d4992b3d10 g_application_activate(): Fix typo in docs. 2012-02-15 11:53:03 +01:00
Ryan Lortie
40e9192d72 GApplication: put non-unique apps on D-Bus
For a number of reasons it might be useful to register the object paths
associated with a non-unique application so that the application can at
least field requests to its unique D-Bus name.

https://bugzilla.gnome.org/show_bug.cgi?id=647986
2012-02-09 12:15:49 -05:00
Matthias Clasen
49eeaa9bbd Assorted documentation fixes 2012-01-30 16:16:48 -05:00
Matthias Clasen
4e9f59bff8 e G_SOURCE_CONTINUE/REMOVE internally
Now that we have these macros, we should use them.
This commit covers everything in gio/.
2012-01-25 16:15:18 -05:00
Ryan Lortie
54b986d918 GApplication: drop support for appmenu/menubars
This has been moved over to GtkApplication now.

https://bugzilla.gnome.org/show_bug.cgi?id=668118
2012-01-18 13:39:22 -05:00
Ryan Lortie
0a22f63ebe Drop public menu APIs from GApplication
This is moving to Gtk, but we don't want to do it all right now.
2011-12-19 12:34:16 -05:00
Ryan Lortie
0971d36e4b GApplication: receiving end of GRemoteActionGroup
Use the fact that the action group exporter now speaks to
GRemoteActionGroup to get the platform data into GApplicion without
hacks.

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-17 12:54:02 -05:00
Ryan Lortie
eefd08996f introduce GRemoteActionGroup
This interfaceifies the extra functions that were on GDBusActionGroup
for dealing with platform data.

The two main benefits of doing this:

  - no longer have to do a silly song and dance in GApplication to avoid
    calling GDBusActionGroup API from non-dbus-aware code

  - the interface can be reused by the action group exporter to avoid
    ugly and unbindable hook callbacks

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-17 12:54:02 -05:00
Ryan Lortie
ee9f104432 GApplication: send platform data for actions again
Use the _full variants of the GDBusActionGroup API to send platform data
for action invocations once again.
2011-12-16 22:24:03 -05:00
Ryan Lortie
e370631f46 GApplication: emit signals on action changes
Now that we're a GActionMap the story about propagating signals from our
(now-constant) internal action group is vastly simplified.  If someone
calls g_application_set_action_group() then signals will stop working --
but this function is deprecated and they never worked before, so no big
loss there.

https://bugzilla.gnome.org/show_bug.cgi?id=643736
2011-12-16 11:43:59 -05:00
Matthias Clasen
4f5732f721 GApplication: fix a copy-paste error
Activating an action must not turn into a change-state request.
2011-12-12 01:44:41 -05:00
Matthias Clasen
dec7ed8aba Rearrange GApplication long desc a bit 2011-12-12 00:01:20 -05:00
Ryan Lortie
829b4dfb43 Clean up GApplication docs
Clean up the docs for GApplication and related classes.

I'm no longer writing documentation for the structure type of classes
and interfaces.  See https://bugzilla.gnome.org/show_bug.cgi?id=665926
for discussin on the correct way forward on this point.

Also: stop putting gtk-doc comments in installed headers.
2011-12-10 17:23:28 -05:00
Matthias Clasen
8d428e3cc4 GApplication: Make ::startup run-first
https://bugzilla.gnome.org/show_bug.cgi?id=665817
2011-12-08 23:46:32 -05:00
Matthias Clasen
caa6287f39 More documentation fixes 2011-12-08 18:05:15 -05:00
Matthias Clasen
690596e9fb Fully implement app-menu and menubar properties 2011-12-08 18:05:14 -05:00
Ryan Lortie
ac8bc3d407 GApplication: make menu properties readwrite
Otherwise the notify signals won't be emitted.
2011-12-08 18:05:14 -05:00
Ryan Lortie
a9f03596fa GApplication: menu can change after registration
Allow the menu to be changed after registration.  This is quite useful
for setting up the menus from the ::startup handler instead of having to
do it before registration because it lets you skip the work if you're
not the primary instance.
2011-12-08 18:05:14 -05:00
Ryan Lortie
088682d860 GApplication: implement GActionMap
and deprecate g_application_set_action_group().
2011-12-08 18:05:14 -05:00
Ryan Lortie
75f1802a1c Fix some GMenu and GMenuItem leaking 2011-12-08 18:05:14 -05:00
Ryan Lortie
3821627366 GApplication: make distinction about menus
Rename g_application_set_menu to g_application_set_app_menu and make a
couple of fixups.  Clarify the documentation about exactly what this
menu is meant to be.

Add g_application_set_menubar and document that as well.
2011-12-08 18:05:14 -05:00
Matthias Clasen
41c19c7df8 GApplication: Add a menu example to the docs 2011-12-08 18:05:13 -05:00
Matthias Clasen
ae0bd032ca Add g_application_set_menu
This adds ane asy way to export menu information alongside
the actions that are already exported by GApplication.
2011-12-08 18:05:12 -05:00
Matthias Clasen
df4cd241e5 GApplication: use GDBusActionGroup
instead of the internal version of the same
2011-12-08 18:05:12 -05:00
Matthias Clasen
3d686e3d8f Clarify docs around main loop vfuncs
Mention that the vfuncs are no longer used, and tweak the
wording around what g_application_run() does.

https://bugzilla.gnome.org/show_bug.cgi?id=665391
2011-12-07 14:38:37 -05:00
Ryan Lortie
a81cdf297c GApplication: add default application 2011-11-26 20:11:40 -05:00
Matthias Clasen
2cbc6d9ae6 GApplication: Implement query_action 2011-11-26 19:43:46 -05:00
Ryan Lortie
a795e563df Drop last uses of @returns: 2011-11-21 12:02:02 -05:00
Ryan Lortie
43007aa2d2 GApplication: don't create a mainloop
Just iterate the main context directly.  Also: avoid calling the virtual
functions for mainloops.

https://bugzilla.gnome.org/show_bug.cgi?id=658805
2011-09-14 14:09:12 -04:00
Ryan Lortie
01f9479438 GApplication: add chain-up checks
Make sure ::startup and ::shutdown are being chained up.
2011-09-14 14:00:08 -04:00
Brian Koning
15b1c1bf4f GApplication: introduce ::shutdown
Introduce ::shutdown as a dual to ::startup.

https://bugzilla.gnome.org/show_bug.cgi?id=643934
2011-09-14 13:45:44 -04:00
Ryan Lortie
8a7d33024a gio docs: lots more fixes 2011-09-06 00:31:49 -04:00
Johan Dahlin
ec98953e42 Pass in NULL instead of g_cclosure_marshal_generic
NULL is now a shortcut for g_cclosure_marshal_generic, so avoid
referencing it directly.

https://bugzilla.gnome.org/show_bug.cgi?id=654917
2011-07-19 14:38:34 -03:00
Colin Walters
b74e2a720a Stop using glib-genmarshal at build time
To help cross compilation, don't use glib-genmarshal in our
build.  This is easy now that we have g_cclosure_marshal_generic().

In gobject/, add gmarshal.[ch] to git (making the existing entry
points stubs).

In gio/, simply switch to using g_cclosure_marshal_generic().

https://bugzilla.gnome.org/show_bug.cgi?id=652168
2011-06-20 17:24:07 -04:00
Ryan Lortie
9793919d7b Whitespace fixes 2011-05-18 17:56:50 -04:00
Colin Walters
78203f3699 gapplication: Fix typo in property 2011-04-15 14:58:30 -04:00
Ryan Lortie
0f9b83dd36 GApplication: #include "gsettings.h"
Since we call g_settings_sync() from there now...
2011-04-15 09:30:24 -04:00
Ryan Lortie
ff57ed5d6a GApplication: g_settings_sync() on exit
Call g_settings_sync() just before g_applcation_run() returns.  This is
really the correct thing to do in every case that you're using GSettings
and it prevents every single application from having to do it for
themselves.

Closes bug #647419.
2011-04-11 03:41:10 -04:00
Ryan Lortie
9d204338f3 GApplication: add G_APPLICATION_NON_UNIQUE
Add a flag to essentially short-circuit g_application_register().  The
application makes no attempt to acquire the bus name or check for
existing instances with that name.  The application is never considered
as being 'remote' and all requests are handled locally.

Closes #646985.
2011-04-10 07:55:33 -04:00
Murray Cumming
30fdc1a799 Docs: Changed can not to cannot. 2011-03-24 09:33:55 +01:00
Matthias Clasen
fc75b2597d Improve preconditions in action-related GApplication api
https://bugzilla.gnome.org/show_bug.cgi?id=643780
2011-03-06 23:08:46 -05:00
Murray Cumming
90ad3c9962 g_application_run(): Add (allow-none) introspection annotation. 2011-03-05 14:51:55 +01:00
Matthias Clasen
34ac69e688 Add more GApplication docs
Add more details about ::command-line to the g_application_run docs.
2011-03-04 12:03:15 -05:00
Murray Cumming
91614bb5fe GApplication: Check more before warning about a missing signal handler.
* gio/application.c (g_application_real_command_line): Check that the
default signal handler is not the current one before complaining, because
it is not unusual for overloads to call the base class implementation as
a matter of habit.
g_application_real_open() and g_application_real_activate() already do this
extra check.
2011-03-04 15:16:39 +01:00
Matthias Clasen
1485871ed5 GApplication: More documentation tweaks 2011-03-04 01:55:19 -05:00
Matthias Clasen
6dd692d858 Small doc correction
We don't actually pass @argc to local_command_line().
2011-03-04 00:27:23 -05:00
Matthias Clasen
3c7203cf1a GApplication: Clarify docs for @argv
Clearly state that @argv may be NULL.
https://bugzilla.gnome.org/show_bug.cgi?id=643649
2011-03-04 00:12:34 -05:00
Matthias Clasen
1a6455b785 GApplication: Beef up the local_command_line() docs
This adds some details, such as the meaning of @argc, @argv and @status,
even though gtk-doc does not make it easy to document vfunc arguments.
Requested in
https://bugzilla.gnome.org/show_bug.cgi?id=643478
2011-03-04 00:03:13 -05:00
Matthias Clasen
f05bce027e GApplication: Improve documentation
This commit adds some details regarding platform data.
2011-03-03 23:34:49 -05:00
Matthias Clasen
321682871b Try harder to explain GApplicationCommandline
Trying to answer some of the questions in
https://bugzilla.gnome.org/show_bug.cgi?id=643468
2011-03-03 22:40:48 -05:00
Matthias Clasen
e3cff93408 GApplications: Tighten up application-id validity checks
Also add tests for these conditions.
https://bugzilla.gnome.org/show_bug.cgi?id=643197
2011-02-25 11:13:55 -05:00
Cosimo Cecchi
51dd7c5e4a application: fix a typo in the docs annotation 2011-02-22 22:02:05 -05:00
Johan Dahlin
fdaaa22b58 Correct gtk-doc SECTION: syntax
g-ir-scanner does not allow a space between the : and the
section name.
2011-02-01 16:18:02 -02:00
Ryan Lortie
9f8798170d GApplication: add notes about GDBus architecture
Some people are trying to write code that calls g_application_register()
then checks to see if we became the primary name owner before exporting
objects.  This sort of approach worked with libdbus-1 because method
calls to the freshly-acquired name would not be dispatched until the
application returned to the mainloop.  With GDBus, however, dispatches
can occur at any time (including in the brief space between acquiring
the name and actually registering the object).

Add documentation to make it clear that you should not expect this to
work.
2011-01-31 13:19:59 -05:00
Matthias Clasen
654ab34e3a Don't warn in GApplication if class handlers have been overridden
https://bugzilla.gnome.org/show_bug.cgi?id=640042
2011-01-21 10:52:48 -05:00
Pavel Holejsovsky
8c742aea72 Add missing annotations to GApplication and GApplicationCommandLine. 2010-12-15 11:26:59 +01:00
Matthias Clasen
8c7e284116 Tweak GApplication docs 2010-11-02 23:02:05 -04:00
Matthias Clasen
78407a0098 GApplication: Add an action example 2010-10-31 20:49:53 -04:00
Ryan Lortie
cb64773002 Use 'aay' instead of 'as' for environ
It might contain non-utf8 characters.
2010-10-29 16:33:47 -04:00
Ryan Lortie
7aa2e50262 GApplication: support environment passing
Add support for passing the full contents of the environment to the
primary instance (by storing it in the platform_data) when
G_APPLICATION_SEND_ENVIRONMENT is in the flags.
2010-10-28 22:50:00 -04:00
Ryan Lortie
4baad1acbf GApplication: exit_status unset in one branch
Closes #633206
2010-10-27 09:26:01 -04:00
Ryan Lortie
d8d2513710 Implement (untested) GApplication actions support 2010-10-25 14:32:07 -04:00
Matthias Clasen
00366f440d Some more GApplication doc tweaks 2010-10-23 21:01:15 +02:00
Matthias Clasen
013f862a03 Properly register the inactivity-timeout property
It is a uint, not a boolean, so register it as such.
Also, only install the service timeout if we are actually registered
as the primary instance.
2010-10-23 14:05:04 +02:00
Matthias Clasen
7c735b05f7 Move a confusing comment to the right place 2010-10-23 12:01:51 +02:00
Matthias Clasen
b0e45c9799 Add another example for commandline handling
Also, clarify some aspects in the documentation.
2010-10-23 11:59:29 +02:00
Matthias Clasen
499d9ba8b8 Add some examples to the GApplication docs 2010-10-23 02:31:16 +02:00
Matthias Clasen
79790b9278 Brush up the GApplication docs
Also, fix up inclusions, mark properties for translation, etc.
2010-10-23 02:31:16 +02:00
Matthias Clasen
210a77a07e Fix a typo 2010-10-23 02:31:16 +02:00
Ryan Lortie
dd6e15dd24 GApplication: create local commandline properly
Don't pass a gchar** to g_object_new() when a GVariant* is expected.
2010-10-21 14:02:41 +02:00
Ryan Lortie
e33deea16c GApplication: reduce GVariant abuse
Don't use GVariant* as the representation for the argument array.
2010-10-19 19:38:00 +02:00
Ryan Lortie
a6b8a3113b GApplication: use g_signal_accumulator_first_wins
...instead of our homebrew version.
2010-10-19 01:16:46 +02:00
Ryan Lortie
3fe94ca9e9 GApplication: fill in action group implementation 2010-10-19 01:16:46 +02:00
Ryan Lortie
d6ac6c1850 Rename methods on GActionGroup to include 'action'
Makes explicit the fact that you are interacting with the individual
action rather than the group and removes potential namespace conflicts
with classes implementing the interface (like g_application_activate()
vs g_application_activate_action()).
2010-10-19 01:16:46 +02:00
Ryan Lortie
b2f942c142 GApplication: stub-in GActionGroup implementation 2010-10-19 01:16:46 +02:00
Ryan Lortie
3e6eee806c GApplication: add remote commandline support 2010-10-19 01:16:46 +02:00
Ryan Lortie
72ce1c7eb6 GApplication: fix inactivity-timeout
Create the gobject property for it.

Tweak the logic of having a pending timeout at the time that the
application starts -- run the mainloop with a use count of zero if there
is a timeout active.
2010-10-19 01:16:46 +02:00
Ryan Lortie
a7923a4aa3 new GApplication implementation 2010-10-19 01:16:46 +02:00
Matthias Clasen
eb3e926b09 Fix an off-by-one error 2010-07-30 19:53:29 -04:00
Colin Walters
8a2e7d371f Make default-quit not apply if register=FALSE
Callers who are using g_application_unregistered_try_new are
likely wanting to continue doing something else if _register()
fails.  Change the semantics so that passing register=FALSE
unsets default-quit as well.  This means that a later _register()
call will send Activate but continue the process.

https://bugzilla.gnome.org/show_bug.cgi?id=622005
2010-07-14 09:39:47 -04:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Ryan Lortie
d9e90c3894 GVariant: improve bytestring support
- add G_VARIANT_TYPE_BYTESTRING, _BYTESTRING_ARRAY, _STRING_ARRAY

 - remove g_variant_{new,get}_byte_array functions

 - add g_variant_{new,get,dup}_bytestring{,_array} functions

 - remove undocumented support for deserialising arrays of objectpaths
   or signature strngs using g_variant_get_strv()

 - add and document new format strings '^ay', '^&ay', '^aay' and '^a&ay'

 - update GApplication to use the new API

 - update GSettings binding code to use the new API

 - add tests
2010-07-07 16:25:48 -04:00
Matthias Clasen
d19380c809 Improve g_application_new documentation
Patch by Saleem Abdulrasool, bug 622154.
2010-06-22 08:24:30 -04:00
Colin Walters
8f5bde679e [GApplication] Add working directory to platform data
https://bugzilla.gnome.org/show_bug.cgi?id=621838
2010-06-18 16:05:00 -04:00
Matthias Clasen
408daaa294 Fix the build 2010-06-17 16:36:58 -04:00
Matthias Clasen
8a105625b0 Documentation fixups 2010-06-17 16:07:52 -04:00
Christian Persch
10e430bcc0 Fix GApplication for the G_TYPE_VARIANT change 2010-06-17 21:41:09 +02:00
Christian Persch
b90f11ff97 Typo fix 2010-06-16 17:48:02 +02:00
Colin Walters
102c5f6a7d Rework GApplication API to use GInitable
https://bugzilla.gnome.org/show_bug.cgi?id=620952
2010-06-16 11:13:43 -04:00
Colin Walters
85210bcf9b Switch to using variants for timestamps, split out signals
Like how we're handling activation, use GVariant for timestamps.  To
avoid polluting the GtkApplication API with GVariants, we rename the
GApplication signals to "quit-with-data" and "action-with-data".
GtkApplication will then wrap those as just "quit" and "action".

https://bugzilla.gnome.org/show_bug.cgi?id=621002
2010-06-14 16:36:23 -04:00
Colin Walters
8cab5e4693 [GApplication] Tweak docs a bit 2010-06-10 13:14:29 -04:00
Christian Persch
d8dca11733 Fix thinko
When replacing strcmp() with g_variant_is_of_type(), remove the "== 0"
part! Found by Colin Walters.
2010-06-08 19:43:30 +02:00
Christian Persch
d3b091f63a Use g_variant_is_of_type()
... instead of strcmp()'ing the type strings.

Bug #620954.
2010-06-08 17:41:46 +02:00
Matthias Clasen
e300c7e622 Fix a missing parameter in a doc comment
Pointed out by David Zeuthen.
2010-06-07 23:28:30 -04:00
Matthias Clasen
a89b10c1dc Fix a signal signature
GApplication::action was erroneously declaring the timestamp parameter
as int instead of uint.
2010-06-07 23:27:21 -04:00
Matthias Clasen
063470ea0d Fix a misspelt doc comment 2010-06-07 22:34:07 -04:00
Matthias Clasen
32b7fbb890 Rename GApplication::appid to GApplication::application-id 2010-06-07 22:21:47 -04:00
Matthias Clasen
fdc99873ee Document signals 2010-06-07 21:23:42 -04:00
Javier Jardón
d68100afcc [docs] GApplication is available since Gio 2.26 2010-06-08 00:00:39 +02:00
Matthias Clasen
c2a539eff0 Use g types for consistency 2010-06-07 17:48:09 -04:00
Matthias Clasen
6427e93757 Merge the wip/gapplication branch
This adds a GApplication object to GIO, which is the core of
an application support class, supporting
- uniqueness
- exporting actions (simple scripting)
- standard actions (quit, activate)

The implementation for Linux uses D-Bus, takes a name on the
session bus, and exports a org.gtk.Application interface.

Implementations for Win32 and OS X are still missing.
2010-06-07 13:48:42 -04:00