lifecycle_delegate.h
Go to the documentation of this file.
/*
* Copyright © 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
* Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_
#define UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_
#include <ubuntu/visibility.h>
#include <ubuntu/application/archive.h>
#include <ubuntu/application/options.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*u_on_application_resumed)(const UApplicationOptions *options, void *context);
typedef void (*u_on_application_about_to_stop)(UApplicationArchive *archive, void *context);
typedef void UApplicationLifecycleDelegate;
UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate*
u_application_lifecycle_delegate_new();
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_destroy(
UApplicationLifecycleDelegate *delegate);
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_ref(
UApplicationLifecycleDelegate *delegate);
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_unref(
UApplicationLifecycleDelegate *delegate);
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_set_application_resumed_cb(
UApplicationLifecycleDelegate *delegate,
u_on_application_resumed cb);
UBUNTU_DLL_PUBLIC u_on_application_resumed
u_application_lifecycle_delegate_get_application_resumed_cb(
UApplicationLifecycleDelegate *delegate);
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_set_application_about_to_stop_cb(
UApplicationLifecycleDelegate *delegate,
u_on_application_about_to_stop cb);
UBUNTU_DLL_PUBLIC u_on_application_about_to_stop
u_application_lifecycle_delegate_get_application_about_to_stop_cb(
UApplicationLifecycleDelegate *delegate);
UBUNTU_DLL_PUBLIC void
u_application_lifecycle_delegate_set_context(
UApplicationLifecycleDelegate *delegate,
void *context);
UBUNTU_DLL_PUBLIC void*
u_application_lifecycle_delegate_get_context(
UApplicationLifecycleDelegate *delegate,
void *context);
#ifdef __cplusplus
}
#endif
#endif /* UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ */
u_application_lifecycle_delegate_ref
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *delegate)
Increments the reference count of the supplied lifecycle delegate.
u_on_application_resumed
void(* u_on_application_resumed)(const UApplicationOptions *options, void *context)
Prototype for the callback that is invoked whenever the app has been resumed.
Definition: lifecycle_delegate.h:38
u_application_lifecycle_delegate_get_context
UBUNTU_DLL_PUBLIC void * u_application_lifecycle_delegate_get_context(UApplicationLifecycleDelegate *delegate, void *context)
Queries the cb context from the supplied delegate.
archive.h
u_application_lifecycle_delegate_set_application_about_to_stop_cb
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_about_to_stop_cb(UApplicationLifecycleDelegate *delegate, u_on_application_about_to_stop cb)
Sets the about-to-stop cb for the supplied delegate.
u_application_lifecycle_delegate_get_application_about_to_stop_cb
UBUNTU_DLL_PUBLIC u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb(UApplicationLifecycleDelegate *delegate)
Queries the about-to-be-stopped cb from the supplied delegate.
visibility.h
u_application_lifecycle_delegate_unref
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *delegate)
Decrements the reference count of the supplied lifecycle delegate and destroys it if the count reache...
u_application_lifecycle_delegate_set_context
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_context(UApplicationLifecycleDelegate *delegate, void *context)
Sets the cb context for the supplied delegate.
u_application_lifecycle_delegate_new
UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate * u_application_lifecycle_delegate_new()
Creates a new instance of the lifecycle delegate with an initial refernce count of 1...
UApplicationOptions
void UApplicationOptions
Encapsulates options as passed to the application.
Definition: options.h:35
UApplicationLifecycleDelegate
void UApplicationLifecycleDelegate
Opaque type encapsulating all app-specific callback functions.
Definition: lifecycle_delegate.h:50
UApplicationArchive
struct UbuntuApplicationArchive_ UApplicationArchive
Definition: archive.h:33
UBUNTU_DLL_PUBLIC
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:26
u_application_lifecycle_delegate_get_application_resumed_cb
UBUNTU_DLL_PUBLIC u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb(UApplicationLifecycleDelegate *delegate)
Queries the resumed cb from the supplied delegate.
u_on_application_about_to_stop
void(* u_on_application_about_to_stop)(UApplicationArchive *archive, void *context)
Prototype for the callback that is invoked whenever the app is about to be stopped. Applications can serialize their state to the supplied archive.
Definition: lifecycle_delegate.h:44
u_application_lifecycle_delegate_destroy
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *delegate)
Destroys an instance of the lifecycle delegate and releases all of its resources. ...
options.h
u_application_lifecycle_delegate_set_application_resumed_cb
UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_resumed_cb(UApplicationLifecycleDelegate *delegate, u_on_application_resumed cb)
Sets the resumed cb for the supplied delegate.