Bug #677859 - Depreciated functions in Gtk+2.24

GtkComboBox related fixes
Patch by Robert Fewell

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22215 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2012-06-13 15:23:25 +00:00
parent 784d846884
commit 79e6da77da
22 changed files with 646 additions and 618 deletions

View File

@ -316,15 +316,16 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
GList *acct_types, GList *acct_commodities)
{
GtkListStore *store;
GtkTreeIter iter;
GList *list, *node;
char *text;
const gchar *text;
g_return_val_if_fail (combo && GTK_IS_COMBO_BOX_ENTRY(combo), NULL);
g_return_val_if_fail (combo && GTK_IS_COMBO_BOX(combo), NULL);
g_return_val_if_fail (book, NULL);
g_return_val_if_fail (acct_types, NULL);
/* Figure out if anything is set in the combo */
text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(combo)))));
g_object_set_data (G_OBJECT(combo), "book", book);
list = gnc_account_get_descendants (gnc_book_get_root_account (book));
@ -357,11 +358,12 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
}
name = gnc_account_get_full_name (account);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
gtk_list_store_append(store, &iter);
gtk_list_store_set (store, &iter, 0, name, -1);
/* Save the first account name in case no account name was set */
if (!text || g_strcmp0 (text, "") == 0)
{
g_free (text); /* This is ok, even if text is already NULL */
text = g_strdup (name);
}
g_free(name);
@ -370,10 +372,7 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
g_list_free (list);
gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(combo), text);
if (text)
g_free (text);
gnc_cbwe_set_by_string(GTK_COMBO_BOX(combo), text);
return gnc_account_select_combo_get_active (combo);
}
@ -381,17 +380,18 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
Account *
gnc_account_select_combo_get_active (GtkWidget *combo)
{
gchar *text;
const gchar *text;
QofBook *book;
if (!combo || !GTK_IS_COMBO_BOX_ENTRY(combo))
if (!combo || !GTK_IS_COMBO_BOX(combo))
return NULL;
book = g_object_get_data (G_OBJECT(combo), "book");
if (!book)
return NULL;
text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
text = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(combo)))));
if (!text || g_strcmp0 (text, "") == 0)
return NULL;

View File

