glibmm r580 - in trunk: . gio/src glib/glibmm tools/m4
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glibmm r580 - in trunk: . gio/src glib/glibmm tools/m4
- Date: Mon, 4 Feb 2008 20:27:38 +0000 (GMT)
Author: murrayc
Date: Mon Feb 4 20:27:38 2008
New Revision: 580
URL: http://svn.gnome.org/viewvc/glibmm?rev=580&view=rev
Log:
2008-02-04 Murray Cumming <murrayc murrayc com>
* tools/m4/class_interface.m4: Allow _CLASS_INTERFACE() to take two
extra optional paremeters to specify the base class, so that appropriate
code is generated when we derive from another Interface - which seems
appropriate when the GInterface has a prerequisite.
* gio/src/loadableicon.ccg:
* gio/src/loadableicon.hg: Derive from Icon, because it is a prerequisite
of this interface. Use the extra _CLASS_INTERFACE() parameters.
* gio/src/fileicon.hg: Do not derive from Icon because that happens
through LoadableIcon now. But do use _IMPLEMENTS_INTERFACE(Icon) here,
because only a Glib::Object can actually implement an interface.
Modified:
trunk/ChangeLog
trunk/gio/src/fileicon.hg
trunk/gio/src/loadableicon.ccg
trunk/gio/src/loadableicon.hg
trunk/glib/glibmm/interface.h
trunk/tools/m4/class_interface.m4
Modified: trunk/gio/src/fileicon.hg
==============================================================================
--- trunk/gio/src/fileicon.hg (original)
+++ trunk/gio/src/fileicon.hg Mon Feb 4 20:27:38 2008
@@ -34,7 +34,7 @@
*/
class FileIcon
: public Glib::Object,
- public Icon,
+ //Already derived by LoadableIcon: public Icon,
public LoadableIcon
{
_CLASS_GOBJECT(FileIcon, GFileIcon, G_FILE_ICON, Glib::Object, GObject)
Modified: trunk/gio/src/loadableicon.ccg
==============================================================================
--- trunk/gio/src/loadableicon.ccg (original)
+++ trunk/gio/src/loadableicon.ccg Mon Feb 4 20:27:38 2008
@@ -18,9 +18,11 @@
*/
#include <gio/gio.h>
+#include <giomm/private/icon_p.h>
#include "slot_async.h"
-namespace Gio {
+namespace Gio
+{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<InputStream>
Modified: trunk/gio/src/loadableicon.hg
==============================================================================
--- trunk/gio/src/loadableicon.hg (original)
+++ trunk/gio/src/loadableicon.hg Mon Feb 4 20:27:38 2008
@@ -17,12 +17,12 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/interface.h>
+#include <giomm/icon.h>
#include <giomm/inputstream.h>
#include <giomm/icon.h>
_DEFS(giomm,gio)
-_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(giomm/private/icon_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GLoadableIconIface GLoadableIconIface;
@@ -35,14 +35,9 @@
*
* @newin2p16
*/
-class LoadableIcon :
- public Glib::Interface,
- public Gio::Icon
+class LoadableIcon : public Icon
{
- // TODO: this is an interface that extends another interface -- is there
- // something else we need to do here, or is inheriting from the C++ class
- // enough?
- _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface)
+ _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface, Icon, GIcon)
public:
/**
Modified: trunk/glib/glibmm/interface.h
==============================================================================
--- trunk/glib/glibmm/interface.h (original)
+++ trunk/glib/glibmm/interface.h Mon Feb 4 20:27:38 2008
@@ -41,7 +41,20 @@
typedef GTypeInterface BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+ /** Called by constructors of derived classes. Provide the result of
+ * the Class object's init() function to ensure that it is properly
+ * initialized.
+ *
+ * @param interface_class The Class object for the derived type.
+ */
explicit Interface(const Glib::Interface_Class& interface_class);
+
+ /** Called by constructors of derived classes.
+ *
+ * @param cast_item A C instance that will be wrapped by the new
+ * C++ instance. This does not take a reference, so call reference()
+ * if necessary.
+ */
explicit Interface(GObject* castitem);
virtual ~Interface();
Modified: trunk/tools/m4/class_interface.m4
==============================================================================
--- trunk/tools/m4/class_interface.m4 (original)
+++ trunk/tools/m4/class_interface.m4 Mon Feb 4 20:27:38 2008
@@ -10,9 +10,9 @@
define(`__CCAST__',`$3')
define(`__CCLASS__',`$4') dnl SomethingIface or SomethingClass, both suffixes are used.
define(`__BASE__',_LOWER(__CPPNAME__))
-define(`__CPPPARENT__',`Glib::Interface')
-dnl define(`__CPARENT__',`GObject')
-define(`__PCAST__',`(GObject*)')
+define(`__CPPPARENT__',m4_ifelse($5,`',`Glib::Interface',$5)) #Optional parameter.
+define(`__CPARENT__',m4_ifelse($6,`',`GObject',$6)) #Optional parameter.
+define(`__PCAST__',`(__CPARENT__`'*)')
define(`__BOOL_IS_INTERFACE__',`1')
@@ -34,7 +34,7 @@
dnl
dnl
define(`_PH_CLASS_DECLARATION_INTERFACE',`dnl
-class __CPPNAME__`'_Class : public Glib::Interface_Class
+class __CPPNAME__`'_Class : public __CPPPARENT__`'_Class
{
public:
typedef __CPPNAME__ CppObjectType;
@@ -187,7 +187,7 @@
__CPPNAME__::__CPPNAME__`'()
:
- Glib::Interface(__BASE__`'_class_.init())
+ __CPPPARENT__`'(__BASE__`'_class_.init())
{}
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
@@ -195,6 +195,11 @@
__CPPPARENT__`'(__PCAST__`'(castitem))
{}
+__CPPNAME__::__CPPNAME__`'(const Glib::Interface_Class& interface_class)
+: __CPPPARENT__`'(interface_class)
+{
+}
+
__CPPNAME__::~__CPPNAME__`'()
{}
@@ -238,6 +243,14 @@
protected:
__CPPNAME__`'(); // you must derive from this class
+ /** Called by constructors of derived classes. Provide the result of
+ * the Class init() function to ensure that it is properly
+ * initialized.
+ *
+ * @param interface_class The Class object for the derived type.
+ */
+ explicit __CPPNAME__`'(const Glib::Interface_Class& interface_class);
+
public:
// This is public so that C++ wrapper instances can be
// created for C instances of unwrapped types.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]