GnuCash  4.12-527-g05ffd3d4eb
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_PAGE_URI,
  PROP_BOOK, PROP_STATUSBAR_TEXT, PROP_USE_NEW_WINDOW, PROP_UI_DESCRIPTION,
  PROP_UI_MERGE, PROP_ACTION_GROUP
}
 

Functions

 GNC_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, GtkUIManager *merge)
 Add the actions for a content page to the specified window. More...
 
void gnc_plugin_page_unmerge_actions (GncPluginPage *plugin_page, GtkUIManager *merge)
 Remove the actions for a content page from the specified window. More...
 
GtkAction * gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name)
 Retrieve a GtkAction 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_uri (GncPluginPage *page)
 Retrieve the Uniform Resource Identifier for this page. More...
 
void gnc_plugin_page_set_uri (GncPluginPage *page, const gchar *name)
 
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...
 
GtkUIManager * gnc_plugin_page_get_ui_merge (GncPluginPage *page)
 Retrieve the GtkUIManager object associated with this page. More...
 
GtkActionGroup * gnc_plugin_page_get_action_group (GncPluginPage *page)
 Retrieve the GtkActionGroup object associated with this page. More...
 
GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page, const gchar *group_name)
 Create the GtkActionGroup object associated with this 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_uri (GncPluginPage *page, const char *name)
 Set the Uniform Resource Identifier for 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 711 of file gnc-plugin-page.c.

712 {
713  GncPluginPagePrivate *priv;
714 
715  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
716  g_return_if_fail (book != NULL);
717 
718  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
719  priv->books = g_list_append (priv->books, book);
720 }
The instance private data for a content plugin.

◆ gnc_plugin_page_create_action_group()

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

Create the GtkActionGroup 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 GtkActionGroup object for this page.

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

1121 {
1122  GncPluginPagePrivate *priv;
1123  GtkActionGroup *group;
1124 
1125  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1126  group = gtk_action_group_new (group_name);
1127  gtk_action_group_set_translation_domain (group, PROJECT_NAME);
1128  priv->action_group = group;
1129  return group;
1130 }
The instance private data for a content plugin.
GtkActionGroup * action_group
The group of all actions provided by this 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 156 of file gnc-plugin-page.c.

157 {
158  GncPluginPageClass *klass;
159 
160  g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
161 
162  klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
163  g_return_if_fail (klass != NULL);
164  g_return_if_fail (klass->destroy_widget != NULL);
165 
166  klass->destroy_widget (plugin_page);
167 }
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 958 of file gnc-plugin-page.c.

959 {
960  GncPluginPagePrivate *priv;
961 
962  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
963 
964  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
965 
966  if (priv->page_changed_id > 0)
967  {
968  g_signal_handler_disconnect (G_OBJECT(page->window), priv->page_changed_id);
969  priv->page_changed_id = 0;
970  }
971 }
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 1133 of file gnc-plugin-page.c.

1134 {
1135  if (!page)
1136  return TRUE;
1137 
1138  if (!GNC_IS_PLUGIN_PAGE(page))
1139  return TRUE;
1140 
1141  if (!GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)
1142  return TRUE;
1143 
1144  return (GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)(page);
1145 }

◆ gnc_plugin_page_get_action()

GtkAction * gnc_plugin_page_get_action ( GncPluginPage page,
const gchar *  name 
)

Retrieve a GtkAction object associated with this page.

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

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

297 {
298  GncPluginPagePrivate *priv;
299 
300  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
301  g_return_val_if_fail (name != NULL, NULL);
302 
303  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
304  if (!priv->action_group)
305  return NULL;
306  return gtk_action_group_get_action (priv->action_group, name);
307 }
The instance private data for a content plugin.
GtkActionGroup * action_group
The group of all actions provided by this plugin.

◆ gnc_plugin_page_get_action_group()

GtkActionGroup * gnc_plugin_page_get_action_group ( GncPluginPage page)

