[Gnucash-changes] r13382 - gnucash/trunk - Let the account matcher accept a parent widget to avoid windows that

Christian Stimming cstim at cvs.gnucash.org
Fri Feb 24 17:22:46 EST 2006


Author: cstim
Date: 2006-02-24 17:22:44 -0500 (Fri, 24 Feb 2006)
New Revision: 13382
Trac: http://svn.gnucash.org/trac/changeset/13382

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
   gnucash/trunk/src/import-export/import-account-matcher.c
   gnucash/trunk/src/import-export/import-account-matcher.h
   gnucash/trunk/src/import-export/import-main-matcher.c
   gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c
   gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
Log:
Let the account matcher accept a parent widget to avoid windows that
are lost behind other windows. Adapt importer modules accordingly.




Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/ChangeLog	2006-02-24 22:22:44 UTC (rev 13382)
@@ -1,5 +1,9 @@
 2006-02-24  Christian Stimming  <stimming at tuhh.de>
 
+	* src/import-export/import-account-matcher.h: Let the account
+	matcher accept a parent widget to avoid windows that are lost
+	behind other windows. Adapt importer modules accordingly.
+
 	* src/import-export/import-account-matcher.c: Don't allow
 	placeholder be selected for importing transactions. Fixes
 	bug#327891.

Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2006-02-24 22:22:44 UTC (rev 13382)
@@ -399,7 +399,8 @@
 	 GNC_COMMODITY_NS_ISO, AB_Account_GetCurrency (hbci_acc));
     }
 
-    gnc_acc = gnc_import_select_account(NULL, TRUE, longname, currency, BANK,
+    gnc_acc = gnc_import_select_account(info->window,
+					NULL, TRUE, longname, currency, BANK,
 					old_value, NULL);
     g_free(longname);
 

Modified: gnucash/trunk/src/import-export/import-account-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-account-matcher.c	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/import-account-matcher.c	2006-02-24 22:22:44 UTC (rev 13382)
@@ -121,7 +121,8 @@
     }
 }
 