@ -103,7 +103,7 @@ void gnc_ui_payment_window_set_postaccount (PaymentWindow *pw, const Account* ac
g_assert(account);
{
gchar *acct_string = gnc_account_get_full_name (account);
gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(pw->post_combo), acct_string);
gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
g_free(acct_string);
}
}
@ -752,8 +752,8 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
pw->post_combo = GTK_WIDGET (gtk_builder_get_object (builder, "post_combo"));
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( pw->post_combo ), 0 );
gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pw->post_combo));
gtk_combo_box_set_entry_text_column( GTK_COMBO_BOX( pw->post_combo ), 0 );
gnc_cbwe_require_list_item(GTK_COMBO_BOX(pw->post_combo));
label = GTK_WIDGET (gtk_builder_get_object (builder, "owner_label"));
box = GTK_WIDGET (gtk_builder_get_object (builder, "owner_box"));
@ -792,7 +792,7 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
if (postacct)
{
gchar *acct_string = gnc_account_get_full_name (postacct);
gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(pw->post_combo), acct_string);
gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
gnc_payment_dialog_post_to_changed(pw);
g_free(acct_string);
}
@ -837,7 +837,8 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
const gchar *text;
const char *acct_type;
text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(pw->post_combo)))));
if (!text || safe_strcmp (text, "") == 0)
{

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.20"/>
<requires lib="gtk+" version="2.24"/>
<object class="GtkDialog" id="Payment Dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -75,11 +75,19 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkComboBoxEntry" id="post_combo">
<object class="GtkComboBox" id="post_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">post_combo_model</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="gnc_payment_dialog_post_to_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry">
<property name="can_focus">False</property>
<property name="overwrite_mode">True</property>
</object>
</child>
</object>
</child>
</object>
@ -485,6 +493,7 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
<child>
<object class="GtkButton" id="cancelbutton">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -502,6 +511,7 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
<child>
<object class="GtkButton" id="okbutton">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -551,22 +561,6 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
<!-- column-name doc_lot -->
<column type="gpointer"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">01-01-2011</col>
<col id="1" translatable="yes">35006</col>
<col id="2" translatable="yes">Invoice</col>
<col id="3" translatable="yes">100,00 €</col>
<col id="4" translatable="yes"></col>
</row>
<row>
<col id="0" translatable="yes">05-10-2011</col>
<col id="1" translatable="yes">Test-VS3</col>
<col id="2" translatable="yes">Credit Note</col>
<col id="3" translatable="yes"></col>
<col id="4" translatable="yes">50,00 €</col>
</row>
</data>
</object>
<object class="GtkAdjustment" id="docs_list_vert_adj">
<property name="upper">100</property>

View File

@ -626,22 +626,21 @@ gxi_update_progress_bar (const gchar *message, double percentage)
static void
gxi_update_default_enc_combo (GncXmlImportData *data)
{
GtkComboBox *combo;
GtkComboBoxText *combo;
GList *enc_iter;
/* add encodings list */
if (data->default_encoding_combo)
gtk_widget_destroy (data->default_encoding_combo);
data->default_encoding_combo = gtk_combo_box_new_text ();
combo = GTK_COMBO_BOX (data->default_encoding_combo);
data->default_encoding_combo = gtk_combo_box_text_new();
combo = GTK_COMBO_BOX_TEXT (data->default_encoding_combo);
for (enc_iter = data->encodings; enc_iter; enc_iter = enc_iter->next)
{
gtk_combo_box_append_text (
gtk_combo_box_text_append_text (
combo, g_quark_to_string (GPOINTER_TO_UINT (enc_iter->data)));
}
gtk_combo_box_set_active (
combo,
gtk_combo_box_set_active (GTK_COMBO_BOX(combo),
g_list_index (data->encodings, GUINT_TO_POINTER (data->default_encoding)));
/* show encodings */

View File

@ -112,9 +112,9 @@ gnc_ui_select_commodity_create(const gnc_commodity * orig_sel,
dialog_commodity_mode mode);
void gnc_ui_select_commodity_new_cb(GtkButton * button,
gpointer user_data);
void gnc_ui_select_commodity_changed_cb(GtkComboBoxEntry *cbe,
void gnc_ui_select_commodity_changed_cb(GtkComboBox *cbwe,
gpointer user_data);
void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBoxEntry *cbe,
void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBox *cbwe,
gpointer user_data);
/* The commodity creation window */
@ -249,55 +249,21 @@ gnc_ui_select_commodity_create(const gnc_commodity * orig_sel,
GtkWidget *button, *label;
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "liststore1");
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "liststore2");
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "Security Selector Dialog");
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, retval);
retval->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Security Selector Dialog"));
retval->namespace_combo = GTK_WIDGET(gtk_builder_get_object (builder, "ss_namespace_cbe"));
retval->commodity_combo = GTK_WIDGET(gtk_builder_get_object (builder, "ss_commodity_cbe"));
retval->namespace_combo = GTK_WIDGET(gtk_builder_get_object (builder, "ss_namespace_cbwe"));
retval->commodity_combo = GTK_WIDGET(gtk_builder_get_object (builder, "ss_commodity_cbwe"));
retval->select_user_prompt = GTK_WIDGET(gtk_builder_get_object (builder, "select_user_prompt"));
retval->ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ss_ok_button"));
label = GTK_WIDGET(gtk_builder_get_object (builder, "item_label"));
/* namespace List Store - create here as we get an error if created in builder */
{
GtkListStore *store;
GtkTreeIter iter;
gchar string[] = "Dummy namespace Line";
store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0, string, -1 );
gtk_combo_box_set_model( GTK_COMBO_BOX( retval->namespace_combo ),
GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( retval->namespace_combo ), 0 );
}
/* commodity List Store - create here as we get an error if created in builder */
{
GtkListStore *store;
GtkTreeIter iter;
gchar string[] = "Dummy commodity Line";
store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0, string, -1 );
gtk_combo_box_set_model( GTK_COMBO_BOX( retval->commodity_combo ),
GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( retval->commodity_combo ), 0 );
}
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));
gnc_cbwe_require_list_item(GTK_COMBO_BOX(retval->namespace_combo));
gnc_cbwe_require_list_item(GTK_COMBO_BOX(retval->commodity_combo));
gtk_label_set_text (GTK_LABEL (retval->select_user_prompt), "");
@ -395,27 +361,28 @@ gnc_ui_select_commodity_new_cb(GtkButton * button,
* Commodity Selection dialog. It should not be used outside of the
* dialog-commodity.c file.
*
* @param cbe A pointer to the commodity name entry widget in the
* @param cbwe 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 (GtkComboBoxEntry *cbe,
gnc_ui_select_commodity_changed_cb (GtkComboBox *cbwe,
gpointer user_data)
{
SelectCommodityWindow * w = user_data;
gchar *namespace, *fullname;
gchar *namespace;
const gchar *fullname;
gboolean ok;
ENTER("cbe=%p, user_data=%p", cbe, user_data);
ENTER("cbwe=%p, user_data=%p", cbwe, user_data);
namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
fullname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(w->commodity_combo));
fullname = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (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);
@ -435,20 +402,20 @@ gnc_ui_select_commodity_changed_cb (GtkComboBoxEntry *cbe,
* Commodity Selection dialog. It should not be used outside of the
* dialog-commodity.c file.
*
* @param cbe A pointer to the commodity namespace entry widget in
* @param cbwe 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 (GtkComboBoxEntry *cbe,
gnc_ui_select_commodity_namespace_changed_cb (GtkComboBox *cbwe,
gpointer user_data)
{
SelectCommodityWindow * w = user_data;
gchar *namespace;
ENTER("cbe=%p, user_data=%p", cbe, user_data);
ENTER("cbwe=%p, user_data=%p", cbwe, 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);
@ -472,7 +439,7 @@ collate(gconstpointer a, gconstpointer b)
void
gnc_ui_update_commodity_picker (GtkWidget *cbe,
gnc_ui_update_commodity_picker (GtkWidget *cbwe,
const gchar * namespace,
const gchar * init_string)
{
@ -482,15 +449,16 @@ gnc_ui_update_commodity_picker (GtkWidget *cbe,
GtkComboBox *combo_box;
GtkEntry *entry;
GtkTreeModel *model;
GtkTreeIter iter;
gnc_commodity_table *table;
gint current = 0, match = 0;
gchar *name;
g_return_if_fail(GTK_IS_COMBO_BOX_ENTRY(cbe));
g_return_if_fail(GTK_IS_COMBO_BOX(cbwe));
g_return_if_fail(namespace);
/* Erase the old entries */
combo_box = GTK_COMBO_BOX(cbe);
combo_box = GTK_COMBO_BOX(cbwe);
model = gtk_combo_box_get_model(combo_box);
gtk_list_store_clear(GTK_LIST_STORE(model));
@ -514,7 +482,9 @@ gnc_ui_update_commodity_picker (GtkWidget *cbe,
for (iterator = commodity_items; iterator; iterator = iterator->next)
{
name = (char *)iterator->data;
gtk_combo_box_append_text(combo_box, name);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, name, -1);
if (init_string && g_utf8_collate(name, init_string) == 0)
match = current;
current++;
@ -663,19 +633,20 @@ gnc_ui_update_fq_info (CommodityWindow *cw)
* gnc_ui_update_namespace_picker
********************************************************************/
void
gnc_ui_update_namespace_picker (GtkWidget *cbe,
gnc_ui_update_namespace_picker (GtkWidget *cbwe,
const char * init_string,
dialog_commodity_mode mode)
{
GtkComboBox *combo_box;
GtkTreeModel *model;
GtkTreeIter iter;
GList *namespaces, *node;
gint current = 0, match = 0;
g_return_if_fail(GTK_IS_COMBO_BOX_ENTRY (cbe));
g_return_if_fail(GTK_IS_COMBO_BOX (cbwe));
/* Erase the old entries */
combo_box = GTK_COMBO_BOX(cbe);
combo_box = GTK_COMBO_BOX(cbwe);
model = gtk_combo_box_get_model(combo_box);
gtk_list_store_clear(GTK_LIST_STORE(model));
gtk_combo_box_set_active(combo_box, -1);
@ -708,7 +679,7 @@ gnc_ui_update_namespace_picker (GtkWidget *cbe,
break;
}
/* stick them in the combobox */
/* add them to the combobox */
namespaces = g_list_sort(namespaces, collate);
for (node = namespaces; node; node = node->next)
{
@ -716,7 +687,11 @@ gnc_ui_update_namespace_picker (GtkWidget *cbe,
continue;
/* Hide the template entry */
if (g_utf8_collate(node->data, "template" ) != 0)
gtk_combo_box_append_text(combo_box, node->data);
{
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, node->data, -1);
}
if (init_string && (g_utf8_collate(node->data, init_string) == 0))
match = current;
current++;
@ -728,22 +703,21 @@ gnc_ui_update_namespace_picker (GtkWidget *cbe,
gchar *
gnc_ui_namespace_picker_ns (GtkWidget *cbe)
gnc_ui_namespace_picker_ns (GtkWidget *cbwe)
{
gchar *namespace;
const gchar *namespace;
g_return_val_if_fail(GTK_IS_COMBO_BOX_ENTRY (cbe), NULL);
g_return_val_if_fail(GTK_IS_COMBO_BOX (cbwe), NULL);
namespace = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cbe));
namespace = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(cbwe)))));
if (safe_strcmp (namespace, GNC_COMMODITY_NS_ISO) == 0)
{
/* In case the user types in ISO4217, map it to CURRENCY. */
g_free(namespace);
return g_strdup(GNC_COMMODITY_NS_CURRENCY);
}
else
return namespace;
return g_strdup(namespace);
}
@ -755,15 +729,16 @@ gnc_ui_commodity_quote_info_cb (GtkWidget *w, gpointer data)
{
CommodityWindow *cw = data;
gboolean get_quote, allow_src, active;
gchar *text;
const gchar *text;
gint i;
ENTER(" ");
get_quote = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cw->namespace_combo));
text = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( 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++)
@ -929,11 +904,11 @@ gnc_ui_quote_tz_menu_create(void)
order to be portable to non GNU OSes, we may have to support
whatever we add here manually on those systems. */
combo = gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Use local time"));
combo = gtk_combo_box_text_new();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Use local time"));
for (itemstr = &known_timezones[0]; *itemstr; itemstr++)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), *itemstr);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), *itemstr);
}
gtk_widget_show(combo);
@ -967,6 +942,7 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
parent, selected_namespace, fullname, mnemonic);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "liststore2");
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "adjustment1");
gnc_builder_add_from_file (builder, "dialog-commodity.glade", "Security Dialog");
@ -993,10 +969,9 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
/* Get widget pointers */
retval->fullname_entry = GTK_WIDGET(gtk_builder_get_object (builder, "fullname_entry"));
retval->mnemonic_entry = GTK_WIDGET(gtk_builder_get_object (builder, "mnemonic_entry"));
retval->namespace_combo = GTK_WIDGET(gtk_builder_get_object (builder, "namespace_cbe"));
retval->namespace_combo = GTK_WIDGET(gtk_builder_get_object (builder, "namespace_cbwe"));
retval->code_entry = GTK_WIDGET(gtk_builder_get_object (builder, "code_entry"));
retval->fraction_spinbutton = GTK_WIDGET(gtk_builder_get_object (builder,
"fraction_spinbutton"));
retval->fraction_spinbutton = GTK_WIDGET(gtk_builder_get_object (builder, "fraction_spinbutton"));
retval->ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
retval->get_quote_check = GTK_WIDGET(gtk_builder_get_object (builder, "get_quote_check"));
retval->source_label = GTK_WIDGET(gtk_builder_get_object (builder, "source_label"));
@ -1004,23 +979,6 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
retval->source_button[SOURCE_MULTI] = GTK_WIDGET(gtk_builder_get_object (builder, "multi_source_button"));
retval->quote_tz_label = GTK_WIDGET(gtk_builder_get_object (builder, "quote_tz_label"));
/* namespace List Store - create here as we get an error if created in builder */
{
GtkListStore *store;
GtkTreeIter iter;
gchar string[] = "Dummy namespace Line";
store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0, string, -1 );
gtk_combo_box_set_model( GTK_COMBO_BOX( retval->namespace_combo ),
GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( retval->namespace_combo ), 0 );
}
/* Build custom widgets */
box = GTK_WIDGET(gtk_builder_get_object (builder, "single_source_box"));
if (gnc_commodity_namespace_is_iso(selected_namespace))
@ -1108,8 +1066,7 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
/* Fill in any data, top to bottom */
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_cbwe_add_completion(GTK_COMBO_BOX(retval->namespace_combo));
gnc_ui_update_namespace_picker(retval->namespace_combo,
selected_namespace,
include_iso ? DIAG_COMM_ALL : DIAG_COMM_NON_CURRENCY);

