Files | |
| file | gnc-main-window.c |
| Functions for adding content to a window. | |
| file | gnc-main-window.h |
| Functions for adding content to a window. | |
Data Structures | |
| struct | GncMainWindowPrivate |
| struct | MergedActionEntry |
| struct | GncMainWindowSaveData |
| struct | menu_update |
| struct | _ActionStatus |
| struct | GncMainWindow |
| struct | GncMainWindowClass |
| struct | GncMainWindowActionData |
Defines | |
| #define | PLUGIN_PAGE_LABEL "plugin-page" |
| #define | PLUGIN_PAGE_CLOSE_BUTTON "close-button" |
| #define | PLUGIN_PAGE_TAB_LABEL "label" |
| #define | KEY_SHOW_CLOSE_BUTTON "tab_close_buttons" |
| #define | KEY_TAB_NEXT_RECENT "tab_next_recent" |
| #define | KEY_TAB_POSITION "tab_position" |
| #define | KEY_TAB_WIDTH "tab_width" |
| #define | GNC_MAIN_WINDOW_NAME "GncMainWindow" |
| #define | GNC_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_MAIN_WINDOW, GncMainWindowPrivate)) |
| #define | WINDOW_COUNT "WindowCount" |
| #define | WINDOW_STRING "Window %d" |
| #define | WINDOW_GEOMETRY "WindowGeometry" |
| #define | WINDOW_POSITION "WindowPosition" |
| #define | WINDOW_MAXIMIZED "WindowMaximized" |
| #define | TOOLBAR_VISIBLE "ToolbarVisible" |
| #define | STATUSBAR_VISIBLE "StatusbarVisible" |
| #define | SUMMARYBAR_VISIBLE "SummarybarVisible" |
| #define | WINDOW_FIRSTPAGE "FirstPage" |
| #define | WINDOW_PAGECOUNT "PageCount" |
| #define | WINDOW_PAGEORDER "PageOrder" |
| #define | PAGE_TYPE "PageType" |
| #define | PAGE_NAME "PageName" |
| #define | PAGE_STRING "Page %d" |
| #define | GNC_TYPE_MAIN_WINDOW (gnc_main_window_get_type ()) |
| #define | GNC_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_MAIN_WINDOW, GncMainWindow)) |
| #define | GNC_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_MAIN_WINDOW, GncMainWindowClass)) |
| #define | GNC_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_MAIN_WINDOW)) |
| #define | GNC_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_MAIN_WINDOW)) |
| #define | GNC_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_MAIN_WINDOW, GncMainWindowClass)) |
| #define | PLUGIN_PAGE_IMMUTABLE "page-immutable" |
Typedefs | |
| typedef _ActionStatus | ActionStatus |
| typedef void(*) | GncMainWindowFunc (GncMainWindow *window, GncPluginPage *page) |
| typedef void(*) | GncMainWindowPageFunc (GncPluginPage *page, gpointer user_data) |
Enumerations | |
| enum | { PAGE_ADDED, PAGE_CHANGED, LAST_SIGNAL } |
Functions | |
| void | gnc_main_window_foreach_page (GncMainWindowPageFunc fn, gpointer user_data) |
| void | gnc_main_window_restore_all_windows (const GKeyFile *keyfile) |
| void | gnc_main_window_restore_default_state (void) |
| void | gnc_main_window_save_all_windows (GKeyFile *keyfile) |
| gboolean | gnc_main_window_finish_pending (GncMainWindow *window) |
| gboolean | gnc_main_window_all_finish_pending (void) |
| void | main_window_update_page_name (GncPluginPage *page, const gchar *name_in) |
| GType | gnc_main_window_get_type (void) |
| GncMainWindow * | gnc_main_window_new (void) |
| void | gnc_main_window_display_page (GncPluginPage *page) |
| void | gnc_main_window_open_page (GncMainWindow *window, GncPluginPage *page) |
| void | gnc_main_window_close_page (GncPluginPage *page) |
| GncPluginPage * | gnc_main_window_get_current_page (GncMainWindow *window) |
| void | gnc_main_window_manual_merge_actions (GncMainWindow *window, const gchar *group_name, GtkActionGroup *group, guint merge_id) |
| void | gnc_main_window_merge_actions (GncMainWindow *window, const gchar *group_name, GtkActionEntry *actions, guint n_actions, const gchar *filename, gpointer user_data) |
| void | gnc_main_window_unmerge_actions (GncMainWindow *window, const gchar *group_name) |
| void | gnc_main_window_actions_updated (GncMainWindow *window) |
| GtkActionGroup * | gnc_main_window_get_action_group (GncMainWindow *window, const gchar *group_name) |
| void | gnc_main_window_show_all_windows (void) |
| gncUIWidget | gnc_ui_get_toplevel (void) |
| void | gnc_main_window_set_progressbar_window (GncMainWindow *window) |
| gboolean | gnc_main_window_button_press_cb (GtkWidget *whatever, GdkEventButton *event, GncPluginPage *page) |
| void | gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group, const gchar *domain) |
| void | gnc_main_window_all_action_set_sensitive (const gchar *action_name, gboolean sensitive) |
| #define PLUGIN_PAGE_LABEL "plugin-page" |
This label is used to provide a mapping from a visible page widget back to the corresponding GncPluginPage object.
Definition at line 80 of file gnc-main-window.c.
| anonymous enum |
Names of signals generated by the main window.
Definition at line 72 of file gnc-main-window.c.
00072 { 00073 PAGE_ADDED, 00074 PAGE_CHANGED, 00075 LAST_SIGNAL 00076 };
| void gnc_gtk_action_group_set_translation_domain | ( | GtkActionGroup * | action_group, | |
| const gchar * | domain | |||
| ) |
gnc_gtk_action_group_set_translation_domain: : a GtkActionGroup : the translation domain to use for dgettext() calls
Sets the translation domain and uses dgettext() for translating the and of GtkActionEntrys added by gtk_action_group_add_actions().
This is copied from gtk's gtk_action_group_set_translation_domain() into GnuCash in order to fix problems when empty msgids were passed through gettext().
See http://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug is fixed in the gtk that we can rely open, then gnc_gtk_action_group_set_translation_domain can be replaced by gtk_action_group_set_translation_domain again.
Definition at line 3752 of file gnc-main-window.c.
03754 { 03755 g_return_if_fail (GTK_IS_ACTION_GROUP (action_group)); 03756 03757 gtk_action_group_set_translate_func (action_group, 03758 (GtkTranslateFunc)dgettext_swapped, 03759 g_strdup (domain), 03760 g_free); 03761 }
| void gnc_main_window_actions_updated | ( | GncMainWindow * | window | ) |
Force a full update of the user interface for the specified window. This can be an expensive function, but is needed because the gtk ui manager doesn't always seem to update properly when actions are changed.
| window | A pointer to the window whose user interface should be updated. |
Definition at line 2482 of file gnc-main-window.c.
02483 { 02484 GtkActionGroup *force; 02485 02486 g_return_if_fail (GNC_IS_MAIN_WINDOW (window)); 02487 02488 /* Unfortunately gtk_ui_manager_ensure_update doesn't work 02489 * here. Force a full update by adding and removing an empty 02490 * action group. 02491 */ 02492 force = gtk_action_group_new("force_update"); 02493 gtk_ui_manager_insert_action_group (window->ui_merge, force, 0); 02494 gtk_ui_manager_ensure_update (window->ui_merge); 02495 gtk_ui_manager_remove_action_group (window->ui_merge, force); 02496 g_object_unref(force); 02497 }
| void gnc_main_window_all_action_set_sensitive | ( | const gchar * | action_name, | |
| gboolean | sensitive | |||
| ) |
Change the sensitivity of a command in all windows. This can be used to serialize access to a command so that in cannot be reinvoked until the current invocation is finished.
| action_name | The name of the command to modity. | |
| sensitive | Whether or not the user should be able to invoke this action. |
Definition at line 3765 of file gnc-main-window.c.
03767 { 03768 GList *tmp; 03769 GtkAction *action; 03770 03771 for (tmp = active_windows; tmp; tmp = g_list_next(tmp)) { 03772 action = gnc_main_window_find_action (tmp->data, action_name); 03773 gtk_action_set_sensitive (action, sensitive); 03774 } 03775 }
| gboolean gnc_main_window_all_finish_pending | ( | void | ) |
Tell all pages in all windows to finish any outstanding activities. This function will call gnc_plugin_page_finish_pending for each installed page. If any page returns a failure indication, then the function stops walking pages and immediately returns a failure.
| window | Whe window whose pages should be checked. |
Definition at line 938 of file gnc-main-window.c.
00939 { 00940 const GList *windows, *item; 00941 00942 windows = gnc_gobject_tracking_get_list(GNC_MAIN_WINDOW_NAME); 00943 for (item = windows; item; item = g_list_next(item)) { 00944 if (!gnc_main_window_finish_pending(item->data)) { 00945 return FALSE; 00946 } 00947 } 00948 return TRUE; 00949 }
| 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. If this was a "right-click" then Gnucash will popup the contextual menu.
| whatever | Whatever widget had focus when the user issued the keyboard context-menu request. | |
| event | The event parameter describing where on the screen the mouse was pointing when clicked, type of click, modifiers, etc. | |
| page | This is the GncPluginPage corresponding to the visible page. |
Definition at line 3713 of file gnc-main-window.c.
03716 { 03717 g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE); 03718 03719 ENTER("widget %p, event %p, page %p", whatever, event, page); 03720 /* Ignore double-clicks and triple-clicks */ 03721 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { 03722 do_popup_menu(page, event); 03723 LEAVE("menu shown"); 03724 return TRUE; 03725 } 03726 03727 LEAVE("other click"); 03728 return FALSE; 03729 }
| void gnc_main_window_close_page | ( | GncPluginPage * | page | ) |
Remove a data plugin page from a window and display the previous page. If the page removed was the last page in the window, and there is more than one window open, then the entire window will be destroyed.
| page | The page of data to be removed. |
Definition at line 2311 of file gnc-main-window.c.
02312 { 02313 GncMainWindow *window; 02314 GncMainWindowPrivate *priv; 02315 02316 if (!page || !page->notebook_page) 02317 return; 02318 02319 if (!gnc_plugin_page_finish_pending(page)) 02320 return; 02321 02322 if (!GNC_IS_MAIN_WINDOW (page->window)) 02323 return; 02324 02325 window = GNC_MAIN_WINDOW (page->window); 02326 if (!window) { 02327 g_warning("Page is not in a window."); 02328 return; 02329 } 02330 02331 gnc_main_window_disconnect(window, page); 02332 gnc_plugin_page_destroy_widget (page); 02333 g_object_unref(page); 02334 02335 /* If this isn't the last window, go ahead and destroy the window. */ 02336 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02337 if (priv->installed_pages == NULL) { 02338 if (g_list_length(active_windows) > 1) { 02339 gtk_widget_destroy(GTK_WIDGET(window)); 02340 } 02341 } 02342 }
| 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 notebook to show the specified page.
| page | The existing page to be displayed. |
Definition at line 2147 of file gnc-main-window.c.
02148 { 02149 GncMainWindow *window; 02150 GncMainWindowPrivate *priv; 02151 GtkNotebook *notebook; 02152 gint page_num; 02153 02154 window = GNC_MAIN_WINDOW (page->window); 02155 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02156 notebook = GTK_NOTEBOOK (priv->notebook); 02157 page_num = gtk_notebook_page_num(notebook, page->notebook_page); 02158 gtk_notebook_set_current_page (notebook, page_num); 02159 gtk_window_present(GTK_WINDOW(window)); 02160 }
| gboolean gnc_main_window_finish_pending | ( | GncMainWindow * | window | ) |
Tell a window to finish any outstanding activities. This function will call gnc_plugin_page_finish_pending for each installed page. If any page returns a failure indication, then the function stops walking pages and immediately returns a failure.
| window | Whe window whose pages should be checked. |
Definition at line 920 of file gnc-main-window.c.
00921 { 00922 GncMainWindowPrivate *priv; 00923 GList *item; 00924 00925 g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), TRUE); 00926 00927 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 00928 for (item = priv->installed_pages; item; item = g_list_next(item)) { 00929 if (!gnc_plugin_page_finish_pending(item->data)) { 00930 return FALSE; 00931 } 00932 } 00933 return TRUE; 00934 }
| GtkActionGroup * gnc_main_window_get_action_group | ( | GncMainWindow * | window, | |
| const gchar * | group_name | |||
| ) |
Retrieve a specific set of user interface actions from a window. This function can be used to get an group of action to be manipulated when the front page of a window has changed.
| window | The window to check when looking for the action group. | |
| group_name | The name of a set of actions. This must be a name provided when the actions were installed. |
Definition at line 2521 of file gnc-main-window.c.
02523 { 02524 GncMainWindowPrivate *priv; 02525 MergedActionEntry *entry; 02526 02527 g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), NULL); 02528 g_return_val_if_fail (group_name != NULL, NULL); 02529 02530 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02531 if (priv->merged_actions_table == NULL) 02532 return NULL; 02533 entry = g_hash_table_lookup (priv->merged_actions_table, group_name); 02534 02535 if (entry == NULL) 02536 return NULL; 02537 02538 return entry->action_group; 02539 }
| 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. Any plugin that needs to manipulate its menus based upon the currently selected menu page should connect to the "page_changed" signal on a window. The callback function from that signal can then call this function to obtain a pointer to the current page.
| window | A pointer to the window whose front page should be returned. |
Definition at line 2353 of file gnc-main-window.c.
02354 { 02355 GncMainWindowPrivate *priv; 02356 02357 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02358 return priv->current_page; 02359 }
| GType gnc_main_window_get_type | ( | void | ) |
Get the type of a gnc main window.
Definition at line 1767 of file gnc-main-window.c.
01768 { 01769 static GType gnc_main_window_type = 0; 01770 01771 if (gnc_main_window_type == 0) { 01772 static const GTypeInfo our_info = { 01773 sizeof (GncMainWindowClass), 01774 NULL, 01775 NULL, 01776 (GClassInitFunc) gnc_main_window_class_init, 01777 NULL, 01778 NULL, 01779 sizeof (GncMainWindow), 01780 0, 01781 (GInstanceInitFunc) gnc_main_window_init 01782 }; 01783 01784 static const GInterfaceInfo plugin_info = { 01785 (GInterfaceInitFunc) gnc_window_main_window_init, 01786 NULL, 01787 NULL 01788 }; 01789 01790 gnc_main_window_type = g_type_register_static (GTK_TYPE_WINDOW, 01791 GNC_MAIN_WINDOW_NAME, 01792 &our_info, 0); 01793 g_type_add_interface_static (gnc_main_window_type, 01794 GNC_TYPE_WINDOW, 01795 &plugin_info); 01796 } 01797 01798 return gnc_main_window_type; 01799 }
| void gnc_main_window_manual_merge_actions | ( | GncMainWindow * | window, | |
| const gchar * | group_name, | |||
| GtkActionGroup * | group, | |||
| guint | merge_id | |||
| ) |
Manually add a set of actions to the specified window. Plugins whose user interface is not hard coded (e.g. the menu-additions * plugin) must create their actions at run time, then use this * function to install them into the window.
| window | A pointer to the window whose user interface should be updated. | |
| group_name | The name for this set of actions. This name should be unique among all groups added to the window, and will be needed to remove the actions from this window. | |
| group | A pointer to an array of GtkActions. These are the actions that will be added to the user interface. | |
| merge_id | A merge identifier retrieved from a call to gtk_ui_manager_new_merge_id(). |
Definition at line 2368 of file gnc-main-window.c.
02372 { 02373 GncMainWindowPrivate *priv; 02374 MergedActionEntry *entry; 02375 02376 g_return_if_fail (GNC_IS_MAIN_WINDOW (window)); 02377 g_return_if_fail (group_name != NULL); 02378 g_return_if_fail (GTK_IS_ACTION_GROUP(group)); 02379 g_return_if_fail (merge_id > 0); 02380 02381 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02382 entry = g_new0 (MergedActionEntry, 1); 02383 entry->action_group = group; 02384 entry->merge_id = merge_id; 02385 gtk_ui_manager_ensure_update (window->ui_merge); 02386 g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry); 02387 }
| void gnc_main_window_merge_actions | ( | GncMainWindow * | window, | |
| const gchar * | group_name, | |||
| GtkActionEntry * | entries, | |||
| guint | n_entries, | |||
| const gchar * | filename, | |||
| gpointer | user_data | |||
| ) |
Add a set of actions to the specified window. This function should not need to be called directly by plugin implementors. Correctly assigning values to the GncPluginClass fields during plugin initialization will cause this routine to be automatically called.
| window | A pointer to the window whose user interface should be updated. | |
| group_name | The name for this set of actions. This name should be unique among all groups added to the window, and will be needed to remove the actions from this window. | |
| entries | A pointer to an array of GtkActionEntry. These are the actions that will be added to the user interface. | |
| n_entries | The number of actions in the array. | |
| filename | The filename containing the user interface definition that goes with this set of actions. | |
| user_data | The data to be provided to all callback functions. |
Definition at line 2397 of file gnc-main-window.c.
02403 { 02404 GncMainWindowPrivate *priv; 02405 GncMainWindowActionData *data; 02406 MergedActionEntry *entry; 02407 GError *error = NULL; 02408 gchar *pathname; 02409 02410 g_return_if_fail (GNC_IS_MAIN_WINDOW (window)); 02411 g_return_if_fail (group_name != NULL); 02412 g_return_if_fail (actions != NULL); 02413 g_return_if_fail (n_actions > 0); 02414 g_return_if_fail (filename != NULL); 02415 02416 data = g_new0 (GncMainWindowActionData, 1); 02417 data->window = window; 02418 data->data = user_data; 02419 02420 pathname = gnc_gnome_locate_ui_file (filename); 02421 if (pathname == NULL) 02422 return; 02423 02424 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02425 entry = g_new0 (MergedActionEntry, 1); 02426 entry->action_group = gtk_action_group_new (group_name); 02427 gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE); 02428 gtk_action_group_add_actions (entry->action_group, actions, n_actions, data); 02429 gtk_ui_manager_insert_action_group (window->ui_merge, entry->action_group, 0); 02430 entry->merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge, pathname, &error); 02431 g_assert(entry->merge_id || error); 02432 if (entry->merge_id) { 02433 gtk_ui_manager_ensure_update (window->ui_merge); 02434 g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry); 02435 } else { 02436 g_critical("Failed to load ui file.\n Filename %s\n Error %s", 02437 filename, error->message); 02438 g_error_free(error); 02439 g_free(entry); 02440 } 02441 g_free(pathname); 02442 }
| GncMainWindow * gnc_main_window_new | ( | void | ) |
Create a new gnc main window plugin.
Definition at line 1994 of file gnc-main-window.c.
01995 { 01996 GncMainWindow *window; 01997 gncUIWidget old_window; 01998 01999 window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL); 02000 gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); 02001 02002 old_window = gnc_ui_get_toplevel(); 02003 if (old_window) { 02004 gint width, height; 02005 gtk_window_get_size (GTK_WINDOW (old_window), &width, &height); 02006 gtk_window_resize (GTK_WINDOW (window), width, height); 02007 if ((gdk_window_get_state((GTK_WIDGET(old_window))->window) 02008 & GDK_WINDOW_STATE_MAXIMIZED) != 0) { 02009 gtk_window_maximize (GTK_WINDOW (window)); 02010 } 02011 } 02012 active_windows = g_list_append (active_windows, window); 02013 gnc_main_window_update_title(window); 02014 gnc_main_window_update_all_menu_items(); 02015 return window; 02016 }
| void gnc_main_window_open_page | ( | GncMainWindow * | window, | |
| GncPluginPage * | page | |||
| ) |
Display a data plugin page in a window. If the page already exists in any window, then that window will be brought to the front and the notebook switch to display the specified page. If the page is new then it will be added to the specified window (unless the page itself requests otherwise.). If the window is NULL, the new page will be added to the first window.
| window | The window to display a new page in. | |
| page | The new page of data to be displayed, or the existing page of data the should be brought to the top and displayed. |
Definition at line 2171 of file gnc-main-window.c.
02173 { 02174 GncMainWindowPrivate *priv; 02175 GtkWidget *tab_hbox; 02176 GtkWidget *label, *entry, *event_box; 02177 const gchar *icon, *text; 02178 GtkWidget *image; 02179 GList *tmp; 02180 gint width; 02181 02182 ENTER("window %p, page %p", window, page); 02183 02184 if (window) 02185 g_return_if_fail (GNC_IS_MAIN_WINDOW (window)); 02186 g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); 02187 g_return_if_fail (gnc_plugin_page_has_books(page)); 02188 02189 if (gnc_main_window_page_exists(page)) { 02190 gnc_main_window_display_page(page); 02191 return; 02192 } 02193 02194 /* Does the page want to be in a new window? */ 02195 if (gnc_plugin_page_get_use_new_window(page)) { 02196 /* See if there's a blank window. If so, use that. */ 02197 for (tmp = active_windows; tmp; tmp = g_list_next(tmp)) { 02198 window = GNC_MAIN_WINDOW(tmp->data); 02199 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02200 if (priv->installed_pages == NULL) { 02201 break; 02202 } 02203 } 02204 if (tmp == NULL) 02205 window = gnc_main_window_new (); 02206 gtk_widget_show(GTK_WIDGET(window)); 02207 } else if ((window == NULL) && active_windows) { 02208 window = active_windows->data; 02209 } 02210 02211 page->window = GTK_WIDGET(window); 02212 page->notebook_page = gnc_plugin_page_create_widget (page); 02213 g_object_set_data (G_OBJECT (page->notebook_page), 02214 PLUGIN_PAGE_LABEL, page); 02215 02216 /* 02217 * The page tab. 02218 */ 02219 width = gnc_gconf_get_float(GCONF_GENERAL, KEY_TAB_WIDTH, NULL); 02220 icon = GNC_PLUGIN_PAGE_GET_CLASS(page)->tab_icon; 02221 label = gtk_label_new (gnc_plugin_page_get_page_name(page)); 02222 if (width != 0) { 02223 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE); 02224 gtk_label_set_max_width_chars(GTK_LABEL(label), width); 02225 } 02226 gtk_widget_show (label); 02227 g_object_set_data(G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL, label); 02228 02229 tab_hbox = gtk_hbox_new (FALSE, 6); 02230 gtk_widget_show (tab_hbox); 02231 02232 if (icon != NULL) { 02233 image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_MENU); 02234 gtk_widget_show (image); 02235 gtk_box_pack_start (GTK_BOX (tab_hbox), image, FALSE, FALSE, 0); 02236 } 02237 02238 event_box = gtk_event_box_new(); 02239 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE); 02240 gtk_widget_show(event_box); 02241 gtk_container_add(GTK_CONTAINER(event_box), label); 02242 gtk_box_pack_start (GTK_BOX (tab_hbox), event_box, TRUE, TRUE, 0); 02243 02244 text = gnc_plugin_page_get_page_long_name(page); 02245 if (text) { 02246 gtk_tooltips_set_tip(tips, event_box, text, NULL); 02247 } 02248 02249 entry = gtk_entry_new(); 02250 gtk_widget_hide (entry); 02251 gtk_box_pack_start (GTK_BOX (tab_hbox), entry, TRUE, TRUE, 0); 02252 g_signal_connect(G_OBJECT(entry), "activate", 02253 G_CALLBACK(gnc_main_window_tab_entry_activate), page); 02254 g_signal_connect(G_OBJECT(entry), "focus-out-event", 02255 G_CALLBACK(gnc_main_window_tab_entry_focus_out_event), 02256 page); 02257 g_signal_connect(G_OBJECT(entry), "key-press-event", 02258 G_CALLBACK(gnc_main_window_tab_entry_key_press_event), 02259 page); 02260 g_signal_connect(G_OBJECT(entry), "editing-done", 02261 G_CALLBACK(gnc_main_window_tab_entry_editing_done), 02262 page); 02263 02264 /* Add close button - Not for immutable pages */ 02265 if (!g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE)) { 02266 GtkWidget *close_image, *close_button; 02267 GtkRequisition requisition; 02268 02269 close_button = gtk_button_new(); 02270 gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE); 02271 close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); 02272 gtk_widget_show(close_image); 02273 gtk_widget_size_request(close_image, &requisition); 02274 gtk_widget_set_size_request(close_button, requisition.width + 4, 02275 requisition.height + 2); 02276 gtk_button_set_alignment(GTK_BUTTON(close_button), 0.5, 0.5); 02277 gtk_container_add(GTK_CONTAINER(close_button), close_image); 02278 if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SHOW_CLOSE_BUTTON, NULL)) 02279 gtk_widget_show (close_button); 02280 else 02281 gtk_widget_hide (close_button); 02282 02283 g_signal_connect_swapped (G_OBJECT (close_button), "clicked", 02284 G_CALLBACK(gnc_main_window_close_page), page); 02285 02286 gtk_box_pack_start (GTK_BOX (tab_hbox), close_button, FALSE, FALSE, 0); 02287 02288 g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_CLOSE_BUTTON, close_button); 02289 } 02290 02291 /* 02292 * The popup menu 02293 */ 02294 label = gtk_label_new (gnc_plugin_page_get_page_name(page)); 02295 02296 /* 02297 * Now install it all in the window. 02298 */ 02299 gnc_main_window_connect(window, page, tab_hbox, label); 02300 02301 LEAVE(""); 02302 }
| void gnc_main_window_restore_all_windows | ( | const GKeyFile * | keyfile | ) |
Restore the persistent state of all windows.
| keyfile | The GKeyFile containing persistent window state. |
Definition at line 739 of file gnc-main-window.c.
00740 { 00741 gint i, window_count; 00742 GError *error = NULL; 00743 GncMainWindowSaveData data; 00744 GncMainWindow *window; 00745 00746 /* We use the same struct for reading and for writing, so we cast 00747 away the const. */ 00748 data.key_file = (GKeyFile *) keyfile; 00749 window_count = g_key_file_get_integer(data.key_file, STATE_FILE_TOP, 00750 WINDOW_COUNT, &error); 00751 if (error) { 00752 g_warning("error reading group %s key %s: %s", 00753 STATE_FILE_TOP, WINDOW_COUNT, error->message); 00754 g_error_free(error); 00755 LEAVE("can't read count"); 00756 return; 00757 } 00758 00759 /* Restore all state information on the open windows. Window 00760 numbers in state file are 1-based. GList indices are 0-based. */ 00761 gnc_set_busy_cursor (NULL, TRUE); 00762 for (i = 0; i < window_count; i++) { 00763 data.window_num = i; 00764 window = g_list_nth_data(active_windows, i); 00765 gnc_main_window_restore_window(window, &data); 00766 } 00767 gnc_unset_busy_cursor (NULL); 00768 }
| void gnc_main_window_restore_default_state | ( | void | ) |
Restore the persistent state of one window to a sane default.
Definition at line 771 of file gnc-main-window.c.
00772 { 00773 GtkAction *action; 00774 GncMainWindow *window; 00775 00776 /* The default state should be to have an Account Tree page open 00777 * in the window. */ 00778 DEBUG("no saved state file"); 00779 window = g_list_nth_data(active_windows, 0); 00780 action = gnc_main_window_find_action(window, "FileNewAccountTreeAction"); 00781 gtk_action_activate(action); 00782 }
| void gnc_main_window_save_all_windows | ( | GKeyFile * | keyfile | ) |
Save the persistent state of all windows.
| keyfile | The GKeyFile to contain persistent window state. |
Definition at line 902 of file gnc-main-window.c.
00903 { 00904 GncMainWindowSaveData data; 00905 00906 /* Set up the iterator data structures */ 00907 data.key_file = keyfile; 00908 data.window_num = 1; 00909 data.page_num = 1; 00910 00911 g_key_file_set_integer(data.key_file, 00912 STATE_FILE_TOP, WINDOW_COUNT, 00913 g_list_length(active_windows)); 00914 /* Dump all state information on the open windows */ 00915 g_list_foreach(active_windows, (GFunc)gnc_main_window_save_window, &data); 00916 }
| void gnc_main_window_set_progressbar_window | ( | GncMainWindow * | window | ) |
Set the window where all progressbar updates should occur. This is a wrapper around the gnc_window_set_progressbar_window() function.
| window | The window to use for all progressbar updates. |
Definition at line 3629 of file gnc-main-window.c.
03630 { 03631 GncWindow *gncwin; 03632 gncwin = GNC_WINDOW(window); 03633 gnc_window_set_progressbar_window(gncwin); 03634 }
| void gnc_main_window_show_all_windows | ( | void | ) |
Shows all main windows.
Definition at line 3506 of file gnc-main-window.c.
03507 { 03508 GList *window_iter; 03509 for (window_iter = active_windows; window_iter != NULL; window_iter = window_iter->next) 03510 { 03511 gtk_widget_show(GTK_WIDGET(window_iter->data)); 03512 } 03513 }
| void gnc_main_window_unmerge_actions | ( | GncMainWindow * | window, | |
| const gchar * | group_name | |||
| ) |
Remove a set of actions from the specified window. This function should not need to be called directly by plugin implementors. It will automatically be called when a plugin is removed from a window.
| window | A pointer to the window whose user interface should be updated. | |
| group_name | The name for this set of actions. This must be the same name provided when the actions were installed. |
Definition at line 2451 of file gnc-main-window.c.
02453 { 02454 GncMainWindowPrivate *priv; 02455 MergedActionEntry *entry; 02456 02457 g_return_if_fail (GNC_IS_MAIN_WINDOW (window)); 02458 g_return_if_fail (group_name != NULL); 02459 02460 priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); 02461 if (priv->merged_actions_table == NULL) 02462 return; 02463 entry = g_hash_table_lookup (priv->merged_actions_table, group_name); 02464 02465 if (entry == NULL) 02466 return; 02467 02468 gtk_ui_manager_remove_action_group (window->ui_merge, entry->action_group); 02469 gtk_ui_manager_remove_ui (window->ui_merge, entry->merge_id); 02470 gtk_ui_manager_ensure_update (window->ui_merge); 02471 02472 g_hash_table_remove (priv->merged_actions_table, group_name); 02473 }
| gncUIWidget gnc_ui_get_toplevel | ( | void | ) |
Get a pointer to the first active top level window or NULL if there is none.
Definition at line 3520 of file gnc-main-window.c.
03521 { 03522 GList *window; 03523 03524 for (window=active_windows; window; window=window->next) 03525 if (gtk_window_is_active (GTK_WINDOW (window->data))) 03526 return window->data; 03527 03528 return NULL; 03529 }
1.5.2