[Gnucash-changes] r14325 - gnucash/branches/deprecated-cleanup - Set up the list store completion data structures in common code.

David Hampton hampton at cvs.gnucash.org
Sun Jun 4 20:39:27 EDT 2006


Author: hampton
Date: 2006-06-04 20:39:26 -0400 (Sun, 04 Jun 2006)
New Revision: 14325
Trac: http://svn.gnucash.org/trac/changeset/14325

Modified:
   gnucash/branches/deprecated-cleanup/ChangeLog
   gnucash/branches/deprecated-cleanup/src/core-utils/gnc-gtk-utils.c
   gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-account-sel.c
   gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-currency-edit.c
Log:
Set up the list store completion data structures in common code.


Modified: gnucash/branches/deprecated-cleanup/ChangeLog
===================================================================
--- gnucash/branches/deprecated-cleanup/ChangeLog	2006-06-04 23:34:19 UTC (rev 14324)
+++ gnucash/branches/deprecated-cleanup/ChangeLog	2006-06-05 00:39:26 UTC (rev 14325)
@@ -1,3 +1,10 @@
+2006-06-04  David Hampton  <hampton at employees.org>
+
+	* src/core-utils/gnc-gtk-utils.c:
+	* src/gnome-utils/gnc-currency-edit.c:
+	* src/gnome-utils/gnc-account-sel.c: Set up the list store
+	completion data structures in common code.
+
 2006-05-20  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/dialog-options.c:

Modified: gnucash/branches/deprecated-cleanup/src/core-utils/gnc-gtk-utils.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/core-utils/gnc-gtk-utils.c	2006-06-04 23:34:19 UTC (rev 14324)
+++ gnucash/branches/deprecated-cleanup/src/core-utils/gnc-gtk-utils.c	2006-06-05 00:39:26 UTC (rev 14325)
@@ -165,6 +165,15 @@
   entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbe)));
   completion = gtk_entry_get_completion(entry);
 
+  /* No completion yet? Set one up. */
+  if (!completion) {
+    completion = gtk_entry_completion_new();
+    model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbe));
+    gtk_entry_completion_set_model(completion, model);
+    gtk_entry_completion_set_text_column(completion, 0);
+    gtk_entry_set_completion(entry, completion);
+  }
+
   /* If an item in the combo box isn't already selected, then force
    * select the first item. Take care, the combo box may not have been
    * filled yet.  */

Modified: gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-account-sel.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-account-sel.c	2006-06-04 23:34:19 UTC (rev 14324)
+++ gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-account-sel.c	2006-06-05 00:39:26 UTC (rev 14325)
@@ -132,8 +132,6 @@
 gnc_account_sel_init (GNCAccountSel *gas)
 {
 	GtkWidget *widget;
-	GtkEntry *entry;
-	GtkEntryCompletion *completion;
 
         gas->initDone = FALSE;
         gas->acctTypeFilters = FALSE;
@@ -148,12 +146,6 @@
         gtk_container_add( GTK_CONTAINER(gas), widget );
 
         /* Add completion. */
-	entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget)));
-	completion = gtk_entry_completion_new();
-        gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(gas->store));
-	gtk_entry_completion_set_text_column(completion, COLUMN_ACCT_NAME);
-	//	gtk_entry_completion_set_inline_completion(completion, TRUE);
-	gtk_entry_set_completion(entry, completion);
 	gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(widget));
 
         /* Get the accounts, place into combo list */

Modified: gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-currency-edit.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-currency-edit.c	2006-06-04 23:34:19 UTC (rev 14324)
+++ gnucash/branches/deprecated-cleanup/src/gnome-utils/gnc-currency-edit.c	2006-06-05 00:39:26 UTC (rev 14325)
@@ -192,8 +192,6 @@
 {
 	GNCCurrencyEdit *gce;
 	GtkListStore *store;
-	GtkEntry *entry;
-	GtkEntryCompletion* completion;
 
 	store = gtk_list_store_new (1, G_TYPE_STRING);
 	gce = g_object_new (GNC_TYPE_CURRENCY_EDIT,
@@ -202,14 +200,6 @@
 			    NULL);
 	g_object_unref (store);
 
-	/* Set up completion on the entry */
-	entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(gce)));
-	completion = gtk_entry_completion_new();
-	gtk_entry_completion_set_model(completion,
-				       GTK_TREE_MODEL(store));
-	gtk_entry_completion_set_text_column(completion, 0);
-	gtk_entry_set_completion(entry, completion);
-
 	/* Now the signals to make sure the user can't leave the
 	   widget without a valid currency. */
 	gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(gce));



More information about the gnucash-changes mailing list