1
1
/* HomeBank -- Free, easy, personal accounting for everyone.
2
* Copyright (C) 1995-2015 Maxime DOYEN
2
* Copyright (C) 1995-2016 Maxime DOYEN
4
4
* This file is part of HomeBank.
200
200
gtk_entry_set_text(GTK_ENTRY(widget), "");
203
void ui_gtk_entry_replace_text(GtkWidget *widget, gchar **storage)
207
DB( g_print(" storage is '%p' at '%p'\n", *storage, storage) );
209
/* free any previous string */
210
if( *storage != NULL )
216
text = gtk_entry_get_text(GTK_ENTRY(widget));
217
*storage = g_strdup(text);
204
221
GtkWidget *make_label_group(gchar *str)
232
GtkWidget *make_label_widget(char *str)
234
GtkWidget *label = gtk_label_new_with_mnemonic (str);
236
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
237
gtk_widget_set_halign (label, GTK_ALIGN_END);
220
242
GtkWidget *make_label(char *str, gfloat xalign, gfloat yalign)
244
GtkWidget *label = gtk_label_new_with_mnemonic (str);
224
label = gtk_label_new_with_mnemonic (str);
246
//todo: deprecated in 3.14
225
247
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
248
//gtk_label_set_xalign(GTK_LABEL(label), xalign);
249
//gtk_label_set_yalign(GTK_LABEL(label), yalign);
238
261
entry = gtk_entry_new ();
239
262
gtk_editable_set_editable (GTK_EDITABLE(entry), FALSE);
240
263
g_object_set(entry, "xalign", xalign, NULL);
242
//entry = gtk_label_new(NULL);
243
//gtk_misc_set_padding (entry, 4, 2);
244
//gtk_misc_set_alignment(entry, xalign, 0.5);
409
GtkWidget *make_euro(GtkWidget *label)
428
GtkWidget *make_exchange_rate(GtkWidget *label)
411
430
GtkWidget *spinner;
412
431
GtkAdjustment *adj;
414
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, -G_MAXINT32, G_MAXINT32, 0.01, 1.0, 0.0);
433
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 99999, 0.01, 1.0, 0.0);
415
434
spinner = gtk_spin_button_new (adj, 1.0, 6);
416
435
//gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
417
436
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinner), TRUE);
843
862
** Make a paymode combobox widget
845
GtkWidget *make_paymode(GtkWidget *label)
866
paymode_set_sensitive (GtkCellLayout *cell_layout,
867
GtkCellRenderer *cell,
868
GtkTreeModel *tree_model,
876
path = gtk_tree_model_get_path (tree_model, iter);
877
indices = gtk_tree_path_get_indices (path);
878
sensitive = (indices[0] == PAYMODE_INTXFER) ? FALSE : TRUE;
879
gtk_tree_path_free (path);
882
g_object_set (cell, "sensitive", sensitive, NULL);
887
static GtkWidget *make_paymode_internal(GtkWidget *label, gboolean intxfer)
849
891
GtkWidget *combobox;
850
GtkCellRenderer *renderer;
892
GtkCellRenderer *renderer, *r1, *r2;
854
895
store = gtk_list_store_new (
861
901
combobox = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
864
renderer = gtk_cell_renderer_pixbuf_new();
903
renderer = r1 = gtk_cell_renderer_pixbuf_new();
865
904
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, FALSE);
866
905
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(combobox), renderer, "icon-name", LST_PAYMODE_ICONNAME);
868
renderer = gtk_cell_renderer_text_new();
907
renderer = r2 = gtk_cell_renderer_text_new();
869
908
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, FALSE);
870
909
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(combobox), renderer, "text", LST_PAYMODE_LABEL);
872
gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
912
if( intxfer == FALSE )
914
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
916
paymode_set_sensitive,
918
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
920
paymode_set_sensitive,
874
924
//populate our combobox model
875
925
for(i=0;i<NUM_PAYMODE_MAX;i++)
945
GtkWidget *make_paymode(GtkWidget *label)
947
return make_paymode_internal(label, TRUE);
950
GtkWidget *make_paymode_nointxfer(GtkWidget *label)
952
return make_paymode_internal(label, FALSE);
892
956
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
894
958
#define NUM_NAINEX_MAX 3