GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Enumerations | Functions
Common object and functions

Files

file  gnc-plugin-page.c
 Functions for adding plugins to a GnuCash window.
 
file  gnc-plugin-page.h
 Functions for adding plugins to a GnuCash window.
 

Data Structures

struct  GncPluginPagePrivate
 The instance private data for a content plugin. More...
 
struct  GncPluginPage
 The instance data structure for a content plugin. More...
 
struct  GncPluginPageClass
 The class data structure for a content plugin. More...
 

Macros

#define GNC_PREF_SUMMARYBAR_POSITION_TOP   "summarybar-position-top"
 
#define GNC_PREF_SUMMARYBAR_POSITION_BOTTOM   "summarybar-position-bottom"
 
#define GNC_TYPE_PLUGIN_PAGE   (gnc_plugin_page_get_type ())
 
#define GNC_PLUGIN_PAGE(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPage))
 
#define GNC_PLUGIN_PAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE, GncPluginPageClass))
 
#define GNC_IS_PLUGIN_PAGE(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN_PAGE))
 
#define GNC_IS_PLUGIN_PAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE))
 
#define GNC_PLUGIN_PAGE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN_PAGE, GncPluginPageClass))
 

Enumerations

enum  {
  INSERTED , REMOVED , SELECTED , UNSELECTED ,
  LAST_SIGNAL
}
 
enum  {
  PROP_0 , PROP_PAGE_NAME , PROP_PAGE_COLOR , PROP_BOOK ,
  PROP_STATUSBAR_TEXT , PROP_USE_NEW_WINDOW , PROP_UI_DESCRIPTION
}
 

Functions

 G_DEFINE_TYPE_WITH_CODE (GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT, G_ADD_PRIVATE(GncPluginPage))
 
void gnc_plugin_page_destroy_widget (GncPluginPage *plugin_page)
 Destroy the display widget that corresponds to this plugin.
 
void gnc_plugin_page_show_summarybar (GncPluginPage *page, gboolean visible)
 Show/hide the summarybar 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.
 
GncPluginPagegnc_plugin_page_recreate_page (GtkWidget *window, const gchar *page_type, GKeyFile *key_file, const gchar *group_name)
 This function looks up a specific plugin type by name, and then calls a plugin specific function to create a new page and restore its content to a previous state.
 
void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page)
 Add the actions for a content page to the specified window.
 
GAction * gnc_plugin_page_get_action (GncPluginPage *page, const gchar *action_name)
 Retrieve a GAction object associated with this page.
 
const gchar * gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
 Retrieve the textual name of a plugin.
 
void gnc_plugin_page_inserted (GncPluginPage *plugin_page)
 
void gnc_plugin_page_removed (GncPluginPage *plugin_page)
 
void gnc_plugin_page_selected (GncPluginPage *plugin_page)
 
void gnc_plugin_page_unselected (GncPluginPage *plugin_page)
 
void gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book)
 Add a book reference to the specified page.
 
gboolean gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book)
 Query a page to see if it has a reference to a given book.
 
gboolean gnc_plugin_page_has_books (GncPluginPage *page)
 Query a page to see if it has a reference to any book.
 
GtkWidget * gnc_plugin_page_get_window (GncPluginPage *page)
 Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
 
const gchar * gnc_plugin_page_get_page_name (GncPluginPage *page)
 Retrieve the name of this page.
 
void gnc_plugin_page_set_page_name (GncPluginPage *page, const gchar *name)
 
const gchar * gnc_plugin_page_get_page_long_name (GncPluginPage *page)
 Retrieve the long name of this page.
 
void gnc_plugin_page_set_page_long_name (GncPluginPage *page, const gchar *name)
 
const gchar * gnc_plugin_page_get_page_color (GncPluginPage *page)
 Retrieve the color of this page.
 
void gnc_plugin_page_set_page_color (GncPluginPage *page, const gchar *color)
 
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_disconnect_page_changed (GncPluginPage *page)
 Disconnect the page_changed_id signal callback.
 
const gchar * gnc_plugin_page_get_statusbar_text (GncPluginPage *page)
 Retrieve the statusbar text associated with this page.
 
void gnc_plugin_page_set_statusbar_text (GncPluginPage *page, const gchar *message)
 
