36 #include <glib/gi18n.h> 42 #include "dialog-doclink.h" 45 #include "dialog-fincalc.h" 46 #include "dialog-find-transactions.h" 47 #include "dialog-find-transactions2.h" 48 #include "dialog-imap-editor.h" 49 #include "dialog-sx-since-last-run.h" 50 #include "dialog-totd.h" 51 #include "assistant-acct-period.h" 52 #include "assistant-loan.h" 55 #include "gnc-gui-query.h" 59 #include "gnc-session.h" 60 #include "gnc-plugin-page-sx-list.h" 64 G_GNUC_UNUSED
static QofLogModule log_module = GNC_MOD_GUI;
68 static void gnc_plugin_basic_commands_finalize (GObject *
object);
70 static void gnc_plugin_basic_commands_add_to_window (
GncPlugin *plugin,
GncMainWindow *window, GQuark type);
71 static void gnc_plugin_basic_commands_main_window_page_changed(
GncMainWindow *window,
GncPluginPage *page, gpointer user_data);
82 static void gnc_main_window_cmd_actions_scheduled_transaction_editor (GtkAction *action,
GncMainWindowActionData *data);
85 #if CLOSE_BOOKS_ACTUALLY_WORKS 100 #define PLUGIN_ACTIONS_NAME "gnc-plugin-basic-commands-actions" 101 #define PLUGIN_UI_FILENAME "gnc-plugin-basic-commands-ui.xml" 105 static GtkActionEntry gnc_plugin_actions [] =
111 "FileNewAction",
"document-new", N_(
"New _File"),
"<primary>n",
112 N_(
"Create a new file"),
113 G_CALLBACK (gnc_main_window_cmd_file_new)
116 "FileOpenAction",
"document-open", N_(
"_Open..."),
"<primary>o",
117 N_(
"Open an existing GnuCash file"),
118 G_CALLBACK (gnc_main_window_cmd_file_open)
121 "FileSaveAction",
"document-save", N_(
"_Save"),
"<primary>s",
122 N_(
"Save the current file"),
123 G_CALLBACK (gnc_main_window_cmd_file_save)
126 "FileSaveAsAction",
"document-save-as", N_(
"Save _As..."),
"<shift><primary>s",
127 N_(
"Save this file with a different name"),
128 G_CALLBACK (gnc_main_window_cmd_file_save_as)
131 "FileRevertAction",
"document-revert", N_(
"Re_vert"), NULL,
132 N_(
"Reload the current database, reverting all unsaved changes"),
133 G_CALLBACK (gnc_main_window_cmd_file_revert)
136 "FileExportAccountsAction",
"go-next",
137 N_(
"Export _Accounts"), NULL,
138 N_(
"Export the account hierarchy to a new GnuCash datafile"),
139 G_CALLBACK (gnc_main_window_cmd_file_export_accounts)
145 "EditFindTransactionsAction",
"edit-find", N_(
"_Find..."),
"<primary>f",
146 N_(
"Find transactions with a search"),
147 G_CALLBACK (gnc_main_window_cmd_tools_find_transactions)
150 "EditTaxOptionsAction", NULL,
153 N_(
"Ta_x Report Options"), NULL,
158 N_(
"Setup relevant accounts for tax reports, e.g. US income tax"),
159 G_CALLBACK (gnc_main_window_cmd_edit_tax_options)
164 {
"ActionsScheduledTransactionsAction", NULL, N_(
"_Scheduled Transactions"), NULL, NULL, NULL },
166 "ActionsScheduledTransactionEditorAction", NULL, N_(
"_Scheduled Transaction Editor"), NULL,
167 N_(
"The list of Scheduled Transactions"),
168 G_CALLBACK (gnc_main_window_cmd_actions_scheduled_transaction_editor)
171 "ActionsSinceLastRunAction", NULL, N_(
"Since _Last Run..."), NULL,
172 N_(
"Create Scheduled Transactions since the last time run"),
173 G_CALLBACK (gnc_main_window_cmd_actions_since_last_run)
176 "ActionsMortgageLoanAction", NULL, N_(
"_Mortgage & Loan Repayment..."), NULL,
177 N_(
"Setup scheduled transactions for repayment of a loan"),
178 G_CALLBACK (gnc_main_window_cmd_actions_mortgage_loan)
180 {
"ActionsBudgetAction", NULL, N_(
"B_udget"), NULL, NULL, NULL },
181 #ifdef CLOSE_BOOKS_ACTUALLY_WORKS 183 "ActionsCloseBooksAction", NULL, N_(
"Close _Books"), NULL,
184 N_(
"Archive old data using accounting periods"),
185 G_CALLBACK (gnc_main_window_cmd_actions_close_books)
187 #endif // CLOSE_BOOKS_ACTUALLY_WORKS 191 "ToolsPriceEditorAction", NULL, N_(
"_Price Database"), NULL,
192 N_(
"View and edit the prices for stocks and mutual funds"),
193 G_CALLBACK (gnc_main_window_cmd_tools_price_editor)
196 "ToolsCommodityEditorAction", NULL, N_(
"_Security Editor"), NULL,
197 N_(
"View and edit the commodities for stocks and mutual funds"),
198 G_CALLBACK (gnc_main_window_cmd_tools_commodity_editor)
201 "ToolsFinancialCalculatorAction", NULL, N_(
"_Loan Repayment Calculator"), NULL,
202 N_(
"Use the loan/mortgage repayment calculator"),
203 G_CALLBACK (gnc_main_window_cmd_tools_financial_calculator)
206 "ToolsBookCloseAction", NULL, N_(
"_Close Book"), NULL,
207 N_(
"Close the Book at the end of the Period"),
208 G_CALLBACK (gnc_main_window_cmd_tools_close_book)
211 "ToolsImapEditorAction", NULL, N_(
"_Import Map Editor"), NULL,
212 N_(
"View and Delete Bayesian and non-Bayesian information"),
213 G_CALLBACK (gnc_main_window_cmd_tools_imap_editor)
216 "ToolsTransLinkedDocsAction", NULL, N_(
"_Transaction Linked Documents"), NULL,
217 N_(
"View all Transaction Linked Documents"),
218 G_CALLBACK (gnc_main_window_cmd_tools_trans_doclink)
224 "HelpTipsOfTheDayAction", NULL, N_(
"_Tips Of The Day"), NULL,
225 N_(
"View the Tips of the Day"),
226 G_CALLBACK (gnc_main_window_cmd_help_totd)
230 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
236 static const gchar *gnc_plugin_important_actions[] =
244 static const gchar *gnc_plugin_initially_insensitive_actions[] =
254 static const gchar *readwrite_only_active_actions[] =
256 "ToolsBookCloseAction",
266 static const gchar *dirty_only_active_actions[] =
280 #define GNC_PLUGIN_BASIC_COMMANDS_GET_PRIVATE(o) \ 281 ((GncPluginBasicCommandsPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_PLUGIN_BASIC_COMMANDS)) 284 static GObjectClass *parent_class = NULL;
296 plugin = g_object_new (GNC_TYPE_PLUGIN_BASIC_COMMANDS, NULL);
298 return GNC_PLUGIN (plugin);
316 gnc_plugin_basic_commands_add_to_window (
GncPlugin *plugin,
320 GtkActionGroup *action_group =
323 gnc_plugin_initially_insensitive_actions,
325 g_signal_connect(window,
"page_changed",
326 G_CALLBACK(gnc_plugin_basic_commands_main_window_page_changed),
332 static void update_inactive_actions(
GncPluginPage *plugin_page)
335 GtkActionGroup *action_group;
342 if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
345 window = GNC_MAIN_WINDOW(plugin_page->
window);
346 g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
348 g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
352 "sensitive", is_readwrite);
354 "sensitive", is_dirty);
358 gnc_plugin_basic_commands_main_window_page_changed(
GncMainWindow *window,
366 update_inactive_actions(page);
382 GObjectClass *object_class = G_OBJECT_CLASS (klass);
385 parent_class = g_type_class_peek_parent (klass);
387 object_class->finalize = gnc_plugin_basic_commands_finalize;
390 plugin_class->
plugin_name = GNC_PLUGIN_BASIC_COMMANDS_NAME;
393 plugin_class->
add_to_window = gnc_plugin_basic_commands_add_to_window;
397 plugin_class->
actions = gnc_plugin_actions;
398 plugin_class->
n_actions = gnc_plugin_n_actions;
424 gnc_plugin_basic_commands_finalize (GObject *
object)
426 g_return_if_fail (GNC_IS_PLUGIN_BASIC_COMMANDS (
object));
428 G_OBJECT_CLASS (parent_class)->finalize (
object);
441 gnc_file_new (GTK_WINDOW (data->window));
447 g_return_if_fail (data != NULL);
456 gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
457 #ifdef HAVE_DBI_DBI_H 458 gnc_ui_file_access_for_open (GTK_WINDOW (data->window));
460 gnc_file_open (GTK_WINDOW (data->window));
462 gnc_window_set_progressbar_window (NULL);
468 g_return_if_fail (data != NULL);
473 gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
474 gnc_file_save (GTK_WINDOW (data->window));
475 gnc_window_set_progressbar_window (NULL);
481 g_return_if_fail (data != NULL);
486 gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
487 #ifdef HAVE_DBI_DBI_H 488 gnc_ui_file_access_for_save_as (GTK_WINDOW (data->window));
490 gnc_file_save_as (GTK_WINDOW (data->window));
492 gnc_window_set_progressbar_window (NULL);
498 g_return_if_fail (data != NULL);
503 gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
504 gnc_file_revert(GTK_WINDOW (data->window));
505 gnc_window_set_progressbar_window (NULL);
511 g_return_if_fail (data != NULL);
513 gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
514 #ifdef HAVE_DBI_DBI_H 515 gnc_ui_file_access_for_export (GTK_WINDOW (data->window));
517 gnc_file_export (GTK_WINDOW (data->window));
519 gnc_window_set_progressbar_window (NULL);
525 g_return_if_fail (data != NULL);
527 gnc_tax_info_dialog (GTK_WIDGET (data->window), NULL);
543 GList *auto_created_txns = NULL;
544 const char *nothing_to_do_msg =
545 _(
"There are no Scheduled Transactions to be entered at this time." );
547 g_return_if_fail (data != NULL);
549 window = GTK_WINDOW (data->window);
562 gnc_ui_sx_since_last_run_dialog (window, sx_instances, auto_created_txns);
563 auto_created_txns = NULL;
569 gnc_info_dialog (window,
"%s", nothing_to_do_msg);
573 gnc_info_dialog(window, ngettext
576 (
"There are no Scheduled Transactions to be entered at this time. " 577 "(%d transaction automatically created)",
578 "There are no Scheduled Transactions to be entered at this time. " 579 "(%d transactions automatically created)",
584 g_list_free(auto_created_txns);
585 g_object_unref(G_OBJECT(sx_instances));
591 gnc_ui_sx_loan_assistant_create ();
593 #ifdef CLOSE_BOOKS_ACTUALLY_WORKS 597 gnc_acct_period_dialog();
604 gnc_set_busy_cursor(NULL, TRUE);
605 gnc_imap_dialog (GTK_WIDGET (data->window));
606 gnc_unset_busy_cursor(NULL);
612 gnc_set_busy_cursor (NULL, TRUE);
613 gnc_doclink_trans_dialog (GTK_WINDOW (data->window));
614 gnc_unset_busy_cursor (NULL);
620 gnc_set_busy_cursor(NULL, TRUE);
621 gnc_prices_dialog (GTK_WIDGET (data->window));
622 gnc_unset_busy_cursor(NULL);
628 gnc_set_busy_cursor(NULL, TRUE);
629 gnc_commodities_dialog (GTK_WIDGET (data->window));
630 gnc_unset_busy_cursor(NULL);
636 gnc_ui_fincalc_dialog_create(GTK_WINDOW (data->window));
649 #ifdef REGISTER2_ENABLED 651 gnc_ui_find_transactions_dialog_create2 (NULL);
654 gnc_ui_find_transactions_dialog_create (GTK_WINDOW(data->window), NULL);
661 g_return_if_fail (data != NULL);
663 gnc_totd_dialog(GTK_WINDOW(data->window), FALSE);
The instance data structure for an basic commands menu plugin.
guint n_actions
The number of actions in the actions array.
The instance data structure for a content plugin.
utility functions for the GnuCash UI
gint num_auto_create_no_notify_instances
The number of automatically-created instances that do no request notification.
This file contains the functions to present a GUI to select a book closing date and accounts into whi...
Functions that are supported by all types of windows.
GtkWidget * window
The window that contains the display widget for this plugin.
void gnc_sx_instance_model_summarize(GncSxInstanceModel *model, GncSxSummary *summary)
void gnc_sx_instance_model_effect_change(GncSxInstanceModel *model, gboolean auto_create_only, GList **created_transaction_guids, GList **creation_errors)
Really ("effectively") create the transactions from the SX instances in the given model...
The class data structure for a menu-only plugin.
void gnc_ui_close_book(QofBook *book, GtkWindow *parent)
Create and run the dialog to close the book.
const gchar * ui_filename
The relative name of the XML file describing the menu/toolbar action items.
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
Functions for adding content to a window.
GtkActionEntry * actions
An array of actions that should automatically be added to any GnuCash "main" content window that is o...
Functions providing the file history menu.
void gnc_account_reset_convert_bayes_to_flat(void)
Reset the flag that indicates the function imap_convert_bayes_to_flat has been run.
The class data structure for a basic commands menu plugin.
const gchar ** important_actions
A NULL terminated list of actions that should be considered important.
GncPlugin * gnc_plugin_basic_commands_new(void)
Create a new basic commands menu plugin.
gboolean qof_book_session_not_saved(const QofBook *book)
qof_book_not_saved() returns the value of the session_dirty flag, set when changes to any object in t...
All type declarations for the whole Gnucash engine.
void(* add_to_window)(GncPlugin *plugin, GncMainWindow *window, GQuark type)
A callback that will be invoked when this plugin is added to a window.
const gchar * actions_name
A name for the set of actions that will be added by this plugin.
The instance private data structure for an basic commands plugin.
GtkActionGroup * gnc_main_window_get_action_group(GncMainWindow *window, const gchar *group_name)
Retrieve a specific set of user interface actions from a window.
gboolean qof_book_is_readonly(const QofBook *book)
Return whether the book is read only.
const gchar * plugin_name
The textual name of this plugin.
The instance data structure for a menu-only plugin.
#define PLUGIN_ACTIONS_NAME
The label given to the main window for this plugin.
GncSxInstanceModel * gnc_sx_get_current_instances(void)
Shorthand for get_instances(now, FALSE);.
#define GNC_TYPE_PLUGIN_PAGE_SX_LIST
Functions providing a list of scheduled transactions as a plugin page.
GncPluginPage * gnc_plugin_page_sx_list_new(void)
This file contains the functions to present a GUI to select a file or a database connection.
The instance data structure for a main window object.
gboolean gnc_main_window_all_finish_pending(void)
Tell all pages in all windows to finish any outstanding activities.
gboolean need_dialog
If the dialog needs to be displayed.
Functions providing a basic set of menu items.
#define PLUGIN_UI_FILENAME
The name of the UI description file for this plugin.