GnuCash  5.6-150-g038405b370+
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. More...
 
void gnc_plugin_page_show_summarybar (GncPluginPage *page, gboolean visible)
 Show/hide the summarybar associated with this page. More...
 
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. More...
 
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. More...
 
void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page)
 Add the actions for a content page to the specified window. More...
 
GAction * gnc_plugin_page_get_action (GncPluginPage *page, const gchar *action_name)
 Retrieve a GAction object associated with this page. More...
 
const gchar * gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
 Retrieve the textual name of a plugin. More...
 
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. More...
 
gboolean gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book)
 Query a page to see if it has a reference to a given book. More...
 
gboolean gnc_plugin_page_has_books (GncPluginPage *page)
 Query a page to see if it has a reference to any book. More...
 
GtkWidget * gnc_plugin_page_get_window (GncPluginPage *page)
 Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page. More...
 
const gchar * gnc_plugin_page_get_page_name (GncPluginPage *page)
 Retrieve the name of this page. More...
 
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. More...
 
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. More...
 
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. More...
 
void gnc_plugin_page_disconnect_page_changed (GncPluginPage *page)
 Disconnect the page_changed_id signal callback. More...
 
const gchar * gnc_plugin_page_get_statusbar_text (GncPluginPage *page)
 Retrieve the statusbar text associated with this page. More...
 
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. More...
 
void gnc_plugin_page_set_use_new_window (GncPluginPage *page, gboolean use_new)
 Set the "use new window" setting associated with this page. More...
 
const gchar * gnc_plugin_page_get_ui_description (GncPluginPage *page)
 Retrieve the name of the XML UI file associated with this page. More...
 
void gnc_plugin_page_set_ui_description (GncPluginPage *page, const char *ui_filename)
 Set an alternate UI for the specified page. More...
 
GtkBuilder * gnc_plugin_page_get_builder (GncPluginPage *page)
 Retrieve the GtkBuilder object associated with this page. More...
 
const gchar * gnc_plugin_page_get_menu_qualifier (GncPluginPage *page)
 Retrieve the menu qualifier for this page. More...
 
void gnc_plugin_page_set_menu_qualifier (GncPluginPage *page, const char *menu_qualifier)
 Set a qualifier string for this page. More...
 
const gchar * gnc_plugin_page_get_menu_popup_qualifier (GncPluginPage *page)
 Retrieve the menu popup qualifier for this page. More...
 
void gnc_plugin_page_set_menu_popup_qualifier (GncPluginPage *page, const char *menu_qualifier)
 Set a qualifier string for this page. More...
 
GSimpleActionGroup * gnc_plugin_page_get_action_group (GncPluginPage *page)
 Retrieve the GSimpleActionGroup object associated with this page. More...
 
GSimpleActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page, const gchar *group_name)
 Create the GSimpleActionGroup object associated with this page. More...
 
const gchar * gnc_plugin_page_get_simple_action_group_name (GncPluginPage *page)
 Retrieve the simple action group name associated with this plugin page. More...
 
gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page)
 Tell a page to finish any outstanding activities. More...
 
GType gnc_plugin_page_get_type (void)
 Get the type of a content plugin. More...
 
GtkWidget * gnc_plugin_page_create_widget (GncPluginPage *plugin_page)
 Create the display widget that corresponds to this plugin. More...
 
void gnc_plugin_page_set_page_name (GncPluginPage *page, const char *name)
 Set the name of this page. More...
 
void gnc_plugin_page_set_page_long_name (GncPluginPage *page, const char *name)
 Set the long name of this page. More...
 
void gnc_plugin_page_set_page_color (GncPluginPage *page, const char *color)
 Set the color of this page. More...
 
void gnc_plugin_page_set_statusbar_text (GncPluginPage *page, const char *name)
 Set the statusbar text associated with this page. More...
 

Detailed Description

Function Documentation

◆ 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 656 of file gnc-plugin-page.c.

657 {
658  GncPluginPagePrivate *priv;
659 
660  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
661  g_return_if_fail (book != NULL);
662 
663  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
664  priv->books = g_list_append (priv->books, book);
665 }
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 1081 of file gnc-plugin-page.c.

1082 {
1083  GncPluginPagePrivate *priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1084 
1085  priv->simple_action_group = g_simple_action_group_new ();
1086  priv->simple_action_group_name = group_name;
1087 
1088  return priv->simple_action_group;
1089 }
The instance private data for a content plugin.

