GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-main-window.h
Go to the documentation of this file.
1/*
2 * gnc-main-window.h -- GtkWindow which represents the
3 * GnuCash main window.
4 *
5 * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
6 * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, contact:
20 *
21 * Free Software Foundation Voice: +1-617-542-5942
22 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
23 * Boston, MA 02110-1301, USA gnu@gnu.org
24 */
25
36#ifndef __GNC_MAIN_WINDOW_H
37#define __GNC_MAIN_WINDOW_H
38
39#include <gtk/gtk.h>
40#include "gnc-plugin-page.h"
41
42#ifdef __cplusplus
43extern "C"
44{
45#endif
46
47/* type macros */
48#define GNC_TYPE_MAIN_WINDOW (gnc_main_window_get_type ())
49#define GNC_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_MAIN_WINDOW, GncMainWindow))
50#define GNC_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_MAIN_WINDOW, GncMainWindowClass))
51#define GNC_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_MAIN_WINDOW))
52#define GNC_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_MAIN_WINDOW))
53#define GNC_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_MAIN_WINDOW, GncMainWindowClass))
54
55#define PLUGIN_PAGE_IMMUTABLE "page-immutable"
56
57/* typedefs & structures */
58
59typedef struct
60{
61 const gchar *actions;
62 const gchar *update_type;
64
66typedef struct _GncMainWindow GncMainWindow;
67
69typedef struct
70{
71 GtkApplicationWindowClass gtk_application_window;
73 /* callbacks */
74 void (*page_added) (GncMainWindow *window,
75 GncPluginPage *page);
76 void (*page_changed) (GncMainWindow *window,
77 GncPluginPage *page);
78 void (*menu_changed) (GncMainWindow *window,
79 GncPluginPage *page);
81
82typedef struct
83{
84 GncMainWindow *window;
85 gpointer data;
87
88typedef void (*GncMainWindowFunc) (GncMainWindow *window, GncPluginPage *page);
89typedef void (*GncMainWindowPageFunc) (GncPluginPage *page, gpointer user_data);
90
91/* function prototypes */
92
98
99
104GncMainWindow *gnc_main_window_new (void);
105
106
113
114
127void gnc_main_window_open_page (GncMainWindow *window,
128 GncPluginPage *page);
129
130
139
140
148void gnc_main_window_foreach_page (GncMainWindowPageFunc fn,
149 gpointer user_data);
150
151
166GncPluginPage *gnc_main_window_get_current_page (GncMainWindow *window);
167
173void
175 const gchar *name_in);
176
182void
184 const gchar *long_name_in);
185
191void
193 const gchar *color_in);
194
201void
203 gboolean read_only);
204
219void gnc_main_window_manual_merge_actions (GncMainWindow *window,
220 const gchar *group_name,
221 GSimpleActionGroup *group);
222
223
248void gnc_main_window_merge_actions (GncMainWindow *window,
249 const gchar *group_name,
250 GActionEntry *entries,
251 guint n_entries,
252 const gchar **ui_updates,
253 const gchar *ui_filename,
254 gpointer user_data);
255
256
268void gnc_main_window_unmerge_actions (GncMainWindow *window,
269 const gchar *group_name);
270
282void gnc_main_window_set_vis_of_items_by_action (GncMainWindow *window,
283 const gchar **action_names,
284 gboolean vis);
285
296GtkWidget *gnc_main_window_menu_find_menu_item (GncMainWindow *window,
297 const gchar *action_name);
298
309GtkWidget * gnc_main_window_toolbar_find_tool_item (GncMainWindow *window,
310 const gchar *action_name);
311
326gboolean gnc_main_window_update_menu_for_action (GncMainWindow *window,
327 const gchar *action_name,
328 const gchar *label,
329 const gchar *tooltip);
330
338void gnc_main_window_menu_add_accelerator_keys (GncMainWindow *window);
339
346typedef struct
347{
349 const char *action_name;
351 const char *short_label;
353
354
362void gnc_main_window_init_short_names (GncMainWindow *window,
363 GncToolBarShortNames *toolbar_labels);
364
365
379GSimpleActionGroup *gnc_main_window_get_action_group (GncMainWindow *window,
380 const gchar *group_name);
381
382
389void gnc_main_window_set_progressbar_window( GncMainWindow *window );
390
391
409gboolean gnc_main_window_button_press_cb (GtkWidget *whatever,
410 GdkEventButton *event,
411 GncPluginPage *page);
412
426gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget,
427 GncPluginPage *page);
428
429
434void gnc_main_window_restore_all_windows(const GKeyFile *keyfile);
435
444gboolean gnc_main_window_is_restoring_pages (GncMainWindow *window);
445
452gboolean gnc_main_window_is_quitting (GncMainWindow *window);
453
458void gnc_main_window_save_all_windows(GKeyFile *keyfile);
459
462void gnc_main_window_restore_default_state(GncMainWindow *window);
463
464
474gboolean gnc_main_window_finish_pending (GncMainWindow *window);
475
476
486
495void gnc_main_window_all_action_set_sensitive (const gchar *action_name, gboolean sensitive);
496
507GAction *gnc_main_window_find_action (GncMainWindow *window,
508 const gchar *action_name);
509
520GAction *gnc_main_window_find_action_in_group (GncMainWindow *window,
521 const gchar *group_name,
522 const gchar *action_name);
523
530GMenuModel *gnc_main_window_get_menu_model (GncMainWindow *window);
531
541void gnc_main_window_update_menu_and_toolbar (GncMainWindow *window,
542 GncPluginPage *page,
543 const gchar **ui_updates);
544
549
550gboolean gnc_main_window_just_plugin_prefs (GncMainWindow* window);
551
565GtkWidget *gnc_book_options_dialog_cb (gboolean modal, gchar *title,
566 GtkWindow *parent);
567
580
581#ifdef __cplusplus
582}
583#endif
584#endif /* __GNC_MAIN_WINDOW_H */
585
Holds all of the options for a book, report, or stylesheet, organized by GncOptionSections.
Functions for adding plugins to a GnuCash window.
void gnc_main_window_merge_actions(GncMainWindow *window, const gchar *group_name, GActionEntry *actions, guint n_actions, const gchar **ui_updates, const gchar *ui_filename, gpointer user_data)
Add a set of actions to the specified window.
void gnc_main_window_save_all_windows(GKeyFile *keyfile)
Save the persistent state of all windows.
void gnc_main_window_manual_merge_actions(GncMainWindow *window, const gchar *group_name, GSimpleActionGroup *group)
Manually add a set of actions to the specified window.
void gnc_main_window_menu_add_accelerator_keys(GncMainWindow *window)
Scan the main window menu and add accelerator keys to main window accelerator group.
gboolean gnc_main_window_finish_pending(GncMainWindow *window)
Tell a window to finish any outstanding activities.
gboolean gnc_main_window_is_restoring_pages(GncMainWindow *window)
Check if the main window is restoring the plugin pages.
void gnc_main_window_display_page(GncPluginPage *page)
Bring the window containing the specified page to the top of the window stack, then switch the notebo...
GAction * gnc_main_window_find_action_in_group(GncMainWindow *window, const gchar *group_name, const gchar *action_name)
Find the GAction in a specific action group for window.
void main_window_update_page_set_read_only_icon(GncPluginPage *page, gboolean read_only)
Update the icon on the page tabs in the main window.
GncPluginPage * gnc_main_window_get_current_page(GncMainWindow *window)
Retrieve a pointer to the page that is currently at the front of the specified window.
gboolean gnc_main_window_all_finish_pending(void)
Tell all pages in all windows to finish any outstanding activities.
void main_window_update_page_color(GncPluginPage *page, const gchar *color_in)
Update the color on the page tabs in the main window.
void gnc_main_window_restore_all_windows(const GKeyFile *keyfile)
Restore the persistent state of all windows.
gboolean gnc_main_window_is_quitting(GncMainWindow *window)
Check if the main window is quitting.
gboolean gnc_main_window_button_press_cb(GtkWidget *whatever, GdkEventButton *event, GncPluginPage *page)
Callback function invoked when the user clicks in the content of any Gnucash window.
GSimpleActionGroup * gnc_main_window_get_action_group(GncMainWindow *window, const gchar *group_name)
Retrieve a specific set of user interface actions from a window.
gboolean gnc_book_options_dialog_apply_helper(GncOptionDB *options)
Processes selected options in the Book Options dialog: checks book_currency and use_split_action_for_...
GAction * gnc_main_window_find_action(GncMainWindow *window, const gchar *action_name)
Find the GAction in the main window.
GtkWidget * gnc_book_options_dialog_cb(gboolean modal, gchar *title, GtkWindow *parent)
Opens the Book Options dialog.
void gnc_main_window_init_short_names(GncMainWindow *window, GncToolBarShortNames *toolbar_labels)
Update the labels of the toolbar items with short names.
void main_window_update_page_name(GncPluginPage *page, const gchar *name_in)
Update the name of the page in the main window.
void gnc_main_window_all_action_set_sensitive(const gchar *action_name, gboolean sensitive)
Change the sensitivity of a command in all windows.
void gnc_main_window_restore_default_state(GncMainWindow *window)
Restore the persistent state of one window to a sane default.
gboolean gnc_main_window_popup_menu_cb(GtkWidget *widget, GncPluginPage *page)
Callback function invoked when the user requests that Gnucash popup the contextual menu via the keybo...
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
gboolean gnc_main_window_update_menu_for_action(GncMainWindow *window, const gchar *action_name, const gchar *label, const gchar *tooltip)
Find the GMenuModel item given the action name for the window specified.
GncMainWindow * gnc_main_window_new(void)
Create a new gnc main window plugin.
void gnc_main_window_set_progressbar_window(GncMainWindow *window)
Set the window where all progressbar updates should occur.
GType gnc_main_window_get_type(void)
Get the type of a gnc main window.
GMenuModel * gnc_main_window_get_menu_model(GncMainWindow *window)
Return the GMenuModel for the main window menu bar.
void gnc_main_window_set_vis_of_items_by_action(GncMainWindow *window, const gchar **action_names, gboolean vis)
Show or hide menu and toolbar items based on a NULL terminated list of action names.
GtkWidget * gnc_main_window_menu_find_menu_item(GncMainWindow *window, const gchar *action_name)
Find the menu item with the given action name for the window specified.
void gnc_main_window_unmerge_actions(GncMainWindow *window, const gchar *group_name)
Remove a set of actions from the specified window.
void main_window_update_page_long_name(GncPluginPage *page, const gchar *long_name_in)
Update the long name of the page in the main window.
void gnc_main_window_update_menu_and_toolbar(GncMainWindow *window, GncPluginPage *page, const gchar **ui_updates)
Update the main window menu with the placeholders listed in ui_updates and load the page specific too...
void gnc_main_window_show_all_windows(void)
Shows all main windows.
void gnc_main_window_foreach_page(GncMainWindowPageFunc fn, gpointer user_data)
Iterator function to walk all pages in all windows, calling the specified function for each page.
GtkWidget * gnc_main_window_toolbar_find_tool_item(GncMainWindow *window, const gchar *action_name)
Find the toolbar item with the given action name for the window specified.
void gnc_main_window_close_page(GncPluginPage *page)
Remove a data plugin page from a window and display the previous page.
The class data structure for a main window object.
GtkApplicationWindowClass gtk_application_window
The parent class for a main window.
The instance data structure for a content plugin.
A structure for defining alternate action names for use in the toolbar.
const char * short_label
The alternate toolbar label to use.
const char * action_name
The name of the action.
The instance data structure for a main window object.