~mdoyen/homebank/trunk

« back to all changes in this revision

Viewing changes to src/ui-tag.c

  • Committer: Maxime Doyen
  • Date: 2023-01-12 17:58:52 UTC
  • Revision ID: homebank@free.fr-20230112175852-qtqy23vexam04fim
5.6.1 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  HomeBank -- Free, easy, personal accounting for everyone.
2
 
 *  Copyright (C) 1995-2022 Maxime DOYEN
 
2
 *  Copyright (C) 1995-2023 Maxime DOYEN
3
3
 *
4
4
 *  This file is part of HomeBank.
5
5
 *
19
19
 
20
20
#include "homebank.h"
21
21
 
 
22
#include "hb-tag.h"
22
23
#include "ui-tag.h"
23
24
 
24
25
 
56
57
GList *ltag, *list;
57
58
        
58
59
        //populate template
59
 
        hbtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), 0, "----");
60
 
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
 
60
        //hbtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combobox), 0, "----");
 
61
        //gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
61
62
 
62
63
        ltag = list = tag_glist_sorted(1);
63
64
        while (list != NULL)
74
75
 
75
76
                list = g_list_next(list);
76
77
        }
 
78
        
 
79
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
77
80
 
78
81
        g_list_free(ltag);
79
82
}
196
199
 
197
200
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
198
201
 
 
202
void ui_tag_listview_toggle_to_filter(GtkTreeView *treeview, Filter *filter)
 
203
{
 
204
GtkTreeModel *model;
 
205
GtkTreeIter     iter;
 
206
gboolean valid;
 
207
gboolean toggled;
 
208
 
 
209
        DB( g_print("(ui_tag_listview) toggle_to_filter\n") );
 
210
 
 
211
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
 
212
        //selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_tag));
 
213
        valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
 
214
        while (valid)
 
215
        {
 
216
        Tag *tagitem;
 
217
 
 
218
                gtk_tree_model_get (model, &iter,
 
219
                        LST_DEFTAG_TOGGLE, &toggled,
 
220
                        LST_DEFTAG_DATAS, &tagitem,
 
221
                        -1);
 
222
 
 
223
                DB( g_print(" get tag k:%3d = %d (%s)\n", tagitem->key, toggled, tagitem->name) );
 
224
                da_flt_status_tag_set(filter, tagitem->key, toggled);
 
225
                
 
226
                //tagitem->flt_select = toggled;
 
227
 
 
228
                /* Make iter point to the next row in the list store */
 
229
                valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
 
230
        }
 
231
}
 
232
 
199
233
 
200
234
static void
201
235
ui_tag_listview_toggled_cb (GtkCellRendererToggle *cell,
221
255
  gtk_tree_path_free (path);
222
256
}
223
257
 
 
258
void
 
259
ui_tag_listview_quick_select(GtkTreeView *treeview, const gchar *uri)
 
260
{
 
261
GtkTreeModel *model;
 
262
GtkTreeIter     iter;
 
263
gboolean valid;
 
264
gboolean toggle;
 
265
gint qselect = hb_clicklabel_to_int(uri);
 
266
 
 
267
        DB( g_print("(ui_acc_listview) quick select\n") );
 
268
 
 
269
 
 
270
        DB( g_print(" comboboxlink '%s' %d\n", uri, qselect) );
 
271
 
 
272
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
 
273
        valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
 
274
        while (valid)
 
275
        {
 
276
                switch(qselect)
 
277
                {
 
278
                        case HB_LIST_QUICK_SELECT_ALL:
 
279
                                gtk_list_store_set (GTK_LIST_STORE (model), &iter, LST_DEFTAG_TOGGLE, TRUE, -1);
 
280
                                break;
 
281
                        case HB_LIST_QUICK_SELECT_NONE:
 
282
                                gtk_list_store_set (GTK_LIST_STORE (model), &iter, LST_DEFTAG_TOGGLE, FALSE, -1);
 
283
                                break;
 
284
                        case HB_LIST_QUICK_SELECT_INVERT:
 
285
                                        gtk_tree_model_get (model, &iter, LST_DEFTAG_TOGGLE, &toggle, -1);
 
286
                                        toggle ^= 1;
 
287
                                        gtk_list_store_set (GTK_LIST_STORE (model), &iter, LST_DEFTAG_TOGGLE, toggle, -1);
 
288
                                break;
 
289
                }
 
290
                valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
 
291
        }
 
292
}
 
