Merge Bob Fewell's 'fixes8' into maint.

This commit is contained in:
John Ralls
2018-07-23 14:51:01 -07:00
12 changed files with 398 additions and 308 deletions

View File

@@ -67,9 +67,11 @@
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
#define DIALOG_OPTIONS_CM_CLASS "dialog-options"
#define DIALOG_OPTIONS_CM_CLASS "dialog-options"
#define DIALOG_BOOK_OPTIONS_CM_CLASS "dialog-book-options"
#define GNC_PREFS_GROUP "dialogs.options"
/*
* Point where preferences switch control method from a set of
* notebook tabs to a list.
@@ -86,7 +88,7 @@ static int gain_loss_accounts_in_filter = 0;
struct gnc_option_win
{
GtkWidget * dialog;
GtkWidget * window;
GtkWidget * notebook;
GtkWidget * page_list_view;
GtkWidget * page_list;
@@ -103,10 +105,13 @@ struct gnc_option_win
gpointer close_cb_data;
/* Hold onto this for a complete reset */
GNCOptionDB * option_db;
GNCOptionDB *option_db;
/* Hold on to this to unregister the right class */
const char *component_class;
/* widget being destroyed */
gboolean destroyed;
};
typedef enum
@@ -150,8 +155,6 @@ static currency_accounting_data *book_currency_data = NULL;
static GNCOptionWinCallback global_help_cb = NULL;
gpointer global_help_cb_data = NULL;
void gnc_options_dialog_response_cb(GtkDialog *dialog, gint response,
GNCOptionWin *window);
static void gnc_options_dialog_reset_cb(GtkWidget * w, gpointer data);
void gnc_options_dialog_list_select_cb (GtkTreeSelection *selection,
gpointer data);
@@ -172,16 +175,42 @@ gnc_option_get_gtk_widget (GNCOption *option)
static void
gnc_options_dialog_changed_internal (GtkWidget *widget, gboolean sensitive)
{
GtkDialog *dialog;
while (widget && !GTK_IS_DIALOG(widget))
while (widget && !GTK_IS_WINDOW(widget))
widget = gtk_widget_get_parent(widget);
if (widget == NULL)
return;
dialog = GTK_DIALOG(widget);
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, sensitive);
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY, sensitive);
/* find the ok and cancel buttons, we know where they will be so do it
this way as opposed to using gtk_container_foreach, much less iteration */
if (GTK_IS_CONTAINER(widget))
{
GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
for (GList *it = children; it; it = it->next)
{
if (GTK_IS_BOX (GTK_WIDGET(it->data)))
{
GList *children = gtk_container_get_children(GTK_CONTAINER(it->data));
for (GList *it = children; it; it = it->next)
{
if (GTK_IS_BUTTON_BOX (GTK_WIDGET(it->data)))
{
GList *children = gtk_container_get_children(GTK_CONTAINER(it->data));
for (GList *it = children; it; it = it->next)
{
if (g_strcmp0 (gtk_widget_get_name(GTK_WIDGET(it->data)), "ok_button") == 0)
gtk_widget_set_sensitive (GTK_WIDGET(it->data), sensitive);
if (g_strcmp0 (gtk_widget_get_name(GTK_WIDGET(it->data)), "apply_button") == 0)
gtk_widget_set_sensitive (GTK_WIDGET(it->data), sensitive);
}
g_list_free (children);
}
}
g_list_free (children);
}
}
g_list_free (children);
}
}
void
@@ -189,7 +218,7 @@ gnc_options_dialog_changed (GNCOptionWin *win)
{
if (!win) return;
gnc_options_dialog_changed_internal (win->dialog, TRUE);
gnc_options_dialog_changed_internal (win->window, TRUE);
}
void
@@ -667,8 +696,7 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity)
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(
book_currency_data->default_gain_loss_account_widget),
TRUE);
col =
gnc_tree_view_add_text_column(GNC_TREE_VIEW(
col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(
book_currency_data->default_gain_loss_account_widget),
_("Currency"), /* title */
"commodity", /* pref name */
@@ -684,8 +712,7 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity)
gnc_tree_view_account_column_add_color (GNC_TREE_VIEW_ACCOUNT(
book_currency_data->default_gain_loss_account_widget), col);
col =
gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(
col = gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(
book_currency_data->default_gain_loss_account_widget),
_("Placeholder"),
/* Translators: This string has a context prefix; the
@@ -1889,7 +1916,7 @@ gnc_options_dialog_build_contents (GNCOptionWin *propertybox,
}
/********************************************************************\
* gnc_options_dialog_build_contents_full *
* gnc_options_dialog_build_contents_full *
* builds an options dialog given a property box and an options *
* database and make the dialog visible depending on the *
* show_dialog flag *
@@ -1968,15 +1995,15 @@ gnc_options_dialog_build_contents_full (GNCOptionWin *propertybox,
gtk_tree_selection_select_iter (selection, &iter);
gtk_notebook_set_current_page(GTK_NOTEBOOK(propertybox->notebook), default_page);
}
gnc_options_dialog_changed_internal(propertybox->dialog, FALSE);
gnc_options_dialog_changed_internal(propertybox->window, FALSE);
if (show_dialog)
gtk_widget_show(propertybox->dialog);
gtk_widget_show(propertybox->window);
}
GtkWidget *
gnc_options_dialog_widget(GNCOptionWin * win)
{
return win->dialog;
return win->window;
}
GtkWidget *
@@ -1991,42 +2018,62 @@ gnc_options_dialog_notebook(GNCOptionWin * win)
return win->notebook;
}
void
gnc_options_dialog_response_cb(GtkDialog *dialog, gint response, GNCOptionWin *window)
static void
gnc_options_dialog_help_button_cb(GtkWidget * widget, GNCOptionWin *win)
{
GNCOptionWinCallback close_cb;
if (win->help_cb)
(win->help_cb)(win, win->help_cb_data);
}
switch (response)
static void
gnc_options_dialog_cancel_button_cb(GtkWidget * widget, GNCOptionWin *win)
{
if (win->close_cb)
(win->close_cb)(win, win->close_cb_data);
else
gtk_widget_hide(win->window);
}
static void
gnc_options_dialog_apply_button_cb(GtkWidget * widget, GNCOptionWin *win)
{
GNCOptionWinCallback close_cb = win->close_cb;
win->close_cb = NULL;
if (win->apply_cb)
win->apply_cb (win, win->apply_cb_data);
win->close_cb = close_cb;
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->window));
gnc_options_dialog_changed_internal (win->window, FALSE);
}
static void
gnc_options_dialog_ok_button_cb(GtkWidget * widget, GNCOptionWin *win)
{
GNCOptionWinCallback close_cb = win->close_cb;
win->close_cb = NULL;
if (win->apply_cb)
win->apply_cb (win, win->apply_cb_data);
win->close_cb = close_cb;
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->window));
if (win->close_cb)
(win->close_cb)(win, win->close_cb_data);
else
gtk_widget_hide(win->window);
}
static void
gnc_options_dialog_destroy_cb (GtkWidget *object, GNCOptionWin *win)
{
if (!win) return;
if (win->destroyed == FALSE)
{
case GTK_RESPONSE_HELP:
if (window->help_cb)
(window->help_cb)(window, window->help_cb_data);
break;
case GTK_RESPONSE_OK:
case GTK_RESPONSE_APPLY:
close_cb = window->close_cb;
window->close_cb = NULL;
if (window->apply_cb)
window->apply_cb (window, window->apply_cb_data);
window->close_cb = close_cb;
if (response == GTK_RESPONSE_APPLY)
{
gnc_options_dialog_changed_internal (window->dialog, FALSE);
break;
}
/* fall through */
default:
if (window->close_cb)
{
(window->close_cb)(window, window->close_cb_data);
}
else
{
gtk_widget_hide(window->dialog);
}
break;
if (win->close_cb)
(win->close_cb)(win, win->close_cb_data);
}
}
@@ -2043,7 +2090,7 @@ gnc_options_dialog_reset_cb(GtkWidget * w, gpointer data)
section = (GNCOptionSection*)val;
gnc_option_db_section_reset_widgets (section);
gnc_options_dialog_changed_internal (win->dialog, TRUE);
gnc_options_dialog_changed_internal (win->window, TRUE);
}
void
@@ -2072,10 +2119,10 @@ gnc_options_register_stocks (void)
GtkStockItem items[] =
{
{ GTK_STOCK_APPLY , "gnc_option_apply_button", 0, 0, NULL },
{ GTK_STOCK_HELP , "gnc_options_dialog_help", 0, 0, NULL },
{ GTK_STOCK_OK , "gnc_options_dialog_ok", 0, 0, NULL },
{ GTK_STOCK_CANCEL , "gnc_options_dialog_cancel", 0, 0, NULL },
{ GTK_STOCK_APPLY , "gnc_option_apply_button", 0, 0, NULL },
{ GTK_STOCK_HELP , "gnc_options_dialog_help", 0, 0, NULL },
{ GTK_STOCK_OK , "gnc_options_dialog_ok", 0, 0, NULL },
{ GTK_STOCK_CANCEL , "gnc_options_dialog_cancel", 0, 0, NULL },
};
if (done)
@@ -2091,8 +2138,8 @@ gnc_options_register_stocks (void)
static void
component_close_handler (gpointer data)
{
GNCOptionWin *window = data;
gtk_dialog_response(GTK_DIALOG(window->dialog), GTK_RESPONSE_CANCEL);
GNCOptionWin *win = data;
gnc_options_dialog_cancel_button_cb (NULL, win);
}
static void
@@ -2152,16 +2199,17 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
GtkBuilder *builder;
GtkWidget *hbox;
gint component_id;
GtkWidget *button;
retval = g_new0(GNCOptionWin, 1);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-options.glade", "gnucash_options_dialog");
retval->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "gnucash_options_dialog"));
gnc_builder_add_from_file (builder, "dialog-options.glade", "gnucash_options_window");
retval->window = GTK_WIDGET(gtk_builder_get_object (builder, "gnucash_options_window"));
retval->page_list = GTK_WIDGET(gtk_builder_get_object (builder, "page_list_scroll"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(retval->dialog), "GncOptionsDialog");
gtk_window_set_transient_for (GTK_WINDOW (retval->dialog), parent);
gnc_widget_set_style_context (GTK_WIDGET(retval->window), "GncOptionsDialog");
/* Page List */
{
GtkTreeView *view;
@@ -2189,13 +2237,23 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
g_signal_connect (selection, "changed",
G_CALLBACK (gnc_options_dialog_list_select_cb), retval);
}
button = GTK_WIDGET(gtk_builder_get_object (builder, "helpbutton"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_options_dialog_help_button_cb), retval);
button = GTK_WIDGET(gtk_builder_get_object (builder, "cancelbutton"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_options_dialog_cancel_button_cb), retval);
button = GTK_WIDGET(gtk_builder_get_object (builder, "applybutton"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_options_dialog_apply_button_cb), retval);
button = GTK_WIDGET(gtk_builder_get_object (builder, "okbutton"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_options_dialog_ok_button_cb), retval);
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, retval);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(retval->window));
if (title)
gtk_window_set_title(GTK_WINDOW(retval->dialog), title);
gtk_window_set_title(GTK_WINDOW(retval->window), title);
/* modal */
if (modal == TRUE)
@@ -2229,20 +2287,25 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
GNC_ID_ACCOUNT,
QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
}
g_signal_connect (retval->window, "destroy",
G_CALLBACK(gnc_options_dialog_destroy_cb), retval);
g_object_unref(G_OBJECT(builder));
retval->destroyed = FALSE;
return retval;
}
/* Creates a new GNCOptionWin structure, but assumes you have your own
dialog widget you want to plugin */
GNCOptionWin *
gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog)
gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *window)
{
GNCOptionWin * retval;
retval = g_new0(GNCOptionWin, 1);
retval->dialog = dialog;
retval->window = window;
return retval;
}
@@ -2286,9 +2349,10 @@ gnc_options_dialog_destroy(GNCOptionWin * win)
gnc_unregister_gui_component_by_data(win->component_class, win);
gtk_widget_destroy(win->dialog);
win->destroyed = TRUE;
gtk_widget_destroy(win->window);
win->dialog = NULL;
win->window = NULL;
win->notebook = NULL;
win->apply_cb = NULL;
win->help_cb = NULL;
@@ -3519,7 +3583,7 @@ gnc_option_set_ui_value_radiobutton (GNCOption *option, gboolean use_default,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
// g_object_set_data(G_OBJECT(widget), "gnc_radiobutton_index",
// GINT_TO_POINTER(index));
// GINT_TO_POINTER(index));
return FALSE;
}
}
@@ -4256,8 +4320,8 @@ void gnc_options_ui_initialize (void)
struct scm_cb
{
SCM apply_cb;
SCM close_cb;
SCM apply_cb;
SCM close_cb;
};
static void

