glibmm r754 - in trunk: . gio/src



Author: jjongsma
Date: Fri Dec 12 02:42:47 2008
New Revision: 754
URL: http://svn.gnome.org/viewvc/glibmm?rev=754&view=rev

Log:
Add a bunch of new / missed API

Modified:
   trunk/ChangeLog
   trunk/gio/src/appinfo.ccg
   trunk/gio/src/appinfo.hg
   trunk/gio/src/cancellable.hg
   trunk/gio/src/drive.hg
   trunk/gio/src/icon.ccg
   trunk/gio/src/icon.hg
   trunk/gio/src/mount.ccg
   trunk/gio/src/mount.hg

Modified: trunk/gio/src/appinfo.ccg
==============================================================================
--- trunk/gio/src/appinfo.ccg	(original)
+++ trunk/gio/src/appinfo.ccg	Fri Dec 12 02:42:47 2008
@@ -55,31 +55,25 @@
   return Glib::wrap(capp_info);
 }
 
-Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all()
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool AppInfo::launch_default_for_uri(const std::string& uri)
+#else
+bool AppInfo::launch_default_for_uri(const std::string& uri, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 {
-  return Glib::ListHandle< Glib::RefPtr<AppInfo> >(g_app_info_get_all(), Glib::OWNERSHIP_SHALLOW);
-}
+  GError* gerror = 0;
+  bool retvalue = g_app_info_launch_default_for_uri(uri.c_str(), NULL, &(gerror));
 
-Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all_for_type(const std::string& content_type)
-{
-  return Glib::ListHandle< Glib::RefPtr<AppInfo> >(
-    g_app_info_get_all_for_type(content_type.c_str()), Glib::OWNERSHIP_SHALLOW);
-}
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 
-Glib::RefPtr<AppInfo> AppInfo::get_default_for_type(const std::string& content_type,
-                                                    bool must_support_uris)
-{
-  GAppInfo* cinfo = 0;
-  cinfo = g_app_info_get_default_for_type(content_type.c_str(),
-                                          static_cast<gboolean>(must_support_uris));
-  return Glib::wrap(cinfo);
+  return retvalue;
 }
 
-Glib::RefPtr<AppInfo> AppInfo::get_default_for_uri_scheme(const std::string& uri_scheme)
-{
-  GAppInfo* cinfo = 0;
-  cinfo = g_app_info_get_default_for_uri_scheme(uri_scheme.c_str());
-  return Glib::wrap(cinfo);
-}
 
 } // namespace Gio

Modified: trunk/gio/src/appinfo.hg
==============================================================================
--- trunk/gio/src/appinfo.hg	(original)
+++ trunk/gio/src/appinfo.hg	Fri Dec 12 02:42:47 2008
@@ -91,7 +91,7 @@
                                                        std::auto_ptr<Glib::Error>& error);
 #endif // GLIBMM_EXCEPTIONS_ENABLED
 
-  _IGNORE(g_app_info_dup)
+  //_IGNORE(g_app_info_dup)
   _IGNORE(g_app_info_equal)
 
   // Note that the implementation of equal() is virtual via equal_vfunc().
@@ -101,6 +101,7 @@
   _WRAP_METHOD(std::string get_name() const, g_app_info_get_name)
   _WRAP_METHOD(std::string get_description() const, g_app_info_get_description)
   _WRAP_METHOD(std::string get_executable() const, g_app_info_get_executable)
+  _WRAP_METHOD(std::string get_commandline() const, g_app_info_get_commandline)
 
   _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_app_info_get_icon, refreturn)
   _WRAP_METHOD(const Glib::RefPtr<const Icon> get_icon() const,
@@ -118,6 +119,9 @@
                g_app_info_launch_uris,
                errthrow)
   _WRAP_METHOD(bool should_show() const, g_app_info_should_show)