View File

@ -212,7 +212,7 @@ gnc_ui_edit_commodity_modal(gnc_commodity *commodity,
/** Given a combo box, fill in the known commodity namespaces and then
* select one.
*
* @param cbe The widget to populate with information.
* @param cbwe The widget to populate with information.
*
* @param sel The namespace that should be initially selected when
* the combo box appears.
@ -224,25 +224,25 @@ gnc_ui_edit_commodity_modal(gnc_commodity *commodity,
*
* @note The returned string must be freed by the caller.
*/
void gnc_ui_update_namespace_picker(GtkWidget *cbe,
void gnc_ui_update_namespace_picker(GtkWidget *cbwe,
const gchar *sel,
dialog_commodity_mode mode);
/** Given a combo box, return the currently selected namespaces.
*
* @param cbe The combo box of namespaces.
* @param cbwe 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.
*/
gchar *gnc_ui_namespace_picker_ns (GtkWidget *cbe);
gchar *gnc_ui_namespace_picker_ns (GtkWidget *cbwe);
/** Given a combo box, fill in all the known commodities for the
* specified namespace, and then select one.
*
* @param cbe The widget to populate with information.
* @param cbwe The widget to populate with information.
*
* @param namespace All commodities with this namespace will be added
* to the combo box.
@ -250,7 +250,7 @@ gchar *gnc_ui_namespace_picker_ns (GtkWidget *cbe);
* @param sel The commodity that should be initially selected when
* the combo box appears.
*/
void gnc_ui_update_commodity_picker(GtkWidget *cbe,
void gnc_ui_update_commodity_picker(GtkWidget *cbwe,
const gchar *namespace,
const gchar *sel);
/** @} */

View File

@ -49,23 +49,23 @@ typedef struct FileAccessWindow
/* Parts of the dialog */
int type;
GtkWidget* dialog;
GtkWidget* frame_file;
GtkWidget* frame_database;
GtkWidget* readonly_checkbutton;
GtkFileChooser* fileChooser;
gchar *starting_dir;
GtkComboBox* cb_uri_type;
GtkEntry* tf_host;
GtkEntry* tf_database;
GtkEntry* tf_username;
GtkEntry* tf_password;
GtkWidget *dialog;
GtkWidget *frame_file;
GtkWidget *frame_database;
GtkWidget *readonly_checkbutton;
GtkFileChooser *fileChooser;
gchar *starting_dir;
GtkComboBoxText *cb_uri_type;
GtkEntry *tf_host;
GtkEntry *tf_database;
GtkEntry *tf_username;
GtkEntry *tf_password;
} FileAccessWindow;
void gnc_ui_file_access_file_activated_cb( GtkFileChooser *chooser,
FileAccessWindow *faw );
void gnc_ui_file_access_response_cb( GtkDialog *, gint, GtkDialog * );
static void cb_uri_type_changed_cb( GtkComboBox* cb );
static void cb_uri_type_changed_cb( GtkComboBoxText* cb );
static gchar*
geturl( FileAccessWindow* faw )
@ -85,7 +85,7 @@ geturl( FileAccessWindow* faw )
password = gtk_entry_get_text( faw->tf_password );
file = gtk_file_chooser_get_filename( faw->fileChooser );
type = gtk_combo_box_get_active_text( faw->cb_uri_type );
type = gtk_combo_box_text_get_active_text(faw->cb_uri_type );
if ( gnc_uri_is_file_protocol( type ) )
{
if ( file == NULL ) /* file protocol was chosen but no filename was set */
@ -208,7 +208,7 @@ set_widget_sensitivity_for_uri_type( FileAccessWindow* faw, const gchar* uri_typ
}
static void
cb_uri_type_changed_cb( GtkComboBox* cb )
cb_uri_type_changed_cb( GtkComboBoxText* cb )
{
GtkWidget* dialog;
FileAccessWindow* faw;
@ -221,7 +221,7 @@ cb_uri_type_changed_cb( GtkComboBox* cb )
faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" );
g_return_if_fail( faw != NULL );
type = gtk_combo_box_get_active_text( cb );
type = gtk_combo_box_text_get_active_text( cb );
set_widget_sensitivity_for_uri_type( faw, type );
}
@ -348,7 +348,7 @@ gnc_ui_file_access( int type )
gnc_ui_file_access_file_activated_cb, faw, NULL );
uri_type_container = GTK_WIDGET(gtk_builder_get_object (builder, "vb_uri_type_container" ));
faw->cb_uri_type = GTK_COMBO_BOX(gtk_combo_box_new_text());
faw->cb_uri_type = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new());
gtk_container_add( GTK_CONTAINER(uri_type_container), GTK_WIDGET(faw->cb_uri_type) );
gtk_box_set_child_packing( GTK_BOX(uri_type_container), GTK_WIDGET(faw->cb_uri_type),
/*expand*/TRUE, /*fill*/FALSE, /*padding*/0, GTK_PACK_START );
@ -406,27 +406,27 @@ gnc_ui_file_access( int type )
access_method_index = -1;
if ( need_access_method_file )
{
gtk_combo_box_append_text( faw->cb_uri_type, "file" );
gtk_combo_box_text_append_text( faw->cb_uri_type, "file" );
active_access_method_index = ++access_method_index;
}
if ( need_access_method_mysql )
{
gtk_combo_box_append_text( faw->cb_uri_type, "mysql" );
gtk_combo_box_text_append_text( faw->cb_uri_type, "mysql" );
++access_method_index;
}
if ( need_access_method_postgres )
{
gtk_combo_box_append_text( faw->cb_uri_type, "postgres" );
gtk_combo_box_text_append_text( faw->cb_uri_type, "postgres" );
++access_method_index;
}
if ( need_access_method_sqlite3 )
{
gtk_combo_box_append_text( faw->cb_uri_type, "sqlite3" );
gtk_combo_box_text_append_text( faw->cb_uri_type, "sqlite3" );
active_access_method_index = ++access_method_index;
}
if ( need_access_method_xml )
{
gtk_combo_box_append_text( faw->cb_uri_type, "xml" );
gtk_combo_box_text_append_text( faw->cb_uri_type, "xml" );
++access_method_index;
// Set XML as default if it is offered (which mean we are in
@ -442,8 +442,8 @@ gnc_ui_file_access( int type )
/* Hide the frame that's not required for the active access method so either only
* the File or only the Database frame are presented. */
gtk_combo_box_set_active( faw->cb_uri_type, active_access_method_index );
set_widget_sensitivity_for_uri_type( faw, gtk_combo_box_get_active_text( faw->cb_uri_type ) );
gtk_combo_box_set_active(GTK_COMBO_BOX(faw->cb_uri_type), active_access_method_index );
set_widget_sensitivity_for_uri_type( faw, gtk_combo_box_text_get_active_text( faw->cb_uri_type ));
}
void

View File

@ -538,11 +538,11 @@ gnc_option_create_date_widget (GNCOption *option)
* see http://bugzilla.gnome.org/show_bug.cgi?id=303717 , see
* also gnc_option_create_multichoice_widget() below. */
char *string;
rel_widget = gtk_combo_box_new_text();
rel_widget = gtk_combo_box_text_new();
for (i = 0; i < num_values; i++)
{
string = gnc_option_permissible_value_name(option, i);
gtk_combo_box_append_text(GTK_COMBO_BOX(rel_widget), string);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(rel_widget), string);
g_free(string);
}
@ -712,12 +712,12 @@ gnc_option_create_multichoice_widget(GNCOption *option)
see http://bugzilla.gnome.org/show_bug.cgi?id=303717 */
char *itemstring;
/* char *description; */
widget = gtk_combo_box_new_text();
widget = gtk_combo_box_text_new();
for (i = 0; i < num_values; i++)
{
itemstring = gnc_option_permissible_value_name(option, i);
/* description = gnc_option_permissible_value_description(option, i); */
gtk_combo_box_append_text(GTK_COMBO_BOX(widget),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget),
(itemstring && *itemstring) ? _(itemstring) : "");
/*, (description && *description) ? _(description) : "" */
/* Maybe the per-item tooltip will simply be added as such an

View File

@ -155,18 +155,16 @@ gnc_account_sel_init (GNCAccountSel *gas)
g_object_set(gas, "spacing", 2, (gchar*)NULL);
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));
widget = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(gas->store));
gas->combo = GTK_COMBO_BOX(widget);
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(widget), ACCT_COL_NAME);
g_object_unref(gas->store);
g_signal_connect_swapped(gas->combo, "changed",
G_CALLBACK(combo_changed_cb), gas);
gtk_container_add( GTK_CONTAINER(gas), widget );
/* Add completion. */
gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(widget));
gnc_cbwe_require_list_item(GTK_COMBO_BOX(widget));
/* Get the accounts, place into combo list */
gas_populate_list( gas );

