~mdoyen/homebank/5.7.x

« back to all changes in this revision

Viewing changes to src/hb-account.c

  • Committer: Maxime Doyen
  • Date: 2023-09-06 19:22:10 UTC
  • Revision ID: homebank@free.fr-20230906192210-kal1pe00sty1jt2g
5.7 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
                g_free(item->number);
51
51
                g_free(item->bankname);
52
52
                g_free(item->notes);
 
53
                g_free(item->website);
53
54
                
54
55
                g_free(item->xferexpname);
55
56
                g_free(item->xferincname);
396
397
        return hb_string_utf8_compare(a->name, b->name);
397
398
}
398
399
 
399
 
 
400
400
static gint
401
401
account_glist_key_compare_func(Account *a, Account *b)
402
402
{
403
403
        return a->key - b->key;
404
404
}
405
405
 
 
406
static gint
 
407
account_glist_pos_compare_func(Account *a, Account *b)
 
408
{
 
409
        return a->pos - b->pos;
 
410
}
 
411
 
406
412
 
407
413
GList *account_glist_sorted(gint column)
408
414
{
409
415
GList *list = g_hash_table_get_values(GLOBALS->h_acc);
410
416
 
411
 
        if(column == 0)
412
 
                return g_list_sort(list, (GCompareFunc)account_glist_key_compare_func);
413
 
        else
414
 
                return g_list_sort(list, (GCompareFunc)account_glist_name_compare_func);
 
417
        switch(column)
 
418
        {
 
419
                case HB_GLIST_SORT_POS:
 
420
                        return g_list_sort(list, (GCompareFunc)account_glist_pos_compare_func);
 
421
                        break;
 
422
                case HB_GLIST_SORT_NAME:
 
423
                        return g_list_sort(list, (GCompareFunc)account_glist_name_compare_func);
 
424
                        break;
 
425
                //case HB_GLIST_SORT_KEY:
 
426
                default:
 
427
                        return g_list_sort(list, (GCompareFunc)account_glist_key_compare_func);
 
428
                        break;
 
429
        }
415
430
}
416
431
 
417
432
 
418
 
 
419
433
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
420
434
 
421
435
GtkWindow *
534
548
 
535
549
 
536
550
gboolean
 
551
account_has_website(Account *item)
 
552
{
 
553
gboolean retval = FALSE;
 
554
 
 
555
        if( item != NULL && item->website != NULL )
 
556
        {
 
557
                //TODO: reinforce controls here
 
558
                if( strlen(item->website) > 4 )
 
559
                        retval = TRUE;
 
560
        }
 
561
        return retval;
 
562
}
 
563
 
 
564
 
 
565
 
 
566
gboolean
537
567
account_exists(gchar *name)
538
568
{
539
569
Account *existitem;