seahorse r2628 - trunk/libcryptui/template



Author: nnielsen
Date: Sat Nov 22 22:54:26 2008
New Revision: 2628
URL: http://svn.gnome.org/viewvc/seahorse?rev=2628&view=rev

Log:
Add some template files for GObject classes and interfaces.

Added:
   trunk/libcryptui/template/
   trunk/libcryptui/template/crui-xxx.c
   trunk/libcryptui/template/crui-xxx.h
   trunk/libcryptui/template/crui-zzz.c
   trunk/libcryptui/template/crui-zzz.h

Added: trunk/libcryptui/template/crui-xxx.c
==============================================================================
--- (empty file)
+++ trunk/libcryptui/template/crui-xxx.c	Sat Nov 22 22:54:26 2008
@@ -0,0 +1,159 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#include "config.h"
+
+#include "crui-xxx.h"
+
+enum {
+	PROP_0,
+	PROP_XXX
+};
+
+enum {
+	SIGNAL,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+struct _CruiXxxPrivate {
+};
+
+G_DEFINE_TYPE (CruiXxx, crui_xxx, G_TYPE_OBJECT);
+
+#define CRUI_XXX_GET_PRIVATE(o) \
+	(G_TYPE_INSTANCE_GET_PRIVATE ((o), CRUI_TYPE_XXX, CruiXxxPrivate))
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL 
+ */
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+
+static GObject* 
+crui_xxx_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+{
+	GObject *obj = G_OBJECT_CLASS (crui_xxx_parent_class)->constructor (type, n_props, props);
+	CruiXxx *self = NULL;
+	CruiXxxPrivate *pv;
+	
+	if (obj) {
+		pv = CRUI_XXX_GET_PRIVATE (obj);
+		self = CRUI_XXX (obj);
+		
+	}
+	
+	return obj;
+}
+
+static void
+crui_xxx_init (CruiXxx *self)
+{
+	CruiXxxPrivate *pv = CRUI_XXX_GET_PRIVATE (self);
+
+}
+
+static void
+crui_xxx_dispose (GObject *obj)
+{
+	CruiXxx *self = CRUI_XXX (obj);
+	CruiXxxPrivate *pv = CRUI_XXX_GET_PRIVATE (self);
+    
+	G_OBJECT_CLASS (crui_xxx_parent_class)->dispose (obj);
+}
+
+static void
+crui_xxx_finalize (GObject *obj)
+{
+	CruiXxx *self = CRUI_XXX (obj);
+	CruiXxxPrivate *pv = CRUI_XXX_GET_PRIVATE (self);
+
+	G_OBJECT_CLASS (crui_xxx_parent_class)->finalize (obj);
+}
+
+static void
+crui_xxx_set_property (GObject *obj, guint prop_id, const GValue *value, 
+                           GParamSpec *pspec)
+{
+	CruiXxx *self = CRUI_XXX (obj);
+	CruiXxxPrivate *pv = CRUI_XXX_GET_PRIVATE (self);
+	
+	switch (prop_id) {
+	case PROP_XXX:
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+crui_xxx_get_property (GObject *obj, guint prop_id, GValue *value, 
+                           GParamSpec *pspec)
+{
+	CruiXxx *self = CRUI_XXX (obj);
+	CruiXxxPrivate *pv = CRUI_XXX_GET_PRIVATE (self);
+	
+	switch (prop_id) {
+	case PROP_XXX:
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+crui_xxx_class_init (CruiXxxClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+    
+	crui_xxx_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (CruiXxxPrivate));
+
+	gobject_class->constructor = crui_xxx_constructor;
+	gobject_class->dispose = crui_xxx_dispose;
+	gobject_class->finalize = crui_xxx_finalize;
+	gobject_class->set_property = crui_xxx_set_property;
+	gobject_class->get_property = crui_xxx_get_property;
+    
+	g_object_class_install_property (gobject_class, PROP_XXX,
+	           g_param_spec_pointer ("xxx", "Xxx", "Xxx.", G_PARAM_READWRITE));
+    
+	signals[SIGNAL] = g_signal_new ("signal", CRUI_TYPE_XXX, 
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (CruiXxxClass, signal),
+	                                NULL, NULL, g_cclosure_marshal_VOID__OBJECT, 
+	                                G_TYPE_NONE, 0);
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+CruiXxx*
+crui_xxx_new (void)
+{
+	return g_object_new (CRUI_TYPE_XXX, NULL);
+}

Added: trunk/libcryptui/template/crui-xxx.h
==============================================================================
--- (empty file)
+++ trunk/libcryptui/template/crui-xxx.h	Sat Nov 22 22:54:26 2008
@@ -0,0 +1,54 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#ifndef __CRUI_XXX_H__
+#define __CRUI_XXX_H__
+
+#include <glib-object.h>
+
+#define CRUI_TYPE_XXX               (crui_xxx_get_type ())
+#define CRUI_XXX(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CRUI_TYPE_XXX, CruiXxx))
+#define CRUI_XXX_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), CRUI_TYPE_XXX, CruiXxxClass))
+#define CRUI_IS_XXX(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CRUI_TYPE_XXX))
+#define CRUI_IS_XXX_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), CRUI_TYPE_XXX))
+#define CRUI_XXX_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), CRUI_TYPE_XXX, CruiXxxClass))
+
+typedef struct _CruiXxx CruiXxx;
+typedef struct _CruiXxxClass CruiXxxClass;
+typedef struct _CruiXxxPrivate CruiXxxPrivate;
+    
+struct _CruiXxx {
+	GObject parent;
+};
+
+struct _CruiXxxClass {
+	GObjectClass parent_class;
+    
+	/* signals --------------------------------------------------------- */
+    
+	void (*signal) (CruiXxx *xxx);
+};
+
+GType               crui_xxx_get_type               (void);
+
+CruiXxx*            crui_xxx_new                    (void);
+
+#endif /* __CRUI_XXX_H__ */

Added: trunk/libcryptui/template/crui-zzz.c
==============================================================================
--- (empty file)
+++ trunk/libcryptui/template/crui-zzz.c	Sat Nov 22 22:54:26 2008
@@ -0,0 +1,60 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#include "config.h"
+
+#include "crui-zzz.h"
+
+static void
+crui_zzz_base_init (gpointer gobject_class)
+{
+	static gboolean initialized = FALSE;
+	if (!initialized) {
+		/* Add properties and signals to the interface */
+		
+		
+		initialized = TRUE;
+	}
+}
+
+GType
+crui_zzz_get_type (void)
+{
+	static GType type = 0;
+	if (!type) {
+		static const GTypeInfo info = {
+			sizeof (CruiZzzIFace),
+			crui_zzz_base_init,               /* base init */
+			NULL,             /* base finalize */
+			NULL,             /* class_init */
+			NULL,             /* class finalize */
+			NULL,             /* class data */
+			0,
+			0,                /* n_preallocs */
+			NULL,             /* instance init */
+		};
+		type = g_type_register_static (G_TYPE_INTERFACE, "CruiZzzIFace", &info, 0);
+		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+	}
+	
+	return type;
+}
+

Added: trunk/libcryptui/template/crui-zzz.h
==============================================================================
--- (empty file)
+++ trunk/libcryptui/template/crui-zzz.h	Sat Nov 22 22:54:26 2008
@@ -0,0 +1,46 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#ifndef __CRUI_ZZZ_H__
+#define __CRUI_ZZZ_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define CRUI_TYPE_ZZZ                 (crui_zzz_get_type())
+#define CRUI_ZZZ(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CRUI_TYPE_ZZZ, CruiZzz))
+#define CRUI_IS_ZZZ(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CRUI_TYPE_ZZZ))
+#define CRUI_ZZZ_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), CRUI_TYPE_ZZZ, CruiZzzIface))
+
+typedef struct _CruiZzz      CruiZzz;
+typedef struct _CruiZzzIface CruiZzzIface;
+
+struct _CruiZzzIface {
+	GTypeInterface parent;
+};
+
+GType                  crui_zzz_get_type                          (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __CRUI_ZZZ_H__ */
+



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