Changeset 12669


Ignore:
Timestamp:
Aug 13, 2011, 5:03:18 AM (10 years ago)
Author:
jordan
Message:

(trunk gtk) simplify the implementation of get_details_dialog_key()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r12657 r12669  
    9393};
    9494
     95static void
     96gtr_window_present( GtkWindow * window )
     97{
     98    gtk_window_present_with_time( window, gtk_get_current_event_time( ) );
     99}
     100
    95101/***
    96102****
     
    99105***/
    100106
    101 static void
    102 gtr_window_present( GtkWindow * window )
    103 {
    104     gtk_window_present_with_time( window, gtk_get_current_event_time( ) );
    105 }
    106 
    107 /***
    108 ****
    109 ****  DETAILS DIALOGS MANAGEMENT
    110 ****
    111 ***/
    112 
    113107static int
    114 compare_integers( const void * a, const void * b )
    115 {
    116     return *(int*)a - *(int*)b;
     108compare_integers( gconstpointer a, gconstpointer b )
     109{
     110    return (int)a - (int)b;
    117111}
    118112
     
    120114get_details_dialog_key( GSList * id_list )
    121115{
    122     int i;
    123     int n;
    124     int * ids;
    125116    GSList * l;
     117    GSList * tmp = g_slist_sort( g_slist_copy( id_list ), compare_integers );
    126118    GString * gstr = g_string_new( NULL );
    127119
    128     n = g_slist_length( id_list );
    129     ids = g_new( int, n );
    130     i = 0;
    131     for( l=id_list; l!=NULL; l=l->next )
    132         ids[i++] = GPOINTER_TO_INT( l->data );
    133     g_assert( i == n );
    134     qsort( ids, n, sizeof(int), compare_integers );
    135 
    136     for( i=0; i<n; ++i )
    137         g_string_append_printf( gstr, "%d ", ids[i] );
    138 
    139     g_free( ids );
     120    for( l=tmp; l!=NULL; l=l->next )
     121        g_string_append_printf( gstr, "%d ", (int)l->data );
     122
     123    g_slist_free( tmp );
    140124    return g_string_free( gstr, FALSE );
    141125}
Note: See TracChangeset for help on using the changeset viewer.