summaryrefslogtreecommitdiff
path: root/gio/src/application.hg
blob: 87c5295c273dc328a2fd5648ae908ab4d752ac72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2007 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <giomm/cancellable.h>
#include <glibmm/object.h>
#include <glibmm/variant.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

_WRAP_ENUM(ApplicationFlags, GApplicationFlags, NO_GTYPE)

/** TODO
 *
 * @newin{2,26}
 */
class Application : public Glib::Object
{
  _CLASS_GOBJECT(Application, GApplication, G_APPLICATION, Glib::Object, GObject)

protected:
  _CTOR_DEFAULT()

public:
  //_WRAP_CREATE()

  _WRAP_METHOD(static Glib::RefPtr<Application> create(const Glib::ustring& appid, ApplicationFlags flags = APPLICATION_FLAGS_NONE), g_application_new)

  _WRAP_METHOD(static Glib::RefPtr<Application> create_try(const Glib::ustring& appid, ApplicationFlags flags = APPLICATION_FLAGS_NONE), g_application_try_new, errthrow)

  _WRAP_METHOD(static Glib::RefPtr<Application> create_unregistered_try(const Glib::ustring& appid, ApplicationFlags flags = APPLICATION_FLAGS_NONE), g_application_unregistered_try_new, errthrow)


  //TODO: Add a version with no cancellable.
  //Renamed from register() because that is a C++ keyword.
  _WRAP_METHOD(bool register_application(const Glib::RefPtr<Gio::Cancellable>& cancellable), g_application_register, errthrow)

  _WRAP_METHOD(static Glib::RefPtr<Application> get_instance(), g_application_get_instance, refreturn)
  _WRAP_METHOD(Glib::ustring get_id() const, g_application_get_id)

  _WRAP_METHOD(void add_action(const Glib::ustring& name, const Glib::ustring& description), g_application_add_action)
  _WRAP_METHOD(void remove_action(const Glib::ustring& name), g_application_remove_action)

   #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
  _WRAP_METHOD(Glib::StringArrayHandle list_actions() const, g_application_list_actions)

  _WRAP_METHOD(void set_action_enabled(const Glib::ustring& name, bool enabled = true), g_application_set_action_enabled)
  _WRAP_METHOD(bool get_action_enabled(const Glib::ustring& name) const, g_application_get_action_enabled)
  _WRAP_METHOD(Glib::ustring get_action_description(const Glib::ustring& name), g_application_get_action_description)
  _WRAP_METHOD(void invoke_action(const Glib::ustring& name, const Glib::VariantBase& platform_data), g_application_invoke_action)

  _WRAP_METHOD(void run(int argc, char** argv), g_application_run)
  //TODO: g_application_run_with_arguments)
  _WRAP_METHOD(bool quit_with_data(const Glib::VariantBase& platform_data), g_application_quit_with_data)

  _WRAP_METHOD(bool is_remote() const, g_application_is_remote)

//#m4 _CONVERSION(`const gchar*', `const Glib::ustring&', `Glib::ustring($3)')
//#m4 _CONVERSION(`GVariant*', `const Glib::VariantBase&', `Glib::wrap($3, true)')

  _WRAP_SIGNAL(void startup(), "startup")
  _WRAP_SIGNAL(void activate(), "activate")
  //TODO: _WRAP_SIGNAL(void open(GFile** files, int n_files, const Glib::ustring& hint), "open")
  //TODO: Wrap ApplicationCommandLine: _WRAP_SIGNAL(void command_line(const Glib::RefPtr<ApplicationCommandLine>& command_line), "command-line")
};


} // namespace Gio