View File

@ -44,7 +44,7 @@ typedef struct
gboolean initDone;
gboolean isModal;
GtkListStore *store;
GtkComboBoxEntry *combo;
GtkComboBox *combo;
GList *acctTypeFilters;
GList *acctCommodityFilters;
gint eventHandlerId;

View File

@ -107,7 +107,7 @@ gnc_currency_edit_get_type (void)
NULL
};
currency_edit_type = g_type_register_static (GTK_TYPE_COMBO_BOX_ENTRY,
currency_edit_type = g_type_register_static (GTK_TYPE_COMBO_BOX,
"GNCCurrencyEdit",
&currency_edit_info, 0);
}
@ -157,10 +157,17 @@ gnc_currency_edit_init (GNCCurrencyEdit *gce)
static void
add_item(gnc_commodity *commodity, GNCCurrencyEdit *gce)
{
GtkTreeModel *model;
GtkTreeIter iter;
const char *string;
model = gtk_combo_box_get_model(GTK_COMBO_BOX(gce));
string = gnc_commodity_get_printname(commodity);
gtk_combo_box_append_text(GTK_COMBO_BOX(gce), string);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, string, -1);
}
@ -198,13 +205,16 @@ gnc_currency_edit_new (void)
store = gtk_list_store_new (1, G_TYPE_STRING);
gce = g_object_new (GNC_TYPE_CURRENCY_EDIT,
"model", store,
"text-column", 0,
"has-entry", TRUE,
NULL);
g_object_unref (store);
/* Set the column for the text */
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX(gce), 0);
/* Now the signals to make sure the user can't leave the
widget without a valid currency. */
gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(gce));
gnc_cbwe_require_list_item(GTK_COMBO_BOX(gce));
/* Fill in all the data. */
fill_currencies (gce);
@ -237,7 +247,7 @@ gnc_currency_edit_set_currency (GNCCurrencyEdit *gce,
g_return_if_fail(currency != NULL);
printname = gnc_commodity_get_printname(currency);
gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(gce), printname);
gnc_cbwe_set_by_string(GTK_COMBO_BOX(gce), printname);
}

View File

@ -67,12 +67,12 @@
typedef struct
{
GtkComboBoxEntry combobox;
GtkComboBox combobox;
} GNCCurrencyEdit;
typedef struct
{
GtkComboBoxEntryClass combobox;
GtkComboBoxClass combobox;
} GNCCurrencyEditClass;
/** Return the GType for the GNCCurrencyEdit currency selection widget.

View File

@ -70,7 +70,7 @@ static GtkHBoxClass *parent_class;
/**
* gnc_date_delta_get_type:
*
* Returns the GtkType for the GNCDateDelta widget
* Returns the GType for the GNCDateDelta widget
*/
GType
gnc_date_delta_get_type (void)
@ -212,13 +212,13 @@ set_units (GtkComboBox *combo, GNCDateDelta *gdd)
static void
fill_units_combo(GNCDateDelta *gdd)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
_("Days"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
_("Weeks"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
_("Months"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->units_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
_("Years"));
g_signal_connect (gdd->units_combo, "changed",
@ -242,9 +242,9 @@ set_polarity (GtkComboBox *combo, GNCDateDelta *gdd)
static void
fill_polarity_combo(GNCDateDelta *gdd)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->polarity_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->polarity_combo),
_("Ago"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gdd->polarity_combo),
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->polarity_combo),
_("From Now"));
g_signal_connect (gdd->polarity_combo, "changed",
@ -265,13 +265,13 @@ create_children (GNCDateDelta *gdd)
g_signal_connect(gdd->value_spin, "changed",
G_CALLBACK(value_changed), gdd);
gdd->units_combo = gtk_combo_box_new_text();
gdd->units_combo = gtk_combo_box_text_new();
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_combo = gtk_combo_box_new_text();
gdd->polarity_combo = gtk_combo_box_text_new();
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);

View File