+  // FIXME: use better terminology than delete/do_delete
+  _WRAP_METHOD(bool can_delete() const, g_app_info_can_delete)
+  _WRAP_METHOD(bool do_delete(), g_app_info_delete)
 
   _WRAP_METHOD(bool set_as_default_for_type(const std::string& content_type),
                g_app_info_set_as_default_for_type,
@@ -132,14 +136,19 @@
   _WRAP_METHOD(bool remove_supports_type(const std::string& content_type),
                g_app_info_remove_supports_type,
                errthrow)
-
-  static Glib::ListHandle< Glib::RefPtr<AppInfo> > get_all();
-
-  static Glib::ListHandle< Glib::RefPtr<AppInfo> > get_all_for_type(const std::string& content_type);
-
-  static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool must_support_uris = true);
-
-  static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme);
+#m4 _CONVERSION(`GList*',`Glib::ListHandle<Glib::RefPtr<AppInfo> >',`Glib::ListHandle<Glib::RefPtr<AppInfo> >($3, Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(static Glib::ListHandle<Glib::RefPtr<AppInfo> > get_all(), g_app_info_get_all)
+  _WRAP_METHOD(static Glib::ListHandle<Glib::RefPtr<AppInfo> > get_all_for_type(const std::string& content_type), g_app_info_get_all_for_type)
+  _WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool must_support_uris = true), g_app_info_get_default_for_type)
+  _WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme), g_app_info_get_default_for_uri_scheme)
+  _WRAP_METHOD(static void reset_type_associations(const std::string& content_type), g_app_info_reset_type_associations)
+  _WRAP_METHOD(static bool launch_default_for_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& context), g_app_info_launch_default_for_uri, errthrow)
+  // same as above but without optional AppLaunchContext
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  static bool launch_default_for_uri(const std::string& uri);
+#else
+  static bool launch_default_for_uri(const std::string& uri, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 
 protected:
   //_WRAP_VFUNC(Glib::RefPtr<AppInfo> dup(), "dup")

Modified: trunk/gio/src/cancellable.hg
==============================================================================
--- trunk/gio/src/cancellable.hg	(original)
+++ trunk/gio/src/cancellable.hg	Fri Dec 12 02:42:47 2008
@@ -59,6 +59,9 @@
                g_cancellable_pop_current)
   _WRAP_METHOD(void reset(), g_cancellable_reset)
 
+  // FIXME: is this useful in the C++ API?
+  //_WRAP_METHOD(void make_pollfd(PollFD* pollfd), g_cancellable_make_pollfd)
+
   _WRAP_SIGNAL(void cancelled(), cancelled)
 };
 

Modified: trunk/gio/src/drive.hg
==============================================================================
--- trunk/gio/src/drive.hg	(original)
+++ trunk/gio/src/drive.hg	Fri Dec 12 02:42:47 2008
@@ -112,6 +112,10 @@
   _WRAP_METHOD(std::string get_identifier(const std::string& kind) const, g_drive_get_identifier)
   _WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, g_drive_enumerate_identifiers)
 
+  _WRAP_SIGNAL(void changed(), changed);
+  _WRAP_SIGNAL(void disconnected(), disconnected);
+  _WRAP_SIGNAL(void eject_button(), eject_button);
+
   //_WRAP_VFUNC(Glib::ustring get_name() const, get_name)
   //Careful of ref-counting: //_WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, get_icon)
   //_WRAP_VFUNC(bool has_volumes() const, has_volumes)

Modified: trunk/gio/src/icon.ccg
==============================================================================
--- trunk/gio/src/icon.ccg	(original)
+++ trunk/gio/src/icon.ccg	Fri Dec 12 02:42:47 2008
@@ -29,4 +29,23 @@
                  const_cast<GIcon*>(other->gobj())));
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Icon> Icon::create(const std::string& str)
+#else
+Glib::RefPtr<Icon> Icon::create(const std::string& str, std::auto_ptr<Glib::Error>& error)
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  GIcon* icon = g_icon_new_for_string(str.c_str(), &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return Glib::wrap(icon);
+}
+
 } // namespace Gio

Modified: trunk/gio/src/icon.hg
==============================================================================
--- trunk/gio/src/icon.hg	(original)
+++ trunk/gio/src/icon.hg	Fri Dec 12 02:42:47 2008
@@ -44,13 +44,23 @@
   _CLASS_INTERFACE(Icon, GIcon, G_ICON, GIconIface)
 
 public:
+  // We can't just use a _WRAP_CREATE macro here since this is an abstract
+  // interface class, so implement it by hand
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  static Glib::RefPtr<Icon> create(const std::string& str);
+#else
+  static Glib::RefPtr<Icon> create(const std::string& str, std::auto_ptr<Glib::Error>& error);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+  _IGNORE(g_icon_new_for_string)
   _WRAP_METHOD(guint hash() const, g_icon_hash)
+  _WRAP_METHOD(std::string to_string() const, g_icon_to_string)
 
   _IGNORE(g_icon_equal)
   // TODO: should this, and File's equal(), be virtual, in order to
   // be available to derived classes?
   bool equal(const Glib::RefPtr<Icon>& other) const;
 
+
   //_WRAP_VFUNC(guint hash() const, "hash")
 
   // TODO: also kind of related to equal() being virtual or not,

