From 0ecc6caa636a8b46f3bbfb435a4be4bb1ddb22c4 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 15 Dec 2013 17:14:47 +0000 Subject: [PATCH] BUG 336843 (Attach images/files/urls to transactions): - Added conditional to grey-out/disable 'Open File/Link' when association is unset - Converted 'Open Location' dialog to gtk_dialog_new_with_buttons - fixed invalid options from last submitted patch - made dialog modal git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23563 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome/gnc-plugin-page-register.c | 9 +++++++++ src/gnome/gnc-split-reg.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c index e804ed646a..bdbc4da9cc 100644 --- a/src/gnome/gnc-plugin-page-register.c +++ b/src/gnome/gnc-plugin-page-register.c @@ -906,6 +906,7 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag GtkAction *action; gboolean expanded, voided; Transaction *trans; + const char *uri; /* Set 'Split Transaction' */ priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); @@ -931,6 +932,12 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag "UnvoidTransactionAction"); gtk_action_set_sensitive (GTK_ACTION(action), voided); + /* Set 'ExecAssociated' */ + uri = xaccTransGetAssociation(trans); + action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), + "ExecAssociatedTransactionAction"); + gtk_action_set_sensitive (GTK_ACTION(action), uri ? TRUE:FALSE); + /* If we are in a readonly book, make any modifying action inactive */ if (qof_book_is_readonly(gnc_get_current_book())) { @@ -3456,6 +3463,7 @@ gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action, priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page); gsr_default_associate_handler_file(priv->gsr, NULL); + gnc_plugin_page_register_ui_update (NULL, plugin_page); LEAVE(" "); } @@ -3472,6 +3480,7 @@ gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action, priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page); gsr_default_associate_handler_location(priv->gsr, NULL); + gnc_plugin_page_register_ui_update (NULL, plugin_page); LEAVE(" "); } diff --git a/src/gnome/gnc-split-reg.c b/src/gnome/gnc-split-reg.c index 9e18a4d5cf..b9d198a1e2 100644 --- a/src/gnome/gnc-split-reg.c +++ b/src/gnome/gnc-split-reg.c @@ -1096,9 +1096,9 @@ gsr_default_associate_handler_location( GNCSplitReg *gsr, gpointer data ) if (is_trans_readonly_and_warn(trans)) return; - dialog = gtk_file_chooser_dialog_new ("Associate Location with Transaction", + dialog = gtk_dialog_new_with_buttons ("Associate Location with Transaction", GTK_WINDOW(gsr->window), - GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);