@ -29,16 +29,16 @@
#define CHANGED_ID "changed_id"
/** Find an entry in the GtkComboBoxEntry by its text value, and set
/** Find an entry in the GtkComboBox 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 cbwe A pointer to a GtkComboBox with entry widget.
*
* @param text The entry text to find in the model of the combo box
* entry. */
void
gnc_cbe_set_by_string(GtkComboBoxEntry *cbe,
gnc_cbwe_set_by_string(GtkComboBox *cbwe,
const gchar *text)
{
GtkTreeModel *model;
@ -47,15 +47,15 @@ gnc_cbe_set_by_string(GtkComboBoxEntry *cbe,
gint column, index, id;
gboolean match;
model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbe));
model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbwe));
if (!gtk_tree_model_get_iter_first(model, &iter))
{
/* empty tree */
gtk_combo_box_set_active(GTK_COMBO_BOX(cbe), -1);
gtk_combo_box_set_active(GTK_COMBO_BOX(cbwe), -1);
return;
}
column = gtk_combo_box_entry_get_text_column(cbe);
column = gtk_combo_box_get_entry_text_column(cbwe);
do
{
gtk_tree_model_get(model, &iter, column, &tree_string, -1);
@ -65,36 +65,36 @@ gnc_cbe_set_by_string(GtkComboBoxEntry *cbe,
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);
id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cbwe), CHANGED_ID));
g_signal_handler_block(cbwe, id);
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(cbwe), &iter);
g_signal_handler_unblock(cbwe, id);
index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbe));
g_object_set_data(G_OBJECT(cbe), LAST_INDEX, GINT_TO_POINTER(index));
index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbwe));
g_object_set_data(G_OBJECT(cbwe), 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
/** The GtkComboBox with entry 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. */
* @param cbwe A pointer to a GtkComboBox widget. */
static void
gnc_cbe_changed_cb (GtkComboBox *widget,
GtkComboBoxEntry *cbe)
gnc_cbwe_changed_cb (GtkComboBox *widget,
GtkComboBox *cbwe)
{
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));
g_object_set_data(G_OBJECT(cbwe), LAST_INDEX, GINT_TO_POINTER(index));
}
@ -113,19 +113,19 @@ gnc_cbe_changed_cb (GtkComboBox *widget,
* @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. */
* @param cbwe A pointer to a currency entry widget. */
static gboolean
gnc_cbe_match_selected_cb (GtkEntryCompletion *completion,
GtkTreeModel *comp_model,
GtkTreeIter *comp_iter,
GtkComboBoxEntry *cbe)
gnc_cbwe_match_selected_cb (GtkEntryCompletion *completion,
GtkTreeModel *comp_model,
GtkTreeIter *comp_iter,
GtkComboBox *cbwe)
{
gint column;
gchar *text;
column = gtk_combo_box_entry_get_text_column(cbe);
column = gtk_combo_box_get_entry_text_column(cbwe);
gtk_tree_model_get(comp_model, comp_iter, column, &text, -1);
gnc_cbe_set_by_string(cbe, text);
gnc_cbwe_set_by_string(cbwe, text);
g_free(text);
return FALSE;
}
@ -142,40 +142,40 @@ gnc_cbe_match_selected_cb (GtkEntryCompletion *completion,
*
* @param event Unused.
*
* @param cbe A pointer to a currency entry widget. */
* @param cbwe A pointer to a currency entry widget. */
static gboolean
gnc_cbe_focus_out_cb (GtkEntry *entry,
GdkEventFocus *event,
GtkComboBoxEntry *cbe)
gnc_cbwe_focus_out_cb (GtkEntry *entry,
GdkEventFocus *event,
GtkComboBox *cbwe)
{
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);
gnc_cbwe_set_by_string(cbwe, 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);
index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cbwe), LAST_INDEX));
gtk_combo_box_set_active(GTK_COMBO_BOX(cbwe), index);
return FALSE;
}
void
gnc_cbe_add_completion (GtkComboBoxEntry *cbe)
gnc_cbwe_add_completion (GtkComboBox *cbwe)
{
GtkEntry *entry;
GtkEntryCompletion *completion;
GtkTreeModel *model;
entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbe)));
entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbwe)));
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));
model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbwe));
gtk_entry_completion_set_model(completion, model);
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
@ -184,7 +184,7 @@ gnc_cbe_add_completion (GtkComboBoxEntry *cbe)
}
void
gnc_cbe_require_list_item (GtkComboBoxEntry *cbe)
gnc_cbwe_require_list_item (GtkComboBox *cbwe)
{
GtkEntry *entry;
GtkEntryCompletion *completion;
@ -193,33 +193,33 @@ gnc_cbe_require_list_item (GtkComboBoxEntry *cbe)
gint index, id;
/* Ensure completion is set up. */
gnc_cbe_add_completion(cbe);
gnc_cbwe_add_completion(cbwe);
/* 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)));
entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cbwe)));
completion = gtk_entry_get_completion(entry);
index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbe));
index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbwe));
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);
gtk_combo_box_set_active(GTK_COMBO_BOX(cbwe), 0);
index = 0;
}
}
g_object_set_data(G_OBJECT(cbe), LAST_INDEX, GINT_TO_POINTER(index));
g_object_set_data(G_OBJECT(cbwe), LAST_INDEX, GINT_TO_POINTER(index));
/* Now the signals to make sure the user can't leave the
widget without a valid match. */
id = g_signal_connect(cbe, "changed",
G_CALLBACK(gnc_cbe_changed_cb), cbe);
id = g_signal_connect(cbwe, "changed",
G_CALLBACK(gnc_cbwe_changed_cb), cbwe);
g_signal_connect(completion, "match_selected",
G_CALLBACK(gnc_cbe_match_selected_cb), cbe);
G_CALLBACK(gnc_cbwe_match_selected_cb), cbwe);
g_signal_connect(entry, "focus-out-event",
G_CALLBACK(gnc_cbe_focus_out_cb), cbe);
G_CALLBACK(gnc_cbwe_focus_out_cb), cbwe);
g_object_set_data(G_OBJECT(cbe), CHANGED_ID, GINT_TO_POINTER(id));
g_object_set_data(G_OBJECT(cbwe), CHANGED_ID, GINT_TO_POINTER(id));
}

View File

@ -1,5 +1,5 @@
/********************************************************************\
* gnc-gtk-utils.c -- utility functions based on glib functions *
* gnc-gtk-utils.h -- utility functions based on glib functions *
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
* *
* This program is free software; you can redistribute it and/or *
@ -41,9 +41,9 @@
@{
*/
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);
void gnc_cbwe_set_by_string(GtkComboBox *cbwe, const gchar *text);
void gnc_cbwe_add_completion (GtkComboBox *cbwe);
void gnc_cbwe_require_list_item (GtkComboBox *cbwe);
/** @} */

View File

@ -256,14 +256,14 @@ gnc_period_select_set_fy_end (GncPeriodSelect *period, const GDate *fy_end)
for (i = GNC_ACCOUNTING_PERIOD_CYEAR_LAST; i < GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i++)
{
label = priv->start ? _(start_strings[i]) : _(end_strings[i]);
gtk_combo_box_append_text(GTK_COMBO_BOX(priv->selector), label);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->selector), label);
}
}
else
{
for (i = GNC_ACCOUNTING_PERIOD_FYEAR_LAST - 1; i >= GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i--)
{
gtk_combo_box_remove_text(GTK_COMBO_BOX(priv->selector), i);
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(priv->selector), i);
}
}
}
@ -286,7 +286,7 @@ gnc_period_select_set_date_common (GncPeriodSelect *period, const GDate *date)
{
priv->date_align = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_alignment_set_padding(GTK_ALIGNMENT(priv->date_align), 0, 0, 6, 0);
gtk_box_pack_start_defaults(GTK_BOX(period), priv->date_align);
gtk_box_pack_start(GTK_BOX(period), priv->date_align, TRUE, TRUE, 0);
priv->date_label = gtk_label_new("");
gtk_container_add(GTK_CONTAINER(priv->date_align), priv->date_label);
gtk_widget_show_all(priv->date_align);
@ -619,11 +619,11 @@ gnc_period_select_new (gboolean starting_labels)
/* Set up private data structures */
priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
priv->selector = gtk_combo_box_new_text();
priv->selector = gtk_combo_box_text_new();
priv->start = starting_labels;
/* Add the internal widgets to the hbox */
gtk_box_pack_start_defaults(GTK_BOX(period), priv->selector);
gtk_box_pack_start(GTK_BOX(period), priv->selector, TRUE, TRUE, 0);
gtk_widget_show(priv->selector);
/* Find out when the combo box changes */
@ -634,7 +634,7 @@ gnc_period_select_new (gboolean starting_labels)
for (i = 0; i < GNC_ACCOUNTING_PERIOD_CYEAR_LAST; i++)
{
label = starting_labels ? _(start_strings[i]) : _(end_strings[i]);
gtk_combo_box_append_text(GTK_COMBO_BOX(priv->selector), label);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->selector), label);
}
/* Track changes to date formatting */

View File

