Update a report's tab name in the main window when the name in the

report options is changed. Fixes #334199.  Also update a register's
tab name if the account name is changed.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13832 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton committed 2006-04-22 20:14:41 +00:00
1 parent 913f040e62
commit 8600495bb8
5 files changed
+37 -33

No files matched your search

+9
View File
@@ -1,3 +1,12 @@
2006-04-22 David Hampton <hampton@employees.org>
* src/report/report-gnome/gnc-plugin-page-report.c:
* src/gnome-utils/gnc-main-window.[ch]:
* src/gnome/gnc-plugin-page-register.c: Update a report's tab name
in the main window when the name in the report options is
changed. Fixes #334199. Also update a register's tab name if the
account name is changed.
2006-04-22 Christian Stimming <stimming@tuhh.de>
* src/gnome/gnc-split-reg.c: Mark string for translation as
+6 -8
View File
@@ -108,8 +108,6 @@ static void gnc_main_window_destroy (GtkObject *object);
static void gnc_main_window_setup_window (GncMainWindow *window);
static void gnc_window_main_window_init (GncWindowIface *iface);
static void main_window_update_page_name (GncMainWindow *window, GncPluginPage *page, const gchar *name_in);
/* Callbacks */
static void gnc_main_window_add_widget (GtkUIManager *merge, GtkWidget *widget, GncMainWindow *window);
static void gnc_main_window_switch_page (GtkNotebook *notebook, GtkNotebookPage *notebook_page, gint pos, GncMainWindow *window);
@@ -484,7 +482,7 @@ gnc_main_window_restore_page (GncMainWindow *window, GncMainWindowSaveData *data
/* Fall through and still show the page. */
} else {
DEBUG("updating page name for %p to %s.", page, name);
main_window_update_page_name(window, page, name);
main_window_update_page_name(page, name);
g_free(name);
}
}
@@ -1505,11 +1503,11 @@ main_window_find_tab_items (GncMainWindow *window,
return (*label_p && *entry_p);
}
static void
main_window_update_page_name (GncMainWindow *window,
GncPluginPage *page,
void
main_window_update_page_name (GncPluginPage *page,
const gchar *name_in)
{
GncMainWindow *window;
GncMainWindowPrivate *priv;
GtkWidget *label, *entry;
gchar *name;
@@ -1528,6 +1526,7 @@ main_window_update_page_name (GncMainWindow *window,
}
/* Update the plugin */
window = GNC_MAIN_WINDOW(page->window);
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
gnc_plugin_page_set_page_name(page, name);
@@ -1562,8 +1561,7 @@ gnc_main_window_tab_entry_activate (GtkWidget *entry,
return;
}
main_window_update_page_name(GNC_MAIN_WINDOW(page->window), page,
gtk_entry_get_text(GTK_ENTRY(entry)));
main_window_update_page_name(page, gtk_entry_get_text(GTK_ENTRY(entry)));
gtk_widget_hide(entry);
gtk_widget_show(label);
+4
View File
@@ -146,6 +146,10 @@ void gnc_main_window_close_page (GncPluginPage *page);
GncPluginPage *gnc_main_window_get_current_page (GncMainWindow *window);
void
main_window_update_page_name (GncPluginPage *page,
const gchar *name_in);
/** 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 *
+17 -23
View File
@@ -2796,8 +2796,6 @@ gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data)
return;
}
if (ei->event_mask & QOF_EVENT_MODIFY) {
/* CAS: We need to also handle account renames, but at
least we don't crash for those. */
}
}
}
@@ -2855,32 +2853,18 @@ gppr_account_destroy_cb (Account *account)
}
/** This function is the handler for all event messages from the
* engine. Its purpose is to update the account tree model any time
* an account is added to the engine or deleted from the engine.
* This change to the model is then propagated to any/all overlying
* filters and views. This function listens to the ADD, REMOVE, and
* DESTROY events.
* engine. Its purpose is to update the register page any time
* an account or transaction is changed.
*
* @internal
*
* @warning There is a "Catch 22" situation here.
* gtk_tree_model_row_deleted() can't be called until after the item
* has been deleted from the real model (which is the engine's
* account tree for us), but once the account has been deleted from
* the engine we have no way to determine the path to pass to
* row_deleted(). This is a PITA, but the only other choice is to
* have this model mirror the engine's accounts instead of
* referencing them directly.
* @param entity A pointer to the affected item.
*
* @param entity The guid of the affected item.
* @param event_type The type of the affected item.
*
* @param type The type of the affected item. This function only
* cares about items of type "account".
* @param page A pointer to the register page.
*
* @param event type The type of the event. This function only cares
* about items of type ADD, REMOVE, MODIFY, and DESTROY.
*
* @param user_data A pointer to the account tree model.
* @param ed
*/
static void
gnc_plugin_page_register_event_handler (QofEntity *entity,
@@ -2894,12 +2878,22 @@ gnc_plugin_page_register_event_handler (QofEntity *entity,
GtkWidget *window;
g_return_if_fail(page); /* Required */
if (!GNC_IS_TRANS(entity))
if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
return;
ENTER("entity %p of type %d, page %p, event data %p",
entity, event_type, page, ed);
if (GNC_IS_ACCOUNT(entity)) {
gchar *label;
label = gnc_plugin_page_register_get_tab_name(GNC_PLUGIN_PAGE(page));
main_window_update_page_name(GNC_PLUGIN_PAGE(page), label);
g_free(label);
LEAVE("tab name updated");
return;
}
if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY))) {
LEAVE("not a modify");
return;
@@ -546,7 +546,7 @@ gnc_plugin_page_report_option_change_cb(gpointer data)
new_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
"Report name", NULL);
if (strcmp(old_name, new_name) != 0) {
gnc_plugin_page_set_page_name(GNC_PLUGIN_PAGE(report), new_name);
main_window_update_page_name(GNC_PLUGIN_PAGE(report), new_name);
}
g_free(new_name);
@@ -845,7 +845,6 @@ gnc_plugin_page_report_finish_pending (GncPluginPage *page)
report = GNC_PLUGIN_PAGE_REPORT(page);
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
printf("%s: reloading is %d\n", __FUNCTION__, priv->reloading);
return !priv->reloading;
}