◆ 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 152 of file gnc-plugin-page.c.

153 {
154  GncPluginPageClass *klass;
155 
156  g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
157 
158  klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
159  g_return_if_fail (klass != NULL);
160  g_return_if_fail (klass->destroy_widget != NULL);
161 
162  klass->destroy_widget (plugin_page);
163 }
void(* destroy_widget)(GncPluginPage *plugin_page)
Function called to destroy the display widget for a particular type of plugin.
The class data structure for a content plugin.

◆ 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 901 of file gnc-plugin-page.c.

902 {
903  GncPluginPagePrivate *priv;
904 
905  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
906 
907  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
908 
909  if (priv->page_changed_id > 0)
910  {
911  g_signal_handler_disconnect (G_OBJECT(page->window), priv->page_changed_id);
912  priv->page_changed_id = 0;
913  }
914 }
GtkWidget * window
The window that contains the display widget for this plugin.
The instance private data for a content 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 1104 of file gnc-plugin-page.c.

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

◆ 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 281 of file gnc-plugin-page.c.

282 {
283  GncPluginPagePrivate *priv;
284 
285  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
286  g_return_val_if_fail (name != NULL, NULL);
287 
288  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
289  if (!priv->simple_action_group)
290  return NULL;
291  return g_action_map_lookup_action (G_ACTION_MAP(priv->simple_action_group), name);
292 }
The instance private data for a content plugin.

◆ 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 1070 of file gnc-plugin-page.c.

1071 {
1072  GncPluginPagePrivate *priv;
1073 
1074  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1075 
1076  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1077  return priv->simple_action_group;
1078 }
The instance private data for a content plugin.

◆ 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 1008 of file gnc-plugin-page.c.

1009 {
1010  GncPluginPagePrivate *priv;
1011 
1012  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1013 
1014  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1015  return priv->builder;
1016 }
The instance private data for a content plugin.

◆ 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 1045 of file gnc-plugin-page.c.

1046 {
1047  GncPluginPagePrivate *priv;
1048 
1049  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1050 
1051  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1052  return priv->menu_popup_qualifier;
1053 }
The instance private data for a content plugin.

◆ 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 1021 of file gnc-plugin-page.c.

1022 {
1023  GncPluginPagePrivate *priv;
1024 
1025  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1026 
1027  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1028  return priv->menu_qualifier;
1029 }
The instance private data for a content plugin.

◆ 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 787 of file gnc-plugin-page.c.

788 {
789  GncPluginPagePrivate *priv;
790 
791  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
792 
793  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
794  return priv->page_color;
795 }
The instance private data for a content plugin.

◆ 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 757 of file gnc-plugin-page.c.

758 {
759  GncPluginPagePrivate *priv;
760 
761  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
762 
763  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
764  return priv->page_long_name;
765 }
The instance private data for a content plugin.

◆ 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 717 of file gnc-plugin-page.c.

718 {
719  GncPluginPagePrivate *priv;
720 
721  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
722 
723  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
724  return priv->page_name;
725 }
The instance private data for a content plugin.

◆ 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 297 of file gnc-plugin-page.c.

298 {
299  GncPluginPageClass *klass;
300 
301  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
302 
303  klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
304  g_return_val_if_fail (klass != NULL, NULL);
305 
306  return (klass->plugin_name);
307 }
The class data structure for a content plugin.
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 1092 of file gnc-plugin-page.c.

1093 {
1094  GncPluginPagePrivate *priv;
1095 
1096  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1097 
1098  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1099 
1100  return priv->simple_action_group_name;
1101 }
The instance private data for a content plugin.

◆ 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 919 of file gnc-plugin-page.c.

920 {
921  GncPluginPagePrivate *priv;
922 
923  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
924 
925  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
926  return priv->statusbar_text;
927 }
The instance private data for a content plugin.

◆ 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 977 of file gnc-plugin-page.c.

978 {
979  GncPluginPagePrivate *priv;
980 
981  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
982 
983  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
984  return priv->ui_description;
985 }
char * ui_description
The group of all actions provided by this plugin.
The instance private data for a content 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 948 of file gnc-plugin-page.c.

949 {
950  GncPluginPagePrivate *priv;
951 
952  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
953 
954  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
955  return priv->use_new_window;
956 }
The instance private data for a content plugin.

◆ 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 706 of file gnc-plugin-page.c.