@ -1,7 +1,218 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="Security Selector Dialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Select security/currency </property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ss_new_button">
<property name="label">gtk-new</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ss_cancel_button">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ss_ok_button">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="select_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="select_user_prompt">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select user information here...</property>
<property name="justify">center</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkLabel" id="label807">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
</object>
</child>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkLabel" id="item_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">_Security/currency:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
</object>
</child>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="ss_namespace_cbwe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore2</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="gnc_ui_select_commodity_namespace_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<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">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="ss_commodity_cbwe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore1</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="gnc_ui_select_commodity_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<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">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="1">ss_new_button</action-widget>
<action-widget response="-6">ss_cancel_button</action-widget>
<action-widget response="-5">ss_ok_button</action-widget>
</action-widgets>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100000000</property>
<property name="value">10000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkDialog" id="Security Dialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@ -9,18 +220,19 @@
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox6">
<object class="GtkBox" id="dialog-vbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area6">
<object class="GtkButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -38,6 +250,7 @@
<child>
<object class="GtkButton" id="ok_button">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -55,6 +268,7 @@
<child>
<object class="GtkButton" id="help_button">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -94,7 +308,7 @@
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -104,13 +318,11 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Enter the full name of the commodity. Example: Cisco Systems Inc., or Apple Computer, Inc.</property>
<property name="tooltip_text" translatable="yes">Enter the full name of the commodity. Example: Cisco Systems Inc., or Apple Computer, Inc.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="gnc_ui_commodity_changed_cb" swapped="no"/>
</object>
<packing>
@ -118,7 +330,7 @@
<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="y_options"/>
</packing>
</child>
<child>
@ -128,13 +340,11 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Enter the ticker symbol for the commodity (e.g. CSCO or AAPL). If you are retrieving quotes online, this field must exactly match the ticker symbol used by the quote source (including case). </property>
<property name="tooltip_text" translatable="yes">Enter the ticker symbol for the commodity (e.g. CSCO or AAPL). If you are retrieving quotes online, this field must exactly match the ticker symbol used by the quote source (including case). </property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="gnc_ui_commodity_changed_cb" swapped="no"/>
</object>
<packing>
@ -142,7 +352,7 @@
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -152,20 +362,18 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Enter a unique code used to identify the commodity. Or, you may safely leave this field blank.</property>
<property name="tooltip_text" translatable="yes">Enter a unique code used to identify the commodity. Or, you may safely leave this field blank.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
@ -193,12 +401,10 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Enter the smallest fraction of the commodity which can be traded. For stocks which can only be traded in whole numbers, enter 1.</property>
<property name="tooltip_text" translatable="yes">Enter the smallest fraction of the commodity which can be traded. For stocks which can only be traded in whole numbers, enter 1.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
</object>
@ -231,7 +437,7 @@
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -245,7 +451,7 @@
<packing>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -400,7 +606,6 @@
<property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">namespace_cbe</property>
</object>
</child>
</object>
@ -522,6 +727,7 @@
<child>
<object class="GtkCheckButton" id="get_quote_check">
<property name="label" translatable="yes">_Get Online Quotes</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -548,6 +754,7 @@
<child>
<object class="GtkRadioButton" id="single_source_button">
<property name="label" translatable="yes">Si_ngle:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -577,6 +784,7 @@
<child>
<object class="GtkRadioButton" id="multi_source_button">
<property name="label" translatable="yes">_Multiple:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -606,6 +814,7 @@
<child>
<object class="GtkRadioButton" id="unknown_source_button">
<property name="label" translatable="yes">_Unknown:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -651,17 +860,25 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="namespace_cbe">
<object class="GtkComboBox" id="namespace_cbwe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore2</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="gnc_ui_commodity_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry5">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<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">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -728,199 +945,26 @@
<action-widget response="-11">help_button</action-widget>
</action-widgets>
</object>
<object class="GtkDialog" id="Security Selector Dialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Select security/currency </property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ss_new_button">
<property name="label">gtk-new</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ss_cancel_button">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ss_ok_button">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="select_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="select_user_prompt">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select user information here...</property>
<property name="justify">center</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkLabel" id="label807">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">ss_namespace_cbe</property>
</object>
</child>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkLabel" id="item_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">_Security/currency:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">ss_commodity_cbe</property>
</object>
</child>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="ss_namespace_cbe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="gnc_ui_select_commodity_namespace_changed_cb" swapped="no"/>
</object>
<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">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="ss_commodity_cbe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="gnc_ui_select_commodity_changed_cb" swapped="no"/>
</object>
<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">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="1">ss_new_button</action-widget>
<action-widget response="-6">ss_cancel_button</action-widget>
<action-widget response="-5">ss_ok_button</action-widget>
</action-widgets>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name item -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Dummy commodity Line</col>
</row>
</data>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100000000</property>
<property name="value">10000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
<object class="GtkListStore" id="liststore2">
<columns>
<!-- column-name item -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Dummy namespace Line</col>
</row>
</data>
</object>
</interface>
</interface>

View File

