| typedef struct _GncPluginPagePrivate GncPluginPagePrivate |
The instance private data for a content plugin.
| anonymous enum |
Definition at line 61 of file gnc-plugin-page.c.
00061 { 00062 INSERTED, 00063 REMOVED, 00064 SELECTED, 00065 UNSELECTED, 00066 LAST_SIGNAL 00067 };
| anonymous enum |
| PROP_0 | |
| PROP_PAGE_NAME | |
| PROP_PAGE_URI | |
| PROP_BOOK | |
| PROP_STATUSBAR_TEXT | |
| PROP_USE_NEW_WINDOW | |
| PROP_UI_DESCRIPTION | |
| PROP_UI_MERGE | |
| PROP_ACTION_GROUP |
Definition at line 69 of file gnc-plugin-page.c.
00069 { 00070 PROP_0, 00071 PROP_PAGE_NAME, 00072 PROP_PAGE_URI, 00073 PROP_BOOK, 00074 PROP_STATUSBAR_TEXT, 00075 PROP_USE_NEW_WINDOW, 00076 PROP_UI_DESCRIPTION, 00077 PROP_UI_MERGE, 00078 PROP_ACTION_GROUP, 00079 };
| void gnc_plugin_page_add_book | ( | GncPluginPage * | page, | |
| QofBook * | book | |||
| ) |
Add a book reference to the specified page.
| page | The page to be modified. | |
| book | The book referenced by this page. |
Definition at line 681 of file gnc-plugin-page.c.
00682 { 00683 GncPluginPagePrivate *priv; 00684 00685 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 00686 g_return_if_fail (book != NULL); 00687 00688 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00689 priv->books = g_list_append(priv->books, book); 00690 }
| GtkActionGroup * gnc_plugin_page_create_action_group | ( | GncPluginPage * | page, | |
| const gchar * | group_name | |||
| ) |
Create the GtkActionGroup object associated with this page.
| page | The page whose menu/toolbar action group should be created. | |
| group_name | The 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. |
Definition at line 947 of file gnc-plugin-page.c.
00948 { 00949 GncPluginPagePrivate *priv; 00950 GtkActionGroup *group; 00951 00952 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00953 group = gtk_action_group_new(group_name); 00954 gnc_gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE); 00955 priv->action_group = group; 00956 return group; 00957 }
| 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.
| plugin_page | A pointer to the plugin for which a display widget should be created. |
Definition at line 140 of file gnc-plugin-page.c.
00141 { 00142 GncPluginPageClass *klass; 00143 GtkWidget *widget; 00144 00145 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page), NULL); 00146 00147 klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); 00148 g_return_val_if_fail (klass != NULL, NULL); 00149 g_return_val_if_fail (klass->create_widget != NULL, NULL); 00150 00151 widget = klass->create_widget (plugin_page); 00152 00153 /* 00154 * If there is a destroy function, add a ref so that the 00155 * widgets will exists when the destroy function is called. 00156 * Otherwise it will be destroyed when it is removed from the 00157 * main notebook for the window. 00158 */ 00159 if (klass->destroy_widget) 00160 g_object_ref(widget); 00161 00162 return widget; 00163 }
| 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.
| plugin_page | A pointer to the plugin whose display widget should be destroyed. |
Definition at line 170 of file gnc-plugin-page.c.
00171 { 00172 GncPluginPageClass *klass; 00173 00174 g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); 00175 00176 klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); 00177 g_return_if_fail (klass != NULL); 00178 g_return_if_fail (klass->destroy_widget != NULL); 00179 00180 return klass->destroy_widget (plugin_page); 00181 }
| gboolean gnc_plugin_page_finish_pending | ( | GncPluginPage * | plugin_page | ) |
Tell a page to finish any outstanding activities.
| page | A page. |
Definition at line 960 of file gnc-plugin-page.c.
00961 { 00962 if (!page) 00963 return TRUE; 00964 if (!GNC_IS_PLUGIN_PAGE(page)) 00965 return TRUE; 00966 00967 if (!GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending) 00968 return TRUE; 00969 return (GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)(page); 00970 }
| GtkAction * gnc_plugin_page_get_action | ( | GncPluginPage * | page, | |
| const gchar * | name | |||
| ) |
Retrieve a GtkAction object associated with this page.
| page | The page whose menu/toolbar action group should be retrieved. | |
| name | The name of the GtkAction to find. |
Definition at line 306 of file gnc-plugin-page.c.
00307 { 00308 GncPluginPagePrivate *priv; 00309 00310 g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), NULL); 00311 g_return_val_if_fail(name != NULL, NULL); 00312 00313 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00314 if (!priv->action_group) 00315 return NULL; 00316 return gtk_action_group_get_action (priv->action_group, name); 00317 }
| GtkActionGroup * gnc_plugin_page_get_action_group | ( | GncPluginPage * | page | ) |
Retrieve the GtkActionGroup object associated with this page.
| page | The page whose menu/toolbar action group should be retrieved. |
Definition at line 935 of file gnc-plugin-page.c.
00936 { 00937 GncPluginPagePrivate *priv; 00938 00939 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00940 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00941 return priv->action_group; 00942 }
| 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 pate name in the notebook tab.
| page | The page whose name should be retrieved. |
Definition at line 778 of file gnc-plugin-page.c.
00779 { 00780 GncPluginPagePrivate *priv; 00781 00782 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00783 00784 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00785 return priv->page_long_name; 00786 }
| 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.
| page | The page whose name should be retrieved. |
Definition at line 740 of file gnc-plugin-page.c.
00741 { 00742 GncPluginPagePrivate *priv; 00743 00744 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00745 00746 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00747 return priv->page_name; 00748 }
| const gchar * gnc_plugin_page_get_plugin_name | ( | GncPluginPage * | plugin_page | ) |
Retrieve the textual name of a plugin.
| plugin_page | A pointer to the page whose actions name should be retrieved. |
Definition at line 322 of file gnc-plugin-page.c.
00323 { 00324 GncPluginPageClass *klass; 00325 00326 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page), NULL); 00327 00328 klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); 00329 g_return_val_if_fail (klass != NULL, NULL); 00330 00331 return (klass->plugin_name); 00332 }
| const gchar * gnc_plugin_page_get_statusbar_text | ( | GncPluginPage * | page | ) |
Retrieve the statusbar text associated with this page.
| page | The page whose statusbar should text be retrieved. |
Definition at line 835 of file gnc-plugin-page.c.
00836 { 00837 GncPluginPagePrivate *priv; 00838 00839 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00840 00841 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00842 return priv->statusbar_text; 00843 }
| GType gnc_plugin_page_get_type | ( | void | ) |
Get the type of a content plugin.
Definition at line 107 of file gnc-plugin-page.c.
00108 { 00109 static GType gnc_plugin_page_type = 0; 00110 00111 if (gnc_plugin_page_type == 0) { 00112 static const GTypeInfo our_info = { 00113 00114 sizeof (GncPluginPageClass), 00115 NULL, /* base_init */ 00116 NULL, /* base_finalize */ 00117 (GClassInitFunc) gnc_plugin_page_class_init, 00118 NULL, /* class_finalize */ 00119 NULL, /* class_data */ 00120 sizeof (GncPluginPage), 00121 0, /* n_preallocs */ 00122 (GInstanceInitFunc) gnc_plugin_page_init, 00123 }; 00124 00125 gnc_plugin_page_type = g_type_register_static (G_TYPE_OBJECT, 00126 "GncPluginPage", 00127 &our_info, 0); 00128 } 00129 00130 return gnc_plugin_page_type; 00131 }
| const char * gnc_plugin_page_get_ui_description | ( | GncPluginPage * | page | ) |
Retrieve the name of the XML UI file associated with this page.
| page | The page whose setting should be retrieved. |
Definition at line 892 of file gnc-plugin-page.c.
00893 { 00894 GncPluginPagePrivate *priv; 00895 00896 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); 00897 00898 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00899 return priv->ui_description; 00900 }
| GtkUIManager * gnc_plugin_page_get_ui_merge | ( | GncPluginPage * | page | ) |
Retrieve the GtkUIManager object associated with this page.
| page | The page whose UI information should be retrieved. |
Definition at line 922 of file gnc-plugin-page.c.
00923 { 00924 GncPluginPagePrivate *priv; 00925 00926 g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), NULL); 00927 00928 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00929 return priv->ui_merge; 00930 }
| const gchar * gnc_plugin_page_get_uri | ( | GncPluginPage * | page | ) |
Retrieve the Uniform Resource Identifier for this page.
| page | The page whose URI should be retrieved. |
Definition at line 807 of file gnc-plugin-page.c.
00808 { 00809 GncPluginPagePrivate *priv; 00810 00811 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00812 00813 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00814 return priv->uri; 00815 }
| gboolean gnc_plugin_page_get_use_new_window | ( | GncPluginPage * | page | ) |
Retrieve the "use new window" setting associated with this page.
| page | The page whose setting should be retrieved. |
Definition at line 863 of file gnc-plugin-page.c.
00864 { 00865 GncPluginPagePrivate *priv; 00866 00867 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); 00868 00869 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00870 return priv->use_new_window; 00871 }
| GtkWidget * gnc_plugin_page_get_window | ( | GncPluginPage * | page | ) |
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
| page | The page whose window should be retrieved. |
Definition at line 729 of file gnc-plugin-page.c.
00730 { 00731 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); 00732 00733 return page->window; 00734 }
| 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.
| page | The page to query. | |
| book | The guid of the book in question. |
Definition at line 695 of file gnc-plugin-page.c.
00696 { 00697 GncPluginPagePrivate *priv; 00698 GList *item; 00699 00700 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); 00701 g_return_val_if_fail (book != NULL, FALSE); 00702 00703 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00704 for (item = priv->books; item; item = g_list_next(item)) { 00705 if (item->data == book) { 00706 return TRUE; 00707 } 00708 } 00709 return FALSE; 00710 }
| gboolean gnc_plugin_page_has_books | ( | GncPluginPage * | page | ) |
Query a page to see if it has a reference to any book.
| page | The page to query. |
Definition at line 715 of file gnc-plugin-page.c.
00716 { 00717 GncPluginPagePrivate *priv; 00718 00719 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); 00720 00721 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00722 return (priv->books != NULL); 00723 }
| void gnc_plugin_page_merge_actions | ( | GncPluginPage * | plugin_page, | |
| GtkUIManager * | merge | |||
| ) |
Add the actions for a content page to the specified window.
| plugin_page | A pointer to the page whose actions should be added to the user interface. | |
| merge | A pointer to the UI manager data structure for a window. |
Definition at line 269 of file gnc-plugin-page.c.
00271 { 00272 GncPluginPagePrivate *priv; 00273 00274 g_return_if_fail (GNC_IS_PLUGIN_PAGE(page)); 00275 00276 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00277 priv->ui_merge = ui_merge; 00278 priv->merge_id = gnc_plugin_add_actions(priv->ui_merge, 00279 priv->action_group, 00280 priv->ui_description); 00281 }
| 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.
| window | The window where this page should be installed. | |
| page_type | The name of the page type to create. | |
| key_file | A pointer to the GKeyFile data structure where the page information should be read. | |
| group_name | The group name to use when restoring data. |
Definition at line 231 of file gnc-plugin-page.c.
00235 { 00236 GncPluginPageClass *klass; 00237 GncPluginPage *page = NULL; 00238 GType type; 00239 00240 ENTER("type %s, keyfile %p, group %s", page_type, key_file, page_group); 00241 type = g_type_from_name(page_type); 00242 if (type == 0) { 00243 LEAVE("Cannot find type named %s", page_type); 00244 return NULL; 00245 } 00246 00247 klass = g_type_class_ref(type); 00248 if (klass == NULL) { 00249 const gchar *type_name = g_type_name(type); 00250 LEAVE("Cannot create class %s(%s)", page_type, type_name ? type_name : "invalid type"); 00251 return NULL; 00252 } 00253 00254 if (!klass->recreate_page) { 00255 LEAVE("Class %shas no recreate function.", page_type); 00256 g_type_class_unref(klass); 00257 return NULL; 00258 } 00259 00260 page = (klass->recreate_page)(window, key_file, page_group); 00261 g_type_class_unref(klass); 00262 LEAVE(" "); 00263 return page; 00264 }
| 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.
| page | The page to save. | |
| key_file | A pointer to the GKeyFile data structure where the page information should be written. | |
| group_name | The group name to use when saving data. |
Definition at line 207 of file gnc-plugin-page.c.
00210 { 00211 GncPluginPageClass *klass; 00212 00213 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 00214 g_return_if_fail (key_file != NULL); 00215 g_return_if_fail (group_name != NULL); 00216 00217 ENTER(" "); 00218 klass = GNC_PLUGIN_PAGE_GET_CLASS (page); 00219 g_return_if_fail (klass != NULL); 00220 g_return_if_fail (klass->save_page != NULL); 00221 00222 klass->save_page(page, key_file, group_name); 00223 LEAVE(" "); 00224 }
| 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 pate name in the notebook tab.
| page | The page whose name should be set. | |
| name | The new string for the 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.
| page | The page whose name should be set. | |
| name | The new string for the name. |
| void gnc_plugin_page_set_statusbar_text | ( | GncPluginPage * | page, | |
| const char * | name | |||
| ) |
Set the statusbar text associated with this page.
| page | The page whose statusbar text should be set. | |
| name | The new statusbar text for the page. |
| 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.
| page | The page to modify. | |
| ui_filename | The filename (no path) of the alternate UI. |
Definition at line 906 of file gnc-plugin-page.c.
00908 { 00909 GncPluginPagePrivate *priv; 00910 00911 g_return_if_fail(GNC_IS_PLUGIN_PAGE(page)); 00912 00913 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00914 if (priv->ui_description) 00915 g_free(priv->ui_description); 00916 priv->ui_description = g_strdup(ui_filename); 00917 }
| void gnc_plugin_page_set_uri | ( | GncPluginPage * | page, | |
| const char * | name | |||
| ) |
Set the Uniform Resource Identifier for this page.
| page | The page whose URI should be set. | |
| name | The new URI for the page. |
| 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.
| page | The page whose setting should be updated. | |
| use_new | The new value for this setting. |
Definition at line 879 of file gnc-plugin-page.c.
00880 { 00881 GncPluginPagePrivate *priv; 00882 00883 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 00884 00885 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00886 priv->use_new_window = use_new; 00887 }
| void gnc_plugin_page_show_summarybar | ( | GncPluginPage * | page, | |
| gboolean | visible | |||
| ) |
Show/hide the summarybar associated with this page.
| page | The page whose summarybar visibility should be changed. | |
| visible | Whether or not the summarybar should be shown.. |
Definition at line 186 of file gnc-plugin-page.c.
00188 { 00189 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 00190 00191 if (!page->summarybar) 00192 return; 00193 00194 if (visible) { 00195 gtk_widget_show(page->summarybar); 00196 } else { 00197 gtk_widget_hide(page->summarybar); 00198 } 00199 }
| void gnc_plugin_page_unmerge_actions | ( | GncPluginPage * | plugin_page, | |
| GtkUIManager * | merge | |||
| ) |
Remove the actions for a content page from the specified window.
| plugin_page | A pointer to the page whose actions should be removed from the user interface. | |
| merge | A pointer to the UI manager data structure for a window. |
Definition at line 286 of file gnc-plugin-page.c.
00288 { 00289 GncPluginPagePrivate *priv; 00290 00291 priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); 00292 00293 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 00294 g_return_if_fail (priv->merge_id != 0); 00295 g_return_if_fail (priv->action_group != NULL); 00296 00297 gtk_ui_manager_remove_ui(ui_merge, priv->merge_id); 00298 gtk_ui_manager_remove_action_group(ui_merge, priv->action_group); 00299 00300 priv->ui_merge = NULL; 00301 priv->merge_id = 0; 00302 }
1.5.2