Modified: trunk/gio/src/mount.ccg
==============================================================================
--- trunk/gio/src/mount.ccg	(original)
+++ trunk/gio/src/mount.ccg	Fri Dec 12 02:42:47 2008
@@ -34,7 +34,7 @@
 
   g_mount_unmount(gobj(),
                   GMountUnmountFlags(flags),
-                  cancellable->gobj(), 
+                  cancellable->gobj(),
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -48,7 +48,7 @@
 
   g_mount_unmount(gobj(),
                   GMountUnmountFlags(flags),
-                  NULL, 
+                  NULL,
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -57,7 +57,7 @@
 {
   g_mount_unmount(gobj(),
                   GMountUnmountFlags(flags),
-                  NULL, 
+                  NULL,
                   NULL,
                   NULL);
 }
@@ -73,7 +73,7 @@
   g_mount_remount(gobj(),
                   static_cast<GMountMountFlags>(flags),
                   operation->gobj(),
-                  cancellable->gobj(), 
+                  cancellable->gobj(),
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -88,7 +88,7 @@
   g_mount_remount(gobj(),
                   static_cast<GMountMountFlags>(flags),
                   operation->gobj(),
-                  NULL, 
+                  NULL,
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -98,7 +98,7 @@
   g_mount_remount(gobj(),
                   static_cast<GMountMountFlags>(flags),
                   operation->gobj(),
-                  NULL, 
+                  NULL,
                   NULL,
                   NULL);
 }
@@ -108,7 +108,7 @@
   g_mount_remount(gobj(),
                   static_cast<GMountMountFlags>(flags),
                   NULL,
-                  NULL, 
+                  NULL,
                   NULL,
                   NULL);
 }
@@ -122,7 +122,7 @@
 
   g_mount_eject(gobj(),
                   GMountUnmountFlags(flags),
-                  cancellable->gobj(), 
+                  cancellable->gobj(),
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -136,7 +136,7 @@
 
   g_mount_eject(gobj(),
                   GMountUnmountFlags(flags),
-                  NULL, 
+                  NULL,
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -145,7 +145,7 @@
 {
   g_mount_eject(gobj(),
                   GMountUnmountFlags(flags),
-                  NULL, 
+                  NULL,
                   NULL,
                   NULL);
 }
@@ -160,7 +160,7 @@
 
   g_mount_guess_content_type(gobj(),
                   force_rescan,
-                  cancellable->gobj(), 
+                  cancellable->gobj(),
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -174,7 +174,7 @@
 
   g_mount_guess_content_type(gobj(),
                   force_rescan,
-                  NULL, 
+                  NULL,
                   &SignalProxy_async_callback,
                   slot_copy);
 }
@@ -183,11 +183,42 @@
 {
   g_mount_guess_content_type(gobj(),
                   force_rescan,
-                  NULL, 
+                  NULL,
                   NULL,
                   NULL);
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+void Mount::guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan)
+#else
+void Mount::guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+    GError* gerror = 0;
+    g_mount_guess_content_type_sync(gobj(), force_rescan, cancellable->gobj(),
+                                    &gerror);
+  if(gerror)
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+      error =
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+          ::Glib::Error::throw_exception(gerror);
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+void Mount::guess_content_type_sync(bool force_rescan)
+#else
+void Mount::guess_content_type_sync(bool force_rescan, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+    GError* gerror = 0;
+    g_mount_guess_content_type_sync(gobj(), force_rescan, NULL, &gerror);
+  if(gerror)
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+      error =
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+          ::Glib::Error::throw_exception(gerror);
+}
+
 
 } // namespace Gio
 

Modified: trunk/gio/src/mount.hg
==============================================================================
--- trunk/gio/src/mount.hg	(original)
+++ trunk/gio/src/mount.hg	Fri Dec 12 02:42:47 2008
@@ -219,12 +219,24 @@
   void guess_content_type(bool force_rescan = true);
   _IGNORE(g_mount_guess_content_type)
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  void guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan = true);
+  void guess_content_type_sync(bool force_rescan = true);
+#else
+  void guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan, std::auto_ptr<Glib::Error>& error);
+  void guess_content_type_sync(bool force_rescan, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+  _IGNORE(g_mount_guess_content_type_sync)
 
   #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
 
   //TODO: Correct the documentation:
   _WRAP_METHOD(Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_guess_content_type_finish, errthrow)
 
+  _WRAP_METHOD(bool is_shadowed() const, g_mount_is_shadowed)
+  _WRAP_METHOD(void shadow(), g_mount_shadow)
+  _WRAP_METHOD(void unshadow(), g_mount_unshadow)
+
 
   _WRAP_SIGNAL(void changed(), changed)
   _WRAP_SIGNAL(void unmounted(), unmounted)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]