aboutsummarylogtreecommitdiffstats
path: root/gtk_win.c
diff options
context:
space:
mode:
authorAntony Kellermann2018-08-22 11:43:31 -0400
committerAntony Kellermann2018-08-22 11:43:31 -0400
commit9cf45afbae64bafec5244893038edc042981a47c (patch)
treee0a247e089135fdf8a479304749647c6100adcc3 /gtk_win.c
parent94aa7fc95c9a31718089bcf29cd108febfb18353 (diff)
downloadaur-9cf45afbae64bafec5244893038edc042981a47c.tar.gz
Implemented peers for gtk info
Diffstat (limited to 'gtk_win.c')
-rw-r--r--gtk_win.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gtk_win.c b/gtk_win.c
index 856aacae1d8b..a5f6f0181cb5 100644
--- a/gtk_win.c
+++ b/gtk_win.c
@@ -346,8 +346,10 @@ void on_check_tree_view_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
if (pInfo->api_provider != IEX) // Only see info for iex securities
return;
- if (pInfo->name[0] == '\0') // MISC not loaded yet
- iex_batch_store_data_info(pInfo, MISC);
+ if (pInfo->name[0] == '\0') {// MISC not loaded yet
+ api_info_store_data_batch(pInfo, MISC);
+ format_cells(pInfo->peers);
+ }
info_pane_populate_all(pInfo);
g_free(symbol);
@@ -447,6 +449,7 @@ void list_store_update(void) {
void info_pane_populate_all(const Info* pInfo) {
info_pane_populate_header(pInfo);
info_pane_populate_company(pInfo);
+ info_pane_populate_peers(pInfo);
}
void info_pane_populate_header(const Info* pInfo) {
@@ -536,6 +539,23 @@ void info_pane_populate_company(const Info* pInfo) {
}
}
+void info_pane_populate_peers(const Info* pInfo) {
+ GtkListStore* pListStore = GTK_LIST_STORE(GET_OBJECT("peers_list"));
+ gtk_list_store_clear(pListStore);
+
+ Info* idx; // Append pListStore store with portfolio data
+ GtkTreeIter iter;
+ for (size_t i = 0; i < pInfo->peers->length; i++) {
+ gtk_list_store_append(pListStore, &iter);
+ idx = pInfo->peers->array[i];
+ gtk_list_store_set(pListStore, &iter,
+ PEER_COLUMN_SYMBOL, idx->symbol,
+ PEER_COLUMN_PROFIT_24H_PERCENT, idx->fprofit_last_close_percent,
+ PEER_COLUMN_PROFIT_7D_PERCENT, idx->fprofit_7d_percent,
+ PEER_COLUMN_PROFIT_30D_PERCENT, idx->fprofit_30d_percent, -1);
+ }
+}
+
void show_generic_message_dialog(const char* message, gboolean success) {
char widget_name[64];
if (success)