293
 
 
294
 
224
295
static gint
225
296
ui_tag_listview_compare_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
226
297
{
246
317
{
247
318
Tag *entry;
248
319
gchar *name;
249
 
#if MYDEBUG
250
 
gchar *string;
251
 
#endif
252
320
 
253
321
        gtk_tree_model_get(model, iter, LST_DEFTAG_DATAS, &entry, -1);
254
 
        if(entry->name == NULL)
255
 
                name = _("(none)");             // can never occurs !
 
322
        if(entry->key == 0)
 
323
                name = _("(no tag)");
256
324
        else
257
325
                name = entry->name;
258
326
 
259
 
        #if MYDEBUG
260
 
                string = g_strdup_printf ("[%d] %s", entry->key, name );
261
 
                g_object_set(renderer, "text", string, NULL);
262
 
                g_free(string);
263
 
        #else
264
 
                g_object_set(renderer, "text", name, NULL);
265
 
        #endif
266
 
 
267
 
}
 
327
        g_object_set(renderer, "text", name, NULL);
 
328
}
 
329
 
 
330
 
 
331
#if MYDEBUG == 1
 
332
static void
 
333
ui_tag_listview_cell_data_function_debugkey (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 
334
{
 
335
Tag *item;
 
336
gchar *string;
 
337
 
 
338
        gtk_tree_model_get(model, iter, LST_DEFTAG_DATAS, &item, -1);
 
339
        string = g_strdup_printf ("[%d]", item->key );
 
340
        g_object_set(renderer, "text", string, NULL);
 
341
        g_free(string);
 
342
}
 
343
#endif  
268
344
 
269
345
 
270
346
 
391
467
 
392
468
        gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (treeview), PREFS->grid_lines);
393
469
 
 
470
 
 
471
        #if MYDEBUG == 1
 
472
        column = gtk_tree_view_column_new();
 
473
        renderer = gtk_cell_renderer_text_new ();
 
474
        gtk_tree_view_column_pack_start(column, renderer, TRUE);
 
475
        gtk_tree_view_column_set_cell_data_func(column, renderer, ui_tag_listview_cell_data_function_debugkey, NULL, NULL);
 
476
        gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
 
477
        #endif
 
478
 
 
479
 
394
480
        // column 1: toggle
395
481
        if( withtoggle == TRUE )
396
482
        {
401
487
                                                             NULL);
402
488
                gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
403
489
 
 
490
                gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE);
 
491
 
404
492
                g_signal_connect (renderer, "toggled",
405
493
                            G_CALLBACK (ui_tag_listview_toggled_cb), store);
406
494
 
 
495
                g_object_set_data(G_OBJECT(treeview), "togrdr_data", renderer);
407
496
        }
408
497
 
409
498
        // column 2: name
469
558
}
470
559
 
471
560
 
 
561
static void
 
562
ui_tag_manage_dialog_load_csv( GtkWidget *widget, gpointer user_data)
 
563
{
 
564
struct ui_tag_manage_dialog_data *data = user_data;
 
565
gchar *filename = NULL;
 
566
gchar *error;
 
567
 
 
568
        //data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(GTK_WIDGET(widget), GTK_TYPE_WINDOW)), "inst_data");
 
569
 
 
570
        DB( g_print("(ui_tag_manage_dialog) load csv - data %p\n", data) );
 
571
 
 
572
        if( ui_file_chooser_csv(GTK_WINDOW(data->dialog), GTK_FILE_CHOOSER_ACTION_OPEN, &filename, NULL) == TRUE )
 
573
        {
 
574
                DB( g_print(" + filename is %s\n", filename) );
 
575
 
 
576
                if( !tag_load_csv(filename, &error) )
 
577
                {
 
578
                        ui_dialog_msg_infoerror(GTK_WINDOW(data->dialog), GTK_MESSAGE_ERROR,
 
579
                                        _("File format error"),
 
580
                                        _("The CSV file must contains the exact numbers of column,\nseparated by a semi-colon, please see the help for more details.")
 
581
                                        );
 
582
                }
 
583
 
 
584
                g_free( filename );
 
585
                ui_tag_listview_populate(data->LV_tag, 0);
 
586
        }
 
587
}
 