View File

@@ -40,11 +40,11 @@
#define GNC_PREFS_GROUP "dialogs.find-account"
/** Enumeration for the tree-store */
enum GncFindAccountColumn {ACC_FULL_NAME, ACCOUNT, PLACE_HOLDER, HIDDEN, NOT_USED, BAL_ZERO};
enum GncFindAccountColumn {ACC_FULL_NAME, ACCOUNT, PLACE_HOLDER, HIDDEN, NOT_USED, BAL_ZERO, TAX};
typedef struct
{
GtkWidget *dialog;
GtkWidget *window;
GtkWidget *parent;
QofSession *session;
Account *account;
@@ -65,11 +65,7 @@ typedef struct
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
void gnc_find_account_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data);
void gnc_find_account_dialog_close_cb (GtkDialog *dialog, gpointer user_data);
void gnc_find_account_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data);
void
static void
gnc_find_account_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
@@ -77,25 +73,15 @@ gnc_find_account_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data
ENTER(" ");
gnc_unregister_gui_component_by_data (DIALOG_FIND_ACCOUNT_CM_CLASS, facc_dialog);
if (facc_dialog->dialog)
if (facc_dialog->window)
{
gtk_widget_destroy (facc_dialog->dialog);
facc_dialog->dialog = NULL;
gtk_widget_destroy (facc_dialog->window);
facc_dialog->window = NULL;
}
g_free (facc_dialog);
LEAVE(" ");
}
void
gnc_find_account_dialog_close_cb (GtkDialog *dialog, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
ENTER(" ");
gnc_close_gui_component_by_data (DIALOG_FIND_ACCOUNT_CM_CLASS, facc_dialog);
LEAVE(" ");
}
static void
jump_to_account (FindAccountDialog *facc_dialog, Account *jump_account)
{
@@ -103,7 +89,7 @@ jump_to_account (FindAccountDialog *facc_dialog, Account *jump_account)
gnc_plugin_page_account_tree_open (jump_account, GTK_WINDOW(facc_dialog->parent));
if (facc_dialog->jump_close == TRUE)
gnc_find_account_dialog_close_cb (GTK_DIALOG(facc_dialog->dialog), facc_dialog);
gnc_close_gui_component_by_data (DIALOG_FIND_ACCOUNT_CM_CLASS, facc_dialog);
}
static void
@@ -148,32 +134,30 @@ row_double_clicked (GtkTreeView *treeview, GtkTreePath *path,
jump_to_account (facc_dialog, jump_account);
}
void
gnc_find_account_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
static void
gnc_find_account_dialog_jump_button_cb (GtkWidget * widget, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
switch (response_id)
{
case GTK_RESPONSE_APPLY:
gnc_find_account_dialog_jump_to (facc_dialog);
return;
case GTK_RESPONSE_YES:
gnc_find_account_dialog_jump_set (facc_dialog);
return;
case GTK_RESPONSE_CLOSE:
default:
gnc_close_gui_component_by_data (DIALOG_FIND_ACCOUNT_CM_CLASS, facc_dialog);
return;
}
gnc_find_account_dialog_jump_to (facc_dialog);
}
static void
fill_model (FindAccountDialog *facc_dialog, Account *account)
gnc_find_account_dialog_check_button_cb (GtkWidget * widget, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
gnc_find_account_dialog_jump_set (facc_dialog);
}
static void
gnc_find_account_dialog_close_button_cb (GtkWidget * widget, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
gnc_close_gui_component_by_data (DIALOG_FIND_ACCOUNT_CM_CLASS, facc_dialog);
}
static void
fill_model (GtkTreeModel *model, Account *account)
{
GtkTreeModel *model;
GtkTreeIter iter;
gchar *fullname = gnc_account_get_full_name (account);
gint splits = xaccAccountCountSplits (account, TRUE);
@@ -181,8 +165,6 @@ fill_model (FindAccountDialog *facc_dialog, Account *account)
PINFO("Add to Store: Account '%s'", fullname);
model = gtk_tree_view_get_model (GTK_TREE_VIEW(facc_dialog->view));
gtk_list_store_append (GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
@@ -190,7 +172,8 @@ fill_model (FindAccountDialog *facc_dialog, Account *account)
PLACE_HOLDER, (xaccAccountGetPlaceholder (account) == TRUE ? "emblem-default" : NULL),
HIDDEN, (xaccAccountGetHidden (account) == TRUE ? "emblem-default" : NULL),
NOT_USED, (splits == 0 ? "emblem-default" : NULL),
BAL_ZERO, (gnc_numeric_zero_p (total) == TRUE ? "emblem-default" : NULL), -1);
BAL_ZERO, (gnc_numeric_zero_p (total) == TRUE ? "emblem-default" : NULL),
TAX, (xaccAccountGetTaxRelated (account) == TRUE ? "emblem-default" : NULL), -1);
g_free (fullname);
}
@@ -202,6 +185,7 @@ get_account_info (FindAccountDialog *facc_dialog)
GList *ptr;
gchar *filter_text;
gboolean radio_root;
GtkTreeModel *model;
/* Get the state of the root radio button */
radio_root = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(facc_dialog->radio_root));
@@ -216,6 +200,14 @@ get_account_info (FindAccountDialog *facc_dialog)
filter_text = g_ascii_strdown (gtk_entry_get_text (GTK_ENTRY(facc_dialog->filter_text_entry)), -1);
/* disconnect the model from the treeview */
model = gtk_tree_view_get_model (GTK_TREE_VIEW(facc_dialog->view));
g_object_ref (G_OBJECT(model));
gtk_tree_view_set_model (GTK_TREE_VIEW(facc_dialog->view), NULL);
// Clear the list store
gtk_list_store_clear (GTK_LIST_STORE(model));
/* Go through list of accounts */
for (ptr = accts; ptr; ptr = g_list_next (ptr))
{
@@ -224,7 +216,7 @@ get_account_info (FindAccountDialog *facc_dialog)
gchar *match_string = g_ascii_strdown (full_name, -1);
if ((g_strcmp0 (filter_text, "") == 0) || (g_strrstr (match_string, filter_text) != NULL))
fill_model (facc_dialog, acc);
fill_model (model, acc);
g_free (match_string);
g_free (full_name);
@@ -232,17 +224,16 @@ get_account_info (FindAccountDialog *facc_dialog)
g_free (filter_text);
g_list_free (accts);
/* reconnect the model to the treeview */
gtk_tree_view_set_model (GTK_TREE_VIEW(facc_dialog->view), model);
g_object_unref(G_OBJECT(model));
gtk_tree_view_columns_autosize (GTK_TREE_VIEW(facc_dialog->view));
}
static void
filter_button_cb (GtkButton *button, FindAccountDialog *facc_dialog)
{
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(facc_dialog->view));
// Clear the list store
gtk_list_store_clear (GTK_LIST_STORE(model));
get_account_info (facc_dialog);
// Clear the filter
@@ -252,34 +243,29 @@ filter_button_cb (GtkButton *button, FindAccountDialog *facc_dialog)
static void
gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialog)
{
GtkWidget *dialog;
GtkWidget *window;
GtkBuilder *builder;
GtkTreeSelection *selection;
GtkTreeViewColumn *tree_column;
GtkCellRenderer *cr;
GtkWidget *button;
ENTER(" ");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-find-account.glade", "list-store");
gnc_builder_add_from_file (builder, "dialog-find-account.glade", "find_account_dialog");
gnc_builder_add_from_file (builder, "dialog-find-account.glade", "find_account_window");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "find_account_dialog"));
facc_dialog->dialog = dialog;
window = GTK_WIDGET(gtk_builder_get_object (builder, "find_account_window"));
facc_dialog->window = window;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncFindAccountDialog");
gnc_widget_set_style_context (GTK_WIDGET(window), "GncFindAccountDialog");
facc_dialog->session = gnc_get_current_session();
facc_dialog->parent = parent;
/* parent */
if (parent != NULL)
{
facc_dialog->parent = parent;
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
}
else
facc_dialog->parent = NULL;
gtk_window_set_title (GTK_WINDOW(facc_dialog->window), _("Find Account"));
/* Connect the radio buttons...*/
facc_dialog->radio_root = GTK_WIDGET(gtk_builder_get_object (builder, "radio-root"));
@@ -292,6 +278,13 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
g_signal_connect (facc_dialog->filter_button, "clicked",
G_CALLBACK(filter_button_cb), (gpointer)facc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "jumpto_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_find_account_dialog_jump_button_cb), facc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "check_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_find_account_dialog_check_button_cb), facc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_find_account_dialog_close_button_cb), facc_dialog);
facc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
g_signal_connect (facc_dialog->view, "row-activated",
G_CALLBACK(row_double_clicked), (gpointer)facc_dialog);
@@ -299,9 +292,6 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
// Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(facc_dialog->view), gnc_tree_view_get_grid_lines_pref ());
/* default to 'close' button */
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(facc_dialog->view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
@@ -350,11 +340,27 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
gtk_tree_view_column_set_attributes (tree_column, cr, "icon-name", BAL_ZERO, NULL);
gtk_cell_renderer_set_alignment (cr, 0.5, 0.5);
tree_column = gtk_tree_view_column_new();
gtk_tree_view_column_set_title (tree_column, _("Tax related"));
gtk_tree_view_append_column (GTK_TREE_VIEW(facc_dialog->view), tree_column);
gtk_tree_view_column_set_alignment (tree_column, 0.5);
gtk_tree_view_column_set_expand (tree_column, TRUE);
cr = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start (tree_column, cr, TRUE);
// connect 'active' and set 'xalign' property of the cell renderer
gtk_tree_view_column_set_attributes (tree_column, cr, "icon-name", TAX, NULL);
gtk_cell_renderer_set_alignment (cr, 0.5, 0.5);
g_signal_connect (facc_dialog->window, "destroy",
G_CALLBACK(gnc_find_account_dialog_window_destroy_cb), facc_dialog);
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, facc_dialog);
g_object_unref (G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->window));
gtk_widget_show_all (GTK_WIDGET(facc_dialog->window));
if (facc_dialog->account != NULL)
{
@@ -368,7 +374,6 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
g_free (sub_label);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(facc_dialog->radio_subroot), TRUE);
gtk_widget_show_all (facc_dialog->radio_hbox);
}
else
gtk_widget_hide (facc_dialog->radio_hbox);
@@ -377,7 +382,6 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
gtk_entry_set_text (GTK_ENTRY(facc_dialog->filter_text_entry), "");
get_account_info (facc_dialog);
LEAVE(" ");
}
@@ -387,8 +391,8 @@ close_handler (gpointer user_data)
FindAccountDialog *facc_dialog = user_data;
ENTER(" ");
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->dialog));
gtk_widget_destroy (GTK_WIDGET(facc_dialog->dialog));
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->window));
gtk_widget_destroy (GTK_WIDGET(facc_dialog->window));
LEAVE(" ");
}
@@ -411,7 +415,7 @@ show_handler (const char *klass, gint component_id,
LEAVE("No data strucure");
return(FALSE);
}
gtk_window_present (GTK_WINDOW(facc_dialog->dialog));
gtk_window_present (GTK_WINDOW(facc_dialog->window));
LEAVE(" ");
return(TRUE);
}
@@ -447,7 +451,5 @@ gnc_find_account_dialog (GtkWidget *parent, Account *account)
facc_dialog);
gnc_gui_component_set_session (component_id, facc_dialog->session);
gtk_widget_show (facc_dialog->dialog);
LEAVE(" ");
}

