[Gnucash-changes] r13609 - gnucash/trunk - Finish removing the
redundant list of valid strings maintained by the
David Hampton
hampton at cvs.gnucash.org
Sat Mar 11 22:52:46 EST 2006
Author: hampton
Date: 2006-03-11 22:52:45 -0500 (Sat, 11 Mar 2006)
New Revision: 13609
Trac: http://svn.gnucash.org/trac/changeset/13609
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/register/register-gnome/combocell-gnome.c
gnucash/trunk/src/register/register-gnome/gnucash-item-list.c
gnucash/trunk/src/register/register-gnome/gnucash-item-list.h
Log:
Finish removing the redundant list of valid strings maintained by the
combocell and use the list in the item_edit widget. Fixes the problem
where account cell contents disappear when focusing in/out of an
account cell.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-03-12 03:42:04 UTC (rev 13608)
+++ gnucash/trunk/ChangeLog 2006-03-12 03:52:45 UTC (rev 13609)
@@ -1,3 +1,16 @@
+2006-03-11 David Hampton <hampton at employees.org>
+
+ * src/register/register-gnome/combocell-gnome.c:
+ * src/register/register-gnome/gnucash-item-list.[ch]: Finish
+ removing the redundant list of valid strings maintained by the
+ combocell and use the list in the item_edit widget. Fixes the
+ problem where account cell contents disappear when focusing in/out
+ of an account cell.
+
+ * src/gnome-utils/account-quickfill.c: Update the quickfill to
+ watch for accounts being added/removed from the account
+ tree. Fixes 152101 and 302682.
+
2006-03-11 Derek Atkins <derek at ihtfp.com>
* src/gnome-search/dialog-search.c:
Modified: gnucash/trunk/src/register/register-gnome/combocell-gnome.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/combocell-gnome.c 2006-03-12 03:42:04 UTC (rev 13608)
+++ gnucash/trunk/src/register/register-gnome/combocell-gnome.c 2006-03-12 03:52:45 UTC (rev 13609)
@@ -50,15 +50,12 @@
typedef struct _PopBox
{
- GList *menustrings;
-
GnucashSheet *sheet;
GncItemEdit *item_edit;
GncItemList *item_list;
gboolean signals_connected; /* list signals connected? */
- gboolean list_in_sync; /* list in sync with menustrings? */
gboolean list_popped; /* list is popped up? */
gboolean autosize;
@@ -145,9 +142,7 @@
box->sheet = NULL;
box->item_edit = NULL;
box->item_list = NULL;
- box->menustrings = NULL;
box->signals_connected = FALSE;
- box->list_in_sync = TRUE;
box->list_popped = FALSE;
box->autosize = FALSE;
@@ -306,12 +301,6 @@
}
static void
-menustring_free (gpointer string, gpointer user_data)
-{
- g_free (string);
-}
-
-static void
gnc_combo_cell_destroy (BasicCell *bcell)
{
ComboCell *cell = (ComboCell *) bcell;
@@ -323,10 +312,6 @@
{
GList *node;
- g_list_foreach (box->menustrings, menustring_free, NULL);
- g_list_free (box->menustrings);
- box->menustrings = NULL;
-
/* Don't destroy the qf if its not ours to destroy */
if (FALSE == box->use_quickfill_cache)
{
@@ -379,13 +364,7 @@
box = cell->cell.gui_private;
if (box == NULL)
return;
- if (box->menustrings == NULL)
- return;
- g_list_foreach (box->menustrings, menustring_free, NULL);
- g_list_free (box->menustrings);
- box->menustrings = NULL;
-
/* Don't destroy the qf if its not ours to destroy */
if (FALSE == box->use_quickfill_cache)
{
@@ -401,8 +380,6 @@
unblock_list_signals (cell);
}
-
- box->list_in_sync = TRUE;
}
void
@@ -431,26 +408,6 @@
cell->shared_store = data;
}
-static void
-gnc_append_string_to_list (gpointer _string, gpointer _item_list)
-{
- char *string = _string;
- GncItemList *item_list = GNC_ITEM_LIST (_item_list);
-
- gnc_item_list_append (item_list, string);
-}
-
-static void
-gnc_combo_sync_edit_list(PopBox *box)
-{
- if (box->list_in_sync || box->item_list == NULL)
- return;
-
- gnc_item_list_clear (box->item_list);
- g_list_foreach (box->menustrings, gnc_append_string_to_list,
- box->item_list);
-}
-
void
gnc_combo_cell_add_menu_item (ComboCell *cell, char * menustr)
{
@@ -462,11 +419,7 @@
return;
box = cell->cell.gui_private;
- box->menustrings = g_list_append (box->menustrings,
- g_strdup (menustr));
- gnc_combo_sync_edit_list(box);
-
if (box->item_list != NULL)
{
block_list_signals (cell);
@@ -478,8 +431,6 @@
unblock_list_signals (cell);
}
- else
- box->list_in_sync = FALSE;
/* If we're going to be using a pre-fab quickfill,
* then don't fill it in here */
@@ -501,11 +452,7 @@
return;
box = cell->cell.gui_private;
- box->menustrings = g_list_append (box->menustrings,
- g_strdup (menustr));
- gnc_combo_sync_edit_list(box);
-
if (box->item_list != NULL)
{
block_list_signals (cell);
@@ -524,8 +471,6 @@
}
unblock_list_signals (cell);
}
- else
- box->list_in_sync = FALSE;
/* If we're going to be using a pre-fab quickfill,
* then don't fill it in here */
@@ -892,8 +837,6 @@
if (find)
return FALSE;
- gnc_combo_sync_edit_list (box);
-
gnc_item_edit_set_popup (box->item_edit,
GNOME_CANVAS_ITEM (box->item_list),
get_popup_height, popup_autosize,
@@ -927,22 +870,15 @@
if (box->strict)
{
- GList *find = NULL;
+ if (bcell->value) {
+ if (gnc_item_in_list (box->item_list, bcell->value))
+ return;
- if (bcell->value)
- find = g_list_find_custom (box->menustrings,
- bcell->value,
- (GCompareFunc) strcmp);
- if (find)
- return;
-
- if (bcell->value)
- find = g_list_find_custom (box->ignore_strings,
- bcell->value,
- (GCompareFunc) strcmp);
- if (find)
- return;
-
+ if (g_list_find_custom (box->ignore_strings,
+ bcell->value,
+ (GCompareFunc) strcmp))
+ return;
+ }
gnc_basic_cell_set_value_internal (bcell, "");
}
}
Modified: gnucash/trunk/src/register/register-gnome/gnucash-item-list.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-item-list.c 2006-03-12 03:42:04 UTC (rev 13608)
+++ gnucash/trunk/src/register/register-gnome/gnucash-item-list.c 2006-03-12 03:52:45 UTC (rev 13609)
@@ -123,6 +123,29 @@
return FALSE;
}
+gboolean
+gnc_item_in_list (GncItemList *item_list, const char *string)
+{
+ FindSelectionData *to_find_data;
+ gboolean result;
+
+ g_return_val_if_fail(item_list != NULL, FALSE);
+ g_return_val_if_fail(IS_GNC_ITEM_LIST(item_list), FALSE);
+
+ to_find_data = (FindSelectionData*)g_new0(FindSelectionData, 1);
+ to_find_data->item_list = item_list;
+ to_find_data->string_to_find = string;
+
+ gtk_tree_model_foreach(GTK_TREE_MODEL(item_list->list_store),
+ _gnc_item_find_selection,
+ to_find_data);
+
+ result = (to_find_data->found_path != NULL);
+ g_free(to_find_data);
+ return result;
+}
+
+
void
gnc_item_list_select (GncItemList *item_list, const char *string)
{
@@ -432,6 +455,8 @@
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
GTK_SELECTION_BROWSE);
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_store),
+ 0, GTK_SORT_ASCENDING);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("List"),
Modified: gnucash/trunk/src/register/register-gnome/gnucash-item-list.h
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-item-list.h 2006-03-12 03:42:04 UTC (rev 13608)
+++ gnucash/trunk/src/register/register-gnome/gnucash-item-list.h 2006-03-12 03:52:45 UTC (rev 13609)
@@ -67,6 +67,8 @@
void gnc_item_list_set_sort_enabled(GncItemList *item_list, gboolean enabled);
+gboolean gnc_item_in_list (GncItemList *item_list, const char *string);
+
void gnc_item_list_select (GncItemList *item_list, const char *string);
void gnc_item_list_show_selected (GncItemList *item_list);
More information about the gnucash-changes
mailing list