-Account * gnc_import_select_account(const gchar * account_online_id_value,
+Account * gnc_import_select_account(gncUIWidget parent,
+				    const gchar * account_online_id_value,
 				    gboolean auto_create,
 				    const gchar * account_human_description,
 				    gnc_commodity * new_account_default_commodity,
@@ -168,6 +169,9 @@
 	}
       
       picker->dialog     = glade_xml_get_widget (xml, "Generic Import Account Picker");
+      if (parent)
+	gtk_window_set_transient_for (GTK_WINDOW (picker->dialog), 
+				      GTK_WINDOW (parent));
       picker->account_tree_sw   = glade_xml_get_widget (xml, "account_tree_sw");
       online_id_label = glade_xml_get_widget (xml, "online_id_label");
       button = glade_xml_get_widget (xml, "newbutton");
@@ -205,9 +209,11 @@
 
 	  /* See if the selected account is a placeholder. */
 	  if (xaccAccountGetPlaceholder (retval)) {
-	    gnc_error_dialog (/* FIXME: add parent*/ NULL,
-			      _("The account %s does not allow transactions."),
-			      xaccAccountGetName (retval));
+	    gnc_error_dialog
+	      (picker->dialog,
+	       _("The account %s is a placeholder account and does not allow "
+		 "transactions. Please choose a different account."),
+	       xaccAccountGetName (retval));
 	    response = GNC_RESPONSE_NEW;
 	    break;
 	  }

Modified: gnucash/trunk/src/import-export/import-account-matcher.h
===================================================================
--- gnucash/trunk/src/import-export/import-account-matcher.h	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/import-account-matcher.h	2006-02-24 22:22:44 UTC (rev 13382)
@@ -26,6 +26,7 @@
 #define ACCOUNT_MATCHER_H
  
 #include "Account.h"
+#include "gnc-ui-common.h"
 
 /**  Must be called with a string containing a unique identifier for the
   account.  If an account with a matching online_id kvp_frame is
@@ -36,6 +37,8 @@
   again).  If the user refuses to select or create an account, NULL is
   returned.
 
+  @param parent The parent widget. Can be NULL.
+
     @param account_online_id_value The string containing your unique
     account_id coming from some string of your module.  This is the
     normal mode of operation. Can be NULL.
@@ -86,7 +89,8 @@
   @return A pointer to the found or created Account, or NULL if no
   account was found or created.
 */
-Account * gnc_import_select_account(const gchar * account_online_id_value,
+Account * gnc_import_select_account(gncUIWidget parent,
+				    const gchar * account_online_id_value,
 				    gboolean auto_create,
 				    const gchar * account_human_description,
 				    gnc_commodity * new_account_default_commodity,

Modified: gnucash/trunk/src/import-export/import-main-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-main-matcher.c	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/import-main-matcher.c	2006-02-24 22:22:44 UTC (rev 13382)
@@ -298,7 +298,8 @@
   gboolean ok_pressed;
   g_assert (trans_info);
   old_acc = gnc_import_TransInfo_get_destacc (trans_info);
-  new_acc = gnc_import_select_account(NULL,
+  new_acc = gnc_import_select_account(info->dialog,
+				      NULL,
 				      TRUE,
 				      _("Destination account for the auto-balance split."),
 				      xaccTransGetCurrency(gnc_import_TransInfo_get_trans(trans_info)),

Modified: gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c
===================================================================
--- gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c	2006-02-24 22:22:44 UTC (rev 13382)
@@ -211,7 +211,8 @@
     AB_ImExporterAccountInfo_GetAccountName(accinfo);
   gchar *online_id = g_strconcat (bank_code, account_number, NULL);
   
-  gnc_acc = gnc_import_select_account(online_id, 1, account_name, NULL, 
+  gnc_acc = gnc_import_select_account(NULL, 
+				      online_id, 1, account_name, NULL, 
 				      NO_TYPE, NULL, NULL);
   g_free(online_id);
   if (gnc_acc) {

Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-02-24 22:09:47 UTC (rev 13381)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-02-24 22:22:44 UTC (rev 13382)
@@ -122,7 +122,8 @@
   g_assert(gnc_ofx_importer_gui);
 
   if(data.account_id_valid==true){
-    account = gnc_import_select_account(data.account_id, 0, NULL, NULL, NO_TYPE, NULL, NULL);
+    account = gnc_import_select_account(NULL,
+					data.account_id, 0, NULL, NULL, NO_TYPE, NULL, NULL);
     if(account!=NULL)
       {
 	/********** Create the transaction and setup transaction data ************/
@@ -347,7 +348,8 @@
 								  in any translations.  */
 							      _("Stock account for security \"%s\""),
 							      data.security_data_ptr->secname);
-		    investment_account = gnc_import_select_account(data.unique_id,
+		    investment_account = gnc_import_select_account(NULL,
+								   data.unique_id,
 								   1,
 								   investment_account_text, 
 								   investment_commodity,
@@ -413,6 +415,7 @@
 								      _("Income account for security \"%s\""),
 								      data.security_data_ptr->secname);
 			    income_account=gnc_import_select_account(NULL,
+								     NULL,
 								     1,
 								     investment_account_text, 
 								     currency,
@@ -582,7 +585,10 @@
 					  "%s \"%s\"",
 					  account_type_name,
 					  data.account_name);
-    selected_account = gnc_import_select_account(data.account_id, 1, account_description, default_commodity, default_type, NULL, NULL);
+    selected_account = gnc_import_select_account(NULL,
+						 data.account_id, 1,
+						 account_description, default_commodity,
+						 default_type, NULL, NULL);
     g_free(account_description);
     g_free(account_type_name);
   }



More information about the gnucash-changes mailing list