GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-plugin-stylesheets.c
1 /*
2  * gnc-plugin-stylesheets.c --
3  * Copyright (C) 2003 David Hampton <[email protected]>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, contact:
17  *
18  * Free Software Foundation Voice: +1-617-542-5942
19  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
20  * Boston, MA 02110-1301, USA [email protected]
21  */
22 
23 #include "config.h"
24 
25 #include <gtk/gtk.h>
26 #include <glib/gi18n.h>
27 
28 #include "dialog-report-style-sheet.h"
29 #include "gnc-gnome-utils.h"
30 #include "gnc-plugin-stylesheets.h"
31 #include "gnc-plugin-manager.h"
32 #include "gnc-engine.h"
33 
34 static void gnc_plugin_stylesheets_class_init (GncPluginStylesheetsClass *klass);
35 static void gnc_plugin_stylesheets_init (GncPluginStylesheets *plugin);
36 static void gnc_plugin_stylesheets_finalize (GObject *object);
37 
38 
39 /* Command callbacks */
40 static void gnc_plugin_stylesheets_cmd_edit_style_sheet (GtkAction *action,
42 
43 
44 #define PLUGIN_ACTIONS_NAME "gnc-plugin-stylesheets-actions"
45 #define PLUGIN_UI_FILENAME "gnc-plugin-stylesheets-ui.xml"
46 
47 static GtkActionEntry gnc_plugin_actions [] =
48 {
49  /* Menu Items */
50  {
51  "EditStyleSheetsAction", NULL, N_("St_yle Sheets"), NULL,
52  N_("Edit report style sheets"),
53  G_CALLBACK (gnc_plugin_stylesheets_cmd_edit_style_sheet)
54  },
55 };
56 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
57 
58 
60 {
61  gpointer dummy;
63 
64 #define GNC_PLUGIN_STYLESHEETS_GET_PRIVATE(o) \
65  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_STYLESHEETS, GncPluginStylesheetsPrivate))
66 
67 static GObjectClass *parent_class = NULL;
68 
69 /************************************************************
70  * Object Implementation *
71  ************************************************************/
72 
73 GType
74 gnc_plugin_stylesheets_get_type (void)
75 {
76  static GType gnc_plugin_stylesheets_type = 0;
77 
78  if (gnc_plugin_stylesheets_type == 0)
79  {
80  static const GTypeInfo our_info =
81  {
83  NULL, /* base_init */
84  NULL, /* base_finalize */
85  (GClassInitFunc) gnc_plugin_stylesheets_class_init,
86  NULL, /* class_finalize */
87  NULL, /* class_data */
88  sizeof (GncPluginStylesheets),
89  0, /* n_preallocs */
90  (GInstanceInitFunc) gnc_plugin_stylesheets_init,
91  };
92 
93  gnc_plugin_stylesheets_type = g_type_register_static (GNC_TYPE_PLUGIN,
94  "GncPluginStylesheets",
95  &our_info, 0);
96  }
97 
98  return gnc_plugin_stylesheets_type;
99 }
100 
101 GncPlugin *
102 gnc_plugin_stylesheets_new (void)
103 {
104  return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_STYLESHEETS, NULL));
105 }
106 
107 static void
108 gnc_plugin_stylesheets_class_init (GncPluginStylesheetsClass *klass)
109 {
110  GObjectClass *object_class = G_OBJECT_CLASS (klass);
111  GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
112 
113  parent_class = g_type_class_peek_parent (klass);
114 
115  object_class->finalize = gnc_plugin_stylesheets_finalize;
116 
117  /* plugin info */
118  plugin_class->plugin_name = GNC_PLUGIN_STYLESHEETS_NAME;
119 
120  /* widget addition/removal */
121  plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
122  plugin_class->actions = gnc_plugin_actions;
123  plugin_class->n_actions = gnc_plugin_n_actions;
124  plugin_class->ui_filename = PLUGIN_UI_FILENAME;
125 
126  g_type_class_add_private(klass, sizeof(GncPluginStylesheetsPrivate));
127 }
128 
129 static void
130 gnc_plugin_stylesheets_init (GncPluginStylesheets *plugin)
131 {
132 }
133 
134 static void
135 gnc_plugin_stylesheets_finalize (GObject *object)
136 {
137  g_return_if_fail (GNC_IS_PLUGIN_STYLESHEETS (object));
138 
139  G_OBJECT_CLASS (parent_class)->finalize (object);
140 }
141 
142 /************************************************************
143  * Command Callbacks *
144  ************************************************************/
145 
146 static void
147 gnc_plugin_stylesheets_cmd_edit_style_sheet (GtkAction *action,
149 {
150  gnc_style_sheet_dialog_open();
151 }
152 
153 /************************************************************
154  * Plugin Bootstrapping *
155  ************************************************************/
156 
157 void
158 gnc_plugin_stylesheets_create_plugin (void)
159 {
160  GncPlugin *plugin = gnc_plugin_stylesheets_new ();
161 
163 }
Plugin management functions for the GnuCash UI.
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
const gchar * ui_filename
Definition: gnc-plugin.h:137
GtkActionEntry * actions
Definition: gnc-plugin.h:122
GncPluginManager * gnc_plugin_manager_get(void)
Gnome specific utility functions.
All type declarations for the whole Gnucash engine.
const gchar * actions_name
Definition: gnc-plugin.h:119
const gchar * plugin_name
Definition: gnc-plugin.h:112
#define PLUGIN_ACTIONS_NAME
#define PLUGIN_UI_FILENAME