r14588 - gnucash/trunk - Remove the majority of the remaining deprecated widgets by collapsing
David Hampton
hampton at cvs.gnucash.org
Wed Aug 2 14:13:40 EDT 2006
Author: hampton
Date: 2006-08-02 14:13:30 -0400 (Wed, 02 Aug 2006)
New Revision: 14588
Trac: http://svn.gnucash.org/trac/changeset/14588
Added:
gnucash/trunk/src/core-utils/gnc-gtk-utils.c
gnucash/trunk/src/core-utils/gnc-gtk-utils.h
gnucash/trunk/src/gnome-search/search-core-utils.c
gnucash/trunk/src/gnome-search/search-core-utils.h
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
gnucash/trunk/src/business/business-gnome/dialog-billterms.c
gnucash/trunk/src/business/business-gnome/dialog-payment.c
gnucash/trunk/src/business/business-gnome/glade/billterms.glade
gnucash/trunk/src/business/business-gnome/glade/payment.glade
gnucash/trunk/src/business/business-gnome/search-owner.c
gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade
gnucash/trunk/src/core-utils/Makefile.am
gnucash/trunk/src/gnome-search/Makefile.am
gnucash/trunk/src/gnome-search/dialog-search.c
gnucash/trunk/src/gnome-search/search-account.c
gnucash/trunk/src/gnome-search/search-boolean.c
gnucash/trunk/src/gnome-search/search-date.c
gnucash/trunk/src/gnome-search/search-double.c
gnucash/trunk/src/gnome-search/search-int64.c
gnucash/trunk/src/gnome-search/search-numeric.c
gnucash/trunk/src/gnome-search/search-reconciled.c
gnucash/trunk/src/gnome-search/search-string.c
gnucash/trunk/src/gnome-utils/dialog-account.c
gnucash/trunk/src/gnome-utils/dialog-commodity.c
gnucash/trunk/src/gnome-utils/dialog-commodity.h
gnucash/trunk/src/gnome-utils/dialog-options.c
gnucash/trunk/src/gnome-utils/dialog-utils.h
gnucash/trunk/src/gnome-utils/glade/commodity.glade
gnucash/trunk/src/gnome-utils/glade/druid-provider-multifile.glade
gnucash/trunk/src/gnome-utils/gnc-account-sel.c
gnucash/trunk/src/gnome-utils/gnc-account-sel.h
gnucash/trunk/src/gnome-utils/gnc-currency-edit.c
gnucash/trunk/src/gnome-utils/gnc-date-delta.c
gnucash/trunk/src/gnome-utils/gnc-date-delta.h
gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.c
gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.h
gnucash/trunk/src/gnome-utils/gnc-frequency.c
gnucash/trunk/src/gnome-utils/gnc-frequency.h
gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm
gnucash/trunk/src/gnome/dialog-fincalc.c
gnucash/trunk/src/gnome/dialog-scheduledxaction.h
gnucash/trunk/src/gnome/dialog-sx-from-trans.c
gnucash/trunk/src/gnome/dialog-tax-info.c
gnucash/trunk/src/gnome/druid-loan.c
gnucash/trunk/src/gnome/druid-stock-split.c
gnucash/trunk/src/gnome/glade/account.glade
gnucash/trunk/src/gnome/glade/fincalc.glade
gnucash/trunk/src/gnome/glade/lots.glade
gnucash/trunk/src/gnome/glade/sched-xact.glade
gnucash/trunk/src/gnome/glade/stocks.glade
gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
gnucash/trunk/src/gnome/lot-viewer.c
gnucash/trunk/src/import-export/binary-import/druid-commodity.c
gnucash/trunk/src/import-export/generic-import.glade
gnucash/trunk/src/import-export/gnc-import-format-gnome.c
gnucash/trunk/src/import-export/gnc-import-format-gnome.h
gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
gnucash/trunk/src/import-export/hbci/glade/hbci.glade
gnucash/trunk/src/import-export/import-backend.c
gnucash/trunk/src/import-export/import-backend.h
gnucash/trunk/src/import-export/import-main-matcher.c
gnucash/trunk/src/import-export/import-match-picker.c
gnucash/trunk/src/import-export/import-provider-format.glade
gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
gnucash/trunk/src/import-export/qif-import/qif.glade
gnucash/trunk/src/register/register-gnome/gnucash-color.c
gnucash/trunk/src/report/report-gnome/dialog-column-view.c
gnucash/trunk/src/report/report-gnome/dialog-style-sheet.c
gnucash/trunk/src/report/report-gnome/report.glade
Log:
Remove the majority of the remaining deprecated widgets by collapsing
the "deprecated-cleanup" branch (r13935:14581) back into trunk.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/ChangeLog 2006-08-02 18:13:30 UTC (rev 14588)
@@ -1,3 +1,10 @@
+2006-08-02 David Hampton <hampton at employees.org>
+
+ * various: Remove the majority of the remaining deprecated widgets
+ by collapsing the "deprecated-cleanup" branch (r13935:14581) back
+ into trunk. This patch also creates a new file for the code that
+ requires a GtkEntry text to match one of its completions.
+
2006-07-31 Derek Atkins <derek at ihtfp.com>
* src/bin/gnucash-bin.c:
Modified: gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome-utils.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/business-gnome-utils.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,7 @@
*
* Written By: Derek Atkins <warlord at MIT.EDU>
* Copyright (C) 2001,2002,2006 Derek Atkins
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -32,6 +33,7 @@
#include "gnc-ui-util.h"
#include "qof.h"
#include "gnc-component-manager.h"
+#include "gnc-gtk-utils.h"
#include "gncCustomer.h"
#include "gncJob.h"
@@ -304,20 +306,27 @@
gnc_fill_account_select_combo (GtkWidget *combo, GNCBook *book,
GList *acct_types)
{
- GList *list, *node, *names = NULL;
+ GtkListStore *store;
+ GtkEntry *entry;
+ GList *list, *node;
char *text;
- gboolean found = FALSE;
- g_return_if_fail (combo);
+ g_return_if_fail (combo && GTK_IS_COMBO_BOX_ENTRY(combo));
g_return_if_fail (book);
g_return_if_fail (acct_types);
/* Figure out if anything is set in the combo */
- text = gtk_editable_get_chars (GTK_EDITABLE ((GTK_COMBO (combo))->entry), 0, -1);
+ text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
list = xaccGroupGetSubAccounts (gnc_book_get_group (book));
- /* Create a list of names. Figure out if we've got the 'saved' one */
+ /* Clear the existing list */
+ entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo)));
+ gtk_entry_set_text(entry, "");
+ store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)));
+ gtk_list_store_clear(store);
+
+ /* Add the account names to the combo box */
for (node = list; node; node = node->next) {
Account *account = node->data;
char *name;
@@ -328,28 +337,15 @@
continue;
name = xaccAccountGetFullName (account);
- if (name != NULL) {
- names = g_list_append (names, name);
- if (!safe_strcmp (name, text))
- found = TRUE;
- }
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
+ g_free(name);
}
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
g_list_free (list);
- /* set the popdown strings and the default to last selected choice
- * (or the first entry if none was previously selected */
+ gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(combo), text);
- if (names) {
- gtk_combo_set_popdown_strings (GTK_COMBO (combo), names);
- gtk_entry_set_text (GTK_ENTRY ((GTK_COMBO (combo))->entry),
- found ? text : names->data);
- }
-
- for (node = names; node; node = node->next)
- g_free (node->data);
- g_list_free (names);
-
if (text)
g_free (text);
}
Modified: gnucash/trunk/src/business/business-gnome/dialog-billterms.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-billterms.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/dialog-billterms.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* dialog-billterms.c -- Dialog to create and edit billing terms
* Copyright (C) 2002 Derek Atkins
* Author: Derek Atkins <warlord at MIT.EDU>
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -39,13 +40,18 @@
#define DIALOG_BILLTERMS_CM_CLASS "billterms-dialog"
-void billterms_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data);
+enum term_cols {
+ BILL_TERM_COL_NAME = 0,
+ BILL_TERM_COL_TERM,
+ NUM_BILL_TERM_COLS
+};
+
void billterms_new_term_cb (GtkButton *button, BillTermsWindow *btw);
void billterms_delete_term_cb (GtkButton *button, BillTermsWindow *btw);
void billterms_edit_term_cb (GtkButton *button, BillTermsWindow *btw);
void billterms_window_close (GtkWidget *widget, gpointer data);
void billterms_window_destroy_cb (GtkWidget *widget, gpointer data);
+void billterms_type_combobox_changed (GtkComboBox *cb, gpointer data);
typedef struct _billterm_notebook {
GtkTooltips * tooltips;
@@ -68,7 +74,7 @@
struct _billterms_window {
GtkWidget * dialog;
- GtkWidget * terms_clist;
+ GtkWidget * terms_view;
GtkWidget * desc_entry;
GtkWidget * type_label;
GtkWidget * term_vbox;
@@ -342,53 +348,16 @@
show_notebook (&nbt->notebook);
}
-static void
-on_days1_activate (GtkWidget *w, gpointer data)
+void
+billterms_type_combobox_changed (GtkComboBox *cb, gpointer data)
{
NewBillTerm *nbt = data;
+ gint value;
- maybe_set_type (nbt, GNC_TERM_TYPE_DAYS);
+ value = gtk_combo_box_get_active(cb);
+ maybe_set_type (nbt, value + 1);
}
-static void
-on_proximo1_activate (GtkWidget *w, gpointer data)
-{
- NewBillTerm *nbt = data;
-
- maybe_set_type (nbt, GNC_TERM_TYPE_PROXIMO);
-}
-
-static void
-make_menu (GtkWidget *omenu, NewBillTerm *nbt)
-{
- GladeXML *xml;
- GtkWidget *popup;
-
- /* Open and read the Popup XML */
- xml = gnc_glade_xml_new ("billterms.glade", "Term Type Popup");
- popup = glade_xml_get_widget (xml, "Term Type Popup");
-
- /* Glade insists on making this a tearoff menu. */
- if (gnc_gconf_menus_have_tearoff()) {
- GtkMenuShell *ms = GTK_MENU_SHELL (popup);
- GtkWidget *tearoff;
-
- tearoff = g_list_nth_data (ms->children, 0);
- ms->children = g_list_remove (ms->children, tearoff);
- gtk_widget_destroy (tearoff);
- }
-
- /* attach the signal handlers */
- glade_xml_signal_connect_data (xml, "on_days1_activate",
- G_CALLBACK (on_days1_activate), nbt);
- glade_xml_signal_connect_data (xml, "on_proximo1_activate",
- G_CALLBACK (on_proximo1_activate), nbt);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), popup);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu),
- nbt->notebook.type - 1);
-}
-
static GncBillTerm *
new_billterm_dialog (BillTermsWindow *btw, GncBillTerm *term,
const char *name)
@@ -396,7 +365,7 @@
GncBillTerm *created_term = NULL;
NewBillTerm *nbt;
GladeXML *xml;
- GtkWidget *box;
+ GtkWidget *box, *combo_box;
gint response;
gboolean done;
const gchar *dialog_name;
@@ -432,7 +401,8 @@
nbt->notebook.type = GNC_TERM_TYPE_DAYS;
/* Create the menu */
- make_menu (glade_xml_get_widget (xml, "type_menu"), nbt);
+ combo_box = glade_xml_get_widget (xml, "type_combobox");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), nbt->notebook.type - 1);
/* Show the right notebook page */
show_notebook (&nbt->notebook);
@@ -509,27 +479,26 @@
billterms_window_refresh (BillTermsWindow *btw)
{
GList *list, *node;
- GtkAdjustment *vadjustment;
- GtkCList *clist;
- gfloat save_value = 0.0;
+ GncBillTerm *term;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
g_return_if_fail (btw);
- clist = GTK_CLIST (btw->terms_clist);
+ view = GTK_TREE_VIEW (btw->terms_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
- vadjustment = gtk_clist_get_vadjustment (clist);
- if (vadjustment)
- save_value = vadjustment->value;
-
/* Clear the list */
- gtk_clist_freeze (clist);
- gtk_clist_clear (clist);
-
+ gtk_list_store_clear (store);
gnc_gui_component_clear_watches (btw->component_id);
/* Add the items to the list */
list = gncBillTermGetTerms (btw->book);
- /* If there are no erms, clear the term display */
+ /* If there are no terms, clear the term display */
if (list == NULL) {
btw->current_term = NULL;
billterms_term_refresh (btw);
@@ -538,20 +507,21 @@
}
for ( node = list; node; node = node->next) {
- char *row_text[2];
- gint row;
- GncBillTerm *term = node->data;
-
+ term = node->data;
gnc_gui_component_watch_entity (btw->component_id,
gncBillTermGetGUID (term),
QOF_EVENT_MODIFY);
- row_text[0] = (char *)gncBillTermGetName (term);
- row_text[1] = NULL;
-
- row = gtk_clist_prepend (clist, row_text);
- gtk_clist_set_row_data (clist, row, term);
- gtk_clist_set_selectable (clist, row, TRUE);
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ BILL_TERM_COL_NAME, gncBillTermGetName(term),
+ BILL_TERM_COL_TERM, term,
+ -1);
+ if (term == btw->current_term) {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
}
g_list_free (list);
@@ -560,49 +530,46 @@
GNC_BILLTERM_MODULE_NAME,
QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
- if (vadjustment) {
- save_value = CLAMP (save_value, vadjustment->lower,
- vadjustment->upper - vadjustment->page_size);
- gtk_adjustment_set_value (vadjustment, save_value);
+ if (reference) {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path) {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
}
-
- gtk_clist_thaw (clist);
-
- {
- gint row = gtk_clist_find_row_from_data (clist, btw->current_term);
-
- if (row < 0)
- row = 0;
-
- gtk_clist_select_row (clist, row, 0);
-
- /* If this row isn't visible, move it to the center */
- if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto (clist, row, 0, 0.5, 0);
- }
- /* select_row() above will refresh the term display */
}
-void
-billterms_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data)
+static void
+billterm_selection_changed (GtkTreeSelection *selection,
+ BillTermsWindow *btw)
{
- BillTermsWindow *btw = user_data;
- GncBillTerm *term = gtk_clist_get_row_data (clist, row);
+ GncBillTerm *term = NULL;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
g_return_if_fail (btw);
- g_return_if_fail (term);
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ gtk_tree_model_get(model, &iter, BILL_TERM_COL_TERM, &term, -1);
+
/* If we've changed, then reset the term list */
if (term != btw->current_term)
btw->current_term = term;
/* And force a refresh of the entries */
billterms_term_refresh (btw);
+}
- /* If the user double-clicked on the item, pop up the edit window */
- if (event && event->type == GDK_2BUTTON_PRESS)
- new_billterm_dialog (btw, term, NULL);
+static void
+billterm_selection_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ BillTermsWindow *btw)
+{
+ new_billterm_dialog (btw, btw->current_term, NULL);
}
void
@@ -702,6 +669,11 @@
BillTermsWindow *btw;
GladeXML *xml;
GtkWidget *widget;
+ GtkTreeView *view;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
if (!book) return NULL;
@@ -724,11 +696,28 @@
/* Open and read the XML */
xml = gnc_glade_xml_new ("billterms.glade", "Terms Window");
btw->dialog = glade_xml_get_widget (xml, "Terms Window");
- btw->terms_clist = glade_xml_get_widget (xml, "terms_clist");
+ btw->terms_view = glade_xml_get_widget (xml, "terms_view");
btw->desc_entry = glade_xml_get_widget (xml, "desc_entry");
btw->type_label = glade_xml_get_widget (xml, "type_label");
btw->term_vbox = glade_xml_get_widget (xml, "term_vbox");
+ /* Initialize the view */
+ view = GTK_TREE_VIEW(btw->terms_view);
+ store = gtk_list_store_new (NUM_BILL_TERM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", BILL_TERM_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ g_signal_connect(view, "row-activated",
+ G_CALLBACK(billterm_selection_activated), btw);
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(billterm_selection_changed), btw);
+
/* Initialize the notebook widgets */
init_notebook_widgets (&btw->notebook, TRUE,
GTK_DIALOG (btw->dialog), btw);
Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* dialog-payment.c -- Dialog for payment entry
* Copyright (C) 2002,2006 Derek Atkins
* Author: Derek Atkins <warlord at MIT.EDU>
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -34,6 +35,7 @@
#include "qof.h"
#include "gnc-date-edit.h"
#include "gnc-amount-edit.h"
+#include "gnc-gtk-utils.h"
#include "gnc-tree-view-account.h"
#include "Transaction.h"
#include "Account.h"
@@ -246,7 +248,7 @@
}
/* Verify the "post" account */
- text = gtk_entry_get_text (GTK_ENTRY ((GTK_COMBO (pw->post_combo))->entry));
+ text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
if (!text || safe_strcmp (text, "") == 0) {
text = _("You must enter an account name for posting.");
gnc_error_dialog (pw->dialog, text);
@@ -383,6 +385,7 @@
pw->num_entry = glade_xml_get_widget (xml, "num_entry");
pw->memo_entry = glade_xml_get_widget (xml, "memo_entry");
pw->post_combo = glade_xml_get_widget (xml, "post_combo");
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pw->post_combo));
label = glade_xml_get_widget (xml, "owner_label");
box = glade_xml_get_widget (xml, "owner_box");
@@ -451,7 +454,7 @@
const gchar *text;
const char *acct_type;
- text = gtk_entry_get_text(GTK_ENTRY((GTK_COMBO(pw->post_combo))->entry));
+ text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
if (!text || safe_strcmp (text, "") == 0) {
/* XXX: I know there's only one type here */
Modified: gnucash/trunk/src/business/business-gnome/glade/billterms.glade
===================================================================
--- gnucash/trunk/src/business/business-gnome/glade/billterms.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/glade/billterms.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -107,30 +107,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="terms_clist">
+ <widget class="GtkTreeView" id="terms_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="billterms_row_selected" last_modification_time="Mon, 08 Sep 2003 02:00:56 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label23">
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -561,37 +545,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="type_menu">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Choose the type of Billing Term</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget3">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Type Menu</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkHBox" id="notebook_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -785,7 +738,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">type_menu</property>
+ <property name="mnemonic_widget">type_combobox</property>
</widget>
</child>
</widget>
@@ -798,6 +751,24 @@
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="type_combobox">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Days
+Proximo</property>
+ <property name="focus_on_click">True</property>
+ <signal name="changed" handler="billterms_type_combobox_changed" last_modification_time="Tue, 06 Jun 2006 01:17:37 GMT"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -991,7 +962,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">type_menu</property>
+ <property name="mnemonic_widget">type_combobox</property>
</widget>
</child>
</widget>
@@ -1006,25 +977,12 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="type_menu">
+ <widget class="GtkComboBox" id="type_combobox">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Choose the type of Billing Term</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget3">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Type Menu</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Days
+Proximo</property>
+ <property name="focus_on_click">True</property>
+ <signal name="changed" handler="billterms_type_combobox_changed" last_modification_time="Tue, 06 Jun 2006 01:17:37 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -1032,7 +990,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="y_options">fill</property>
</packing>
</child>
@@ -1065,30 +1023,6 @@
</child>
</widget>
-<widget class="GtkMenu" id="Term Type Popup">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="days1">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Number of days from now</property>
- <property name="label" translatable="yes">Days</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_days1_activate"/>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="proximo1">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Absolute Day-of-the-month</property>
- <property name="label" translatable="yes">Proximo</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_proximo1_activate"/>
- </widget>
- </child>
-</widget>
-
<widget class="GtkWindow" id="Term Notebook">
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
Modified: gnucash/trunk/src/business/business-gnome/glade/payment.glade
===================================================================
--- gnucash/trunk/src/business/business-gnome/glade/payment.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/glade/payment.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -95,7 +95,7 @@
<child>
<widget class="GtkLabel" id="owner_label">
<property name="visible">True</property>
- <property name="label" translatable="no">(owner)</property>
+ <property name="label">(owner)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
@@ -116,7 +116,7 @@
<child>
<widget class="GtkLabel" id="invoice_label">
<property name="visible">True</property>
- <property name="label" translatable="no">(invoice)</property>
+ <property name="label">(invoice)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -309,7 +309,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
+ <property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -328,7 +328,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
+ <property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -381,57 +381,11 @@
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
- <widget class="GtkCombo" id="post_combo">
- <property name="border_width">3</property>
+ <widget class="GtkComboBoxEntry" id="post_combo">
<property name="visible">True</property>
- <property name="value_in_list">True</property>
- <property name="allow_empty">False</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="combo-entry1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget1">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget2">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items">Dummy Entry</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">True</property>
</widget>
</child>
Modified: gnucash/trunk/src/business/business-gnome/search-owner.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/search-owner.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/business-gnome/search-owner.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -32,6 +34,7 @@
#include "business-gnome-utils.h"
#include "search-owner.h"
+#include "search-core-utils.h"
#define d(x)
@@ -199,12 +202,15 @@
}
static void
-type_option_changed (GtkWidget *widget, GNCSearchOwner *fe)
+type_combo_changed (GtkWidget *widget, GNCSearchOwner *fe)
{
GNCSearchOwnerPrivate *priv;
- GncOwnerType type = (GncOwnerType)
- g_object_get_data (G_OBJECT (widget), "option");
+ GncOwnerType type;
+ g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+
+ type = gnc_combo_box_search_get_active(GTK_COMBO_BOX(widget));
+
/* If the type changed or if we don't have a type create the owner_choice */
priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
if (type != gncOwnerGetType (&(priv->owner))) {
@@ -216,99 +222,43 @@
}
static GtkWidget *
-add_type_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- GncOwnerType type)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) type);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (type_option_changed),
- user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_TYPE_MENU_ITEM(str,tp) { \
- item = add_type_menu_item (menu, fe, str, tp); \
- if (type == tp) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_type_menu (GNCSearchCoreType *fe)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
GNCSearchOwnerPrivate *priv;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
GncOwnerType type;
- menu = gtk_menu_new ();
-
priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
type = gncOwnerGetType (&(priv->owner));
- ADD_TYPE_MENU_ITEM (_("Customer"), GNC_OWNER_CUSTOMER);
- first = item;
- ADD_TYPE_MENU_ITEM (_("Vendor"), GNC_OWNER_VENDOR);
- ADD_TYPE_MENU_ITEM (_("Employee"), GNC_OWNER_EMPLOYEE);
- ADD_TYPE_MENU_ITEM (_("Job"), GNC_OWNER_JOB);
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("Customer"), GNC_OWNER_CUSTOMER);
+ gnc_combo_box_search_add(combo, _("Vendor"), GNC_OWNER_VENDOR);
+ gnc_combo_box_search_add(combo, _("Employee"), GNC_OWNER_EMPLOYEE);
+ gnc_combo_box_search_add(combo, _("Job"), GNC_OWNER_JOB);
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
+ g_signal_connect (combo, "changed", G_CALLBACK (type_combo_changed), fe);
+ gnc_combo_box_search_set_active(combo, type);
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
+ return GTK_WIDGET(combo);
- return opmenu;
-}
-static void
-how_option_changed (GtkWidget *widget, GNCSearchOwner *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
}
static GtkWidget *
-add_how_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (how_option_changed),
- user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_HOW_MENU_ITEM(str,op) { \
- item = add_how_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_how_menu (GNCSearchCoreType *fe)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("is"), GUID_MATCH_ANY);
+ gnc_combo_box_search_add(combo, _("is not"), GUID_MATCH_NONE);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : GUID_MATCH_ANY);
- ADD_HOW_MENU_ITEM (_("is"), GUID_MATCH_ANY);
- first = item; /* Force one */
- ADD_HOW_MENU_ITEM (_("is not"), GUID_MATCH_NONE);
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static GtkWidget *
Modified: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -32,6 +32,7 @@
#include "gnc-component-manager.h"
#include "gnc-ui.h"
#include "gnc-gui-query.h"
+#include "gnc-gtk-utils.h"
#include "gnc-ui-util.h"
#include "qof.h"
#include "gnc-amount-edit.h"
@@ -43,23 +44,32 @@
#define DIALOG_TAX_TABLE_CM_CLASS "tax-table-dialog"
#define GCONF_SECTION "dialogs/business/tax_tables"
+enum tax_table_cols {
+ TAX_TABLE_COL_NAME = 0,
+ TAX_TABLE_COL_POINTER,
+ NUM_TAX_TABLE_COLS
+};
+
+enum tax_entry_cols {
+ TAX_ENTRY_COL_NAME = 0,
+ TAX_ENTRY_COL_POINTER,
+ TAX_ENTRY_COL_AMOUNT,
+ NUM_TAX_ENTRY_COLS
+};
+
void tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw);
void tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw);
void tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw);
void tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw);
void tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data);
-void tax_table_entry_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data);
void tax_table_window_close (GtkWidget *widget, gpointer data);
void tax_table_window_destroy_cb (GtkWidget *widget, gpointer data);
struct _taxtable_window {
GtkWidget * dialog;
- GtkWidget * names_clist;
- GtkWidget * entries_clist;
+ GtkWidget * names_view;
+ GtkWidget * entries_view;
GncTaxTable * current_table;
GncTaxTableEntry * current_entry;
@@ -175,45 +185,17 @@
}
static void
-optionmenu_changed (GtkWidget *widget, NewTaxTable *ntt)
+combo_changed (GtkWidget *widget, NewTaxTable *ntt)
{
- g_return_if_fail (ntt);
- ntt->type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(widget), "option"));
-}
+ gint index;
-static GtkWidget *
-add_menu_item (GtkWidget *menu, NewTaxTable *ntt, char *label, gint type)
-
-{
- GtkWidget *item;
+ g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+ g_return_if_fail(ntt);
- item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", GINT_TO_POINTER (type));
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (optionmenu_changed), ntt);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+ ntt->type = index + 1;
}
-static GtkWidget *
-make_menu (GtkWidget *omenu, NewTaxTable *ntt)
-{
- GtkWidget *menu, *value, *percent;
- int current = ntt->type - 1;
-
- menu = gtk_menu_new ();
- value = add_menu_item (menu, ntt, _("Value $"), GNC_AMT_TYPE_VALUE);
- /* xgettext:no-c-format */
- percent = add_menu_item (menu, ntt, _("Percent %"), GNC_AMT_TYPE_PERCENT);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
-
- g_signal_emit_by_name (G_OBJECT ((current == GNC_AMT_TYPE_VALUE-1 ?
- value : percent)), "activate", ntt);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
- return menu;
-}
-
static GncTaxTable *
new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
GncTaxTableEntry *entry, const char *name)
@@ -221,9 +203,9 @@
GncTaxTable *created_table = NULL;
NewTaxTable *ntt;
GladeXML *xml;
- GtkWidget *box, *widget;
+ GtkWidget *box, *widget, *combo;
gboolean done;
- gint response;
+ gint response, index;
if (!ttw) return NULL;
if (new_table && entry) return NULL;
@@ -246,7 +228,10 @@
gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
/* Create the menu */
- make_menu (glade_xml_get_widget (xml, "type_menu"), ntt);
+ combo = glade_xml_get_widget (xml, "type_combobox");
+ index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
+ g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
/* Attach our own widgets */
box = glade_xml_get_widget (xml, "amount_box");
@@ -332,26 +317,27 @@
/***********************************************************************/
static void
-tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table)
+tax_table_entries_refresh (TaxTableWindow *ttw)
{
GList *list, *node;
- GtkAdjustment *vadjustment = NULL;
- GtkCList *clist;
- gfloat save_value = 0.0;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
+ GncTaxTableEntry *selected_entry;
g_return_if_fail (ttw);
- clist = GTK_CLIST (ttw->entries_clist);
+ view = GTK_TREE_VIEW (ttw->entries_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
- if (!new_table) {
- vadjustment = gtk_clist_get_vadjustment (clist);
- if (vadjustment)
- save_value = vadjustment->value;
- }
-
/* Clear the list */
- gtk_clist_freeze (clist);
- gtk_clist_clear (clist);
+ selected_entry = ttw->current_entry;
+ gtk_list_store_clear (store);
+ if (ttw->current_table == NULL)
+ return;
/* Add the items to the list */
list = gncTaxTableGetEntries (ttw->current_table);
@@ -360,7 +346,6 @@
for (node = list ; node; node = node->next) {
char *row_text[3];
- gint row;
GncTaxTableEntry *entry = node->data;
Account *acc = gncTaxTableEntryGetAccount (entry);
gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
@@ -380,126 +365,115 @@
gnc_default_print_info (TRUE)));
break;
}
- row_text[2] = NULL;
- row = gtk_clist_prepend (clist, row_text);
- gtk_clist_set_row_data (clist, row, entry);
- gtk_clist_set_selectable (clist, row, TRUE);
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ TAX_ENTRY_COL_NAME, row_text[0],
+ TAX_ENTRY_COL_POINTER, entry,
+ TAX_ENTRY_COL_AMOUNT, row_text[1],
+ -1);
+ if (entry == selected_entry) {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
g_free (row_text[0]);
g_free (row_text[1]);
}
- g_list_free (list);
-
- if (!new_table) {
- if (vadjustment) {
- save_value = CLAMP (save_value, vadjustment->lower,
- vadjustment->upper - vadjustment->page_size);
- gtk_adjustment_set_value (vadjustment, save_value);
+ if (reference) {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path) {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
}
}
-
- gtk_clist_thaw (clist);
-
- {
- gint row = gtk_clist_find_row_from_data (clist, ttw->current_entry);
-
- if (row < 0)
- row = 0;
-
- gtk_clist_select_row (clist, row, 0);
-
- /* If this row isn't visible, move it to the center */
- if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto (clist, row, 0, 0.5, 0);
- }
}
static void
tax_table_window_refresh (TaxTableWindow *ttw)
{
GList *list, *node;
- GtkAdjustment *vadjustment;
- GtkCList *clist;
- gfloat save_value = 0.0;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
g_return_if_fail (ttw);
- clist = GTK_CLIST (ttw->names_clist);
+ view = GTK_TREE_VIEW (ttw->names_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
- vadjustment = gtk_clist_get_vadjustment (clist);
- if (vadjustment)
- save_value = vadjustment->value;
-
/* Clear the list */
- gtk_clist_freeze (clist);
- gtk_clist_clear (clist);
+ gtk_list_store_clear(store);
gnc_gui_component_clear_watches (ttw->component_id);
/* Add the items to the list */
list = gncTaxTableGetTables (ttw->book);
-
- /* If there are no tables, clear the entries list */
- if (list == NULL)
- gtk_clist_clear (GTK_CLIST (ttw->entries_clist));
- else
+ if (list)
list = g_list_reverse (g_list_copy (list));
for (node = list; node; node = node->next) {
- char *row_text[2];
- gint row;
GncTaxTable *table = node->data;
gnc_gui_component_watch_entity (ttw->component_id,
gncTaxTableGetGUID (table),
QOF_EVENT_MODIFY);
- row_text[0] = (char *)gncTaxTableGetName (table);
- row_text[1] = NULL;
-
- row = gtk_clist_prepend (clist, row_text);
- gtk_clist_set_row_data (clist, row, table);
- gtk_clist_set_selectable (clist, row, TRUE);
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ TAX_TABLE_COL_NAME, gncTaxTableGetName (table),
+ TAX_TABLE_COL_POINTER, table,
+ -1);
+ if (table == ttw->current_table) {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
}
- g_list_free (list);
+ if (list)
+ g_list_free (list);
gnc_gui_component_watch_entity_type (ttw->component_id,
GNC_TAXTABLE_MODULE_NAME,
QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
- if (vadjustment) {
- save_value = CLAMP (save_value, vadjustment->lower,
- vadjustment->upper - vadjustment->page_size);
- gtk_adjustment_set_value (vadjustment, save_value);
+ if (reference) {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path) {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
}
-
- gtk_clist_thaw (clist);
-
- {
- gint row = gtk_clist_find_row_from_data (clist, ttw->current_table);
-
- if (row < 0)
- row = 0;
-
- gtk_clist_select_row (clist, row, 0);
-
- /* If this row isn't visible, move it to the center */
- if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto (clist, row, 0, 0.5, 0);
- }
+ ;; tax_table_entries_refresh (ttw);
/* select_row() above will refresh the entries window */
}
-void
-tax_table_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data)
+static void
+tax_table_selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
{
TaxTableWindow *ttw = user_data;
- GncTaxTable *table = gtk_clist_get_row_data (clist, row);
+ GncTaxTable *table;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
g_return_if_fail (ttw);
+
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ return;
+
+ gtk_tree_model_get(model, &iter, TAX_TABLE_COL_POINTER, &table, -1);
g_return_if_fail (table);
/* If we've changed, then reset the entry list */
@@ -508,26 +482,38 @@
ttw->current_entry = NULL;
}
/* And force a refresh of the entries */
- tax_table_entries_refresh (ttw, TRUE);
+ tax_table_entries_refresh (ttw);
}
-void
-tax_table_entry_row_selected (GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer user_data)
+static void
+tax_table_entry_selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
{
TaxTableWindow *ttw = user_data;
- GncTaxTableEntry *entry = gtk_clist_get_row_data (clist, row);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
g_return_if_fail (ttw);
- g_return_if_fail (entry);
- ttw->current_entry = entry;
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ ttw->current_entry = NULL;
+ return;
+ }
- /* If we double-click an item, then pop up an 'edit' window */
- if (event && event->type == GDK_2BUTTON_PRESS)
- new_tax_table_dialog (ttw, FALSE, entry, NULL);
+ gtk_tree_model_get(model, &iter, TAX_ENTRY_COL_POINTER, &ttw->current_entry, -1);
}
+static void
+tax_table_entry_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ TaxTableWindow *ttw = user_data;
+
+ new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
+}
+
void
tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw)
{
@@ -665,6 +651,11 @@
{
TaxTableWindow *ttw;
GladeXML *xml;
+ GtkTreeView *view;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
if (!book) return NULL;
@@ -687,9 +678,45 @@
/* Open and read the XML */
xml = gnc_glade_xml_new ("tax-tables.glade", "Tax Table Window");
ttw->dialog = glade_xml_get_widget (xml, "Tax Table Window");
- ttw->names_clist = glade_xml_get_widget (xml, "tax_tables_clist");
- ttw->entries_clist = glade_xml_get_widget (xml, "tax_table_entries");
+ ttw->names_view = glade_xml_get_widget (xml, "tax_tables_view");
+ ttw->entries_view = glade_xml_get_widget (xml, "tax_table_entries");
+ /* Create the tax tables view */
+ view = GTK_TREE_VIEW(ttw->names_view);
+ store = gtk_list_store_new (NUM_TAX_TABLE_COLS, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", TAX_TABLE_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(tax_table_selection_changed), ttw);
+
+
+ /* Create the tax table entries view */
+ view = GTK_TREE_VIEW(ttw->entries_view);
+ store = gtk_list_store_new (NUM_TAX_ENTRY_COLS, G_TYPE_STRING,
+ G_TYPE_POINTER, G_TYPE_STRING);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", TAX_ENTRY_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(tax_table_entry_selection_changed), ttw);
+ g_signal_connect(view, "row-activated",
+ G_CALLBACK(tax_table_entry_row_activated), ttw);
+
+
/* Setup signals */
glade_xml_signal_autoconnect_full( xml,
gnc_glade_autoconnect_full_func,
Modified: gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -107,30 +107,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="tax_tables_clist">
+ <widget class="GtkTreeView" id="tax_tables_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="tax_table_row_selected" last_modification_time="Mon, 08 Sep 2003 03:31:16 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label23">
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -250,30 +234,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="tax_table_entries">
+ <widget class="GtkTreeView" id="tax_table_entries">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="tax_table_entry_row_selected" last_modification_time="Mon, 08 Sep 2003 03:31:06 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label23">
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -630,7 +598,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">type_menu</property>
+ <property name="mnemonic_widget">type_combobox</property>
</widget>
</child>
</widget>
@@ -665,43 +633,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="type_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget5">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Value ($)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Percent (%)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkHBox" id="amount_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -758,6 +689,23 @@
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="type_combobox">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Value $
+Percent %</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: gnucash/trunk/src/core-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/Makefile.am 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/core-utils/Makefile.am 2006-08-02 18:13:30 UTC (rev 14588)
@@ -6,7 +6,8 @@
gnc-gdate-utils.c \
gnc-gkeyfile-utils.c \
gnc-glib-utils.c \
- gnc-gobject-utils.c
+ gnc-gobject-utils.c \
+ gnc-gtk-utils.c
libcore_utils_la_LIBADD = \
${GLIB_LIBS} \
@@ -28,7 +29,8 @@
gnc-gdate-utils.h \
gnc-gkeyfile-utils.h \
gnc-glib-utils.h \
- gnc-gobject-utils.h
+ gnc-gobject-utils.h \
+ gnc-gtk-utils.h
EXTRA_DIST = ${gwmod_DATA}
Added: gnucash/trunk/src/core-utils/gnc-gtk-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gtk-utils.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/core-utils/gnc-gtk-utils.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -0,0 +1,215 @@
+/********************************************************************\
+ * gnc-gtk-utils.c -- utility functions based on glib functions *
+ * Copyright (C) 2006 David Hampton <hampton at employees.org> *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+ * *
+\********************************************************************/
+
+#include "config.h"
+
+#include "gnc-gtk-utils.h"
+
+#define LAST_INDEX "last_index"
+#define CHANGED_ID "changed_id"
+
+
+/** Find an entry in the GtkComboBoxEntry by its text value, and set
+ * the widget to that value. This function also records the index of
+ * that text value for use when the user leaves the widget.
+ *
+ * @param cbe A pointer to a GtkComboBoxEntry widget.
+ *
+ * @param text The entry text to find in the model of the combo box
+ * entry. */
+void
+gnc_cbe_set_by_string(GtkComboBoxEntry *cbe,
+ const gchar *text)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ const gchar *tree_string;
+ gint column, index, id;
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbe));
+ if (!gtk_tree_model_get_iter_first(model, &iter)) {
+ /* empty tree */
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cbe), -1);
+ return;
+ }
+
+ column = gtk_combo_box_entry_get_text_column(cbe);
+ do {
+ gtk_tree_model_get(model, &iter, column, &tree_string, -1);
+ if (g_utf8_collate(text, tree_string) != 0)
+ continue;
+
+ /* Found a matching string */
+ id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cbe), CHANGED_ID));
+ g_signal_handler_block(cbe, id);
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(cbe), &iter);
+ g_signal_handler_unblock(cbe, id);
+
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbe));
+ g_object_set_data(G_OBJECT(cbe), LAST_INDEX, GINT_TO_POINTER(index));
+ return;
+ } while (gtk_tree_model_iter_next(model, &iter));
+}
+
+
+/** The GtkComboBoxEntry widget has changed its value. If the widget
+ * now points to another valid entry string then record the index of
+ * that string for use when the user leaves the widget.
+ *
+ * @param widget Unused.
+ *
+ * @param cbe A pointer to a GtkComboBoxEntry widget. */
+static void
+gnc_cbe_changed_cb (GtkComboBox *widget,
+ GtkComboBoxEntry *cbe)
+{
+ gint index;
+
+ index = gtk_combo_box_get_active(widget);
+ if (index == -1)
+ return;
+ g_object_set_data(G_OBJECT(cbe), LAST_INDEX, GINT_TO_POINTER(index));
+}
+
+
+/** The completion attached to currency edit widget has selected a
+ * match. This function extracts the completed string from the
+ * completion code's temporary model, and uses that to set the index
+ * of that currency name for use when the user leaves the widget.
+ * This should always point to a valid currency name since the user
+ * made the selection from a list of currency names.
+ *
+ * @param completion Unused.
+ *
+ * @param comp_model A temporary model used by completion code that
+ * contains only the current matches.
+ *
+ * @param comp_iter The iter in the completion's temporary model
+ * that represents the user selected match.
+ *
+ * @param cbe A pointer to a currency entry widget. */
+static gboolean
+gnc_cbe_match_selected_cb (GtkEntryCompletion *completion,
+ GtkTreeModel *comp_model,
+ GtkTreeIter *comp_iter,
+ GtkComboBoxEntry *cbe)
+{
+ gint column;
+ gchar *text;
+
+ column = gtk_combo_box_entry_get_text_column(cbe);
+ gtk_tree_model_get(comp_model, comp_iter, column, &text, -1);
+ gnc_cbe_set_by_string(cbe, text);
+ return FALSE;
+}
+
+
+/** The focus left the currency edit widget, so reset the widget to
+ * its last known good value. If the widget value contained a valid
+ * currency then this is a noop. Otherwise the widget will be reset
+ * to the last user selected currency. This latter state will occur
+ * if the user has typed characters directly into the widget but not
+ * selected a completion.
+ *
+ * @param entry Unused.
+ *
+ * @param event Unused.
+ *
+ * @param cbe A pointer to a currency entry widget. */
+static gboolean
+gnc_cbe_focus_out_cb (GtkEntry *entry,
+ GdkEventFocus *event,
+ GtkComboBoxEntry *cbe)
+{
+ const gchar *text;
+ gint index;
+
+ /* Make a final attempt to match the current text. */
+ text = gtk_entry_get_text(entry);
+ gnc_cbe_set_by_string(cbe, text);
+
+ /* Get the last known index (which may have just been set). */
+ index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cbe), LAST_INDEX));
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cbe), index);
+ return FALSE;
+}
+
+void
+gnc_cbe_add_completion (GtkComboBoxEntry *cbe)
+{
+ GtkEntry *entry;
+ GtkEntryCompletion *completion;
+ GtkTreeModel *model;
+
+ entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbe)));
+ completion = gtk_entry_get_completion(entry);
+ if (completion)
+ return;
+
+ /* No completion yet? Set one up. */
+ 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_completion_set_inline_completion(completion, TRUE);
+ gtk_entry_set_completion(entry, completion);
+}
+
+void
+gnc_cbe_require_list_item (GtkComboBoxEntry *cbe)
+{
+ GtkEntry *entry;
+ GtkEntryCompletion *completion;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint index, id;
+
+ /* Ensure completion is set up. */
+ gnc_cbe_add_completion(cbe);
+
+ /* 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. */
+ entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbe)));
+ completion = gtk_entry_get_completion(entry);
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbe));
+ if (index == -1) {
+ model = gtk_entry_completion_get_model(completion);
+ if (gtk_tree_model_get_iter_first(model, &iter)) {
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cbe), 0);
+ index = 0;
+ }
+ }
+ g_object_set_data(G_OBJECT(cbe), LAST_INDEX, GINT_TO_POINTER(index));
+
+ /* Now the signals to make sure the user can't leave the
+ widget without a valid currency. */
+ id = g_signal_connect(cbe, "changed",
+ G_CALLBACK(gnc_cbe_changed_cb), cbe);
+ g_signal_connect(completion, "match_selected",
+ G_CALLBACK(gnc_cbe_match_selected_cb), cbe);
+ g_signal_connect(entry, "focus-out-event",
+ G_CALLBACK(gnc_cbe_focus_out_cb), cbe);
+
+ g_object_set_data(G_OBJECT(cbe), CHANGED_ID, GINT_TO_POINTER(id));
+}
Added: gnucash/trunk/src/core-utils/gnc-gtk-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gtk-utils.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/core-utils/gnc-gtk-utils.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -0,0 +1,55 @@
+/********************************************************************\
+ * gnc-gtk-utils.c -- utility functions based on glib functions *
+ * Copyright (C) 2006 David Hampton <hampton at employees.org> *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+ * *
+\********************************************************************/
+
+/** @addtogroup Gtk
+ @{ */
+/** @addtogroup Gtk Gtk Utilities
+
+ The API in this file is designed to provide support functions that
+ wrap the base gtk functions and make them easier to use.
+
+ @{ */
+/** @file gnc-gtk-utils.h
+ * @brief gtk helper routines.
+ * @author Copyright (C) 2006 David Hampton <hampton at employees.org>
+ */
+
+#ifndef GNC_GTK_UTILS_H
+#define GNC_GTK_UTILS_H
+
+#include <gtk/gtk.h>
+
+/** @name gtk Miscellaneous Functions
+ @{
+*/
+
+void gnc_cbe_set_by_string(GtkComboBoxEntry *cbe, const gchar *text);
+void gnc_cbe_add_completion (GtkComboBoxEntry *cbe);
+void gnc_cbe_require_list_item (GtkComboBoxEntry *cbe);
+
+
+/** @} */
+
+#endif /* GNC_GTK_UTILS_H */
+/** @} */
+/** @} */
Modified: gnucash/trunk/src/gnome/dialog-fincalc.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-fincalc.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/dialog-fincalc.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -64,8 +64,8 @@
GtkWidget *calc_button;
- GtkWidget *compounding_menu;
- GtkWidget *payment_menu;
+ GtkWidget *compounding_combo;
+ GtkWidget *payment_combo;
GtkWidget *end_of_period_radio;
GtkWidget *discrete_compounding_radio;
@@ -162,10 +162,10 @@
gtk_label_set_text (GTK_LABEL(fcd->payment_total_label), string);
i = normalize_period(&fcd->financial_info.CF);
- gtk_option_menu_set_history(GTK_OPTION_MENU(fcd->compounding_menu), i);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fcd->compounding_combo), i);
i = normalize_period(&fcd->financial_info.PF);
- gtk_option_menu_set_history(GTK_OPTION_MENU(fcd->payment_menu), i);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fcd->payment_combo), i);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcd->end_of_period_radio),
!fcd->financial_info.bep);
@@ -203,10 +203,10 @@
gnc_amount_edit_get_damount(GNC_AMOUNT_EDIT(fcd->amounts[FUTURE_VALUE]));
fcd->financial_info.fv = -fcd->financial_info.fv;
- i = gnc_option_menu_get_active(fcd->compounding_menu);
+ i = gtk_combo_box_get_active(GTK_COMBO_BOX(fcd->compounding_combo));
fcd->financial_info.CF = periods[i];
- i = gnc_option_menu_get_active(fcd->payment_menu);
+ i = gtk_combo_box_get_active(GTK_COMBO_BOX(fcd->payment_combo));
fcd->financial_info.PF = periods[i];
toggle = GTK_TOGGLE_BUTTON(fcd->end_of_period_radio);
@@ -254,13 +254,6 @@
g_free(fcd);
}
-static void
-connect_fincalc_menu_item(GtkWidget *item, gpointer data)
-{
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (fincalc_update_calc_button_cb), data);
-}
-
void
fincalc_compounding_radio_toggled(GtkToggleButton *togglebutton, gpointer data)
{
@@ -274,7 +267,7 @@
sensitive = gtk_toggle_button_get_active (togglebutton);
- gtk_widget_set_sensitive (fcd->compounding_menu, sensitive);
+ gtk_widget_set_sensitive (fcd->compounding_combo, sensitive);
}
void
@@ -554,7 +547,7 @@
{
FinCalcDialog *fcd;
GtkWidget *button;
- GtkWidget *menu;
+ GtkWidget *combo;
GtkWidget *edit;
GladeXML *xml;
@@ -601,17 +594,15 @@
fcd->calc_button = glade_xml_get_widget (xml, "calc_button");
- menu = glade_xml_get_widget (xml, "compounding_menu");
- fcd->compounding_menu = menu;
- gnc_option_menu_init(menu);
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menu));
- gtk_container_forall(GTK_CONTAINER(menu), connect_fincalc_menu_item, fcd);
+ combo = glade_xml_get_widget (xml, "compounding_combo");
+ fcd->compounding_combo = combo;
+ g_signal_connect(fcd->compounding_combo, "changed",
+ G_CALLBACK (fincalc_update_calc_button_cb), fcd);
- menu = glade_xml_get_widget (xml, "payment_menu");
- fcd->payment_menu = menu;
- gnc_option_menu_init(menu);
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menu));
- gtk_container_forall(GTK_CONTAINER(menu), connect_fincalc_menu_item, fcd);
+ combo = glade_xml_get_widget (xml, "payment_combo");
+ fcd->payment_combo = combo;
+ g_signal_connect(fcd->compounding_combo, "changed",
+ G_CALLBACK (fincalc_update_calc_button_cb), fcd);
button = glade_xml_get_widget (xml, "period_payment_radio");
fcd->end_of_period_radio = button;
Modified: gnucash/trunk/src/gnome/dialog-scheduledxaction.h
===================================================================
--- gnucash/trunk/src/gnome/dialog-scheduledxaction.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/dialog-scheduledxaction.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -42,10 +42,12 @@
SchedXactionDialog * gnc_ui_scheduled_xaction_dialog_create(void);
void gnc_ui_scheduled_xaction_dialog_destroy(SchedXactionDialog *sxd);
+#ifdef __GTK_CLIST_H__
void row_select_handler( GtkCList *clist, gint row, gint col,
GdkEventButton *event, gpointer d );
void row_unselect_handler( GtkCList *clist, gint row, gint col,
GdkEventButton *event, gpointer d );
+#endif
void gnc_sxd_list_refresh( SchedXactionDialog *sxd );
Modified: gnucash/trunk/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-from-trans.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/dialog-sx-from-trans.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,7 @@
* scheduled transaction from a real one *
* Copyright (C) 2001 Robert Merkel <rgmerk at mira.net> *
* Copyright (C) 2001 Joshua Sled <jsled at asynchronous.org> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -55,7 +56,7 @@
#define SXFTD_PARAM_TABLE "param_table"
#define SXFTD_NAME_ENTRY "name_entry"
#define SXFTD_N_OCCURRENCES_ENTRY "n_occurrences_entry"
-#define SXFTD_FREQ_OPTION_MENU "freq_option_menu"
+#define SXFTD_FREQ_COMBO_BOX "freq_combo_box"
/* #define SXFTD_END_DATE_EDIT "end_date_edit" */
#define SXFTD_START_DATE_EDIT "start_date_edit"
#define SXFTD_EX_CAL_FRAME "ex_cal_frame"
@@ -71,7 +72,7 @@
static QofLogModule log_module = GNC_MOD_SX;
-static void sxftd_freq_option_changed( GtkWidget *w, gpointer user_data );
+static void sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data );
static void gnc_sx_trans_window_response_cb(GtkDialog *dialog, gint response, gpointer data);
static void sxftd_destroy( GtkWidget *w, gpointer user_data );
@@ -295,8 +296,8 @@
/* Note that we make the start date the *NEXT* instance, not the
* present one. */
- w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_OPTION_MENU);
- index = gnc_option_menu_get_active(w);
+ w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_COMBO_BOX);
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
switch(index)
{
@@ -423,6 +424,12 @@
/* compute good initial date. */
start_tt = xaccTransGetDate( sxfti->trans );
g_date_set_time_t( &date, start_tt );
+ w = glade_xml_get_widget(sxfti->gxml,
+ SXFTD_FREQ_COMBO_BOX);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0);
+ g_signal_connect( w, "changed",
+ G_CALLBACK(sxftd_freq_combo_changed),
+ sxfti );
fs = xaccFreqSpecMalloc( gnc_get_current_book() );
sxftd_update_fs( sxfti, &date, fs );
xaccFreqSpecGetNextInstance( fs, &date, &nextDate );
@@ -438,14 +445,6 @@
gtk_editable_insert_text( GTK_EDITABLE(w), transName,
(strlen(transName) * sizeof(char)), &pos );
- w = glade_xml_get_widget(sxfti->gxml,
- SXFTD_FREQ_OPTION_MENU);
- gnc_option_menu_init(w);
- w = gtk_option_menu_get_menu( GTK_OPTION_MENU(w) );
- g_signal_connect( GTK_OBJECT(w), "selection-done",
- G_CALLBACK(sxftd_freq_option_changed),
- sxfti );
-
g_signal_connect( GTK_OBJECT(w), "destroy",
G_CALLBACK(sxftd_destroy),
sxfti );
@@ -588,7 +587,7 @@
* somehow.
**/
static void
-sxftd_freq_option_changed( GtkWidget *w, gpointer user_data )
+sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data )
{
SXFromTransInfo *sxfti = (SXFromTransInfo*)user_data;
GDate date, nextDate;
Modified: gnucash/trunk/src/gnome/dialog-tax-info.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-tax-info.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/dialog-tax-info.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -703,18 +703,6 @@
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
ti_dialog->txf_help_text = text;
- /* set text height */
- {
- GtkStyle *style = gtk_widget_get_style (text);
- GdkFont *font = NULL;
-
- if (style != NULL)
- font = gdk_font_from_description (style->font_desc);
-
- if (font)
- gtk_widget_set_size_request (text, -1, (font->ascent + font->descent) * 5 + 6);
- }
-
tree_view = GTK_TREE_VIEW(glade_xml_get_widget(xml, "txf_category_view"));
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(store));
Modified: gnucash/trunk/src/gnome/druid-loan.c
===================================================================
--- gnucash/trunk/src/gnome/druid-loan.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/druid-loan.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* druid-loan.c : A Gnome Druid for setting up loan-repayment *
* scheduled transactions. *
* Copyright (C) 2002 Joshua Sled <jsled at asynchronous.org> *
+ * Copyright (C) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -64,6 +65,7 @@
# define PARAM_TABLE "param_table"
# define ORIG_PRINC_ENTRY "orig_princ_ent"
# define IRATE_SPIN "irate_spin"
+# define TYPE_COMBOBOX "type_combobox"
# define VAR_CONTAINER "type_freq_frame"
# define LENGTH_SPIN "len_spin"
# define LENGTH_OPT "len_opt"
@@ -98,6 +100,14 @@
#define OPT_VBOX_SPACING 2
+enum loan_cols {
+ LOAN_COL_DATE = 0,
+ LOAN_COL_PAYMENT,
+ LOAN_COL_PRINCIPAL,
+ LOAN_COL_INTEREST,
+ NUM_LOAN_COLS
+};
+
typedef enum {
CURRENT_YEAR,
NOW_PLUS_ONE,
@@ -251,12 +261,12 @@
GNCAccountSel *prmAccountGAS;
GNCAmountEdit *prmOrigPrincGAE;
GtkSpinButton *prmIrateSpin;
- GtkOptionMenu *prmType;
+ GtkComboBox *prmType;
GtkFrame *prmVarFrame;
GNCFrequency *prmVarGncFreq;
GNCDateEdit *prmStartDateGDE;
GtkSpinButton *prmLengthSpin;
- GtkOptionMenu *prmLengthType;
+ GtkComboBox *prmLengthType;
GtkSpinButton *prmRemainSpin;
/* opt = options */
@@ -294,13 +304,13 @@
GNCFrequency *payGncFreq;
/* rev = review */
- GtkOptionMenu *revRangeOpt;
+ GtkComboBox *revRangeOpt;
GtkFrame *revDateFrame;
GtkTable *revTable;
GNCDateEdit *revStartDate;
GNCDateEdit *revEndDate;
GtkScrolledWindow *revScrollWin;
- GtkCList *revCL;
+ GtkTreeView *revView;
} LoanDruidData;
/**
@@ -329,7 +339,7 @@
static void ld_destroy( GtkObject *o, gpointer ud );
static void ld_cancel_check( GnomeDruid *gd, LoanDruidData *ldd );
-static void ld_prm_type_changed( GtkWidget *w, gint index, gpointer ud );
+static void ld_prm_type_changed( GtkWidget *w, gpointer ud );
static void ld_calc_upd_rem_payments( GtkWidget *w, gpointer ud );
static void ld_escrow_toggle( GtkToggleButton *tb, gpointer ud );
@@ -349,17 +359,14 @@
GDate *end );
static void ld_rev_recalc_schedule( LoanDruidData *ldd );
-static void ld_rev_range_opt_changed( GtkButton *b, gpointer ud );
+static void ld_rev_range_opt_changed( GtkComboBox *combo, gpointer ud );
static void ld_rev_range_changed( GNCDateEdit *gde, gpointer ud );
static void ld_rev_get_dates( LoanDruidData *ldd,
GDate *start,
GDate *end );
-static void ld_rev_update_clist( LoanDruidData *ldd,
+static void ld_rev_update_view( LoanDruidData *ldd,
GDate *start,
GDate *end );
-static void ld_rev_clist_allocate_col_widths( GtkWidget *w,
- GtkAllocation *alloc,
- gpointer user_data );
static void ld_rev_sched_list_free( gpointer data, gpointer user_data );
static void ld_rev_hash_to_list( gpointer key,
gpointer val,
@@ -547,26 +554,9 @@
gtk_widget_set_sensitive( GTK_WIDGET(ldd->prmVarFrame), FALSE );
{
- GtkAlignment *a;
- GNCOptionInfo typeOptInfo[] = {
- { _("Fixed"), _("A Fixed-Rate loan"), ld_prm_type_changed, ldd },
- { _("3/1 Year"),
- /* Translators: ARM = Adjustable Rate Mortgage; that is a
- loan where the rate is constant for the period before
- the '/', e.g. 5 years, and then may change. See also
- http://www.fanniemae.com/tools/glossary.jhtml */
- _("A 3/1 Year ARM"), ld_prm_type_changed, ldd },
- { _("5/1 Year"), _("A 5/1 Year ARM"), ld_prm_type_changed, ldd },
- { _("7/1 Year"), _("A 7/1 Year ARM"), ld_prm_type_changed, ldd },
- { _("10/1 Year"), _("A 10/1 Year ARM"), ld_prm_type_changed, ldd },
- };
- ldd->prmType =
- GTK_OPTION_MENU( gnc_build_option_menu( typeOptInfo, 5 ) );
- a = GTK_ALIGNMENT( gtk_alignment_new( 0.0, 0.5, 0.25, 1.0 ) );
- gtk_container_add( GTK_CONTAINER(a), GTK_WIDGET(ldd->prmType) );
- gtk_table_attach( ldd->prmTable, GTK_WIDGET(a),
- 3, 4, 2, 3,
- 0, 0, 2, 2 );
+ g_signal_connect( ldd->prmType, "changed",
+ G_CALLBACK( ld_prm_type_changed ),
+ ldd );
}
{
@@ -594,8 +584,7 @@
g_signal_connect( ldd->prmLengthSpin, "changed",
G_CALLBACK( ld_calc_upd_rem_payments ),
ldd );
- g_signal_connect( gtk_option_menu_get_menu(ldd->prmLengthType),
- "selection-done",
+ g_signal_connect( ldd->prmLengthType, "changed",
G_CALLBACK( ld_calc_upd_rem_payments ),
ldd );
@@ -605,10 +594,6 @@
gtk_spin_button_set_adjustment( ldd->prmRemainSpin, a );
}
- gnc_option_menu_init( GTK_WIDGET(ldd->prmType) );
- gnc_option_menu_init( GTK_WIDGET(ldd->prmLengthType) );
- gnc_option_menu_init( GTK_WIDGET(ldd->revRangeOpt) );
-
g_signal_connect( ldd->optEscrowCb, "toggled",
G_CALLBACK(ld_escrow_toggle), ldd );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->optEscrowHBox), FALSE );
@@ -713,8 +698,8 @@
/* Review page widget setup. */
{
- g_signal_connect( gtk_option_menu_get_menu(ldd->revRangeOpt),
- "selection-done",
+ gtk_combo_box_set_active( ldd->revRangeOpt, 0 );
+ g_signal_connect( ldd->revRangeOpt, "changed",
G_CALLBACK( ld_rev_range_opt_changed ),
ldd );
g_signal_connect( ldd->revStartDate, "date-changed",
@@ -862,13 +847,15 @@
GET_CASTED_WIDGET( GTK_TABLE, PARAM_TABLE );
ldd->prmIrateSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, IRATE_SPIN );
+ ldd->prmType =
+ GET_CASTED_WIDGET( GTK_COMBO_BOX, TYPE_COMBOBOX );
ldd->prmVarFrame =
GET_CASTED_WIDGET( GTK_FRAME, VAR_CONTAINER );
/* ldd->prmStartDateGDE */
ldd->prmLengthSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, LENGTH_SPIN );
ldd->prmLengthType =
- GET_CASTED_WIDGET( GTK_OPTION_MENU, LENGTH_OPT );
+ GET_CASTED_WIDGET( GTK_COMBO_BOX, LENGTH_OPT );
ldd->prmRemainSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, REMAIN_SPIN );
@@ -916,7 +903,7 @@
/* rev = review */
ldd->revRangeOpt =
- GET_CASTED_WIDGET( GTK_OPTION_MENU, REV_RANGE_OPT );
+ GET_CASTED_WIDGET( GTK_COMBO_BOX, REV_RANGE_OPT );
ldd->revDateFrame =
GET_CASTED_WIDGET( GTK_FRAME, REV_DATE_FRAME );
ldd->revTable =
@@ -1055,11 +1042,13 @@
static
void
-ld_prm_type_changed( GtkWidget *w, gint index, gpointer ud )
+ld_prm_type_changed( GtkWidget *w, gpointer ud )
{
LoanDruidData *ldd;
+ gint index;
ldd = (LoanDruidData*)ud;
+ index = gtk_combo_box_get_active( ldd->prmType );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->prmVarFrame),
index != FIXED );
}
@@ -1170,7 +1159,7 @@
}
ldd->ld.principal = gnc_amount_edit_get_amount( ldd->prmOrigPrincGAE );
ldd->ld.interestRate = gtk_spin_button_get_value( ldd->prmIrateSpin );
- ldd->ld.type = gnc_option_menu_get_active( GTK_WIDGET(ldd->prmType) );
+ ldd->ld.type = gtk_combo_box_get_active( ldd->prmType );
if ( ldd->ld.type != FIXED ) {
gnc_frequency_save_state( ldd->prmVarGncFreq,
ldd->ld.loanFreq,
@@ -1193,7 +1182,7 @@
/* len / periods */
{
ldd->ld.perSize =
- (gnc_option_menu_get_active( GTK_WIDGET(ldd->prmLengthType) )
+ (gtk_combo_box_get_active( ldd->prmLengthType )
== MONTHS) ? MONTHS : YEARS;
ldd->ld.numPer =
gtk_spin_button_get_value_as_int( ldd->prmLengthSpin );
@@ -1212,7 +1201,7 @@
ldd = (LoanDruidData*)ud;
gnc_amount_edit_set_amount( ldd->prmOrigPrincGAE, ldd->ld.principal );
gtk_spin_button_set_value( ldd->prmIrateSpin, ldd->ld.interestRate );
- gtk_option_menu_set_history( ldd->prmType, ldd->ld.type );
+ gtk_combo_box_set_active( ldd->prmType, ldd->ld.type );
if ( ldd->ld.type != FIXED ) {
gnc_frequency_setup( ldd->prmVarGncFreq,
ldd->ld.loanFreq,
@@ -1234,7 +1223,7 @@
/* length: total and remaining */
{
gtk_spin_button_set_value( ldd->prmLengthSpin, ldd->ld.numPer );
- gtk_option_menu_set_history( ldd->prmLengthType, ldd->ld.perSize );
+ gtk_combo_box_set_active( ldd->prmLengthType, ldd->ld.perSize );
gtk_spin_button_set_value( ldd->prmRemainSpin, ldd->ld.numMonRemain );
}
}
@@ -1749,16 +1738,18 @@
/* 3, here, does not include the Date column. */
const static int BASE_COLS = 3;
LoanDruidData *ldd;
- gchar **titles;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GType *types;
int i;
ldd = (LoanDruidData*)ud;
- /* Cleanup old clist */
- if ( ldd->revCL != NULL ) {
- gtk_container_remove( GTK_CONTAINER(ldd->revScrollWin),
- GTK_WIDGET(ldd->revCL) );
- ldd->revCL = NULL;
+ /* Cleanup old view */
+ if ( ldd->revView != NULL ) {
+ gtk_widget_destroy( GTK_WIDGET(ldd->revView) );
+ ldd->revView = NULL;
}
ldd->ld.revNumPmts = BASE_COLS;
@@ -1775,40 +1766,58 @@
}
/* '+1' for leading date col */
- titles = g_new0( gchar*, ldd->ld.revNumPmts + 1 );
- titles[0] = _( "Date" );
- titles[1] = _( "Payment" );
- titles[2] = _( "Principal" );
- titles[3] = _( "Interest" );
+ types = g_new( GType, ldd->ld.revNumPmts + 1 );
+ for ( i=0; i < ldd->ld.revNumPmts + 1; i++ )
+ types[i] = G_TYPE_STRING;
+ store = gtk_list_store_newv(ldd->ld.revNumPmts + 1, types);
+ g_free(types);
+
+ ldd->revView = GTK_TREE_VIEW(
+ gtk_tree_view_new_with_model( GTK_TREE_MODEL(store) ));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer,
+ "text", LOAN_COL_DATE,
+ NULL);
+ gtk_tree_view_append_column(ldd->revView, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Payment"), renderer,
+ "text", LOAN_COL_PAYMENT,
+ NULL);
+ gtk_tree_view_append_column(ldd->revView, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Principal"), renderer,
+ "text", LOAN_COL_PRINCIPAL,
+ NULL);
+ gtk_tree_view_append_column(ldd->revView, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Interest"), renderer,
+ "text", LOAN_COL_INTEREST,
+ NULL);
+ gtk_tree_view_append_column(ldd->revView, column);
+
/* move the appropriate names over into the title array */
{
for ( i=0; i < ldd->ld.repayOptCount; i++ ) {
if ( ldd->ld.revRepayOptToColMap[i] == -1 ) {
continue;
}
- /* '+1' offset for the "Date" title */
- titles[ ldd->ld.revRepayOptToColMap[i] + 1 ] =
- ldd->ld.repayOpts[i]->name;
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes
+ (ldd->ld.repayOpts[i]->name, renderer,
+ "text", LOAN_COL_INTEREST + i,
+ NULL);
+ gtk_tree_view_append_column(ldd->revView, column);
}
}
- ldd->revCL = GTK_CLIST(
- gtk_clist_new_with_titles( ldd->ld.revNumPmts+1,
- titles ) );
- g_free( titles );
-
- for( i=0; i < ldd->ld.revNumPmts+1; i++ ) {
- gtk_clist_set_column_resizeable( ldd->revCL, i, TRUE );
-
- }
-
- g_signal_connect( ldd->revCL, "size-allocate",
- G_CALLBACK(ld_rev_clist_allocate_col_widths),
- ldd );
-
gtk_container_add( GTK_CONTAINER(ldd->revScrollWin),
- GTK_WIDGET(ldd->revCL) );
- gtk_widget_show_all( GTK_WIDGET(ldd->revCL) );
+ GTK_WIDGET(ldd->revView) );
+ gtk_widget_show( GTK_WIDGET(ldd->revView) );
ld_rev_recalc_schedule( ldd );
@@ -1817,7 +1826,7 @@
g_date_clear( &start, 1 );
g_date_clear( &end, 1 );
ld_rev_get_dates( ldd, &start, &end );
- ld_rev_update_clist( ldd, &start, &end );
+ ld_rev_update_view( ldd, &start, &end );
}
}
@@ -2499,8 +2508,7 @@
g_free( valueStr );
}
total = totalVal
- * ( gnc_option_menu_get_active(
- GTK_WIDGET(ldd->prmLengthType) )
+ * ( gtk_combo_box_get_active( ldd->prmLengthType )
== 1 ? 12 : 1 );
remain = total - i;
gtk_spin_button_set_value( ldd->prmRemainSpin, remain );
@@ -2509,12 +2517,12 @@
static
void
-ld_rev_range_opt_changed( GtkButton *b, gpointer ud )
+ld_rev_range_opt_changed( GtkComboBox *combo, gpointer ud )
{
LoanDruidData *ldd = (LoanDruidData*)ud;
int opt;
- opt = gnc_option_menu_get_active( GTK_WIDGET(ldd->revRangeOpt) );
+ opt = gtk_combo_box_get_active( ldd->revRangeOpt );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->revDateFrame),
(opt == CUSTOM) );
{
@@ -2522,7 +2530,7 @@
g_date_clear( &start, 1 );
g_date_clear( &end, 1 );
ld_rev_get_dates( ldd, &start, &end );
- ld_rev_update_clist( ldd, &start, &end );
+ ld_rev_update_view( ldd, &start, &end );
}
}
@@ -2536,7 +2544,7 @@
g_date_clear( &start, 1 );
g_date_clear( &end, 1 );
ld_rev_get_dates( ldd, &start, &end );
- ld_rev_update_clist( ldd, &start, &end );
+ ld_rev_update_view( ldd, &start, &end );
}
}
@@ -2562,7 +2570,7 @@
void
ld_rev_get_dates( LoanDruidData *ldd, GDate *start, GDate *end )
{
- int range = gnc_option_menu_get_active( GTK_WIDGET(ldd->revRangeOpt) );
+ int range = gtk_combo_box_get_active( ldd->revRangeOpt );
switch ( range ) {
case CURRENT_YEAR:
g_date_set_time_t( start, time(NULL) );
@@ -2801,20 +2809,21 @@
static
void
-ld_rev_update_clist( LoanDruidData *ldd, GDate *start, GDate *end )
+ld_rev_update_view( LoanDruidData *ldd, GDate *start, GDate *end )
{
static gchar *NO_AMT_CELL_TEXT = " ";
GList *l;
GNCPrintAmountInfo pai;
- /* '+1' for the date cell */
- gchar *rowText[ ldd->ld.revNumPmts + 1 ];
+ GtkListStore *store;
+ GtkTreeIter iter;
pai = gnc_default_price_print_info();
pai.min_decimal_places = 2;
- gtk_clist_clear( ldd->revCL );
- gtk_clist_freeze( ldd->revCL );
+ store = GTK_LIST_STORE(gtk_tree_view_get_model( ldd->revView ));
+ gtk_list_store_clear( store );
+
for ( l = ldd->ld.revSchedule; l != NULL; l = l->next )
{
int i;
@@ -2826,54 +2835,31 @@
if ( g_date_compare( &rrr->date, end ) > 0 )
continue; /* though we can probably return, too. */
- qof_print_gdate( tmpBuf, MAX_DATE_LENGTH, &rrr->date );
- rowText[0] = g_strdup( tmpBuf );
+ gtk_list_store_append(store, &iter);
+ qof_print_gdate( tmpBuf, MAX_DATE_LENGTH, &rrr->date );
+ gtk_list_store_set( store, &iter, LOAN_COL_DATE, tmpBuf, -1 );
+
for ( i=0; i<ldd->ld.revNumPmts; i++ )
{
int numPrinted;
if ( gnc_numeric_check( rrr->numCells[i] )
== GNC_ERROR_ARG )
{
- rowText[i+1] = NO_AMT_CELL_TEXT;
+ /* '+1' for the date cell */
+ gtk_list_store_set( store, &iter,
+ i+1, NO_AMT_CELL_TEXT,
+ -1);
continue;
}
numPrinted = xaccSPrintAmount( tmpBuf, rrr->numCells[i], pai );
g_assert( numPrinted < 50 );
- rowText[i+1] = g_strdup( tmpBuf );
+ /* '+1' for the date cell */
+ gtk_list_store_set( store, &iter,
+ i+1, tmpBuf,
+ -1);
}
- gtk_clist_append( ldd->revCL, rowText );
-
- for ( i=ldd->ld.revNumPmts-1; i>=0; i-- )
- {
- if ( strcmp( rowText[i], NO_AMT_CELL_TEXT ) == 0 )
- continue;
- g_free( rowText[i] );
- }
}
- gtk_clist_thaw( ldd->revCL );
}
-
-static
-void
-ld_rev_clist_allocate_col_widths( GtkWidget *w,
- GtkAllocation *alloc,
- gpointer user_data )
-{
- LoanDruidData *ldd = (LoanDruidData*)user_data;
- gint i, evenWidth, width;
-
- width = alloc->width;
- /* The '-10' is to account for misc widget noise not accounted for by
- * the simple division. */
- evenWidth = (gint)(width / (ldd->ld.revNumPmts+1) ) - 10;
- gtk_clist_freeze( ldd->revCL );
- for ( i=0; i<ldd->ld.revNumPmts+1; i++ )
- {
- gtk_clist_set_column_width( ldd->revCL,
- i, evenWidth );
- }
- gtk_clist_thaw( ldd->revCL );
-}
Modified: gnucash/trunk/src/gnome/druid-stock-split.c
===================================================================
--- gnucash/trunk/src/gnome/druid-stock-split.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/druid-stock-split.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -47,6 +47,14 @@
#define DRUID_STOCK_SPLIT_CM_CLASS "druid-stock-split"
+enum split_cols {
+ SPLIT_COL_ACCOUNT = 0,
+ SPLIT_COL_FULLNAME,
+ SPLIT_COL_MNEMONIC,
+ SPLIT_COL_SHARES,
+ NUM_SPLIT_COLS
+};
+
/** structures *********************************************************/
typedef struct
{
@@ -54,7 +62,7 @@
GtkWidget * druid;
/* account page data */
- GtkWidget * account_list;
+ GtkWidget * account_view;
Account * acct;
/* info page data */
@@ -107,19 +115,23 @@
}
static int
-fill_account_list (StockSplitInfo *info, Account *account)
+fill_account_list (StockSplitInfo *info, Account *selected_account)
{
- GtkCList *clist;
+ GtkTreeRowReference *reference = NULL;
+ GtkTreeView *view;
+ GtkListStore *list;
+ GtkTreeIter iter;
+ GtkTreePath *path;
GList *accounts;
GList *node;
gint rows = 0;
+ gchar *full_name;
- clist = GTK_CLIST (info->account_list);
+ view = GTK_TREE_VIEW(info->account_view);
+ list = GTK_LIST_STORE(gtk_tree_view_get_model(view));
- gtk_clist_freeze (clist);
+ gtk_list_store_clear (list);
- gtk_clist_clear (clist);
-
accounts = xaccGroupGetSubAccountsSorted (gnc_get_current_group ());
for (node = accounts; node; node = node->next)
{
@@ -127,8 +139,6 @@
GNCPrintAmountInfo print_info;
const gnc_commodity *commodity;
gnc_numeric balance;
- char *strings[4];
- gint row;
if (!xaccAccountIsPriced(account))
continue;
@@ -142,59 +152,56 @@
commodity = xaccAccountGetCommodity (account);
+ full_name = xaccAccountGetFullName (account);
print_info = gnc_account_print_info (account, FALSE);
- strings[0] = xaccAccountGetFullName (account);
- strings[1] = (char *) gnc_commodity_get_mnemonic (commodity);
- strings[2] = (char *) xaccPrintAmount (balance, print_info);
- strings[3] = NULL;
+ gtk_list_store_append(list, &iter);
+ gtk_list_store_set(list, &iter,
+ SPLIT_COL_ACCOUNT, account,
+ SPLIT_COL_FULLNAME, full_name,
+ SPLIT_COL_MNEMONIC, gnc_commodity_get_mnemonic(commodity),
+ SPLIT_COL_SHARES, xaccPrintAmount(balance, print_info),
+ -1);
- row = gtk_clist_append (clist, strings);
+ if (account == selected_account) {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(list), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(list), path);
+ gtk_tree_path_free(path);
+ }
- gtk_clist_set_row_data (clist, row, account);
+ g_free (full_name);
- g_free (strings[0]);
-
rows++;
}
g_list_free(accounts);
- {
- gint row = 0;
-
- if (account)
- row = gtk_clist_find_row_from_data (clist, account);
-
- if (row < 0)
- row = 0;
-
- gtk_clist_select_row (GTK_CLIST (info->account_list), row, 0);
+ if (reference) {
+ GtkTreeSelection* selection = gtk_tree_view_get_selection(view);
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path) {
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
}
- gtk_clist_columns_autosize (clist);
-
- gtk_clist_thaw (clist);
-
return rows;
}
static void
-clist_select_row (GtkCList *clist,
- gint row,
- gint column,
- GdkEventButton *event,
- gpointer user_data)
+selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
{
StockSplitInfo *info = user_data;
- Account *account;
+ GtkTreeModel *list;
+ GtkTreeIter iter;
- account = gtk_clist_get_row_data (clist, row);
-
- /* Happens when the first row is inserted, before the row data can be added */
- if (account == NULL)
+ if (!gtk_tree_selection_get_selected(selection, &list, &iter))
return;
-
- info->acct = account;
+ gtk_tree_model_get(list, &iter,
+ SPLIT_COL_ACCOUNT, &info->acct,
+ -1);
}
static void
@@ -583,16 +590,42 @@
/* account list */
{
- GtkCList *clist;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
- info->account_list = glade_xml_get_widget (xml, "account_clist");
+ info->account_view = glade_xml_get_widget (xml, "account_view");
- clist = GTK_CLIST (info->account_list);
+ view = GTK_TREE_VIEW(info->account_view);
- gtk_clist_set_selection_mode (clist, GTK_SELECTION_BROWSE);
+ store = gtk_list_store_new(NUM_SPLIT_COLS, G_TYPE_POINTER, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
- g_signal_connect (clist, "select_row",
- G_CALLBACK (clist_select_row), info);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
+ "text", SPLIT_COL_FULLNAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Symbol"), renderer,
+ "text", SPLIT_COL_MNEMONIC,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Shares"), renderer,
+ "text", SPLIT_COL_SHARES,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (selection_changed), info);
}
/* info widgets */
Modified: gnucash/trunk/src/gnome/glade/account.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/account.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/glade/account.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -294,7 +294,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">account_scu</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -464,93 +463,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="account_scu">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Smallest fraction of this commodity that can be referenced.</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget1">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Use Commodity Value</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/10</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/100</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/1000</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/10000</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/100000</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1/1000000</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkScrolledWindow" id="scrolledwindow9">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -587,6 +499,38 @@
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkEventBox" id="eventbox1">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Smallest fraction of this commodity that can be referenced.</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="GtkComboBox" id="account_scu">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Use Commodity Value
+1
+1/10
+1/100
+1/1000
+1/10000
+1/100000
+1/1000000</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="left_attach">1</property>
Modified: gnucash/trunk/src/gnome/glade/fincalc.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/fincalc.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/glade/fincalc.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -910,116 +910,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="compounding_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget1">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tri-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget11">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (360)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (365)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkAlignment" id="alignment23">
<property name="visible">True</property>
<property name="xalign">0.5</property>
@@ -1082,7 +972,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">payment_menu</property>
</widget>
</child>
</widget>
@@ -1120,7 +1009,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">payment_menu</property>
</widget>
</child>
</widget>
@@ -1219,116 +1107,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="payment_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget13">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget14">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget15">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget16">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tri-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget17">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget18">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget19">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget23">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (360)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (365)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label797">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Compounding:</b></property>
@@ -1375,6 +1153,58 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="payment_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Annual
+Semi-annual
+Tri-annual
+Quarterly
+Bi-monthly
+Monthly
+Semi-monthly
+Bi-weekly
+Weekly
+Daily (360)
+Daily (365)</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="compounding_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Annual
+Semi-annual
+Tri-annual
+Quarterly
+Bi-monthly
+Monthly
+Semi-monthly
+Bi-weekly
+Weekly
+Daily (360)
+Daily (365)</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/gnome/glade/lots.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/lots.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/glade/lots.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -324,7 +324,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
+ <property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="lv_title_entry_changed_cb" last_modification_time="Sun, 22 May 2005 21:25:12 GMT"/>
</widget>
@@ -492,96 +492,18 @@
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="lot clist">
+ <widget class="GtkTreeView" id="lot view">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">A list of all of the lots in this account.</property>
<property name="can_focus">True</property>
- <property name="n_columns">5</property>
- <property name="column_widths">80,80,80,80,80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="lv_select_row_cb" last_modification_time="Sun, 22 May 2005 21:25:47 GMT"/>
- <signal name="unselect_row" handler="lv_unselect_row_cb" last_modification_time="Sun, 22 May 2005 21:26:02 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="label" translatable="yes">Opened</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="label" translatable="yes">Closed</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="label" translatable="yes">Title</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="label" translatable="yes">Balance</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="label" translatable="yes">Gains</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">False</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/sched-xact.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/glade/sched-xact.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -1069,119 +1069,28 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="freq_option">
+ <widget class="GtkComboBox" id="freq_combobox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget1">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">None</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Once</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily [M-F]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget11">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tri-Yearly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-Yearly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget13">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Yearly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">None
+Once
+Daily
+Daily [M-F]
+Weekly
+Bi-Weekly
+Semi-Monthly
+Monthly
+Quarterly
+Tri-Yearly
+Semi-Yearly
+Yearly</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
- <property name="y_options"></property>
+ <property name="y_options">fill</property>
</packing>
</child>
</widget>
@@ -1988,269 +1897,45 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="semimonthly_first">
+ <widget class="GtkComboBox" id="semimonthly_first">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget14">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget15">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget16">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget17">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget18">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget19">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget23">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget25">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget26">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget27">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget28">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget29">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget30">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget31">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget32">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget33">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget34">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget35">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget36">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget37">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget38">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget39">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget40">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget41">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget42">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget43">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget44">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget45">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
@@ -2289,264 +1974,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="semimonthly_second">
+ <widget class="GtkComboBox" id="semimonthly_second">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget46">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget47">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget48">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget49">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget50">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget51">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget52">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget53">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget54">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget55">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget56">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget57">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget58">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget59">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget60">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget61">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget62">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget63">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget64">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget65">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget66">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget67">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget68">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget69">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget70">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget71">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget72">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget73">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget74">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget75">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget76">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget77">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -2708,264 +2169,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="monthly_day">
+ <widget class="GtkComboBox" id="monthly_day">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget78">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget79">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget80">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget81">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget82">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget83">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget84">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget85">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget86">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget87">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget88">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget89">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget90">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget91">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget92">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget93">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget94">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget95">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget96">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget97">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget98">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget99">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget100">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget101">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget102">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget103">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget104">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget105">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget106">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget107">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget108">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget109">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3048,40 +2285,12 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="quarterly_occur">
+ <widget class="GtkComboBox" id="quarterly_occur">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget110">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget111">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Jan, Apr, Jul, Oct</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget112">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Feb, May, Aug, Nov</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget113">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Mar, Jun, Sep, Dec</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Jan, Apr, Jul, Oct
+Feb, May, Aug, Nov
+Mar, Jun, Sep, Dec</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3126,264 +2335,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="quarterly_day">
+ <widget class="GtkComboBox" id="quarterly_day">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget114">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget115">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget116">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget117">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget118">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget119">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget120">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget121">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget122">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget123">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget124">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget125">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget126">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget127">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget128">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget129">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget130">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget131">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget132">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget133">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget134">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget135">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget136">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget137">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget138">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget139">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget140">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget141">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget142">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget143">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget144">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget145">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3459,48 +2444,12 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="triyearly_occur">
+ <widget class="GtkComboBox" id="triyearly_occur">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget146">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget147">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Jan, May, Sep</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget148">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Feb, Jun, Oct</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget149">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Mar, Jul, Nov</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget150">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Apr, Aug, Dec</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Jan, May, Sep
+Feb, Jun, Oct
+Mar, Jul, Nov</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3545,264 +2494,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="triyearly_day">
+ <widget class="GtkComboBox" id="triyearly_day">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget151">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget152">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget153">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget154">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget155">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget156">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget157">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget158">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget159">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget160">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget161">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget162">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget163">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget164">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget165">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget166">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget167">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget168">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget169">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget170">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget171">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget172">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget173">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget174">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget175">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget176">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget177">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget178">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget179">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget180">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget181">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget182">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3878,64 +2603,15 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="semiyearly_occur">
+ <widget class="GtkComboBox" id="semiyearly_occur">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget183">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget184">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Jan, Jul</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget185">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Feb, Aug</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget186">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Mar, Sep</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget187">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Apr, Oct</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget188">
- <property name="visible">True</property>
- <property name="label" translatable="yes">May, Nov</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget189">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Jun, Dec</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Jan, Jul
+Feb, Aug
+Mar, Sep
+Apr, Oct
+May, Nov
+Jun, Dec</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3980,264 +2656,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="semiyearly_day">
+ <widget class="GtkComboBox" id="semiyearly_day">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget190">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget191">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget192">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget193">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget194">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget195">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget196">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget197">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget198">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget199">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget200">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget201">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget202">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget203">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget204">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget205">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget206">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget207">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget208">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget209">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget210">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget211">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget212">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget213">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget214">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget215">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget216">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget217">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget218">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget219">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget220">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget221">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -4388,112 +2840,21 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="yearly_month">
+ <widget class="GtkComboBox" id="yearly_month">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget222">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget223">
- <property name="visible">True</property>
- <property name="label" translatable="yes">January</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget224">
- <property name="visible">True</property>
- <property name="label" translatable="yes">February</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget225">
- <property name="visible">True</property>
- <property name="label" translatable="yes">March</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget226">
- <property name="visible">True</property>
- <property name="label" translatable="yes">April</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget227">
- <property name="visible">True</property>
- <property name="label" translatable="yes">May</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget228">
- <property name="visible">True</property>
- <property name="label" translatable="yes">June</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget229">
- <property name="visible">True</property>
- <property name="label" translatable="yes">July</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget230">
- <property name="visible">True</property>
- <property name="label" translatable="yes">August</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget231">
- <property name="visible">True</property>
- <property name="label" translatable="yes">September</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget232">
- <property name="visible">True</property>
- <property name="label" translatable="yes">October</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget233">
- <property name="visible">True</property>
- <property name="label" translatable="yes">November</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget234">
- <property name="visible">True</property>
- <property name="label" translatable="yes">December</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">January
+February
+March
+April
+May
+June
+July
+August
+September
+October
+November
+December</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -4538,264 +2899,40 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="yearly_day">
+ <widget class="GtkComboBox" id="yearly_day">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget235">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget236">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget237">
- <property name="visible">True</property>
- <property name="label" translatable="yes">2nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget238">
- <property name="visible">True</property>
- <property name="label" translatable="yes">3rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget239">
- <property name="visible">True</property>
- <property name="label" translatable="yes">4th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget240">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget241">
- <property name="visible">True</property>
- <property name="label" translatable="yes">6th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget242">
- <property name="visible">True</property>
- <property name="label" translatable="yes">7th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget243">
- <property name="visible">True</property>
- <property name="label" translatable="yes">8th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget244">
- <property name="visible">True</property>
- <property name="label" translatable="yes">9th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget245">
- <property name="visible">True</property>
- <property name="label" translatable="yes">10th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget246">
- <property name="visible">True</property>
- <property name="label" translatable="yes">11th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget247">
- <property name="visible">True</property>
- <property name="label" translatable="yes">12th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget248">
- <property name="visible">True</property>
- <property name="label" translatable="yes">13th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget249">
- <property name="visible">True</property>
- <property name="label" translatable="yes">14th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget250">
- <property name="visible">True</property>
- <property name="label" translatable="yes">15th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget251">
- <property name="visible">True</property>
- <property name="label" translatable="yes">16th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget252">
- <property name="visible">True</property>
- <property name="label" translatable="yes">17th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget253">
- <property name="visible">True</property>
- <property name="label" translatable="yes">18th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget254">
- <property name="visible">True</property>
- <property name="label" translatable="yes">19th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget255">
- <property name="visible">True</property>
- <property name="label" translatable="yes">20th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget256">
- <property name="visible">True</property>
- <property name="label" translatable="yes">21st</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget257">
- <property name="visible">True</property>
- <property name="label" translatable="yes">22nd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget258">
- <property name="visible">True</property>
- <property name="label" translatable="yes">23rd</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget259">
- <property name="visible">True</property>
- <property name="label" translatable="yes">24th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget260">
- <property name="visible">True</property>
- <property name="label" translatable="yes">25th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget261">
- <property name="visible">True</property>
- <property name="label" translatable="yes">26th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget262">
- <property name="visible">True</property>
- <property name="label" translatable="yes">27th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget263">
- <property name="visible">True</property>
- <property name="label" translatable="yes">28th</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget264">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[29th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget265">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[30th/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget266">
- <property name="visible">True</property>
- <property name="label" translatable="yes">[31st/last]</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">1st
+2nd
+3rd
+4th
+5th
+6th
+7th
+8th
+9th
+10th
+11th
+12th
+13th
+14th
+15th
+16th
+17th
+18th
+19th
+20th
+21st
+22nd
+23rd
+24th
+25th
+26th
+27th
+28th
+[29th/last]
+[30th/last]
+[31st/last]</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -5367,76 +3504,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="freq_option_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget269">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget270">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget271">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget272">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget273">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget274">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget275">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Yearly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -5456,6 +3523,27 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="freq_combo_box">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Daily
+Weekly
+Bi-Weekly
+Monthly
+Quarterly
+Yearly</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -6697,32 +4785,11 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="len_opt">
+ <widget class="GtkComboBox" id="len_opt">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget288">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget289">
- <property name="visible">True</property>
- <property name="label" translatable="yes">months</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget290">
- <property name="visible">True</property>
- <property name="label" translatable="yes">years</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">months
+years</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -6934,6 +5001,26 @@
<property name="y_options">expand|shrink|fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="type_combobox">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Fixed Rate
+3/1 Year ARM
+5/1 Year ARM
+7/1 Year ARM
+10/1 Year ARM</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -7898,48 +5985,13 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkOptionMenu" id="rev_range_opt">
+ <widget class="GtkComboBox" id="rev_range_opt">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget291">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget292">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Current Year</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget293">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Now + 1 Year</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget294">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Whole Loan</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget295">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Custom</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Current Year
+Now + 1 Year
+Whole Loan
+Custom</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -8644,6 +6696,7 @@
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">False</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/gnome/glade/stocks.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/stocks.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/glade/stocks.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -78,82 +78,23 @@
</child>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <widget class="GtkScrolledWindow" id="scrolledwindow22">
<property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow21">
+ <widget class="GtkTreeView" id="account_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkCList" id="account_clist">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">80,80,80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label847718">
- <property name="label" translatable="yes">Account</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847719">
- <property name="label" translatable="yes">Symbol</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847720">
- <property name="label" translatable="yes">Shares</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -73,6 +73,9 @@
#define PLUGIN_PAGE_ACCT_TREE_CM_CLASS "plugin-page-acct-tree"
#define GCONF_SECTION "window/pages/account_tree"
+#define DELETE_DIALOG_FILTER "filter"
+#define DELETE_DIALOG_ACCOUNT "account"
+
enum {
ACCOUNT_SELECTED,
LAST_SIGNAL
@@ -780,93 +783,43 @@
{
GtkWidget *button;
gpointer dmas, tmas;
+ gint dmas_cnt, tmas_cnt;
gboolean sensitive;
dmas = g_object_get_data(G_OBJECT(dialog), "dmas");
tmas = g_object_get_data(G_OBJECT(dialog), "tmas");
+ dmas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(dmas));
+ tmas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(tmas));
+
sensitive = (((NULL == dmas) ||
- (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(dmas)) ||
- GTK_LIST(GNC_ACCOUNT_SEL(dmas)->combo->list)->children)) &&
+ (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(dmas)) || dmas_cnt)) &&
((NULL == tmas) ||
- (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(tmas)) ||
- GTK_LIST(GNC_ACCOUNT_SEL(tmas)->combo->list)->children)));
+ (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(tmas)) || tmas_cnt)));
button = gnc_glade_lookup_widget(dialog, "deletebutton");
gtk_widget_set_sensitive(button, sensitive);
}
-/***
- *** GNCAccountSel has an odd habit of adding a
- *** blank item when its list is otherwise empty.
- ***/
-
static void
-exclude_account(GtkWidget *item,
- gpointer name)
-{
- char *text;
-
- gtk_label_get(GTK_LABEL(GTK_BIN(item)->child), &text);
- if ((0 == strlen(text)) || (0 == strcmp(text, name))) {
- gtk_widget_destroy(GTK_WIDGET(item));
- }
-}
-
-static void
-exclude_account_subtree(GtkWidget *item,
- gpointer prefix)
-{
- char *text;
-
- gtk_label_get(GTK_LABEL(GTK_BIN(item)->child), &text);
- if ((0 == strlen(text)) || 0 == strncmp(text, prefix, strlen(prefix))) {
- gtk_widget_destroy(GTK_WIDGET(item));
- }
-}
-
-static gint
-compare_listitem_text(gconstpointer item,
- gconstpointer entrytext)
-{
- char *text;
-
- gtk_label_get(GTK_LABEL(GTK_BIN(item)->child), &text);
- return strcmp(text, entrytext);
-}
-
-static void
gppat_populate_gas_list(GtkWidget *dialog,
GNCAccountSel *gas,
gboolean exclude_subaccounts)
{
- GtkList *list;
- GtkEntry *entry;
- gpointer name, filter;
+ Account *account;
+ GList *filter;
g_return_if_fail(GTK_IS_DIALOG(dialog));
if (gas == NULL)
return;
- list = GTK_LIST(gas->combo->list);
- entry = GTK_ENTRY(gas->combo->entry);
- name = g_object_get_data(G_OBJECT(dialog), "name");
- filter = g_object_get_data(G_OBJECT(dialog), "filter");
+ account = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_ACCOUNT);
+ filter = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_FILTER);
/* Setting the account type filter triggers GNCAccountSel population. */
gnc_account_sel_set_acct_filters (gas, filter);
/* Accounts to be deleted must be removed. */
- gtk_container_foreach(GTK_CONTAINER(list), (exclude_subaccounts ?
- exclude_account_subtree :
- exclude_account), name);
+ gnc_account_sel_purge_account( gas, account, exclude_subaccounts);
- /* The entry widget may need to be reset. */
- if (NULL == g_list_find_custom(list->children,
- gtk_entry_get_text(entry),
- compare_listitem_text)) {
- gtk_entry_set_text(entry, "");
- gtk_list_select_item(list, 0);
- }
-
/* The sensitivity of the OK button needs to be reevaluated. */
set_ok_sensitivity(GTK_WIDGET(dialog));
}
@@ -945,8 +898,8 @@
* type as the one being deleted.
*/
filter = g_list_prepend(NULL, (gpointer)xaccAccountGetType(account));
- g_object_set_data(G_OBJECT(dialog), "filter", filter);
- g_object_set_data(G_OBJECT(dialog), "name", acct_name);
+ g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_FILTER, filter);
+ g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_ACCOUNT, account);
/*
* Adjust the dialog based on whether the account has
Modified: gnucash/trunk/src/gnome/lot-viewer.c
===================================================================
--- gnucash/trunk/src/gnome/lot-viewer.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome/lot-viewer.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -21,14 +21,7 @@
* *
\********************************************************************/
-/* This uses the clist widget, which I know is deprecated in gnome2.
- * Sorry, I'll try to keep it real simple.
- *
- * For example: I'd like to allow the user to edit the lot
- * title 'in-place' in the clist, but gnome-1.2 does not allow
- * entry widgets in clist cells.
- *
- * XXX todo: The button "view lot in register" is not implemented.
+/* XXX todo: The button "view lot in register" is not implemented.
* it needs to open register window showing only the splits in the
* given lot ...
*
@@ -57,12 +50,15 @@
#define LOT_VIEWER_CM_CLASS "lot-viewer"
-#define OPEN_COL 0
-#define CLOSE_COL 1
-#define TITLE_COL 2
-#define BALN_COL 3
-#define GAINS_COL 4
-#define NUM_COLS 5
+enum lot_cols {
+ LOT_COL_OPEN = 0,
+ LOT_COL_CLOSE,
+ LOT_COL_TITLE,
+ LOT_COL_BALN,
+ LOT_COL_GAINS,
+ LOT_COL_PNTR,
+ NUM_LOT_COLS
+};
#define RESPONSE_VIEW 1
#define RESPONSE_DELETE 2
@@ -83,14 +79,14 @@
GtkButton * scrub_lot_button;
GtkPaned * lot_hpaned;
GtkPaned * lot_vpaned;
- GtkCList * lot_clist;
+ GtkTreeView * lot_view;
+ GtkListStore * lot_store;
GtkTextView * lot_notes;
GtkEntry * title_entry;
GtkCList * mini_clist;
Account * account;
GNCLot * selected_lot;
- int selected_row;
};
static void gnc_lot_viewer_fill (GNCLotViewer *lv);
@@ -98,16 +94,6 @@
/* ======================================================================== */
/* Callback prototypes */
-void lv_select_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data);
-void lv_unselect_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data);
void lv_title_entry_changed_cb (GtkEntry *ent, gpointer user_data);
void lv_response_cb (GtkDialog *dialog, gint response, gpointer data);
void lv_window_destroy_cb (GtkObject *object, gpointer user_data);
@@ -227,19 +213,12 @@
/* ======================================================================== */
/* Callback for selecting a row the the list-of-list clist */
-void
-lv_select_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data)
+static void
+lv_select_row (GNCLotViewer *lv,
+ GNCLot *lot)
{
- GNCLotViewer *lv = user_data;
- GNCLot *lot;
const char * str;
- lot = gtk_clist_get_row_data (clist, row);
-
str = gnc_lot_get_title (lot);
if (!str) str = "";
gtk_entry_set_text (lv->title_entry, str);
@@ -253,8 +232,6 @@
/* Don't set until end, to avoid recursion in gtkentry "changed" cb. */
lv->selected_lot = lot;
- lv->selected_row = row;
-
lv_show_splits (lv);
#ifdef LOTS_READY_FOR_SHOWTIME
@@ -271,7 +248,6 @@
{
/* Set immediately, to avoid recursion in gtkentry "changed" cb. */
lv->selected_lot = NULL;
- lv->selected_row = -1;
/* Blank the title widget */
gtk_entry_set_text (lv->title_entry, "");
@@ -294,27 +270,17 @@
/* ======================================================================== */
/* Callback for un-selecting a row the the list-of-list clist */
-void
-lv_unselect_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data)
+static void
+lv_unselect_row (GNCLotViewer *lv)
{
- GNCLotViewer *lv = user_data;
GNCLot *lot = lv->selected_lot;
const char * str;
char * notes;
- if (lv->selected_row < 0)
- return;
-
- /* Get the title, plunk it into ctree */
- str = gtk_entry_get_text (lv->title_entry);
- gtk_clist_set_text (lv->lot_clist, row, TITLE_COL, str);
-
if (lot)
{
+ /* Get the title, save_the_title */
+ str = gtk_entry_get_text (lv->title_entry);
gnc_lot_set_title (lot, str);
/* Get the notes, save the notes */
@@ -326,6 +292,23 @@
lv_unset_lot (lv);
}
+static void
+lv_selection_changed_cb (GtkTreeSelection *selection,
+ GNCLotViewer *lv)
+{
+ GNCLot *lot;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ gtk_tree_model_get(model, &iter, LOT_COL_PNTR, &lot, -1);
+ lv_select_row(lv, lot);
+ } else {
+ lv_unselect_row(lv);
+ }
+}
+
+
/* ======================================================================== */
/* Callback when user types a new lot title into the entry widget */
@@ -333,10 +316,16 @@
lv_title_entry_changed_cb (GtkEntry *ent, gpointer user_data)
{
GNCLotViewer *lv = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
const char * title;
title = gtk_entry_get_text (lv->title_entry);
- if (0 > lv->selected_row) return;
- gtk_clist_set_text (lv->lot_clist, lv->selected_row, TITLE_COL, title);
+
+ selection = gtk_tree_view_get_selection(lv->lot_view);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, LOT_COL_TITLE, title, -1);
+ }
}
/* ======================================================================== */
@@ -392,16 +381,23 @@
static void
gnc_lot_viewer_fill (GNCLotViewer *lv)
{
- int row;
LotList *lot_list, *node;
- GNCLot *selected_lot;
- int selected_row = -1;
+ GNCLot *this_lot, *selected_lot = NULL;
+ GtkListStore *store;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ gboolean found = FALSE;
lot_list = xaccAccountGetLotList (lv->account);
- selected_lot = lv->selected_lot;
- gtk_clist_freeze (lv->lot_clist);
- gtk_clist_clear (lv->lot_clist);
+ selection = gtk_tree_view_get_selection(lv->lot_view);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get(model, &iter, LOT_COL_PNTR, &selected_lot, -1);
+
+ /* Crazy. Should update in place if possible. */
+ gtk_list_store_clear (lv->lot_store);
+
for (node = lot_list; node; node=node->next)
{
char obuff[MAX_DATE_LENGTH];
@@ -415,11 +411,13 @@
gnc_numeric amt_baln = gnc_lot_get_balance (lot);
gnc_commodity *currency = find_first_currency (lot);
gnc_numeric gains_baln = get_realized_gains (lot, currency);
- const char *row_vals[NUM_COLS];
+ store = lv->lot_store;
+ gtk_list_store_append(store, &iter);
+
/* Opening date */
qof_print_date_buff (obuff, MAX_DATE_LENGTH, open_date);
- row_vals[OPEN_COL] = obuff;
+ gtk_list_store_set(store, &iter, LOT_COL_OPEN, obuff, -1);
/* Closing date */
if (gnc_lot_is_closed (lot))
@@ -429,43 +427,48 @@
time_t close_date = xaccTransGetDate (ftrans);
qof_print_date_buff (cbuff, MAX_DATE_LENGTH, close_date);
- row_vals[CLOSE_COL] = cbuff;
+ gtk_list_store_set(store, &iter, LOT_COL_CLOSE, cbuff, -1);
}
else
{
- row_vals[CLOSE_COL] = _("Open");
+ gtk_list_store_set(store, &iter, LOT_COL_CLOSE, cbuff, _("Open"), -1);
}
/* Title */
- row_vals[TITLE_COL] = gnc_lot_get_title (lot);
+ gtk_list_store_set(store, &iter, LOT_COL_TITLE, gnc_lot_get_title(lot), -1);
/* Amount */
xaccSPrintAmount (baln_buff, amt_baln,
gnc_account_print_info (lv->account, TRUE));
- row_vals[BALN_COL] = baln_buff;
+ gtk_list_store_set(store, &iter, LOT_COL_BALN, baln_buff, -1);
/* Capital Gains/Losses Appreciation/Depreciation */
xaccSPrintAmount (gain_buff, gains_baln,
gnc_commodity_print_info (currency, TRUE));
- row_vals[GAINS_COL] = gain_buff;
+ gtk_list_store_set(store, &iter, LOT_COL_GAINS, gain_buff, -1);
/* Self-reference */
- row = gtk_clist_append (lv->lot_clist, (char **)row_vals);
- gtk_clist_set_row_data (lv->lot_clist, row, lot);
- if (lot == selected_lot) selected_row = row;
+ gtk_list_store_set(store, &iter, LOT_COL_PNTR, lot, -1);
}
- gtk_clist_thaw (lv->lot_clist);
/* re-select the row that the user had previously selected,
* if possible. */
- if (-1 < selected_row)
- {
- gtk_clist_select_row (lv->lot_clist, selected_row, 1);
+ if (selected_lot) {
+ model = GTK_TREE_MODEL(lv->lot_store);
+ if (gtk_tree_model_get_iter_first(model, &iter)) {
+ do {
+ gtk_tree_model_get(model, &iter, LOT_COL_PNTR, &this_lot, -1);
+ if (this_lot == selected_lot) {
+ gtk_tree_selection_select_iter(selection, &iter);
+ found = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next(model, &iter));
+ }
}
- else
- {
- gtk_clist_unselect_all (lv->lot_clist);
- }
+
+ if (!found)
+ gtk_tree_selection_unselect_all(selection);
}
/* ======================================================================== */
@@ -584,6 +587,58 @@
/* ======================================================================== */
static void
+lv_init_lot_view (GNCLotViewer *lv)
+{
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ GtkCellRenderer *renderer;
+
+ g_return_if_fail(GTK_IS_TREE_VIEW(lv->lot_view));
+
+ view = lv->lot_view;
+ store = gtk_list_store_new(NUM_LOT_COLS, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+ lv->lot_store = store;
+
+ /* Set up the columns */
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Opened"), renderer,
+ "text", LOT_COL_OPEN, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Closed"), renderer,
+ "text", LOT_COL_CLOSE, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Title"), renderer,
+ "text", LOT_COL_TITLE, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Balance"), renderer,
+ "text", LOT_COL_BALN, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Gains"), renderer,
+ "text", LOT_COL_GAINS, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ /* Set up the selection callbacks */
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(lv_selection_changed_cb), lv);
+}
+
+/* ======================================================================== */
+
+static void
lv_create (GNCLotViewer *lv)
{
GladeXML *xml;
@@ -603,7 +658,8 @@
lv->delete_button = GTK_BUTTON(glade_xml_get_widget (xml, "delete button"));
lv->scrub_lot_button = GTK_BUTTON(glade_xml_get_widget (xml, "scrub lot button"));
- lv->lot_clist = GTK_CLIST(glade_xml_get_widget (xml, "lot clist"));
+ lv->lot_view = GTK_TREE_VIEW(glade_xml_get_widget (xml, "lot view"));
+ lv_init_lot_view(lv);
lv->lot_notes = GTK_TEXT_VIEW(glade_xml_get_widget (xml, "lot notes text"));
lv->title_entry = GTK_ENTRY (glade_xml_get_widget (xml, "lot title entry"));
@@ -620,19 +676,12 @@
lv->mini_clist = GTK_CLIST(glade_xml_get_widget (xml, "mini clist"));
lv->selected_lot = NULL;
- lv->selected_row = -1;
/* Setup signals */
glade_xml_signal_autoconnect_full( xml,
gnc_glade_autoconnect_full_func,
lv);
- g_signal_connect (lv->lot_clist, "select_row",
- G_CALLBACK (lv_select_row_cb), lv);
-
- g_signal_connect (lv->lot_clist, "unselect_row",
- G_CALLBACK (lv_unselect_row_cb), lv);
-
gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(lv->window));
}
Modified: gnucash/trunk/src/gnome-search/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-search/Makefile.am 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/Makefile.am 2006-08-02 18:13:30 UTC (rev 14588)
@@ -27,6 +27,7 @@
search-account.c \
search-boolean.c \
search-core-type.c \
+ search-core-utils.c \
search-date.c \
search-double.c \
search-int64.c \
@@ -43,6 +44,7 @@
search-account.h \
search-boolean.h \
search-core-type.h \
+ search-core-utils.h \
search-date.h \
search-double.h \
search-int64.h \
Modified: gnucash/trunk/src/gnome-search/dialog-search.c
===================================================================
--- gnucash/trunk/src/gnome-search/dialog-search.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/dialog-search.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
* Copyright (C) 2002 Derek Atkins
* Author: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -52,6 +54,12 @@
GNC_SEARCH_MATCH_ANY = 1
} GNCSearchType;
+enum search_cols {
+ SEARCH_COL_NAME = 0,
+ SEARCH_COL_POINTER,
+ NUM_SEARCH_COLS
+};
+
struct _GNCSearchWindow {
GtkWidget * dialog;
GtkWidget * criteria_table;
@@ -298,18 +306,12 @@
}
static void
-match_all (GtkWidget *widget, GNCSearchWindow *sw)
+match_combo_changed (GtkComboBox *combo_box, GNCSearchWindow *sw)
{
- sw->grouping = GNC_SEARCH_MATCH_ALL;
+ sw->grouping = gtk_combo_box_get_active(combo_box);
}
static void
-match_any (GtkWidget *widget, GNCSearchWindow *sw)
-{
- sw->grouping = GNC_SEARCH_MATCH_ANY;
-}
-
-static void
search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
GSList * buttongroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON(button));
@@ -557,11 +559,18 @@
}
static void
-option_activate (GtkMenuItem *item, struct _crit_data *data)
+combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
{
- GNCSearchParam *param = g_object_get_data (G_OBJECT (item), "param");
+ GNCSearchParam *param;
GNCSearchCoreType *newelem;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (!gtk_combo_box_get_active_iter(combo_box, &iter))
+ return;
+ model = gtk_combo_box_get_model(combo_box);
+ gtk_tree_model_get(model, &iter, SEARCH_COL_POINTER, ¶m, -1);
+
if (gnc_search_param_type_match (param, data->param)) {
/* The param type is the same, just save the new param */
data->param = param;
@@ -614,7 +623,10 @@
static GtkWidget *
get_element_widget (GNCSearchWindow *sw, GNCSearchCoreType *element)
{
- GtkWidget *menu, *item, *omenu, *hbox, *p;
+ GtkWidget *combo_box, *hbox, *p;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkCellRenderer *cell;
GList *l;
struct _crit_data *data;
int index = 0, current = 0;
@@ -632,27 +644,34 @@
data->container = hbox;
data->param = sw->last_param;
- menu = gtk_menu_new ();
+ store = gtk_list_store_new(NUM_SEARCH_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+
+ cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
+ "text", SEARCH_COL_NAME,
+ NULL);
+
for (l = sw->params_list; l; l = l->next) {
GNCSearchParam *param = l->data;
- item = gtk_menu_item_new_with_label (_(param->title));
- g_object_set_data (G_OBJECT (item), "param", param);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_activate), data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ SEARCH_COL_NAME, _(param->title),
+ SEARCH_COL_POINTER, param,
+ -1);
+
if (param == sw->last_param) /* is this the right parameter to start? */
current = index;
index++;
}
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
- gtk_widget_show (omenu);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box), current);
+ g_signal_connect (combo_box, "changed", G_CALLBACK (combo_box_changed), data);
- gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), combo_box, FALSE, FALSE, 0);
if (p)
gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
@@ -748,7 +767,7 @@
{
GladeXML *xml;
GtkWidget *label, *add, *box;
- GtkWidget *menu, *item, *omenu;
+ GtkComboBox *combo_box;
GtkWidget *new_item_button;
const char * type_label;
gboolean active;
@@ -782,25 +801,14 @@
gtk_box_pack_start (GTK_BOX (box), add, FALSE, FALSE, 3);
/* Set the match-type menu */
- menu = gtk_menu_new ();
+ combo_box = GTK_COMBO_BOX(gtk_combo_box_new_text());
+ gtk_combo_box_append_text(combo_box, _("all criteria are met"));
+ gtk_combo_box_append_text(combo_box, _("any criteria are met"));
+ gtk_combo_box_set_active(combo_box, sw->grouping);
+ g_signal_connect(combo_box, "changed", G_CALLBACK (match_combo_changed), sw);
- item = gtk_menu_item_new_with_label (_("all criteria are met"));
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (match_all), sw);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- item = gtk_menu_item_new_with_label (_("any criteria are met"));
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (match_any), sw);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), sw->grouping);
-
- gtk_widget_show (omenu);
box = glade_xml_get_widget (xml, "type_menu_box");
- gtk_box_pack_start (GTK_BOX (box), omenu, FALSE, FALSE, 3);
+ gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET(combo_box), FALSE, FALSE, 3);
/* if there's no original query, make the narrow, add, delete
* buttons inaccessible */
Modified: gnucash/trunk/src/gnome-search/search-account.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-account.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-account.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -31,6 +33,7 @@
#include "gnc-gui-query.h"
#include "search-account.h"
+#include "search-core-utils.h"
#define d(x)
@@ -172,58 +175,30 @@
return valid;
}
-static void
-option_changed (GtkWidget *widget, GNCSearchAccount *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchAccount *fi = (GNCSearchAccount *)fe;
GNCSearchAccountPrivate *priv;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
+ int initial = 0;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
priv = _PRIVATE(fi);
if (priv->match_all) {
- ADD_MENU_ITEM (_("matches all accounts"), GUID_MATCH_ALL);
- first = item;
+ gnc_combo_box_search_add(combo, _("matches all accounts"), GUID_MATCH_ALL);
+ initial = GUID_MATCH_ALL;
} else {
- ADD_MENU_ITEM (_("matches any account"), GUID_MATCH_ANY);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("matches no accounts"), GUID_MATCH_NONE);
+ gnc_combo_box_search_add(combo, _("matches any account"), GUID_MATCH_ANY);
+ gnc_combo_box_search_add(combo, _("matches no accounts"), GUID_MATCH_NONE);
+ initial = GUID_MATCH_ANY;
}
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : initial);
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static char *
Modified: gnucash/trunk/src/gnome-search/search-boolean.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-boolean.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-boolean.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -28,6 +30,7 @@
#include "QueryCore.h"
#include "search-boolean.h"
+#include "search-core-utils.h"
#define d(x)
@@ -159,56 +162,24 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchBoolean *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
toggle_changed (GtkToggleButton *button, GNCSearchBoolean *fe)
{
fe->value = gtk_toggle_button_get_active (button);
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchBoolean *fi = (GNCSearchBoolean *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("is"), COMPARE_EQUAL);
+ gnc_combo_box_search_add(combo, _("is not"), COMPARE_NEQ);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : COMPARE_EQUAL);
- ADD_MENU_ITEM (_("is"), COMPARE_EQUAL);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("is not"), COMPARE_NEQ);
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static GtkWidget *
Added: gnucash/trunk/src/gnome-search/search-core-utils.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-core-utils.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-core-utils.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -0,0 +1,138 @@
+/*
+ * search-core-utils.c -- common functions for search code
+ * Copyright (C) 2006 David Hampton <hampton at employees.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "search-core-utils.h"
+
+
+static void
+search_combo_changed (GtkWidget *widget, gint *value)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+ g_return_if_fail(value);
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
+ return;
+
+ gtk_tree_model_get(model, &iter,
+ GNC_COMBO_SEARCH_COL_VALUE, value,
+ -1);
+}
+
+GtkWidget *
+gnc_combo_box_new_search (void)
+{
+ GtkWidget *combo;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+
+ store = gtk_list_store_new(NUM_GNC_COMBO_SEARCH_COLS, G_TYPE_STRING, G_TYPE_UINT);
+ combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
+ "text", GNC_COMBO_SEARCH_COL_TEXT,
+ NULL);
+ return combo;
+}
+
+void
+gnc_combo_box_search_add (GtkComboBox *combo, const gchar *text, guint value)
+{
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+ g_return_if_fail(GTK_IS_COMBO_BOX(combo));
+ g_return_if_fail(text);
+
+ store = GTK_LIST_STORE(gtk_combo_box_get_model(combo));
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ GNC_COMBO_SEARCH_COL_TEXT, text,
+ GNC_COMBO_SEARCH_COL_VALUE, value,
+ -1);
+}
+
+guint
+gnc_combo_box_search_get_active (GtkComboBox *combo)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ guint value;
+
+ g_return_val_if_fail(GTK_IS_COMBO_BOX(combo), 0);
+
+ model = gtk_combo_box_get_model(combo);
+ if (!gtk_combo_box_get_active_iter(combo, &iter))
+ return 0;
+
+ gtk_tree_model_get(model, &iter,
+ GNC_COMBO_SEARCH_COL_VALUE, &value,
+ -1);
+ return value;
+}
+
+void
+gnc_combo_box_search_set_active (GtkComboBox *combo, guint value)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ guint row_value = 0;
+
+ g_return_if_fail(GTK_IS_COMBO_BOX(combo));
+
+ model = gtk_combo_box_get_model(combo);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
+
+ do {
+ gtk_tree_model_get(model, &iter,
+ GNC_COMBO_SEARCH_COL_VALUE, &row_value,
+ -1);
+ if (value == row_value) {
+ gtk_combo_box_set_active_iter(combo, &iter);
+ return;
+ }
+ } while (gtk_tree_model_iter_next(model, &iter));
+
+ /* No match found. Select the first item. */
+ gtk_combo_box_set_active(combo, 0);
+}
+
+void
+gnc_combo_box_search_changed(GtkComboBox *combo, guint *value)
+{
+ g_signal_connect (combo, "changed",
+ G_CALLBACK (search_combo_changed), value);
+}
Added: gnucash/trunk/src/gnome-search/search-core-utils.h
===================================================================
--- gnucash/trunk/src/gnome-search/search-core-utils.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-core-utils.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -0,0 +1,38 @@
+/*
+ * search-core-utils.h -- common functions for search code
+ * Copyright (C) 2006 David Hampton <hampton at employees.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ *
+ */
+
+/* Functions for creating the common two column GtkComboBox used by
+ * all the search widgets. */
+
+enum gnc_combo_search_cols {
+ GNC_COMBO_SEARCH_COL_TEXT = 0,
+ GNC_COMBO_SEARCH_COL_VALUE,
+ NUM_GNC_COMBO_SEARCH_COLS,
+};
+
+GtkWidget *gnc_combo_box_new_search (void);
+void gnc_combo_box_search_add (GtkComboBox *combo, const gchar *text, guint value);
+guint gnc_combo_box_search_get_active (GtkComboBox *combo);
+void gnc_combo_box_search_set_active (GtkComboBox *combo, guint value);
+void gnc_combo_box_search_changed(GtkComboBox *combo, guint *value);
+
Modified: gnucash/trunk/src/gnome-search/search-date.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-date.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-date.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -30,6 +32,7 @@
#include "QueryCore.h"
#include "search-date.h"
+#include "search-core-utils.h"
#define d(x)
@@ -172,60 +175,29 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchDate *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
date_changed (GNCDateEdit *date_edit, GNCSearchDate *fe)
{
fe->ts = gnc_date_edit_get_date_ts (date_edit);
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK(option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
- ADD_MENU_ITEM (_("is before"), COMPARE_LT);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("is before or on"), COMPARE_LTE);
- ADD_MENU_ITEM (_("is on"), COMPARE_EQUAL);
- ADD_MENU_ITEM (_("is not on"), COMPARE_NEQ);
- ADD_MENU_ITEM (_("is after"), COMPARE_GT);
- ADD_MENU_ITEM (_("is on or after"), COMPARE_GTE);
+ gnc_combo_box_search_add(combo, _("is before"), COMPARE_LT);
+ gnc_combo_box_search_add(combo, _("is before or on"), COMPARE_LTE);
+ gnc_combo_box_search_add(combo, _("is on"), COMPARE_EQUAL);
+ gnc_combo_box_search_add(combo, _("is not on"), COMPARE_NEQ);
+ gnc_combo_box_search_add(combo, _("is after"), COMPARE_GT);
+ gnc_combo_box_search_add(combo, _("is on or after"), COMPARE_GTE);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : COMPARE_LT);
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static void
Modified: gnucash/trunk/src/gnome-search/search-double.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-double.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-double.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,7 @@
#include "QueryCore.h"
#include "search-double.h"
+#include "search-core-utils.h"
#define d(x)
@@ -164,60 +167,29 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchDouble *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
entry_changed (GNCAmountEdit *entry, GNCSearchDouble *fe)
{
fe->value = gnc_amount_edit_get_damount (entry);
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GtkWidget *menu, *item, *first = NULL, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
- ADD_MENU_ITEM (_("is less than"), COMPARE_LT);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("is less than or equal to"), COMPARE_LTE);
- ADD_MENU_ITEM (_("equals"), COMPARE_EQUAL);
- ADD_MENU_ITEM (_("does not equal"), COMPARE_NEQ);
- ADD_MENU_ITEM (_("is greater than"), COMPARE_GT);
- ADD_MENU_ITEM (_("is greater than or equal to"), COMPARE_GTE);
+ gnc_combo_box_search_add(combo, _("is less than"), COMPARE_LT);
+ gnc_combo_box_search_add(combo, _("is less than or equal to"), COMPARE_LTE);
+ gnc_combo_box_search_add(combo, _("equals"), COMPARE_EQUAL);
+ gnc_combo_box_search_add(combo, _("does not equal"), COMPARE_NEQ);
+ gnc_combo_box_search_add(combo, _("is greater than"), COMPARE_GT);
+ gnc_combo_box_search_add(combo, _("is greater than or equal to"), COMPARE_GTE);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : COMPARE_LT);
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static void
Modified: gnucash/trunk/src/gnome-search/search-int64.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-int64.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-int64.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,7 @@
#include "QueryCore.h"
#include "search-int64.h"
+#include "search-core-utils.h"
#define d(x)
@@ -165,13 +168,6 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchInt64 *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
entry_changed (GNCAmountEdit *entry, GNCSearchInt64 *fe)
{
gnc_numeric value = gnc_amount_edit_get_amount (entry);
@@ -180,47 +176,22 @@
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GtkWidget *menu, *item, *first = NULL, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("is less than"), COMPARE_LT);
+ gnc_combo_box_search_add(combo, _("is less than or equal to"), COMPARE_LTE);
+ gnc_combo_box_search_add(combo, _("equals"), COMPARE_EQUAL);
+ gnc_combo_box_search_add(combo, _("does not equal"), COMPARE_NEQ);
+ gnc_combo_box_search_add(combo, _("is greater than"), COMPARE_GT);
+ gnc_combo_box_search_add(combo, _("is greater than or equal to"), COMPARE_GTE);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : COMPARE_LT);
- ADD_MENU_ITEM (_("is less than"), COMPARE_LT);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("is less than or equal to"), COMPARE_LTE);
- ADD_MENU_ITEM (_("equals"), COMPARE_EQUAL);
- ADD_MENU_ITEM (_("does not equal"), COMPARE_NEQ);
- ADD_MENU_ITEM (_("is greater than"), COMPARE_GT);
- ADD_MENU_ITEM (_("is greater than or equal to"), COMPARE_GTE);
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static void
Modified: gnucash/trunk/src/gnome-search/search-numeric.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-numeric.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-numeric.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,7 @@
#include "QueryCore.h"
#include "search-numeric.h"
+#include "search-core-utils.h"
#define d(x)
@@ -194,109 +197,62 @@
}
static void
-how_option_changed (GtkWidget *widget, GNCSearchNumeric *fe)
-{
- fe->how = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
-option_changed (GtkWidget *widget, GNCSearchNumeric *fe)
-{
- fe->option = (query_compare_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
entry_changed (GNCAmountEdit *entry, GNCSearchNumeric *fe)
{
fe->value = gnc_amount_edit_get_amount (entry);
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- query_compare_t option, GCallback fcn)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", fcn, user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(cmp,str,op,fcn) { \
- item = add_menu_item (menu, fe, str, op, fcn); \
- if (cmp == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_how_menu (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
GNCSearchNumericPrivate *priv;
- GtkWidget *menu, *item, *first = NULL, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
-
priv = _PRIVATE(fi);
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("less than") : _("is less than")),
- COMPARE_LT, G_CALLBACK (how_option_changed));
- first = item; /* Force one */
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("less than or equal to") :
- _("is less than or equal to")),
- COMPARE_LTE, G_CALLBACK (how_option_changed));
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("equal to") : _("equals")),
- COMPARE_EQUAL, G_CALLBACK (how_option_changed));
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("not equal to") : _("does not equal")),
- COMPARE_NEQ, G_CALLBACK (how_option_changed));
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("greater than") : _("is greater than")),
- COMPARE_GT, G_CALLBACK (how_option_changed));
- ADD_MENU_ITEM (fi->how, (priv->is_debcred ?
- _("greater than or equal to") :
- _("is greater than or equal to")),
- COMPARE_GTE, G_CALLBACK (how_option_changed));
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("less than") : _("is less than")),
+ COMPARE_LT);
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("less than or equal to") :
+ _("is less than or equal to")),
+ COMPARE_LTE);
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("equal to") : _("equals")),
+ COMPARE_EQUAL);
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("not equal to") : _("does not equal")),
+ COMPARE_NEQ);
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("greater than") : _("is greater than")),
+ COMPARE_GT);
+ gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ _("greater than or equal to") :
+ _("is greater than or equal to")),
+ COMPARE_GTE);
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : COMPARE_LT);
- return opmenu;
+ return GTK_WIDGET(combo);
}
static GtkWidget *
make_option_menu (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("has credits or debits"), NUMERIC_MATCH_ANY);
+ gnc_combo_box_search_add(combo, _("has debits"), NUMERIC_MATCH_DEBIT);
+ gnc_combo_box_search_add(combo, _("has credits"), NUMERIC_MATCH_CREDIT);
+ gnc_combo_box_search_changed(combo, &fi->option);
+ gnc_combo_box_search_set_active(combo, fi->option ? fi->option : NUMERIC_MATCH_ANY);
- ADD_MENU_ITEM (fi->option, _("has credits or debits"), NUMERIC_MATCH_ANY,
- G_CALLBACK (option_changed));
- first = item; /* Force one */
- ADD_MENU_ITEM (fi->option, _("has debits"), NUMERIC_MATCH_DEBIT,
- G_CALLBACK (option_changed));
- ADD_MENU_ITEM (fi->option, _("has credits"), NUMERIC_MATCH_CREDIT,
- G_CALLBACK (option_changed));
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static void
Modified: gnucash/trunk/src/gnome-search/search-reconciled.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-reconciled.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-reconciled.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,7 @@
#include "Transaction.h" /* for ?REC */
#include "search-reconciled.h"
+#include "search-core-utils.h"
#define d(x)
@@ -160,13 +163,6 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchReconciled *fe)
-{
- fe->how = (char_match_t)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
toggle_changed (GtkToggleButton *button, GNCSearchReconciled *fe)
{
gboolean is_on = gtk_toggle_button_get_active (button);
@@ -180,43 +176,18 @@
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- char_match_t option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-#define ADD_MENU_ITEM(str,op) { \
- item = add_menu_item (menu, fe, str, op); \
- if (fi->how == op) { current = index; first = item; } \
- index++; \
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchReconciled *fi = (GNCSearchReconciled *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0, index = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+ gnc_combo_box_search_add(combo, _("is"), CHAR_MATCH_ANY);
+ gnc_combo_box_search_add(combo, _("is not"), CHAR_MATCH_NONE);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : CHAR_MATCH_ANY);
- ADD_MENU_ITEM (_("is"), CHAR_MATCH_ANY);
- first = item; /* Force one */
- ADD_MENU_ITEM (_("is not"), CHAR_MATCH_NONE);
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static GtkWidget *
Modified: gnucash/trunk/src/gnome-search/search-string.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-string.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-search/search-string.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,8 @@
*
* Authors: Derek Atkins <warlord at MIT.EDU>
*
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,7 @@
#include <regex.h>
#include "search-string.h"
+#include "search-core-utils.h"
#include "QueryCore.h"
#define d(x)
@@ -235,13 +238,6 @@
}
static void
-option_changed (GtkWidget *widget, GNCSearchString *fe)
-{
- fe->how = (GNCSearchString_Type)
- g_object_get_data (G_OBJECT (widget), "option");
-}
-
-static void
entry_changed (GtkEntry *entry, GNCSearchString *fe)
{
const char *new;
@@ -251,49 +247,22 @@
}
static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- GNCSearchString_Type option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label (label);
- g_object_set_data (G_OBJECT (item), "option", (gpointer) option);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_changed), user_data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
- return item;
-}
-
-static GtkWidget *
make_menu (GNCSearchCoreType *fe)
{
GNCSearchString *fi = (GNCSearchString *)fe;
- GtkWidget *menu, *item, *first, *opmenu;
- int current = 0;
+ GtkComboBox *combo;
- menu = gtk_menu_new ();
+ combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
- item = add_menu_item (menu, fe, _("contains"), SEARCH_STRING_CONTAINS);
- first = item;
+ gnc_combo_box_search_add(combo, _("contains"), SEARCH_STRING_CONTAINS);
+ gnc_combo_box_search_add(combo, _("matches regex"),
+ SEARCH_STRING_MATCHES_REGEX);
+ gnc_combo_box_search_add(combo, _("does not match regex"),
+ SEARCH_STRING_NOT_MATCHES_REGEX);
+ gnc_combo_box_search_changed(combo, &fi->how);
+ gnc_combo_box_search_set_active(combo, fi->how ? fi->how : SEARCH_STRING_CONTAINS);
- item = add_menu_item (menu, fe, _("does not contain"),
- SEARCH_STRING_NOT_CONTAINS);
- if (fi->how == SEARCH_STRING_NOT_CONTAINS) { current = 1; first = item; }
-
- item = add_menu_item (menu, fe, _("matches regex"),
- SEARCH_STRING_MATCHES_REGEX);
- if (fi->how == SEARCH_STRING_MATCHES_REGEX) { current = 2; first = item; }
-
- item = add_menu_item (menu, fe, _("does not match regex"),
- SEARCH_STRING_NOT_MATCHES_REGEX);
- if (fi->how == SEARCH_STRING_NOT_MATCHES_REGEX)
- { current = 3; first = item; }
-
- opmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (opmenu), menu);
-
- g_signal_emit_by_name (G_OBJECT (first), "activate", fe);
- gtk_option_menu_set_history (GTK_OPTION_MENU (opmenu), current);
-
- return opmenu;
+ return GTK_WIDGET(combo);
}
static void
Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -54,6 +54,14 @@
#define DIALOG_EDIT_ACCOUNT_CM_CLASS "dialog-edit-account"
#define GCONF_SECTION "dialogs/account"
+enum account_cols {
+ ACCOUNT_COL_FULLNAME = 0,
+ ACCOUNT_COL_FIELDNAME,
+ ACCOUNT_COL_OLD_VALUE,
+ ACCOUNT_COL_NEW_VALUE,
+ NUM_ACCOUNT_COLS
+};
+
typedef enum
{
NEW_ACCOUNT,
@@ -211,7 +219,7 @@
} else {
index = 0;
}
- gtk_option_menu_set_history(GTK_OPTION_MENU(aw->account_scu), index);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(aw->account_scu), index);
string = xaccAccountGetCode (account);
if (string == NULL) string = "";
@@ -338,7 +346,7 @@
old_scu = xaccAccountGetCommoditySCU(account);
}
- index = gnc_option_menu_get_active(aw->account_scu);
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(aw->account_scu));
nonstd = (index != 0);
if (nonstd != xaccAccountGetNonStdSCU(account))
xaccAccountSetNonStdSCU(account, nonstd);
@@ -556,7 +564,7 @@
typedef struct
{
Account *account;
- GtkCList *list;
+ GtkListStore *list;
guint count;
} FillStruct;
@@ -566,49 +574,32 @@
Account *account = key;
FillStruct *fs = data;
gchar *full_name;
- gchar *account_field_name;
- gchar *account_field_value;
- gchar *value_str;
+ const gchar *account_field_name;
+ const gchar *account_field_value;
+ const gchar *value_str;
+ GtkTreeIter iter;
if (fs == NULL) return;
if (fs->account == account) return;
full_name = xaccAccountGetFullName(account);
- if(!full_name)
- full_name = g_strdup("");
+ account_field_name = "Type";
+ account_field_value = xaccAccountGetTypeStr(xaccAccountGetType(account));
+ value_str = xaccAccountGetTypeStr(GPOINTER_TO_INT(value));
- account_field_name = g_strdup("Type");
- if (!account_field_name)
- account_field_name = g_strdup("");
-
- account_field_value =
- g_strdup (xaccAccountGetTypeStr(xaccAccountGetType(account)));
- if (!account_field_value)
- account_field_value = g_strdup("");
-
- value_str = g_strdup(xaccAccountGetTypeStr(GPOINTER_TO_INT(value)));
-
- {
- gchar *strings[5];
-
- strings[0] = full_name;
- strings[1] = account_field_name;
- strings[2] = account_field_value;
- strings[3] = value_str;
- strings[4] = NULL;
-
- gtk_clist_append(fs->list, strings);
- }
-
+ gtk_list_store_append(fs->list, &iter);
+ gtk_list_store_set(fs->list, &iter,
+ ACCOUNT_COL_FULLNAME, full_name,
+ ACCOUNT_COL_FIELDNAME, account_field_name,
+ ACCOUNT_COL_OLD_VALUE, account_field_value,
+ ACCOUNT_COL_NEW_VALUE, value_str,
+ -1);
g_free(full_name);
- g_free(account_field_name);
- g_free(account_field_value);
- g_free(value_str);
fs->count++;
}
static guint
-fill_list(Account *account, GtkCList *list,
+fill_list(Account *account, GtkListStore *list,
GHashTable *change)
{
FillStruct fs;
@@ -632,8 +623,10 @@
GHashTable *change_type)
{
Account *account;
- GtkCList *list;
- gchar *titles[5];
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeView *view;
+ GtkListStore *store;
gboolean result;
guint size;
@@ -644,28 +637,47 @@
if (!account)
return FALSE;
- titles[0] = _("Account");
- titles[1] = _("Field");
- titles[2] = _("Old Value");
- titles[3] = _("New Value");
- titles[4] = NULL;
+ store = gtk_list_store_new(NUM_ACCOUNT_COLS, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING);
- list = GTK_CLIST(gtk_clist_new_with_titles(4, titles));
-
size = 0;
- size += fill_list(account, list, change_type);
+ size += fill_list(account, GTK_LIST_STORE(store), change_type);
if (size == 0)
{
- gtk_widget_destroy(GTK_WIDGET(list));
+ gtk_widget_destroy(GTK_WIDGET(store));
return TRUE;
}
- gtk_clist_column_titles_passive(list);
- gtk_clist_set_sort_column(list, 0);
- gtk_clist_sort(list);
- gtk_clist_columns_autosize(list);
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store),
+ ACCOUNT_COL_FULLNAME,
+ GTK_SORT_ASCENDING);
+ view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
+ "text", ACCOUNT_COL_FULLNAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Field"), renderer,
+ "text", ACCOUNT_COL_FIELDNAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Old Value"), renderer,
+ "text", ACCOUNT_COL_OLD_VALUE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("New Value"), renderer,
+ "text", ACCOUNT_COL_NEW_VALUE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
{
GtkWidget *dialog;
GtkWidget *scroll;
@@ -699,7 +711,7 @@
gtk_container_add(GTK_CONTAINER(frame), scroll);
gtk_container_set_border_width(GTK_CONTAINER(scroll), 5);
- gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(list));
+ gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(view));
gtk_widget_show_all(vbox);
@@ -1277,7 +1289,6 @@
G_CALLBACK (commodity_changed_cb), aw);
aw->account_scu = glade_xml_get_widget (xml, "account_scu");
- gnc_option_menu_init(aw->account_scu);
box = glade_xml_get_widget (xml, "parent_scroll");
Modified: gnucash/trunk/src/gnome-utils/dialog-commodity.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-commodity.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/dialog-commodity.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -42,18 +42,23 @@
#include "dialog-commodity.h"
#include "dialog-utils.h"
#include "gnc-engine.h"
+#include "gnc-gtk-utils.h"
#include "gnc-gui-query.h"
#include "gnc-ui-util.h"
#include "gnc-ui.h"
static QofLogModule log_module = GNC_MOD_GUI;
+enum {
+ SOURCE_COL_NAME = 0,
+ SOURCE_COL_FQ_SUPPORTED,
+ NUM_SOURCE_COLS
+};
+
struct select_commodity_window {
GtkWidget * dialog;
GtkWidget * namespace_combo;
- GtkWidget * namespace_entry;
GtkWidget * commodity_combo;
- GtkWidget * commodity_entry;
GtkWidget * select_user_prompt;
GtkWidget * ok_button;
@@ -102,9 +107,9 @@
dialog_commodity_mode mode);
void gnc_ui_select_commodity_new_cb(GtkButton * button,
gpointer user_data);
-void gnc_ui_select_commodity_changed_cb(GtkEditable * entry,
+void gnc_ui_select_commodity_changed_cb(GtkComboBoxEntry *cbe,
gpointer user_data);
-void gnc_ui_select_commodity_namespace_changed_cb(GtkEditable * entry,
+void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBoxEntry *cbe,
gpointer user_data);
/* The commodity creation window */
@@ -229,7 +234,8 @@
{
SelectCommodityWindow * retval = g_new0(SelectCommodityWindow, 1);
GladeXML *xml;
- const char * namespace, *title, *text;
+ const char *title, *text;
+ gchar *namespace;
GtkWidget *button, *label;
xml = gnc_glade_xml_new ("commodity.glade", "Security Selector Dialog");
@@ -238,13 +244,17 @@
retval );
retval->dialog = glade_xml_get_widget (xml, "Security Selector Dialog");
- retval->namespace_combo = glade_xml_get_widget (xml, "namespace_combo");
- retval->commodity_combo = glade_xml_get_widget (xml, "commodity_combo");
- retval->commodity_entry = glade_xml_get_widget (xml, "commodity_entry");
+ retval->namespace_combo = glade_xml_get_widget (xml, "namespace_cbe");
+ retval->commodity_combo = glade_xml_get_widget (xml, "commodity_cbe");
retval->select_user_prompt = glade_xml_get_widget (xml, "select_user_prompt");
retval->ok_button = glade_xml_get_widget (xml, "ok_button");
label = glade_xml_get_widget (xml, "item_label");
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(retval->namespace_combo), 0);
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(retval->commodity_combo), 0);
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->namespace_combo));
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->commodity_combo));
+
gtk_label_set_text (GTK_LABEL (retval->select_user_prompt), "");
#ifdef DRH
@@ -275,12 +285,13 @@
gtk_label_set_text_with_mnemonic (GTK_LABEL(label), text);
/* build the menus of namespaces and commodities */
- gnc_ui_update_namespace_picker(retval->namespace_combo,
+ gnc_ui_update_namespace_picker(retval->namespace_combo,
gnc_commodity_get_namespace(orig_sel),
mode);
namespace = gnc_ui_namespace_picker_ns(retval->namespace_combo);
gnc_ui_update_commodity_picker(retval->commodity_combo, namespace,
gnc_commodity_get_printname(orig_sel));
+ g_free(namespace);
return retval;
}
@@ -305,7 +316,7 @@
{
SelectCommodityWindow * w = user_data;
- const char * namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
+ gchar * namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
const gnc_commodity * new_commodity =
gnc_ui_new_commodity_modal_full(namespace,
@@ -322,6 +333,7 @@
gnc_commodity_get_namespace(new_commodity),
gnc_commodity_get_printname(new_commodity));
}
+ g_free(namespace);
}
@@ -334,27 +346,28 @@
* Commodity Selection dialog. It should not be used outside of the
* dialog-commodity.c file.
*
- * @param entry A pointer to the commodity name entry widget in the
+ * @param cbe A pointer to the commodity name entry widget in the
* dialog.
*
* @param user_data A pointer to the data structure describing the
* current state of the commodity picker.
*/
void
-gnc_ui_select_commodity_changed_cb(GtkEditable * entry,
- gpointer user_data)
+gnc_ui_select_commodity_changed_cb (GtkComboBoxEntry *cbe,
+ gpointer user_data)
{
SelectCommodityWindow * w = user_data;
- const char * namespace;
- const char * fullname;
+ gchar *namespace, *fullname;
gboolean ok;
- ENTER("entry=%p, user_data=%p", entry, user_data);
+ ENTER("cbe=%p, user_data=%p", cbe, user_data);
namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
- fullname = gtk_entry_get_text(GTK_ENTRY(w->commodity_entry));
+ fullname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(w->commodity_combo));
DEBUG("namespace=%s, name=%s", namespace, fullname);
w->selection = gnc_commodity_table_find_full(gnc_get_current_commodities(),
namespace, fullname);
+ g_free(fullname);
+ g_free(namespace);
ok = (w->selection != NULL);
gtk_widget_set_sensitive(w->ok_button, ok);
@@ -373,23 +386,24 @@
* Commodity Selection dialog. It should not be used outside of the
* dialog-commodity.c file.
*
- * @param entry A pointer to the commodity namespace entry widget in
+ * @param cbe A pointer to the commodity namespace entry widget in
* the dialog.
*
* @param user_data A pointer to the data structure describing the
* current state of the commodity picker.
*/
void
-gnc_ui_select_commodity_namespace_changed_cb(GtkEditable * entry,
- gpointer user_data)
+gnc_ui_select_commodity_namespace_changed_cb (GtkComboBoxEntry *cbe,
+ gpointer user_data)
{
SelectCommodityWindow * w = user_data;
- const char * namespace;
+ gchar *namespace;
- ENTER("entry=%p, user_data=%p", entry, user_data);
+ ENTER("cbe=%p, user_data=%p", cbe, user_data);
namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
DEBUG("namespace=%s", namespace);
gnc_ui_update_commodity_picker(w->commodity_combo, namespace, NULL);
+ g_free(namespace);
LEAVE(" ");
}
@@ -398,50 +412,58 @@
* gnc_ui_update_commodity_picker
********************************************************************/
static int
-g_strcmp(gconstpointer a, gconstpointer b)
+collate(gconstpointer a, gconstpointer b)
{
- return strcmp(a, b);
+ if (!a)
+ return -1;
+ if (!b)
+ return 1;
+ return g_utf8_collate(a, b);
}
void
-gnc_ui_update_commodity_picker(GtkWidget * combobox,
- const char * namespace,
- const char * init_string)
+gnc_ui_update_commodity_picker (GtkWidget *cbe,
+ const gchar * namespace,
+ const gchar * init_string)
{
GList * commodities;
GList * iterator = NULL;
GList * commodity_items = NULL;
+ GtkComboBox *combo_box;
+ GtkTreeModel *model;
gnc_commodity_table *table;
- const char * current;
+ gint current = 0, match = 0;
+ gchar *name;
+ g_return_if_fail(GTK_IS_COMBO_BOX_ENTRY(cbe));
+ g_return_if_fail(namespace);
+
+ /* Erase the old entries */
+ combo_box = GTK_COMBO_BOX(cbe);
+ model = gtk_combo_box_get_model(combo_box);
+ gtk_list_store_clear(GTK_LIST_STORE(model));
+ gtk_combo_box_set_active(combo_box, -1);
+
table = gnc_book_get_commodity_table (gnc_get_current_book ());
commodities = gnc_commodity_table_get_commodities(table, namespace);
-
for(iterator = commodities; iterator; iterator = iterator->next) {
commodity_items =
g_list_append(commodity_items,
(gpointer) gnc_commodity_get_printname(iterator->data));
}
- commodity_items = g_list_sort(commodity_items, g_strcmp);
+ g_list_free(commodities);
- if(!commodity_items) {
- commodity_items = g_list_append(commodity_items, "");
+ commodity_items = g_list_sort(commodity_items, collate);
+ for (iterator = commodity_items; iterator; iterator = iterator->next) {
+ name = (char *)iterator->data;
+ gtk_combo_box_append_text(combo_box, name);
+ if (init_string && g_utf8_collate(name, init_string) == 0)
+ match = current;
+ current++;
}
- gtk_combo_set_popdown_strings(GTK_COMBO(combobox),
- commodity_items);
- if(init_string) {
- current = init_string;
- }
- else {
- current = commodity_items->data;
- }
-
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combobox)->entry), current);
-
- /* free the lists */
- g_list_free(commodities);
+ gtk_combo_box_set_active(combo_box, match);
g_list_free(commodity_items);
}
@@ -466,7 +488,7 @@
gnc_ui_select_commodity_response_cb (GtkDialog * dialog, gint response, gpointer data)
{
SelectCommodityWindow * w = data;
- const gchar *namespace;
+ gchar *namespace;
const gchar *fullname;
gnc_commodity *commodity = NULL;
@@ -477,6 +499,7 @@
commodity = gnc_commodity_table_find_full (gnc_get_current_commodities (),
namespace, fullname);
+ g_free(namespace);
if (commodity != NULL) {
if (w->callback != NULL)
@@ -506,6 +529,7 @@
gnc_commodity_get_namespace (commodity),
gnc_commodity_get_printname (commodity));
}
+ g_free(namespace);
break;
default:
if (w->callback != NULL)
@@ -574,13 +598,23 @@
********************************************************************/
void
-gnc_ui_update_namespace_picker(GtkWidget * combobox,
- const char * init_string,
- dialog_commodity_mode mode)
+gnc_ui_update_namespace_picker (GtkWidget *cbe,
+ const char * init_string,
+ dialog_commodity_mode mode)
{
- GList * namespaces, *node;
- const char * active;
+ GtkComboBox *combo_box;
+ GtkTreeModel *model;
+ GList *namespaces, *node;
+ gint current = 0, match = 0;
+ g_return_if_fail(GTK_IS_COMBO_BOX_ENTRY(cbe));
+
+ /* Erase the old entries */
+ combo_box = GTK_COMBO_BOX(cbe);
+ model = gtk_combo_box_get_model(combo_box);
+ gtk_list_store_clear(GTK_LIST_STORE(model));
+ gtk_combo_box_set_active(combo_box, -1);
+
/* fetch a list of the namespaces */
switch (mode) {
case DIAG_COMM_ALL:
@@ -591,7 +625,7 @@
case DIAG_COMM_NON_CURRENCY:
namespaces =
gnc_commodity_table_get_namespaces (gnc_get_current_commodities());
- node = g_list_find_custom (namespaces, GNC_COMMODITY_NS_CURRENCY, g_strcmp);
+ node = g_list_find_custom (namespaces, GNC_COMMODITY_NS_CURRENCY, collate);
if (node) {
namespaces = g_list_remove_link (namespaces, node);
g_list_free_1 (node);
@@ -607,48 +641,34 @@
break;
}
- /* Legacy namespace should never be seen */
- node = g_list_find_custom (namespaces, GNC_COMMODITY_NS_LEGACY, g_strcmp);
- if (node) {
- namespaces = g_list_remove_link (namespaces, node);
- g_list_free_1 (node);
- }
-
/* stick them in the combobox */
- namespaces = g_list_sort(namespaces, g_strcmp);
- gtk_combo_set_popdown_strings (GTK_COMBO (combobox), namespaces);
-
- /* set the entry text */
- if (init_string)
- active = init_string;
- else if (namespaces)
- active = namespaces->data;
- else
- active = "";
-
- if (safe_strcmp (active, "CURRENCY") == 0 ||
- safe_strcmp (init_string, "CURRENCY") == 0)
- {
- active = "CURRENCY";
+ namespaces = g_list_sort(namespaces, collate);
+ for (node = namespaces; node; node = node->next) {
+ if (g_utf8_collate(node->data, GNC_COMMODITY_NS_LEGACY) == 0)
+ continue;
+ gtk_combo_box_append_text(combo_box, node->data);
+ if (init_string && (g_utf8_collate(node->data, init_string) == 0))
+ match = current;
+ current++;
}
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combobox)->entry), active);
+ gtk_combo_box_set_active(combo_box, match);
g_list_free(namespaces);
}
-const char *
-gnc_ui_namespace_picker_ns (GtkWidget *combobox)
+gchar *
+gnc_ui_namespace_picker_ns (GtkWidget *cbe)
{
- const char *namespace;
+ char *namespace;
- g_return_val_if_fail (combobox != NULL, NULL);
- g_return_val_if_fail (GTK_IS_COMBO (combobox), NULL);
+ g_return_val_if_fail(GTK_IS_COMBO_BOX_ENTRY (cbe), NULL);
- namespace = gtk_entry_get_text (GTK_ENTRY(GTK_COMBO (combobox)->entry));
+ namespace = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cbe));
if (safe_strcmp (namespace, GNC_COMMODITY_NS_ISO) == 0) {
/* In case the user types in ISO4217, map it to CURRENCY. */
- return GNC_COMMODITY_NS_CURRENCY;
+ g_free(namespace);
+ return strdup(GNC_COMMODITY_NS_CURRENCY);
} else
return namespace;
}
@@ -660,14 +680,15 @@
{
CommodityWindow *cw = data;
gboolean get_quote, allow_src, active;
- const char *text;
+ gchar *text;
gint i;
ENTER(" ");
get_quote = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
- text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(cw->namespace_combo)->entry));
+ text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cw->namespace_combo));
allow_src = !gnc_commodity_namespace_is_iso(text);
+ g_free(text);
gtk_widget_set_sensitive(cw->source_label, get_quote && allow_src);
for (i = SOURCE_SINGLE; i < SOURCE_MAX; i++) {
@@ -687,7 +708,7 @@
gnc_ui_commodity_changed_cb(GtkWidget * dummy, gpointer user_data)
{
CommodityWindow * w = user_data;
- const char * namespace;
+ gchar *namespace;
const char * fullname;
const char * mnemonic;
gboolean ok;
@@ -700,6 +721,7 @@
DEBUG("namespace=%s, name=%s, mnemonic=%s", namespace, fullname, mnemonic);
ok = (fullname && namespace && mnemonic &&
fullname[0] && namespace[0] && mnemonic[0]);
+ g_free(namespace);
} else {
ok = TRUE;
}
@@ -719,37 +741,47 @@
gnc_ui_source_menu_create(QuoteSourceType type)
{
gint i, max;
- GtkMenu *menu;
- GtkWidget *item;
- GtkWidget *omenu;
+ const gchar *name;
+ gboolean supported;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkWidget *combo;
+ GtkCellRenderer *renderer;
gnc_quote_source *source;
- menu = GTK_MENU(gtk_menu_new());
- gtk_widget_show(GTK_WIDGET(menu));
-
+ store = gtk_list_store_new(NUM_SOURCE_COLS, G_TYPE_STRING, G_TYPE_BOOLEAN);
if (type == SOURCE_CURRENCY) {
- item = gtk_menu_item_new_with_label(_("Currency"));
- gtk_widget_show(item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ SOURCE_COL_NAME, _("Currency"),
+ SOURCE_COL_FQ_SUPPORTED, TRUE,
+ -1);
} else {
max = gnc_quote_source_num_entries(type);
for (i = 0; i < max; i++) {
source = gnc_quote_source_lookup_by_ti(type, i);
if (source == NULL)
break;
- item = gtk_menu_item_new_with_label(gnc_quote_source_get_user_name(source));
- gtk_widget_set_sensitive(item, gnc_quote_source_get_supported(source));
- gtk_widget_show(item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ name = gnc_quote_source_get_user_name(source);
+ supported = gnc_quote_source_get_supported(source);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ SOURCE_COL_NAME, name,
+ SOURCE_COL_FQ_SUPPORTED, supported,
+ -1);
}
}
- omenu = gtk_option_menu_new();
- gtk_widget_show(omenu);
- gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), GTK_WIDGET(menu));
- gnc_option_menu_init(omenu);
-
- return omenu;
+ combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer,
+ "text", SOURCE_COL_NAME);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer,
+ "sensitive", SOURCE_COL_FQ_SUPPORTED);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+ gtk_widget_show(combo);
+ return combo;
}
/********************************************************************\
@@ -795,9 +827,7 @@
static GtkWidget *
gnc_ui_quote_tz_menu_create(void)
{
- GtkMenu *menu;
- GtkWidget *item;
- GtkWidget *omenu;
+ GtkWidget *combo;
gchar **itemstr;
/* add items here as needed, but bear in mind that right now these
@@ -806,25 +836,14 @@
order to be portable to non GNU OSes, we may have to support
whatever we add here manually on those systems. */
- menu = GTK_MENU(gtk_menu_new());
- gtk_widget_show(GTK_WIDGET(menu));
-
- item = gtk_menu_item_new_with_label(_("Use local time"));
- gtk_widget_show(item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-
+ combo = gtk_combo_box_new_text();
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Use local time"));
for(itemstr = &known_timezones[0]; *itemstr; itemstr++) {
- item = gtk_menu_item_new_with_label(*itemstr);
- gtk_widget_show(item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), *itemstr);
}
- omenu = gtk_option_menu_new();
- gtk_widget_show(omenu);
- gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), GTK_WIDGET(menu));
- gnc_option_menu_init(omenu);
-
- return omenu;
+ gtk_widget_show(combo);
+ return combo;
}
/** Build the new/edit commodity dialog box
@@ -876,7 +895,7 @@
/* Get widget pointers */
retval->fullname_entry = glade_xml_get_widget (xml, "fullname_entry");
retval->mnemonic_entry = glade_xml_get_widget (xml, "mnemonic_entry");
- retval->namespace_combo = glade_xml_get_widget (xml, "namespace_combo");
+ retval->namespace_combo = glade_xml_get_widget (xml, "namespace_cbe");
retval->code_entry = glade_xml_get_widget (xml, "code_entry");
retval->fraction_spinbutton = glade_xml_get_widget (xml,
"fraction_spinbutton");
@@ -966,6 +985,8 @@
gtk_entry_set_text (GTK_ENTRY (retval->fullname_entry), fullname ? fullname : "");
gtk_entry_set_text (GTK_ENTRY (retval->mnemonic_entry), mnemonic ? mnemonic : "");
+ gnc_cbe_add_completion(GTK_COMBO_BOX_ENTRY(retval->namespace_combo));
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(retval->namespace_combo), 0);
gnc_ui_update_namespace_picker(retval->namespace_combo,
selected_namespace,
include_iso ? DIAG_COMM_ALL : DIAG_COMM_NON_CURRENCY);
@@ -1001,18 +1022,18 @@
if (!gnc_commodity_is_iso(commodity)) {
type = gnc_quote_source_get_type(source);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->source_button[type]), TRUE);
- gtk_option_menu_set_history (GTK_OPTION_MENU (win->source_menu[type]),
- gnc_quote_source_get_index(source));
+ gtk_combo_box_set_active(GTK_COMBO_BOX(win->source_menu[type]),
+ gnc_quote_source_get_index(source));
}
if (quote_tz) {
pos = gnc_find_timezone_menu_position(quote_tz);
- if(pos == 0) {
- PWARN("Unknown price quote timezone (%s), resetting to default.",
- quote_tz ? quote_tz : "(null)");
- }
+// if(pos == 0) {
+// PWARN("Unknown price quote timezone (%s), resetting to default.",
+// quote_tz ? quote_tz : "(null)");
+// }
}
- gtk_option_menu_set_history (GTK_OPTION_MENU (win->quote_tz_menu), pos);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(win->quote_tz_menu), pos);
LEAVE(" ");
}
@@ -1156,7 +1177,7 @@
gnc_quote_source *source;
QuoteSourceType type;
const char * fullname = gtk_entry_get_text(GTK_ENTRY(w->fullname_entry));
- const char * namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
+ gchar *namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
const char * mnemonic = gtk_entry_get_text(GTK_ENTRY(w->mnemonic_entry));
const char * code = gtk_entry_get_text(GTK_ENTRY(w->code_entry));
QofBook * book = gnc_get_current_book ();
@@ -1174,7 +1195,7 @@
gnc_commodity_begin_edit(c);
gnc_commodity_set_quote_flag (c, gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (w->get_quote_check)));
- selection = gnc_option_menu_get_active (w->quote_tz_menu);
+ selection = gtk_combo_box_get_active(GTK_COMBO_BOX(w->quote_tz_menu));
string = gnc_timezone_menu_position_to_string(selection);
gnc_commodity_set_quote_tz(c, string);
gnc_commodity_commit_edit(c);
@@ -1194,6 +1215,7 @@
if ((!w->edit_commodity && c) ||
(w->edit_commodity && c && (c != w->edit_commodity))) {
gnc_warning_dialog (w->dialog, _("That commodity already exists."));
+ g_free(namespace);
return FALSE;
}
@@ -1221,11 +1243,11 @@
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->source_button[type])))
break;
}
- selection = gnc_option_menu_get_active (w->source_menu[type]);
+ selection = gtk_combo_box_get_active(GTK_COMBO_BOX(w->source_menu[type]));
source = gnc_quote_source_lookup_by_ti (type, selection);
gnc_commodity_set_quote_source(c, source);
- selection = gnc_option_menu_get_active (w->quote_tz_menu);
+ selection = gtk_combo_box_get_active(GTK_COMBO_BOX(w->quote_tz_menu));
string = gnc_timezone_menu_position_to_string(selection);
gnc_commodity_set_quote_tz(c, string);
gnc_commodity_commit_edit(c);
@@ -1238,8 +1260,10 @@
_("You must enter a non-empty \"Full name\", "
"\"Symbol/abbreviation\", "
"and \"Type\" for the commodity."));
+ g_free(namespace);
return FALSE;
}
+ g_free(namespace);
LEAVE(" ");
return TRUE;
}
Modified: gnucash/trunk/src/gnome-utils/dialog-commodity.h
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-commodity.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/dialog-commodity.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* dialog-commodity.h -- "select" and "new" commodity windows *
* (GnuCash) *
* Copyright (C) 2000 Bill Gribble <grib at billgribble.com> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -214,7 +215,7 @@
/** Given a combo box, fill in the known commodity namespaces and then
* select one.
*
- * @param combobox The combo box to populate with information.
+ * @param cbe The widget to populate with information.
*
* @param sel The namespace that should be initially selected when
* the combo box appears.
@@ -226,25 +227,25 @@
*
* @note The returned string must be freed by the caller.
*/
-void gnc_ui_update_namespace_picker(GtkWidget * combobox,
- const char * sel,
+void gnc_ui_update_namespace_picker(GtkWidget *cbe,
+ const gchar *sel,
dialog_commodity_mode mode);
/** Given a combo box, return the currently selected namespaces.
*
- * @param combobox The combo box of namespaces.
+ * @param cbe The combo box of namespaces.
*
* @return The currently selected namespace.
*
* @note This string is owned by the engine and must not be freed by
* the caller.
*/
-const char * gnc_ui_namespace_picker_ns (GtkWidget *combobox);
+gchar *gnc_ui_namespace_picker_ns (GtkWidget *cbe);
/** Given a combo box, fill in all the known commodities for the
* specified namespace, and then select one.
*
- * @param combobox The combo box to populate with information.
+ * @param cbe The widget to populate with information.
*
* @param namespace All commodities with this namespace will be added
* to the combo box.
@@ -252,9 +253,9 @@
* @param sel The commodity that should be initially selected when
* the combo box appears.
*/
-void gnc_ui_update_commodity_picker(GtkWidget * combobox,
- const char * namespace,
- const char * sel);
+void gnc_ui_update_commodity_picker(GtkWidget *cbe,
+ const gchar *namespace,
+ const gchar *sel);
/** @} */
#endif
Modified: gnucash/trunk/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-options.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/dialog-options.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -908,100 +908,90 @@
}
static void
-gnc_option_list_select_cb(GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer data)
+gnc_option_list_changed_cb(GtkTreeSelection *selection,
+ GNCOption *option)
{
- GNCOption *option = data;
+ GtkTreeView *view;
- gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(TRUE));
- gnc_option_changed_widget_cb(GTK_WIDGET(clist), option);
+ view = gtk_tree_selection_get_tree_view(selection);
+ gnc_option_changed_widget_cb(GTK_WIDGET(view), option);
}
static void
-gnc_option_list_unselect_cb(GtkCList *clist, gint row, gint column,
- GdkEventButton *event, gpointer data)
-{
- GNCOption *option = data;
-
- gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(FALSE));
- gnc_option_changed_widget_cb(GTK_WIDGET(clist), option);
-}
-
-static void
gnc_option_list_select_all_cb(GtkWidget *widget, gpointer data)
{
GNCOption *option = data;
+ GtkTreeView *view;
+ GtkTreeSelection *selection;
- gtk_clist_select_all(GTK_CLIST(gnc_option_get_widget (option)));
- gnc_option_changed_widget_cb(widget, option);
+ view = GTK_TREE_VIEW(gnc_option_get_widget (option));
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_all(selection);
+ gnc_option_changed_widget_cb(GTK_WIDGET(view), option);
}
static void
gnc_option_list_clear_all_cb(GtkWidget *widget, gpointer data)
{
GNCOption *option = data;
+ GtkTreeView *view;
+ GtkTreeSelection *selection;
- gtk_clist_unselect_all(GTK_CLIST(gnc_option_get_widget (option)));
- gnc_option_changed_widget_cb(widget, option);
+ view = GTK_TREE_VIEW(gnc_option_get_widget (option));
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_unselect_all(selection);
+ gnc_option_changed_widget_cb(GTK_WIDGET(view), option);
}
static GtkWidget *
gnc_option_create_list_widget(GNCOption *option, char *name, GtkTooltips *tooltips)
{
- GtkWidget *scroll_win;
- GtkWidget *top_hbox;
+ GtkListStore *store;
+ GtkTreeView *view;
+ GtkTreeIter iter;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkTreeSelection *selection;
+
GtkWidget *button;
GtkWidget *frame;
- GtkWidget *clist;
GtkWidget *hbox;
GtkWidget *bbox;
gint num_values;
- gint width;
gint i;
- top_hbox = gtk_hbox_new(FALSE, 0);
-
frame = gtk_frame_new(name);
- gtk_box_pack_start(GTK_BOX(top_hbox), frame, FALSE, FALSE, 0);
-
hbox = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), hbox);
- clist = gtk_clist_new(1);
- gtk_clist_column_titles_hide(GTK_CLIST(clist));
- gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_MULTIPLE);
+ store = gtk_list_store_new(1, G_TYPE_STRING);
+ view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", 0,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+ gtk_tree_view_set_headers_visible(view, FALSE);
num_values = gnc_option_num_permissible_values(option);
for (i = 0; i < num_values; i++)
{
- gchar *text[1];
gchar *string;
string = gnc_option_permissible_value_name(option, i);
- if (string != NULL)
- {
- text[0] = *string ? _(string) : "";
- gtk_clist_append(GTK_CLIST(clist), text);
- gtk_clist_set_row_data(GTK_CLIST(clist), i, GINT_TO_POINTER(FALSE));
- free(string);
- }
- else
- {
- PERR("bad value name\n");
- }
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, string ? string : "",
+ -1);
}
- scroll_win = gtk_scrolled_window_new(NULL, NULL);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(view), FALSE, FALSE, 0);
- width = gtk_clist_columns_autosize(GTK_CLIST(clist));
- gtk_widget_set_size_request(scroll_win, width + 50, -1);
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_option_list_changed_cb), option);
- gtk_box_pack_start(GTK_BOX(hbox), scroll_win, FALSE, FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(scroll_win), 5);
- gtk_container_add(GTK_CONTAINER(scroll_win), clist);
bbox = gtk_vbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
@@ -1028,9 +1018,9 @@
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(gnc_option_default_cb), option);
- gnc_option_set_widget (option, clist);
+ gnc_option_set_widget (option, GTK_WIDGET(view));
- return top_hbox;
+ return frame;
}
static void
@@ -1815,8 +1805,7 @@
value = gnc_account_sel_new();
gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(value), acct_type_list);
- g_signal_connect(G_OBJECT(gnc_account_sel_gtk_entry(GNC_ACCOUNT_SEL(value))),
- "changed",
+ g_signal_connect(value, "changed",
G_CALLBACK(gnc_option_changed_widget_cb), option);
gnc_option_set_widget (option, value);
@@ -1840,7 +1829,6 @@
{
GtkWidget *value;
GtkWidget *eventbox;
- gint num_lines;
*enclosing = gnc_option_create_list_widget(option, name, tooltips);
value = gnc_option_get_widget (option);
@@ -1854,21 +1842,8 @@
gtk_tooltips_set_tip(tooltips, eventbox, documentation, NULL);
- //gtk_widget_realize(value);
-
gnc_option_set_ui_value(option, FALSE);
-
- g_signal_connect(G_OBJECT(value), "select_row",
- G_CALLBACK(gnc_option_list_select_cb), option);
- g_signal_connect(G_OBJECT(value), "unselect_row",
- G_CALLBACK(gnc_option_list_unselect_cb), option);
-
- num_lines = gnc_option_num_permissible_values(option);
- num_lines = MIN(num_lines, 9) + 1;
-
- gtk_clist_set_row_height(GTK_CLIST(value), 0);
- gtk_widget_set_size_request(value, -1, GTK_CLIST(value)->row_height * num_lines);
- gtk_widget_show_all(*enclosing);
+ gtk_widget_show(*enclosing);
return value;
}
@@ -2407,14 +2382,13 @@
gnc_option_set_ui_value_list (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
- gint num_rows, row;
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+ gint row;
- gtk_clist_unselect_all(GTK_CLIST(widget));
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
+ gtk_tree_selection_unselect_all(selection);
- num_rows = gnc_option_num_permissible_values(option);
- for (row = 0; row < num_rows; row++)
- gtk_clist_set_row_data(GTK_CLIST(widget), row, GINT_TO_POINTER(FALSE));
-
while (SCM_LISTP(value) && !SCM_NULLP(value))
{
SCM item;
@@ -2428,8 +2402,9 @@
return TRUE;
}
- gtk_clist_select_row(GTK_CLIST(widget), row, 0);
- gtk_clist_set_row_data(GTK_CLIST(widget), row, GINT_TO_POINTER(TRUE));
+ path = gtk_tree_path_new_from_indices(row, -1);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
}
if (!SCM_LISTP(value) || !SCM_NULLP(value))
@@ -2825,20 +2800,23 @@
static SCM
gnc_option_get_ui_value_list (GNCOption *option, GtkWidget *widget)
{
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
SCM result;
gboolean selected;
- GtkCList *clist;
gint num_rows;
gint row;
- clist = GTK_CLIST(widget);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
num_rows = gnc_option_num_permissible_values(option);
result = scm_c_eval_string("'()");
for (row = 0; row < num_rows; row++)
{
- selected = GPOINTER_TO_INT(gtk_clist_get_row_data(clist, row));
- if (selected)
+ path = gtk_tree_path_new_from_indices(row, -1);
+ selected = gtk_tree_selection_path_is_selected(selection, path);
+ gtk_tree_path_free(path);
+ if (selected)
result = scm_cons(gnc_option_permissible_value(option, row), result);
}
Modified: gnucash/trunk/src/gnome-utils/dialog-utils.h
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-utils.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/dialog-utils.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -113,8 +113,10 @@
* place. Stick to gtk_clist_append, or use gnc_clist_set_check
* after you have built the list. This only applies to unrealized
* widgets. */
+#ifdef __GTK_CLIST_H__
void gnc_clist_set_check (GtkCList *list, int row, int col,
gboolean checked);
+#endif
GladeXML * gnc_glade_xml_new (const char *filename, const char *root);
GtkWidget * gnc_glade_lookup_widget (GtkWidget *widget, const char *name);
Modified: gnucash/trunk/src/gnome-utils/glade/commodity.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/commodity.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/glade/commodity.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -88,130 +88,6 @@
<property name="column_spacing">12</property>
<child>
- <widget class="GtkCombo" id="commodity_combo">
- <property name="visible">True</property>
- <property name="value_in_list">True</property>
- <property name="allow_empty">False</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="commodity_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- <signal name="changed" handler="gnc_ui_select_commodity_changed_cb" last_modification_time="Wed, 16 Jul 2003 20:18:37 GMT"/>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget4">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget5">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCombo" id="namespace_combo">
- <property name="visible">True</property>
- <property name="value_in_list">True</property>
- <property name="allow_empty">False</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="namespace_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- <signal name="changed" handler="gnc_ui_select_commodity_namespace_changed_cb"/>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget1">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget2">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="select_user_prompt">
<property name="visible">True</property>
<property name="label" translatable="yes">Select user information here...</property>
@@ -260,7 +136,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">namespace_entry</property>
+ <property name="mnemonic_widget">namespace_cbe</property>
</widget>
</child>
</widget>
@@ -299,7 +175,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">commodity_entry</property>
+ <property name="mnemonic_widget">commodity_cbe</property>
</widget>
</child>
</widget>
@@ -312,6 +188,42 @@
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBoxEntry" id="namespace_cbe">
+ <property name="visible">True</property>
+ <property name="items">Dummy namespace entry</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">True</property>
+ <signal name="changed" handler="gnc_ui_select_commodity_namespace_changed_cb" last_modification_time="Thu, 08 Jun 2006 23:26:58 GMT"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBoxEntry" id="commodity_cbe">
+ <property name="visible">True</property>
+ <property name="items">Dummy security entry</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">True</property>
+ <signal name="changed" handler="gnc_ui_select_commodity_changed_cb" last_modification_time="Thu, 08 Jun 2006 23:30:40 GMT"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -479,69 +391,6 @@
</child>
<child>
- <widget class="GtkCombo" id="namespace_combo">
- <property name="visible">True</property>
- <property name="value_in_list">False</property>
- <property name="allow_empty">True</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="namespace_entry">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Enter the type of commodity. For stocks, this is often an exchange on which the stock is traded. You can choose an existing type from the list or enter a new type with the keyboard.</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- <signal name="changed" handler="gnc_ui_commodity_changed_cb" last_modification_time="Sat, 19 Jul 2003 20:58:53 GMT"/>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget7">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget8">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkEntry" id="code_entry">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Enter a unique code used to identify the commodity. Or, you may safely leave this field blank.</property>
@@ -889,7 +738,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">namespace_entry</property>
+ <property name="mnemonic_widget">namespace_cbe</property>
</widget>
</child>
</widget>
@@ -1255,6 +1104,24 @@
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBoxEntry" id="namespace_cbe">
+ <property name="visible">True</property>
+ <property name="items">Dummy namespace</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">True</property>
+ <signal name="changed" handler="gnc_ui_commodity_changed_cb" last_modification_time="Thu, 08 Jun 2006 23:29:20 GMT"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: gnucash/trunk/src/gnome-utils/glade/druid-provider-multifile.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/druid-provider-multifile.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/glade/druid-provider-multifile.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -72,30 +72,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="file_list">
+ <widget class="GtkTreeView" id="file_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_select_loaded_file_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label827">
- <property name="label" translatable="no">labe82l7</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/gnome-utils/gnc-account-sel.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-account-sel.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-account-sel.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -3,6 +3,7 @@
*
* Copyright (C) 2002 Joshua Sled <jsled at asynchronous.org>
* All rights reserved.
+ * Copyright (C) 2006 David Hampton <hampton at employees.org>
*
* Gnucash is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
@@ -31,6 +32,7 @@
#include "GNCId.h"
#include "gnc-account-sel.h"
#include "gnc-exp-parser.h"
+#include "gnc-gtk-utils.h"
#include "gnc-ui-util.h"
#include "qof.h"
@@ -43,6 +45,12 @@
LAST_SIGNAL
};
+enum account_cols {
+ ACCT_COL_NAME = 0,
+ ACCT_COL_PTR,
+ NUM_ACCT_COLS
+};
+
static guint account_sel_signals [LAST_SIGNAL] = { 0 };
static void gnc_account_sel_init (GNCAccountSel *gas);
@@ -50,20 +58,12 @@
static void gnc_account_sel_finalize (GObject *object);
static void gnc_account_sel_dispose (GObject *object);
-static void gas_accounts_to_names (gpointer data, gpointer user_data);
+static void gas_filter_accounts (gpointer data, gpointer user_data);
static void gas_populate_list (GNCAccountSel *gas);
-static void gas_strcmp_adapter (gpointer a, gpointer b);
static void gas_new_account_click (GtkButton *b, gpointer ud);
-#if 0 /* completion not implemented */
-static void gnc_account_sel_changed( GtkEditable *entry, gpointer ud );
-static void gnc_account_sel_list_clicked( GtkButton *b, gpointer ud );
-static gint gnc_account_sel_key_press( GtkWidget *widget,
- GdkEventKey *event );
-#endif /* 0 -- completion not implemented */
-
static GtkHBox *parent_class;
GType
@@ -134,23 +134,23 @@
static void
gnc_account_sel_init (GNCAccountSel *gas)
{
+ GtkWidget *widget;
+
gas->initDone = FALSE;
gas->acctTypeFilters = FALSE;
gas->newAccountButton = NULL;
- gas->combo = GTK_COMBO(gtk_combo_new());
- gtk_combo_set_value_in_list( gas->combo, TRUE, TRUE );
- gtk_container_add( GTK_CONTAINER(gas), GTK_WIDGET(gas->combo) );
+ gas->store = gtk_list_store_new(NUM_ACCT_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ widget =
+ gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(gas->store), ACCT_COL_NAME);
+ gas->combo = GTK_COMBO_BOX_ENTRY(widget);
+ gtk_combo_box_set_model(GTK_COMBO_BOX(widget),
+ GTK_TREE_MODEL(gas->store));
+ gtk_container_add( GTK_CONTAINER(gas), widget );
- /* This is only because completion cannot be implemented. */
- gtk_editable_set_editable( GTK_EDITABLE(gas->combo->entry), FALSE );
+ /* Add completion. */
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(widget));
-#if 0 /* completion not implemented. */
- g_signal_connect( gas->combo->entry, "changed",
- G_CALLBACK( gnc_account_sel_changed ),
- gas );
-#endif /* 0 -- completion not implemented. */
-
/* Get the accounts, place into combo list */
gas_populate_list( gas );
@@ -163,92 +163,68 @@
typedef struct {
GNCAccountSel *gas;
GList **outList;
-} accounts_to_names_data;
+} account_filter_data;
-/**
- * Used in the g_list_foreach call in gas_populate_list to see if the given
- * string is in [via strcmp] the list, and to set the flag as necessary.
- **/
-typedef struct {
- char *str;
- gboolean flag;
-} findData;
-
static
void
-gas_strcmp_adapter( gpointer listElt, gpointer ud )
-{
- findData *fd = (findData*)ud;
- fd->flag |= ( strcmp( (char*)listElt, (char*)fd->str ) == 0 );
-}
-
-static
-void
gas_populate_list( GNCAccountSel *gas )
{
- accounts_to_names_data atnd;
+ account_filter_data atnd;
AccountGroup *ag;
- GList *accts, *nameList;
- gchar *currentSel;
+ Account *acc;
+ GtkTreeIter iter;
+ GtkEntry *entry;
+ gint i, active = 0;
+ GList *accts, *ptr, *filteredAccts;
+ gchar *currentSel, *name;
+ entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(gas->combo)));
currentSel = gtk_editable_get_chars(
- GTK_EDITABLE(gas->combo->entry), 0, -1 );
+ GTK_EDITABLE(entry), 0, -1 );
ag = gnc_book_get_group( gnc_get_current_book() );
accts = (GList*)xaccGroupGetSubAccountsSorted( ag );
- nameList = NULL;
+ filteredAccts = NULL;
atnd.gas = gas;
- atnd.outList = &nameList;
+ atnd.outList = &filteredAccts;
- g_list_foreach( accts, gas_accounts_to_names,
- (gpointer)&atnd );
+ g_list_foreach( accts, gas_filter_accounts, (gpointer)&atnd );
g_list_free( accts );
- /* Make sure we have a list of something... */
- if ( nameList == NULL )
- nameList = g_list_prepend( NULL, "" );
+ gtk_list_store_clear(gas->store);
+ for (ptr = filteredAccts, i = 0; ptr; ptr = g_list_next(ptr), i++) {
+ acc = ptr->data;
+ name = xaccAccountGetFullName(acc);
+ gtk_list_store_append(gas->store, &iter);
+ gtk_list_store_set(gas->store, &iter,
+ ACCT_COL_NAME, name,
+ ACCT_COL_PTR, acc,
+ -1);
+ if (g_utf8_collate(name, currentSel) == 0) {
+ active = i;
+ g_free(name);
+ }
+ }
- gtk_combo_set_popdown_strings( gas->combo, nameList );
-
/* If the account which was in the text box before still exists, then
* reset to it. */
- {
- findData tmpfd;
- gint pos;
- tmpfd.str = currentSel;
- tmpfd.flag = FALSE;
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gas->combo), active);
- g_list_foreach( nameList, gas_strcmp_adapter, &tmpfd );
-
- if ( tmpfd.flag ) {
- gtk_editable_delete_text(
- GTK_EDITABLE(gas->combo->entry), 0, -1 );
- pos = 0;
- gtk_editable_insert_text(
- GTK_EDITABLE(gas->combo->entry),
- currentSel, strlen(currentSel), &pos );
- }
- }
- g_list_free( nameList );
+ g_list_free( filteredAccts );
if ( currentSel ) {
g_free( currentSel );
}
-
-#if 0 /* completion not implemented */
- gas->completion = g_completion_new( NULL );
- g_completion_add_items( gas->completion, nameList );
-#endif /* 0 -- completion not implemented */
}
static
void
-gas_accounts_to_names( gpointer data, gpointer user_data )
+gas_filter_accounts( gpointer data, gpointer user_data )
{
- accounts_to_names_data *atnd;
+ account_filter_data *atnd;
Account *a;
- atnd = (accounts_to_names_data*)user_data;
+ atnd = (account_filter_data*)user_data;
a = (Account*)data;
/* Filter as we've been configured to do. */
if ( atnd->gas->acctTypeFilters ) {
@@ -261,90 +237,10 @@
return;
}
}
- *atnd->outList =
- g_list_append( *atnd->outList, xaccAccountGetFullName(a) );
+ *atnd->outList = g_list_append( *atnd->outList, a );
}
-#if 0 /* completion not implemented */
-/*
- * There is apparently no way -- in GTK 1.x -- to programatically select a
- * region in the way we would like... so we've disallowed manual editing of
- * the Account string.
- */
-static
-void
-gnc_account_sel_changed( GtkEditable *entry, gpointer ud )
-{
- gchar *s, *prefix;
- GNCAccountSel *gas = (GNCAccountSel*)ud;
- if ( !gas->initDone ) {
- return;
- }
- s = gtk_editable_get_chars( entry, 0, -1 );
- g_completion_complete( gas->completion, s, &prefix );
- if ( prefix && (strlen(prefix) > 0) ) {
- printf( "changed into \"%s\"; longest completion: \"%s\"\n", s, prefix );
- g_signal_handlers_block_by_func( gas->combo->entry,
- gnc_account_sel_changed,
- ud );
- gtk_entry_set_text( GTK_ENTRY(gas->combo->entry), prefix );
- gtk_editable_select_region( GTK_EDITABLE(gas->combo->entry),
- strlen(s), -1 );
- {
- GdkEventKey k;
- gboolean ret;
-
- k.type = GDK_KEY_RELEASE;
- k.send_event = TRUE;
- k.state = GDK_SHIFT_MASK;
- k.keyval = GDK_End;
- k.length = 0;
- k.string = "";
- printf( "foo [%d : \"%s\"]\n", k.length, k.string );
- //gtk_widget_event( GTK_WIDGET(gas->combo->entry), &e );
- g_signal_emit_by_name( gas->combo->entry,
- "key-press-event",
- gas->combo->entry, &k, NULL, &ret );
- printf( "bar\n" );
- }
- gtk_editable_set_position( GTK_EDITABLE(gas->combo->entry),
- strlen(s) );
- g_signal_handlers_unblock_by_func( gas->combo->entry,
- gnc_account_sel_changed,
- ud );
- g_free( prefix );
- }
- g_free( s );
-}
-
-static
-gint
-gnc_account_sel_key_press(GtkWidget *widget, GdkEventKey *event)
-{
- GNCAccountSel *gas = GNC_ACCOUNT_SEL(widget);
- gint result;
-
- result = (* GTK_WIDGET_CLASS (parent_class)->key_press_event)(widget, event);
-
- switch (event->keyval)
- {
- case GDK_Tab:
- /* FIXME: += equivalent keys. */
- break;
- if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK))
- break;
- return result;
- case GDK_KP_Enter:
- break;
- default:
- return result;
- }
-
- return TRUE;
-}
-#endif /* 0 -- completion not implemented */
-
GtkWidget *
gnc_account_sel_new (void)
{
@@ -355,47 +251,56 @@
return GTK_WIDGET (gas);
}
-GtkWidget *
-gnc_account_sel_gtk_entry (GNCAccountSel *gas)
+typedef struct {
+ GNCAccountSel *gas;
+ Account *acct;
+} gas_find_data;
+
+static
+gboolean
+gnc_account_sel_find_account (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gas_find_data *data)
{
- g_return_val_if_fail(gas != NULL, NULL);
- g_return_val_if_fail(GNC_IS_ACCOUNT_SEL(gas), NULL);
+ Account *model_acc;
- return (GtkWidget *)gas->combo->entry;
-}
+ gtk_tree_model_get(model, iter, ACCT_COL_PTR, &model_acc, -1);
+ if (data->acct != model_acc)
+ return FALSE;
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(data->gas->combo), iter);
+ return TRUE;
+}
void
gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct )
{
- gchar *acctStr;
+ gas_find_data data;
- if ( acct == NULL ) {
- gtk_list_select_item( GTK_LIST(gas->combo->list), 0 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), -1 );
+ if ( acct == NULL )
return;
- }
- acctStr = xaccAccountGetFullName( acct );
- gtk_entry_set_text( GTK_ENTRY(gas->combo->entry), acctStr );
- g_free( acctStr );
+
+ data.gas = gas;
+ data.acct = acct;
+ gtk_tree_model_foreach(GTK_TREE_MODEL(gas->store),
+ (GtkTreeModelForeachFunc)gnc_account_sel_find_account,
+ &data);
}
Account*
gnc_account_sel_get_account( GNCAccountSel *gas )
{
- AccountGroup *ag;
- Account *ret;
- gchar *txt;
+ GtkTreeIter iter;
+ Account *acc;
- ret = NULL;
- txt = gtk_editable_get_chars( GTK_EDITABLE(gas->combo->entry), 0, -1 );
- g_assert( txt != NULL );
- if ( strlen(txt) == 0 ) {
- goto cleanup;
- }
- ag = gnc_book_get_group( gnc_get_current_book() );
- ret = xaccGetAccountFromFullName( ag, txt );
- cleanup:
- g_free( txt );
- return ret;
+ if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(gas->combo), &iter))
+ return NULL;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(gas->store), &iter,
+ ACCT_COL_PTR, &acc,
+ -1);
+ return acc;
}
@@ -500,3 +405,53 @@
else
gnc_ui_new_account_with_types( NULL, gas->acctTypeFilters );
}
+
+gint
+gnc_account_sel_get_num_account( GNCAccountSel *gas )
+{
+ if (NULL == gas)
+ return 0;
+ return gtk_tree_model_iter_n_children( GTK_TREE_MODEL(gas->store), NULL );
+}
+
+void
+gnc_account_sel_purge_account( GNCAccountSel *gas,
+ Account *target,
+ gboolean recursive)
+{
+ GtkTreeModel *model = GTK_TREE_MODEL(gas->store);
+ GtkTreeIter iter;
+ Account *acc;
+ gboolean more;
+
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
+
+ if (!recursive) {
+ do {
+ gtk_tree_model_get(model, &iter, ACCT_COL_PTR, &acc, -1);
+ if (acc == target) {
+ gtk_list_store_remove(gas->store, &iter);
+ break;
+ }
+ } while (gtk_tree_model_iter_next(model, &iter));
+ } else {
+ do {
+ gtk_tree_model_get(model, &iter, ACCT_COL_PTR, &acc, -1);
+ while (acc) {
+ if (acc == target)
+ break;
+ acc = xaccAccountGetParentAccount(acc);
+ }
+
+ if (acc == target)
+ more = gtk_list_store_remove(gas->store, &iter);
+ else
+ more = gtk_tree_model_iter_next(model, &iter);
+ } while (more);
+ }
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gas->combo), 0);
+}
+
+
Modified: gnucash/trunk/src/gnome-utils/gnc-account-sel.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-account-sel.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-account-sel.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -6,6 +6,7 @@
* freshly-retreived account list, the widget will re-select that account.
*
* Copyright (C) 2002 Joshua Sled <jsled at asynchronous.org>
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
* All rights reserved.
**/
@@ -42,7 +43,8 @@
GtkHBox hbox;
gboolean initDone;
gboolean isModal;
- GtkCombo *combo;
+ GtkListStore *store;
+ GtkComboBoxEntry *combo;
GList *acctTypeFilters;
gint eventHandlerId;
/* The state of this pointer also serves as a flag about what state
@@ -64,7 +66,7 @@
GType gnc_account_sel_get_type (void);
GtkWidget* gnc_account_sel_new (void);
-GtkWidget* gnc_account_sel_gtk_entry (GNCAccountSel *gas);
+
/**
* Sets the GAS to the given account. If the account doesn't exist in the
* list, then it doesn't change the state of the GAS. If the account is
@@ -99,4 +101,7 @@
void gnc_account_sel_set_new_account_modal( GNCAccountSel *gas,
gboolean state );
+gint gnc_account_sel_get_num_account( GNCAccountSel *gas );
+void gnc_account_sel_purge_account( GNCAccountSel *gas, Account *acc, gboolean recursive);
+
#endif /* !ndef GNC_ACCOUNT_SEL_H */
Modified: gnucash/trunk/src/gnome-utils/gnc-currency-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-currency-edit.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-currency-edit.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -64,6 +64,7 @@
#include "gnc-currency-edit.h"
#include "gnc-commodity.h"
+#include "gnc-gtk-utils.h"
#include "gnc-ui-util.h"
static void gnc_currency_edit_init (GNCCurrencyEdit *gce);
@@ -74,8 +75,7 @@
/** The instance private data for a content plugin. */
typedef struct _GNCCurrencyEditPrivate
{
- gint last_index; /**< Last valid GtkListStore index */
- gulong changed_id; /**< Signal handler id */
+ gint dummy;
} GNCCurrencyEditPrivate;
#define GET_PRIVATE(o) \
@@ -139,135 +139,9 @@
static void
gnc_currency_edit_init (GNCCurrencyEdit *gce)
{
- GNCCurrencyEditPrivate *priv;
-
- priv = GET_PRIVATE(gce);
- priv->last_index = -1;
- priv->changed_id = 0;
}
-/** Find an entry in the GtkComboBoxEntry by its text value, and set
- * the widget to that value. This function also records the index of
- * that text value for use when the user leaves the widget.
- *
- * @param gce A pointer to a currency entry widget.
- *
- * @param text The entry text to find in the model of the combo box
- * entry. */
-static void
-gce_set_by_string(GNCCurrencyEdit *gce,
- const gchar *text)
-{
- GNCCurrencyEditPrivate *priv;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GValue value = { 0 };
- const gchar *tree_string;
- gint result = 1;
-
- priv = GET_PRIVATE(gce);
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(gce));
- if (!gtk_tree_model_get_iter_first(model, &iter)) {
- /* empty tree */
- return;
- }
-
- do {
- gtk_tree_model_get_value(model, &iter, 0, &value);
- tree_string = g_value_get_string(&value);
- result = strcmp(text, tree_string);
- g_value_unset(&value);
- if (result != 0)
- continue;
-
- /* Found a matching string */
- g_signal_handler_block(gce, priv->changed_id);
- gtk_combo_box_set_active_iter(GTK_COMBO_BOX(gce), &iter);
- g_signal_handler_unblock(gce, priv->changed_id);
- priv->last_index = gtk_combo_box_get_active(GTK_COMBO_BOX(gce));
- return;
- } while (gtk_tree_model_iter_next(model, &iter));
-}
-
-
-/** The currency edit widget has changed its value. If the widget
- * now points to another valid currency name then record the index
- * of that currency name for use when the user leaves the widget.
- *
- * @param widget Unused.
- *
- * @param gce A pointer to a currency entry widget. */
-static void
-gnc_changed_cb (GtkComboBox *widget,
- GNCCurrencyEdit *gce)
-{
- GNCCurrencyEditPrivate *priv;
- gint current;
-
- priv = GET_PRIVATE(gce);
- current = gtk_combo_box_get_active(widget);
- if (current == -1)
- return;
- priv->last_index = current;
-}
-
-
-/** The completion attached to currency edit widget has selected a
- * match. This function extracts the completed string from the
- * completion code's temporary model, and uses that to set the index
- * of that currency name for use when the user leaves the widget.
- * This should always point to a valid currency name since the user
- * made the selection from a list of currency names.
- *
- * @param completion Unused.
- *
- * @param comp_model A temporary model used by completion code that
- * contains only the current matches.
- *
- * @param comp_iter The iter in the completion's temporary model
- * that represents the user selected match.
- *
- * @param gce A pointer to a currency entry widget. */
-static gboolean
-gnc_match_selected_cb (GtkEntryCompletion *completion,
- GtkTreeModel *comp_model,
- GtkTreeIter *comp_iter,
- GNCCurrencyEdit *gce)
-{
- gchar *text;
-
- gtk_tree_model_get(comp_model, comp_iter, 0, &text, -1);
- gce_set_by_string(gce, text);
- return FALSE;
-}
-
-
-/** The focus left the currency edit widget, so reset the widget to
- * its last known good value. If the widget value contained a valid
- * currency then this is a noop. Otherwise the widget will be reset
- * to the last user selected currency. This latter state will occur
- * if the user has typed characters directly into the widget but not
- * selected a completion.
- *
- * @param entry Unused.
- *
- * @param event Unused.
- *
- * @param gce A pointer to a currency entry widget. */
-static gboolean
-gce_focus_out_cb (GtkEntry *entry,
- GdkEventFocus *event,
- GNCCurrencyEdit *gce)
-{
- GNCCurrencyEditPrivate *priv;
-
- priv = GET_PRIVATE(gce);
- gtk_combo_box_set_active(GTK_COMBO_BOX(gce), priv->last_index);
- return FALSE;
-}
-
-
/** This auxiliary function adds a single currency name to the combo
* box. It is called as an iterator function when running a list of
* currencies.
@@ -316,11 +190,8 @@
GtkWidget *
gnc_currency_edit_new (void)
{
- GNCCurrencyEditPrivate *priv;
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,
@@ -329,24 +200,9 @@
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. */
- priv = GET_PRIVATE(gce);
- priv->changed_id =
- g_signal_connect(gce, "changed",
- G_CALLBACK(gnc_changed_cb), gce);
- g_signal_connect(completion, "match_selected",
- G_CALLBACK(gnc_match_selected_cb), gce);
- g_signal_connect(entry, "focus-out-event",
- G_CALLBACK(gce_focus_out_cb), gce);
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(gce));
/* Fill in all the data. */
fill_currencies (gce);
@@ -378,7 +234,7 @@
g_return_if_fail(currency != NULL);
printname = gnc_commodity_get_printname(currency);
- gce_set_by_string(gce, printname);
+ gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(gce), printname);
}
Modified: gnucash/trunk/src/gnome-utils/gnc-date-delta.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-delta.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-date-delta.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -158,8 +158,8 @@
gnc_date_delta_init (GNCDateDelta *gdd)
{
gdd->value_spin = NULL;
- gdd->units_menu = NULL;
- gdd->polarity_menu = NULL;
+ gdd->units_combo = NULL;
+ gdd->polarity_combo = NULL;
gdd->units = 0;
gdd->polarity = 0;
@@ -194,93 +194,59 @@
}
static void
-set_units (GtkWidget *widget, gpointer data)
+set_units (GtkComboBox *combo, GNCDateDelta *gdd)
{
- GNCDateDeltaUnits units;
- GNCDateDelta *gdd;
+ gint active;
- units = GPOINTER_TO_INT(data);
- gdd = GNC_DATE_DELTA(g_object_get_data(G_OBJECT(widget), GDD_LABEL));
+ active = gtk_combo_box_get_active(GTK_COMBO_BOX(gdd->units_combo));
+ if ((active < GNC_DATE_DELTA_DAYS) || (active > GNC_DATE_DELTA_YEARS))
+ active = GNC_DATE_DELTA_DAYS;
+ gdd->units = active;
- gdd->units = units;
-
g_signal_emit (gdd, date_delta_signals [UNITS_CHANGED], 0);
g_signal_emit (gdd, date_delta_signals [DELTA_CHANGED], 0);
}
static void
-fill_units_menu(GNCDateDelta *gdd)
+fill_units_combo(GNCDateDelta *gdd)
{
- GtkWidget *menu;
- GtkWidget *item;
- char *strings[] = {
- _("Days"),
- _("Weeks"),
- _("Months"),
- _("Years"),
- NULL
- };
- gint i;
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
+ _("Days"));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
+ _("Weeks"));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
+ _("Months"));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
+ _("Years"));
- menu = gtk_menu_new ();
- gtk_widget_show(menu);
-
- for (i = 0; strings[i] != NULL; i++)
- {
- item = gtk_menu_item_new_with_label (strings[i]);
- g_object_set_data(G_OBJECT(item), GDD_LABEL, gdd);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show(item);
-
- g_signal_connect (item, "activate",
- G_CALLBACK (set_units), GINT_TO_POINTER(i));
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gdd->units_menu), menu);
+ g_signal_connect (gdd->units_combo, "changed",
+ G_CALLBACK (set_units), gdd);
}
static void
-set_polarity (GtkWidget *widget, gpointer data)
+set_polarity (GtkComboBox *combo, GNCDateDelta *gdd)
{
- GNCDateDeltaPolarity polarity;
- GNCDateDelta *gdd;
+ gint active;
- polarity = GPOINTER_TO_INT(data);
- gdd = GNC_DATE_DELTA(g_object_get_data(G_OBJECT(widget), GDD_LABEL));
+ active = gtk_combo_box_get_active(GTK_COMBO_BOX(gdd->units_combo));
+ if ((active < GNC_DATE_DELTA_PAST) || (active > GNC_DATE_DELTA_FUTURE))
+ active = GNC_DATE_DELTA_PAST;
+ gdd->polarity = active;
- gdd->polarity = polarity;
-
g_signal_emit (gdd, date_delta_signals [POLARITY_CHANGED], 0);
g_signal_emit (gdd, date_delta_signals [DELTA_CHANGED], 0);
}
static void
-fill_polarity_menu(GNCDateDelta *gdd)
+fill_polarity_combo(GNCDateDelta *gdd)
{
- GtkWidget *menu;
- GtkWidget *item;
- char *strings[] = {
- _("Ago"),
- _("From Now"),
- NULL
- };
- gint i;
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->polarity_combo),
+ _("Ago"));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->polarity_combo),
+ _("From Now"));
- menu = gtk_menu_new ();
- gtk_widget_show(menu);
-
- for (i = 0; strings[i] != NULL; i++)
- {
- item = gtk_menu_item_new_with_label (strings[i]);
- g_object_set_data(G_OBJECT(item), GDD_LABEL, gdd);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show(item);
-
- g_signal_connect (item, "activate",
- G_CALLBACK (set_polarity), GINT_TO_POINTER(i));
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gdd->polarity_menu), menu);
+ g_signal_connect (gdd->polarity_combo, "changed",
+ G_CALLBACK(set_polarity), gdd);
}
static void
@@ -297,18 +263,18 @@
g_signal_connect(gdd->value_spin, "changed",
G_CALLBACK(value_changed), gdd);
- gdd->units_menu = gtk_option_menu_new();
- fill_units_menu(gdd);
- gtk_option_menu_set_history(GTK_OPTION_MENU(gdd->units_menu), 0);
- gtk_box_pack_start(GTK_BOX(gdd), gdd->units_menu, FALSE, FALSE, 0);
- gtk_widget_show(gdd->units_menu);
+ gdd->units_combo = gtk_combo_box_new_text();
+ fill_units_combo(gdd);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->units_combo), 0);
+ gtk_box_pack_start(GTK_BOX(gdd), gdd->units_combo, FALSE, FALSE, 0);
+ gtk_widget_show(gdd->units_combo);
- gdd->polarity_menu = gtk_option_menu_new();
- fill_polarity_menu(gdd);
- gtk_option_menu_set_history(GTK_OPTION_MENU(gdd->polarity_menu), 0);
- gtk_box_pack_start(GTK_BOX(gdd), gdd->polarity_menu, FALSE, FALSE, 0);
+ gdd->polarity_combo = gtk_combo_box_new_text();
+ fill_polarity_combo(gdd);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->polarity_combo), 0);
+ gtk_box_pack_start(GTK_BOX(gdd), gdd->polarity_combo, FALSE, FALSE, 0);
if (gdd->show_polarity)
- gtk_widget_show(gdd->polarity_menu);
+ gtk_widget_show(gdd->polarity_combo);
}
/**
@@ -382,7 +348,7 @@
gdd->units = units;
- gtk_option_menu_set_history(GTK_OPTION_MENU(gdd->units_menu), units);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->units_combo), units);
}
/**
@@ -417,7 +383,7 @@
gdd->polarity = polarity;
- gtk_option_menu_set_history(GTK_OPTION_MENU(gdd->polarity_menu), polarity);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->polarity_combo), polarity);
}
/**
@@ -451,7 +417,7 @@
gdd->show_polarity = show_polarity;
if (show_polarity)
- gtk_widget_show(gdd->polarity_menu);
+ gtk_widget_show(gdd->polarity_combo);
else
- gtk_widget_hide(gdd->polarity_menu);
+ gtk_widget_hide(gdd->polarity_combo);
}
Modified: gnucash/trunk/src/gnome-utils/gnc-date-delta.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-delta.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-date-delta.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -54,8 +54,8 @@
GtkHBox hbox;
GtkWidget *value_spin;
- GtkWidget *units_menu;
- GtkWidget *polarity_menu;
+ GtkWidget *units_combo;
+ GtkWidget *polarity_combo;
GNCDateDeltaUnits units;
GNCDateDeltaPolarity polarity;
Modified: gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -11,6 +11,12 @@
#include "gnc-ui.h"
#include "gnc-gui-query.h"
+enum file_cols {
+ FILE_COL_FILENAME = 0,
+ FILE_COL_POINTER,
+ NUM_FILE_COLS
+};
+
static void gnc_druid_provider_multifile_gnome_class_init (GNCDruidProviderMultifileGnomeClass *class);
static void gnc_druid_provider_multifile_gnome_finalize (GObject *obj);
@@ -52,13 +58,19 @@
}
static void
-gnc_dpmfg_select_file_cb(GtkCList *clist, int row, int column, GdkEvent *event,
- gpointer user_data)
+gnc_dpmfg_select_file_cb(GtkTreeSelection *selection,
+ GNCDruidProviderMultifileGnome *prov_mf)
{
- GNCDruidProviderMultifileGnome *prov_mf = user_data;
- gpointer file = gtk_clist_get_row_data(clist, row);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
- prov_mf->selected_file = file;
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ gtk_tree_model_get(model, &iter,
+ FILE_COL_POINTER, &prov_mf->selected_file,
+ -1);
+ } else {
+ prov_mf->selected_file = NULL;
+ }
}
static void
@@ -66,35 +78,46 @@
{
GNCDruidProviderDescMultifile *desc_mf =
GNC_DRUID_PROVIDER_DESC_MULTIFILE(prov_mf->parent.desc);
- GtkCList *clist = GTK_CLIST(prov_mf->list);
+ GtkTreeView *view = GTK_TREE_VIEW(prov_mf->file_view);
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
GList *list;
const gchar* filename;
- gint row = 0;
- gint sel_row = -1;
gpointer be_ctx = prov_mf->parent.druid->be_ctx;
- gtk_clist_freeze(clist);
- gtk_clist_clear(clist);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+ gtk_list_store_clear(store);
for (list = desc_mf->get_files(be_ctx); list; list = list->next) {
filename = desc_mf->get_filename(be_ctx, list->data);
- row = gtk_clist_append(clist, (char**)&filename);
- gtk_clist_set_row_data(clist, row, list->data);
-
- if (prov_mf->selected_file == list->data)
- sel_row = row;
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ FILE_COL_FILENAME, filename,
+ FILE_COL_POINTER, list->data,
+ -1);
+ if (prov_mf->selected_file == list->data) {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
}
- gtk_clist_thaw(clist);
-
- if(sel_row >= 0)
- gtk_clist_select_row(clist, sel_row, 0);
- else
+ if (reference) {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path) {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
+ } else {
prov_mf->selected_file = NULL;
-
- /* hopefully we don't need to queue the actual window */
- gtk_widget_queue_resize(GTK_WIDGET(prov_mf->page));
+ }
}
static GNCDruidPage*
@@ -188,8 +211,12 @@
GNCDruidProviderMultifileGnome *prov;
GNCDruidProviderDescMultifile *desc_mf;
GNCDruidCB *cb;
- GtkWidget *window, *page, *list, *button1, *button2, *label;
+ GtkWidget *window, *page, *view, *button1, *button2, *label;
GladeXML *xml;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
/* verify that this is the correct provider descriptor */
g_return_val_if_fail(IS_GNC_DRUID_PROVIDER_DESC_MULTIFILE(desc), NULL);
@@ -218,7 +245,7 @@
g_assert(xml);
window = glade_xml_get_widget(xml, "Multifile Provider Window");
page = glade_xml_get_widget(xml, "Multifile Provider Page");
- list = glade_xml_get_widget(xml, "file_list");
+ view = glade_xml_get_widget(xml, "file_view");
button1 = glade_xml_get_widget(xml, "load_button");
button2 = glade_xml_get_widget(xml, "unload_button");
label = glade_xml_get_widget(xml, "instruction_label");
@@ -233,11 +260,23 @@
g_assert(page);
prov->page = GNOME_DRUID_PAGE(page);
prov_base->pages = g_list_prepend(NULL, page);
- prov->list = list;
+ prov->file_view = view;
+ /* Set up the file view */
+ store = gtk_list_store_new (NUM_FILE_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", FILE_COL_FILENAME,
+ NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
+ g_signal_connect(selection, "changed",
+ (GCallback)gnc_dpmfg_select_file_cb, prov);
+
/* Set the page properties */
- g_signal_connect(G_OBJECT(list), "select-row",
- (GCallback)gnc_dpmfg_select_file_cb, prov);
g_signal_connect(G_OBJECT(button1), "clicked",
(GCallback)gnc_dpmfg_load_another_cb, prov);
g_signal_connect(G_OBJECT(button2), "clicked",
Modified: gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-druid-provider-multifile-gnome.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -41,7 +41,7 @@
GNCDruidProvider parent;
GnomeDruidPage* page;
- GtkWidget* list;
+ GtkWidget* file_view;
GNCDruidCB* cb;
gpointer selected_file;
Modified: gnucash/trunk/src/gnome-utils/gnc-frequency.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-frequency.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-frequency.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* gnc-frequency.c -- GnuCash widget for frequency editing. *
* Copyright (C) 2001,2002 Joshua Sled <jsled at asynchronous.org> *
* Copyright (C) 2003 Linas Vepstas <linas at linas.org> *
+ * Copyright (C) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -51,7 +52,7 @@
static void gnc_frequency_class_init( GNCFrequencyClass *klass );
-static void freq_option_value_changed( GtkMenuShell *b, gpointer d );
+static void freq_combo_changed( GtkComboBox *b, gpointer d );
static void start_date_changed( GNCDateEdit *gde, gpointer d );
static void spin_changed_helper( GtkAdjustment *adj, gpointer d );
@@ -156,11 +157,11 @@
GtkWidget *o;
GtkAdjustment *adj;
- static const struct optionMenuTuple {
+ static const struct comboBoxTuple {
char *name;
void (*fn)();
- } optionMenus[] = {
- { "freq_option", freq_option_value_changed },
+ } comboBoxes[] = {
+ { "freq_combobox", freq_combo_changed },
{ "semimonthly_first", semimonthly_sel_changed },
{ "semimonthly_second", semimonthly_sel_changed },
{ "monthly_day", monthly_sel_changed },
@@ -191,8 +192,8 @@
gf->gxml = gnc_glade_xml_new( "sched-xact.glade", "gncfreq_vbox" );
o = glade_xml_get_widget( gf->gxml, "gncfreq_nb" );
gf->nb = GTK_NOTEBOOK(o);
- o = glade_xml_get_widget( gf->gxml, "freq_option" );
- gf->freqOpt = GTK_OPTION_MENU(o);
+ o = glade_xml_get_widget( gf->gxml, "freq_combobox" );
+ gf->freqComboBox = GTK_COMBO_BOX(o);
gf->startDate = GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), FALSE, FALSE ));
/* Add the new widget to the table. */
{
@@ -206,17 +207,13 @@
gf->vb = vb;
gtk_container_add( GTK_CONTAINER(&gf->widget), GTK_WIDGET(gf->vb) );
- /* initialize the option menus */
- for ( i=0; optionMenus[i].name != NULL; i++ ) {
- o = glade_xml_get_widget( gf->gxml, optionMenus[i].name );
- gnc_option_menu_init( GTK_WIDGET(o) );
- if ( optionMenus[i].fn != NULL ) {
- o = gtk_option_menu_get_menu(GTK_OPTION_MENU(o));
- /* FIXME: having the user-data be a struct of a
- * calendar name and the GNCFrequency would allow a
- * single callback fn */
- g_signal_connect( o, "selection-done",
- G_CALLBACK(optionMenus[i].fn), gf );
+ /* initialize the combo boxes */
+ for ( i=0; comboBoxes[i].name != NULL; i++ ) {
+ o = glade_xml_get_widget( gf->gxml, comboBoxes[i].name );
+ gtk_combo_box_set_active(GTK_COMBO_BOX(o), 0);
+ if ( comboBoxes[i].fn != NULL ) {
+ g_signal_connect( o, "changed",
+ G_CALLBACK(comboBoxes[i].fn), gf );
}
}
@@ -281,7 +278,7 @@
g_assert( page != -1 );
gtk_notebook_set_current_page( gf->nb, page );
- gtk_option_menu_set_history( gf->freqOpt, page );
+ gtk_combo_box_set_active( gf->freqComboBox, page );
switch ( uift )
{
@@ -425,7 +422,7 @@
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
/* first date */
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o), firstDayOfMonth-1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o), firstDayOfMonth-1 );
/* second date */
subFS = (FreqSpec*)(g_list_nth( list, 1 )->data);
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
@@ -434,7 +431,7 @@
PERR( "Inappropriate FreqSpec type\n" );
return;
}
- gtk_option_menu_set_history( GTK_OPTION_MENU(o), secondDayOfMonth-1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o), secondDayOfMonth-1 );
}
break;
case UIFREQ_MONTHLY:
@@ -452,7 +449,7 @@
o = glade_xml_get_widget( gf->gxml, "monthly_spin" );
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o), dayOfMonth-1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o), dayOfMonth-1 );
/* set the day-of-month */
}
break;
@@ -544,9 +541,9 @@
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o),
(int)rint(floor(monthlyMult / 12)) );
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o), monthOffset );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o), monthOffset );
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o), dayOfMonth-1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o), dayOfMonth-1 );
}
break;
default:
@@ -558,7 +555,7 @@
g_signal_emit_by_name( gf, "changed" );
}
-static void
+void
gnc_frequency_setup_default( GNCFrequency *gf, FreqSpec *fs, GDate *date )
{
time_t secs;
@@ -581,7 +578,7 @@
g_assert( page != -1 );
gtk_notebook_set_current_page( gf->nb, page );
- gtk_option_menu_set_history( gf->freqOpt, page );
+ gtk_combo_box_set_active( gf->freqComboBox, page );
}
/* Setup the start date */
@@ -757,7 +754,7 @@
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
- day = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ day = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
tmpFS = xaccFreqSpecMalloc(gnc_get_current_book ());
g_date_to_struct_tm( &gd, &stm);
if ( day >= stm.tm_mday ) {
@@ -771,7 +768,7 @@
xaccFreqSpecCompositeAdd( fs, tmpFS );
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
- day = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ day = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
tmpFS = xaccFreqSpecMalloc(gnc_get_current_book ());
tmpTimeT = gnc_date_edit_get_date( gf->startDate );
g_date_set_time_t( &gd, tmpTimeT );
@@ -796,7 +793,7 @@
g_date_to_struct_tm( &gd, &stm);
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
- day = gnc_option_menu_get_active( GTK_WIDGET(o) ) + 1;
+ day = gtk_combo_box_get_active( GTK_COMBO_BOX(o) ) + 1;
stm.tm_mday = day;
g_date_set_time_t( &gd, mktime( &stm ) );
xaccFreqSpecSetMonthly( fs, &gd, tmpInt );
@@ -857,7 +854,7 @@
o = glade_xml_get_widget( ((GNCFrequency*)d)->gxml,
"monthly_day" );
- dayOfMonth = gnc_option_menu_get_active( GTK_WIDGET(o) ) + 1;
+ dayOfMonth = gtk_combo_box_get_active( GTK_COMBO_BOX(o) ) + 1;
tmptt = gnc_date_edit_get_date( gf->startDate );
tmptm = localtime( &tmptt );
@@ -888,10 +885,10 @@
tmptm = localtime( &tmptt );
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
- tmpint = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ tmpint = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
- if ( tmpint > gnc_option_menu_get_active( GTK_WIDGET(o) )+1 ) {
- tmpint = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ if ( tmpint > gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1 ) {
+ tmpint = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
}
tmptm->tm_mday = tmpint;
@@ -946,8 +943,8 @@
time_t tmpTT;
struct tm *tmpTm;
- occur = gnc_option_menu_get_active( occurW );
- day = gnc_option_menu_get_active( dayOfMonthW ) + 1;
+ occur = gtk_combo_box_get_active( GTK_COMBO_BOX(occurW) );
+ day = gtk_combo_box_get_active( GTK_COMBO_BOX(dayOfMonthW) ) + 1;
tmpTT = gnc_date_edit_get_date( gf->startDate );
tmpTm = localtime( &tmpTT );
@@ -975,9 +972,9 @@
tmptm = localtime( &tmptt );
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
- tmptm->tm_mon = gnc_option_menu_get_active( GTK_WIDGET(o) );
+ tmptm->tm_mon = gtk_combo_box_get_active( GTK_COMBO_BOX(o) );
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
- tmptm->tm_mday = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ tmptm->tm_mday = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
/* FIXME: correct for
option_menu_selected_day > min(31,correct_days_in_month)
@@ -1005,7 +1002,7 @@
}
static void
-freq_option_value_changed( GtkMenuShell *b, gpointer d )
+freq_combo_changed( GtkComboBox *b, gpointer d )
{
GNCFrequency *gf = (GNCFrequency*)d;
int optIdx;
@@ -1015,7 +1012,7 @@
GtkWidget *o;
/* Set the new page. */
- optIdx = gnc_option_menu_get_active( GTK_WIDGET(((GNCFrequency*)d)->freqOpt) );
+ optIdx = gtk_combo_box_get_active( GTK_COMBO_BOX(((GNCFrequency*)d)->freqComboBox) );
gtk_notebook_set_current_page( ((GNCFrequency*)d)->nb, optIdx );
/* setup initial values for new page, as possible. */
@@ -1033,45 +1030,45 @@
tmpTm->tm_mday += 14;
tmpDate = mktime( tmpTm );
tmpTm = localtime( &tmpDate );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- min( tmpTm->tm_mday, tmpDayOfMonth ) - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ min( tmpTm->tm_mday, tmpDayOfMonth ) - 1 );
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- max( tmpTm->tm_mday, tmpDayOfMonth ) - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ max( tmpTm->tm_mday, tmpDayOfMonth ) - 1 );
}
break;
case UIFREQ_MONTHLY:
/* on the <startdate_dom> */
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday - 1 );
break;
case UIFREQ_QUARTERLY:
/* on the <startdate_dom> */
o = glade_xml_get_widget( gf->gxml, "quarterly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday - 1 );
break;
case UIFREQ_TRI_ANUALLY:
/* on the <startdate_dom> */
o = glade_xml_get_widget( gf->gxml, "triyearly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday - 1 );
break;
case UIFREQ_SEMI_YEARLY:
/* on the <startdate_dom> */
o = glade_xml_get_widget( gf->gxml, "semiyearly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday - 1 );
break;
case UIFREQ_YEARLY:
/* on the <startdate_mon>, <startdate_dom> */
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mon );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mon );
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday - 1 );
break;
default:
/* nuttin can be done, for whatever reason. */
@@ -1088,10 +1085,10 @@
{
struct tm *tmpTm;
tmpTm = localtime( &startDate );
- gtk_option_menu_set_history( GTK_OPTION_MENU(occurOptMenu),
- tmpTm->tm_mon % monthsInRange );
- gtk_option_menu_set_history( GTK_OPTION_MENU(dayOptMenu),
- tmpTm->tm_mday - 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(occurOptMenu),
+ tmpTm->tm_mon % monthsInRange );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(dayOptMenu),
+ tmpTm->tm_mday - 1 );
}
static void
@@ -1125,23 +1122,23 @@
{
gint first_day;
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
- first_day = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
+ first_day = gtk_combo_box_get_active( GTK_COMBO_BOX(o) )+1;
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
- if ( first_day < gnc_option_menu_get_active(
- GTK_WIDGET(o) )+1 ) {
+ if ( first_day < gtk_combo_box_get_active(
+ GTK_COMBO_BOX(o) )+1 ) {
o = glade_xml_get_widget( gf->gxml,
"semimonthly_first" );
}
tmpTm = localtime( &dateFromGDE );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
tmpTm->tm_mday-1 );
}
break;
case UIFREQ_MONTHLY:
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
tmpTm = localtime( &dateFromGDE );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
(tmpTm->tm_mday-1) );
break;
case UIFREQ_QUARTERLY:
@@ -1168,11 +1165,11 @@
case UIFREQ_YEARLY:
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
tmpTm = localtime( &dateFromGDE );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mon );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mon );
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
- gtk_option_menu_set_history( GTK_OPTION_MENU(o),
- tmpTm->tm_mday-1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(o),
+ tmpTm->tm_mday-1 );
break;
default:
PERR( "unknown uift value %d\n", uift );
Modified: gnucash/trunk/src/gnome-utils/gnc-frequency.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-frequency.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gnc-frequency.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -45,7 +45,7 @@
GtkVBox *vb;
GtkNotebook *nb;
- GtkOptionMenu *freqOpt;
+ GtkComboBox *freqComboBox;
GNCDateEdit *startDate;
GladeXML *gxml;
} GNCFrequency;
@@ -102,4 +102,7 @@
*/
void gnc_frequency_set_date_label_text (GNCFrequency *gf, const gchar *txt);
+void
+gnc_frequency_setup_default( GNCFrequency *gf, FreqSpec *fs, GDate *date );
+
#endif /* !defined( GNC_FREQUENCY_H ) */
Modified: gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm
===================================================================
--- gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm 2006-08-02 18:13:30 UTC (rev 14588)
@@ -392,21 +392,8 @@
;; dialog-utils.h
- (gw:wrap-as-wct ws '<gnc:GtkCList> "GtkCList*" "const GtkCList*")
-
(gw:wrap-function
ws
- 'gnc:clist-set-check
- '<gw:void>
- "gnc_clist_set_check"
- '((<gnc:GtkCList> clist)
- (<gw:int> row)
- (<gw:int> col)
- (<gw:bool> checked))
- "Set the check status of a clist cell.")
-
- (gw:wrap-function
- ws
'gnc:set-busy-cursor
'<gw:void>
"gnc_set_busy_cursor"
Modified: gnucash/trunk/src/import-export/binary-import/druid-commodity.c
===================================================================
--- gnucash/trunk/src/import-export/binary-import/druid-commodity.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/binary-import/druid-commodity.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -393,9 +393,9 @@
{
CommodityDruid * cd = user_data;
CommodityDruidPage * dpage = g_object_get_data(G_OBJECT(page), "page_struct");
- const char * new_type;
- const char * new_name;
- const char * new_mnemonic;
+ gchar * new_type;
+ const gchar * new_name;
+ const gchar * new_mnemonic;
gnc_commodity * new_comm;
new_type = gnc_ui_namespace_picker_ns (dpage->new_type_combo);
@@ -408,6 +408,7 @@
_("You must put values for the type, name, "
"and abbreviation of the currency/stock."));
+ g_free(new_type);
return TRUE;
}
@@ -418,7 +419,7 @@
gnc_warning_dialog(cd->window,
_("You must enter an existing national "
"currency or enter a different type."));
-
+ g_free(new_type);
return TRUE;
}
new_comm = g_hash_table_lookup(cd->new_map, dpage->old_name);
@@ -429,6 +430,7 @@
gnc_commodity_set_namespace(new_comm, new_type);
gnc_commodity_set_mnemonic(new_comm, new_mnemonic);
+ g_free(new_type);
return FALSE;
}
Modified: gnucash/trunk/src/import-export/generic-import.glade
===================================================================
--- gnucash/trunk/src/import-export/generic-import.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/generic-import.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -261,151 +261,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="downloaded_clist">
+ <widget class="GtkTreeView" id="downloaded_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">9</property>
- <property name="column_widths">67,89,49,109,43,58,32,29,34</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="downloaded_transaction_select_cb"/>
- <signal name="unselect_row" handler="downloaded_transaction_unselect_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847716">
- <property name="label" translatable="yes">Date</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847717">
- <property name="label" translatable="yes">Account</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847718">
- <property name="label" translatable="yes">Amount</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847719">
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847720">
- <property name="label" translatable="yes">Memo</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847721">
- <property name="label" translatable="yes">A</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847722">
- <property name="label" translatable="yes">R</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847723">
- <property name="label" translatable="yes">EDIT</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847724">
- <property name="label" translatable="yes">Select Import Action</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">True</property>
+ <property name="enable_search">False</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -415,6 +278,10 @@
<property name="fill">True</property>
</packing>
</child>
+
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -785,105 +652,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="downloaded_clist">
+ <widget class="GtkTreeView" id="downloaded_view">
<property name="visible">True</property>
- <property name="n_columns">6</property>
- <property name="column_widths">80,80,80,80,80,80</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="downloaded_transaction_select_cb"/>
- <signal name="unselect_row" handler="downloaded_transaction_unselect_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847779">
- <property name="label" translatable="yes">Account</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847780">
- <property name="label" translatable="yes">Date</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847781">
- <property name="label" translatable="yes">Amount</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847782">
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847783">
- <property name="label" translatable="yes">Memo</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847784">
- <property name="label" translatable="yes">Imbalance</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -924,91 +700,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="matched_clist">
+ <widget class="GtkTreeView" id="matched_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">5</property>
- <property name="column_widths">80,80,80,80,80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="match_transaction_select_cb"/>
- <signal name="unselect_row" handler="match_transaction_unselect_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847767">
- <property name="label" translatable="yes">Confidence</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847768">
- <property name="label" translatable="yes">Date</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847769">
- <property name="label" translatable="yes">Amount</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847770">
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847771">
- <property name="label" translatable="yes">Memo</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/import-export/gnc-import-format-gnome.c
===================================================================
--- gnucash/trunk/src/import-export/gnc-import-format-gnome.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/gnc-import-format-gnome.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -27,6 +27,12 @@
gnc_import_format_gnome_class_init, NULL,
gnc_import_format_gnome_get_type)
+enum ifg_cols {
+ IFG_COL_TEXT = 0,
+ IFG_COL_VALUE,
+ NUM_IFG_COLS
+};
+
static void
gnc_import_format_gnome_class_init (GNCImportProvFormatGnomeClass *klass)
{
@@ -54,39 +60,47 @@
}
static void
-gnc_ifg_option_changed (GtkWidget *widget, GNCImportProvFormatGnome *prov_f)
+gnc_ifg_option_changed (GtkComboBox *combo, GNCImportProvFormatGnome *prov_f)
{
- prov_f->choice = (GncImportFormat)
- g_object_get_data(G_OBJECT(widget), "option");
-}
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint value;
-static GtkWidget *
-add_menu_item (GtkWidget *menu, gpointer user_data, char *label,
- GncImportFormat option)
-{
- GtkWidget *item = gtk_menu_item_new_with_label(label);
- g_object_set_data(G_OBJECT(item), "option", (gpointer) option);
- g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(gnc_ifg_option_changed),
- user_data);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
- gtk_widget_show(item);
- return item;
+ g_return_if_fail(GTK_IS_COMBO_BOX(combo));
+ g_return_if_fail(value);
+
+ model = gtk_combo_box_get_model(combo);
+ if (!gtk_combo_box_get_active_iter(combo, &iter))
+ return;
+
+ gtk_tree_model_get(model, &iter, IFG_COL_VALUE, &value, -1);
+ prov_f->choice = (GncImportFormat)value;
}
#define ADD_MENU_ITEM(str,op) { \
- if (formats & op) { \
- item = add_menu_item(menu, prov_f, str, op); \
- if (!first) first = item; \
- } \
+ gtk_list_store_append(store, &iter); \
+ gtk_list_store_set(store, &iter, \
+ IFG_COL_TEXT, str, \
+ IFG_COL_VALUE, op, \
+ -1); \
}
static void
make_menu (GNCImportProvFormatGnome *prov_f, GncImportFormat formats)
{
- GtkWidget *menu, *item, *first = NULL;
+ GtkComboBox *combo = prov_f->format_combo;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
- menu = gtk_menu_new();
+ store = gtk_list_store_new(NUM_IFG_COLS, G_TYPE_STRING, G_TYPE_INT);
+ gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer,
+ "text", IFG_COL_TEXT);
+
/* Numeric formats */
ADD_MENU_ITEM(_("Period-as-decimal (1,000.00)"), GNCIF_NUM_PERIOD);
ADD_MENU_ITEM(_("Comma-as-decimal (1.000,00)"), GNCIF_NUM_COMMA);
@@ -97,12 +111,9 @@
ADD_MENU_ITEM(_("y-m-d"), GNCIF_DATE_YMD);
ADD_MENU_ITEM(_("y-d-m"), GNCIF_DATE_YDM);
- gtk_option_menu_set_menu(prov_f->format_menu, menu);
-
- g_signal_emit_by_name(G_OBJECT(first), "activate", prov_f);
- gtk_option_menu_set_history(prov_f->format_menu, 0);
-
- gtk_widget_show(menu);
+ g_signal_connect(G_OBJECT(prov_f->format_combo), "changed",
+ G_CALLBACK(gnc_ifg_option_changed), prov_f);
+ gtk_combo_box_set_active(prov_f->format_combo, 0);
}
static GNCDruidPage*
@@ -153,7 +164,7 @@
GNCImportProvFormatGnome *prov;
GNCImportDescFormat *desc_f;
GNCImportFormatCB *cb;
- GtkWidget *window, *page, *label, *format_menu, *sample_label;
+ GtkWidget *window, *page, *label, *format_combo, *sample_label;
GladeXML *xml;
/* verify that this is the correct provider descriptor */
@@ -183,10 +194,10 @@
window = glade_xml_get_widget(xml, "Format Provider Window");
page = glade_xml_get_widget(xml, "Format Provider Page");
label = glade_xml_get_widget(xml, "inst_label");
- format_menu = glade_xml_get_widget(xml, "import_format_menu");
+ format_combo = glade_xml_get_widget(xml, "import_format_combo");
sample_label = glade_xml_get_widget(xml, "format_sample_label");
- prov->format_menu = GTK_OPTION_MENU(format_menu);
+ prov->format_combo = GTK_COMBO_BOX(format_combo);
prov->sample_label = GTK_LABEL(sample_label);
g_object_ref(page);
Modified: gnucash/trunk/src/import-export/gnc-import-format-gnome.h
===================================================================
--- gnucash/trunk/src/import-export/gnc-import-format-gnome.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/gnc-import-format-gnome.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -28,7 +28,7 @@
GNCDruidProvider parent;
GnomeDruidPage* page;
- GtkOptionMenu* format_menu;
+ GtkComboBox* format_combo;
GtkLabel* sample_label;
GncImportFormat choice;
Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -1,6 +1,7 @@
/********************************************************************\
* druid-hbci-initial.c -- hbci creation functionality *
* Copyright (C) 2002 Christian Stimming *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -51,6 +52,15 @@
/* #define DEFAULT_HBCI_VERSION 201 */
+enum account_list_cols {
+ ACCOUNT_LIST_COL_INDEX = 0,
+ ACCOUNT_LIST_COL_HBCI_NAME,
+ ACCOUNT_LIST_COL_HBCI_ACCT,
+ ACCOUNT_LIST_COL_GNC_NAME,
+ ACCOUNT_LIST_COL_CHECKED,
+ NUM_ACCOUNT_LIST_COLS
+};
+
struct _hbciinitialinfo
{
GtkWidget *window;
@@ -61,35 +71,19 @@
/* account match page */
GtkWidget *accountpage;
- GtkWidget *accountlist;
+ GtkTreeView *accountview;
+ GtkListStore *accountstore;
/* OpenHBCI stuff */
AB_BANKING *api;
GNCInteractor *interactor;
- /* account match: row_number (int) -> hbci_account */
- GHashTable *hbci_hash;
/* hbci_account (direct) -> gnucash_account -- DO NOT DELETE THE KEYS! */
GHashTable *gnc_hash;
};
-static gboolean
-hash_remove (gpointer key, gpointer value, gpointer user_data)
-{
- free (key);
- return TRUE;
-}
-
static void
-delete_hash (GHashTable *hash)
-{
- if (hash != NULL) {
- g_hash_table_foreach_remove (hash, &hash_remove, NULL);
- g_hash_table_destroy (hash);
- }
-}
-static void
reset_initial_info (HBCIInitialInfo *info)
{
if (info == NULL) return;
@@ -99,8 +93,6 @@
}
info->api = NULL;
- delete_hash (info->hbci_hash);
- info->hbci_hash = NULL;
if (info->gnc_hash != NULL)
g_hash_table_destroy (info->gnc_hash);
info->gnc_hash = NULL;
@@ -150,48 +142,47 @@
update_accountlist_acc_cb (AB_ACCOUNT *hacc, gpointer user_data)
{
HBCIInitialInfo *info = user_data;
- gchar *row_text[3];
+ gchar *gnc_name, *hbci_name;
Account *gacc;
- int row;
- gint *row_key;
+ GtkTreeIter iter;
g_assert(hacc);
g_assert(info);
- row_text[2] = "";
-
- row_text[0] = gnc_hbci_account_longname(hacc);
+
+ hbci_name = gnc_hbci_account_longname(hacc);
/* Get corresponding gnucash account */
gacc = g_hash_table_lookup (info->gnc_hash, hacc);
/* Build the text for the gnucash account. */
if (gacc == NULL)
- row_text[1] = "";
+ gnc_name = g_strdup("");
else
- row_text[1] = xaccAccountGetFullName (gacc);
+ gnc_name = xaccAccountGetFullName (gacc);
- /* Add this row to the list */
- row = gtk_clist_append (GTK_CLIST (info->accountlist), row_text);
+ gtk_list_store_append(info->accountstore, &iter);
+ gtk_list_store_set(info->accountstore, &iter,
+ ACCOUNT_LIST_COL_HBCI_NAME, hbci_name,
+ ACCOUNT_LIST_COL_HBCI_ACCT, hacc,
+ ACCOUNT_LIST_COL_GNC_NAME, gnc_name,
+ ACCOUNT_LIST_COL_CHECKED, FALSE,
+ -1);
- /* Set the "new" checkbox. */
- gnc_clist_set_check (GTK_CLIST (info->accountlist), row, 2,
- FALSE);
-
- /* Store the row_number -> hbci_account hash reference. */
- row_key = g_new(gint, 1);
- *row_key = row;
- g_hash_table_insert (info->hbci_hash, row_key, (AB_ACCOUNT*)hacc);
-
+ g_free(gnc_name);
+ g_free(hbci_name);
return NULL;
}
-/* Update the account list GtkCList widget */
+/* Update the account list GtkListStore widget */
static void
update_accountlist (HBCIInitialInfo *info)
{
- int sel_row = 0;
AB_BANKING *banking;
AB_ACCOUNT_LIST2 *acclist;
+ GtkTreeModel *model;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ GtkTreePath *path = NULL;
g_assert(info);
banking = info->api;
@@ -199,15 +190,12 @@
g_assert(info->gnc_hash);
/* Store old selected row here. */
- sel_row = (GTK_CLIST(info->accountlist))->focus_row;
+ selection = gtk_tree_view_get_selection(info->accountview);
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ path = gtk_tree_model_get_path(model, &iter);
/* Delete old list */
- gtk_clist_freeze (GTK_CLIST (info->accountlist));
- gtk_clist_clear (GTK_CLIST (info->accountlist));
-
- /* Delete old hash with row_number -> hbci_account */
- delete_hash (info->hbci_hash);
- info->hbci_hash = g_hash_table_new (&g_int_hash, &g_int_equal);
+ gtk_list_store_clear(info->accountstore);
/* Go through all HBCI accounts */
acclist = AB_Banking_GetAccounts(banking);
@@ -218,14 +206,13 @@
else
printf("update_accountlist: Oops, account list from AB_Banking is NULL.\n");
- /* printf("update_accountlist: HBCI hash has %d entries.\n", g_hash_table_size(info->hbci_hash)); */
/* printf("update_accountlist: GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash)); */
-
- gtk_clist_thaw (GTK_CLIST (info->accountlist));
- /* move to the old selected row */
- (GTK_CLIST(info->accountlist))->focus_row = sel_row;
- gtk_clist_moveto(GTK_CLIST(info->accountlist), sel_row, 0, 0.0, 0.0);
+ if (path) {
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(info->accountview, path, NULL, FALSE, 0.0, 0.0);
+ gtk_tree_path_free(path);
+ }
}
/*
* end update_accountlist
@@ -344,17 +331,24 @@
static void
-on_accountlist_select_row (GtkCList *clist, gint row,
- gint column, GdkEvent *event,
- gpointer user_data)
+on_accountlist_changed (GtkTreeSelection *selection,
+ gpointer user_data)
{
HBCIInitialInfo *info = user_data;
AB_ACCOUNT *hbci_acc;
Account *gnc_acc, *old_value;
- gchar *longname;
+ gchar *longname, *gnc_name;
gnc_commodity *currency = NULL;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
- hbci_acc = g_hash_table_lookup (info->hbci_hash, &row);
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ return;
+ gtk_tree_selection_unselect_iter(selection, &iter);
+ gtk_tree_model_get(model, &iter,
+ ACCOUNT_LIST_COL_HBCI_ACCT, &hbci_acc,
+ -1);
+
if (hbci_acc) {
old_value = g_hash_table_lookup (info->gnc_hash, hbci_acc);
@@ -378,12 +372,17 @@
if (gnc_acc) {
if (old_value)
g_hash_table_remove (info->gnc_hash, hbci_acc);
-
g_hash_table_insert (info->gnc_hash, hbci_acc, gnc_acc);
+ gnc_name = xaccAccountGetFullName (gnc_acc);
+ gtk_list_store_set(info->accountstore, &iter,
+ ACCOUNT_LIST_COL_GNC_NAME, gnc_name,
+ -1);
+ g_free(gnc_name);
+ } else {
+ gtk_list_store_set(info->accountstore, &iter,
+ ACCOUNT_LIST_COL_GNC_NAME, "",
+ -1);
}
-
- /* update display */
- update_accountlist(info);
} /* hbci_acc */
}
@@ -544,8 +543,6 @@
/* Reset existing mapping tables */
AB_Banking_Fini (info->api);
- delete_hash (info->hbci_hash);
- info->hbci_hash = NULL;
if (info->gnc_hash != NULL)
g_hash_table_destroy (info->gnc_hash);
info->gnc_hash = NULL;
@@ -626,6 +623,9 @@
HBCIInitialInfo *info;
GladeXML *xml;
GtkWidget *page;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
info = g_new0 (HBCIInitialInfo, 1);
@@ -657,9 +657,39 @@
{
page = glade_xml_get_widget(xml, "account_match_page");
info->accountpage = page;
- info->accountlist = glade_xml_get_widget(xml, "account_page_list");
- g_signal_connect (info->accountlist, "select_row",
- G_CALLBACK (on_accountlist_select_row), info);
+ info->accountview =
+ GTK_TREE_VIEW(glade_xml_get_widget(xml, "account_page_view"));
+ info->accountstore = gtk_list_store_new(NUM_ACCOUNT_LIST_COLS,
+ G_TYPE_INT, G_TYPE_STRING,
+ G_TYPE_POINTER, G_TYPE_STRING,
+ G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(info->accountview, GTK_TREE_MODEL(info->accountstore));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("HBCI account name"),
+ renderer,
+ "text", ACCOUNT_LIST_COL_HBCI_NAME,
+ NULL);
+ gtk_tree_view_append_column(info->accountview, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("GnuCash account name"),
+ renderer,
+ "text", ACCOUNT_LIST_COL_GNC_NAME,
+ NULL);
+ gtk_tree_view_append_column(info->accountview, column);
+ gtk_tree_view_column_set_expand(column, TRUE);
+
+ renderer = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes(_("New?"),
+ renderer,
+ "active", ACCOUNT_LIST_COL_CHECKED,
+ NULL);
+ gtk_tree_view_append_column(info->accountview, column);
+
+ selection = gtk_tree_view_get_selection(info->accountview);
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (on_accountlist_changed), info);
g_signal_connect (page, "prepare",
G_CALLBACK (on_accountlist_prepare), info);
}
Modified: gnucash/trunk/src/import-export/hbci/glade/hbci.glade
===================================================================
--- gnucash/trunk/src/import-export/hbci/glade/hbci.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/hbci/glade/hbci.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -199,59 +199,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="account_page_list">
+ <widget class="GtkTreeView" id="account_page_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">281,242,53</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label834">
- <property name="label" translatable="yes">HBCI account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label835">
- <property name="label" translatable="yes">GnuCash account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label836">
- <property name="label" translatable="yes">New?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/import-backend.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -23,6 +23,7 @@
@brief import-backend.c: Generic importer backend implementation (duplicate matching algorithm, action handling, etc.)
@author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
+ @author Copyright (c) 2006 David Hampton <hampton at employees.org>
*/
#include "config.h"
@@ -256,9 +257,9 @@
}
}
-GdkPixmap* gen_probability_pixmap(gint score_original, GNCImportSettings *settings, GtkWidget * widget)
+GdkPixbuf* gen_probability_pixbuf(gint score_original, GNCImportSettings *settings, GtkWidget * widget)
{
- GdkPixmap* retval = NULL;
+ GdkPixbuf* retval = NULL;
gint i, j;
gint score;
const gint height = 15;
@@ -339,11 +340,7 @@
}
}
- retval = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(widget),
- NULL,
- NULL,
- xpm);
+ retval = gdk_pixbuf_new_from_xpm_data((const gchar **)xpm);
for(i=0;i<=num_colors+height;i++)
{
/*DEBUG("free_loop i=%d%s%s",i,": ",xpm[i]);*/
@@ -820,23 +817,14 @@
/***********************************************************************
*/
-/** /brief -- Processes every selected match
+/** /brief -- Processes one match
according to its selected action. */
-void
-gnc_import_process_trans_clist (GtkCList *clist,
- GncImportMatchMap *matchmap)
+gboolean
+gnc_import_process_trans_item (GncImportMatchMap *matchmap,
+ GNCImportTransInfo *trans_info)
{
- GNCImportTransInfo * trans_info;
- gint row_number = 0, i = 0;
- g_assert (clist);
-
/* DEBUG("Begin"); */
- gtk_clist_freeze (clist);
- trans_info =
- (GNCImportTransInfo *) gtk_clist_get_row_data(clist, 0);
-
- for(i = 1; trans_info != NULL; i++)
- {
+
g_assert (trans_info);
/*DEBUG("Iteration %d, action %d, split %s", i,
trans_info->action,
@@ -845,7 +833,7 @@
switch (gnc_import_TransInfo_get_action (trans_info))
{
case GNCImport_SKIP:
- break;
+ return FALSE;
case GNCImport_ADD:
/* Transaction gets imported. */
@@ -951,24 +939,8 @@
default:
DEBUG("Invalid GNCImportAction for this imported transaction.");
}
-
- /* For all actions except SKIP delete this transaction now. */
- if(trans_info->action != GNCImport_SKIP) {
- row_number = gtk_clist_find_row_from_data(clist, trans_info);
- gtk_clist_remove (clist, row_number);
- /* decrement the iteration counter since we've just removed
- one row. */
- i--;
- }
-
- /* Get next trans_info, NULL if finished */
- trans_info =
- (GNCImportTransInfo *) gtk_clist_get_row_data(clist, i);
- }
-
/*DEBUG("End");*/
- gtk_clist_thaw (clist);
- /*DEBUG("Thawed.")*/
+ return FALSE;
}
/********************************************************************\
Modified: gnucash/trunk/src/import-export/import-backend.h
===================================================================
--- gnucash/trunk/src/import-export/import-backend.h 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/import-backend.h 2006-08-02 18:13:30 UTC (rev 14588)
@@ -21,7 +21,8 @@
/** @file import-backend.h
@brief Generic importer backend interface
@author Copyright (C) 2002 Benoit Grégoire
- @author Christian Stimming
+ @author Christian Stimming
+ @author Copyright (c) 2006 David Hampton <hampton at employees.org>
*/
#ifndef TRANSACTION_MATCHER_H
@@ -100,23 +101,25 @@
GNCImportSettings *settings);
/** This function is intended to be called when the importer dialog is
- * finished. It iterates through the GtkCList of imported transaction
- * * (i.e. the TransInfo as user_data in each row is considered) and
- * processes each ImportTransInfo according to its selected action:
+ * finished. It should be called once for each imported transaction
+ * and processes each ImportTransInfo according to its selected action:
* For GNCImport_ADD, the transaction is added etc. etc.
*
* Each succesful match is also stored in the given ImportMatchMap,
* or, if that argument is NULL, in the ImportMatchMap of each
* originating account.
*
- * @param clist The GtkCList to iterate over.
- *
* @param matchmap The ImportMatchMap where each match should be
* stored. May be NULL, in which case the ImportMatchMap of each
- * account will be used. */
-void
-gnc_import_process_trans_clist (GtkCList *clist,
- GncImportMatchMap *matchmap);
+ * account will be used.
+ *
+ * @param trans_info The ImportTransInfo item to process.
+ *
+ * @return TRUE if the item has been processed.
+ */
+gboolean
+gnc_import_process_trans_item (GncImportMatchMap *matchmap,
+ GNCImportTransInfo *trans_info);
/** This function generates a new pixmap representing a match score.
It is a series of vertical bars of different colors.
@@ -131,7 +134,7 @@
@param widget The parent widget in which the pixmap will eventually
be added. Will be used to generate the colormap.
*/
-GdkPixmap* gen_probability_pixmap (gint score,
+GdkPixbuf* gen_probability_pixbuf (gint score,
GNCImportSettings *settings,
GtkWidget * widget);
Modified: gnucash/trunk/src/import-export/import-main-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-main-matcher.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/import-main-matcher.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -23,10 +23,11 @@
@brief Transaction matcher main window
@author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
+ @author Copyright (c) 2006 David Hampton <hampton at employees.org>
*/
#include "config.h"
-#include <gnome.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "import-main-matcher.h"
@@ -46,180 +47,45 @@
struct _main_matcher_info
{
GtkWidget *dialog;
- GtkWidget *clist;
+ GtkTreeView *view;
GNCImportSettings *user_settings;
- GdkPixmap* fleche_pixmap;
- GdkPixmap* checkbox_checked_pixmap;
- GdkPixmap* checkbox_unchecked_pixmap;
- GdkColor color_back_white;
GdkColor color_back_red;
GdkColor color_back_green;
GdkColor color_back_yellow;
int selected_row;
};
-#define NUM_COLUMNS_DOWNLOADED_CLIST 9
-#define DOWNLOADED_CLIST_ACCOUNT 1
-#define DOWNLOADED_CLIST_DATE 0
-#define DOWNLOADED_CLIST_AMOUNT 2
-#define DOWNLOADED_CLIST_DESCRIPTION 3
-#define DOWNLOADED_CLIST_MEMO 4
-#define DOWNLOADED_CLIST_ACTION_ADD 5
-#define DOWNLOADED_CLIST_ACTION_CLEAR 6
-#define DOWNLOADED_CLIST_ACTION_EDIT 7
-#define DOWNLOADED_CLIST_ACTION_INFO 8
-static QofLogModule log_module = GNC_MOD_IMPORT;
+enum downloaded_cols {
+ DOWNLOADED_COL_DATE = 0,
+ DOWNLOADED_COL_ACCOUNT,
+ DOWNLOADED_COL_AMOUNT,
+ DOWNLOADED_COL_DESCRIPTION,
+ DOWNLOADED_COL_MEMO,
+ DOWNLOADED_COL_ACTION_ADD,
+ DOWNLOADED_COL_ACTION_CLEAR,
+ DOWNLOADED_COL_ACTION_EDIT,
+ DOWNLOADED_COL_ACTION_INFO,
+ DOWNLOADED_COL_ACTION_PIXBUF,
+ DOWNLOADED_COL_DATA,
+ DOWNLOADED_COL_COLOR,
+ NUM_DOWNLOADED_COLS
+};
-/* Local prototypes */
-static void automatch_clist_transactions(GNCImportMainMatcher *info, GtkCList *clist, int starting_row);
+#define COLOR_RED "brown1"
+#define COLOR_YELLOW "gold"
+#define COLOR_GREEN "DarkSeaGreen1"
+static QofLogModule log_module = GNC_MOD_IMPORT;
-
-static char * fleche_xpm[] = {
-"17 22 41 1",
-" c None",
-". c #FFFFFF",
-"+ c #000000",
-"@ c #FFFAFF",
-"# c #F6FFF6",
-"$ c #EEEEE6",
-"% c #B4B29C",
-"& c #F6F6F6",
-"* c #F6F2F6",
-"= c #EFF7EF",
-"- c #EEF2EE",
-"; c #EEEEEE",
-"> c #F6EEF6",
-", c #E6EEE6",
-"' c #EEEAEE",
-") c #E6EAE6",
-"! c #EEE6EE",
-"~ c #E6E6E6",
-"{ c #DEE2DE",
-"] c #E6E2E6",
-"^ c #DEDEDE",
-"/ c #E6DEE6",
-"( c #DEDADE",
-"_ c #D5DED5",
-": c #D5DAD5",
-"< c #DED6DE",
-"[ c #D5D6D5",
-"} c #D5D2D5",
-"| c #CDD6CD",
-"1 c #CDD2CD",
-"2 c #CDCECD",
-"3 c #D5CED5",
-"4 c #CDCACD",
-"5 c #C5CAC5",
-"6 c #C5C6C5",
-"7 c #CDC6CD",
-"8 c #BDC6BD",
-"9 c #C5C2C5",
-"0 c #C5BEC5",
-"a c #BDC2BD",
-"b c #BDBEBD",
-".+++++++++++++++.",
-"+ at .............#+",
-"+.$$$$$$$$$$$$$%+",
-"+.$&&*&&&&&=&&&%+",
-"+.$*--*-**-*-*-%+",
-"+.$;;;;>-;;;;;-%+",
-"+.$,',';;';',';%+",
-"+.$)!)!)!))))')%+",
-"+.$~~~~~~~~~~~~%+",
-"+.${]+++++++]]]%+",
-"+.${^/+++++/{^{%+",
-"+.$(^(_+++((_(^%+",
-"+.$:<:(<+<::<(<%+",
-"+.$[[<[[[[[<[[[%+",
-"+.$}|}}}}|}}}}}%+",
-"+.$111112131131%+",
-"+.$242442422424%+",
-"+.$454545444545%+",
-"+.$676676656767%+",
-"+.$689689696966%+",
-"+0%%%%%%%%%%%%%a+",
-"b+++++++++++++++b"};
-
-static char * checkbox_checked_xpm[] = {
-"16 16 28 1",
-" c None",
-". c #20449C",
-"+ c #000000",
-"@ c #FFFFFF",
-"# c #D5D2D5",
-"$ c #EEEEEE",
-"% c #B4B6B4",
-"& c #20409C",
-"* c #DEE2DE",
-"= c #E6E6E6",
-"- c #EEEAEE",
-"; c #838183",
-"> c #184094",
-", c #CDCACD",
-"' c #8B898B",
-") c #949594",
-"! c #9C999C",
-"~ c #A4A5A4",
-"{ c #C5C6C5",
-"] c #949194",
-"^ c #A4A1A4",
-"/ c #BDBABD",
-"( c #DEDADE",
-"_ c #C5C2C5",
-": c #BDBEBD",
-"< c #DEDEDE",
-"[ c #D5D6D5",
-"} c #ACAAAC",
-" .............. ",
-"................",
-"..++++++++++++..",
-"..+@@@@@@@@@#+..",
-"..+@$$$$$$$+%+..",
-"..+@$$$$$$++++&.",
-"..+@$+*=-+++;+>.",
-"..+ at +++,+++''+&.",
-"..+@=+++++)!~+..",
-"..+ at -{+++]^//+..",
-"..+@$(_+]^_#:+..",
-"..+@<[#/}/#[:+..",
-"..+#:::/%/:::+..",
-"..++++++++++++..",
-"................",
-" .............. "};
-
-static char * checkbox_unchecked_xpm[] = {
-"12 12 14 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #A4A5A4",
-"# c #DEE2DE",
-"$ c #7B7D7B",
-"% c #DEDEDE",
-"& c #D5D6D5",
-"* c #CDD2CD",
-"= c #CDCACD",
-"- c #C5C6C5",
-"; c #C5C2C5",
-"> c #BDBEBD",
-", c #ACAEAC",
-"............",
-".+++++++++ at .",
-".+########$.",
-".+%%%%%%%%$.",
-".+&&&&&&&&$.",
-".+********$.",
-".+========$.",
-".+--;---;-$.",
-".+>>>>>>>>$.",
-".+,,,,,,,,$.",
-".@$$$$$$$$$.",
-"............"};
-
+/* Local prototypes */
static void
-refresh_clist_row (GNCImportMainMatcher *gui,
- int row_number, GNCImportTransInfo *info);
+automatch_store_transactions(GNCImportMainMatcher *info,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GNCImportTransInfo *trans_info);
+static void
+refresh_model_row(GNCImportMainMatcher *gui, GtkTreeModel *model,
+ GtkTreeIter *iter, GNCImportTransInfo *info);
void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
{
@@ -234,13 +100,50 @@
static void
on_matcher_ok_clicked (GtkButton *button,
- gpointer user_data)
+ GNCImportMainMatcher *info)
{
- GNCImportMainMatcher *info = user_data;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeRowReference *ref;
+ GtkTreeIter iter;
+ GNCImportTransInfo *trans_info;
+ GSList *refs_list = NULL, *item;
+
g_assert (info);
+
/* DEBUG ("Begin") */
- gnc_import_process_trans_clist (GTK_CLIST (info->clist), NULL);
+
+ model = gtk_tree_view_get_model(info->view);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
+
+ do {
+ gtk_tree_model_get(model, &iter,
+ DOWNLOADED_COL_DATA, &trans_info,
+ -1);
+ if (gnc_import_process_trans_item (NULL, trans_info)) {
+ path = gtk_tree_model_get_path(model, &iter);
+ ref = gtk_tree_row_reference_new(model, path);
+ refs_list = g_slist_append(refs_list, ref);
+ gtk_tree_path_free(path);
+ }
+ } while (gtk_tree_model_iter_next (model, &iter));
+
/* DEBUG ("Deleting") */
+ /* DRH: Is this necessary. Isn't the call to trans_list_delete at
+ the end of this routine going to destroy the entire list store
+ anyway? */
+ for (item = refs_list; item; item = g_slist_next(item)) {
+ ref = item->data;
+ model = gtk_tree_row_reference_get_model(ref);
+ path = gtk_tree_row_reference_get_path(ref);
+ if (gtk_tree_model_get_iter(model, &iter, path))
+ gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
+ gtk_tree_path_free(path);
+ gtk_tree_row_reference_free(ref);
+ }
+ g_slist_free(refs_list);
+
gnc_gen_trans_list_delete (info);
/* DEBUG ("End") */
}
@@ -292,7 +195,9 @@
static void
run_account_picker_dialog (GNCImportMainMatcher *info,
- gint row, GNCImportTransInfo *trans_info)
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GNCImportTransInfo *trans_info)
{
Account *old_acc, *new_acc;
gboolean ok_pressed;
@@ -313,112 +218,244 @@
TRUE);
/* Iterate through the transactions in a given clist to auto match them */
- automatch_clist_transactions(info, (GtkCList*)info->clist, row);
+ automatch_store_transactions(info, model, iter, trans_info);
}
}
static void
run_match_dialog (GNCImportMainMatcher *info,
- gint row, GNCImportTransInfo *trans_info)
+ GNCImportTransInfo *trans_info)
{
gnc_import_match_picker_run_and_close (trans_info);
}
static void
-clist_select_row_cb (GtkCList *clist,
- gint row_number,
- gint column,
- GdkEventButton *event,
- gpointer user_data)
+gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ GNCImportMainMatcher *gui)
{
- GNCImportMainMatcher *gui = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
GNCImportTransInfo *trans_info;
- gboolean should_refresh = TRUE;
- /*DEBUG("row_number: %d%s%d",row_number,", column: ",column);*/
- trans_info = gtk_clist_get_row_data (clist, row_number);
- if (trans_info == NULL)
+
+ model = gtk_tree_view_get_model(gui->view);
+ if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
return;
+ gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
- switch(column)
+ if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_ADD
+ && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
{
- case DOWNLOADED_CLIST_ACTION_ADD:
- if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_ADD
- && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
- }
- else
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_ADD);
- }
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+ }
+ else
+ {
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_ADD);
+ }
+ refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ GNCImportMainMatcher *gui)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GNCImportTransInfo *trans_info;
+
+ model = gtk_tree_view_get_model(gui->view);
+ if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
+ return;
+ gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+ if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_CLEAR
+ && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
+ {
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+ }
+ else
+ {
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_CLEAR);
+ }
+ refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_edit_toggled_cb (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ GNCImportMainMatcher *gui)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GNCImportTransInfo *trans_info;
+
+ model = gtk_tree_view_get_model(gui->view);
+ if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
+ return;
+ gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+ if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_EDIT
+ && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
+ {
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+ }
+ else
+ {
+ gnc_import_TransInfo_set_action(trans_info, GNCImport_EDIT);
+ }
+ refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_row_activated_cb (GtkTreeView *view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ GNCImportMainMatcher *gui)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GNCImportTransInfo *trans_info;
+
+ model = gtk_tree_view_get_model(gui->view);
+ if (!gtk_tree_model_get_iter(model, &iter, path))
+ return;
+ gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+ switch(gnc_import_TransInfo_get_action (trans_info))
+ {
+ case GNCImport_ADD:
+ if (gnc_import_TransInfo_is_balanced(trans_info) == FALSE) {
+ run_account_picker_dialog (gui, model, &iter, trans_info);
+ }
break;
- case DOWNLOADED_CLIST_ACTION_CLEAR:
- if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_CLEAR
- && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
- }
- else
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_CLEAR);
- }
+ case GNCImport_CLEAR:
+ run_match_dialog (gui, trans_info);
break;
- case DOWNLOADED_CLIST_ACTION_EDIT:
- if( gnc_import_TransInfo_get_action(trans_info)==GNCImport_EDIT
- && gnc_import_Settings_get_action_skip_enabled (gui->user_settings)==TRUE)
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
- }
- else
- {
- gnc_import_TransInfo_set_action(trans_info, GNCImport_EDIT);
- }
+ case GNCImport_SKIP:
+ /*The information displayed is only informative, until you select an action*/
break;
- case DOWNLOADED_CLIST_ACTION_INFO:
- switch(gnc_import_TransInfo_get_action (trans_info))
- {
- case GNCImport_ADD:
- if(gnc_import_TransInfo_is_balanced(trans_info)==FALSE)
- {
- run_account_picker_dialog (gui, row_number, trans_info);
- }
- break;
- case GNCImport_CLEAR:
- run_match_dialog (gui, row_number, trans_info);
- break;
- case GNCImport_SKIP:
- /*The information displayed is only informative, until you select an action*/
- break;
- default:
- PERR("I don't know what to do! (Yet...)");
- }
- break;
default:
- /*Do nothing for other columns*/
- should_refresh = FALSE;
+ PERR("I don't know what to do! (Yet...)");
}
-
- if(should_refresh == TRUE)/*If there was a change, refresh the GUI for that row*/
- {
- refresh_clist_row (gui, row_number, trans_info);
- }
- gtk_clist_unselect_row (clist,
- row_number,
- column);
+ refresh_model_row(gui, model, &iter, trans_info);
}
-static void gnc_gen_trans_list_freeze (GNCImportMainMatcher *gui)
+static void
+gnc_gen_trans_row_changed_cb (GtkTreeSelection *selection,
+ GNCImportMainMatcher *gui)
{
- g_assert (gui);
- gtk_clist_freeze (GTK_CLIST (gui->clist));
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ return;
+ gtk_tree_selection_unselect_iter(selection, &iter);
}
-static void gnc_gen_trans_list_thaw (GNCImportMainMatcher *gui)
+static GtkTreeViewColumn *
+add_text_column(GtkTreeView *view, const gchar *title, int col_num)
{
- g_assert (gui);
- gtk_clist_thaw (GTK_CLIST (gui->clist));
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes
+ (title, renderer,
+ "text", col_num,
+ "background", DOWNLOADED_COL_COLOR,
+ NULL);
+ g_object_set(G_OBJECT(column),
+ "reorderable", TRUE,
+ "resizable", TRUE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+ return column;
}
+static GtkTreeViewColumn *
+add_toggle_column(GtkTreeView *view, const gchar *title, int col_num,
+ GCallback cb_fn, gpointer cb_arg)
+{
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ renderer = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes
+ (title, renderer,
+ "active", col_num,
+ "cell-background", DOWNLOADED_COL_COLOR,
+ NULL);
+ g_object_set(G_OBJECT(column),
+ "reorderable", TRUE,
+ NULL);
+ g_signal_connect(renderer, "toggled", cb_fn, cb_arg);
+ gtk_tree_view_append_column(view, column);
+ return column;
+}
+
+static void
+gnc_gen_trans_init_view (GNCImportMainMatcher *info,
+ gboolean show_account,
+ gboolean show_edit)
+{
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
+ view = info->view;
+ store = gtk_list_store_new(NUM_DOWNLOADED_COLS,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
+ GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ /* Add the columns */
+ add_text_column(view, _("Date"), DOWNLOADED_COL_DATE);
+ column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
+ gtk_tree_view_column_set_visible(column, show_account);
+ add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
+ add_text_column(view, _("Description"), DOWNLOADED_COL_DESCRIPTION);
+ add_text_column(view, _("Memo"), DOWNLOADED_COL_MEMO);
+ add_toggle_column(view, _("A"), DOWNLOADED_COL_ACTION_ADD,
+ G_CALLBACK(gnc_gen_trans_add_toggled_cb), info);
+ add_toggle_column(view, _("R"), DOWNLOADED_COL_ACTION_CLEAR,
+ G_CALLBACK(gnc_gen_trans_clear_toggled_cb), info);
+ column = add_toggle_column(view, _("Edit"), DOWNLOADED_COL_ACTION_EDIT,
+ G_CALLBACK(gnc_gen_trans_edit_toggled_cb), info);
+ gtk_tree_view_column_set_visible(column, show_edit);
+
+
+ /* The last column has multiple renderers */
+ renderer = gtk_cell_renderer_pixbuf_new();
+ g_object_set(renderer, "xalign", 0.0, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("Info"), renderer,
+ "pixbuf", DOWNLOADED_COL_ACTION_PIXBUF,
+ "cell-background", DOWNLOADED_COL_COLOR,
+ NULL);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_set_attributes(column, renderer,
+ "text", DOWNLOADED_COL_ACTION_INFO,
+ "background", DOWNLOADED_COL_COLOR,
+ NULL);
+ g_object_set(G_OBJECT(column),
+ "reorderable", TRUE,
+ "resizable", TRUE,
+ NULL);
+ gtk_tree_view_append_column(info->view, column);
+
+
+ selection = gtk_tree_view_get_selection(info->view);
+ g_signal_connect(info->view, "row-activated",
+ G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
+}
+
GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
const gchar* heading,
gboolean all_from_same_account,
@@ -427,6 +464,7 @@
GNCImportMainMatcher *info;
GladeXML *xml;
GtkWidget *heading_label;
+ gboolean show_edit;
info = g_new0 (GNCImportMainMatcher, 1);
@@ -439,8 +477,11 @@
info->dialog = glade_xml_get_widget (xml, "transaction_matcher");
g_assert (info->dialog != NULL);
- info->clist = glade_xml_get_widget (xml, "downloaded_clist");
- g_assert (info->clist != NULL);
+ info->view = GTK_TREE_VIEW(glade_xml_get_widget (xml, "downloaded_view"));
+ g_assert (info->view != NULL);
+
+ show_edit = gnc_import_Settings_get_action_edit_enabled (info->user_settings);
+ gnc_gen_trans_init_view(info, all_from_same_account, show_edit);
heading_label = glade_xml_get_widget (xml, "heading_label");
g_assert (heading_label != NULL);
@@ -449,9 +490,6 @@
GTK_WINDOW (parent));*/
/* Connect signals */
- glade_xml_signal_connect_data(xml, "downloaded_transaction_select_cb",
- G_CALLBACK(clist_select_row_cb),
- info);
glade_xml_signal_connect_data(xml, "on_matcher_ok_clicked",
G_CALLBACK(on_matcher_ok_clicked),
info);
@@ -462,68 +500,10 @@
G_CALLBACK(on_matcher_help_clicked),
info);
- /*Initialise pixmaps*/
- info->fleche_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(info->dialog),
- NULL,
- NULL,
- fleche_xpm);
- info->checkbox_checked_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(info->dialog),
- NULL,
- NULL,
- checkbox_checked_xpm);
- info->checkbox_unchecked_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(info->dialog),
- NULL,
- NULL,
- checkbox_unchecked_xpm);
/*Initialise the colors */
- info->color_back_red.red=65535;
- info->color_back_red.green=16383;
- info->color_back_red.blue=16383;
- info->color_back_green.red=49151;
- info->color_back_green.green=65535;
- info->color_back_green.blue=49151;
- info->color_back_yellow.red=65535;
- info->color_back_yellow.green=55255;
- info->color_back_yellow.blue=0;
- info->color_back_white.red=65535;
- info->color_back_white.green=65535;
- info->color_back_white.blue=65535;
- /*Ajust column size*/
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_DATE,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_AMOUNT,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACTION_ADD,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACTION_CLEAR,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACTION_EDIT,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACTION_INFO,
- TRUE);
- /*Set column visibility*/
- if(all_from_same_account==TRUE)
- {
- gtk_clist_set_column_visibility (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACCOUNT,
- FALSE);
- }
- if(gnc_import_Settings_get_action_edit_enabled (info->user_settings)==FALSE)
- {
- gtk_clist_set_column_visibility (GTK_CLIST (info->clist),
- DOWNLOADED_CLIST_ACTION_EDIT,
- FALSE);
- }
-
+ gdk_color_parse(COLOR_RED, &info->color_back_red);
+ gdk_color_parse(COLOR_YELLOW, &info->color_back_yellow);
+ gdk_color_parse(COLOR_GREEN, &info->color_back_green);
if (heading)
gtk_label_set_text (GTK_LABEL (heading_label), heading);
@@ -548,109 +528,63 @@
return result;
}
-/* For cleaning up dangling row data. */
-static void
-trans_clist_row_destroy_cb (gpointer data)
-{
- GNCImportTransInfo * transaction_info = data;
- /*DEBUG("Begin");*/
- gnc_import_TransInfo_delete (transaction_info);
-}
-
-static char ** gen_clist_row_text (GNCImportTransInfo *info)
-{
- static char *text[NUM_COLUMNS_DOWNLOADED_CLIST];
- gint i;
- g_assert (info);
- for(i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++)
- {
- text[i]=g_strdup("");
- }
- return text;
-}
-
-
static void
-refresh_clist_row (GNCImportMainMatcher *gui,
- int row_number, GNCImportTransInfo *info)
+refresh_model_row (GNCImportMainMatcher *gui,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GNCImportTransInfo *info)
{
- char *text[NUM_COLUMNS_DOWNLOADED_CLIST];
- char **old_text = g_new(char *, NUM_COLUMNS_DOWNLOADED_CLIST);/* Should be g_new?*/
- gint i;
- gchar *tmp,*imbalance;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ gchar *tmp,*imbalance,*text,*color;
+ const gchar *ro_text;
g_assert (gui);
+ g_assert (model);
g_assert (info);
/*DEBUG("Begin");*/
- gnc_gen_trans_list_freeze(gui);
- for (i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++)
- {
- gtk_clist_get_text (GTK_CLIST (gui->clist), row_number,
- i,
- &(old_text[i]));
- text[i]=NULL;
- }
+ store = GTK_LIST_STORE(model);
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_DATA, info, -1);
- /* Note that ALL strings must be duplicated with g_strdup or equivalent, so that they can
- be freed by the widget*/
-
/*Account:*/
- text[DOWNLOADED_CLIST_ACCOUNT] =
- g_strdup(xaccAccountGetName(xaccSplitGetAccount(gnc_import_TransInfo_get_fsplit (info))));
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACCOUNT,
- text[DOWNLOADED_CLIST_ACCOUNT]);
+ ro_text =
+ xaccAccountGetName(xaccSplitGetAccount(gnc_import_TransInfo_get_fsplit (info)));
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
/*Date*/
- text[DOWNLOADED_CLIST_DATE] =
+ text =
qof_print_date ( xaccTransGetDate( gnc_import_TransInfo_get_trans(info) ) );
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_DATE,
- text[DOWNLOADED_CLIST_DATE]);
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE, text, -1);
+ g_free(text);
/*Amount*/
- text[DOWNLOADED_CLIST_AMOUNT] =
- g_strdup(xaccPrintAmount
+ ro_text = xaccPrintAmount
(xaccSplitGetAmount (gnc_import_TransInfo_get_fsplit(info) ),
gnc_split_amount_print_info(gnc_import_TransInfo_get_fsplit(info), TRUE)
- ) );
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_AMOUNT,
- text[DOWNLOADED_CLIST_AMOUNT]);
+ );
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
/*Description*/
- text[DOWNLOADED_CLIST_DESCRIPTION] =
- g_strdup(xaccTransGetDescription(gnc_import_TransInfo_get_trans(info) ) );
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_DESCRIPTION,
- text[DOWNLOADED_CLIST_DESCRIPTION]);
+ ro_text = xaccTransGetDescription(gnc_import_TransInfo_get_trans(info) );
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_DESCRIPTION, ro_text, -1);
/*Memo*/
- text[DOWNLOADED_CLIST_MEMO] =
- g_strdup(xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(info) ) );
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_MEMO,
- text[DOWNLOADED_CLIST_MEMO]);
+ ro_text = xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(info) );
+ gtk_list_store_set(store, iter, DOWNLOADED_COL_MEMO, ro_text, -1);
/*Actions*/
- text[DOWNLOADED_CLIST_ACTION_ADD] = g_strdup("");
- text[DOWNLOADED_CLIST_ACTION_CLEAR] = g_strdup("");
- text[DOWNLOADED_CLIST_ACTION_EDIT] = g_strdup("");
/* Action informations */
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_white));
+ ro_text = text = color = NULL;
switch(gnc_import_TransInfo_get_action(info))
{
case GNCImport_ADD:
if(gnc_import_TransInfo_is_balanced(info)==TRUE)
{
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup(_("New, already balanced"));
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_green));
+ ro_text = _("New, already balanced");
+ color = COLOR_GREEN;
}
else
{
@@ -664,14 +598,13 @@
TRUE) ));
if (gnc_import_TransInfo_get_destacc (info) != NULL)
{
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_green));
+ color = COLOR_GREEN;
tmp = xaccAccountGetFullName
(gnc_import_TransInfo_get_destacc (info));
if(gnc_import_TransInfo_get_destacc_selected_manually(info)
== TRUE)
{
- text[DOWNLOADED_CLIST_ACTION_INFO] =
+ text =
/* Translators: %1$s is the amount to be
transferred. %2$s is the destination account. */
g_strdup_printf(_("New, transfer %s to (manual) \"%s\""),
@@ -679,7 +612,7 @@
}
else
{
- text[DOWNLOADED_CLIST_ACTION_INFO] =
+ text =
/* Translators: %1$s is the amount to be
transferred. %2$s is the destination account. */
g_strdup_printf(_("New, transfer %s to (auto) \"%s\""),
@@ -690,162 +623,102 @@
}
else
{
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_yellow));
- text[DOWNLOADED_CLIST_ACTION_INFO] =
+ color = COLOR_YELLOW;
+ text =
/* Translators: %s is the amount to be transferred. */
g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
imbalance);
}
- g_free (imbalance);
+ g_free (imbalance);
}
break;
case GNCImport_CLEAR:
if(gnc_import_TransInfo_get_selected_match(info))
{
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_green));
+ color = COLOR_GREEN;
if(gnc_import_TransInfo_get_match_selected_manually(info)==TRUE)
{
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup(_("Reconcile (manual) match"));
+ ro_text = _("Reconcile (manual) match");
}
else
{
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup(_("Reconcile (auto) match"));
+ ro_text = _("Reconcile (auto) match");
}
}
else
{
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_red));
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup_printf(_("Match missing!"));
+ color = COLOR_RED;
+ ro_text = _("Match missing!");
}
break;
case GNCImport_EDIT:
- text[DOWNLOADED_CLIST_ACTION_INFO] = g_strdup("NOT SUPPORTED YET!");
+ color = "white";
+ ro_text = "NOT SUPPORTED YET!";
break;
case GNCImport_SKIP:
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup(_("Do not import (no action selected)"));
- gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
- &(gui->color_back_red));
+ color = COLOR_RED;
+ ro_text = _("Do not import (no action selected)");
break;
default:
- text[DOWNLOADED_CLIST_ACTION_INFO] =
- g_strdup("WRITEME, this is an unknown action");
+ color = "white";
+ ro_text = "WRITEME, this is an unknown action";
}
- gtk_clist_set_text (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_INFO,
- text[DOWNLOADED_CLIST_ACTION_INFO]);
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_COLOR, color,
+ DOWNLOADED_COL_ACTION_INFO, ro_text ? ro_text : text,
+ -1);
+ if (text)
+ g_free(text);
+
/* Set the pixmaps */
- if(gnc_import_TransInfo_get_action(info)==GNCImport_ADD)
- {
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_ADD,
- text[DOWNLOADED_CLIST_ACTION_ADD],
- 3,
- gui->checkbox_checked_pixmap,
- NULL);
-
- if(gnc_import_TransInfo_is_balanced(info)==FALSE)
- {
- /*Show the arrow button*/
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_INFO,
- text[DOWNLOADED_CLIST_ACTION_INFO],
- 3,
- gui->fleche_pixmap,
- NULL);
- }
- }
- else
- {
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_ADD,
- text[DOWNLOADED_CLIST_ACTION_ADD],
- 3,
- gui->checkbox_unchecked_pixmap,
- NULL);
- }
-
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_ACTION_ADD,
+ gnc_import_TransInfo_get_action(info)==GNCImport_ADD,
+ -1);
if(gnc_import_TransInfo_get_action(info)==GNCImport_SKIP)
{
/*Show the best match's confidence pixmap in the info column*/
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_INFO,
- text[DOWNLOADED_CLIST_ACTION_INFO],
- 3,
- gen_probability_pixmap( gnc_import_MatchInfo_get_probability
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_ACTION_PIXBUF,
+ gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
( gnc_import_TransInfo_get_selected_match (info)),
gui->user_settings,
- GTK_WIDGET(gui->clist)),
- NULL);
+ GTK_WIDGET(gui->view)),
+ -1);
}
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_ACTION_CLEAR,
+ gnc_import_TransInfo_get_action(info)==GNCImport_CLEAR,
+ -1);
if(gnc_import_TransInfo_get_action(info)==GNCImport_CLEAR)
{
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_CLEAR,
- text[DOWNLOADED_CLIST_ACTION_CLEAR],
- 3,
- gui->checkbox_checked_pixmap,
- NULL);
/*Show the best match's confidence pixmap in the info column*/
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_INFO,
- text[DOWNLOADED_CLIST_ACTION_INFO],
- 3,
- gen_probability_pixmap( gnc_import_MatchInfo_get_probability
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_ACTION_PIXBUF,
+ gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
( gnc_import_TransInfo_get_selected_match (info)),
gui->user_settings,
- GTK_WIDGET(gui->clist)),
- NULL);
+ GTK_WIDGET(gui->view)),
+ -1);
}
- else
- {
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_CLEAR,
- text[DOWNLOADED_CLIST_ACTION_CLEAR],
- 3,
- gui->checkbox_unchecked_pixmap,
- NULL);
- }
- if(gnc_import_TransInfo_get_action(info)==GNCImport_EDIT)
- {
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_EDIT,
- text[DOWNLOADED_CLIST_ACTION_EDIT],
- 3,
- gui->checkbox_checked_pixmap,
- NULL);
- }
- else
- {
- gtk_clist_set_pixtext (GTK_CLIST (gui->clist), row_number,
- DOWNLOADED_CLIST_ACTION_EDIT,
- text[DOWNLOADED_CLIST_ACTION_EDIT],
- 3,
- gui->checkbox_unchecked_pixmap,
- NULL);
- }
-
- gtk_clist_set_row_height (GTK_CLIST (gui->clist),
- 24);
-
-
- gnc_gen_trans_list_thaw(gui);
+ gtk_list_store_set(store, iter,
+ DOWNLOADED_COL_ACTION_EDIT,
+ gnc_import_TransInfo_get_action(info)==GNCImport_EDIT,
+ -1);
+
+ selection = gtk_tree_view_get_selection(gui->view);
+ gtk_tree_selection_unselect_all(selection);
}
void gnc_gen_trans_list_add_trans(GNCImportMainMatcher *gui, Transaction *trans)
{
GNCImportTransInfo * transaction_info = NULL;
- gint row_number;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
g_assert (gui);
g_assert (trans);
@@ -859,37 +732,25 @@
gnc_import_TransInfo_init_matches (transaction_info,
gui->user_settings);
- row_number = gtk_clist_append(GTK_CLIST (gui->clist),
- gen_clist_row_text (transaction_info));
- gtk_clist_set_row_data_full(GTK_CLIST (gui->clist),
- row_number,
- transaction_info,
- trans_clist_row_destroy_cb);
- refresh_clist_row (gui,
- row_number,
- transaction_info);
+ model = gtk_tree_view_get_model(gui->view);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ refresh_model_row (gui, model, &iter, transaction_info);
}
return;
}/* end gnc_import_add_trans() */
/* Iterate through the rows of the clist and try to automatch each of them */
-static void automatch_clist_transactions(GNCImportMainMatcher *info, GtkCList *clist, int starting_row)
+static void
+automatch_store_transactions (GNCImportMainMatcher *info,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GNCImportTransInfo *trans_info)
{
- int row;
- GNCImportTransInfo *trans_info;
-
- gtk_clist_freeze(clist); /* prevent a lot of visual updates at once */
- for(row = starting_row+1; row < clist->rows; row++)
- {
- trans_info = gtk_clist_get_row_data(clist, row);
-
/* returns TRUE if we changed this row, so update it */
if(gnc_import_TransInfo_refresh_destacc(trans_info, NULL))
{
- refresh_clist_row(info, row, trans_info);
+ refresh_model_row(info, model, iter, trans_info);
}
- }
- gtk_clist_thaw(clist); /* let all the updates be shown */
}
/** @} */
Modified: gnucash/trunk/src/import-export/import-match-picker.c
===================================================================
--- gnucash/trunk/src/import-export/import-match-picker.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/import-match-picker.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -23,11 +23,13 @@
@brief The transaction match picker dialog
implementation
@author Copyright (C) 2002 Benoit Grégoire
+ @author Copyright (c) 2006 David Hampton <hampton at employees.org>
*/
#include "config.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "import-backend.h"
#include "import-match-picker.h"
@@ -42,20 +44,27 @@
#define GCONF_SECTION "dialogs/import/generic_matcher/match_picker"
-#define NUM_COLUMNS_DOWNLOADED_CLIST 6
-static const int DOWNLOADED_CLIST_ACCOUNT = 0;
-static const int DOWNLOADED_CLIST_DATE = 1;
-static const int DOWNLOADED_CLIST_AMOUNT = 2;
-static const int DOWNLOADED_CLIST_DESCRIPTION = 3;
-static const int DOWNLOADED_CLIST_MEMO = 4;
-static const int DOWNLOADED_CLIST_BALANCED = 5;
+enum downloaded_cols {
+ DOWNLOADED_COL_ACCOUNT = 0,
+ DOWNLOADED_COL_DATE,
+ DOWNLOADED_COL_AMOUNT,
+ DOWNLOADED_COL_DESCRIPTION,
+ DOWNLOADED_COL_MEMO,
+ DOWNLOADED_COL_BALANCED,
+ DOWNLOADED_COL_INFO_PTR,
+ NUM_DOWNLOADED_COLS
+};
-#define NUM_COLUMNS_MATCHER_CLIST 5
-static const int MATCHER_CLIST_CONFIDENCE = 0;
-static const int MATCHER_CLIST_DATE = 1;
-static const int MATCHER_CLIST_AMOUNT = 2;
-static const int MATCHER_CLIST_DESCRIPTION = 3;
-static const int MATCHER_CLIST_MEMO = 4;
+enum matcher_cols {
+ MATCHER_COL_CONFIDENCE = 0,
+ MATCHER_COL_CONFIDENCE_PIXBUF,
+ MATCHER_COL_DATE,
+ MATCHER_COL_AMOUNT,
+ MATCHER_COL_DESCRIPTION,
+ MATCHER_COL_MEMO,
+ MATCHER_COL_INFO_PTR,
+ NUM_MATCHER_COLS
+};
/* Needs to be commented in again if any DEBUG() macro is used here. */
/*static short module = MOD_IMPORT;*/
@@ -72,8 +81,8 @@
struct _transpickerdialog {
GtkWidget * transaction_matcher;
- GtkCList * downloaded_clist;
- GtkCList * match_clist;
+ GtkTreeView * downloaded_view;
+ GtkTreeView * match_view;
GNCImportSettings * user_settings;
struct _transactioninfo * selected_trans_info;
GNCImportMatchInfo * selected_match_info;
@@ -81,57 +90,76 @@
-static gint
+static void
downloaded_transaction_append(GNCImportMatchPicker * matcher,
- GNCImportTransInfo * transaction_info)
+ GNCImportTransInfo * transaction_info)
{
- gint row_number;
- const char * clist_text[NUM_COLUMNS_DOWNLOADED_CLIST];
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ Transaction *trans;
+ Split *split;
+ gchar *text;
+ const gchar *ro_text;
+ gboolean found = FALSE;
+ GNCImportTransInfo *local_info;
g_assert(matcher);
g_assert(transaction_info);
+
/*DEBUG("Begin");*/
- row_number = gtk_clist_find_row_from_data(matcher->downloaded_clist,
- transaction_info);
+
+ /* Has the transaction already been added? */
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(matcher->downloaded_view));
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
+ do {
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
+ DOWNLOADED_COL_INFO_PTR, &local_info,
+ -1);
+ if (local_info == transaction_info) {
+ found = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
+ }
+ if (!found)
+ gtk_list_store_append(store, &iter);
+ split = gnc_import_TransInfo_get_fsplit(transaction_info);
+ trans = gnc_import_TransInfo_get_trans(transaction_info);
+
/*Account*/
- clist_text[DOWNLOADED_CLIST_ACCOUNT] =
- g_strdup ( xaccAccountGetName
- ( xaccSplitGetAccount
- ( gnc_import_TransInfo_get_fsplit (transaction_info))));
-
-
+ ro_text = xaccAccountGetName(xaccSplitGetAccount(split));
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
+
/*Date*/
- clist_text[DOWNLOADED_CLIST_DATE] =
- qof_print_date
- ( xaccTransGetDate
- ( gnc_import_TransInfo_get_trans(transaction_info) ) );
+ text = qof_print_date(xaccTransGetDate(trans));
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_DATE, text, -1);
+ g_free(text);
/*Amount*/
- clist_text[DOWNLOADED_CLIST_AMOUNT] =
- g_strdup( xaccPrintAmount( xaccSplitGetAmount ( gnc_import_TransInfo_get_fsplit(transaction_info) ),
- gnc_split_amount_print_info( gnc_import_TransInfo_get_fsplit(transaction_info), TRUE)
- ) );
+ ro_text = xaccPrintAmount(xaccSplitGetAmount(split),
+ gnc_split_amount_print_info(split, TRUE));
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
/*Description*/
- clist_text[DOWNLOADED_CLIST_DESCRIPTION] = g_strdup(xaccTransGetDescription(gnc_import_TransInfo_get_trans(transaction_info) ) );
+ ro_text = xaccTransGetDescription(trans);
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_DESCRIPTION, ro_text, -1);
/*Memo*/
- clist_text[DOWNLOADED_CLIST_MEMO] =
- g_strdup(xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(transaction_info) ) );
+ ro_text = xaccSplitGetMemo(split);
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_MEMO, ro_text, -1);
/*Imbalance*/
- clist_text[DOWNLOADED_CLIST_BALANCED] =
- g_strdup (xaccPrintAmount (xaccTransGetImbalance(gnc_import_TransInfo_get_trans(transaction_info) ),
- gnc_default_print_info (TRUE) )
- );
+ ro_text = xaccPrintAmount(xaccTransGetImbalance(trans),
+ gnc_default_print_info(TRUE));
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_BALANCED, ro_text, -1);
- row_number = gtk_clist_append(matcher->downloaded_clist,
- (char **)(clist_text));
- gtk_clist_set_row_data(matcher->downloaded_clist,
- row_number,
- transaction_info);
- return row_number;
+ gtk_list_store_set(store, &iter, DOWNLOADED_COL_INFO_PTR,
+ transaction_info, -1);
+
+ selection = gtk_tree_view_get_selection(matcher->downloaded_view);
+ gtk_tree_selection_select_iter(selection, &iter);
}
/********************************************************************\
@@ -141,96 +169,100 @@
\********************************************************************/
static void
-downloaded_transaction_select_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEventButton *event,
- gpointer user_data) {
- GNCImportMatchPicker * matcher = user_data;
+downloaded_transaction_changed_cb (GtkTreeSelection *selection,
+ GNCImportMatchPicker *matcher)
+{
GNCImportMatchInfo * match_info;
+ GtkTreeModel *dl_model;
+ GtkListStore *match_store;
+ GtkTreeIter iter;
GList * list_element;
- gint row_number;
- const char * clist_text[NUM_COLUMNS_MATCHER_CLIST];
+ gchar *text;
+ const gchar *ro_text;
/*DEBUG("row: %d%s%d",row,", column: ",column);*/
+
+ /* Get the transaction info from the "downloaded" model. */
+ if (!gtk_tree_selection_get_selected(selection, &dl_model, &iter)) {
+ matcher->selected_trans_info=NULL;
+ return;
+ }
+ gtk_tree_model_get(dl_model, &iter,
+ DOWNLOADED_COL_INFO_PTR, &matcher->selected_trans_info,
+ -1);
- matcher->selected_trans_info = gtk_clist_get_row_data(clist, row);
-
-
- gtk_clist_clear(matcher->match_clist);
+ /* Now rewrite the "match" model based on that trans. */
+ match_store = GTK_LIST_STORE(gtk_tree_view_get_model(matcher->match_view));
+ gtk_list_store_clear(match_store);
list_element = g_list_first (gnc_import_TransInfo_get_match_list
(matcher->selected_trans_info));
while(list_element!=NULL)
{
match_info = list_element->data;
+ gtk_list_store_append(match_store, &iter);
+
/* Print fields. */
/* Probability */
- clist_text[MATCHER_CLIST_CONFIDENCE] =
- g_strdup_printf("%d", gnc_import_MatchInfo_get_probability (match_info));
-
+ text = g_strdup_printf("%d", gnc_import_MatchInfo_get_probability (match_info));
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_CONFIDENCE, text, -1);
+ g_free(text);
+
/* Date */
- clist_text[MATCHER_CLIST_DATE]=
+ text =
qof_print_date
( xaccTransGetDate
( xaccSplitGetParent
( gnc_import_MatchInfo_get_split(match_info) ) ));
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_DATE, text, -1);
+ g_free(text);
/* Amount */
- clist_text[MATCHER_CLIST_AMOUNT]=
- g_strdup(xaccPrintAmount( xaccSplitGetAmount ( gnc_import_MatchInfo_get_split(match_info) ),
+ ro_text =
+ xaccPrintAmount( xaccSplitGetAmount ( gnc_import_MatchInfo_get_split(match_info) ),
gnc_split_amount_print_info(gnc_import_MatchInfo_get_split(match_info), TRUE)
- ) );
+ );
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_AMOUNT, ro_text, -1);
/*Description*/
- clist_text[MATCHER_CLIST_DESCRIPTION] =
- g_strdup( xaccTransGetDescription
- ( xaccSplitGetParent( gnc_import_MatchInfo_get_split(match_info)) ));
+ ro_text = xaccTransGetDescription
+ ( xaccSplitGetParent( gnc_import_MatchInfo_get_split(match_info)) );
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_DESCRIPTION, ro_text, -1);
/*Split memo*/
- clist_text[MATCHER_CLIST_MEMO]=
- g_strdup(xaccSplitGetMemo(gnc_import_MatchInfo_get_split(match_info) ) );
+ ro_text = xaccSplitGetMemo(gnc_import_MatchInfo_get_split(match_info) );
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_MEMO, ro_text, -1);
- row_number = gtk_clist_append(matcher->match_clist,
- (char **)(clist_text));
- gtk_clist_set_row_data (matcher->match_clist,
- row_number,
- match_info);
+ gtk_list_store_set(match_store, &iter, MATCHER_COL_INFO_PTR, match_info, -1);
if(gnc_import_MatchInfo_get_probability(match_info) != 0)
{
if(SHOW_NUMERIC_SCORE==TRUE)
{
- gtk_clist_set_pixtext (matcher->match_clist,
- row_number,
- MATCHER_CLIST_CONFIDENCE,
- clist_text[MATCHER_CLIST_CONFIDENCE],
- 3,
- gen_probability_pixmap(gnc_import_MatchInfo_get_probability(match_info),
+ gtk_list_store_set(match_store, &iter,
+ MATCHER_COL_CONFIDENCE_PIXBUF,
+ gen_probability_pixbuf(gnc_import_MatchInfo_get_probability(match_info),
matcher->user_settings,
- GTK_WIDGET(matcher->match_clist)),
- NULL);
+ GTK_WIDGET(matcher->match_view)),
+ -1);
}
else
{
- gtk_clist_set_pixmap (matcher->match_clist,
- row_number,
- MATCHER_CLIST_CONFIDENCE,
- gen_probability_pixmap(gnc_import_MatchInfo_get_probability(match_info),
+ gtk_list_store_set(match_store, &iter,
+ MATCHER_COL_CONFIDENCE_PIXBUF,
+ gen_probability_pixbuf(gnc_import_MatchInfo_get_probability(match_info),
matcher->user_settings,
- GTK_WIDGET(matcher->match_clist)),
- NULL);
+ GTK_WIDGET(matcher->match_view)),
+ -1);
}
}
- gtk_clist_set_row_height (matcher->match_clist,
- 0);
-
if(match_info ==
gnc_import_TransInfo_get_selected_match (matcher->selected_trans_info))
{
- gtk_clist_select_row (matcher->match_clist,
- row_number,
- 0);
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection(matcher->match_view);
+ gtk_tree_selection_select_iter(selection, &iter);
}
list_element=g_list_next(list_element);
@@ -238,29 +270,103 @@
}
static void
-match_transaction_select_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEventButton *event,
- gpointer user_data) {
- GNCImportMatchPicker * matcher = user_data;
- /*DEBUG("row: %d%s%d",row,", column: ",column);*/
- matcher->selected_match_info =
- gtk_clist_get_row_data(clist, row);
+match_transaction_changed_cb (GtkTreeSelection *selection,
+ GNCImportMatchPicker *matcher)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ matcher->selected_match_info=NULL;
+ return;
+ }
+
+ gtk_tree_model_get(model, &iter,
+ MATCHER_COL_INFO_PTR, &matcher->selected_match_info,
+ -1);
}
static void
-match_transaction_unselect_cb(GtkCList *clist,
- gint row,
- gint column,
- GdkEventButton *event,
- gpointer user_data) {
- GNCImportMatchPicker * matcher = user_data;
- /*DEBUG("row: %d%s%d",row,", column: ",column);*/
- matcher->selected_match_info=NULL;
+add_column(GtkTreeView *view, const gchar *title, int col_num)
+{
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(title, renderer,
+ "text", col_num,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+ g_object_set(G_OBJECT(column),
+ "reorderable", TRUE,
+ "resizable", TRUE,
+ NULL);
+}
+static void
+gnc_import_match_picker_init_downloaded_view (GNCImportMatchPicker * matcher)
+{
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+
+ view = matcher->downloaded_view;
+ store = gtk_list_store_new(NUM_DOWNLOADED_COLS,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ add_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
+ add_column(view, _("Date"), DOWNLOADED_COL_DATE);
+ add_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
+ add_column(view, _("Description"), DOWNLOADED_COL_DESCRIPTION);
+ add_column(view, _("Memo"), DOWNLOADED_COL_MEMO);
+ add_column(view, _("Balanced"), DOWNLOADED_COL_BALANCED);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(downloaded_transaction_changed_cb), matcher);
}
+static void
+gnc_import_match_picker_init_match_view (GNCImportMatchPicker * matcher)
+{
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
+ view = matcher->match_view;
+ store = gtk_list_store_new(NUM_MATCHER_COLS,
+ G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ g_object_set(renderer, "xalign", 0.0, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("Confidence"), renderer,
+ "pixbuf", MATCHER_COL_CONFIDENCE_PIXBUF,
+ NULL);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_set_attributes(column, renderer,
+ "text", MATCHER_COL_CONFIDENCE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ add_column(view, _("Date"), MATCHER_COL_DATE);
+ add_column(view, _("Amount"), MATCHER_COL_AMOUNT);
+ add_column(view, _("Description"), MATCHER_COL_DESCRIPTION);
+ add_column(view, _("Memo"), MATCHER_COL_MEMO);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(match_transaction_changed_cb), matcher);
+}
+
/********************************************************************\
* init_match_picker_gui()
* -- GUI initialization for the Match_Picker Dialog
@@ -279,42 +385,13 @@
xml = gnc_glade_xml_new ("generic-import.glade", "match_picker");
g_return_if_fail (xml != NULL);
- /* connect the signals in the interface */
- glade_xml_signal_connect_data(xml,
- "match_transaction_select_cb",
- G_CALLBACK(match_transaction_select_cb),
- matcher);
- glade_xml_signal_connect_data(xml,
- "match_transaction_unselect_cb",
- G_CALLBACK(match_transaction_unselect_cb),
- matcher);
-
matcher->transaction_matcher = glade_xml_get_widget (xml, "match_picker");
- matcher->downloaded_clist = (GtkCList *)glade_xml_get_widget (xml, "downloaded_clist");
- matcher->match_clist = (GtkCList *)glade_xml_get_widget (xml, "matched_clist");
+ matcher->downloaded_view = (GtkTreeView *)glade_xml_get_widget (xml, "downloaded_view");
+ matcher->match_view = (GtkTreeView *)glade_xml_get_widget (xml, "matched_view");
- /*Ajust column size*/
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->downloaded_clist),
- DOWNLOADED_CLIST_DATE,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->downloaded_clist),
- DOWNLOADED_CLIST_AMOUNT,
- TRUE);
+ gnc_import_match_picker_init_downloaded_view(matcher);
+ gnc_import_match_picker_init_match_view(matcher);
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->downloaded_clist),
- DOWNLOADED_CLIST_BALANCED,
- TRUE);
-
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->match_clist),
- MATCHER_CLIST_CONFIDENCE,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->match_clist),
- MATCHER_CLIST_DATE,
- TRUE);
- gtk_clist_set_column_auto_resize (GTK_CLIST (matcher->match_clist),
- MATCHER_CLIST_AMOUNT,
- TRUE);
-
/* DEBUG("User prefs:%s%d%s%d%s%d%s%d%s%d",
" action_replace_enabled:",matcher->action_replace_enabled,
", action_skip_enabled:",matcher->action_skip_enabled,
@@ -337,7 +414,7 @@
gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info)
{
GNCImportMatchPicker *matcher;
- gint row_number, response;
+ gint response;
GNCImportMatchInfo *old;
g_assert (transaction_info);
@@ -347,18 +424,9 @@
/* DEBUG("Init match_picker"); */
init_match_picker_gui(matcher);
- /* Append this single transaction to the downloaded_clist */
- row_number = downloaded_transaction_append(matcher,
- transaction_info);
+ /* Append this single transaction to the view and select it */
+ downloaded_transaction_append(matcher, transaction_info);
- /* Now fake a selection of that transaction. */
- downloaded_transaction_select_cb (matcher->downloaded_clist,
- row_number,
- 2,
- NULL,
- matcher);
- gtk_widget_set_sensitive (GTK_WIDGET (matcher->downloaded_clist), FALSE);
-
old = gnc_import_TransInfo_get_selected_match(transaction_info);
/* Let this dialog run and close. */
Modified: gnucash/trunk/src/import-export/import-provider-format.glade
===================================================================
--- gnucash/trunk/src/import-export/import-provider-format.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/import-provider-format.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -113,10 +113,9 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="import_format_menu">
+ <widget class="GtkComboBox" id="import_format_combo">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">-1</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
Modified: gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* dialog-account-picker.c -- window for picking a Gnucash account *
* from the QIF importer. *
* Copyright (C) 2000-2001 Bill Gribble <grib at billgribble.com> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -34,31 +35,36 @@
#include "gnc-gui-query.h"
#include "gnc-ui-util.h"
+enum account_cols {
+ ACCOUNT_COL_NAME = 0,
+ ACCOUNT_COL_FULLNAME,
+ ACCOUNT_COL_CHECK,
+ NUM_ACCOUNT_COLS
+};
+
struct _accountpickerdialog {
GtkWidget * dialog;
- GtkWidget * treeview;
+ GtkTreeView * treeview;
QIFImportWindow * qif_wind;
SCM map_entry;
gchar * selected_name;
};
static void
-row_data_destroy_cb(gpointer data) {
- g_free(data);
-}
-
-static void
-acct_tree_add_accts(SCM accts, GtkCTree * tree, GtkCTreeNode * parent,
- char * base_name, int *row)
+acct_tree_add_accts(SCM accts,
+ GtkTreeStore *store,
+ GtkTreeIter *parent,
+ const char *base_name,
+ const char *selected_name,
+ GtkTreeRowReference **reference)
{
- char * acctinfo[2];
+ GtkTreeIter iter;
+ char * compname;
char * acctname;
- GtkCTreeNode * node;
gboolean leafnode;
SCM current;
+ gboolean checked;
- acctinfo[1] = "";
-
while(!SCM_NULLP(accts)) {
current = SCM_CAR(accts);
@@ -69,9 +75,9 @@
}
if (SCM_STRINGP(SCM_CAR(current)))
- acctinfo[0] = g_strdup(SCM_STRING_CHARS(SCM_CAR(current)));
+ compname = SCM_STRING_CHARS(SCM_CAR(current));
else
- acctinfo[0] = g_strdup("");
+ compname = "";
if(!SCM_NULLP(SCM_CADDR(current))) {
leafnode = FALSE;
@@ -79,72 +85,69 @@
else {
leafnode = TRUE;
}
-
- node = gtk_ctree_insert_node(tree, parent, NULL,
- acctinfo, 2,
- NULL, NULL, NULL, NULL,
- leafnode, TRUE);
- gnc_clist_set_check (GTK_CLIST (tree), (*row)++, 1,
- SCM_CADR (current) == SCM_BOOL_T);
-
- /* set some row data */
- if(base_name && (strlen(base_name) > 0)) {
+ /* compute full name */
+ if(base_name && *base_name) {
acctname = g_strjoin(gnc_get_account_separator_string(),
- base_name, acctinfo[0], (char *)NULL);
+ base_name, compname, (char *)NULL);
}
else {
- acctname = g_strdup(acctinfo[0]);
+ acctname = g_strdup(compname);
}
- gtk_ctree_node_set_row_data_full(tree, node,
- acctname,
- row_data_destroy_cb);
+
+ checked = (SCM_CADR (current) == SCM_BOOL_T);
+
+ gtk_tree_store_append(store, &iter, parent);
+ gtk_tree_store_set(store, &iter,
+ ACCOUNT_COL_NAME, compname,
+ ACCOUNT_COL_FULLNAME, acctname,
+ ACCOUNT_COL_CHECK, checked,
+ -1);
+
+ if (reference && !*reference &&
+ selected_name && (g_utf8_collate(selected_name, acctname) == 0)) {
+ GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ *reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
+
if(!leafnode) {
- acct_tree_add_accts(SCM_CADDR(current), tree, node, acctname, row);
+ acct_tree_add_accts(SCM_CADDR(current), store, &iter, acctname,
+ selected_name, reference);
}
-
+
+ g_free(acctname);
+
accts = SCM_CDR(accts);
}
}
-static gint
-test_str_cmp(gconstpointer a, gconstpointer b)
-{
- return strcmp(a, b);
-}
-
static void
build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
{
SCM get_accts = scm_c_eval_string("qif-import:get-all-accts");
SCM acct_tree = scm_call_1(get_accts,
gnc_ui_qif_import_druid_get_mappings(import));
- GtkCTreeNode * new_sel;
- int row = 0;
+ GtkTreeStore *store;
+ GtkTreePath *path;
+ GtkTreeSelection* selection;
+ GtkTreeRowReference *reference = NULL;
- gtk_clist_freeze(GTK_CLIST(picker->treeview));
- gtk_clist_clear(GTK_CLIST(picker->treeview));
- gtk_clist_set_column_justification (GTK_CLIST(picker->treeview),
- 1, GTK_JUSTIFY_CENTER);
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(picker->treeview));
+ gtk_tree_store_clear(store);
- acct_tree_add_accts(acct_tree, GTK_CTREE(picker->treeview),
- NULL, NULL, &row);
+ acct_tree_add_accts(acct_tree, store, NULL, NULL,
+ picker->selected_name, &reference);
- if(picker->selected_name) {
- new_sel =
- gtk_ctree_find_by_row_data_custom(GTK_CTREE(picker->treeview),
- NULL,
- picker->selected_name,
- &test_str_cmp);
-
- gtk_ctree_select(GTK_CTREE(picker->treeview), new_sel);
- gtk_ctree_node_moveto(GTK_CTREE(picker->treeview), new_sel, 0,
- 0.5, 0.0);
+ if (reference) {
+ selection = gtk_tree_view_get_selection(picker->treeview);
+ path = gtk_tree_row_reference_get_path(reference);
+ if (path) {
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
+ }
+ gtk_tree_row_reference_free(reference);
}
-
- gtk_clist_columns_autosize (GTK_CLIST (picker->treeview));
- gtk_clist_column_titles_passive (GTK_CLIST (picker->treeview));
- gtk_clist_thaw(GTK_CLIST(picker->treeview));
}
static void
@@ -189,35 +192,26 @@
}
static void
-gnc_ui_qif_account_picker_select_cb(GtkCTree * tree,
- GtkCTreeNode * node,
- gint column,
- gpointer user_data)
+gnc_ui_qif_account_picker_changed_cb (GtkTreeSelection *selection,
+ gpointer user_data)
{
QIFAccountPickerDialog * wind = user_data;
SCM name_setter = scm_c_eval_string("qif-map-entry:set-gnc-name!");
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *name;
g_free(wind->selected_name);
- wind->selected_name =
- g_strdup(gtk_ctree_node_get_row_data(tree, node));
-
- scm_call_2(name_setter, wind->map_entry, scm_makfrom0str(wind->selected_name));
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ gtk_tree_model_get(model, &iter, ACCOUNT_COL_FULLNAME, &name, -1);
+ wind->selected_name = g_strdup(name);
+ scm_call_2(name_setter, wind->map_entry, scm_makfrom0str(wind->selected_name));
+ } else {
+ wind->selected_name = NULL;
+ }
}
-static void
-gnc_ui_qif_account_picker_unselect_cb(GtkCTree * tree,
- GtkCTreeNode * node,
- gint column,
- gpointer user_data)
-{
- QIFAccountPickerDialog * wind = user_data;
-
- g_free(wind->selected_name);
- wind->selected_name = NULL;
-}
-
-
static int
gnc_ui_qif_account_picker_map_cb(GtkWidget * w, gpointer user_data)
{
@@ -259,7 +253,7 @@
G_CALLBACK (gnc_ui_qif_account_picker_new_cb), wind);
wind->dialog = glade_xml_get_widget (xml, "QIF Import Account Picker");
- wind->treeview = glade_xml_get_widget (xml, "account_tree");
+ wind->treeview = GTK_TREE_VIEW(glade_xml_get_widget (xml, "account_tree"));
wind->qif_wind = qif_wind;
wind->map_entry = map_entry;
@@ -269,14 +263,35 @@
scm_gc_protect_object(wind->map_entry);
- g_signal_connect(wind->treeview, "tree_select_row",
- G_CALLBACK(gnc_ui_qif_account_picker_select_cb),
- wind);
+ {
+ GtkTreeStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
- g_signal_connect(wind->treeview, "tree_unselect_row",
- G_CALLBACK(gnc_ui_qif_account_picker_unselect_cb),
- wind);
+ store = gtk_tree_store_new(NUM_ACCOUNT_COLS, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(wind->treeview, GTK_TREE_MODEL(store));
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
+ "text", ACCOUNT_COL_NAME,
+ NULL);
+ g_object_set(column, "expand", TRUE, NULL);
+ gtk_tree_view_append_column(wind->treeview, column);
+
+ renderer = gtk_cell_renderer_toggle_new();
+ g_object_set(renderer, "activatable", FALSE, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("New?"), renderer,
+ "active", ACCOUNT_COL_CHECK,
+ NULL);
+ gtk_tree_view_append_column(wind->treeview, column);
+
+ selection = gtk_tree_view_get_selection(wind->treeview);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_ui_qif_account_picker_changed_cb), wind);
+ }
+
g_signal_connect_after(wind->dialog, "map",
G_CALLBACK(gnc_ui_qif_account_picker_map_cb),
wind);
Modified: gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/druid-qif-import.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/qif-import/druid-qif-import.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -1,7 +1,8 @@
/********************************************************************\
- * druid-qif-import.c -- window for importing QIF files *
+ * druid-qif-import.c -- window for importing QIF files *
* (GnuCash) *
* Copyright (C) 2000 Bill Gribble <grib at billgribble.com> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -43,6 +44,7 @@
#include "gnc-gui-query.h"
#include "gnc-ui-util.h"
#include "gnc-gconf-utils.h"
+#include "gnc-gtk-utils.h"
#include "gnc-ui.h"
#include "guile-mappings.h"
@@ -51,21 +53,45 @@
#define DRUID_QIF_IMPORT_CM_CLASS "druid-qif-import"
#define GCONF_SECTION "dialogs/import/qif"
+#define PREV_ROW "prev_row"
+
+enum filename_cols {
+ FILENAME_COL_INDEX = 0,
+ FILENAME_COL_NAME,
+ NUM_FILENAME_COLS
+};
+
+enum account_cols {
+ ACCOUNT_COL_INDEX = 0,
+ ACCOUNT_COL_QIF_NAME,
+ ACCOUNT_COL_GNC_NAME,
+ ACCOUNT_COL_NEW,
+ NUM_ACCOUNT_COLS
+};
+
+enum qif_trans_cols {
+ QIF_TRANS_COL_INDEX = 0,
+ QIF_TRANS_COL_DATE,
+ QIF_TRANS_COL_DESCRIPTION,
+ QIF_TRANS_COL_AMOUNT,
+ QIF_TRANS_COL_CHECKED,
+ NUM_QIF_TRANS_COLS
+};
+
struct _qifimportwindow {
GtkWidget * window;
GtkWidget * druid;
GtkWidget * filename_entry;
GtkWidget * acct_entry;
GtkWidget * date_format_combo;
- GtkWidget * date_format_entry;
- GtkWidget * selected_file_list;
- GtkWidget * acct_list;
- GtkWidget * cat_list;
- GtkWidget * memo_list;
+ GtkWidget * selected_file_view;
+ GtkWidget * acct_view;
+ GtkWidget * cat_view;
+ GtkWidget * memo_view;
GtkWidget * currency_picker;
GtkWidget * currency_entry;
- GtkWidget * new_transaction_list;
- GtkWidget * old_transaction_list;
+ GtkWidget * new_transaction_view;
+ GtkWidget * old_transaction_view;
GList * pre_comm_pages;
GList * commodity_pages;
@@ -113,7 +139,7 @@
static void update_memo_page(QIFImportWindow * win);
static void update_account_picker_page(QIFImportWindow * wind,
- SCM make_display, GtkWidget *list,
+ SCM make_display, GtkWidget *view,
SCM map_info, SCM * display_info);
static void gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
@@ -427,9 +453,6 @@
const char * path_to_load;
const gchar * default_acctname = NULL;
- GList * format_strings;
- GList * listit;
-
SCM make_qif_file = scm_c_eval_string("make-qif-file");
SCM qif_file_load = scm_c_eval_string("qif-file:read-file");
SCM qif_file_parse = scm_c_eval_string("qif-file:parse-fields");
@@ -548,24 +571,16 @@
if(SCM_LISTP(parse_return) &&
(SCM_CAR(parse_return) == SCM_BOOL_T)) {
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0);
if ((date_formats = scm_call_2(qif_file_parse_results,
SCM_CDR(parse_return),
scm_str2symbol("date"))) != SCM_BOOL_F) {
- format_strings = NULL;
while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats)) {
- format_strings =
- g_list_append(format_strings,
- g_strdup(SCM_SYMBOL_CHARS(SCM_CAR(date_formats))));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
+ SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
date_formats = SCM_CDR(date_formats);
}
- gtk_combo_set_popdown_strings(GTK_COMBO(wind->date_format_combo),
- format_strings);
-
- for(listit = format_strings; listit; listit=listit->next) {
- free(listit->data);
- listit->data = NULL;
- }
- g_list_free(format_strings);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), 0);
ask_date_format = TRUE;
@@ -639,9 +654,12 @@
SCM reparse_dates = scm_c_eval_string("qif-file:reparse-dates");
SCM check_from_acct = scm_c_eval_string("qif-file:check-from-acct");
- SCM format_sym =
- scm_str2symbol(gtk_entry_get_text(GTK_ENTRY(wind->date_format_entry)));
+ SCM format_sym;
+ gchar *text;
+ text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->date_format_combo));
+ format_sym = scm_str2symbol(text);
+ g_free(text);
scm_call_2(reparse_dates, wind->selected_file, format_sym);
if(scm_call_1(check_from_acct, wind->selected_file) != SCM_BOOL_T) {
@@ -670,20 +688,28 @@
****************************************************************/
static void
-gnc_ui_qif_import_select_loaded_file_cb(GtkCList * list,
- int row, int column,
- GdkEvent * event,
- gpointer user_data)
+gnc_ui_qif_import_select_loaded_file_cb (GtkTreeSelection *selection,
+ gpointer user_data)
{
QIFImportWindow * wind = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint row;
- if(SCM_LISTP(wind->imported_files) &&
- (scm_ilength(wind->imported_files) > row)) {
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ gtk_tree_model_get(model, &iter, FILENAME_COL_INDEX, &row, -1);
+ if(SCM_LISTP(wind->imported_files) &&
+ (scm_ilength(wind->imported_files) > row)) {
+ scm_gc_unprotect_object(wind->selected_file);
+ wind->selected_file = scm_list_ref(wind->imported_files,
+ scm_int2num(row));
+ scm_gc_protect_object(wind->selected_file);
+ }
+ } else {
scm_gc_unprotect_object(wind->selected_file);
- wind->selected_file = scm_list_ref(wind->imported_files,
- scm_int2num(row));
+ wind->selected_file = SCM_BOOL_F;
scm_gc_protect_object(wind->selected_file);
- }
+ }
}
/********************************************************************
@@ -768,38 +794,47 @@
SCM loaded_file_list = wind->imported_files;
SCM scm_qiffile = SCM_BOOL_F;
SCM qif_file_path;
- int row;
- int sel_item=-1;
+ int row = 0;
char * row_text;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeRowReference *reference = NULL;
/* clear the list */
- gtk_clist_clear(GTK_CLIST(wind->selected_file_list));
+ view = GTK_TREE_VIEW(wind->selected_file_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+ gtk_list_store_clear(store);
qif_file_path = scm_c_eval_string("qif-file:path");
- /* iterate over all the imported files */
- gtk_clist_freeze(GTK_CLIST(wind->selected_file_list));
-
while(!SCM_NULLP(loaded_file_list)) {
scm_qiffile = SCM_CAR(loaded_file_list);
row_text = SCM_STRING_CHARS(scm_call_1(qif_file_path, scm_qiffile));
- row = gtk_clist_append(GTK_CLIST(wind->selected_file_list),
- &row_text);
-
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ FILENAME_COL_INDEX, row++,
+ FILENAME_COL_NAME, row_text,
+ -1);
if(scm_qiffile == wind->selected_file) {
- sel_item = row;
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
}
loaded_file_list = SCM_CDR(loaded_file_list);
}
- gtk_clist_thaw(GTK_CLIST(wind->selected_file_list));
- if(sel_item >= 0) {
- gtk_clist_select_row(GTK_CLIST(wind->selected_file_list), sel_item, 0);
+ if (reference) {
+ GtkTreeSelection* selection = gtk_tree_view_get_selection(view);
+ path = gtk_tree_row_reference_get_path(reference);
+ if (path) {
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
+ }
+ gtk_tree_row_reference_free(reference);
}
-
- /* Wheee! Look at me! I'm a little one-line hack to make stuff work! */
- gtk_widget_queue_resize (wind->window);
}
@@ -868,28 +903,32 @@
* update_account_picker_page
* Generic function to update an account_picker page. This
* generalizes the code shared whenever any QIF -> GNC mapper is
- * updating it's CLIST. It asks the Scheme side to guess some account
+ * updating it's LIST STORE. It asks the Scheme side to guess some account
* translations and then shows the account name and suggested
- * translation in the Accounts page clist (acount picker list).
+ * translation in the Accounts page view (acount picker list).
****************************************************************/
static void
update_account_picker_page(QIFImportWindow * wind, SCM make_display,
- GtkWidget *list, SCM map_info, SCM * display_info)
+ GtkWidget *view, SCM map_info, SCM * display_info)
{
SCM get_qif_name = scm_c_eval_string("qif-map-entry:qif-name");
SCM get_gnc_name = scm_c_eval_string("qif-map-entry:gnc-name");
SCM get_new = scm_c_eval_string("qif-map-entry:new-acct?");
SCM accts_left;
- int sel_row=0;
- char * row_text[3];
- int row;
+ const gchar *qif_name, *gnc_name;
+ gboolean checked;
+ gint row = 0;
+ gint prev_row;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
- /* get the old selection row */
- sel_row = (GTK_CLIST(list))->focus_row;
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(view)));
- /* now get the list of strings to display in the clist widget */
+ /* now get the list of strings to display in the gtk_list_store widget */
accts_left = scm_call_3(make_display,
wind->imported_files,
map_info,
@@ -899,37 +938,32 @@
*display_info = accts_left;
scm_gc_protect_object(*display_info);
- gtk_clist_column_titles_passive (GTK_CLIST(list));
-
/* clear the list */
- gtk_clist_clear(GTK_CLIST(list));
+ gtk_list_store_clear(store);
- /* update the text in the boxes */
- gtk_clist_freeze(GTK_CLIST(list));
-
- gtk_clist_set_column_justification(GTK_CLIST(list),
- 2,
- GTK_JUSTIFY_CENTER);
-
- row_text[2] = "";
-
while(!SCM_NULLP(accts_left)) {
- row_text[0] = SCM_STRING_CHARS(scm_call_1(get_qif_name, SCM_CAR(accts_left)));
- row_text[1] = SCM_STRING_CHARS(scm_call_1(get_gnc_name, SCM_CAR(accts_left)));
-
- row = gtk_clist_append(GTK_CLIST(list), row_text);
+ qif_name = SCM_STRING_CHARS(scm_call_1(get_qif_name, SCM_CAR(accts_left)));
+ gnc_name = SCM_STRING_CHARS(scm_call_1(get_gnc_name, SCM_CAR(accts_left)));
+ checked = (scm_call_1(get_new, SCM_CAR(accts_left)) == SCM_BOOL_T);
- gnc_clist_set_check (GTK_CLIST(list), row, 2,
- scm_call_1(get_new, SCM_CAR(accts_left)) == SCM_BOOL_T);
-
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ ACCOUNT_COL_INDEX, row++,
+ ACCOUNT_COL_QIF_NAME, qif_name,
+ ACCOUNT_COL_GNC_NAME, gnc_name,
+ ACCOUNT_COL_NEW, checked,
+ -1);
accts_left = SCM_CDR(accts_left);
}
- gtk_clist_thaw(GTK_CLIST(list));
-
/* move to the old selected row */
- (GTK_CLIST(list))->focus_row = sel_row;
- gtk_clist_moveto(GTK_CLIST(list), sel_row, 0, 0.0, 0.0);
+ prev_row = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(store), PREV_ROW));
+ if (prev_row != -1) {
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
+ path = gtk_tree_path_new_from_indices (prev_row, -1);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
+ }
}
@@ -944,7 +978,7 @@
SCM make_account_display = scm_c_eval_string("qif-dialog:make-account-display");
- update_account_picker_page (wind, make_account_display, wind->acct_list,
+ update_account_picker_page (wind, make_account_display, wind->acct_view,
wind->acct_map_info, &(wind->acct_display_info));
}
@@ -958,7 +992,7 @@
{
SCM make_category_display = scm_c_eval_string("qif-dialog:make-category-display");
- update_account_picker_page (wind, make_category_display, wind->cat_list,
+ update_account_picker_page (wind, make_category_display, wind->cat_view,
wind->cat_map_info, &(wind->cat_display_info));
}
@@ -972,11 +1006,57 @@
{
SCM make_memo_display = scm_c_eval_string("qif-dialog:make-memo-display");
- update_account_picker_page (wind, make_memo_display, wind->memo_list,
+ update_account_picker_page (wind, make_memo_display, wind->memo_view,
wind->memo_map_info, &(wind->memo_display_info));
}
+
/********************************************************************
+ ********************************************************************/
+
+static void
+create_account_picker_view(GtkWidget *widget,
+ const gchar *col_name,
+ GCallback callback,
+ gpointer user_data)
+{
+ GtkTreeView *view = GTK_TREE_VIEW(widget);
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
+ store = gtk_list_store_new(NUM_ACCOUNT_COLS, G_TYPE_INT, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(col_name, renderer,
+ "text", ACCOUNT_COL_QIF_NAME,
+ NULL);
+ g_object_set(column, "expand", TRUE, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("GnuCash account name"), renderer,
+ "text", ACCOUNT_COL_GNC_NAME,
+ NULL);
+ g_object_set(column, "expand", TRUE, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_toggle_new();
+ g_object_set(renderer, "activatable", FALSE, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("New?"), renderer,
+ "active", ACCOUNT_COL_NEW,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ g_object_set_data(G_OBJECT(store), PREV_ROW, GINT_TO_POINTER(-1));
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed", callback, user_data);
+}
+
+/********************************************************************
* select_line
* generic function to process the selection when a user tries to edit
* an account mapping in one of the "map QIF * to GNC" pages. This
@@ -985,12 +1065,26 @@
* function.
********************************************************************/
static void
-select_line (QIFImportWindow *wind, gint row, SCM display_info, SCM map_info,
+select_line (QIFImportWindow *wind, GtkTreeSelection *selection,
+ SCM display_info, SCM map_info,
void (*update_page)(QIFImportWindow *))
{
SCM get_name = scm_c_eval_string("qif-map-entry:qif-name");
SCM selected_acct;
-
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint row, prev_row;
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+ gtk_tree_model_get(model, &iter, ACCOUNT_COL_INDEX, &row, -1);
+ prev_row = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(model), PREV_ROW));
+ if (row == prev_row)
+ return;
+ g_object_set_data(G_OBJECT(model), PREV_ROW, GINT_TO_POINTER(row));
+ if (row == -1)
+ return;
+
/* find the <qif-map-entry> corresponding to the selected row */
selected_acct = scm_list_ref(display_info, scm_int2num(row));
@@ -1010,13 +1104,11 @@
********************************************************************/
static void
-gnc_ui_qif_import_account_line_select_cb(GtkCList * clist, gint row,
- gint column, GdkEvent * event,
- gpointer user_data)
+gnc_ui_qif_import_account_line_select_cb(GtkTreeSelection *selection,
+ gpointer user_data)
{
QIFImportWindow * wind = user_data;
-
- select_line (wind, row, wind->acct_display_info, wind->acct_map_info,
+ select_line (wind, selection, wind->acct_display_info, wind->acct_map_info,
update_accounts_page);
}
@@ -1027,13 +1119,11 @@
********************************************************************/
static void
-gnc_ui_qif_import_category_line_select_cb(GtkCList * clist, gint row,
- gint column, GdkEvent * event,
- gpointer user_data)
+gnc_ui_qif_import_category_line_select_cb(GtkTreeSelection *selection,
+ gpointer user_data)
{
QIFImportWindow * wind = user_data;
-
- select_line (wind, row, wind->cat_display_info, wind->cat_map_info,
+ select_line (wind, selection, wind->acct_display_info, wind->acct_map_info,
update_categories_page);
}
@@ -1044,13 +1134,11 @@
********************************************************************/
static void
-gnc_ui_qif_import_memo_line_select_cb(GtkCList * clist, gint row,
- gint column, GdkEvent * event,
- gpointer user_data)
+gnc_ui_qif_import_memo_line_select_cb(GtkTreeSelection *selection,
+ gpointer user_data)
{
QIFImportWindow * wind = user_data;
-
- select_line (wind, row, wind->memo_display_info, wind->memo_map_info,
+ select_line (wind, selection, wind->acct_display_info, wind->acct_map_info,
update_memo_page);
}
@@ -1128,12 +1216,17 @@
Transaction * gnc_xtn;
Split * gnc_split;
gnc_commodity * old_commodity;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection* selection;
const char * mnemonic = NULL;
- const char * namespace = NULL;
+ gchar * namespace = NULL;
const char * fullname = NULL;
- const gchar * row_text[4] = { NULL, NULL, NULL, NULL };
- int rownum;
+ const gchar * amount_str;
+ int rownum = 0;
/* get the default currency */
const char * currname = gtk_entry_get_text(GTK_ENTRY(wind->currency_entry));
@@ -1148,13 +1241,14 @@
page = g_object_get_data(G_OBJECT(gtkpage), "page_struct");
mnemonic = gtk_entry_get_text(GTK_ENTRY(page->new_mnemonic_entry));
- namespace = gnc_ui_namespace_picker_ns((page->new_type_combo));
+ namespace = gnc_ui_namespace_picker_ns(page->new_type_combo);
fullname = gtk_entry_get_text(GTK_ENTRY(page->new_name_entry));
gnc_commodity_set_namespace(page->commodity, namespace);
gnc_commodity_set_fullname(page->commodity, fullname);
gnc_commodity_set_mnemonic(page->commodity, mnemonic);
+ g_free(namespace);
old_commodity = page->commodity;
page->commodity = gnc_commodity_table_insert(gnc_get_current_commodities(),
page->commodity);
@@ -1212,42 +1306,44 @@
return FALSE;
}
- gtk_clist_column_titles_passive (GTK_CLIST(wind->new_transaction_list));
-
/* otherwise, make up the display for the duplicates page */
- gtk_clist_clear(GTK_CLIST(wind->new_transaction_list));
- gtk_clist_freeze(GTK_CLIST(wind->new_transaction_list));
+ view = GTK_TREE_VIEW(wind->new_transaction_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+ gtk_list_store_clear(store);
while(!SCM_NULLP(retval)) {
current_xtn = SCM_CAAR(retval);
gnc_xtn = (Transaction *)gw_wcp_get_ptr(current_xtn);
- gnc_split = xaccTransGetSplit(gnc_xtn, 0);
- row_text[0] = gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn));
- row_text[1] = xaccTransGetDescription(gnc_xtn);
-
if(xaccTransCountSplits(gnc_xtn) > 2) {
- row_text[2] = g_strdup(_("(split)"));
+ amount_str = _("(split)");
}
else {
- row_text[2] =
+ gnc_split = xaccTransGetSplit(gnc_xtn, 0);
+ amount_str =
xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
gnc_account_print_info
(xaccSplitGetAccount(gnc_split), TRUE));
}
- rownum = gtk_clist_append(GTK_CLIST(wind->new_transaction_list),
- (gchar **) row_text);
-
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set
+ (store, &iter,
+ QIF_TRANS_COL_INDEX, rownum++,
+ QIF_TRANS_COL_DATE, gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
+ QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
+ QIF_TRANS_COL_AMOUNT, amount_str,
+ -1);
+
retval = SCM_CDR(retval);
}
- gtk_clist_columns_autosize(GTK_CLIST(wind->new_transaction_list));
+ selection = gtk_tree_view_get_selection(view);
+ path = gtk_tree_path_new_from_indices (0, -1);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
+ }
- gtk_clist_thaw(GTK_CLIST(wind->new_transaction_list));
- gtk_clist_select_row(GTK_CLIST(wind->new_transaction_list), 0, 0);
- }
-
gnc_resume_gui_refresh();
return TRUE;
}
@@ -1384,7 +1480,7 @@
QIFImportWindow * wind = user_data;
QIFDruidPage * qpage = g_object_get_data(G_OBJECT(page), "page_struct");
- const char * namespace = gnc_ui_namespace_picker_ns(qpage->new_type_combo);
+ gchar *namespace = gnc_ui_namespace_picker_ns(qpage->new_type_combo);
const char * name = gtk_entry_get_text(GTK_ENTRY(qpage->new_name_entry));
const char * mnemonic = gtk_entry_get_text(GTK_ENTRY(qpage->new_mnemonic_entry));
int show_matches;
@@ -1392,6 +1488,8 @@
if(!namespace || (namespace[0] == 0)) {
gnc_warning_dialog(wind->window,
_("You must enter a Type for the commodity."));
+ if (namespace)
+ g_free(namespace);
return TRUE;
}
else if(!name || (name[0] == 0)) {
@@ -1413,8 +1511,10 @@
_("You must enter an existing national "
"currency or enter a different type."));
+ g_free(namespace);
return TRUE;
}
+ g_free(namespace);
if(page == (g_list_last(wind->commodity_pages))->data) {
/* it's time to import the accounts. */
@@ -1568,9 +1668,9 @@
info_label = gtk_label_new("");
gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
- retval->new_type_combo = gtk_combo_new();
- gtk_box_pack_start(GTK_BOX(temp),
- retval->new_type_combo, TRUE, TRUE, 0);
+ retval->new_type_combo = gtk_combo_box_entry_new_text();
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->new_type_combo));
+ gtk_box_pack_start(GTK_BOX(temp), retval->new_type_combo, TRUE, TRUE, 0);
info_label = gtk_label_new("");
gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
@@ -1641,77 +1741,102 @@
SCM selected;
Transaction * gnc_xtn;
Split * gnc_split;
- const gchar * row_text[4] = { NULL, NULL, NULL, NULL };
- int rownum;
+ const gchar * amount_str;
+ int rownum = 0;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
- gtk_clist_column_titles_passive (GTK_CLIST(wind->old_transaction_list));
+ view = GTK_TREE_VIEW(wind->old_transaction_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+ gtk_list_store_clear(store);
- gtk_clist_clear(GTK_CLIST(wind->old_transaction_list));
- gtk_clist_freeze(GTK_CLIST(wind->old_transaction_list));
-
- gtk_clist_set_column_justification(GTK_CLIST(wind->old_transaction_list),
- 3,
- GTK_JUSTIFY_CENTER);
-
if(wind->match_transactions != SCM_BOOL_F) {
possible_matches = SCM_CDR(scm_list_ref(wind->match_transactions,
scm_int2num(wind->selected_transaction)));
scm_call_2(scm_c_eval_string("qif-import:refresh-match-selection"),
possible_matches, scm_int2num(selection));
- row_text[3] = "";
-
while(!SCM_NULLP(possible_matches)) {
current_xtn = SCM_CAR(possible_matches);
gnc_xtn = (Transaction *)gw_wcp_get_ptr(SCM_CAR(current_xtn));
selected = SCM_CDR(current_xtn);
- gnc_split = xaccTransGetSplit(gnc_xtn, 0);
- row_text[0] = gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn));
- row_text[1] = xaccTransGetDescription(gnc_xtn);
-
if(xaccTransCountSplits(gnc_xtn) > 2) {
- row_text[2] = _("(split)");
+ amount_str = _("(split)");
}
else {
- row_text[2] =
+ gnc_split = xaccTransGetSplit(gnc_xtn, 0);
+ amount_str =
xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
gnc_account_print_info
(xaccSplitGetAccount(gnc_split), TRUE));
}
-
- rownum = gtk_clist_append(GTK_CLIST(wind->old_transaction_list),
- (gchar **) row_text);
- gnc_clist_set_check (GTK_CLIST(wind->old_transaction_list),
- rownum, 3, selected != SCM_BOOL_F);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set
+ (store, &iter,
+ QIF_TRANS_COL_INDEX, rownum++,
+ QIF_TRANS_COL_DATE, gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
+ QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
+ QIF_TRANS_COL_AMOUNT, amount_str,
+ QIF_TRANS_COL_CHECKED, selected != SCM_BOOL_F,
+ -1);
possible_matches = SCM_CDR(possible_matches);
}
}
-
- gtk_clist_columns_autosize (GTK_CLIST(wind->old_transaction_list));
-
- gtk_clist_thaw(GTK_CLIST(wind->old_transaction_list));
}
static void
-gnc_ui_qif_import_duplicate_new_select_cb(GtkCList * clist, int row, int col,
- GdkEvent * ev, gpointer user_data)
+gnc_ui_qif_import_duplicate_new_select_cb (GtkTreeSelection *selection,
+ QIFImportWindow *wind)
{
- QIFImportWindow * wind = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
- wind->selected_transaction = row;
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ gtk_tree_model_get(model, &iter,
+ QIF_TRANS_COL_INDEX, &wind->selected_transaction,
+ -1);
refresh_old_transactions(wind, -1);
}
+static gboolean
+reset_ignore_old_select(gboolean *ignore)
+{
+ *ignore = FALSE;
+ return FALSE;
+}
static void
-gnc_ui_qif_import_duplicate_old_select_cb(GtkCList * clist, int row, int col,
- GdkEvent * ev, gpointer user_data)
+gnc_ui_qif_import_duplicate_old_select_cb (GtkTreeSelection *selection,
+ QIFImportWindow *wind)
{
- QIFImportWindow * wind = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint row;
+ static gboolean ignore_old_select = FALSE;
+ /* Get the current selection then clear it. We're about to clear
+ * the entire list store and rebuild it so this prevents errors. */
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ return;
+ gtk_tree_selection_unselect_all(selection);
+
+ /* Getting a weird double call the first time a line is clicked.
+ * Once via gtk_tree_view_button_press and then again via
+ * gtk_tree_view_grab_focus. */
+ if (ignore_old_select)
+ return;
+ ignore_old_select = TRUE;
+ g_idle_add((GSourceFunc)reset_ignore_old_select, &ignore_old_select);
+
+ /* Get the row the user clicked on and update the scheme
+ * code/rebuild the list store. */
+ gtk_tree_model_get(model, &iter,
+ QIF_TRANS_COL_INDEX, &row,
+ -1);
refresh_old_transactions(wind, row);
}
@@ -1808,7 +1933,13 @@
SCM mapping_info;
SCM create_ticker_map;
int i;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
char * pre_page_names[NUM_PRE_PAGES] = {
"start_page", "load_file_page", "date_format_page", "account_name_page",
"loaded_files_page", "account_doc_page", "account_match_page",
@@ -1858,10 +1989,6 @@
G_CALLBACK (gnc_ui_qif_import_date_format_next_cb), retval);
glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_select_loaded_file_cb",
- G_CALLBACK (gnc_ui_qif_import_select_loaded_file_cb), retval);
-
- glade_xml_signal_connect_data
(xml, "gnc_ui_qif_import_loaded_files_prepare_cb",
G_CALLBACK (gnc_ui_qif_import_loaded_files_prepare_cb), retval);
@@ -1882,18 +2009,6 @@
G_CALLBACK (gnc_ui_qif_import_default_acct_back_cb), retval);
glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_account_line_select_cb",
- G_CALLBACK (gnc_ui_qif_import_account_line_select_cb), retval);
-
- glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_category_line_select_cb",
- G_CALLBACK (gnc_ui_qif_import_category_line_select_cb), retval);
-
- glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_memo_line_select_cb",
- G_CALLBACK (gnc_ui_qif_import_memo_line_select_cb), retval);
-
- glade_xml_signal_connect_data
(xml, "gnc_ui_qif_import_accounts_prepare_cb",
G_CALLBACK (gnc_ui_qif_import_accounts_prepare_cb), retval);
@@ -1918,14 +2033,6 @@
G_CALLBACK (gnc_ui_qif_import_commodity_prepare_cb), retval);
glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_duplicate_new_select_cb",
- G_CALLBACK (gnc_ui_qif_import_duplicate_new_select_cb), retval);
-
- glade_xml_signal_connect_data
- (xml, "gnc_ui_qif_import_duplicate_old_select_cb",
- G_CALLBACK (gnc_ui_qif_import_duplicate_old_select_cb), retval);
-
- glade_xml_signal_connect_data
(xml, "gnc_ui_qif_import_finish_cb",
G_CALLBACK (gnc_ui_qif_import_finish_cb), retval);
@@ -1950,18 +2057,17 @@
retval->druid = glade_xml_get_widget (xml, "qif_import_druid");
retval->filename_entry = glade_xml_get_widget (xml, "qif_filename_entry");
retval->acct_entry = glade_xml_get_widget (xml, "qif_account_entry");
- retval->date_format_combo = glade_xml_get_widget (xml, "date_format_combo");
- retval->date_format_entry = glade_xml_get_widget (xml, "date_format_entry");
- retval->selected_file_list = glade_xml_get_widget(xml, "selected_file_list");
- retval->currency_picker = glade_xml_get_widget (xml, "currency_combo");
+ retval->date_format_combo = glade_xml_get_widget (xml, "date_format_combobox");
+ retval->selected_file_view = glade_xml_get_widget(xml, "selected_file_view");
+ retval->currency_picker = glade_xml_get_widget (xml, "currency_comboboxentry");
retval->currency_entry = glade_xml_get_widget (xml, "currency_entry");
- retval->acct_list = glade_xml_get_widget (xml, "account_page_list");
- retval->cat_list = glade_xml_get_widget (xml, "category_page_list");
- retval->memo_list = glade_xml_get_widget (xml, "memo_page_list");
- retval->new_transaction_list =
- glade_xml_get_widget (xml, "new_transaction_list");
- retval->old_transaction_list =
- glade_xml_get_widget (xml, "old_transaction_list");
+ retval->acct_view = glade_xml_get_widget (xml, "account_page_view");
+ retval->cat_view = glade_xml_get_widget (xml, "category_page_view");
+ retval->memo_view = glade_xml_get_widget (xml, "memo_page_view");
+ retval->new_transaction_view =
+ glade_xml_get_widget (xml, "new_transaction_view");
+ retval->old_transaction_view =
+ glade_xml_get_widget (xml, "old_transaction_view");
retval->pre_comm_pages = NULL;
retval->post_comm_pages = NULL;
@@ -1987,6 +2093,100 @@
glade_xml_get_widget (xml, doc_page_names[i]));
}
+ /* Set up the selected file view */
+ view = GTK_TREE_VIEW(retval->selected_file_view);
+ store = gtk_list_store_new(NUM_FILENAME_COLS, G_TYPE_INT, G_TYPE_STRING);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
+ "text", FILENAME_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_ui_qif_import_select_loaded_file_cb),
+ retval);
+
+ create_account_picker_view(retval->acct_view, _("QIF account name"),
+ G_CALLBACK(gnc_ui_qif_import_account_line_select_cb),
+ retval);
+ create_account_picker_view(retval->cat_view, _("QIF category name"),
+ G_CALLBACK(gnc_ui_qif_import_category_line_select_cb),
+ retval);
+ create_account_picker_view(retval->memo_view, _("QIF payee/memo"),
+ G_CALLBACK(gnc_ui_qif_import_memo_line_select_cb),
+ retval);
+
+ /* Set up the new transaction view */
+ view = GTK_TREE_VIEW(retval->new_transaction_view);
+ store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer,
+ "text", QIF_TRANS_COL_DATE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
+ "text", QIF_TRANS_COL_DESCRIPTION,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+ gtk_tree_view_column_set_expand(column, TRUE);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Amount"), renderer,
+ "text", QIF_TRANS_COL_AMOUNT,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_ui_qif_import_duplicate_new_select_cb),
+ retval);
+
+
+ /* Set up the old transaction view */
+ view = GTK_TREE_VIEW(retval->old_transaction_view);
+ store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer,
+ "text", QIF_TRANS_COL_DATE,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
+ "text", QIF_TRANS_COL_DESCRIPTION,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+ gtk_tree_view_column_set_expand(column, TRUE);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Amount"), renderer,
+ "text", QIF_TRANS_COL_AMOUNT,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Dup?"), renderer,
+ "active", QIF_TRANS_COL_CHECKED,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_ui_qif_import_duplicate_old_select_cb),
+ retval);
+
+
/* load the saved-state of the mappings from Quicken accounts and
* categories to gnucash accounts */
load_map_prefs = scm_c_eval_string("qif-import:load-map-prefs");
@@ -2017,6 +2217,7 @@
scm_gc_protect_object(retval->match_transactions);
/* set a default currency for new accounts */
+ gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->currency_picker));
gnc_ui_update_commodity_picker(retval->currency_picker,
GNC_COMMODITY_NS_CURRENCY,
gnc_commodity_get_printname
Modified: gnucash/trunk/src/import-export/qif-import/qif.glade
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/import-export/qif-import/qif.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -102,44 +102,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCTree" id="account_tree">
+ <widget class="GtkTreeView" id="account_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">2</property>
- <property name="column_widths">214,48</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label847711">
- <property name="label" translatable="yes">Account</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847712">
- <property name="label" translatable="yes">New?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -350,56 +320,10 @@
</child>
<child>
- <widget class="GtkCombo" id="date_format_combo">
+ <widget class="GtkComboBox" id="date_format_combobox">
<property name="visible">True</property>
- <property name="value_in_list">True</property>
- <property name="allow_empty">False</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="date_format_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget3">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget4">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items">Dummy Date Entry</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -569,38 +493,23 @@
<property name="spacing">4</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow10">
+ <widget class="GtkScrolledWindow" id="scrolledwindow26">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="selected_file_list">
+ <widget class="GtkTreeView" id="selected_file_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_select_loaded_file_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label827">
- <property name="label" translatable="no">labe82l7</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -737,66 +646,21 @@
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow11">
<property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="account_page_list">
+ <widget class="GtkTreeView" id="account_page_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">281,242,53</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_account_line_select_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label834">
- <property name="label" translatable="yes">QIF account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label835">
- <property name="label" translatable="yes">GnuCash account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label836">
- <property name="label" translatable="yes">New?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -901,60 +765,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="category_page_list">
+ <widget class="GtkTreeView" id="category_page_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">243,250,72</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_category_line_select_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label837">
- <property name="label" translatable="yes">QIF category name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label838">
- <property name="label" translatable="yes">GnuCash account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label839">
- <property name="label" translatable="yes">New?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -1049,7 +867,7 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow25">
+ <widget class="GtkScrolledWindow" id="scrolledwindow12">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -1057,60 +875,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="memo_page_list">
+ <widget class="GtkTreeView" id="memo_page_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">285,228,72</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_memo_line_select_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847708">
- <property name="label" translatable="yes">QIF payee/memo</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847709">
- <property name="label" translatable="yes">GnuCash account name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847710">
- <property name="label" translatable="yes">New?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -1165,56 +937,11 @@
</child>
<child>
- <widget class="GtkCombo" id="currency_combo">
+ <widget class="GtkComboBoxEntry" id="currency_comboboxentry">
<property name="visible">True</property>
- <property name="value_in_list">True</property>
- <property name="allow_empty">False</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="currency_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget14">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget15">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget16">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items">Dummy currency entry</property>
+ <property name="has_frame">True</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -1358,7 +1085,7 @@
<child>
<widget class="GtkHBox" id="hbox94">
<property name="visible">True</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
@@ -1377,60 +1104,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="new_transaction_list">
+ <widget class="GtkTreeView" id="new_transaction_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">53,172,56</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_duplicate_new_select_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847700">
- <property name="label" translatable="yes">Date</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847700">
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847702">
- <property name="label" translatable="yes">Amount</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -1478,75 +1159,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="old_transaction_list">
+ <widget class="GtkTreeView" id="old_transaction_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">4</property>
- <property name="column_widths">50,133,55,32</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="gnc_ui_qif_import_duplicate_old_select_cb"/>
-
- <child>
- <widget class="GtkLabel" id="label847703">
- <property name="label" translatable="yes">Date</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847704">
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847705">
- <property name="label" translatable="yes">Amount</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847706">
- <property name="label" translatable="yes">Dup?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/trunk/src/register/register-gnome/gnucash-color.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-color.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/register/register-gnome/gnucash-color.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -152,11 +152,9 @@
void
gnucash_color_init (void)
{
- GdkColormap *colormap = gtk_widget_get_default_colormap ();
-
/* Allocate the default colors */
- gdk_color_white (colormap, &gn_white);
- gdk_color_black (colormap, &gn_black);
+ gnucash_color_alloc_name ("white", &gn_white);
+ gnucash_color_alloc_name ("black", &gn_black);
gnucash_color_alloc_name ("gray60", &gn_light_gray);
gnucash_color_alloc_name ("gray40", &gn_dark_gray);
Modified: gnucash/trunk/src/report/report-gnome/dialog-column-view.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-column-view.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/report/report-gnome/dialog-column-view.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -1,6 +1,7 @@
/********************************************************************
* dialog-column-view.c -- editor for simple column view of reports *
* Copyright (C) 2001 Bill Gribble <grib at billgribble.com> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -34,10 +35,24 @@
#include "guile-mappings.h"
#include "gnc-report.h"
+enum available_cols {
+ AVAILABLE_COL_NAME = 0,
+ AVAILABLE_COL_ROW,
+ NUM_AVAILABLE_COLS
+};
+
+enum contents_cols {
+ CONTENTS_COL_NAME = 0,
+ CONTENTS_COL_ROW,
+ CONTENTS_COL_REPORT_ROWS,
+ CONTENTS_COL_REPORT_COLS,
+ NUM_CONTENTS_COLS
+};
+
struct gncp_column_view_edit {
GNCOptionWin * optwin;
- GtkCList * available;
- GtkCList * contents;
+ GtkTreeView * available;
+ GtkTreeView * contents;
SCM options;
SCM view;
@@ -99,10 +114,14 @@
SCM contents =
gnc_option_db_lookup_option(view->odb, "__general", "report-list",
SCM_BOOL_F);
- SCM this_report, this_name;
+ SCM this_report;
SCM selection;
- char * name[3];
+ const gchar *name;
int row, i, id;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *tree_selection;
/* Update the list of available reports (left selection box). */
row = view->available_selected;
@@ -119,18 +138,25 @@
view->available_list = names;
scm_gc_protect_object(view->available_list);
- gtk_clist_freeze(view->available);
- gtk_clist_clear(view->available);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view->available));
+ gtk_list_store_clear(store);
if(SCM_LISTP(names)) {
for(i = 0; !SCM_NULLP(names); names = SCM_CDR(names), i++) {
if (SCM_EQUALP (SCM_CAR(names), selection))
row = i;
- name[0] = SCM_STRING_CHARS(scm_call_1(template_menu_name, SCM_CAR(names)));
- gtk_clist_append(view->available, name);
+ name = SCM_STRING_CHARS(scm_call_1(template_menu_name, SCM_CAR(names)));
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ AVAILABLE_COL_NAME, name,
+ AVAILABLE_COL_ROW, i,
+ -1);
}
}
- gtk_clist_select_row(view->available, row, 0);
- gtk_clist_thaw(view->available);
+
+ tree_selection = gtk_tree_view_get_selection(view->available);
+ path = gtk_tree_path_new_from_indices(row, -1);
+ gtk_tree_selection_select_path(tree_selection, path);
+ gtk_tree_path_free(path);
/* Update the list of selected reports (right selection box). */
@@ -148,8 +174,8 @@
view->contents_list = contents;
scm_gc_protect_object(view->contents_list);
- gtk_clist_freeze(view->contents);
- gtk_clist_clear(view->contents);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view->contents));
+ gtk_list_store_clear(store);
if(SCM_LISTP(contents)) {
for(i = 0; !SCM_NULLP(contents); contents = SCM_CDR(contents), i++) {
if (SCM_EQUALP (SCM_CAR(contents), selection))
@@ -157,37 +183,52 @@
id = scm_num2int(SCM_CAAR(contents), SCM_ARG1, __FUNCTION__);
this_report = gnc_report_find(id);
- /* this_name = scm_call_1(report_name, this_report); */
- this_name = scm_call_1(report_menu_name, this_report);
- name[0] = g_strdup(SCM_STRING_CHARS(this_name));
- name[1] = g_strdup_printf("%d", scm_num2int(SCM_CADR(SCM_CAR(contents)),
- SCM_ARG1, __FUNCTION__));
- name[2] = g_strdup_printf("%d", scm_num2int(SCM_CADDR(SCM_CAR(contents)),
- SCM_ARG1, __FUNCTION__));
- gtk_clist_append(view->contents, name);
- g_free(name[0]);
- g_free(name[1]);
- g_free(name[2]);
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set
+ (store, &iter,
+ CONTENTS_COL_NAME, SCM_STRING_CHARS(scm_call_1(report_menu_name,
+ this_report)),
+ CONTENTS_COL_ROW, i,
+ CONTENTS_COL_REPORT_COLS, scm_num2int(SCM_CADR(SCM_CAR(contents)),
+ SCM_ARG1, __FUNCTION__),
+ CONTENTS_COL_REPORT_ROWS, scm_num2int(SCM_CADDR(SCM_CAR(contents)),
+ SCM_ARG1, __FUNCTION__),
+ -1);
}
}
- gtk_clist_select_row(view->contents, row, 0);
- gtk_clist_thaw(view->contents);
+
+ tree_selection = gtk_tree_view_get_selection(view->contents);
+ path = gtk_tree_path_new_from_indices(row, -1);
+ gtk_tree_selection_select_path(tree_selection, path);
+ // gtk_tree_view_scroll_to_cell(view->contents, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
}
static void
-gnc_column_view_select_avail_cb(GtkCList * clist, gint row, gint col,
- GdkEvent * ev, gpointer data)
+gnc_column_view_select_avail_cb(GtkTreeSelection *selection,
+ gnc_column_view_edit *r)
{
- gnc_column_view_edit * r = data;
- r->available_selected = row;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ gtk_tree_model_get(model, &iter,
+ AVAILABLE_COL_ROW, &r->available_selected,
+ -1);
}
static void
-gnc_column_view_select_contents_cb(GtkCList * clist, gint row, gint col,
- GdkEvent * ev, gpointer data)
+gnc_column_view_select_contents_cb(GtkTreeSelection *selection,
+ gnc_column_view_edit *r)
{
- gnc_column_view_edit * r = data;
- r->contents_selected = row;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ gtk_tree_model_get(model, &iter,
+ AVAILABLE_COL_ROW, &r->contents_selected,
+ -1);
}
static void
@@ -223,6 +264,10 @@
SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
SCM ptr;
GtkWidget * editor;
+ GtkListStore *store;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
ptr = scm_call_1(get_editor, view);
if(ptr != SCM_BOOL_F) {
@@ -268,8 +313,8 @@
G_CALLBACK (gnc_column_view_edit_size_cb), r);
editor = glade_xml_get_widget (xml, "view_contents_table");
- r->available = GTK_CLIST (glade_xml_get_widget (xml, "available_list"));
- r->contents = GTK_CLIST (glade_xml_get_widget (xml, "contents_list"));
+ r->available = GTK_TREE_VIEW (glade_xml_get_widget (xml, "available_view"));
+ r->contents = GTK_TREE_VIEW (glade_xml_get_widget (xml, "contents_view"));
r->options = options;
r->view = view;
r->available_selected = 0;
@@ -278,11 +323,6 @@
r->contents_list = SCM_EOL;
r->odb = gnc_option_db_new(r->options);
- gtk_clist_set_column_auto_resize(r->available, 0, TRUE);
- gtk_clist_set_column_auto_resize(r->contents, 0, TRUE);
- gtk_clist_set_column_auto_resize(r->contents, 1, TRUE);
- gtk_clist_set_column_auto_resize(r->contents, 2, TRUE);
-
gnc_build_options_dialog_contents(r->optwin, r->odb);
gtk_notebook_append_page(GTK_NOTEBOOK(gnc_options_dialog_notebook
@@ -295,16 +335,49 @@
scm_gc_protect_object(r->available_list);
scm_gc_protect_object(r->contents_list);
- g_signal_connect(G_OBJECT(r->available), "select_row",
- G_CALLBACK (gnc_column_view_select_avail_cb), (gpointer)r);
- g_signal_connect(G_OBJECT(r->contents), "select_row",
- G_CALLBACK (gnc_column_view_select_contents_cb), (gpointer)r);
+ /* Build the 'available' view */
+ store = gtk_list_store_new (NUM_AVAILABLE_COLS, G_TYPE_STRING, G_TYPE_INT);
+ gtk_tree_view_set_model(r->available, GTK_TREE_MODEL(store));
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", AVAILABLE_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(r->available, column);
+
+ selection = gtk_tree_view_get_selection(r->available);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_column_view_select_avail_cb), r);
+
+ /* Build the 'contents' view */
+ store = gtk_list_store_new (NUM_CONTENTS_COLS, G_TYPE_STRING, G_TYPE_INT,
+ G_TYPE_INT, G_TYPE_INT);
+ gtk_tree_view_set_model(r->contents, GTK_TREE_MODEL(store));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Report"), renderer,
+ "text", CONTENTS_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(r->contents, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Cols"), renderer,
+ "text", CONTENTS_COL_REPORT_COLS,
+ NULL);
+ gtk_tree_view_append_column(r->contents, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Rows"), renderer,
+ "text", CONTENTS_COL_REPORT_ROWS,
+ NULL);
+ gtk_tree_view_append_column(r->contents, column);
+
+ selection = gtk_tree_view_get_selection(r->contents);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(gnc_column_view_select_contents_cb), r);
+
update_display_lists(r);
- gtk_clist_column_titles_passive (r->available);
- gtk_clist_column_titles_passive (r->contents);
-
gnc_options_dialog_set_apply_cb(r->optwin,
gnc_column_view_edit_apply_cb, r);
gnc_options_dialog_set_close_cb(r->optwin,
Modified: gnucash/trunk/src/report/report-gnome/dialog-style-sheet.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-style-sheet.c 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/report/report-gnome/dialog-style-sheet.c 2006-08-02 18:13:30 UTC (rev 14588)
@@ -2,6 +2,7 @@
* dialog-style-sheet.c -- window for configuring HTML style *
* sheets in GnuCash *
* Copyright (C) 2000 Bill Gribble <grib at billgribble.com> *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -170,45 +171,45 @@
SCM templates = scm_c_eval_string("(gnc:get-html-templates)");
SCM t_name = scm_c_eval_string("gnc:html-style-sheet-template-name");
SCM new_ss = SCM_BOOL_F;
- GtkWidget * template_entry;
+ GtkWidget * template_combo;
+ GtkTreeModel * template_model;
GtkWidget * name_entry;
- GtkWidget * template_combo;
- GList * strings=NULL;
gint dialog_retval;
- const char * template_str = NULL;
+ char * template_str = NULL;
const char * name_str = NULL;
/* get the new name for the style sheet */
GladeXML *xml = gnc_glade_xml_new ("report.glade",
"New Style Sheet Dialog");
GtkWidget * dlg = glade_xml_get_widget (xml, "New Style Sheet Dialog");
- template_entry = glade_xml_get_widget (xml, "template_entry");
- template_combo = glade_xml_get_widget (xml, "template_combo");
+ template_combo = glade_xml_get_widget (xml, "template_combobox");
name_entry = glade_xml_get_widget (xml, "name_entry");
+ /* Erase the initial dummy entry. */
+ template_model = gtk_combo_box_get_model(GTK_COMBO_BOX(template_combo));
+ gtk_list_store_clear(GTK_LIST_STORE(template_model));
+
/* put in the list of style sheet type names */
for(; !SCM_NULLP(templates); templates=SCM_CDR(templates)) {
SCM t = SCM_CAR(templates);
- strings = g_list_append(strings, SCM_STRING_CHARS(scm_call_1(t_name, t)));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(template_combo),
+ SCM_STRING_CHARS(scm_call_1(t_name, t)));
}
+ gtk_combo_box_set_active(GTK_COMBO_BOX(template_combo), 0);
- gtk_combo_set_popdown_strings(GTK_COMBO(template_combo), strings);
-
- /* The strings on the list are const. Just free the list. */
- g_list_free(strings);
-
/* get the name */
gtk_window_set_transient_for (GTK_WINDOW(dlg), GTK_WINDOW(ssd->toplevel));
dialog_retval = gtk_dialog_run(GTK_DIALOG(dlg));
if(dialog_retval == GTK_RESPONSE_OK) {
- template_str = gtk_entry_get_text(GTK_ENTRY(template_entry));
+ template_str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(template_combo));
name_str = gtk_entry_get_text(GTK_ENTRY(name_entry));
if(template_str && name_str) {
new_ss = scm_call_2(make_ss,
scm_makfrom0str(template_str),
scm_makfrom0str(name_str));
}
+ g_free(template_str);
}
gtk_widget_destroy(dlg);
Modified: gnucash/trunk/src/report/report-gnome/report.glade
===================================================================
--- gnucash/trunk/src/report/report-gnome/report.glade 2006-07-31 13:22:31 UTC (rev 14587)
+++ gnucash/trunk/src/report/report-gnome/report.glade 2006-08-02 18:13:30 UTC (rev 14588)
@@ -131,7 +131,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">template_entry</property>
+ <property name="mnemonic_widget">template_combobox</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -166,63 +166,18 @@
</child>
<child>
- <widget class="GtkCombo" id="template_combo">
+ <widget class="GtkComboBox" id="template_combobox">
<property name="visible">True</property>
- <property name="value_in_list">False</property>
- <property name="allow_empty">True</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="template_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget1">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget2">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items">Dummy Entry</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
</packing>
</child>
</widget>
@@ -269,59 +224,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="contents_list">
+ <widget class="GtkTreeView" id="contents_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">150,34,25</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label847725">
- <property name="label" translatable="yes">Report</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847726">
- <property name="label" translatable="yes">Cols</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847727">
- <property name="label" translatable="yes">Rows</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
@@ -342,11 +252,11 @@
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
- <property name="xalign">0.5</property>
+ <property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">available_list</property>
+ <property name="mnemonic_widget">available_view</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -371,7 +281,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">contents_list</property>
+ <property name="mnemonic_widget">contents_view</property>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -577,29 +487,14 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="available_list">
+ <widget class="GtkTreeView" id="available_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="n_columns">1</property>
- <property name="column_widths">80</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
- <property name="show_titles">False</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label847735">
- <property name="label" translatable="yes">label847735</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
More information about the gnucash-changes
mailing list