mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[dialog-commodity.cpp] convert to c++
This commit is contained in:
parent
4f5ee5dc4e
commit
f2dba525f7
@ -33,7 +33,7 @@ set (gnome_utils_SOURCES
|
|||||||
dialog-account.c
|
dialog-account.c
|
||||||
dialog-doclink-utils.c
|
dialog-doclink-utils.c
|
||||||
dialog-book-close.c
|
dialog-book-close.c
|
||||||
dialog-commodity.c
|
dialog-commodity.cpp
|
||||||
dialog-dup-trans.c
|
dialog-dup-trans.c
|
||||||
dialog-file-access.c
|
dialog-file-access.c
|
||||||
dialog-object-references.c
|
dialog-object-references.c
|
||||||
|
@ -112,6 +112,7 @@ gnc_ui_select_commodity_create(const gnc_commodity * orig_sel,
|
|||||||
dialog_commodity_mode mode);
|
dialog_commodity_mode mode);
|
||||||
void gnc_ui_select_commodity_new_cb(GtkButton * button,
|
void gnc_ui_select_commodity_new_cb(GtkButton * button,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
extern "C" {
|
||||||
void gnc_ui_select_commodity_changed_cb(GtkComboBox *cbwe,
|
void gnc_ui_select_commodity_changed_cb(GtkComboBox *cbwe,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBox *cbwe,
|
void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBox *cbwe,
|
||||||
@ -120,6 +121,7 @@ void gnc_ui_select_commodity_namespace_changed_cb(GtkComboBox *cbwe,
|
|||||||
/* The commodity creation window */
|
/* The commodity creation window */
|
||||||
void gnc_ui_commodity_changed_cb(GtkWidget * dummy, gpointer user_data);
|
void gnc_ui_commodity_changed_cb(GtkWidget * dummy, gpointer user_data);
|
||||||
void gnc_ui_commodity_quote_info_cb(GtkWidget *w, gpointer data);
|
void gnc_ui_commodity_quote_info_cb(GtkWidget *w, gpointer data);
|
||||||
|
}
|
||||||
gboolean gnc_ui_commodity_dialog_to_object(CommodityWindow * w);
|
gboolean gnc_ui_commodity_dialog_to_object(CommodityWindow * w);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -138,7 +140,7 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
|
|||||||
const char * fullname,
|
const char * fullname,
|
||||||
const char * mnemonic)
|
const char * mnemonic)
|
||||||
{
|
{
|
||||||
gnc_commodity * retval = NULL;
|
gnc_commodity * retval = nullptr;
|
||||||
const gchar *initial;
|
const gchar *initial;
|
||||||
gchar *user_prompt_text;
|
gchar *user_prompt_text;
|
||||||
SelectCommodityWindow * win;
|
SelectCommodityWindow * win;
|
||||||
@ -154,9 +156,9 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
|
|||||||
if (parent)
|
if (parent)
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (win->dialog), GTK_WINDOW (parent));
|
gtk_window_set_transient_for (GTK_WINDOW (win->dialog), GTK_WINDOW (parent));
|
||||||
|
|
||||||
if (user_message != NULL)
|
if (user_message != nullptr)
|
||||||
initial = user_message;
|
initial = user_message;
|
||||||
else if ((cusip != NULL) || (fullname != NULL) || (mnemonic != NULL))
|
else if ((cusip != nullptr) || (fullname != nullptr) || (mnemonic != nullptr))
|
||||||
initial = _("\nPlease select a commodity to match");
|
initial = _("\nPlease select a commodity to match");
|
||||||
else
|
else
|
||||||
initial = "";
|
initial = "";
|
||||||
@ -192,11 +194,11 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
|
|||||||
break;
|
break;
|
||||||
case GNC_RESPONSE_NEW:
|
case GNC_RESPONSE_NEW:
|
||||||
DEBUG("case NEW");
|
DEBUG("case NEW");
|
||||||
gnc_ui_select_commodity_new_cb(NULL, win);
|
gnc_ui_select_commodity_new_cb (nullptr, win);
|
||||||
break;
|
break;
|
||||||
default: /* Cancel, Escape, Close, etc. */
|
default: /* Cancel, Escape, Close, etc. */
|
||||||
DEBUG("default: %d", value);
|
DEBUG("default: %d", value);
|
||||||
retval = NULL;
|
retval = nullptr;
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -219,10 +221,10 @@ gnc_ui_select_commodity_modal(gnc_commodity * orig_sel,
|
|||||||
return gnc_ui_select_commodity_modal_full(orig_sel,
|
return gnc_ui_select_commodity_modal_full(orig_sel,
|
||||||
parent,
|
parent,
|
||||||
mode,
|
mode,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -324,7 +326,7 @@ void
|
|||||||
gnc_ui_select_commodity_new_cb(GtkButton * button,
|
gnc_ui_select_commodity_new_cb(GtkButton * button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SelectCommodityWindow * w = user_data;
|
auto w = static_cast<SelectCommodityWindow*>(user_data);
|
||||||
|
|
||||||
gchar * name_space = gnc_ui_namespace_picker_ns (w->namespace_combo);
|
gchar * name_space = gnc_ui_namespace_picker_ns (w->namespace_combo);
|
||||||
|
|
||||||
@ -368,7 +370,7 @@ void
|
|||||||
gnc_ui_select_commodity_changed_cb (GtkComboBox *cbwe,
|
gnc_ui_select_commodity_changed_cb (GtkComboBox *cbwe,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SelectCommodityWindow * w = user_data;
|
auto w = static_cast<SelectCommodityWindow*>(user_data);
|
||||||
gchar *name_space;
|
gchar *name_space;
|
||||||
const gchar *fullname;
|
const gchar *fullname;
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
@ -382,7 +384,7 @@ gnc_ui_select_commodity_changed_cb (GtkComboBox *cbwe,
|
|||||||
name_space, fullname);
|
name_space, fullname);
|
||||||
g_free(name_space);
|
g_free(name_space);
|
||||||
|
|
||||||
ok = (w->selection != NULL);
|
ok = (w->selection != nullptr);
|
||||||
gtk_widget_set_sensitive(w->ok_button, ok);
|
gtk_widget_set_sensitive(w->ok_button, ok);
|
||||||
gtk_dialog_set_default_response(GTK_DIALOG(w->dialog), ok ? 0 : 2);
|
gtk_dialog_set_default_response(GTK_DIALOG(w->dialog), ok ? 0 : 2);
|
||||||
LEAVE("sensitive=%d, default = %d", ok, ok ? 0 : 2);
|
LEAVE("sensitive=%d, default = %d", ok, ok ? 0 : 2);
|
||||||
@ -409,13 +411,13 @@ void
|
|||||||
gnc_ui_select_commodity_namespace_changed_cb (GtkComboBox *cbwe,
|
gnc_ui_select_commodity_namespace_changed_cb (GtkComboBox *cbwe,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SelectCommodityWindow * w = user_data;
|
auto w = static_cast<SelectCommodityWindow*>(user_data);
|
||||||
gchar *name_space;
|
gchar *name_space;
|
||||||
|
|
||||||
ENTER("cbwe=%p, user_data=%p", cbwe, user_data);
|
ENTER("cbwe=%p, user_data=%p", cbwe, user_data);
|
||||||
name_space = gnc_ui_namespace_picker_ns (w->namespace_combo);
|
name_space = gnc_ui_namespace_picker_ns (w->namespace_combo);
|
||||||
DEBUG("name_space=%s", name_space);
|
DEBUG("name_space=%s", name_space);
|
||||||
gnc_ui_update_commodity_picker(w->commodity_combo, name_space, NULL);
|
gnc_ui_update_commodity_picker(w->commodity_combo, name_space, nullptr);
|
||||||
g_free(name_space);
|
g_free(name_space);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
@ -431,7 +433,7 @@ collate(gconstpointer a, gconstpointer b)
|
|||||||
return -1;
|
return -1;
|
||||||
if (!b)
|
if (!b)
|
||||||
return 1;
|
return 1;
|
||||||
return g_utf8_collate(a, b);
|
return g_utf8_collate (static_cast<const char*>(a), static_cast<const char*>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -441,8 +443,8 @@ gnc_ui_update_commodity_picker (GtkWidget *cbwe,
|
|||||||
const gchar * init_string)
|
const gchar * init_string)
|
||||||
{
|
{
|
||||||
GList * commodities;
|
GList * commodities;
|
||||||
GList * iterator = NULL;
|
GList * iterator = nullptr;
|
||||||
GList * commodity_items = NULL;
|
GList * commodity_items = nullptr;
|
||||||
GtkComboBox *combo_box;
|
GtkComboBox *combo_box;
|
||||||
GtkEntry *entry;
|
GtkEntry *entry;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
@ -471,7 +473,7 @@ gnc_ui_update_commodity_picker (GtkWidget *cbwe,
|
|||||||
{
|
{
|
||||||
commodity_items =
|
commodity_items =
|
||||||
g_list_prepend (commodity_items,
|
g_list_prepend (commodity_items,
|
||||||
(gpointer) gnc_commodity_get_printname(iterator->data));
|
(gpointer) gnc_commodity_get_printname(GNC_COMMODITY(iterator->data)));
|
||||||
}
|
}
|
||||||
g_list_free(commodities);
|
g_list_free(commodities);
|
||||||
|
|
||||||
@ -502,12 +504,12 @@ gnc_ui_update_commodity_picker (GtkWidget *cbwe,
|
|||||||
static void
|
static void
|
||||||
gnc_set_commodity_section_sensitivity (GtkWidget *widget, gpointer user_data)
|
gnc_set_commodity_section_sensitivity (GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
CommodityWindow *cw = user_data;
|
auto cw = static_cast<CommodityWindow*>(user_data);
|
||||||
guint offset = 0;
|
guint offset = 0;
|
||||||
|
|
||||||
gtk_container_child_get(GTK_CONTAINER(cw->table), widget,
|
gtk_container_child_get(GTK_CONTAINER(cw->table), widget,
|
||||||
"top-attach", &offset,
|
"top-attach", &offset,
|
||||||
NULL);
|
nullptr);
|
||||||
|
|
||||||
if ((offset < cw->comm_section_top) || (offset >= cw->comm_section_bottom))
|
if ((offset < cw->comm_section_top) || (offset >= cw->comm_section_bottom))
|
||||||
return;
|
return;
|
||||||
@ -526,16 +528,16 @@ gnc_ui_update_commodity_info (CommodityWindow *cw)
|
|||||||
static void
|
static void
|
||||||
gnc_set_fq_sensitivity (GtkWidget *widget, gpointer user_data)
|
gnc_set_fq_sensitivity (GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
CommodityWindow *cw = user_data;
|
auto cw = static_cast<CommodityWindow*>(user_data);
|
||||||
guint offset = 0;
|
guint offset = 0;
|
||||||
|
|
||||||
gtk_container_child_get(GTK_CONTAINER(cw->table), widget,
|
gtk_container_child_get(GTK_CONTAINER(cw->table), widget,
|
||||||
"top-attach", &offset,
|
"top-attach", &offset,
|
||||||
NULL);
|
nullptr);
|
||||||
|
|
||||||
if ((offset < cw->fq_section_top) || (offset >= cw->fq_section_bottom))
|
if ((offset < cw->fq_section_top) || (offset >= cw->fq_section_bottom))
|
||||||
return;
|
return;
|
||||||
g_object_set(widget, "sensitive", FALSE, NULL);
|
g_object_set(widget, "sensitive", FALSE, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -588,12 +590,12 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gnc_commodity_namespace_is_iso (init_string))
|
if (gnc_commodity_namespace_is_iso (init_string))
|
||||||
init_string = NULL;
|
init_string = nullptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DIAG_COMM_CURRENCY:
|
case DIAG_COMM_CURRENCY:
|
||||||
default:
|
default:
|
||||||
namespaces = g_list_prepend (NULL, GNC_COMMODITY_NS_CURRENCY);
|
namespaces = g_list_prepend (nullptr, (gpointer)GNC_COMMODITY_NS_CURRENCY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,18 +626,19 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
|
|||||||
namespaces = g_list_sort(namespaces, collate);
|
namespaces = g_list_sort(namespaces, collate);
|
||||||
for (node = namespaces; node; node = node->next)
|
for (node = namespaces; node; node = node->next)
|
||||||
{
|
{
|
||||||
|
auto ns = static_cast<const char*>(node->data);
|
||||||
/* Skip template, legacy and currency namespaces.
|
/* Skip template, legacy and currency namespaces.
|
||||||
The latter was added as first entry earlier */
|
The latter was added as first entry earlier */
|
||||||
if ((g_utf8_collate(node->data, GNC_COMMODITY_NS_LEGACY) == 0) ||
|
if ((g_utf8_collate(ns, GNC_COMMODITY_NS_LEGACY) == 0) ||
|
||||||
(g_utf8_collate(node->data, GNC_COMMODITY_NS_TEMPLATE ) == 0) ||
|
(g_utf8_collate(ns, GNC_COMMODITY_NS_TEMPLATE ) == 0) ||
|
||||||
(g_utf8_collate(node->data, GNC_COMMODITY_NS_CURRENCY ) == 0))
|
(g_utf8_collate(ns, GNC_COMMODITY_NS_CURRENCY ) == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
|
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
|
||||||
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, node->data, -1);
|
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, ns, -1);
|
||||||
|
|
||||||
if (init_string &&
|
if (init_string &&
|
||||||
(g_utf8_collate(node->data, init_string) == 0))
|
(g_utf8_collate(ns, init_string) == 0))
|
||||||
{
|
{
|
||||||
matched = TRUE;
|
matched = TRUE;
|
||||||
match = iter;
|
match = iter;
|
||||||
@ -656,7 +659,7 @@ gnc_ui_namespace_picker_ns (GtkWidget *cbwe)
|
|||||||
{
|
{
|
||||||
const gchar *name_space;
|
const gchar *name_space;
|
||||||
|
|
||||||
g_return_val_if_fail(GTK_IS_COMBO_BOX (cbwe), NULL);
|
g_return_val_if_fail(GTK_IS_COMBO_BOX (cbwe), nullptr);
|
||||||
|
|
||||||
name_space = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(cbwe)))));
|
name_space = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(cbwe)))));
|
||||||
|
|
||||||
@ -676,7 +679,7 @@ gnc_ui_namespace_picker_ns (GtkWidget *cbwe)
|
|||||||
void
|
void
|
||||||
gnc_ui_commodity_quote_info_cb (GtkWidget *w, gpointer data)
|
gnc_ui_commodity_quote_info_cb (GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
CommodityWindow *cw = data;
|
auto cw = static_cast<CommodityWindow*>(data);
|
||||||
gboolean get_quote, allow_src, active;
|
gboolean get_quote, allow_src, active;
|
||||||
const gchar *text;
|
const gchar *text;
|
||||||
gint i;
|
gint i;
|
||||||
@ -708,7 +711,7 @@ gnc_ui_commodity_quote_info_cb (GtkWidget *w, gpointer data)
|
|||||||
void
|
void
|
||||||
gnc_ui_commodity_changed_cb(GtkWidget * dummy, gpointer user_data)
|
gnc_ui_commodity_changed_cb(GtkWidget * dummy, gpointer user_data)
|
||||||
{
|
{
|
||||||
CommodityWindow * w = user_data;
|
auto w = static_cast<CommodityWindow*>(user_data);
|
||||||
gchar *name_space;
|
gchar *name_space;
|
||||||
const char * fullname;
|
const char * fullname;
|
||||||
const char * mnemonic;
|
const char * mnemonic;
|
||||||
@ -769,7 +772,7 @@ gnc_ui_source_menu_create(QuoteSourceType type)
|
|||||||
for (i = 0; i < max; i++)
|
for (i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
source = gnc_quote_source_lookup_by_ti(type, i);
|
source = gnc_quote_source_lookup_by_ti(type, i);
|
||||||
if (source == NULL)
|
if (source == nullptr)
|
||||||
break;
|
break;
|
||||||
name = gnc_quote_source_get_user_name(source);
|
name = gnc_quote_source_get_user_name(source);
|
||||||
supported = gnc_quote_source_get_supported(source);
|
supported = gnc_quote_source_get_supported(source);
|
||||||
@ -798,7 +801,7 @@ gnc_ui_source_menu_create(QuoteSourceType type)
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
* price quote timezone handling *
|
* price quote timezone handling *
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
static gchar *
|
static const gchar *
|
||||||
known_timezones[] =
|
known_timezones[] =
|
||||||
{
|
{
|
||||||
"Asia/Tokyo",
|
"Asia/Tokyo",
|
||||||
@ -807,7 +810,7 @@ known_timezones[] =
|
|||||||
"America/Chicago",
|
"America/Chicago",
|
||||||
"Europe/London",
|
"Europe/London",
|
||||||
"Europe/Paris",
|
"Europe/Paris",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -833,10 +836,10 @@ gnc_find_timezone_menu_position(const gchar *timezone)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gchar *
|
static const gchar *
|
||||||
gnc_timezone_menu_position_to_string(guint pos)
|
gnc_timezone_menu_position_to_string(guint pos)
|
||||||
{
|
{
|
||||||
if (pos == 0) return NULL;
|
if (pos == 0) return nullptr;
|
||||||
return known_timezones[pos - 1];
|
return known_timezones[pos - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +848,7 @@ static GtkWidget *
|
|||||||
gnc_ui_quote_tz_menu_create(void)
|
gnc_ui_quote_tz_menu_create(void)
|
||||||
{
|
{
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
gchar **itemstr;
|
const gchar **itemstr;
|
||||||
|
|
||||||
/* add items here as needed, but bear in mind that right now these
|
/* add items here as needed, but bear in mind that right now these
|
||||||
must be timezones that GNU libc understands. Also, I'd prefer if
|
must be timezones that GNU libc understands. Also, I'd prefer if
|
||||||
@ -903,10 +906,10 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
|
|||||||
gtk_widget_set_name (GTK_WIDGET(retval->dialog), "gnc-id-security");
|
gtk_widget_set_name (GTK_WIDGET(retval->dialog), "gnc-id-security");
|
||||||
gnc_widget_style_context_add_class (GTK_WIDGET(retval->dialog), "gnc-class-securities");
|
gnc_widget_style_context_add_class (GTK_WIDGET(retval->dialog), "gnc-class-securities");
|
||||||
|
|
||||||
if (parent != NULL)
|
if (parent != nullptr)
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (retval->dialog), GTK_WINDOW (parent));
|
gtk_window_set_transient_for (GTK_WINDOW (retval->dialog), GTK_WINDOW (parent));
|
||||||
|
|
||||||
retval->edit_commodity = NULL;
|
retval->edit_commodity = nullptr;
|
||||||
|
|
||||||
/* Get widget pointers */
|
/* Get widget pointers */
|
||||||
retval->fullname_entry = GTK_WIDGET(gtk_builder_get_object (builder, "fullname_entry"));
|
retval->fullname_entry = GTK_WIDGET(gtk_builder_get_object (builder, "fullname_entry"));
|
||||||
@ -926,15 +929,15 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
|
|||||||
retval->table = GTK_WIDGET(gtk_builder_get_object (builder, "edit_table"));
|
retval->table = GTK_WIDGET(gtk_builder_get_object (builder, "edit_table"));
|
||||||
sec_label = GTK_WIDGET(gtk_builder_get_object (builder, "security_label"));
|
sec_label = GTK_WIDGET(gtk_builder_get_object (builder, "security_label"));
|
||||||
gtk_container_child_get(GTK_CONTAINER(retval->table), sec_label,
|
gtk_container_child_get(GTK_CONTAINER(retval->table), sec_label,
|
||||||
"top-attach", &retval->comm_section_top, NULL);
|
"top-attach", &retval->comm_section_top, nullptr);
|
||||||
|
|
||||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "quote_label"));
|
widget = GTK_WIDGET(gtk_builder_get_object (builder, "quote_label"));
|
||||||
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
||||||
"top-attach", &retval->comm_section_bottom, NULL);
|
"top-attach", &retval->comm_section_bottom, nullptr);
|
||||||
|
|
||||||
gtk_container_child_get(GTK_CONTAINER(retval->table),
|
gtk_container_child_get(GTK_CONTAINER(retval->table),
|
||||||
retval->user_symbol_entry, "top-attach",
|
retval->user_symbol_entry, "top-attach",
|
||||||
&retval->comm_symbol_line, NULL);
|
&retval->comm_symbol_line, nullptr);
|
||||||
|
|
||||||
/* Build custom widgets */
|
/* Build custom widgets */
|
||||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "single_source_box"));
|
box = GTK_WIDGET(gtk_builder_get_object (builder, "single_source_box"));
|
||||||
@ -1007,11 +1010,11 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
|
|||||||
/* Determine the price quote of the dialog */
|
/* Determine the price quote of the dialog */
|
||||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "fq_warning_alignment"));
|
widget = GTK_WIDGET(gtk_builder_get_object (builder, "fq_warning_alignment"));
|
||||||
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
||||||
"top-attach", &retval->fq_section_top, NULL);
|
"top-attach", &retval->fq_section_top, nullptr);
|
||||||
|
|
||||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "bottom_alignment"));
|
widget = GTK_WIDGET(gtk_builder_get_object (builder, "bottom_alignment"));
|
||||||
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
gtk_container_child_get(GTK_CONTAINER(retval->table), widget,
|
||||||
"top-attach", &retval->fq_section_bottom, NULL);
|
"top-attach", &retval->fq_section_bottom, nullptr);
|
||||||
|
|
||||||
gnc_ui_update_fq_info (retval);
|
gnc_ui_update_fq_info (retval);
|
||||||
}
|
}
|
||||||
@ -1054,7 +1057,7 @@ gnc_ui_commodity_update_quote_info(CommodityWindow *win,
|
|||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
has_quote_src = gnc_commodity_get_quote_flag (commodity);
|
has_quote_src = gnc_commodity_get_quote_flag (commodity);
|
||||||
source = gnc_commodity_get_quote_source (commodity);
|
source = gnc_commodity_get_quote_source (commodity);
|
||||||
if (source == NULL)
|
if (source == nullptr)
|
||||||
source = gnc_commodity_get_default_quote_source (commodity);
|
source = gnc_commodity_get_default_quote_source (commodity);
|
||||||
quote_tz = gnc_commodity_get_quote_tz (commodity);
|
quote_tz = gnc_commodity_get_quote_tz (commodity);
|
||||||
|
|
||||||
@ -1092,7 +1095,7 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
|
|||||||
int fraction)
|
int fraction)
|
||||||
{
|
{
|
||||||
CommodityWindow * win;
|
CommodityWindow * win;
|
||||||
gnc_commodity *retval = NULL;
|
gnc_commodity *retval = nullptr;
|
||||||
gboolean done;
|
gboolean done;
|
||||||
gint value;
|
gint value;
|
||||||
|
|
||||||
@ -1113,13 +1116,13 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
|
|||||||
/* Not allowed to create new currencies */
|
/* Not allowed to create new currencies */
|
||||||
if (gnc_commodity_namespace_is_iso(name_space))
|
if (gnc_commodity_namespace_is_iso(name_space))
|
||||||
{
|
{
|
||||||
name_space = NULL;
|
name_space = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
win = gnc_ui_build_commodity_dialog(name_space, parent, fullname,
|
win = gnc_ui_build_commodity_dialog(name_space, parent, fullname,
|
||||||
mnemonic, user_symbol, cusip,
|
mnemonic, user_symbol, cusip,
|
||||||
fraction, (commodity != NULL));
|
fraction, (commodity != nullptr));
|
||||||
|
|
||||||
/* Update stock quote info based on existing commodity */
|
/* Update stock quote info based on existing commodity */
|
||||||
gnc_ui_commodity_update_quote_info(win, commodity);
|
gnc_ui_commodity_update_quote_info(win, commodity);
|
||||||
@ -1146,7 +1149,7 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
|
|||||||
break;
|
break;
|
||||||
default: /* Cancel, Escape, Close, etc. */
|
default: /* Cancel, Escape, Close, etc. */
|
||||||
DEBUG("default: %d", value);
|
DEBUG("default: %d", value);
|
||||||
retval = NULL;
|
retval = nullptr;
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1174,7 +1177,7 @@ gnc_ui_new_commodity_modal_full(const char * name_space,
|
|||||||
gnc_commodity *result;
|
gnc_commodity *result;
|
||||||
|
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
result = gnc_ui_common_commodity_modal(NULL, parent, name_space, cusip,
|
result = gnc_ui_common_commodity_modal(nullptr, parent, name_space, cusip,
|
||||||
fullname, mnemonic, user_symbol,
|
fullname, mnemonic, user_symbol,
|
||||||
10000);
|
10000);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
@ -1192,8 +1195,8 @@ gnc_ui_new_commodity_modal(const char * default_namespace,
|
|||||||
gnc_commodity *result;
|
gnc_commodity *result;
|
||||||
|
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
result = gnc_ui_common_commodity_modal(NULL, parent, default_namespace, NULL,
|
result = gnc_ui_common_commodity_modal(nullptr, parent, default_namespace, nullptr,
|
||||||
NULL, NULL, NULL, 0);
|
nullptr, nullptr, nullptr, 0);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1214,10 +1217,10 @@ gnc_ui_edit_commodity_modal(gnc_commodity *commodity,
|
|||||||
gnc_commodity *result;
|
gnc_commodity *result;
|
||||||
|
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
result = gnc_ui_common_commodity_modal(commodity, parent, NULL, NULL,
|
result = gnc_ui_common_commodity_modal(commodity, parent, nullptr, nullptr,
|
||||||
NULL, NULL, NULL, 0);
|
nullptr, nullptr, nullptr, 0);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
return result != NULL;
|
return result != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1260,7 +1263,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
|
|||||||
gnc_commodity_set_quote_tz(c, string);
|
gnc_commodity_set_quote_tz(c, string);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gnc_commodity_set_quote_tz(c, NULL);
|
gnc_commodity_set_quote_tz(c, nullptr);
|
||||||
|
|
||||||
gnc_commodity_set_user_symbol(c, user_symbol);
|
gnc_commodity_set_user_symbol(c, user_symbol);
|
||||||
|
|
||||||
@ -1324,7 +1327,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
|
|||||||
gnc_commodity_user_set_quote_flag (c, gtk_toggle_button_get_active
|
gnc_commodity_user_set_quote_flag (c, gtk_toggle_button_get_active
|
||||||
(GTK_TOGGLE_BUTTON (w->get_quote_check)));
|
(GTK_TOGGLE_BUTTON (w->get_quote_check)));
|
||||||
|
|
||||||
for (type = SOURCE_SINGLE; type < SOURCE_MAX; type=type+1)
|
for (type = SOURCE_SINGLE; type < SOURCE_MAX; type = static_cast<QuoteSourceType>(type+1))
|
||||||
{
|
{
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->source_button[type])))
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->source_button[type])))
|
||||||
break;
|
break;
|
@ -131,7 +131,7 @@ gnucash/gnome-utils/assistant-xml-encoding.c
|
|||||||
gnucash/gnome-utils/cursors.c
|
gnucash/gnome-utils/cursors.c
|
||||||
gnucash/gnome-utils/dialog-account.c
|
gnucash/gnome-utils/dialog-account.c
|
||||||
gnucash/gnome-utils/dialog-book-close.c
|
gnucash/gnome-utils/dialog-book-close.c
|
||||||
gnucash/gnome-utils/dialog-commodity.c
|
gnucash/gnome-utils/dialog-commodity.cpp
|
||||||
gnucash/gnome-utils/dialog-doclink-utils.c
|
gnucash/gnome-utils/dialog-doclink-utils.c
|
||||||
gnucash/gnome-utils/dialog-dup-trans.c
|
gnucash/gnome-utils/dialog-dup-trans.c
|
||||||
gnucash/gnome-utils/dialog-file-access.c
|
gnucash/gnome-utils/dialog-file-access.c
|
||||||
|
Loading…
Reference in New Issue
Block a user