import homebank-5.2.6
[chaz/homebank] / src / ui-txn-multi.c
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2019 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "homebank.h"
21
22 #include "ui-txn-multi.h"
23
24 #include "ui-account.h"
25 #include "ui-payee.h"
26 #include "ui-category.h"
27 #include "gtk-dateentry.h"
28 #include "list-operation.h"
29
30
31 /****************************************************************************/
32 /* Debug macros */
33 /****************************************************************************/
34 #define MYDEBUG 0
35
36 #if MYDEBUG
37 #define DB(x) (x);
38 #else
39 #define DB(x);
40 #endif
41
42 /* our global datas */
43 extern struct HomeBank *GLOBALS;
44 extern struct Preferences *PREFS;
45
46
47 void ui_multipleedit_dialog_prefill( GtkWidget *widget, Transaction *ope, gint column_id )
48 {
49 struct ui_multipleedit_dialog_data *data;
50 gchar *tagstr;
51
52 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
53
54 DB( g_print ("\n[ui-multipleedit] prefill\n") );
55
56 if(ope != NULL)
57 //if(col_id >= LST_DSPOPE_DATE && col_id != LST_DSPOPE_BALANCE)
58 {
59 switch( column_id )
60 {
61 case LST_DSPOPE_DATE:
62 gtk_date_entry_set_date(GTK_DATE_ENTRY(data->PO_date), (guint)ope->date);
63 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_date), TRUE);
64 break;
65 case LST_DSPOPE_AMOUNT:
66 case LST_DSPOPE_EXPENSE:
67 case LST_DSPOPE_INCOME:
68 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->ST_amount), ope->amount);
69 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_amount), TRUE);
70 break;
71 case LST_DSPOPE_INFO:
72 gtk_combo_box_set_active(GTK_COMBO_BOX(data->NU_mode), ope->paymode);
73 gtk_entry_set_text(GTK_ENTRY(data->ST_info), (ope->info != NULL) ? ope->info : "");
74 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_mode), TRUE);
75 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_info), TRUE);
76 break;
77 case LST_DSPOPE_PAYEE:
78 ui_pay_comboboxentry_set_active(GTK_COMBO_BOX(data->PO_pay), ope->kpay);
79 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_pay), TRUE);
80 break;
81 case LST_DSPOPE_MEMO:
82 gtk_entry_set_text(GTK_ENTRY(data->ST_memo), (ope->memo != NULL) ? ope->memo : "");
83 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_memo), TRUE);
84 break;
85 case LST_DSPOPE_CATEGORY:
86 ui_cat_comboboxentry_set_active(GTK_COMBO_BOX(data->PO_cat), ope->kcat);
87 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_cat), TRUE);
88 break;
89 case LST_DSPOPE_TAGS:
90 tagstr = tags_tostring(ope->tags);
91 gtk_entry_set_text(GTK_ENTRY(data->ST_tags), (tagstr != NULL) ? tagstr : "");
92 g_free(tagstr);
93 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data->CM_tags), TRUE);
94 break;
95 }
96 }
97 }
98
99
100 static void ui_multipleedit_dialog_update( GtkWidget *widget, gpointer user_data )
101 {
102 struct ui_multipleedit_dialog_data *data;
103
104 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
105
106 DB( g_print ("\n[ui-multipleedit] update\n") );
107
108 if(data->PO_date)
109 gtk_widget_set_sensitive (data->PO_date, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_date)) );
110
111 if(data->ST_amount)
112 gtk_widget_set_sensitive (data->ST_amount , gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_amount )) );
113
114 if(data->NU_mode && data->ST_info)
115 {
116 gtk_widget_set_sensitive (data->NU_mode, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_mode)) );
117 gtk_widget_set_sensitive (data->ST_info, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_info)) );
118 }
119
120 if(data->PO_acc)
121 gtk_widget_set_sensitive (data->PO_acc , gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_acc )) );
122
123 if(data->PO_pay)
124 gtk_widget_set_sensitive (data->PO_pay , gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_pay )) );
125
126 if(data->PO_cat)
127 gtk_widget_set_sensitive (data->PO_cat , gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_cat )) );
128
129 if(data->ST_tags)
130 gtk_widget_set_sensitive (data->ST_tags, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_tags)) );
131
132 if(data->ST_memo)
133 gtk_widget_set_sensitive (data->ST_memo, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_memo)) );
134 }
135
136
137 static void ui_multipleedit_dialog_init( GtkWidget *widget, gpointer user_data )
138 {
139 struct ui_multipleedit_dialog_data *data;
140 GtkTreeModel *model;
141 GList *selection, *list;
142
143 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
144
145 DB( g_print ("\n[ui-multipleedit] init\n") );
146
147 model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->treeview));
148 selection = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)), &model);
149
150 data->has_xfer = FALSE;
151
152 list = g_list_last(selection);
153 while(list != NULL)
154 {
155 Transaction *entry;
156 GtkTreeIter iter;
157
158 gtk_tree_model_get_iter(model, &iter, list->data);
159 gtk_tree_model_get(model, &iter, MODEL_TXN_POINTER, &entry, -1);
160
161 if(entry->paymode == PAYMODE_INTXFER)
162 data->has_xfer = TRUE;
163
164 list = g_list_previous(list);
165 }
166
167 g_list_foreach(selection, (GFunc)gtk_tree_path_free, NULL);
168 g_list_free(selection);
169
170 }
171
172
173 gint ui_multipleedit_dialog_apply( GtkWidget *widget, gboolean *do_sort )
174 {
175 struct ui_multipleedit_dialog_data *data;
176 GtkTreeModel *model;
177 GList *selection, *list;
178 gboolean tmp_sort = FALSE;
179 guint changes;
180
181 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
182
183 DB( g_print ("\n[ui-multipleedit] apply\n") );
184
185 changes = GLOBALS->changes_count;
186
187 model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->treeview));
188 selection = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)), &model);
189
190 list = g_list_last(selection);
191 while(list != NULL)
192 {
193 Transaction *txn;
194 GtkTreeIter iter;
195 const gchar *txt;
196 gboolean change = FALSE;
197
198 gtk_tree_model_get_iter(model, &iter, list->data);
199 gtk_tree_model_get(model, &iter, MODEL_TXN_POINTER, &txn, -1);
200
201 DB( g_print(" modifying %s %.2f\n", txn->memo, txn->amount) );
202
203 //TODO: this is always true
204 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_DATE) == TRUE )
205 {
206 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_date)) )
207 {
208 guint32 olddate = txn->date;
209
210 txn->date = gtk_date_entry_get_date(GTK_DATE_ENTRY(data->PO_date));
211 DB( g_print(" -> date: '%d'\n", txn->date) );
212
213 //#1270687/1792808: sort if date changed
214 if(olddate != txn->date)
215 tmp_sort = TRUE;
216
217 change = TRUE;
218 }
219 }
220
221 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_AMOUNT) == TRUE
222 || list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_EXPENSE) == TRUE
223 || list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_INCOME) == TRUE )
224 {
225 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_amount)) )
226 {
227 txn->amount = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->ST_amount));
228 change = TRUE;
229 }
230 }
231
232 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_INFO) == TRUE )
233 {
234 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_mode)) )
235 {
236 txn->paymode = gtk_combo_box_get_active(GTK_COMBO_BOX(data->NU_mode));
237 change = TRUE;
238 }
239
240 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_info)) )
241 {
242 if(txn->info)
243 {
244 g_free(txn->info);
245 txn->info = NULL;
246 change = TRUE;
247 }
248
249 txt = gtk_entry_get_text(GTK_ENTRY(data->ST_info));
250 if (txt && *txt)
251 {
252 txn->info = g_strdup(txt);
253 change = TRUE;
254 }
255 }
256 }
257
258 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_acc)) )
259 {
260 guint32 nkacc = ui_acc_comboboxentry_get_key(GTK_COMBO_BOX(data->PO_acc));
261
262 if( transaction_acc_move(txn, txn->kacc, nkacc) )
263 {
264 GtkTreeIter iter;
265
266 DB( g_print(" -> acc: '%d'\n", nkacc) );
267 gtk_tree_model_get_iter(model, &iter, list->data);
268 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
269 change = TRUE;
270 }
271 }
272
273 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_PAYEE) == TRUE )
274 {
275 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_pay)) )
276 {
277 txn->kpay = ui_pay_comboboxentry_get_key_add_new(GTK_COMBO_BOX(data->PO_pay));
278 DB( g_print(" -> payee: '%d'\n", txn->kpay) );
279 change = TRUE;
280 }
281 }
282
283 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_CATEGORY) == TRUE )
284 {
285 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_cat)) )
286 {
287 if(!(txn->flags & OF_SPLIT))
288 {
289 txn->kcat = ui_cat_comboboxentry_get_key_add_new(GTK_COMBO_BOX(data->PO_cat));
290 DB( g_print(" -> category: '%d'\n", txn->kcat) );
291 change = TRUE;
292 }
293 }
294 }
295
296 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_TAGS) == TRUE )
297 {
298 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_tags)) )
299 {
300 txt = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_tags));
301 if (txt && *txt)
302 {
303 g_free(txn->tags);
304 txn->tags = tags_parse(txt);
305 DB( g_print(" -> tags: '%s'\n", txt) );
306 change = TRUE;
307 }
308 }
309 }
310
311 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_MEMO) == TRUE )
312 {
313 if( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->CM_memo)) )
314 {
315 if(txn->memo)
316 {
317 g_free(txn->memo);
318 txn->memo = NULL;
319 change = TRUE;
320 }
321
322 txt = gtk_entry_get_text(GTK_ENTRY(data->ST_memo));
323 if (txt && *txt)
324 {
325 txn->memo = g_strdup(txt);
326 change = TRUE;
327 }
328 }
329 }
330
331 if( change == TRUE )
332 {
333 txn->flags |= OF_CHANGED;
334 GLOBALS->changes_count++;
335 }
336
337 if( data->has_xfer && txn->paymode == PAYMODE_INTXFER )
338 {
339 Transaction *child;
340 child = transaction_xfer_child_strong_get(txn);
341 transaction_xfer_child_sync(txn, child);
342 }
343
344 list = g_list_previous(list);
345 }
346
347 g_list_foreach(selection, (GFunc)gtk_tree_path_free, NULL);
348 g_list_free(selection);
349
350 if( do_sort != NULL )
351 *do_sort = tmp_sort;
352
353 return GLOBALS->changes_count - changes;
354 }
355
356
357 static gboolean ui_multipleedit_dialog_destroy( GtkWidget *widget, gpointer user_data )
358 {
359 struct ui_multipleedit_dialog_data *data;
360
361 data = g_object_get_data(G_OBJECT(widget), "inst_data");
362
363 DB( g_print ("\n[ui-multipleedit] destroy event occurred\n") );
364
365 g_free(data);
366 return FALSE;
367 }
368
369
370 GtkWidget *ui_multipleedit_dialog_new(GtkWindow *parent, GtkTreeView *treeview)
371 {
372 struct ui_multipleedit_dialog_data *data;
373 GtkWidget *dialog, *content_area;
374 GtkWidget *group_grid, *label, *widget, *toggle;
375 gint row;
376
377 DB( g_print ("\n[ui-multipleedit] new\n") );
378
379 data = g_malloc0(sizeof(struct ui_multipleedit_dialog_data));
380
381 dialog = gtk_dialog_new_with_buttons (NULL,
382 GTK_WINDOW (parent),
383 0,
384 _("_Cancel"),
385 GTK_RESPONSE_REJECT,
386 _("_OK"),
387 GTK_RESPONSE_ACCEPT,
388 NULL);
389
390 //g_signal_connect (dialog, "delete_event", G_CALLBACK (register_panel_dispose), (gpointer)data);
391 g_signal_connect (dialog, "destroy", G_CALLBACK (ui_multipleedit_dialog_destroy), (gpointer)data);
392
393 //store our window private data
394 g_object_set_data(G_OBJECT(dialog), "inst_data", (gpointer)data);
395 DB( g_print(" - new window=%p, inst_data=%p\n", dialog, data) );
396
397 data->window = dialog;
398 data->treeview = treeview;
399
400 ui_multipleedit_dialog_init(dialog, NULL);
401
402
403 gtk_window_set_title (GTK_WINDOW (data->window), _("Multiple edit transactions"));
404
405 content_area = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
406
407 group_grid = gtk_grid_new ();
408 gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
409 gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
410 gtk_container_set_border_width (GTK_CONTAINER(group_grid), SPACING_MEDIUM);
411 gtk_container_add (GTK_CONTAINER (content_area), group_grid);
412
413 row = -1;
414
415 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_DATE) == TRUE )
416 {
417 row++;
418 label = make_label_widget(_("_Date:"));
419 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
420 widget = gtk_check_button_new();
421 data->CM_date = widget;
422 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
423 widget = gtk_date_entry_new();
424 data->PO_date = widget;
425 gtk_widget_set_hexpand (widget, TRUE);
426 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
427
428 g_signal_connect (data->CM_date , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
429 }
430
431 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_AMOUNT) == TRUE
432 || list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_EXPENSE) == TRUE
433 || list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_INCOME) == TRUE )
434 {
435 row++;
436 label = make_label_widget(_("_Amount:"));
437 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
438 widget = gtk_check_button_new();
439 data->CM_amount = widget;
440 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
441 widget = make_amount(label);
442 data->ST_amount = widget;
443 gtk_widget_set_hexpand (widget, TRUE);
444 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
445
446 g_signal_connect (data->CM_amount , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
447 }
448
449 row++;
450 label = make_label_widget(_("A_ccount:"));
451 data->LB_acc = label;
452 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
453 widget = gtk_check_button_new();
454 data->CM_acc = widget;
455 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
456 widget = ui_acc_comboboxentry_new(label);
457 data->PO_acc = widget;
458 gtk_widget_set_hexpand (widget, TRUE);
459 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
460
461 g_signal_connect (data->CM_acc , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
462
463 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_INFO) == TRUE )
464 {
465 row++;
466 label = make_label_widget(_("Pa_yment:"));
467 data->LB_mode = label;
468 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
469 toggle = gtk_check_button_new();
470 data->CM_mode = toggle;
471 gtk_grid_attach (GTK_GRID (group_grid), toggle, 1, row, 1, 1);
472 widget = make_paymode_nointxfer (label);
473 data->NU_mode = widget;
474 gtk_widget_set_hexpand (widget, TRUE);
475 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
476
477 g_signal_connect (data->CM_mode , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
478
479 row++;
480 label = make_label_widget(_("_Info:"));
481 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
482 widget = gtk_check_button_new();
483 data->CM_info = widget;
484 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
485 widget = make_string(label);
486 data->ST_info = widget;
487 gtk_widget_set_hexpand (widget, TRUE);
488 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
489
490 g_signal_connect (data->CM_info , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
491 }
492
493 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_PAYEE) == TRUE )
494 {
495 row++;
496 label = make_label_widget(_("_Payee:"));
497 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
498 widget = gtk_check_button_new();
499 data->CM_pay = widget;
500 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
501 widget = ui_pay_comboboxentry_new(label);
502 data->PO_pay = widget;
503 gtk_widget_set_hexpand (widget, TRUE);
504 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
505
506 g_signal_connect (data->CM_pay , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
507 }
508
509 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_CATEGORY) == TRUE )
510 {
511 row++;
512 label = make_label_widget(_("_Category:"));
513 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
514 widget = gtk_check_button_new();
515 data->CM_cat = widget;
516 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
517 widget = ui_cat_comboboxentry_new(label);
518 data->PO_cat = widget;
519 gtk_widget_set_hexpand (widget, TRUE);
520 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
521
522 g_signal_connect (data->CM_cat , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
523 }
524
525 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_MEMO) == TRUE )
526 {
527 row++;
528 label = make_label_widget(_("M_emo:"));
529 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
530 widget = gtk_check_button_new();
531 data->CM_memo = widget;
532 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
533 widget = make_memo_entry(label);
534 data->ST_memo = widget;
535 gtk_widget_set_hexpand (widget, TRUE);
536 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
537
538 g_signal_connect (data->CM_memo , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
539 }
540
541 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_TAGS) == TRUE )
542 {
543 row++;
544 label = make_label_widget(_("Ta_gs:"));
545 gtk_grid_attach (GTK_GRID (group_grid), label, 0, row, 1, 1);
546 widget = gtk_check_button_new();
547 data->CM_tags = widget;
548 gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
549 widget = make_string(label);
550 data->ST_tags = widget;
551 gtk_widget_set_hexpand (widget, TRUE);
552 gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
553
554 g_signal_connect (data->CM_tags , "toggled", G_CALLBACK (ui_multipleedit_dialog_update), NULL);
555 }
556
557 ui_multipleedit_dialog_update(dialog, NULL);
558
559 ui_acc_comboboxentry_populate(GTK_COMBO_BOX(data->PO_acc), GLOBALS->h_acc, ACC_LST_INSERT_NORMAL);
560 ui_pay_comboboxentry_populate(GTK_COMBO_BOX(data->PO_pay), GLOBALS->h_pay);
561 ui_cat_comboboxentry_populate(GTK_COMBO_BOX(data->PO_cat), GLOBALS->h_cat);
562
563 gtk_widget_show_all (dialog);
564
565 if(data->has_xfer == TRUE)
566 {
567 hb_widget_visible (data->LB_acc, FALSE);
568 hb_widget_visible (data->CM_acc, FALSE);
569 hb_widget_visible (data->PO_acc, FALSE);
570 }
571
572 if( list_txn_column_id_isvisible(GTK_TREE_VIEW(data->treeview), LST_DSPOPE_INFO) == TRUE )
573 {
574 if(data->has_xfer == TRUE)
575 {
576 hb_widget_visible (data->LB_mode, FALSE);
577 hb_widget_visible (data->CM_mode, FALSE);
578 hb_widget_visible (data->NU_mode, FALSE);
579 }
580 }
581
582 return dialog;
583 }
This page took 0.081054 seconds and 4 git commands to generate.