// Generated by gmmproc 2.86.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gtkmm/urilauncher.h>
#include <gtkmm/private/urilauncher_p.h>


/* Copyright 2023 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, see <http://www.gnu.org/licenses/>.
 */

#include <gdkmm/slot_async.h>
#include <gtkmm/window.h>

namespace Gtk
{
// uri{NULL} has no effect in _WRAP_CTOR.
UriLauncher::UriLauncher(const Glib::ustring& uri)
: // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Glib::Object(Glib::ConstructParams(urilauncher_class_.init(), "uri",Glib::c_str_or_nullptr(uri), nullptr))
{
}

} // namespace Gtk

namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& UriLauncher_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Do not derive a GType, or use a derived class:
    gtype_ = gtk_uri_launcher_get_type();

  }

  return *this;
}


Glib::ObjectBase* UriLauncher_Class::wrap_new(GObject* object)
{
  return new UriLauncher((GtkUriLauncher*)object);
}


/* The implementation: */

GtkUriLauncher* UriLauncher::gobj_copy()
{
  reference();
  return gobj();
}

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

}

UriLauncher::UriLauncher(GtkUriLauncher* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


UriLauncher::UriLauncher(UriLauncher&& src) noexcept
: Glib::Object(std::move(src))
{}

UriLauncher& UriLauncher::operator=(UriLauncher&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  return *this;
}


UriLauncher::~UriLauncher() noexcept
{}


UriLauncher::CppClassType UriLauncher::urilauncher_class_; // initialize static member

GType UriLauncher::get_type()
{
  return urilauncher_class_.init().get_type();
}


GType UriLauncher::get_base_type()
{
  return gtk_uri_launcher_get_type();
}


Glib::RefPtr<UriLauncher> UriLauncher::create(const Glib::ustring& uri)
{
  return Glib::make_refptr_for_instance<UriLauncher>( new UriLauncher(uri) );
}

Glib::ustring UriLauncher::get_uri() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_uri_launcher_get_uri(const_cast<GtkUriLauncher*>(gobj())));
}

void UriLauncher::set_uri(const Glib::ustring& uri)
{
  gtk_uri_launcher_set_uri(gobj(), uri.empty() ? nullptr : uri.c_str());
}

void UriLauncher::launch(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable) const
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_uri_launcher_launch(const_cast<GtkUriLauncher*>(gobj()), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void UriLauncher::launch(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable) const
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_uri_launcher_launch(const_cast<GtkUriLauncher*>(gobj()), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

bool UriLauncher::launch_finish(const Glib::RefPtr<Gio::AsyncResult>& result) const
{
  GError* gerror = nullptr;
  auto retvalue = gtk_uri_launcher_launch_finish(const_cast<GtkUriLauncher*>(gobj()), Glib::unwrap(result), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool UriLauncher::can_launch(const Window& parent) const
{
  return gtk_uri_launcher_can_launch(const_cast<GtkUriLauncher*>(gobj()), const_cast<GtkWindow*>((parent).gobj()));
}

bool UriLauncher::can_launch() const
{
  return gtk_uri_launcher_can_launch(const_cast<GtkUriLauncher*>(gobj()), nullptr);
}


Glib::PropertyProxy< Glib::ustring > UriLauncher::property_uri() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "uri");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > UriLauncher::property_uri() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "uri");
}


} // namespace Gtk


