summaryrefslogtreecommitdiff
path: root/gio/src/application.ccg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2011-03-24 11:12:37 +0100
committerMurray Cumming <murrayc@murrayc.com>2011-03-24 11:12:37 +0100
commitc446268b44f3595431ba6f535dc297557c6097e0 (patch)
tree065aa31fa9f2cfd13df8cacef3fae9583fe26e63 /gio/src/application.ccg
parent34dba57c43bf471e9b511cd56d541f5bf58dcc48 (diff)
downloadglibmm-c446268b44f3595431ba6f535dc297557c6097e0.tar.gz
Remove Gio::Application and friends for now because they are not finished.
* gio/src/actiongroup.[hg|ccg]: * gio/src/application.[hg|ccg]: * gio/src/applicationcommandline.[hg|ccg]: Removed these temporarily because we removed Gtk::Application temporarily from gtkmm. See http://mail.gnome.org/archives/gtkmm-list/2011-March/msg00062.html
Diffstat (limited to 'gio/src/application.ccg')
-rw-r--r--gio/src/application.ccg214
1 files changed, 0 insertions, 214 deletions
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
deleted file mode 100644
index 25b0a630..00000000
--- a/gio/src/application.ccg
+++ /dev/null
@@ -1,214 +0,0 @@
-// -*- 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>
-#include <giomm/actiongroup.h>
-#include <giomm/init.h>
-
-namespace
-{
-
-static void Application_signal_open_callback(GApplication* self, GFile** files,
- gint n_files, const gchar* hint, void* data)
-{
- typedef sigc::slot< void, const Gio::Application::type_vec_files&, const Glib::ustring& > SlotType;
-
- Gio::Application::type_vec_files vec_files(n_files);
- for(int i = 0; i < n_files; ++i)
- {
- vec_files[i] = Glib::wrap(files[i], true);
- }
-
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
-
- // Do not try to call a signal on a disassociated wrapper.
- if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
- {
- try
- {
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) {
- (*static_cast<SlotType*>(slot))(vec_files, hint_str);
- return;
- }
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
- }
-
- return;
-}
-
-static void Application_signal_open_notify_callback(GApplication* self, GFile** files,
- gint n_files, const gchar *hint, void* data)
-{
- using namespace Gio;
- typedef sigc::slot< void, const Application::type_vec_files&, const Glib::ustring& > SlotType;
-
- Application::type_vec_files vec_files(n_files);
- for (int i = 0; i < n_files; i++)
- {
- vec_files[i] = Glib::wrap(files[i], true);
- }
-
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
-
- // Do not try to call a signal on a disassociated wrapper.
- if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
- {
- try
- {
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
- {
- (*static_cast<SlotType*>(slot))(vec_files, hint_str);
- return;
- }
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
- }
-
- return;
-}
-
-static const Glib::SignalProxyInfo Application_signal_open_info =
-{
- "open",
- (GCallback) &Application_signal_open_callback,
- (GCallback) &Application_signal_open_notify_callback
-};
-
-}
-
-namespace Gio
-{
-
-
-const Glib::Class& Application::custom_class_init()
-{
- Glib::init();
- Gio::init();
- return application_class_.init();
-}
-
-
-Application::Application(const Glib::ustring& application_id, ApplicationFlags flags)
-:
- // Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
- Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id", application_id.c_str(), "flags", ((GApplicationFlags)(flags)), static_cast<char*>(0)))
-{
-
-}
-
-void Application_Class::open_callback(GApplication* self, GFile** files,
- gint n_files, const gchar *hint)
-{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
- Glib::ObjectBase::_get_current_wrapper((GObject*)self));
-
- // Non-gtkmmproc-generated custom classes implicitly call the default
- // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
- // generated classes can use this optimisation, which avoids the unnecessary
- // parameter conversions if there is no possibility of the virtual function
- // being overridden:
-
- if(obj_base && obj_base->is_derived_())
- {
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
- if(obj) // This can be NULL during destruction.
- {
- try // Trap C++ exceptions which would normally be lost because this is a C callback.
- {
- // Call the virtual member method, which derived classes might override.
- Application::type_vec_files vec_files(n_files);
- for (int i = 0; i < n_files; i++) {
- vec_files[i] = Glib::wrap(files[i], true);
- }
-
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
-
- obj->on_open(vec_files, hint_str);
- return;
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
- }
- }
-
- BaseClassType *const base = static_cast<BaseClassType*>(
- g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
- );
-
- // Call the original underlying C function:
- if(base && base->open)
- (*base->open)(self, files, n_files, hint);
-}
-
-Glib::SignalProxy2< void, const Application::type_vec_files&, const Glib::ustring& > Application::signal_open()
-{
- return Glib::SignalProxy2< void, const Application::type_vec_files&, const Glib::ustring& >(this, &Application_signal_open_info);
-}
-
-void Gio::Application::on_open(const Application::type_vec_files& files, const Glib::ustring& hint)
-{
- BaseClassType *const base = static_cast<BaseClassType*>(
- g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
- );
-
- if(base && base->open) {
- (*base->open)(gobj(),
- Glib::ArrayHandler<type_vec_files::value_type>::vector_to_array(files).data(),
- files.size(),
- hint.c_str());
- }
-}
-
-void Application::open(const type_vec_files& files, const Glib::ustring& hint)
-{
- g_application_open(gobj(),
- Glib::ArrayHandler<type_vec_files::value_type>::vector_to_array(files).data(),
- files.size(),
- hint.c_str());
-}
-
-void Application::open(const Glib::RefPtr<Gio::File>& file, const Glib::ustring& hint)
-{
- type_vec_files files(1);
- files[0] = file;
- open(files, hint);
-}
-
-bool Application::register_application()
-{
- GError* gerror = 0;
- bool retvalue = g_application_register(gobj(), NULL, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-} // namespace Gio