1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/appinfo.h>
5 #include <giomm/private/appinfo_p.h>
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
9 /* Copyright (C) 2007 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <giomm/file.h>
32 #ifdef GLIBMM_EXCEPTIONS_ENABLED
34 AppInfo::create_from_commandline(const std::string& commandline,
35 const std::string& application_name,
36 AppInfoCreateFlags flags)
39 AppInfo::create_from_commandline(const std::string& commandline,
40 const std::string& application_name,
41 AppInfoCreateFlags flags,
42 std::auto_ptr<Glib::Error>& error)
43 #endif // GLIBMM_EXCEPTIONS_ENABLED
45 GAppInfo* capp_info = 0;
48 capp_info = g_app_info_create_from_commandline(commandline.c_str(),
49 application_name.c_str(),
50 static_cast<GAppInfoCreateFlags>(flags),
54 #ifdef GLIBMM_EXCEPTIONS_ENABLED
55 ::Glib::Error::throw_exception(gerror);
57 error = ::Glib::Error::throw_exception(gerror);
58 #endif //GLIBMM_EXCEPTIONS_ENABLED
60 return Glib::wrap(capp_info);
63 Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all()
65 return Glib::ListHandle< Glib::RefPtr<AppInfo> >(g_app_info_get_all(), Glib::OWNERSHIP_SHALLOW);
68 Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all_for_type(const std::string& content_type)
70 return Glib::ListHandle< Glib::RefPtr<AppInfo> >(
71 g_app_info_get_all_for_type(content_type.c_str()), Glib::OWNERSHIP_SHALLOW);
74 Glib::RefPtr<AppInfo> AppInfo::get_default_for_type(const std::string& content_type,
75 bool must_support_uris)
78 cinfo = g_app_info_get_default_for_type(content_type.c_str(),
79 static_cast<gboolean>(must_support_uris));
80 return Glib::wrap(cinfo);
83 Glib::RefPtr<AppInfo> AppInfo::get_default_for_uri_scheme(const std::string& uri_scheme)
86 cinfo = g_app_info_get_default_for_uri_scheme(uri_scheme.c_str());
87 return Glib::wrap(cinfo);
94 } // anonymous namespace
100 Glib::RefPtr<Gio::AppLaunchContext> wrap(GAppLaunchContext* object, bool take_copy)
102 return Glib::RefPtr<Gio::AppLaunchContext>( dynamic_cast<Gio::AppLaunchContext*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
103 //We use dynamic_cast<> in case of multiple inheritance.
106 } /* namespace Glib */
113 /* The *_Class implementation: */
115 const Glib::Class& AppLaunchContext_Class::init()
117 if(!gtype_) // create the GType if necessary
119 // Glib::Class has to know the class init function to clone custom types.
120 class_init_func_ = &AppLaunchContext_Class::class_init_function;
122 // This is actually just optimized away, apparently with no harm.
123 // Make sure that the parent type has been created.
124 //CppClassParent::CppObjectType::get_type();
126 // Create the wrapper type, with the same class/instance size as the base type.
127 register_derived_type(g_app_launch_context_get_type());
129 // Add derived versions of interfaces, if the C type implements any interfaces:
136 void AppLaunchContext_Class::class_init_function(void* g_class, void* class_data)
138 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
139 CppClassParent::class_init_function(klass, class_data);
141 #ifdef GLIBMM_VFUNCS_ENABLED
142 #endif //GLIBMM_VFUNCS_ENABLED
144 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
145 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
148 #ifdef GLIBMM_VFUNCS_ENABLED
149 #endif //GLIBMM_VFUNCS_ENABLED
151 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
152 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
155 Glib::ObjectBase* AppLaunchContext_Class::wrap_new(GObject* object)
157 return new AppLaunchContext((GAppLaunchContext*)object);
161 /* The implementation: */
163 GAppLaunchContext* AppLaunchContext::gobj_copy()
169 AppLaunchContext::AppLaunchContext(const Glib::ConstructParams& construct_params)
171 Glib::Object(construct_params)
176 AppLaunchContext::AppLaunchContext(GAppLaunchContext* castitem)
178 Glib::Object((GObject*)(castitem))
182 AppLaunchContext::~AppLaunchContext()
186 AppLaunchContext::CppClassType AppLaunchContext::applaunchcontext_class_; // initialize static member
188 GType AppLaunchContext::get_type()
190 return applaunchcontext_class_.init().get_type();
193 GType AppLaunchContext::get_base_type()
195 return g_app_launch_context_get_type();
199 AppLaunchContext::AppLaunchContext()
201 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
203 Glib::Object(Glib::ConstructParams(applaunchcontext_class_.init()))
209 Glib::RefPtr<AppLaunchContext> AppLaunchContext::create()
211 return Glib::RefPtr<AppLaunchContext>( new AppLaunchContext() );
213 std::string AppLaunchContext::get_display(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle< Glib::RefPtr<Gio::File> >& files)
215 return Glib::convert_return_gchar_ptr_to_stdstring(g_app_launch_context_get_display(gobj(), Glib::unwrap(info), files.data()));
218 std::string AppLaunchContext::get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle< Glib::RefPtr<Gio::File> >& files)
220 return Glib::convert_return_gchar_ptr_to_stdstring(g_app_launch_context_get_startup_notify_id(gobj(), Glib::unwrap(info), files.data()));
223 void AppLaunchContext::launch_failed(const std::string& startup_notify_id)
225 g_app_launch_context_launch_failed(gobj(), startup_notify_id.c_str());
229 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
230 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
232 #ifdef GLIBMM_VFUNCS_ENABLED
233 #endif //GLIBMM_VFUNCS_ENABLED
242 Glib::RefPtr<Gio::AppInfo> wrap(GAppInfo* object, bool take_copy)
244 return Glib::RefPtr<Gio::AppInfo>( dynamic_cast<Gio::AppInfo*> (Glib::wrap_auto_interface<Gio::AppInfo> ((GObject*)(object), take_copy)) );
245 //We use dynamic_cast<> in case of multiple inheritance.
255 /* The *_Class implementation: */
257 const Glib::Interface_Class& AppInfo_Class::init()
259 if(!gtype_) // create the GType if necessary
261 // Glib::Interface_Class has to know the interface init function
262 // in order to add interfaces to implementing types.
263 class_init_func_ = &AppInfo_Class::iface_init_function;
265 // We can not derive from another interface, and it is not necessary anyway.
266 gtype_ = g_app_info_get_type();
272 void AppInfo_Class::iface_init_function(void* g_iface, void*)
274 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
276 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
277 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
278 g_assert(klass != 0);
280 #ifdef GLIBMM_VFUNCS_ENABLED
281 #endif //GLIBMM_VFUNCS_ENABLED
283 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
284 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
287 #ifdef GLIBMM_VFUNCS_ENABLED
288 #endif //GLIBMM_VFUNCS_ENABLED
290 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
291 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
294 Glib::ObjectBase* AppInfo_Class::wrap_new(GObject* object)
296 return new AppInfo((GAppInfo*)(object));
300 /* The implementation: */
304 Glib::Interface(appinfo_class_.init())
307 AppInfo::AppInfo(GAppInfo* castitem)
309 Glib::Interface((GObject*)(castitem))
312 AppInfo::AppInfo(const Glib::Interface_Class& interface_class)
313 : Glib::Interface(interface_class)
321 void AppInfo::add_interface(GType gtype_implementer)
323 appinfo_class_.init().add_interface(gtype_implementer);
326 AppInfo::CppClassType AppInfo::appinfo_class_; // initialize static member
328 GType AppInfo::get_type()
330 return appinfo_class_.init().get_type();
333 GType AppInfo::get_base_type()
335 return g_app_info_get_type();
338 bool AppInfo::equal(const Glib::RefPtr<AppInfo>& other) const
340 return g_app_info_equal(const_cast<GAppInfo*>(gobj()), Glib::unwrap(other));
343 std::string AppInfo::get_id() const
345 return Glib::convert_const_gchar_ptr_to_stdstring(g_app_info_get_id(const_cast<GAppInfo*>(gobj())));
348 std::string AppInfo::get_name() const
350 return Glib::convert_const_gchar_ptr_to_stdstring(g_app_info_get_name(const_cast<GAppInfo*>(gobj())));
353 std::string AppInfo::get_description() const
355 return Glib::convert_const_gchar_ptr_to_stdstring(g_app_info_get_description(const_cast<GAppInfo*>(gobj())));
358 std::string AppInfo::get_executable() const
360 return Glib::convert_const_gchar_ptr_to_stdstring(g_app_info_get_executable(const_cast<GAppInfo*>(gobj())));
363 Glib::RefPtr<Icon> AppInfo::get_icon()
366 Glib::RefPtr<Icon> retvalue = Glib::wrap(g_app_info_get_icon(gobj()));
368 retvalue->reference(); //The function does not do a ref for us.
373 const Glib::RefPtr<const Icon> AppInfo::get_icon() const
375 return const_cast<AppInfo*>(this)->get_icon();
378 #ifdef GLIBMM_EXCEPTIONS_ENABLED
379 bool AppInfo::launch(const Glib::ListHandle<std::string>& files, const Glib::RefPtr<AppLaunchContext>& launch_context)
381 bool AppInfo::launch(const Glib::ListHandle<std::string>& files, const Glib::RefPtr<AppLaunchContext>& launch_context, std::auto_ptr<Glib::Error>& error)
382 #endif //GLIBMM_EXCEPTIONS_ENABLED
385 bool retvalue = g_app_info_launch(gobj(), files.data(), Glib::unwrap(launch_context), &(gerror));
386 #ifdef GLIBMM_EXCEPTIONS_ENABLED
388 ::Glib::Error::throw_exception(gerror);
391 error = ::Glib::Error::throw_exception(gerror);
392 #endif //GLIBMM_EXCEPTIONS_ENABLED
398 bool AppInfo::supports_uris() const
400 return g_app_info_supports_uris(const_cast<GAppInfo*>(gobj()));
403 bool AppInfo::supports_files() const
405 return g_app_info_supports_files(const_cast<GAppInfo*>(gobj()));
408 #ifdef GLIBMM_EXCEPTIONS_ENABLED
409 bool AppInfo::launch_uris(const Glib::ListHandle<std::string>& uris, GAppLaunchContext* launch_context)
411 bool AppInfo::launch_uris(const Glib::ListHandle<std::string>& uris, GAppLaunchContext* launch_context, std::auto_ptr<Glib::Error>& error)
412 #endif //GLIBMM_EXCEPTIONS_ENABLED
415 bool retvalue = g_app_info_launch_uris(gobj(), uris.data(), launch_context, &(gerror));
416 #ifdef GLIBMM_EXCEPTIONS_ENABLED
418 ::Glib::Error::throw_exception(gerror);
421 error = ::Glib::Error::throw_exception(gerror);
422 #endif //GLIBMM_EXCEPTIONS_ENABLED
428 bool AppInfo::should_show() const
430 return g_app_info_should_show(const_cast<GAppInfo*>(gobj()));
433 #ifdef GLIBMM_EXCEPTIONS_ENABLED
434 bool AppInfo::set_as_default_for_type(const std::string& content_type)
436 bool AppInfo::set_as_default_for_type(const std::string& content_type, std::auto_ptr<Glib::Error>& error)
437 #endif //GLIBMM_EXCEPTIONS_ENABLED
440 bool retvalue = g_app_info_set_as_default_for_type(gobj(), content_type.c_str(), &(gerror));
441 #ifdef GLIBMM_EXCEPTIONS_ENABLED
443 ::Glib::Error::throw_exception(gerror);
446 error = ::Glib::Error::throw_exception(gerror);
447 #endif //GLIBMM_EXCEPTIONS_ENABLED
453 #ifdef GLIBMM_EXCEPTIONS_ENABLED
454 bool AppInfo::set_as_default_for_extension(const std::string& extension)
456 bool AppInfo::set_as_default_for_extension(const std::string& extension, std::auto_ptr<Glib::Error>& error)
457 #endif //GLIBMM_EXCEPTIONS_ENABLED
460 bool retvalue = g_app_info_set_as_default_for_extension(gobj(), extension.c_str(), &(gerror));
461 #ifdef GLIBMM_EXCEPTIONS_ENABLED
463 ::Glib::Error::throw_exception(gerror);
466 error = ::Glib::Error::throw_exception(gerror);
467 #endif //GLIBMM_EXCEPTIONS_ENABLED
473 #ifdef GLIBMM_EXCEPTIONS_ENABLED
474 bool AppInfo::add_supports_type(const std::string& content_type)
476 bool AppInfo::add_supports_type(const std::string& content_type, std::auto_ptr<Glib::Error>& error)
477 #endif //GLIBMM_EXCEPTIONS_ENABLED
480 bool retvalue = g_app_info_add_supports_type(gobj(), content_type.c_str(), &(gerror));
481 #ifdef GLIBMM_EXCEPTIONS_ENABLED
483 ::Glib::Error::throw_exception(gerror);
486 error = ::Glib::Error::throw_exception(gerror);
487 #endif //GLIBMM_EXCEPTIONS_ENABLED
493 bool AppInfo::can_remove_supports_type() const
495 return g_app_info_can_remove_supports_type(const_cast<GAppInfo*>(gobj()));
498 #ifdef GLIBMM_EXCEPTIONS_ENABLED
499 bool AppInfo::remove_supports_type(const std::string& content_type)
501 bool AppInfo::remove_supports_type(const std::string& content_type, std::auto_ptr<Glib::Error>& error)
502 #endif //GLIBMM_EXCEPTIONS_ENABLED
505 bool retvalue = g_app_info_remove_supports_type(gobj(), content_type.c_str(), &(gerror));
506 #ifdef GLIBMM_EXCEPTIONS_ENABLED
508 ::Glib::Error::throw_exception(gerror);
511 error = ::Glib::Error::throw_exception(gerror);
512 #endif //GLIBMM_EXCEPTIONS_ENABLED
519 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
520 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
522 #ifdef GLIBMM_VFUNCS_ENABLED
523 #endif //GLIBMM_VFUNCS_ENABLED