588
 
 
589
 
 
590
static void
 
591
ui_tag_manage_dialog_save_csv( GtkWidget *widget, gpointer user_data)
 
592
{
 
593
struct ui_tag_manage_dialog_data *data = user_data;
 
594
gchar *filename = NULL;
 
595
 
 
596
        DB( g_print("(ui_tag_manage_dialog) save csv\n") );
 
597
 
 
598
        //data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
 
599
 
 
600
        if( ui_file_chooser_csv(GTK_WINDOW(data->dialog), GTK_FILE_CHOOSER_ACTION_SAVE, &filename, NULL) == TRUE )
 
601
        {
 
602
                DB( g_print(" + filename is %s\n", filename) );
 
603
 
 
604
                tag_save_csv(filename);
 
605
                g_free( filename );
 
606
        }
 
607
}
 
608
 
 
609
 
472
610
 
473
611
/**
474
612
 * ui_tag_manage_dialog_add:
535
673
 
536
674
                item = da_tag_get( key );
537
675
 
538
 
                dialog = gtk_dialog_new_with_buttons (_("Edit..."),
 
676
                dialog = gtk_dialog_new_with_buttons (_("Edit Tag"),
539
677
                                                    GTK_WINDOW (data->dialog),
540
678
                                                    0,
541
679
                                                    _("_Cancel"),
703
841
                Tag *newtag;
704
842
                guint dsttagkey;
705
843
 
706
 
                        model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_tag));
707
 
                        gtk_list_store_clear (GTK_LIST_STORE(model));
708
 
 
709
844
                        dsttagkey = ui_tag_combobox_get_key(GTK_COMBO_BOX_TEXT(getwidget));
710
845
 
711
 
                        tag_move(srctag->key, dsttagkey);
712
 
 
713
 
                        newtag = da_tag_get(dsttagkey);
714
 
 
715
 
                        //#1771720: update count
716
 
                        newtag->usage_count += srctag->usage_count;
717
 
                        srctag->usage_count = 0;
718
 
 
719
 
                        // add the new tagee to listview
720
 
                        if(newtag)
721
 
                                ui_tag_listview_add(GTK_TREE_VIEW(data->LV_tag), newtag);
722
 
 
723
 
                        // delete the old tagee
724
 
                        if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton)) )
 
846
                        //do nothing if src = dst...
 
847
                        if( srctag->key != dsttagkey )
725
848
                        {
726
 
                                DB( g_print(" -> delete %d '%s'\n", srctag->key, srctag->name ) );
727
 
 
728
 
                                ui_tag_listview_remove_selected(GTK_TREE_VIEW(data->LV_tag));
729
 
                                da_tag_delete(srctag->key);
 
849
                                model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_tag));
 
850
                                gtk_list_store_clear (GTK_LIST_STORE(model));
 
851
 
 
852
                                DB( g_print(" -> move cat to %d (subcat=%d)\n", dstcatkey, dosubcat) );
 
853
 
 
854
                                tag_move(srctag->key, dsttagkey);
 
855
 
 
856
                                newtag = da_tag_get(dsttagkey);
 
857
 
 
858
                                //#1771720: update count
 
859
                                newtag->usage_count += srctag->usage_count;
 
860
                                srctag->usage_count = 0;
 
861
 
 
862
                                // add the new tag to listview
 
863
                                if(newtag)
 
864
                                        ui_tag_listview_add(GTK_TREE_VIEW(data->LV_tag), newtag);
 
865
 
 
866
                                // delete the old tag
 
867
                                if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton)) )
 
868
                                {
 
869
                                        DB( g_print(" -> delete %d '%s'\n", srctag->key, srctag->name ) );
 
870
 
 
871
                                        ui_tag_listview_remove_selected(GTK_TREE_VIEW(data->LV_tag));
 
872
                                        da_tag_delete(srctag->key);
 
873
                                }
 
874
 
 
875
                                data->change++;
 
876
 
 
877
                                ui_tag_listview_populate(data->LV_tag, 0);
730
878
                        }
731
 
 
732
 
 
733
 
                        data->change++;
734
 
 
735
 
                        ui_tag_listview_populate(data->LV_tag, 0);
736
879
                }
737
880
 
738
881
                // cleanup and destroy
739
882
                gtk_widget_destroy (dialog);
740
883
        }
741
 
 
742
884
}
743
885
 
744
886
 
844
986
}
845
987
 
846
988
 
 
989
static void ui_tag_manage_setup(struct ui_tag_manage_dialog_data *data)
 
990
{
 
991
 
 
992
        DB( g_print("\n[ui-tag] setup\n") );
 
993
 
 
994
        DB( g_print(" init data\n") );
 
995
        data->change = 0;
 
996
 
 
997
        DB( g_print(" populate\n") );
 
998
        //tag_fill_usage();
 
999
        ui_tag_listview_populate(data->LV_tag, 0);
 
1000
 
 
1001
 
 
1002
        //DB( g_print(" set widgets default\n") );
 
1003
 
 
1004
        DB( g_print(" connect widgets signals\n") );
 
1005
 
 
1006
        g_object_bind_property (data->BT_add, "active", data->RE_addreveal, "reveal-child", G_BINDING_BIDIRECTIONAL);
 
1007
 
 
1008
        g_signal_connect (G_OBJECT (data->ST_name), "activate", G_CALLBACK (ui_tag_manage_dialog_add), NULL);
 
1009
        g_signal_connect(G_OBJECT(data->ST_name), "insert-text", G_CALLBACK(ui_tag_manage_filter_text_handler), NULL);
 
1010
        
 
1011
        g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_tag)), "changed", G_CALLBACK (ui_tag_manage_dialog_selection), NULL);
 
1012
        g_signal_connect (GTK_TREE_VIEW(data->LV_tag), "row-activated", G_CALLBACK (ui_tag_manage_dialog_onRowActivated), NULL);
 
1013
 
 
1014
        g_signal_connect (G_OBJECT (data->BT_edit), "clicked", G_CALLBACK (ui_tag_manage_dialog_edit), NULL);
 
1015
        g_signal_connect (G_OBJECT (data->BT_merge), "clicked", G_CALLBACK (ui_tag_manage_dialog_merge), NULL);
 
1016
        g_signal_connect (G_OBJECT (data->BT_delete), "clicked", G_CALLBACK (ui_tag_manage_dialog_delete), NULL);
 
1017
 
 
1018
}
 
1019
 
 
1020
 
 
1021
static gboolean
 
1022
ui_tag_manage_mapped (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
1023
{
 
1024
struct ui_tag_manage_dialog_data *data;
 
1025
 
 
1026
        data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
 
1027
 
 
1028
        DB( g_print("\n(ui_tag_manage_mapped)\n") );
 
1029
 
 
1030
        ui_tag_manage_setup(data);
 
1031
        ui_tag_manage_dialog_update(data->LV_tag, NULL);
 
1032
 
 
1033
        return FALSE;
 
1034
}
 
1035
 
 
1036
 
847
1037
GtkWidget *ui_tag_manage_dialog (void)
848
1038
{
849
1039
struct ui_tag_manage_dialog_data *data;
850
1040
GtkWidget *dialog, *content, *mainvbox, *box, *bbox, *tbar, *treeview, *scrollwin, *table, *addreveal;
 
1041
GtkWidget *menu, *menuitem, *widget, *image;
851
1042
GtkToolItem *toolitem;
852
1043
gint w, h, dw, dh, row;
853
1044
 
868
1059
        //gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
869
1060
        
870
1061
        data->dialog = dialog;
871
 
        data->change = 0;
872
1062
 
873
1063
        //set a nice dialog size
874
1064
        gtk_window_get_size(GTK_WINDOW(GLOBALS->mainwindow), &w, &h);
883
1073
        g_object_set_data(G_OBJECT(dialog), "inst_data", (gpointer)data);
884
1074
        DB( g_print("(ui_tag_manage_dialog) dialog=%p, inst_data=%p\n", dialog, data) );
885
1075
 
886
 
    g_signal_connect (dialog, "destroy",
887
 
                        G_CALLBACK (gtk_widget_destroyed), &dialog);
888
1076
 
889
1077
        //dialog contents
890
1078
        content = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
904
1092
        //test headerbar
905
1093
        //content = gtk_dialog_get_header_bar(GTK_DIALOG (dialog));
906
1094
 
 
1095
        menu = gtk_menu_new ();
 
1096
        gtk_widget_set_halign (menu, GTK_ALIGN_END);
 
1097
 
 
1098
        menuitem = gtk_menu_item_new_with_mnemonic (_("_Import CSV"));
 
1099
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
1100
        g_signal_connect (G_OBJECT (menuitem), "activate", G_CALLBACK (ui_tag_manage_dialog_load_csv), data);
 
1101
 
 
1102
        menuitem = gtk_menu_item_new_with_mnemonic (_("E_xport CSV"));
 
1103
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
1104
        g_signal_connect (G_OBJECT (menuitem), "activate", G_CALLBACK (ui_tag_manage_dialog_save_csv), data);
 
1105
        
 
1106
        //menuitem = gtk_separator_menu_item_new();
 
1107
        //gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
1108
        
 
1109
        //menuitem = gtk_menu_item_new_with_mnemonic (_("_Delete unused"));
 
1110
        //gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
1111
        //g_signal_connect (G_OBJECT (menuitem), "activate", G_CALLBACK (ui_pay_manage_dialog_delete_unused), data);
 
1112
        
 
1113
        gtk_widget_show_all (menu);
 
1114
 
 
1115
        widget = gtk_menu_button_new();
 
1116
        image = gtk_image_new_from_icon_name (ICONNAME_HB_BUTTON_MENU, GTK_ICON_SIZE_MENU);
 
1117
        g_object_set (widget, "image", image, "popup", GTK_MENU(menu),  NULL);
 
1118
        gtk_widget_set_halign (widget, GTK_ALIGN_END);
 
1119
        gtk_box_pack_end(GTK_BOX (bbox), widget, FALSE, FALSE, 0);
 
1120
        //gtk_header_bar_pack_end(GTK_HEADER_BAR (content), widget);
 
1121
        
907
1122
        // list
908
1123
        row++;
909
1124
        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
931
1146
        gtk_container_add (GTK_CONTAINER(toolitem), bbox);
932
1147
        gtk_toolbar_insert(GTK_TOOLBAR(tbar), GTK_TOOL_ITEM(toolitem), -1);
933
1148
 
934
 
        data->BT_add = make_image_toggle_button(ICONNAME_LIST_ADD, _("Add"));
935
 
        gtk_container_add (GTK_CONTAINER (bbox), data->BT_add);
936
 
 
937
 
        //todo: useless ?
938
 
        data->BT_edit = make_image_button(ICONNAME_LIST_EDIT, _("Edit"));
939
 
        gtk_container_add (GTK_CONTAINER (bbox), data->BT_edit);
940
 
 
941
 
        data->BT_merge = make_image_button(ICONNAME_HB_LIST_MERGE, _("Move/Merge"));
942
 
        gtk_container_add (GTK_CONTAINER (bbox), data->BT_merge);
943
 
 
944
 
        data->BT_delete = make_image_button(ICONNAME_LIST_DELETE, _("Delete"));
945
 
        gtk_container_add (GTK_CONTAINER (bbox), data->BT_delete);
 
1149
                data->BT_add = make_image_toggle_button(ICONNAME_LIST_ADD, _("Add"));
 
1150
                gtk_container_add (GTK_CONTAINER (bbox), data->BT_add);
 
1151
 
 
1152
                data->BT_delete = make_image_button(ICONNAME_LIST_DELETE, _("Delete"));
 
1153
                gtk_container_add (GTK_CONTAINER (bbox), data->BT_delete);
 
1154
 
 
1155
        toolitem = gtk_separator_tool_item_new ();
 
1156
        //gtk_tool_item_set_expand (toolitem, TRUE);
 
1157
        gtk_separator_tool_item_set_draw(GTK_SEPARATOR_TOOL_ITEM(toolitem), FALSE);
 
1158
        gtk_toolbar_insert(GTK_TOOLBAR(tbar), GTK_TOOL_ITEM(toolitem), -1);
 
1159
 
 
1160
        bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
1161
        toolitem = gtk_tool_item_new();
 
1162
        gtk_container_add (GTK_CONTAINER(toolitem), bbox);
 
1163
        gtk_toolbar_insert(GTK_TOOLBAR(tbar), GTK_TOOL_ITEM(toolitem), -1);
 
1164
 
 
1165
                data->BT_edit = make_image_button(ICONNAME_LIST_EDIT, _("Edit"));
 
1166
                gtk_container_add (GTK_CONTAINER (bbox), data->BT_edit);
 
1167
 
 
1168
                data->BT_merge = make_image_button(ICONNAME_HB_LIST_MERGE, _("Move/Merge"));
 
1169
                gtk_container_add (GTK_CONTAINER (bbox), data->BT_merge);
946
1170
 
947
1171
        row++;
948
1172
        addreveal = gtk_revealer_new ();
 
1173
        data->RE_addreveal = addreveal;
949
1174
        gtk_grid_attach (GTK_GRID (table), addreveal, 0, row, 2, 1);
950
1175
        data->ST_name = gtk_entry_new ();
951
1176
        gtk_entry_set_placeholder_text(GTK_ENTRY(data->ST_name), _("new tag") );
952
1177
        gtk_widget_set_hexpand (data->ST_name, TRUE);
953
1178
        gtk_container_add(GTK_CONTAINER(addreveal), data->ST_name);
954
 
 
955
 
        
956
 
        
957
 
        //connect all our signals
958
 
        g_object_bind_property (data->BT_add, "active", addreveal, "reveal-child", G_BINDING_BIDIRECTIONAL);
959
 
 
960
 
        g_signal_connect (G_OBJECT (data->ST_name), "activate", G_CALLBACK (ui_tag_manage_dialog_add), NULL);
961
 
        g_signal_connect(G_OBJECT(data->ST_name), "insert-text", G_CALLBACK(ui_tag_manage_filter_text_handler), NULL);
962
 
        
963
 
        g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_tag)), "changed", G_CALLBACK (ui_tag_manage_dialog_selection), NULL);
964
 
        g_signal_connect (GTK_TREE_VIEW(data->LV_tag), "row-activated", G_CALLBACK (ui_tag_manage_dialog_onRowActivated), NULL);
965
 
 
966
 
        g_signal_connect (G_OBJECT (data->BT_edit), "clicked", G_CALLBACK (ui_tag_manage_dialog_edit), NULL);
967
 
        g_signal_connect (G_OBJECT (data->BT_merge), "clicked", G_CALLBACK (ui_tag_manage_dialog_merge), NULL);
968
 
        g_signal_connect (G_OBJECT (data->BT_delete), "clicked", G_CALLBACK (ui_tag_manage_dialog_delete), NULL);
969
 
 
970
 
        //setup, init and show dialog
971
 
        //tag_fill_usage();
972
 
        ui_tag_listview_populate(data->LV_tag, 0);
973
 
        ui_tag_manage_dialog_update(data->LV_tag, NULL);
974
 
 
 
1179
        
 
1180
        
 
1181
        // connect dialog signals
 
1182
        g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &dialog);
 
1183
        g_signal_connect (dialog, "map-event", G_CALLBACK (ui_tag_manage_mapped), &dialog);
 
1184
 
 
1185
        // show & run dialog
 
1186
        DB( g_print(" run dialog\n") );
975
1187
        gtk_widget_show_all (dialog);
976
1188
 
977
 
        //wait for the user
978
 
        gint result = gtk_dialog_run (GTK_DIALOG (dialog));
979
 
 
980
 
        switch (result)
981
 
    {
982
 
        case GTK_RESPONSE_ACCEPT:
983
 
           //do_application_specific_something ();
984
 
           break;
985
 
        default:
986
 
           //do_nothing_since_dialog_was_cancelled ();
987
 
           break;
988
 
    }
 
1189
        // wait for the user
 
1190
        gtk_dialog_run (GTK_DIALOG (dialog));
989
1191
 
990
1192
        // cleanup and destroy
991
1193
        GLOBALS->changes_count += data->change;