gboolean gnc_plugin_page_get_use_new_window (GncPluginPage *page)
 Retrieve the "use new window" setting associated with this page.
 
void gnc_plugin_page_set_use_new_window (GncPluginPage *page, gboolean use_new)
 Set the "use new window" setting associated with this page.
 
const gchar * gnc_plugin_page_get_ui_description (GncPluginPage *page)
 Retrieve the name of the XML UI file associated with this page.
 
void gnc_plugin_page_set_ui_description (GncPluginPage *page, const char *ui_filename)
 Set an alternate UI for the specified page.
 
GtkBuilder * gnc_plugin_page_get_builder (GncPluginPage *page)
 Retrieve the GtkBuilder object associated with this page.
 
const gchar * gnc_plugin_page_get_menu_qualifier (GncPluginPage *page)
 Retrieve the menu qualifier for this page.
 
void gnc_plugin_page_set_menu_qualifier (GncPluginPage *page, const char *menu_qualifier)
 Set a qualifier string for this page.
 
const gchar * gnc_plugin_page_get_menu_popup_qualifier (GncPluginPage *page)
 Retrieve the menu popup qualifier for this page.
 
void gnc_plugin_page_set_menu_popup_qualifier (GncPluginPage *page, const char *menu_qualifier)
 Set a qualifier string for this page.
 
GSimpleActionGroup * gnc_plugin_page_get_action_group (GncPluginPage *page)
 Retrieve the GSimpleActionGroup object 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_simple_action_group_name (GncPluginPage *page)
 Retrieve the simple action group name associated with this plugin page.
 
gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page)
 Tell a page to finish any outstanding activities.
 
GType gnc_plugin_page_get_type (void)
 Get the type of a content plugin.
 
GtkWidget * gnc_plugin_page_create_widget (GncPluginPage *plugin_page)
 Create the display widget that corresponds to this plugin.
 
void gnc_plugin_page_set_page_name (GncPluginPage *page, const char *name)
 Set the name of this page.
 
void gnc_plugin_page_set_page_long_name (GncPluginPage *page, const char *name)
 Set the long name of this page.
 
void gnc_plugin_page_set_page_color (GncPluginPage *page, const char *color)
 Set the color of this page.
 
void gnc_plugin_page_set_statusbar_text (GncPluginPage *page, const char *name)
 Set the statusbar text associated with this page.
 

Detailed Description

Macro Definition Documentation

◆ GNC_IS_PLUGIN_PAGE

#define GNC_IS_PLUGIN_PAGE (   o)    (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN_PAGE))

Definition at line 51 of file gnc-plugin-page.h.

◆ GNC_IS_PLUGIN_PAGE_CLASS

#define GNC_IS_PLUGIN_PAGE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE))

Definition at line 52 of file gnc-plugin-page.h.

◆ GNC_PLUGIN_PAGE

#define GNC_PLUGIN_PAGE (   o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPage))

Definition at line 49 of file gnc-plugin-page.h.

◆ GNC_PLUGIN_PAGE_CLASS

#define GNC_PLUGIN_PAGE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE, GncPluginPageClass))

Definition at line 50 of file gnc-plugin-page.h.

◆ GNC_PLUGIN_PAGE_GET_CLASS

#define GNC_PLUGIN_PAGE_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN_PAGE, GncPluginPageClass))

Definition at line 53 of file gnc-plugin-page.h.

◆ GNC_PREF_SUMMARYBAR_POSITION_BOTTOM

#define GNC_PREF_SUMMARYBAR_POSITION_BOTTOM   "summarybar-position-bottom"

Definition at line 45 of file gnc-plugin-page.h.

◆ GNC_PREF_SUMMARYBAR_POSITION_TOP

#define GNC_PREF_SUMMARYBAR_POSITION_TOP   "summarybar-position-top"

Definition at line 44 of file gnc-plugin-page.h.

◆ GNC_TYPE_PLUGIN_PAGE

#define GNC_TYPE_PLUGIN_PAGE   (gnc_plugin_page_get_type ())

Definition at line 48 of file gnc-plugin-page.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 61 of file gnc-plugin-page.c.

62{
63 INSERTED,
64 REMOVED,
65 SELECTED,
66 UNSELECTED,
67 LAST_SIGNAL
68};

◆ anonymous enum