View File

@@ -48,7 +48,7 @@ enum GncAssocColumn {DATE_TRANS, DESC_TRANS, URI_U, AVAILABLE, URI_SPLIT, URI, U
typedef struct
{
GtkWidget *dialog;
GtkWidget *window;
GtkWidget *view;
const gchar *path_head;
gboolean valid_path_head;
@@ -57,38 +57,22 @@ typedef struct
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
void gnc_assoc_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data);
void gnc_assoc_dialog_close_cb (GtkDialog *dialog, gpointer user_data);
void gnc_assoc_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data);
void
static void
gnc_assoc_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
ENTER(" ");
gnc_unregister_gui_component_by_data (DIALOG_ASSOC_CM_CLASS, assoc_dialog);
if (assoc_dialog->dialog)
if (assoc_dialog->window)
{
gtk_widget_destroy (assoc_dialog->dialog);
assoc_dialog->dialog = NULL;
gtk_widget_destroy (assoc_dialog->window);
assoc_dialog->window = NULL;
}
g_free (assoc_dialog);
LEAVE(" ");
}
void
gnc_assoc_dialog_close_cb (GtkDialog *dialog, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
ENTER(" ");
gnc_close_gui_component_by_data (DIALOG_ASSOC_CM_CLASS, assoc_dialog);
LEAVE(" ");
}
static gint
sort_iter_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
@@ -181,8 +165,11 @@ assoc_dialog_update (AssocDialog *assoc_dialog)
GtkTreeIter iter;
gboolean valid;
/* disconnect the model from the treeview */
model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view));
g_object_ref (G_OBJECT(model));
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL);
/* Get first row in list store */
valid = gtk_tree_model_get_iter_first (model, &iter);
@@ -221,28 +208,30 @@ assoc_dialog_update (AssocDialog *assoc_dialog)
g_free (filename);
valid = gtk_tree_model_iter_next (model, &iter);
}
/* reconnect the model to the treeview */
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), model);
g_object_unref(G_OBJECT(model));
}
void
gnc_assoc_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
static void
gnc_assoc_dialog_sort_button_cb (GtkWidget * widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
AssocDialog *assoc_dialog = user_data;
assoc_dialog_sort (assoc_dialog);
}
switch (response_id)
{
case GTK_RESPONSE_APPLY:
assoc_dialog_update (assoc_dialog);
return;
static void
gnc_assoc_dialog_check_button_cb (GtkWidget * widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
assoc_dialog_update (assoc_dialog);
}
case -8:
assoc_dialog_sort (assoc_dialog);
return;
case GTK_RESPONSE_CLOSE:
default:
gnc_close_gui_component_by_data (DIALOG_ASSOC_CM_CLASS, assoc_dialog);
return;
}
static void
gnc_assoc_dialog_close_button_cb (GtkWidget * widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
gnc_close_gui_component_by_data (DIALOG_ASSOC_CM_CLASS, assoc_dialog);
}
static void
@@ -316,7 +305,10 @@ get_trans_info (AssocDialog *assoc_dialog)
/* Get list of Accounts */
accts = gnc_account_get_descendants_sorted (root);
/* disconnect the model from the treeview */
model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view));
g_object_ref (G_OBJECT(model));
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL);
/* Go through list of accounts */
for (ptr = accts; ptr; ptr = g_list_next (ptr))
@@ -369,35 +361,45 @@ get_trans_info (AssocDialog *assoc_dialog)
qof_query_destroy (query);
g_list_free (splits);
}
/* reconnect the model to the treeview */
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), model);
g_object_unref(G_OBJECT(model));
g_list_free (accts);
g_list_free (trans_list);
}
static void
gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gnc_assoc_dialog_create (AssocDialog *assoc_dialog)
{
GtkWidget *dialog;
GtkWidget *window;
GtkBuilder *builder;
GtkTreeSelection *selection;
GtkWidget *path_head;
GtkTreeViewColumn *tree_column;
GtkCellRenderer *cr;
GtkWidget *button;
ENTER(" ");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-trans-assoc.glade", "list-store");
gnc_builder_add_from_file (builder, "dialog-trans-assoc.glade", "transaction_association_window");
gnc_builder_add_from_file (builder, "dialog-trans-assoc.glade", "transaction_association_dialog");
window = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_association_window"));
assoc_dialog->window = window;
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_association_dialog"));
assoc_dialog->dialog = dialog;
button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_sort_button_cb), assoc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "check_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_check_button_cb), assoc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_close_button_cb), assoc_dialog);
gtk_window_set_title (GTK_WINDOW(assoc_dialog->window), _("Transaction Associations"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncTransAssocDialog");
/* parent */
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
gnc_widget_set_style_context (GTK_WIDGET(window), "GncTransAssocDialog");
assoc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
path_head = GTK_WIDGET(gtk_builder_get_object (builder, "path-head"));
@@ -444,18 +446,19 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
// Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(assoc_dialog->view), gnc_tree_view_get_grid_lines_pref ());
/* default to 'close' button */
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(assoc_dialog->view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (assoc_dialog->window, "destroy",
G_CALLBACK(gnc_assoc_dialog_window_destroy_cb), assoc_dialog);
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, assoc_dialog);
g_object_unref (G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->window));
get_trans_info (assoc_dialog);
gtk_widget_show_all (GTK_WIDGET(window));
LEAVE(" ");
}
@@ -466,8 +469,8 @@ close_handler (gpointer user_data)
AssocDialog *assoc_dialog = user_data;
ENTER(" ");
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->dialog));
gtk_widget_destroy (GTK_WIDGET(assoc_dialog->dialog));
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->window));
gtk_widget_destroy (GTK_WIDGET(assoc_dialog->window));
LEAVE(" ");
}
@@ -490,7 +493,7 @@ show_handler (const char *klass, gint component_id,
LEAVE("No data strucure");
return(FALSE);
}
gtk_window_present (GTK_WINDOW(assoc_dialog->dialog));
gtk_window_present (GTK_WINDOW(assoc_dialog->window));
LEAVE(" ");
return(TRUE);
}
@@ -503,7 +506,7 @@ show_handler (const char *klass, gint component_id,
* Return: nothing *
\********************************************************************/
void
gnc_trans_assoc_dialog (GtkWindow *parent)
gnc_trans_assoc_dialog (void)
{
AssocDialog *assoc_dialog;
@@ -515,12 +518,12 @@ gnc_trans_assoc_dialog (GtkWindow *parent)
}
assoc_dialog = g_new0 (AssocDialog, 1);
gnc_assoc_dialog_create (parent, assoc_dialog);
gnc_assoc_dialog_create (assoc_dialog);
gnc_register_gui_component (DIALOG_ASSOC_CM_CLASS,
refresh_handler, close_handler,
assoc_dialog);
gtk_widget_show (assoc_dialog->dialog);
// gtk_widget_show (assoc_dialog->window);
LEAVE(" ");
}