Retrieve the GtkActionGroup object associated with this page.

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

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

1108 {
1109  GncPluginPagePrivate *priv;
1110 
1111  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1112 
1113  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1114  return priv->action_group;
1115 }
The instance private data for a content plugin.
GtkActionGroup * action_group
The group of all actions provided by this 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 842 of file gnc-plugin-page.c.

843 {
844  GncPluginPagePrivate *priv;
845 
846  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
847 
848  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
849  return priv->page_color;
850 }
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 812 of file gnc-plugin-page.c.

813 {
814  GncPluginPagePrivate *priv;
815 
816  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
817 
818  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
819  return priv->page_long_name;
820 }
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 772 of file gnc-plugin-page.c.

773 {
774  GncPluginPagePrivate *priv;
775 
776  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
777 
778  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
779  return priv->page_name;
780 }
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 312 of file gnc-plugin-page.c.

313 {
314  GncPluginPageClass *klass;
315 
316  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
317 
318  klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
319  g_return_val_if_fail (klass != NULL, NULL);
320 
321  return (klass->plugin_name);
322 }
The class data structure for a content plugin.
const gchar * plugin_name
The textual name of this 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 1005 of file gnc-plugin-page.c.

1006 {
1007  GncPluginPagePrivate *priv;
1008 
1009  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
1010 
1011  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1012  return priv->statusbar_text;
1013 }
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 1063 of file gnc-plugin-page.c.

1064 {
1065  GncPluginPagePrivate *priv;
1066 
1067  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
1068 
1069  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1070  return priv->ui_description;
1071 }
The instance private data for a content plugin.

◆ gnc_plugin_page_get_ui_merge()

GtkUIManager * gnc_plugin_page_get_ui_merge ( GncPluginPage page)

Retrieve the GtkUIManager object associated with this page.

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

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

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

◆ gnc_plugin_page_get_uri()

const gchar * gnc_plugin_page_get_uri ( GncPluginPage page)

Retrieve the Uniform Resource Identifier for this page.

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

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

977 {
978  GncPluginPagePrivate *priv;
979 
980  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
981 
982  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
983  return priv->uri;
984 }
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 1034 of file gnc-plugin-page.c.

1035 {
1036  GncPluginPagePrivate *priv;
1037 
1038  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
1039 
1040  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1041  return priv->use_new_window;
1042 }
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 761 of file gnc-plugin-page.c.

762 {
763  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
764 
765  return page->window;
766 }
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 725 of file gnc-plugin-page.c.

726 {
727  GncPluginPagePrivate *priv;
728  GList *item;
729 
730  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
731  g_return_val_if_fail (book != NULL, FALSE);
732 
733  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
734  for (item = priv->books; item; item = g_list_next (item))
735  {
736  if (item->data == book)
737  {
738  return TRUE;
739  }
740  }
741  return FALSE;
742 }
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 747 of file gnc-plugin-page.c.

748 {
749  GncPluginPagePrivate *priv;
750 
751  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
752 
753  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
754  return (priv->books != NULL);
755 }
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 939 of file gnc-plugin-page.c.

