[nautilus-actions] Introduce new NactApplication class
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Introduce new NactApplication class
- Date: Thu, 11 Jun 2009 17:30:27 -0400 (EDT)
commit bd43e60f8f59230d1bab8c264c2d243b4f1672ea
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jun 11 18:38:21 2009 +0200
Introduce new NactApplication class
ChangeLog | 3 +
src/nact/Makefile.am | 2 +
src/nact/nact-application.c | 155 +++++++++++++++++++++++++++++++++++++++++++
src/nact/nact-application.h | 73 ++++++++++++++++++++
4 files changed, 233 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c383a8..8789d6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
Externalize main function in nact-main.c.
init_dialog becomes public as nact_init_dialog.
+ * src/nact/nact-application.c:
+ * src/nact/nact-application.h: New NactApplication class.
+
* src/nact/nact-main.c: New file.
* src/nact/Makefile.am: Updated accordingly.
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index de95932..49e2b43 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -41,6 +41,8 @@ AM_CPPFLAGS += \
nautilus_actions_config_SOURCES = \
nact.c \
nact.h \
+ nact-application.c \
+ nact-application.h \
nact-main.c \
nact-utils.c \
nact-utils.h \
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
new file mode 100644
index 0000000..1bb926f
--- /dev/null
+++ b/src/nact/nact-application.c
@@ -0,0 +1,155 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "nact-application.h"
+
+/* private class data
+ */
+struct NactApplicationClassPrivate {
+};
+
+/* private instance data
+ */
+struct NactApplicationPrivate {
+ gboolean dispose_has_run;
+};
+
+static GObjectClass *st_parent_class = NULL;
+
+static GType register_type( void );
+static void class_init( NactApplicationClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
+
+GType
+nact_application_get_type( void )
+{
+ static GType application_type = 0;
+
+ if( !application_type ){
+ application_type = register_type();
+ }
+
+ return( application_type );
+}
+
+static GType
+register_type( void )
+{
+ static GTypeInfo info = {
+ sizeof( NactApplicationClass ),
+ ( GBaseInitFunc ) NULL,
+ ( GBaseFinalizeFunc ) NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NactApplication ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ return( g_type_register_static( G_TYPE_OBJECT, "NactApplication", &info, 0 ));
+}
+
+static void
+class_init( NactApplicationClass *klass )
+{
+ static const gchar *thisfn = "nact_application_class_init";
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ st_parent_class = g_type_class_peek_parent( klass );
+
+ GObjectClass *application_class = G_OBJECT_CLASS( klass );
+ application_class->dispose = instance_dispose;
+ application_class->finalize = instance_finalize;
+
+ klass->private = g_new0( NactApplicationClassPrivate, 1 );
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "nact_application_instance_init";
+ g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+
+ g_assert( NACT_IS_APPLICATION( instance ));
+ NactApplication *self = NACT_APPLICATION( instance );
+
+ self->private = g_new0( NactApplicationPrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+}
+
+static void
+instance_dispose( GObject *application )
+{
+ static const gchar *thisfn = "nact_application_instance_dispose";
+ g_debug( "%s: application=%p", thisfn, application );
+
+ g_assert( NACT_IS_APPLICATION( application ));
+ NactApplication *self = NACT_APPLICATION( application );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ /* chain up to the parent class */
+ G_OBJECT_CLASS( st_parent_class )->dispose( application );
+ }
+}
+
+static void
+instance_finalize( GObject *application )
+{
+ static const gchar *thisfn = "nact_application_instance_finalize";
+ g_debug( "%s: application=%p", thisfn, application );
+
+ g_assert( NACT_IS_APPLICATION( application ));
+ /*NactApplication *self = ( NactApplication * ) application;*/
+
+ /* chain call to parent class */
+ if( st_parent_class->finalize ){
+ G_OBJECT_CLASS( st_parent_class )->finalize( application );
+ }
+}
+
+/**
+ * Returns a newly allocated NactApplication object.
+ */
+NactApplication *
+nact_application_new( void )
+{
+ return( g_object_new( NACT_APPLICATION_TYPE, NULL ));
+}
diff --git a/src/nact/nact-application.h b/src/nact/nact-application.h
new file mode 100644
index 0000000..b22355b
--- /dev/null
+++ b/src/nact/nact-application.h
@@ -0,0 +1,73 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_APPLICATION_H__
+#define __NACT_APPLICATION_H__
+
+/*
+ * NactApplication class definition.
+ *
+ * This is the main class for UI programs.
+ */
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NACT_APPLICATION_TYPE ( nact_application_get_type())
+#define NACT_APPLICATION( application ) ( G_TYPE_CHECK_INSTANCE_CAST( application, NACT_APPLICATION_TYPE, NactApplication ))
+#define NACT_APPLICATION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_APPLICATION_TYPE, NactApplicationClass ))
+#define NACT_IS_APPLICATION( application ) ( G_TYPE_CHECK_INSTANCE_TYPE( application, NACT_APPLICATION_TYPE ))
+#define NACT_IS_APPLICATION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_APPLICATION_TYPE ))
+#define NACT_APPLICATION_GET_CLASS( application ) ( G_TYPE_INSTANCE_GET_CLASS(( application ), NACT_APPLICATION_TYPE, NactApplicationClass ))
+
+typedef struct NactApplicationPrivate NactApplicationPrivate;
+
+typedef struct {
+ GObject parent;
+ NactApplicationPrivate *private;
+}
+ NactApplication;
+
+typedef struct NactApplicationClassPrivate NactApplicationClassPrivate;
+
+typedef struct {
+ GObjectClass parent;
+ NactApplicationClassPrivate *private;
+}
+ NactApplicationClass;
+
+GType nact_application_get_type( void );
+
+NactApplication *nact_application_new( void);
+
+G_END_DECLS
+
+#endif /* __NACT_APPLICATION_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]