View File

@@ -23,6 +23,6 @@
#ifndef DIALOG_TRANS_ASSOC_H
#define DIALOG_TRANS_ASSOC_H
void gnc_trans_assoc_dialog (GtkWindow *parent);
void gnc_trans_assoc_dialog (void);
#endif

View File

@@ -624,7 +624,7 @@ static void
gnc_main_window_cmd_tools_trans_assoc (GtkAction *action, GncMainWindowActionData *data)
{
gnc_set_busy_cursor (NULL, TRUE);
gnc_trans_assoc_dialog (GTK_WINDOW (data->window));
gnc_trans_assoc_dialog ();
gnc_unset_busy_cursor (NULL);
}

View File

@@ -21,6 +21,7 @@
<child name="search" schema="org.gnucash.dialogs.search"/>
<child name="transfer" schema="org.gnucash.dialogs.transfer"/>
<child name="trans-assoc" schema="org.gnucash.dialogs.trans-assoc"/>
<child name="options" schema="org.gnucash.dialogs.options"/>
</schema>
<schema id="org.gnucash.dialogs.account" path="/org/gnucash/dialogs/account/">
@@ -245,4 +246,14 @@
followed by the width and height of the window.</description>
</key>
</schema>
<schema id="org.gnucash.dialogs.options" path="/org/gnucash/dialogs/options/">
<key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default>
<summary>Last window position and size</summary>
<description>This setting describes the size and position of the window when it was last closed.
The numbers are the X and Y coordinates of the top left corner of the window
followed by the width and height of the window.</description>
</key>
</schema>
</schemalist>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="custom_report_dialog">
@@ -66,7 +66,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<object class="GtkScrolledWindow" id="custom_report_sw">
<property name="width_request">300</property>
<property name="height_request">150</property>
<property name="visible">True</property>
@@ -124,5 +124,8 @@ the Reports menu or tool bar.</property>
<action-widgets>
<action-widget response="0">close_report_button</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="list-store">
@@ -16,23 +16,34 @@
<column type="gchararray"/>
<!-- column-name bal_zero -->
<column type="gchararray"/>
<!-- column-name tax -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="find_account_dialog">
<object class="GtkWindow" id="find_account_window">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Find Account Dialog</property>
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="gnc_find_account_dialog_window_destroy_cb" swapped="no"/>
<signal name="response" handler="gnc_find_account_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox2">
<child>
<object class="GtkBox" id="dialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="label" translatable="yes">&lt;b&gt;Search the Account List&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
@@ -89,20 +100,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="label" translatable="yes">&lt;b&gt;Search the Account List&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox-radio">
<property name="visible">True</property>
@@ -130,7 +127,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio-root</property>
</object>
@@ -148,7 +144,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<object class="GtkScrolledWindow" id="scrollwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -156,15 +152,16 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">list-store</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="account_full_name">
<property name="resizable">True</property>
<property name="title" translatable="yes">Account Full Name</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<object class="GtkCellRendererText" id="cellrenderertext"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
@@ -194,11 +191,11 @@
</packing>
</child>
<child>
<object class="GtkBox" id="hbox2">
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label3">
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -237,7 +234,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -255,7 +252,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Select a row and then press 'jump to' to jump to account in the Account Tree,
@@ -273,10 +270,8 @@ if account should not be shown, this will be temporarily overridden.</property>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-8">check_button</action-widget>
<action-widget response="-10">jumpto_button</action-widget>
<action-widget response="-6">close_button</action-widget>
</action-widgets>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@@ -1,27 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="gnucash_options_dialog">
<object class="GtkWindow" id="gnucash_options_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">GnuCash Options</property>
<property name="default_width">640</property>
<property name="default_height">480</property>
<property name="type_hint">dialog</property>
<signal name="response" handler="gnc_options_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<child>
<object class="GtkBox" id="dialog-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<child>
<object class="GtkButtonBox" id="buttonbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="helpbutton1">
<object class="GtkButton" id="helpbutton">
<property name="label" translatable="yes">_Help</property>
<property name="name">help_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -32,11 +30,13 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancelbutton1">
<object class="GtkButton" id="cancelbutton">
<property name="label" translatable="yes">_Cancel</property>
<property name="name">cancel_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -53,6 +53,7 @@
<child>
<object class="GtkButton" id="applybutton">
<property name="label" translatable="yes">_Apply</property>
<property name="name">apply_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -67,8 +68,9 @@
</packing>
</child>
<child>
<object class="GtkButton" id="okbutton1">
<object class="GtkButton" id="okbutton">
<property name="label" translatable="yes">_OK</property>
<property name="name">ok_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -91,7 +93,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="hbox1">
<object class="GtkBox" id="hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -105,7 +107,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
</child>
@@ -139,11 +141,8 @@
</child>
</object>
</child>
<action-widgets>
<action-widget response="-11">helpbutton1</action-widget>
<action-widget response="-6">cancelbutton1</action-widget>
<action-widget response="-10">applybutton</action-widget>
<action-widget response="-5">okbutton1</action-widget>
</action-widgets>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="list-store">
@@ -20,28 +20,31 @@
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="transaction_association_dialog">
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Transaction Association Dialog</property>
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
<signal name="destroy" handler="gnc_assoc_dialog_window_destroy_cb" swapped="no"/>
<signal name="response" handler="gnc_assoc_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox2">
<object class="GtkWindow" id="transaction_association_window">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="dialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">All Transaction Associations</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="sort">
<object class="GtkButton" id="sort_button">
<property name="label" translatable="yes">_Sort Association</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -55,7 +58,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="Check">
<object class="GtkButton" id="check_button">
<property name="label" translatable="yes">_Locate Association</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -92,19 +95,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">All Transaction Associations</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="path-head">
<property name="visible">True</property>
@@ -118,7 +108,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -126,8 +116,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">list-store</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="trans-date">
@@ -193,7 +184,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes"> To jump to the Transaction, double click on the entry in the
@@ -208,10 +199,8 @@ Description column or Association column to open the Association</property>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-8">sort</action-widget>
<action-widget response="-10">Check</action-widget>
<action-widget response="-6">close_button</action-widget>
</action-widgets>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@@ -73,6 +73,7 @@ typedef struct _CustomReportDialog
GtkTreeViewColumn *runcol;
GtkTreeViewColumn *editcol;
GtkTreeViewColumn *delcol;
GtkTreeViewColumn *dummycol;
/* data */
SCM reportlist;
@@ -195,6 +196,7 @@ set_reports_view_and_model(CustomReportDialog *crd)
{
GtkCellRenderer *renderer;
GtkTreeModel *model;
gint number_of_columns;
crd->namerenderer = gtk_cell_renderer_text_new();
g_signal_connect (G_OBJECT (crd->namerenderer), "edited",
@@ -227,6 +229,14 @@ set_reports_view_and_model(CustomReportDialog *crd)
NULL);
crd->delcol = gtk_tree_view_get_column (GTK_TREE_VIEW (crd->reportview), VIEW_COL_DELETE);
// this is a dummy column which will be set the same width of the vertical scrollbar
renderer = gtk_cell_renderer_text_new();
number_of_columns = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (crd->reportview), -1,
"", renderer,
NULL);
crd->dummycol = gtk_tree_view_get_column (GTK_TREE_VIEW (crd->reportview), number_of_columns -1);
model = create_and_fill_report_list(crd);
gtk_tree_view_set_model (GTK_TREE_VIEW (crd->reportview), model);
@@ -495,6 +505,9 @@ gnc_ui_custom_report_internal(GncMainWindow * window)
GtkTreeIter iter;
GtkTreeModel *model;
GtkWidget *no_report_notification;
GtkWidget *scroll_window;
GtkWidget *vscroll;
GtkRequisition nat_sb;
crd = g_new0(CustomReportDialog, 1);
@@ -503,10 +516,18 @@ gnc_ui_custom_report_internal(GncMainWindow * window)
crd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "custom_report_dialog"));
crd->reportview = GTK_WIDGET(gtk_builder_get_object (builder, "custom_report_list_view"));
scroll_window = GTK_WIDGET(gtk_builder_get_object (builder, "custom_report_sw"));
no_report_notification = GTK_WIDGET(gtk_builder_get_object (builder, "label2"));
set_reports_view_and_model(crd);
crd->window = window;
// get the vertical scroll bar width
vscroll = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (scroll_window));
gtk_widget_get_preferred_size (vscroll, NULL, &nat_sb);
// set the width of the dummy column to that of the scrollbar
gtk_tree_view_column_set_fixed_width (crd->dummycol, nat_sb.width);
gtk_window_set_transient_for (GTK_WINDOW (crd->dialog), GTK_WINDOW(window));
// Set the style context for this dialog so it can be easily manipulated with css

View File

@@ -827,6 +827,9 @@ gnc_close_gui_component_by_session (gpointer session)
list = find_components_by_session (session);
// reverse the list so class like dialog-options close before window-report
list = g_list_reverse (list);
for (node = list; node; node = node->next)
{
ComponentInfo *ci = node->data;