// Generated by gtkmmproc -- DO NOT MODIFY!


#include <giomm/application.h>
#include <giomm/private/application_p.h>

// -*- 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 <gio/gio.h>
#include <giomm/file.h>

namespace Gio
{

Glib::RefPtr<Application> Application::create(const Glib::ustring& appid)
{
  return Glib::wrap(g_application_new(appid.c_str(), 0, 0));
}


Glib::RefPtr<Application> Application::create_try(const Glib::ustring& appid)
{
  GError* gerror = 0;
  Glib::RefPtr<Application> retvalue = Glib::wrap(g_application_try_new(appid.c_str(), 0, 0, &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


Glib::RefPtr<Application> Application::create_unregistered_try(const Glib::ustring& appid)
{
  GError* gerror = 0;
  Glib::RefPtr<Application> retvalue = Glib::wrap(g_application_unregistered_try_new(appid.c_str(), 0, 0, &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


} // namespace Gio

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::Application> wrap(GApplication* object, bool take_copy)
{
  return Glib::RefPtr<Gio::Application>( dynamic_cast<Gio::Application*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gio
{


/* The *_Class implementation: */

const Glib::Class& Application_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Application_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(g_application_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void Application_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


}


Glib::ObjectBase* Application_Class::wrap_new(GObject* object)
{
  return new Application((GApplication*)object);
}


/* The implementation: */

GApplication* Application::gobj_copy()
{
  reference();
  return gobj();
}

Application::Application(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

Application::Application(GApplication* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Application::~Application()
{}


Application::CppClassType Application::application_class_; // initialize static member

GType Application::get_type()
{
  return application_class_.init().get_type();
}


GType Application::get_base_type()
{
  return g_application_get_type();
}


Application::Application()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(application_class_.init()))
{
  

}

Glib::RefPtr<Application> Application::create(const Glib::ustring& appid, int argc, char** argv)
{
  return Glib::wrap(g_application_new(appid.c_str(), argc, argv));
}


Glib::RefPtr<Application> Application::create_try(const Glib::ustring& appid, int argc, char** argv)
{
  GError* gerror = 0;
  Glib::RefPtr<Application> retvalue = Glib::wrap(g_application_try_new(appid.c_str(), argc, argv, &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


Glib::RefPtr<Application> Application::create_unregistered_try(const Glib::ustring& appid, int argc, char** argv)
{
  GError* gerror = 0;
  Glib::RefPtr<Application> retvalue = Glib::wrap(g_application_unregistered_try_new(appid.c_str(), argc, argv, &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


bool Application::register_application()
{
  return g_application_register(gobj());
}

Glib::RefPtr<Application> Application::get_instance()
{

  Glib::RefPtr<Application> retvalue = Glib::wrap(g_application_get_instance());

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}


Glib::ustring Application::get_id() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_application_get_id(const_cast<GApplication*>(gobj())));
}

void Application::add_action(const Glib::ustring& name, const Glib::ustring& description)
{
g_application_add_action(gobj(), name.c_str(), description.c_str()); 
}

void Application::remove_action(const Glib::ustring& name)
{
g_application_remove_action(gobj(), name.c_str()); 
}

Glib::StringArrayHandle Application::list_actions() const
{
  return Glib::StringArrayHandle(g_application_list_actions(const_cast<GApplication*>(gobj())), Glib::OWNERSHIP_DEEP);
}

void Application::set_action_enabled(const Glib::ustring& name, bool enabled)
{
g_application_set_action_enabled(gobj(), name.c_str(), static_cast<int>(enabled)); 
}

bool Application::get_action_enabled(const Glib::ustring& name) const
{
  return g_application_get_action_enabled(const_cast<GApplication*>(gobj()), name.c_str());
}

Glib::ustring Application::get_action_description(const Glib::ustring& name)
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_application_get_action_description(gobj(), name.c_str()));
}

void Application::invoke_action(const Glib::ustring& name, const Glib::VariantBase& platform_data)
{
g_application_invoke_action(gobj(), name.c_str(), const_cast<GVariant*>((platform_data).gobj())); 
}

void Application::run()
{
g_application_run(gobj()); 
}

bool Application::quit_with_data(const Glib::VariantBase& platform_data)
{
  return g_application_quit_with_data(gobj(), const_cast<GVariant*>((platform_data).gobj()));
}

bool Application::is_remote() const
{
  return g_application_is_remote(const_cast<GApplication*>(gobj()));
}


} // namespace Gio


