GnuCash  5.6-150-g038405b370+
gnc-plugin-page.h
Go to the documentation of this file.
1 /*
2  * gnc-plugin-page.h -- A page, which can be added to the
3  * GnuCash main window.
4  *
5  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
6  * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, contact:
20  *
21  * Free Software Foundation Voice: +1-617-542-5942
22  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
23  * Boston, MA 02110-1301, USA gnu@gnu.org
24  */
25 
36 #ifndef __GNC_PLUGIN_PAGE_H
37 #define __GNC_PLUGIN_PAGE_H
38 
39 #include <glib.h>
40 #include "qof.h"
41 
42 G_BEGIN_DECLS
43 
44 #define GNC_PREF_SUMMARYBAR_POSITION_TOP "summarybar-position-top"
45 #define GNC_PREF_SUMMARYBAR_POSITION_BOTTOM "summarybar-position-bottom"
46 
47 /* type macros */
48 #define GNC_TYPE_PLUGIN_PAGE (gnc_plugin_page_get_type ())
49 #define GNC_PLUGIN_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPage))
50 #define GNC_PLUGIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE, GncPluginPageClass))
51 #define GNC_IS_PLUGIN_PAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN_PAGE))
52 #define GNC_IS_PLUGIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE))
53 #define GNC_PLUGIN_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN_PAGE, GncPluginPageClass))
54 
55 /* typedefs & structures */
56 
58 typedef struct GncPluginPage
59 {
60  GObject gobject;
62  GtkWidget *window;
67  GtkWidget *notebook_page;
71  GtkWidget *summarybar;
77 
78 
80 typedef struct
81 {
82  GObjectClass gobject;
83 
86  const gchar *tab_icon;
88  const gchar *plugin_name;
89 
90  /* Signals */
91  void (* inserted) (GncPluginPage *plugin_page);
92  void (* removed) (GncPluginPage *plugin_page);
93  void (* selected) (GncPluginPage *plugin_page);
94  void (* unselected) (GncPluginPage *plugin_page);
95 
96  /* Virtual Table */
97 
107  GtkWidget *(* create_widget) (GncPluginPage *plugin_page);
108 
114  void (* destroy_widget) (GncPluginPage *plugin_page);
115 
126  void (* save_page) (GncPluginPage *page, GKeyFile *file,
127  const gchar *group);
128 
146  GncPluginPage * (* recreate_page) (GtkWidget *window, GKeyFile *file,
147  const gchar *group);
148 
158  void (* window_changed) (GncPluginPage *plugin_page, GtkWidget *window);
159 
165  void (* focus_page) (GncPluginPage *plugin_page, gboolean on_current_page);
166 
173  gboolean (* focus_page_function) (GncPluginPage *plugin_page);
174 
181  void (* page_name_changed) (GncPluginPage *plugin_page,
182  const gchar *name);
183 
192  void (* update_edit_menu_actions) (GncPluginPage *plugin_page, gboolean hide);
193 
203  gboolean (* finish_pending) (GncPluginPage *plugin_page);
205 
206 
211 GType gnc_plugin_page_get_type (void);
212 
213 
225 GtkWidget *gnc_plugin_page_create_widget (GncPluginPage *plugin_page);
226 
227 
236 
237 
244 void gnc_plugin_page_show_summarybar (GncPluginPage *page, gboolean visible);
245 
246 
260  GKeyFile *key_file,
261  const gchar *group_name);
262 
263 
277 GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window,
278  const gchar *page_type,
279  GKeyFile *key_file,
280  const gchar *group_name);
281 
282 
288 void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page);
289 
290 
299 const gchar *gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page);
300 
301 
308 void gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book);
309 
310 
322 gboolean gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book);
323 
324 
332 
333 
341 GtkWidget *gnc_plugin_page_get_window (GncPluginPage *page);
342 
343 
352 const gchar *gnc_plugin_page_get_page_name (GncPluginPage *page);
353 
354 
362 void gnc_plugin_page_set_page_name (GncPluginPage *page, const char *name);
363 
364 
375 
376 
384 void gnc_plugin_page_set_page_long_name (GncPluginPage *page, const char *name);
385 
386 
395 const gchar *gnc_plugin_page_get_page_color (GncPluginPage *page);
396 
397 
406 void gnc_plugin_page_set_page_color (GncPluginPage *page, const char *color);
407 
408 
417 void gnc_plugin_page_inserted_cb (GncPluginPage *page, gpointer user_data);
418 
419 
425 
426 
435 
436 
444  const char *name);
445 
446 
454 
455 
466  gboolean use_new);
467 
468 
477 
478 
490  const char *ui_filename);
491 
492 
498 GtkBuilder *gnc_plugin_page_get_builder (GncPluginPage *page);
499 
500 
508 
517  const char *menu_qualifier);
518 
526 
535  const char *menu_qualifier);
536 
544 GSimpleActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
545 
558 GSimpleActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
559  const gchar *group_name);
560 
569 
570 
581  const gchar *action_name);
582 
583 /* Signals */
584 void gnc_plugin_page_inserted (GncPluginPage *plugin_page);
585 void gnc_plugin_page_removed (GncPluginPage *plugin_page);
586 void gnc_plugin_page_selected (GncPluginPage *plugin_page);
587 void gnc_plugin_page_unselected (GncPluginPage *plugin_page);
588 
596 gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page);
597 
598 G_END_DECLS
599 
600 #endif /* __GNC_PLUGIN_PAGE_H */
601 
GncPluginPage * gnc_plugin_page_recreate_page(GtkWidget *window, const gchar *page_type, GKeyFile *key_file, const gchar *page_group)
This function looks up a specific plugin type by name, and then calls a plugin specific function to c...
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
gboolean gnc_plugin_page_has_books(GncPluginPage *page)
Query a page to see if it has a reference to any book.
gboolean gnc_plugin_page_get_use_new_window(GncPluginPage *page)
Retrieve the "use new window" setting associated with this page.
const gchar * tab_icon
The relative name of the icon that should be shown on the tab for this page.
void gnc_plugin_page_set_menu_qualifier(GncPluginPage *page, const char *menu_qualifier)
Set a qualifier string for this page.
gboolean gnc_plugin_page_finish_pending(GncPluginPage *page)
Tell a page to finish any outstanding activities.
GType gnc_plugin_page_get_type(void)
Get the type of a content plugin.
void gnc_plugin_page_destroy_widget(GncPluginPage *plugin_page)
Destroy the display widget that corresponds to this plugin.
The instance data structure for a content plugin.
void gnc_plugin_page_set_statusbar_text(GncPluginPage *page, const char *name)
Set the statusbar text associated with this page.
void gnc_plugin_page_merge_actions(GncPluginPage *page)
Add the actions for a content page to the specified window.
const gchar * gnc_plugin_page_get_page_long_name(GncPluginPage *page)
Retrieve the long name of this page.
void gnc_plugin_page_set_ui_description(GncPluginPage *page, const char *ui_filename)
Set an alternate UI for the specified page.
const gchar * gnc_plugin_page_get_page_name(GncPluginPage *page)
Retrieve the name of this page.
GSimpleActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
Retrieve the GSimpleActionGroup object associated with this page.
GtkBuilder * gnc_plugin_page_get_builder(GncPluginPage *page)
Retrieve the GtkBuilder object associated with this page.
GtkWidget * window
The window that contains the display widget for this plugin.
const gchar * gnc_plugin_page_get_page_color(GncPluginPage *page)
Retrieve the color of this page.
void gnc_plugin_page_set_page_long_name(GncPluginPage *page, const char *name)
Set the long name of this page.
const gchar * gnc_plugin_page_get_ui_description(GncPluginPage *page)
Retrieve the name of the XML UI file associated with this page.
GSimpleActionGroup * gnc_plugin_page_create_action_group(GncPluginPage *page, const gchar *group_name)
Create the GSimpleActionGroup object associated with this page.
const gchar * gnc_plugin_page_get_menu_qualifier(GncPluginPage *page)
Retrieve the menu qualifier for this page.
const gchar * gnc_plugin_page_get_menu_popup_qualifier(GncPluginPage *page)
Retrieve the menu popup qualifier for this page.
GObject gobject
The parent object data.
The class data structure for a content plugin.
void gnc_plugin_page_set_use_new_window(GncPluginPage *page, gboolean use_new)
Set the "use new window" setting associated with this page.
void gnc_plugin_page_disconnect_page_changed(GncPluginPage *page)
Disconnect the page_changed_id signal callback.
gboolean gnc_plugin_page_has_book(GncPluginPage *page, QofBook *book)
Query a page to see if it has a reference to a given book.
const gchar * plugin_name
The textual name of this plugin.
const gchar * gnc_plugin_page_get_simple_action_group_name(GncPluginPage *page)
Retrieve the simple action group name associated with this plugin page.
const gchar * gnc_plugin_page_get_statusbar_text(GncPluginPage *page)
Retrieve the statusbar text associated with this page.
void gnc_plugin_page_save_page(GncPluginPage *page, GKeyFile *key_file, const gchar *group_name)
Call the plugin specific function that will save the state of a content page to a disk...
void gnc_plugin_page_set_page_color(GncPluginPage *page, const char *color)
Set the color of this page.
void gnc_plugin_page_set_menu_popup_qualifier(GncPluginPage *page, const char *menu_qualifier)
Set a qualifier string for this page.
void gnc_plugin_page_inserted_cb(GncPluginPage *page, gpointer user_data)
Set up the page_changed callback for when the current page is changed.
void gnc_plugin_page_set_page_name(GncPluginPage *page, const char *name)
Set the name of this page.
void gnc_plugin_page_add_book(GncPluginPage *page, QofBook *book)
Add a book reference to the specified page.
GAction * gnc_plugin_page_get_action(GncPluginPage *page, const gchar *name)
Retrieve a GAction object associated with this page.
GtkWidget * notebook_page
The display widget for this plugin.
void gnc_plugin_page_show_summarybar(GncPluginPage *page, gboolean visible)
Show/hide the summarybar associated with this page.
GtkWidget * summarybar
The summary bar widget (if any) that is associated with this plugin.
GtkWidget * gnc_plugin_page_create_widget(GncPluginPage *plugin_page)
Create the display widget that corresponds to this plugin.
const gchar * gnc_plugin_page_get_plugin_name(GncPluginPage *plugin_page)
Retrieve the textual name of a plugin.