1 /* gAlan - Graphical Audio Language
2 * Copyright (C) 1999 Tony Garnock-Jones
3 * Copyright (C) 2001 Torben Hohn
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "comp-action-class.h"
27 COMPACTION_COMPKLASS
= 1,
32 static void compaction_instance_init( GTypeInstance
*instance
, gpointer g_class
) {
34 //CompAction *self = (CompAction *) instance;
38 static void compaction_set_property( GObject
*object
, guint property_id
, const GValue
*value
, GParamSpec
*pspec
) {
39 CompAction
*self
= COMPACTION( object
);
41 switch( property_id
) {
42 case COMPACTION_COMPKLASS
:
43 self
->k
= g_value_get_pointer( value
);
45 case COMPACTION_INIT_DATA
:
46 self
->init_data
= g_value_get_pointer( value
);
49 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, property_id
, pspec
);
51 printf( "halb gut...\n" );
55 static void compaction_get_property( GObject
*object
, guint property_id
, GValue
*value
, GParamSpec
*pspec
) {
56 CompAction
*self
= COMPACTION( object
);
58 switch( property_id
) {
59 case COMPACTION_COMPKLASS
:
60 g_value_set_pointer( value
, self
->k
);
62 case COMPACTION_INIT_DATA
:
63 g_value_set_pointer( value
, self
->init_data
);
65 printf( "halb gut...\n" );
69 static void compaction_activate( GtkAction
*action
) {
70 CompAction
*self
= COMPACTION( action
);
72 printf( "Ok... soweit isses schon... k->name = %s\n", self
->k
->class_tag
);
73 Sheet
*s
= gui_get_active_sheet();
74 sheet_build_new_component(s
, self
->k
, self
->init_data
);
77 static void compaction_class_init( gpointer g_class
, gpointer g_class_data
) {
79 GObjectClass
*gobject_class
= G_OBJECT_CLASS( g_class
);
80 GtkActionClass
*gtkaction_class
= GTK_ACTION_CLASS( g_class
);
81 //CompActionClass *klass = COMPACTION_CLASS( g_class );
85 gobject_class
->set_property
= compaction_set_property
;
86 gobject_class
->get_property
= compaction_get_property
;
88 pspec
= g_param_spec_pointer(
92 G_PARAM_CONSTRUCT_ONLY
| G_PARAM_READWRITE
);
93 g_object_class_install_property( gobject_class
, COMPACTION_COMPKLASS
, pspec
);
95 pspec
= g_param_spec_pointer(
99 G_PARAM_CONSTRUCT_ONLY
| G_PARAM_READWRITE
);
100 g_object_class_install_property( gobject_class
, COMPACTION_INIT_DATA
, pspec
);
102 gtkaction_class
->activate
= compaction_activate
;
106 GType
compaction_get_type( void ) {
107 static GType type
= 0;
109 static const GTypeInfo info
= {
110 sizeof( CompActionClass
),
113 compaction_class_init
,
116 sizeof( CompAction
),
118 compaction_instance_init
120 type
= g_type_register_static( GTK_TYPE_ACTION
, "CompActionType", &info
, 0 );