anonymous enum

Definition at line 70 of file gnc-plugin-page.c.

71{
72 PROP_0,
73 PROP_PAGE_NAME,
74 PROP_PAGE_COLOR,
75 PROP_BOOK,
76 PROP_STATUSBAR_TEXT,
77 PROP_USE_NEW_WINDOW,
78 PROP_UI_DESCRIPTION,
79};

Function Documentation

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( GncPluginPage  ,
gnc_plugin_page  ,
G_TYPE_OBJECT  ,
G_ADD_PRIVATE(GncPluginPage  
)

Definition at line 111 of file gnc-plugin-page.c.

124{
125 GncPluginPageClass *klass;
126 GtkWidget *widget;
127
128 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
129
130 klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
131 g_return_val_if_fail (klass != NULL, NULL);
132 g_return_val_if_fail (klass->create_widget != NULL, NULL);
133
134 widget = klass->create_widget (plugin_page);
135
136 /*
137 * If there is a destroy function, add a ref so that the
138 * widgets will exists when the destroy function is called.
139 * Otherwise it will be destroyed when it is removed from the
140 * main notebook for the window.
141 */
142 if (klass->destroy_widget)
143 g_object_ref (widget);
144
145 return widget;
146}
The class data structure for a content plugin.
void(* destroy_widget)(GncPluginPage *plugin_page)
Function called to destroy the display widget for a particular type of plugin.
GtkWidget *(* create_widget)(GncPluginPage *plugin_page)
Function called to create the display widget for a particular type of plugin.

◆ gnc_plugin_page_add_book()

void gnc_plugin_page_add_book ( GncPluginPage page,
QofBook book 
)

Add a book reference to the specified page.

Parameters
pageThe page to be modified.
bookThe book referenced by this page.

Definition at line 657 of file gnc-plugin-page.c.

658{
660
661 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
662 g_return_if_fail (book != NULL);
663
664 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
665 priv->books = g_list_append (priv->books, book);
666}
The instance private data for a content plugin.

◆ gnc_plugin_page_create_action_group()

GSimpleActionGroup * gnc_plugin_page_create_action_group ( GncPluginPage page,
const gchar *  group_name 
)

Create the GSimpleActionGroup object associated with this page.

Parameters
pageThe page whose menu/toolbar action group should be created.
group_nameThe name associate with this action group. The name is used to associate key bindings with actions, so it should be consistent across all pages of the same type.
Returns
A pointer to the newly created GSimpleActionGroup object for this page.

Definition at line 1082 of file gnc-plugin-page.c.

1083{
1084 GncPluginPagePrivate *priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1085
1086 priv->simple_action_group = g_simple_action_group_new ();
1087 priv->simple_action_group_name = group_name;
1088
1089 return priv->simple_action_group;
1090}

◆ gnc_plugin_page_create_widget()

GtkWidget * gnc_plugin_page_create_widget ( GncPluginPage plugin_page)

Create the display widget that corresponds to this plugin.

This function will be called by the main/embedded window manipulation code to create a widget that they can display. The returned widget should encompass all information that goes with this page, including scroll bars, a summary bar, etc.

Parameters
plugin_pageA pointer to the plugin for which a display widget should be created.
Returns
A displayable gtk widget.

◆ gnc_plugin_page_destroy_widget()

void gnc_plugin_page_destroy_widget ( GncPluginPage plugin_page)

Destroy the display widget that corresponds to this plugin.

This function will be called by the main/embedded window manipulation code when a page is closed.

Parameters
plugin_pageA pointer to the plugin whose display widget should be destroyed.

Definition at line 153 of file gnc-plugin-page.c.

154{
155 GncPluginPageClass *klass;
156
157 g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
158
159 klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
160 g_return_if_fail (klass != NULL);
161 g_return_if_fail (klass->destroy_widget != NULL);
162
163 klass->destroy_widget (plugin_page);
164}

◆ gnc_plugin_page_disconnect_page_changed()

void gnc_plugin_page_disconnect_page_changed ( GncPluginPage page)

Disconnect the page_changed_id signal callback.

Parameters
pageThe page whose name should be retrieved.

Definition at line 902 of file gnc-plugin-page.c.

903{
905
906 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
907
908 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
909
910 if (priv->page_changed_id > 0)
911 {
912 g_signal_handler_disconnect (G_OBJECT(page->window), priv->page_changed_id);
913 priv->page_changed_id = 0;
914 }
915}
GtkWidget * window
The window that contains the display widget for this plugin.

◆ gnc_plugin_page_finish_pending()

gboolean gnc_plugin_page_finish_pending ( GncPluginPage plugin_page)

Tell a page to finish any outstanding activities.

Parameters
plugin_pageA page.
Returns
FALSE if the page could not or would not comply, which should cancel the pending operation. TRUE otherwise

Definition at line 1105 of file gnc-plugin-page.c.

1106{
1107 if (!page)
1108 return TRUE;
1109
1110 if (!GNC_IS_PLUGIN_PAGE(page))
1111 return TRUE;
1112
1113 if (!GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)
1114 return TRUE;
1115
1116 return (GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)(page);
1117}

◆ gnc_plugin_page_get_action()

GAction * gnc_plugin_page_get_action ( GncPluginPage page,
const gchar *  action_name 
)

Retrieve a GAction object associated with this page.

Parameters
pageThe page whose menu/toolbar action group should be retrieved.
action_nameThe name of the GAction to find.
Returns
A pointer to the requested GAction object or NULL.

Definition at line 282 of file gnc-plugin-page.c.

283{
285
286 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
287 g_return_val_if_fail (name != NULL, NULL);
288
289 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
290 if (!priv->simple_action_group)
291 return NULL;
292 return g_action_map_lookup_action (G_ACTION_MAP(priv->simple_action_group), name);
293}

◆ gnc_plugin_page_get_action_group()

GSimpleActionGroup * gnc_plugin_page_get_action_group ( GncPluginPage page)

Retrieve the GSimpleActionGroup object associated with this page.

Parameters
pageThe page whose menu/toolbar action group should be retrieved.
Returns
A pointer to the GSimpleActionGroup object for this page.

Definition at line 1071 of file gnc-plugin-page.c.

1072{
1074
1075 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1076
1077 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1078 return priv->simple_action_group;
1079}

◆ gnc_plugin_page_get_builder()

GtkBuilder * gnc_plugin_page_get_builder ( GncPluginPage page)

Retrieve the GtkBuilder object associated with this page.

Parameters
pageThe page whose UI information should be retrieved.
Returns
A pointer to the GtkBuilder object for this page.

Definition at line 1009 of file gnc-plugin-page.c.

1010{
1012
1013 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1014
1015 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1016 return priv->builder;
1017}

◆ gnc_plugin_page_get_menu_popup_qualifier()

const gchar * gnc_plugin_page_get_menu_popup_qualifier ( GncPluginPage page)

Retrieve the menu popup qualifier for this page.

Parameters
pageThe page whose quailifier string should be retrieved.
Returns
A qualifier string for this page.

Definition at line 1046 of file gnc-plugin-page.c.

1047{
1049
1050 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1051
1052 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1053 return priv->menu_popup_qualifier;
1054}

◆ gnc_plugin_page_get_menu_qualifier()

const gchar * gnc_plugin_page_get_menu_qualifier ( GncPluginPage page)

Retrieve the menu qualifier for this page.

Parameters
pageThe page whose quailifier string should be retrieved.
Returns
A qualifier string for this page.

Definition at line 1022 of file gnc-plugin-page.c.

1023{
1025
1026 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1027
1028 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1029 return priv->menu_qualifier;
1030}

◆ gnc_plugin_page_get_page_color()

const gchar * gnc_plugin_page_get_page_color ( GncPluginPage page)

Retrieve the color of this page.

This is the color string used in the notebook tab.

Parameters
pageThe page whose name should be retrieved.
Returns
The color for this page. This string is owned by the page and should not be freed by the caller.

Definition at line 788 of file gnc-plugin-page.c.

789{
791
792 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
793
794 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
795 return priv->page_color;
796}

◆ gnc_plugin_page_get_page_long_name()

const gchar * gnc_plugin_page_get_page_long_name ( GncPluginPage page)

Retrieve the long name of this page.

This is the string used in the tooltip that is attached to the page name in the notebook tab.

Parameters
pageThe page whose name should be retrieved.
Returns
The page's name. This string is owned by the page and should not be freed by the caller.

Definition at line 758 of file gnc-plugin-page.c.

759{
761
762 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
763
764 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
765 return priv->page_long_name;
766}

◆ gnc_plugin_page_get_page_name()

const gchar * gnc_plugin_page_get_page_name ( GncPluginPage page)

Retrieve the name of this page.

This is the string used in the window title, and in the notebook tab and page selection menus.

Parameters
pageThe page whose name should be retrieved.
Returns
The page's name. This string is owned by the page and should not be freed by the caller.

Definition at line 718 of file gnc-plugin-page.c.

719{
721
722 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
723
724 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
725 return priv->page_name;
726}

◆ gnc_plugin_page_get_plugin_name()

const gchar * gnc_plugin_page_get_plugin_name ( GncPluginPage plugin_page)

Retrieve the textual name of a plugin.

Parameters
plugin_pageA pointer to the page whose actions name should be retrieved.
Returns
The name of this plugin. This string is owned by the plugin.

Definition at line 298 of file gnc-plugin-page.c.

299{
300 GncPluginPageClass *klass;
301
302 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
303
304 klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
305 g_return_val_if_fail (klass != NULL, NULL);
306
307 return (klass->plugin_name);
308}
const gchar * plugin_name
The textual name of this plugin.

◆ gnc_plugin_page_get_simple_action_group_name()

const gchar * gnc_plugin_page_get_simple_action_group_name ( GncPluginPage page)

Retrieve the simple action group name associated with this plugin page.

Parameters
pageThe page whose simple action group should be retrieved.
Returns
The simple action group name associated with this plugin.

Definition at line 1093 of file gnc-plugin-page.c.

1094{
1096
1097 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1098
1099 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1100
1101 return priv->simple_action_group_name;
1102}

◆ gnc_plugin_page_get_statusbar_text()

const gchar * gnc_plugin_page_get_statusbar_text ( GncPluginPage page)

Retrieve the statusbar text associated with this page.

Parameters
pageThe page whose statusbar should text be retrieved.
Returns
A pointer to the statusbar text for this page. This string is owned by the page and should not be freed by the caller.

Definition at line 920 of file gnc-plugin-page.c.

921{
923
924 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
925
926 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
927 return priv->statusbar_text;
928}

◆ gnc_plugin_page_get_type()

GType gnc_plugin_page_get_type ( void  )

Get the type of a content plugin.

Returns
A GType.

◆ gnc_plugin_page_get_ui_description()

const char * gnc_plugin_page_get_ui_description ( GncPluginPage page)

Retrieve the name of the XML UI file associated with this page.

Parameters
pageThe page whose setting should be retrieved.
Returns
A pointer to the filename used for the UI. This string is owned by the page and should not be freed by the caller.

Definition at line 978 of file gnc-plugin-page.c.

979{
981
982 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
983
984 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
985 return priv->ui_description;
986}
char * ui_description
The group of all actions provided by this plugin.

◆ gnc_plugin_page_get_use_new_window()

gboolean gnc_plugin_page_get_use_new_window ( GncPluginPage page)

Retrieve the "use new window" setting associated with this page.

Parameters
pageThe page whose setting should be retrieved.
Returns
Whether this page should be created in a new window.

Definition at line 949 of file gnc-plugin-page.c.

950{
952
953 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
954
955 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
956 return priv->use_new_window;
957}

◆ gnc_plugin_page_get_window()

GtkWidget * gnc_plugin_page_get_window ( GncPluginPage page)

Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.

Parameters
pageThe page whose window should be retrieved.
Returns
A pointer to the window.

Definition at line 707 of file gnc-plugin-page.c.

708{
709 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
710
711 return page->window;
712}

◆ gnc_plugin_page_has_book()

gboolean gnc_plugin_page_has_book ( GncPluginPage page,
QofBook book 
)

Query a page to see if it has a reference to a given book.

This function takes a guid instead of a QofBook because that's what the engine event mechanism provides.

Parameters
pageThe page to query.
bookThe guid of the book in question.
Returns
TRUE if the page refers to the specified book. FALSE otherwise.

Definition at line 671 of file gnc-plugin-page.c.

672{
674 GList *item;
675
676 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
677 g_return_val_if_fail (book != NULL, FALSE);
678
679 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
680 for (item = priv->books; item; item = g_list_next (item))
681 {
682 if (item->data == book)
683 {
684 return TRUE;
685 }
686 }
687 return FALSE;
688}

◆ gnc_plugin_page_has_books()

gboolean gnc_plugin_page_has_books ( GncPluginPage page)

Query a page to see if it has a reference to any book.

Parameters
pageThe page to query.
Returns
TRUE if the page references any books. FALSE otherwise.

Definition at line 693 of file gnc-plugin-page.c.

694{
696
697 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
698
699 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
700 return (priv->books != NULL);
701}

◆ gnc_plugin_page_inserted()

void gnc_plugin_page_inserted ( GncPluginPage plugin_page)

Definition at line 313 of file gnc-plugin-page.c.

314{
315 g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
316
317 g_signal_emit (G_OBJECT(plugin_page), signals[INSERTED], 0);
318}

◆ gnc_plugin_page_inserted_cb()

void gnc_plugin_page_inserted_cb ( GncPluginPage page,
gpointer  user_data 
)

Set up the page_changed callback for when the current page is changed.

This will store a pointer to the page focus function passed as a parameter so that it can be used in setting up the g_idle_add

Parameters
pageThe page the callback is setup for.
user_dataThe page focus function

Definition at line 882 of file gnc-plugin-page.c.

883{
885
886 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
887
888 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
889
890 priv->page_changed_id = g_signal_connect (G_OBJECT(page->window), "page_changed",
891 G_CALLBACK(gnc_plugin_page_main_window_changed),
892 page);
893
894 // on initial load try and set the page focus
896 (GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
897}
gboolean gnc_main_window_is_restoring_pages(GncMainWindow *window)
Check if the main window is restoring the plugin pages.
GtkWindow * gnc_ui_get_main_window(GtkWidget *widget)
Get a pointer to the final GncMainWindow widget is rooted in.

◆ gnc_plugin_page_merge_actions()

void gnc_plugin_page_merge_actions ( GncPluginPage plugin_page)

Add the actions for a content page to the specified window.

Parameters
plugin_pageA pointer to the page whose actions should be added to the user interface.

Definition at line 253 of file gnc-plugin-page.c.

254{
256 GError *error = NULL;
257 gchar *resource;
258
259 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
260
261 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
262
263 if (!priv->builder)
264 priv->builder = gtk_builder_new ();
265
266 resource = g_strconcat (GNUCASH_RESOURCE_PREFIX "/", priv->ui_description, NULL);
267
268 gtk_builder_set_translation_domain (priv->builder, PROJECT_NAME);
269
270 gtk_builder_add_from_resource (priv->builder, resource, &error);
271
272 if (error)
273 {
274 g_critical ("Failed to load ui resource %s, Error %s", resource, error->message);
275 g_error_free (error);
276 }
277 g_free (resource);
278}

◆ gnc_plugin_page_recreate_page()

GncPluginPage * gnc_plugin_page_recreate_page ( GtkWidget *  window,
const gchar *  page_type,
GKeyFile *  key_file,
const gchar *  group_name 
)

This function looks up a specific plugin type by name, and then calls a plugin specific function to create a new page and restore its content to a previous state.

Parameters
windowThe window where this page should be installed.
page_typeThe name of the page type to create.
key_fileA pointer to the GKeyFile data structure where the page information should be read.
group_nameThe group name to use when restoring data.

Definition at line 213 of file gnc-plugin-page.c.

217{
218 GncPluginPageClass *klass;
219 GncPluginPage *page = NULL;
220 GType type;
221
222 ENTER("type %s, keyfile %p, group %s", page_type, key_file, page_group);
223 type = g_type_from_name (page_type);
224 if (type == 0)
225 {
226 LEAVE("Cannot find type named %s", page_type);
227 return NULL;
228 }
229
230 klass = g_type_class_ref (type);
231 if (klass == NULL)
232 {
233 const gchar *type_name = g_type_name (type);
234 LEAVE("Cannot create class %s(%s)", page_type, type_name ? type_name : "invalid type");
235 return NULL;
236 }
237
238 if (!klass->recreate_page)
239 {
240 LEAVE("Class %shas no recreate function.", page_type);
241 g_type_class_unref (klass);
242 return NULL;
243 }
244
245 page = (klass->recreate_page)(window, key_file, page_group);
246 g_type_class_unref (klass);
247 LEAVE(" ");
248 return page;
249}
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272
GncPluginPage *(* recreate_page)(GtkWidget *window, GKeyFile *file, const gchar *group)
Create a new page based on the information saved during a previous instantiation of gnucash.
The instance data structure for a content plugin.

◆ gnc_plugin_page_removed()

void gnc_plugin_page_removed ( GncPluginPage plugin_page)

Definition at line 321 of file gnc-plugin-page.c.

322{
323 g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
324
325 g_signal_emit (G_OBJECT(plugin_page), signals[REMOVED], 0);
326}

◆ gnc_plugin_page_save_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.

That function must save enough information about the page that it can be recreated next time the user starts gnucash.

Parameters
pageThe page to save.
key_fileA pointer to the GKeyFile data structure where the page information should be written.
group_nameThe group name to use when saving data.

Definition at line 189 of file gnc-plugin-page.c.

192{
193 GncPluginPageClass *klass;
194
195 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
196 g_return_if_fail (key_file != NULL);
197 g_return_if_fail (group_name != NULL);
198
199 ENTER(" ");
200 klass = GNC_PLUGIN_PAGE_GET_CLASS(page);
201 g_return_if_fail (klass != NULL);
202 g_return_if_fail (klass->save_page != NULL);
203
204 klass->save_page (page, key_file, group_name);
205 LEAVE(" ");
206}
void(* save_page)(GncPluginPage *page, GKeyFile *file, const gchar *group)
Save enough information about this page so that it can be recreated next time the user starts gnucash...

◆ gnc_plugin_page_selected()

void gnc_plugin_page_selected ( GncPluginPage plugin_page)

Definition at line 329 of file gnc-plugin-page.c.

330{
331 g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
332
333 g_signal_emit (G_OBJECT(plugin_page), signals[SELECTED], 0);
334}

◆ gnc_plugin_page_set_menu_popup_qualifier()

void gnc_plugin_page_set_menu_popup_qualifier ( GncPluginPage page,
const char *  menu_qualifier 
)

Set a qualifier string for this page.

This string is used when there is more than one popup menu associated with the page.

Parameters
pageThe page whose qualifier string should be updated.
menu_qualifierA string to be used as for the qualifier.

Definition at line 1057 of file gnc-plugin-page.c.

1059{
1061
1062 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1063
1064 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1065
1066 priv->menu_popup_qualifier = menu_qualifier;
1067}

◆ gnc_plugin_page_set_menu_qualifier()

void gnc_plugin_page_set_menu_qualifier ( GncPluginPage page,
const char *  menu_qualifier 
)

Set a qualifier string for this page.

This string is used when there is more than one menu associated with the page.

Parameters
pageThe page whose qualifier string should be updated.
menu_qualifierA string to be used as for the qualifier.

Definition at line 1033 of file gnc-plugin-page.c.

1035{
1037
1038 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1039
1040 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1041
1042 priv->menu_qualifier = menu_qualifier;
1043}

◆ gnc_plugin_page_set_page_color() [1/2]

void gnc_plugin_page_set_page_color ( GncPluginPage page,
const char *  color 
)

Set the color of this page.

This is the color string used in the notebook tab.

Parameters
pageThe page whose name should be retrieved.
colorThe color for this page. This string is owned by the page and should not be freed by the caller.

◆ gnc_plugin_page_set_page_color() [2/2]

void gnc_plugin_page_set_page_color ( GncPluginPage page,
const gchar *  color 
)

Definition at line 801 of file gnc-plugin-page.c.

802{
804
805 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
806
807 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
808 if (priv->page_color)
809 g_free (priv->page_color);
810
811 if (color)
812 priv->page_color = g_strdup (color);
813}

◆ gnc_plugin_page_set_page_long_name() [1/2]

void gnc_plugin_page_set_page_long_name ( GncPluginPage page,
const char *  name 
)

Set the long name of this page.

This is the string used in the tooltip that is attached to the page name in the notebook tab.

Parameters
pageThe page whose name should be set.
nameThe new string for the name.

◆ gnc_plugin_page_set_page_long_name() [2/2]

void gnc_plugin_page_set_page_long_name ( GncPluginPage page,
const gchar *  name 
)

Definition at line 772 of file gnc-plugin-page.c.

773{
775
776 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
777
778 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
779 if (priv->page_long_name)
780 g_free (priv->page_long_name);
781
782 priv->page_long_name = g_strdup (name);
783}

◆ gnc_plugin_page_set_page_name() [1/2]

void gnc_plugin_page_set_page_name ( GncPluginPage page,
const char *  name 
)

Set the name of this page.

This is the string used in the window title, and in the notebook tab and page selection menus.

Parameters
pageThe page whose name should be set.
nameThe new string for the name.

◆ gnc_plugin_page_set_page_name() [2/2]

void gnc_plugin_page_set_page_name ( GncPluginPage page,
const gchar *  name 
)

Definition at line 732 of file gnc-plugin-page.c.

733{
735 GncPluginPageClass *klass;
736
737 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
738
739 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
740 if (priv->page_name)
741 g_free (priv->page_name);
742
743 priv->page_name = g_strdup (name);
744
745 /* Perform page specific actions */
746 klass = GNC_PLUGIN_PAGE_GET_CLASS (page);
747 if (klass->page_name_changed)
748 {
749 klass->page_name_changed(page, name);
750 }
751}
void(* page_name_changed)(GncPluginPage *plugin_page, const gchar *name)
This function vector allows page specific actions to occur when the page name is changed.

◆ gnc_plugin_page_set_statusbar_text() [1/2]

void gnc_plugin_page_set_statusbar_text ( GncPluginPage page,
const char *  name 
)

Set the statusbar text associated with this page.

Parameters
pageThe page whose statusbar text should be set.
nameThe new statusbar text for the page.

◆ gnc_plugin_page_set_statusbar_text() [2/2]

void gnc_plugin_page_set_statusbar_text ( GncPluginPage page,
const gchar *  message 
)

Definition at line 933 of file gnc-plugin-page.c.

934{
936
937 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
938
939 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
940 if (priv->statusbar_text)
941 g_free (priv->statusbar_text);
942
943 priv->statusbar_text = g_strdup (message);
944}

◆ gnc_plugin_page_set_ui_description()

void gnc_plugin_page_set_ui_description ( GncPluginPage page,
const char *  ui_filename 
)

Set an alternate UI for the specified page.

This alternate ui may only use actions specified in the source for the page.

Note
This function must be called before the page is installed into a window.
Parameters
pageThe page to modify.
ui_filenameThe filename (no path) of the alternate UI.

Definition at line 992 of file gnc-plugin-page.c.

994{
996
997 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
998
999 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1000 if (priv->ui_description)
1001 g_free (priv->ui_description);
1002
1003 priv->ui_description = g_strdup (ui_filename);
1004}

◆ gnc_plugin_page_set_use_new_window()

void gnc_plugin_page_set_use_new_window ( GncPluginPage page,
gboolean  use_new 
)

Set the "use new window" setting associated with this page.

If this setting is TRUE, the page will be installed into a new window. Otherwise the page will be installed into an existing window.

Parameters
pageThe page whose setting should be updated.
use_newThe new value for this setting.

Definition at line 965 of file gnc-plugin-page.c.

966{
968
969 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
970
971 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
972 priv->use_new_window = use_new;
973}

◆ gnc_plugin_page_show_summarybar()

void gnc_plugin_page_show_summarybar ( GncPluginPage page,
gboolean  visible 
)

Show/hide the summarybar associated with this page.

Parameters
pageThe page whose summarybar visibility should be changed.
visibleWhether or not the summarybar should be shown..

Definition at line 169 of file gnc-plugin-page.c.

171{
172 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
173
174 if (!page->summarybar)
175 return;
176
177 if (visible)
178 gtk_widget_show (page->summarybar);
179 else
180 gtk_widget_hide (page->summarybar);
181}
GtkWidget * summarybar
The summary bar widget (if any) that is associated with this plugin.

◆ gnc_plugin_page_unselected()

void gnc_plugin_page_unselected ( GncPluginPage plugin_page)

Definition at line 337 of file gnc-plugin-page.c.

338{
339 g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
340
341 g_signal_emit (G_OBJECT(plugin_page), signals[UNSELECTED], 0);
342}