@ -65,8 +65,8 @@ typedef struct
GNCPriceDB *price_db;
GNCPriceEditType type;
GtkWidget * namespace_cbe;
GtkWidget * commodity_cbe;
GtkWidget * namespace_cbwe;
GtkWidget * commodity_cbwe;
GtkWidget * currency_edit;
GtkWidget * date_edit;
GtkWidget * source_entry;
@ -83,11 +83,10 @@ typedef struct
} PriceEditDialog;
void pedit_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data);
void pedit_data_changed_cb (GtkWidget *w, gpointer data);
void pedit_commodity_ns_changed_cb (GtkComboBoxEntry *cbe, gpointer data);
void pedit_commodity_changed_cb (GtkComboBoxEntry *cbe, gpointer data);
void pedit_commodity_ns_changed_cb (GtkComboBox *cbwe, gpointer data);
void pedit_commodity_changed_cb (GtkComboBox *cbwe, gpointer data);
static void
@ -157,9 +156,9 @@ price_to_gui (PriceEditDialog *pedit_dialog)
{
namespace = gnc_commodity_get_namespace(commodity);
fullname = gnc_commodity_get_printname(commodity);
gnc_ui_update_namespace_picker(pedit_dialog->namespace_cbe,
gnc_ui_update_namespace_picker(pedit_dialog->namespace_cbwe,
namespace, DIAG_COMM_ALL);
gnc_ui_update_commodity_picker(pedit_dialog->commodity_cbe,
gnc_ui_update_commodity_picker(pedit_dialog->commodity_cbwe,
namespace, fullname);
currency = gnc_price_get_currency (pedit_dialog->price);
@ -201,14 +200,16 @@ gui_to_price (PriceEditDialog *pedit_dialog)
{
gnc_commodity *commodity;
gnc_commodity *currency;
gchar *namespace, *fullname;
gchar *namespace;
const gchar *fullname;
const char *source;
const char *type;
gnc_numeric value;
Timespec date;
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbe);
fullname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pedit_dialog->commodity_cbe));
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbwe);
fullname = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(pedit_dialog->commodity_cbwe)))));
commodity = gnc_commodity_table_find_full(gnc_get_current_commodities(), namespace, fullname);
if (!commodity)
return _("You must select a Security.");
@ -244,7 +245,6 @@ gui_to_price (PriceEditDialog *pedit_dialog)
gnc_price_commit_edit (pedit_dialog->price);
g_free(namespace);
g_free(fullname);
return NULL;
}
@ -312,33 +312,35 @@ pedit_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
void
pedit_commodity_ns_changed_cb (GtkComboBoxEntry *cbe, gpointer data)
pedit_commodity_ns_changed_cb (GtkComboBox *cbwe, gpointer data)
{
PriceEditDialog *pedit_dialog = data;
gchar *namespace;
gnc_prices_set_changed (pedit_dialog, TRUE);
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbe);
gnc_ui_update_commodity_picker (pedit_dialog->commodity_cbe, namespace, NULL);
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbwe);
gnc_ui_update_commodity_picker (pedit_dialog->commodity_cbwe, namespace, NULL);
g_free(namespace);
}
void
pedit_commodity_changed_cb (GtkComboBoxEntry *cbe, gpointer data)
pedit_commodity_changed_cb (GtkComboBox *cbwe, gpointer data)
{
gnc_commodity *commodity = NULL;
gnc_commodity *currency = NULL;
gchar *namespace, *fullname;
GList *price_list;
gnc_commodity *commodity = NULL;
gnc_commodity *currency = NULL;
gchar *namespace;
const gchar *fullname;
GList *price_list;
PriceEditDialog *pedit_dialog = data;
gnc_prices_set_changed (pedit_dialog, TRUE);
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbe);
fullname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pedit_dialog->commodity_cbe));
namespace = gnc_ui_namespace_picker_ns (pedit_dialog->namespace_cbwe);
fullname = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(pedit_dialog->commodity_cbwe)))));
commodity = gnc_commodity_table_find_full(gnc_get_current_commodities(), namespace, fullname);
if (commodity)
@ -363,7 +365,6 @@ pedit_commodity_changed_cb (GtkComboBoxEntry *cbe, gpointer data)
}
g_free(namespace);
g_free(fullname);
}
@ -388,11 +389,12 @@ gnc_price_pedit_dialog_create (GtkWidget *parent,
GtkWidget *box;
GtkWidget *w;
GtkWidget *label;
gchar *namespace;
gchar *namespace;
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-price.glade", "liststore1");
gnc_builder_add_from_file (builder, "dialog-price.glade", "liststore2");
gnc_builder_add_from_file (builder, "dialog-price.glade", "liststore3");
gnc_builder_add_from_file (builder, "dialog-price.glade", "Price Dialog");
pedit_dialog->session = session;
@ -406,55 +408,19 @@ gnc_price_pedit_dialog_create (GtkWidget *parent,
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
w = GTK_WIDGET(gtk_builder_get_object (builder, "namespace_cbe"));
pedit_dialog->namespace_cbe = w;
w = GTK_WIDGET(gtk_builder_get_object (builder, "namespace_cbwe"));
pedit_dialog->namespace_cbwe = w;
/* namespace List Store - create here as we get an error if created in builder */
{
GtkListStore *store;
GtkTreeIter iter;
gchar string[] = "Dummy namespace Line";
store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0, string, -1 );
gtk_combo_box_set_model( GTK_COMBO_BOX( pedit_dialog->namespace_cbe ),
GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( pedit_dialog->namespace_cbe ), 0 );
}
gtk_combo_box_remove_text(GTK_COMBO_BOX(pedit_dialog->namespace_cbe), 0);
gnc_ui_update_namespace_picker(w, NULL, DIAG_COMM_ALL);
gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pedit_dialog->namespace_cbe));
gtk_combo_box_set_active(GTK_COMBO_BOX(pedit_dialog->namespace_cbe), 1);
gnc_cbwe_require_list_item(GTK_COMBO_BOX(pedit_dialog->namespace_cbwe));
gtk_combo_box_set_active(GTK_COMBO_BOX(pedit_dialog->namespace_cbwe), 1);
w = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_cbe"));
pedit_dialog->commodity_cbe = w;
w = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_cbwe"));
pedit_dialog->commodity_cbwe = w;
/* commodity List Store - create here as we get an error if created in builder */
{
GtkListStore *store;
GtkTreeIter iter;
gchar string[] = "Dummy commodity Line";
store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0, string, -1 );
gtk_combo_box_set_model( GTK_COMBO_BOX( pedit_dialog->commodity_cbe ),
GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
gtk_combo_box_entry_set_text_column( GTK_COMBO_BOX_ENTRY( pedit_dialog->commodity_cbe ), 0 );
}
gtk_combo_box_remove_text(GTK_COMBO_BOX(pedit_dialog->commodity_cbe), 0);
gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pedit_dialog->commodity_cbe));
namespace = gnc_ui_namespace_picker_ns(pedit_dialog->namespace_cbe);
gnc_ui_update_commodity_picker(pedit_dialog->commodity_cbe, namespace, NULL);
gnc_cbwe_require_list_item(GTK_COMBO_BOX(pedit_dialog->commodity_cbwe));
namespace = gnc_ui_namespace_picker_ns(pedit_dialog->namespace_cbwe);
gnc_ui_update_commodity_picker(pedit_dialog->commodity_cbwe, namespace, NULL);
g_free(namespace);
box = GTK_WIDGET(gtk_builder_get_object (builder, "currency_box"));
@ -479,10 +445,9 @@ gnc_price_pedit_dialog_create (GtkWidget *parent,
g_signal_connect (G_OBJECT (GNC_DATE_EDIT (w)->date_entry), "changed",
G_CALLBACK (pedit_data_changed_cb), pedit_dialog);
gtk_entry_set_activates_default(GTK_ENTRY(GNC_DATE_EDIT(w)->date_entry), TRUE);
label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
label = GTK_WIDGET(gtk_builder_get_object (builder, "date__label"));
gnc_date_make_mnemonic_target (GNC_DATE_EDIT(w), label);
w = GTK_WIDGET(gtk_builder_get_object (builder, "source_entry"));
pedit_dialog->source_entry = w;
@ -607,7 +572,7 @@ gnc_price_edit_dialog (GtkWidget * parent,
refresh_handler, close_handler,
pedit_dialog);
gnc_gui_component_set_session (component_id, pedit_dialog->session);
gtk_widget_grab_focus (pedit_dialog->commodity_cbe);
gtk_widget_grab_focus (pedit_dialog->commodity_cbwe);
gtk_widget_show (pedit_dialog->dialog);
}

View File