940 {
941  GncPluginPagePrivate *priv;
942 
943  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
944 
945  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
946 
947  priv->page_changed_id = g_signal_connect (G_OBJECT(page->window), "page_changed",
948  G_CALLBACK(gnc_plugin_page_main_window_changed),
949  page);
950 
951  // on initial load try and set the page focus
952  (GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
953 }
GtkWidget * window
The window that contains the display widget for this plugin.
The instance private data for a content plugin.

◆ gnc_plugin_page_merge_actions()

void gnc_plugin_page_merge_actions ( GncPluginPage plugin_page,
GtkUIManager *  merge 
)

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.
mergeA pointer to the UI manager data structure for a window.

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

259 {
260  GncPluginPagePrivate *priv;
261 
262  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
263 
264  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
265  priv->ui_merge = ui_merge;
266  gtk_action_group_set_sensitive (priv->action_group, TRUE);
267  priv->merge_id = gnc_plugin_add_actions (priv->ui_merge,
268  priv->action_group,
269  priv->ui_description);
270 }
gint gnc_plugin_add_actions(GtkUIManager *ui_merge, GtkActionGroup *action_group, const gchar *filename)
Load a new set of actions into an existing UI.
Definition: gnc-plugin.c:309
The instance private data for a content plugin.
GtkActionGroup * action_group
The group of all actions provided by this 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 216 of file gnc-plugin-page.c.

220 {
221  GncPluginPageClass *klass;
222  GncPluginPage *page = NULL;
223  GType type;
224 
225  ENTER("type %s, keyfile %p, group %s", page_type, key_file, page_group);
226  type = g_type_from_name (page_type);
227  if (type == 0)
228  {
229  LEAVE("Cannot find type named %s", page_type);
230  return NULL;
231  }
232 
233  klass = g_type_class_ref (type);
234  if (klass == NULL)
235  {
236  const gchar *type_name = g_type_name (type);
237  LEAVE("Cannot create class %s(%s)", page_type, type_name ? type_name : "invalid type");
238  return NULL;
239  }
240 
241  if (!klass->recreate_page)
242  {
243  LEAVE("Class %shas no recreate function.", page_type);
244  g_type_class_unref (klass);
245  return NULL;
246  }
247 
248  page = (klass->recreate_page)(window, key_file, page_group);
249  g_type_class_unref (klass);
250  LEAVE(" ");
251  return page;
252 }
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 192 of file gnc-plugin-page.c.

195 {
196  GncPluginPageClass *klass;
197 
198  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
199  g_return_if_fail (key_file != NULL);
200  g_return_if_fail (group_name != NULL);
201 
202  ENTER(" ");
203  klass = GNC_PLUGIN_PAGE_GET_CLASS(page);
204  g_return_if_fail (klass != NULL);
205  g_return_if_fail (klass->save_page != NULL);
206 
207  klass->save_page (page, key_file, group_name);
208  LEAVE(" ");
209 }
#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_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 1077 of file gnc-plugin-page.c.

1079 {
1080  GncPluginPagePrivate *priv;
1081 
1082  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1083 
1084  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1085  if (priv->ui_description)
1086  g_free (priv->ui_description);
1087 
1088  priv->ui_description = g_strdup (ui_filename);
1089 }
The instance private data for a content plugin.

◆ gnc_plugin_page_set_uri()

void gnc_plugin_page_set_uri ( GncPluginPage page,
const char *  name 
)

Set the Uniform Resource Identifier for this page.

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

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

1051 {
1052  GncPluginPagePrivate *priv;
1053 
1054  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
1055 
1056  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
1057  priv->use_new_window = use_new;
1058 }
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 172 of file gnc-plugin-page.c.

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

◆ gnc_plugin_page_unmerge_actions()

void gnc_plugin_page_unmerge_actions ( GncPluginPage plugin_page,
GtkUIManager *  merge 
)

Remove the actions for a content page from the specified window.

Parameters
plugin_pageA pointer to the page whose actions should be removed from the user interface.
mergeA pointer to the UI manager data structure for a window.

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

277 {
278  GncPluginPagePrivate *priv;
279 
280  priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
281 
282  g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
283  g_return_if_fail (priv->merge_id != 0);
284  g_return_if_fail (priv->action_group != NULL);
285 
286  gtk_ui_manager_remove_ui (ui_merge, priv->merge_id);
287  gtk_action_group_set_sensitive (priv->action_group, FALSE);
288  gtk_ui_manager_remove_action_group (ui_merge, priv->action_group);
289 
290  priv->ui_merge = NULL;
291  priv->merge_id = 0;
292 }
The instance private data for a content plugin.
GtkActionGroup * action_group
The group of all actions provided by this plugin.