707 {
708  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
709 
710  return page->window;
711 }
GtkWidget * window
The window that contains the display widget for this plugin.

◆ 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 670 of file gnc-plugin-page.c.

671 {
672  GncPluginPagePrivate *priv;
673  GList *item;
674 
675  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
676  g_return_val_if_fail (book != NULL, FALSE);
677 
678  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
679  for (item = priv->books; item; item = g_list_next (item))
680  {
681  if (item->data == book)
682  {
683  return TRUE;
684  }
685  }
686  return FALSE;
687 }
The instance private data for a content plugin.

◆ 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 692 of file gnc-plugin-page.c.

693 {
694  GncPluginPagePrivate *priv;
695 
696  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
697 
698  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
699  return (priv->books != NULL);
700 }
The instance private data for a content plugin.

◆ 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 881 of file gnc-plugin-page.c.

882 {
883  GncPluginPagePrivate *priv;
884 
885  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
886 
887  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
888 
889  priv->page_changed_id = g_signal_connect (G_OBJECT(page->window), "page_changed",
890  G_CALLBACK(gnc_plugin_page_main_window_changed),
891  page);
892 
893  // on initial load try and set the page focus
894  if (!gnc_main_window_is_restoring_pages (GNC_MAIN_WINDOW(page->window)))
895  (GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
896 }
GtkWidget * window
The window that contains the display widget for this plugin.
gboolean gnc_main_window_is_restoring_pages(GncMainWindow *window)
Check if the main window is restoring the plugin pages.
The instance private data for a content plugin.

◆ 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 252 of file gnc-plugin-page.c.

253 {
254  GncPluginPagePrivate *priv;
255  GError *error = NULL;
256  gchar *resource;
257 
258  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
259 
260  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
261 
262  if (!priv->builder)
263  priv->builder = gtk_builder_new ();
264 
265  resource = g_strconcat (GNUCASH_RESOURCE_PREFIX "/", priv->ui_description, NULL);
266 
267  gtk_builder_set_translation_domain (priv->builder, PROJECT_NAME);
268 
269  gtk_builder_add_from_resource (priv->builder, resource, &error);
270 
271  if (error)
272  {
273  g_critical ("Failed to load ui resource %s, Error %s", resource, error->message);
274  g_error_free (error);
275  }
276  g_free (resource);
277 }
char * ui_description
The group of all actions provided by this plugin.
The instance private data for a content plugin.

◆ 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 212 of file gnc-plugin-page.c.

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

◆ 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 188 of file gnc-plugin-page.c.

191 {
192  GncPluginPageClass *klass;
193 
194  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
195  g_return_if_fail (key_file != NULL);
196  g_return_if_fail (group_name != NULL);
197 
198  ENTER(" ");
199  klass = GNC_PLUGIN_PAGE_GET_CLASS(page);
200  g_return_if_fail (klass != NULL);
201  g_return_if_fail (klass->save_page != NULL);
202 
203  klass->save_page (page, key_file, group_name);
204  LEAVE(" ");
205 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
The class data structure for a content plugin.
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...
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ 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 1056 of file gnc-plugin-page.c.

1058 {
1059  GncPluginPagePrivate *priv;
1060 
1061  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1062 
1063  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1064 
1065  priv->menu_popup_qualifier = menu_qualifier;
1066 }
The instance private data for a content plugin.

◆ 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 1032 of file gnc-plugin-page.c.

1034 {
1035  GncPluginPagePrivate *priv;
1036 
1037  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1038 
1039  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1040 
1041  priv->menu_qualifier = menu_qualifier;
1042 }
The instance private data for a content plugin.

◆ gnc_plugin_page_set_page_color()

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_long_name()

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_name()

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_statusbar_text()

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_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 991 of file gnc-plugin-page.c.

993 {
994  GncPluginPagePrivate *priv;
995 
996  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
997 
998  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
999  if (priv->ui_description)
1000  g_free (priv->ui_description);
1001 
1002  priv->ui_description = g_strdup (ui_filename);
1003 }
char * ui_description
The group of all actions provided by this plugin.
The instance private data for a content plugin.

◆ 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 964 of file gnc-plugin-page.c.

965 {
966  GncPluginPagePrivate *priv;
967 
968  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
969 
970  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
971  priv->use_new_window = use_new;
972 }
The instance private data for a content plugin.

◆ 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 168 of file gnc-plugin-page.c.

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