/* HomeBank -- Free, easy, personal accounting for everyone.
- * Copyright (C) 1995-2017 Maxime DOYEN
+ * Copyright (C) 1995-2018 Maxime DOYEN
*
* This file is part of HomeBank.
*
#include "gtk-chart.h"
+//old url prior 2018
//#define HOMEBANK_URL_HELP "http://homebank.free.fr/help/"
+//#define HOMEBANK_URL_HELP_ONLINE "https://launchpad.net/homebank/+addquestion"
+//#define HOMEBANK_URL_HELP_PROBLEM "https://launchpad.net/homebank/+filebug"
+//#define HOMEBANK_URL_HELP_TRANSLATE "https://launchpad.net/homebank/+translations"
+
#define HOMEBANK_URL_HELP "index.html"
-#define HOMEBANK_URL_HELP_ONLINE "https://launchpad.net/homebank/+addquestion"
-#define HOMEBANK_URL_HELP_TRANSLATE "https://launchpad.net/homebank/+translations"
-#define HOMEBANK_URL_HELP_PROBLEM "https://launchpad.net/homebank/+filebug"
+#define HOMEBANK_URL_HELP_ONLINE "http://homebank.free.fr/support.php"
+#define HOMEBANK_URL_HELP_UPDATES "http://homebank.free.fr/downloads.php"
+#define HOMEBANK_URL_HELP_PROBLEM "http://homebank.free.fr/development.php#bug"
+#define HOMEBANK_URL_HELP_TRANSLATE "http://homebank.free.fr/development.php#translate"
/****************************************************************************/
static void ui_mainwindow_action_help(void);
void ui_mainwindow_action_help_welcome(void);
static void ui_mainwindow_action_help_online(void);
+static void ui_mainwindow_action_help_updates(void);
+static void ui_mainwindow_action_help_releasenotes(void);
static void ui_mainwindow_action_help_translate(void);
static void ui_mainwindow_action_help_problem(void);
static void ui_mainwindow_action_about(void);
void ui_mainwindow_recent_add (struct hbfile_data *data, const gchar *path);
+static void ui_panel_accounts_setup(struct hbfile_data *data);
+
extern gchar *CYA_ACC_TYPE[];
gchar *CYA_CATSUBCAT[] = {
/* HelpMenu */
{ "Contents" , ICONNAME_HELP , N_("_Contents") , "F1", N_("Documentation about HomeBank"), G_CALLBACK (ui_mainwindow_action_help) },
{ "Online" , "lpi-help" , N_("Get Help Online...") , NULL, N_("Connect to the LaunchPad website for online help"), G_CALLBACK (ui_mainwindow_action_help_online) },
- { "Translate" , "lpi-translate" , N_("Translate this Application..."), NULL, N_("Connect to the LaunchPad website to help translate this application"), G_CALLBACK (ui_mainwindow_action_help_translate) },
+
+ { "Updates" , NULL , N_("Check for updates...") , NULL, N_("Visit HomeBank website to check for update"), G_CALLBACK (ui_mainwindow_action_help_updates) },
+ { "ReleaseNotes", NULL , N_("Release Notes") , NULL, N_("Display the release notes"), G_CALLBACK (ui_mainwindow_action_help_releasenotes) },
{ "Problem" , "lpi-bug" , N_("Report a Problem...") , NULL, N_("Connect to the LaunchPad website to help fix problems"), G_CALLBACK (ui_mainwindow_action_help_problem) },
+ { "Translate" , "lpi-translate" , N_("Translate this Application..."), NULL, N_("Connect to the LaunchPad website to help translate this application"), G_CALLBACK (ui_mainwindow_action_help_translate) },
{ "About" , ICONNAME_ABOUT , N_("_About") , NULL, N_("About HomeBank") ,G_CALLBACK (ui_mainwindow_action_about) },
" </menu>"
" <menu action='HelpMenu'>"
" <menuitem action='Contents'/>"
-" <separator/>"
" <menuitem action='Online'/>"
-" <menuitem action='Translate'/>"
+" <separator/>"
+" <menuitem action='Updates'/>"
+" <menuitem action='ReleaseNotes'/>"
" <menuitem action='Problem'/>"
+" <menuitem action='Translate'/>"
" <separator/>"
" <menuitem action='About'/>"
" </menu>"
{
DB( g_print(" - should revert\n") );
- hbfile_change_filepath(hb_util_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb~"));
+ hbfile_change_filepath(hb_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb~"));
ui_mainwindow_open_internal(widget, NULL);
- hbfile_change_filepath(hb_util_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb"));
+ hbfile_change_filepath(hb_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb"));
}
}
};
*/
- static const gchar *copyright = "Copyright \xc2\xa9 1995-2017 - Maxime DOYEN";
+ static const gchar *copyright = "Copyright \xc2\xa9 1995-2018 - Maxime DOYEN";
ui_mainwindow_update(widget, GINT_TO_POINTER(UF_TITLE+UF_SENSITIVE+UF_REFRESHALL));
ui_start_assistant();
- ui_mainwindow_populate_accounts(GLOBALS->mainwindow, NULL);
- ui_mainwindow_scheduled_populate(GLOBALS->mainwindow, NULL);
- ui_mainwindow_populate_topspending(GLOBALS->mainwindow, NULL);
+ //ui_mainwindow_populate_accounts(GLOBALS->mainwindow, NULL);
+ //ui_mainwindow_scheduled_populate(GLOBALS->mainwindow, NULL);
+ //ui_mainwindow_populate_topspending(GLOBALS->mainwindow, NULL);
}
}
{
gboolean result;
- //gtk_widget_destroy(GLOBALS->mainwindow);
-
+ //emulate the wm close button
g_signal_emit_by_name(GLOBALS->mainwindow, "delete-event", NULL, &result);
-
- //gtk_main_quit();
}
+
static void ui_mainwindow_action_file_statistics(void)
{
ui_dialog_file_statistics();
_("_Anonymize")
);
- if( result == GTK_RESPONSE_CANCEL )
- return;
-
- hbfile_anonymize();
- ui_mainwindow_update(GLOBALS->mainwindow, GINT_TO_POINTER(UF_TITLE+UF_SENSITIVE+UF_REFRESHALL));
+ //#1707201
+ //if( result == GTK_RESPONSE_CANCEL )
+ // return;
+ if( result == GTK_RESPONSE_OK )
+ {
+ hbfile_anonymize();
+ ui_mainwindow_update(GLOBALS->mainwindow, GINT_TO_POINTER(UF_TITLE+UF_SENSITIVE+UF_REFRESHALL));
+ }
}
}
+
static void ui_mainwindow_action_export(void)
{
gchar *filename;
}
}
+
static void ui_mainwindow_action_help(void)
{
gchar *link;
link = g_build_filename("file:///", homebank_app_get_help_dir(), HOMEBANK_URL_HELP, NULL );
homebank_util_url_show (link);
+ g_free(link);
+}
+
+
+static void ui_mainwindow_action_help_releasenotes(void)
+{
+gchar *link;
+ #ifdef G_OS_WIN32
+ link = g_build_filename("file:///", homebank_app_get_datas_dir(), "ChangeLog.txt", NULL );
+ #else
+ link = g_build_filename("file:///", homebank_app_get_datas_dir(), "ChangeLog", NULL );
+ #endif
+ homebank_util_url_show (link);
g_free(link);
}
}
+static void ui_mainwindow_action_help_updates(void)
+{
+const gchar *link = HOMEBANK_URL_HELP_UPDATES;
+
+ homebank_util_url_show (link);
+}
+
static void ui_mainwindow_action_help_online(void)
{
const gchar *link = HOMEBANK_URL_HELP_ONLINE;
homebank_util_url_show (link);
-
}
+
static void ui_mainwindow_action_help_translate(void)
{
const gchar *link = HOMEBANK_URL_HELP_TRANSLATE;
homebank_util_url_show (link);
-
}
+
static void ui_mainwindow_action_help_problem(void)
{
const gchar *link = HOMEBANK_URL_HELP_PROBLEM;
homebank_util_url_show (link);
-
}
-
-
/* hbfile functions -------------------- */
-
-
/*
**
*/
gtk_list_store_clear(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_top))));
data->showall = FALSE;
+ ui_panel_accounts_setup(data);
hbfile_cleanup(file_clear);
hbfile_setup(file_clear);
if( result == GTK_RESPONSE_ADD )
{
ope = da_transaction_malloc();
- ope->date = date;
+ ope->date = date;
ope->kacc = account;
if( PREFS->heritdate == FALSE ) //fix: 318733
if(result == GTK_RESPONSE_ADD || result == GTK_RESPONSE_ADDKEEP || result == GTK_RESPONSE_ACCEPT)
{
deftransaction_get(window, NULL);
- transaction_add(ope, NULL, ope->kacc);
+ transaction_add(ope);
DB( g_print(" - added 1 transaction to %d\n", ope->kacc) );
};
-#define MAX_TOPSPENDING 5
+#define MAX_TOPSPENDING 10
static gint tmptop_compare_func(struct tmptop *tt1, struct tmptop *tt2)
{
Transaction *ope = list->data;
- //DB( g_print(" - eval txn: '%s', cat=%d ==> flt-test=%d\n", ope->wording, ope->kcat, filter_test(data->filter, ope)) );
+ //DB( g_print(" - eval txn: '%s', cat=%d ==> flt-test=%d\n", ope->memo, ope->kcat, filter_test(data->filter, ope)) );
if( !(ope->paymode == PAYMODE_INTXFER) )
{
if(acc)
trn_amount = hb_amount_base(ope->amount, acc->kcur);
- if( ope->flags & OF_SPLIT )
+ if( ope->flags & OF_SPLIT )
{
guint nbsplit = da_splits_count(ope->splits);
Split *split;
if(result == GTK_RESPONSE_ADD || result == GTK_RESPONSE_ACCEPT)
{
deftransaction_get(window, NULL);
- transaction_add(txn, NULL, txn->kacc);
+ transaction_add(txn);
GLOBALS->changes_count++;
scheduled_date_advance(arc);
{
struct hbfile_data *data = user_data;
+ DB( g_print("\n[ui-mainwindow] scheduled post\n") );
+
Archive *arc = ui_mainwindow_scheduled_get_selected_item(GTK_TREE_VIEW(data->LV_upc));
if( (arc != NULL) )
da_transaction_init_from_template(txn, arc);
txn->date = scheduled_get_postdate(arc, arc->nextdate);
- transaction_add(txn, NULL, 0);
+ transaction_add(txn);
GLOBALS->changes_count++;
scheduled_date_advance(arc);
if(arc)
{
- DB( g_print("archive is %s\n", arc->wording) );
+ DB( g_print("archive is %s\n", arc->memo) );
gtk_widget_set_sensitive(GTK_WIDGET(data->BT_sched_skip), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->BT_sched_post), TRUE);
nbdays = arc->nextdate - maxpostdate;
nblate = scheduled_get_latepost_count(arc, GLOBALS->today);
- DB( g_print(" - append '%s' : %d\n", arc->wording, nbdays) );
+ DB( g_print(" - append '%s' : %d\n", arc->memo, nbdays) );
if(arc->flags & OF_INCOME)
{
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
LST_DSPUPC_DATAS, arc,
LST_DSPUPC_ACCOUNT, acc,
- LST_DSPUPC_WORDING, arc->wording,
+ LST_DSPUPC_MEMO, arc->memo,
LST_DSPUPC_EXPENSE, exp,
LST_DSPUPC_INCOME, inc,
LST_DSPUPC_REMAINING, nbdays,
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
LST_DSPUPC_DATAS, arc,
LST_DSPUPC_ACCOUNT, acc,
- LST_DSPUPC_WORDING, arc->wording,
+ LST_DSPUPC_MEMO, arc->memo,
LST_DSPUPC_EXPENSE, -inc,
LST_DSPUPC_INCOME, -exp,
LST_DSPUPC_REMAINING, nbdays,
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
LST_DSPUPC_DATAS, NULL,
LST_DSPUPC_ACCOUNT, NULL,
- LST_DSPUPC_WORDING, _("Total"),
+ LST_DSPUPC_MEMO, _("Total"),
LST_DSPUPC_EXPENSE, totexp,
LST_DSPUPC_INCOME, totinc,
-1);
}
-
ui_mainwindow_scheduled_update(widget, NULL);
}
+gboolean ui_mainwindow_open_backup_check_confirm(gchar *filepath)
+{
+gboolean retval = FALSE;
+gchar *basename, *secondtext;
+gboolean result;
+
+ basename = g_path_get_basename(filepath);
+ secondtext = g_strdup_printf (
+ _("Your are about to open the backup file '%s'.\n\nAre you sure you want to do this ?"), basename);
+
+ result = ui_dialog_msg_confirm_alert(
+ GTK_WINDOW(GLOBALS->mainwindow),
+ _("Open a backup file ?"),
+ secondtext,
+ _("_Open backup")
+ );
+
+ g_free(secondtext);
+ g_free(basename);
+
+ if( result == GTK_RESPONSE_OK )
+ retval = TRUE;
+
+ return retval;
+}
/*
if( ui_dialog_msg_savechanges(widget,NULL) == TRUE )
{
- if(ui_file_chooser_xhb(GTK_FILE_CHOOSER_ACTION_OPEN, &filename) == TRUE)
+ if( ui_file_chooser_xhb(GTK_FILE_CHOOSER_ACTION_OPEN, &filename) == TRUE )
{
- hbfile_change_filepath(filename);
+ //#1710955 test for backup open
+ if( hbfile_file_isbackup(filename) )
+ {
+ if( ui_mainwindow_open_backup_check_confirm(filename) == TRUE )
+ {
+ GLOBALS->hbfile_is_bak = TRUE;
+ }
+ else
+ {
+ g_free(filename);
+ return;
+ }
+ }
+ hbfile_change_filepath(filename);
ui_mainwindow_open_internal(widget, NULL);
-
-
}
}
}
+
/*
* open the file stored in GLOBALS->xhb_filepath
*/
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- DB( g_print(" - filename: '%s'\n", GLOBALS->xhb_filepath) );
-
if( GLOBALS->xhb_filepath != NULL )
{
+ DB( g_print(" - filename: '%s'\n", GLOBALS->xhb_filepath) );
+
ui_mainwindow_clear(GLOBALS->mainwindow, GINT_TO_POINTER(FALSE));
GLOBALS->hbfile_is_new = FALSE;
}
+
/*
**
*/
if( GLOBALS->hbfile_is_new == TRUE )
saveas = 1;
+ //#1710955 test for backup open
+ if( GLOBALS->hbfile_is_bak == TRUE )
+ {
+ //todo: later for backup, should also remove datetime and .bak
+ hbfile_change_filepath(hb_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb"));
+ saveas = 1;
+ }
+
if(saveas == 1)
{
if(ui_file_chooser_xhb(GTK_FILE_CHOOSER_ACTION_SAVE, &filename) == TRUE)
homebank_backup_current_file();
r = homebank_save_xml(GLOBALS->xhb_filepath);
GLOBALS->hbfile_is_new = FALSE;
+ GLOBALS->hbfile_is_bak = FALSE;
}
else
return;
gchar *groupname;
gint nballoc;
+ DB( g_print("\n[ui-mainwindow] accounts_groups_get\n") );
+
nballoc = da_acc_length ();
+
+ DB( g_print(" %d accounts\n", nballoc) );
+
hash = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL);
elt = g_list_first(lacc);
while (elt != NULL)
Account *acc = elt->data;
GPtrArray *group;
- if( showall || !(acc->flags & (AF_CLOSED|AF_NOSUMMARY)) )
+ //#1674045 ony rely on nosummary
+ //if( showall || !(acc->flags & (AF_CLOSED|AF_NOSUMMARY)) )
+ if( showall || !(acc->flags & AF_NOSUMMARY) )
{
if( groupby == DSPACC_GROUP_BY_BANK )
{
gtbank = gttoday = gtfuture = 0;
- DB( g_print(" populate listview\n") );
+ DB( g_print(" - populate listview, %d group(s)\n", g_hash_table_size(h_group)) );
model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_acc));
gtk_tree_store_clear (GTK_TREE_STORE(model));
{
GPtrArray *gpa = value;
gdouble tbank, ttoday, tfuture;
+ gint position;
if(gpa != NULL)
{
nbtype++;
//1: Header: Bank, Cash, ...
- //DB( g_print(" - append type '%s'\n", CYA_ACC_TYPE[i]) );
- DB( g_print("\n - append type '%d'\n", key) );
+ DB( g_print(" - add group '%s'\n", (gchar *)key) );
+
+ //#1663399 keep type position like in dropdown
+ position = 0;
+ if( PREFS->pnl_acc_show_by == DSPACC_GROUP_BY_TYPE )
+ {
+ gint t = 0;
+
+ while(CYA_ACC_TYPE[t] != NULL && t < 15)
+ {
+ if( !strcmp(CYA_ACC_TYPE[t], key) )
+ break;
+ t++;
+ }
+
+ position = t;
+ }
gtk_tree_store_append (GTK_TREE_STORE(model), &iter1, NULL);
gtk_tree_store_set (GTK_TREE_STORE(model), &iter1,
+ LST_DSPACC_POS, position,
LST_DSPACC_DATATYPE, DSPACC_TYPE_HEADER,
LST_DSPACC_NAME, key,
-1);
ttoday += hb_amount_base(acc->bal_today, acc->kcur);
tfuture += hb_amount_base(acc->bal_future, acc->kcur);
- DB( g_print(" - insert '%s' :: %.2f %.2f %.2f\n", acc->name, acc->bal_bank, acc->bal_today, acc->bal_future) );
+ DB( g_print(" - add account '%s' :: %.2f %.2f %.2f\n", acc->name, acc->bal_bank, acc->bal_today, acc->bal_future) );
gtk_tree_store_append (GTK_TREE_STORE(model), &child_iter, &iter1);
gtk_tree_store_set (GTK_TREE_STORE(model), &child_iter,
if(gpa->len > 1)
{
- DB( g_print(" - type totals :: %.2f %.2f %.2f\n", tbank, ttoday, tfuture) );
+ DB( g_print(" - group total :: %.2f %.2f %.2f\n", tbank, ttoday, tfuture) );
// insert the total line
gtk_tree_store_append (GTK_TREE_STORE(model), &child_iter, &iter1);
}
/* set balance to header to display when collasped */
- DB( g_print(" - enrich totals to header :: %.2f %.2f %.2f\n", tbank, ttoday, tfuture) );
+ DB( g_print(" - enrich group total header :: %.2f %.2f %.2f\n", tbank, ttoday, tfuture) );
gtk_tree_store_set (GTK_TREE_STORE(model), &iter1,
LST_DSPACC_BANK, tbank,
LST_DSPACC_TODAY, ttoday,
}
- DB( g_print(" - grand totals :: %.2f %.2f %.2f\n", gtbank, gttoday, gtfuture) );
+ DB( g_print(" - grand total :: %.2f %.2f %.2f\n", gtbank, gttoday, gtfuture) );
// Grand total
if( nbtype > 1 )
struct hbfile_data *data;
gint flags;
- DB( g_print("\n[ui-mainwindow] refresh_display\n") );
+ DB( g_print("\n[ui-mainwindow] update %p\n", user_data) );
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
//data = INST_DATA(widget);
gchar *basename;
gchar *changed;
- DB( g_print(" + 1: wintitle %x\n", data->wintitle) );
+ DB( g_print(" 1: wintitle %p\n", data->wintitle) );
basename = g_path_get_basename(GLOBALS->xhb_filepath);
GtkTreePath *path;
gboolean active,sensitive;
- DB( g_print(" + 2: disabled, opelist count\n") );
+ DB( g_print(" 2: disabled, opelist count\n") );
//#1656531
data->acc = NULL;
/* update toolbar, list */
if(flags & UF_VISUAL)
{
- DB( g_print(" + 8: visual\n") );
+ DB( g_print(" 8: visual\n") );
if(PREFS->toolbar_style == 0)
gtk_toolbar_unset_style(GTK_TOOLBAR(data->toolbar));
if(flags & UF_BALANCE)
{
- DB( g_print(" + 4: balances\n") );
+ DB( g_print(" 4: balances\n") );
gtk_tree_view_columns_autosize (GTK_TREE_VIEW(data->LV_acc));
if(flags & UF_REFRESHALL)
{
- DB( g_print(" + 8: refreshall\n") );
+ DB( g_print(" 16: refreshall\n") );
ui_mainwindow_populate_accounts(GLOBALS->mainwindow, NULL);
ui_mainwindow_populate_topspending(GLOBALS->mainwindow, NULL);
}
}
+
+static void ui_mainwindow_destroy(GtkTreeView *treeview, gpointer user_data)
+{
+ DB( g_print("\n[ui-mainwindow] destroy\n") );
+
+}
+
+
/*
**
*/
struct WinGeometry *wg;
gboolean retval = FALSE;
- DB( g_print("\n[ui-mainwindow] dispose\n") );
+ DB( g_print("\n[ui-mainwindow] delete-event\n") );
//store position and size
wg = &PREFS->wal_wg;
}
else
{
- DB( g_print(" free wintitle %x\n", data->wintitle) );
-
+ //todo: retval is useless and below should move to destroy
+ retval = TRUE;
gtk_widget_destroy(data->LV_top);
g_free(data->wintitle);
da_filter_free(data->filter);
g_free(user_data);
+
gtk_main_quit();
}
-
-
- //delete-event TRUE abort/FALSE destroy
+ //TRUE:stop other handlers from being invoked for the event | FALSE: propagate
return retval;
}
static const GActionEntry actions[] = {
// { "paste", activate_action, NULL, NULL, NULL, {0,0,0} },
- { "showall" , activate_toggle, NULL, "false", NULL, {0,0,0} },
- { "groupby", activate_radio, "s", "'type'", NULL, {0,0,0} }
+ { "showall", activate_toggle, NULL, "false" , NULL, {0,0,0} },
+ { "groupby", activate_radio , "s", "'type'", NULL, {0,0,0} }
};
+static void ui_panel_accounts_setup(struct hbfile_data *data)
+{
+GAction *action;
+GVariant *new_state;
+
+ if( !G_IS_SIMPLE_ACTION_GROUP(data->action_group_acc) )
+ return;
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (data->action_group_acc), "showall");
+ if( action )
+ {
+ new_state = g_variant_new_boolean (data->showall);
+ g_simple_action_set_state (G_SIMPLE_ACTION(action), new_state);
+ }
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (data->action_group_acc), "groupby");
+ if( action )
+ {
+ const gchar *value = (PREFS->pnl_acc_show_by == DSPACC_GROUP_BY_TYPE) ? "type" : "bank";
+ new_state = g_variant_new_string (value);
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), new_state);
+ }
+
+}
+
+
static GtkWidget *ui_mainwindow_create_youraccounts(struct hbfile_data *data)
{
GtkWidget *panel, *label, *widget, *sw, *tbar, *hbox, *image;
//gmenu test (see test folder into gtk)
- widget = gtk_menu_button_new();
- gtk_menu_button_set_direction (GTK_MENU_BUTTON(widget), GTK_ARROW_UP);
- gtk_widget_set_halign (widget, GTK_ALIGN_END);
- image = gtk_image_new_from_icon_name (ICONNAME_EMBLEM_SYSTEM, GTK_ICON_SIZE_MENU);
- g_object_set (widget, "image", image, NULL);
-
- toolitem = gtk_tool_item_new();
- gtk_container_add (GTK_CONTAINER(toolitem), widget);
- gtk_toolbar_insert(GTK_TOOLBAR(tbar), GTK_TOOL_ITEM(toolitem), -1);
-
GMenu *menu, *section;
menu = g_menu_new ();
GSimpleActionGroup *group = g_simple_action_group_new ();
+ data->action_group_acc = group;
g_action_map_add_action_entries (G_ACTION_MAP (group), actions, G_N_ELEMENTS (actions), data);
- //init radio
- GAction *action = g_action_map_lookup_action (G_ACTION_MAP (group), "groupby");
- const gchar *value = (PREFS->pnl_acc_show_by == DSPACC_GROUP_BY_TYPE) ? "type" : "bank";
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_string (value));
- gtk_widget_insert_action_group (widget, "actions", G_ACTION_GROUP(group));
+ widget = gtk_menu_button_new();
+ gtk_menu_button_set_direction (GTK_MENU_BUTTON(widget), GTK_ARROW_UP);
+ gtk_widget_set_halign (widget, GTK_ALIGN_END);
+ image = gtk_image_new_from_icon_name (ICONNAME_EMBLEM_SYSTEM, GTK_ICON_SIZE_MENU);
+ g_object_set (widget, "image", image, NULL);
+ toolitem = gtk_tool_item_new();
+ gtk_container_add (GTK_CONTAINER(toolitem), widget);
+ gtk_toolbar_insert(GTK_TOOLBAR(tbar), GTK_TOOL_ITEM(toolitem), -1);
+
+ gtk_widget_insert_action_group (widget, "actions", G_ACTION_GROUP(group));
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (widget), G_MENU_MODEL (menu));
return panel;
//store our window private data
g_object_set_data(G_OBJECT(window), "inst_data", (gpointer)data);
- DB( g_print(" - new window=%x, inst_data=%0x\n", window, data) );
+ DB( g_print(" - new window=%p, inst_data=%p\n", window, data) );
// this is our mainwindow, so store it to GLOBALS data
data->window = window;
gtk_paned_pack1 (GTK_PANED(vpaned), hpaned, FALSE, FALSE);
widget = ui_mainwindow_scheduled_create(data);
- gtk_paned_pack2 (GTK_PANED(vpaned), widget, FALSE, FALSE);
+ gtk_paned_pack2 (GTK_PANED(vpaned), widget, TRUE, FALSE);
widget = ui_mainwindow_create_youraccounts(data);
+ //gtk_widget_set_size_request (widget, 100, -1);
gtk_paned_pack1 (GTK_PANED(hpaned), widget, FALSE, FALSE);
widget = ui_mainwindow_create_topspending(data);
- gtk_paned_pack2 (GTK_PANED(hpaned), widget, FALSE, FALSE);
-
-
- DB( g_print(" - vpaned=%d hpaned=%d\n", PREFS->wal_vpaned, PREFS->wal_hpaned) );
+ //gtk_widget_set_size_request (widget, -1, 100);
+ gtk_paned_pack2 (GTK_PANED(hpaned), widget, TRUE, FALSE);
- if(PREFS->wal_hpaned > 0)
- gtk_paned_set_position(GTK_PANED(data->hpaned), PREFS->wal_hpaned);
- if(PREFS->wal_vpaned > 0)
- gtk_paned_set_position(GTK_PANED(data->vpaned), PREFS->wal_vpaned);
//setup, init and show window
wg = &PREFS->wal_wg;
gtk_window_maximize(GTK_WINDOW(window));
gtk_widget_show_all (window);
-
+
+ //#1662197/1660910 moved after resize/show
+ DB( g_print(" - vpaned=%d hpaned=%d\n", PREFS->wal_vpaned, PREFS->wal_hpaned) );
+
+ if(PREFS->wal_hpaned > 0)
+ gtk_paned_set_position(GTK_PANED(data->hpaned), PREFS->wal_hpaned);
+ if(PREFS->wal_vpaned > 0)
+ gtk_paned_set_position(GTK_PANED(data->vpaned), PREFS->wal_vpaned);
+
//todo: move this elsewhere
DB( g_print(" - setup stuff\n") );
/* GtkWindow events */
g_signal_connect (window, "delete-event", G_CALLBACK (ui_mainwindow_dispose), (gpointer)data);
+ g_signal_connect (window, "destroy", G_CALLBACK (ui_mainwindow_destroy), NULL);
g_signal_connect (window, "screen-changed",