@ -2550,7 +2550,7 @@ gnc_print_check_format_changed (GtkComboBox *widget,
{
GtkListStore *p_store;
GtkTreeModel *f_model;
GtkTreeIter f_iter;
GtkTreeIter f_iter, iter;
gboolean sensitive;
gint pnum;
check_format_t *format;
@ -2578,21 +2578,24 @@ gnc_print_check_format_changed (GtkComboBox *widget,
pcd->position_max = g_slist_length(format->positions); /* -1 for 0 base, +1 for custom entry */
for (elem = format->positions; elem; elem = g_slist_next(elem))
{
gtk_combo_box_append_text(GTK_COMBO_BOX(pcd->position_combobox), elem->data);
gtk_list_store_append(GTK_LIST_STORE(p_store), &iter);
gtk_list_store_set (GTK_LIST_STORE(p_store), &iter, 0, elem->data, -1);
}
}
else
{
/* Invent a "Top" position if format has no positions */
pcd->position_max = 1;
gtk_combo_box_append_text(GTK_COMBO_BOX(pcd->position_combobox), _("Top"));
gtk_list_store_append(GTK_LIST_STORE(p_store), &iter);
gtk_list_store_set (GTK_LIST_STORE(p_store), &iter, 0, _("Top"), -1);
}
}
else
{
pcd->position_max = 0;
}
gtk_combo_box_append_text(GTK_COMBO_BOX(pcd->position_combobox), _("Custom"));
gtk_list_store_append(GTK_LIST_STORE(p_store), &iter);
gtk_list_store_set (GTK_LIST_STORE(p_store), &iter, 0, _("Custom"), -1);
/* If there's only one thing in the position combobox, make it insensitive */
sensitive = (pcd->position_max > 0);

View File

@ -1,7 +1,6 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="Deletion Date">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -9,18 +8,19 @@
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox19">
<object class="GtkBox" id="dialog-vbox19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area19">
<object class="GtkButtonBox" id="dialog-action_area19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -37,6 +37,7 @@
<child>
<object class="GtkButton" id="ok_button">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -76,12 +77,13 @@
<packing>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="delete_manual">
<property name="label" translatable="yes">Delete _manually entered prices</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -95,12 +97,13 @@
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="delete_last">
<property name="label" translatable="yes">Delete _last price for a stock</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -114,7 +117,7 @@
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -128,7 +131,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -142,8 +145,8 @@
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
<child>
@ -184,18 +187,19 @@
<property name="type_hint">dialog</property>
<signal name="response" handler="pedit_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox18">
<object class="GtkBox" id="dialog-vbox18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area18">
<object class="GtkButtonBox" id="dialog-action_area18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="pd_cancel_button">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -212,6 +216,7 @@
<child>
<object class="GtkButton" id="pd_apply_button">
<property name="label">gtk-apply</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -227,6 +232,7 @@
<child>
<object class="GtkButton" id="pd_ok_button">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -257,33 +263,6 @@
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkComboBoxEntry" id="commodity_cbe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="pedit_commodity_changed_cb" swapped="no"/>
</object>
<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>
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="namespace_cbe">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="pedit_commodity_ns_changed_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="namespace_label">
<property name="visible">True</property>
@ -292,11 +271,11 @@
<property name="label" translatable="yes">_Namespace:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">namespace_cbe</property>
<property name="mnemonic_widget">namespace_cbwe</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -307,13 +286,13 @@
<property name="label" translatable="yes">_Security:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">commodity_cbe</property>
<property name="mnemonic_widget">commodity_cbwe</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -329,11 +308,11 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="date_label">
<object class="GtkLabel" id="date__label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@ -345,7 +324,7 @@
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -361,7 +340,7 @@
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -378,7 +357,7 @@
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -394,7 +373,7 @@
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -437,8 +416,6 @@
<property name="editable">False</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="pedit_data_changed_cb" swapped="no"/>
</object>
<packing>
@ -446,7 +423,7 @@
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -488,6 +465,49 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="namespace_cbwe">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore3</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="pedit_commodity_ns_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry3">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="commodity_cbwe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore2</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<signal name="changed" handler="pedit_commodity_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<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>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -514,18 +534,19 @@
<signal name="close" handler="gnc_prices_dialog_close_cb" after="yes" swapped="no"/>
<signal name="response" handler="gnc_prices_dialog_response" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="vbox121">
<object class="GtkBox" id="vbox121">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="hbuttonbox4">
<object class="GtkButtonBox" id="hbuttonbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -556,8 +577,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
@ -578,6 +597,7 @@
<child>
<object class="GtkButton" id="add_button">
<property name="label">gtk-add</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -596,6 +616,7 @@
<child>
<object class="GtkButton" id="remove_button">
<property name="label">gtk-remove</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
@ -614,6 +635,7 @@
</child>
<child>
<object class="GtkButton" id="edit_button">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
@ -671,6 +693,7 @@
</child>
<child>
<object class="GtkButton" id="remove_old_button">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -727,6 +750,7 @@
</child>
<child>
<object class="GtkButton" id="get_quotes_button">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@ -824,4 +848,26 @@
</row>
</data>
</object>
<object class="GtkListStore" id="liststore2">
<columns>
<!-- column-name item -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Dummy commodity Line</col>
</row>
</data>
</object>
<object class="GtkListStore" id="liststore3">
<columns>
<!-- column-name item -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Dummy namespace Line</col>
</row>
</data>
</object>
</interface>

View File

@ -834,6 +834,7 @@ new_security_page(SCM security_hash_key, gnc_commodity *comm, QIFImportWindow *w
{
QIFAssistantPage *retval = g_new0(QIFAssistantPage, 1);
GtkListStore *store;
GtkWidget *table;
GtkWidget *label;
gchar *title = NULL;
@ -922,8 +923,14 @@ new_security_page(SCM security_hash_key, gnc_commodity *comm, QIFImportWindow *w
G_CALLBACK (gnc_ui_qif_import_comm_changed_cb), wind);
/* Namespace entry */
retval->namespace_combo = gtk_combo_box_entry_new_text();
gnc_cbe_add_completion(GTK_COMBO_BOX_ENTRY(retval->namespace_combo));
store = gtk_list_store_new (1, G_TYPE_STRING);
retval->namespace_combo = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store));
g_object_unref(store);
/* Set the column for the text */
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX(retval->namespace_combo), 0);
gnc_cbwe_add_completion(GTK_COMBO_BOX(retval->namespace_combo));
label = gtk_label_new_with_mnemonic(
_("_Exchange or abbreviation type:"));
gtk_label_set_mnemonic_widget(GTK_LABEL(label), retval->namespace_combo);
@ -1885,26 +1892,28 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
SCM_CDR(parse_return),
scm_str2symbol("date"))) != SCM_BOOL_F)
{
gint n_items;
GtkComboBox *combo_box;
GtkTreeModel *model;
GtkTreeIter iter;
/* Block the date call back */
g_signal_handlers_block_by_func( wind->date_format_combo, gnc_ui_qif_import_date_valid_cb, wind );
/* Clear the date format combo box. */
combo_box = GTK_COMBO_BOX(wind->date_format_combo);
model = gtk_combo_box_get_model(combo_box);
gtk_list_store_clear(GTK_LIST_STORE(model));
gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), -1);
n_items = gtk_tree_model_iter_n_children(
gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo)),
NULL);
while (n_items-- > 0)
gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0);
/* Add the formats for the user to select from. */
while (scm_is_list(date_formats) && !scm_is_null(date_formats))
{
gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, SCM_SYMBOL_CHARS(SCM_CAR(date_formats)), -1);
date_formats = SCM_CDR(date_formats);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), -1 );
/* Unblock the date call back */
g_signal_handlers_unblock_by_func( wind->date_format_combo, gnc_ui_qif_import_date_valid_cb, wind );
@ -2017,6 +2026,8 @@ void
gnc_ui_qif_import_date_valid_cb (GtkWidget *widget, gpointer user_data)
{
QIFImportWindow * wind = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
GtkAssistant *assistant = GTK_ASSISTANT(wind->window);
gint num = gtk_assistant_get_current_page (assistant);
@ -2027,7 +2038,10 @@ gnc_ui_qif_import_date_valid_cb (GtkWidget *widget, gpointer user_data)
gchar *text;
/* Get the selected date format. */
text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->date_format_combo));
model = gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo));
gtk_combo_box_get_active_iter (GTK_COMBO_BOX(wind->date_format_combo), &iter);
gtk_tree_model_get( model, &iter, 0, &text, -1 );
if (!text)
{
g_critical("QIF import: BUG DETECTED in gnc_ui_qif_import_date_valid_cb. Format is NULL.");
@ -2635,10 +2649,10 @@ gnc_ui_qif_import_commodity_new_prepare (GtkAssistant *assistant,
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
QIFAssistantPage *qpage = g_object_get_data(G_OBJECT(page), "page_struct");
gchar *ns;
const gchar *ns;
/* Get any entered namespace. */
ns = gtk_combo_box_get_active_text(GTK_COMBO_BOX(qpage->namespace_combo));
ns = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(qpage->namespace_combo)))));
/* Update the namespaces available to select. */
if (!ns || !ns[0])
@ -2648,8 +2662,6 @@ gnc_ui_qif_import_commodity_new_prepare (GtkAssistant *assistant,
DIAG_COMM_ALL);
else
gnc_ui_update_namespace_picker(qpage->namespace_combo, ns, DIAG_COMM_ALL);
g_free(ns);
}
@ -2822,8 +2834,7 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
0);
/* The default currency. */
gchar *currname =
gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->currency_picker));
const gchar *currname = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(wind->currency_picker)))));
/* Raise the busy flag so the assistant can't be canceled unexpectedly. */
wind->busy = TRUE;
@ -2858,7 +2869,6 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
progress),
SCM_EOL);
gnc_progress_dialog_pop(wind->convert_progress);
g_free(currname);
if (retval == SCM_BOOL_T)
{

View File

@ -179,6 +179,7 @@ gnc_style_sheet_new (StyleSheetDialog * ssd)
SCM new_ss = SCM_BOOL_F;
GtkWidget * template_combo;
GtkTreeModel * template_model;
GtkTreeIter iter;
GtkWidget * name_entry;
gint dialog_retval;
GList *template_names = NULL;
@ -218,8 +219,8 @@ gnc_style_sheet_new (StyleSheetDialog * ssd)
template_names = g_list_prepend (template_names, (gpointer)orig_name);
/* The displayed name should be translated */
gtk_combo_box_prepend_text(GTK_COMBO_BOX(template_combo),
_(orig_name));
gtk_list_store_append(GTK_LIST_STORE(template_model), &iter);
gtk_list_store_set (GTK_LIST_STORE(template_model), &iter, 0, _(orig_name), -1);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(template_combo), 0);