Changeset 7464


Ignore:
Timestamp:
Dec 22, 2008, 5:39:03 AM (14 years ago)
Author:
charles
Message:

(trunk gtk) #1585: use g_timeout_add_seconds() where appropriate to group timers together for fewer scheduled wakeups

Location:
trunk/gtk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r7404 r7464  
    2929#include "util.h"
    3030
    31 #define UPDATE_INTERVAL_MSEC 2000
     31#define UPDATE_INTERVAL_SECONDS 2
    3232
    3333/****
     
    15301530    gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), n, TRUE, TRUE, 0 );
    15311531
    1532     tag = g_timeout_add ( UPDATE_INTERVAL_MSEC, periodic_refresh, d );
     1532    tag = gtr_timeout_add_seconds( UPDATE_INTERVAL_SECONDS, periodic_refresh, d );
    15331533    g_object_set_data_full ( G_OBJECT( d ), "tag",
    15341534                             GUINT_TO_POINTER( tag ), remove_tag );
  • trunk/gtk/file-list.c

    r7259 r7464  
    484484        refresh( data );
    485485
    486         data->timeout_tag = g_timeout_add( 2500, refreshModel, data );
     486        data->timeout_tag = gtr_timeout_add_seconds( 2, refreshModel, data );
    487487    }
    488488
  • trunk/gtk/main.c

    r7396 r7464  
    613613    /* start scheduled rate timer */
    614614    updateScheduledLimits ( tr_core_session( cbdata->core ) );
    615     g_timeout_add( 60 * 1000, updateScheduledLimits,
    616                   tr_core_session( cbdata->core ) );
     615    gtr_timeout_add_seconds( 60, updateScheduledLimits, tr_core_session( cbdata->core ) );
    617616
    618617    /* either show the window or iconify it */
  • trunk/gtk/msgwin.c

    r7404 r7464  
    544544    gtk_container_add( GTK_CONTAINER( win ), vbox );
    545545
    546     data->refresh_tag = g_timeout_add( 1666, onRefresh, data );
     546    data->refresh_tag = gtr_timeout_add_seconds( 2, onRefresh, data );
    547547    g_object_weak_ref( G_OBJECT( win ), onWindowDestroyed, data );
    548548
  • trunk/gtk/stats.c

    r7404 r7464  
    170170    g_object_set_data_full( G_OBJECT( d ), "data", ui, g_free );
    171171    g_signal_connect( d, "response", G_CALLBACK( dialogResponse ), ui );
    172     i = g_timeout_add( 1000, updateStats, ui );
     172    i = gtr_timeout_add_seconds( 1, updateStats, ui );
    173173    g_object_weak_ref( G_OBJECT( d ), dialogDestroyed, GUINT_TO_POINTER( i ) );
    174174    return d;
  • trunk/gtk/tr-core.c

    r7393 r7464  
    499499                g_slist_append( p->monitor_files, g_strdup( filename ) );
    500500        if( !p->monitor_idle_tag )
    501             p->monitor_idle_tag = g_timeout_add( 1000, watchFolderIdle,
    502                                                  core );
     501            p->monitor_idle_tag = gtr_timeout_add_seconds( 1, watchFolderIdle, core );
    503502    }
    504503}
  • trunk/gtk/tr-icon.c

    r7404 r7464  
    2727#else
    2828
    29  #define UPDATE_INTERVAL 2500
     29#define UPDATE_INTERVAL_SECONDS 2
    3030
    3131static void
     
    9191    g_signal_connect( icon, "activate", G_CALLBACK( activated ), NULL );
    9292    g_signal_connect( icon, "popup-menu", G_CALLBACK( popup ), NULL );
    93     id = g_timeout_add( UPDATE_INTERVAL, refresh_tooltip_cb, icon );
     93    id = gtr_timeout_add_seconds( UPDATE_INTERVAL_SECONDS, refresh_tooltip_cb, icon );
    9494    g_object_set_data( G_OBJECT( icon ), "tr-core", core );
    9595    g_object_set_data_full( G_OBJECT(
  • trunk/gtk/tr-prefs.c

    r7404 r7464  
    12431243        data->label = ndata->label;
    12441244        data->alive = ndata->alive;
    1245         g_timeout_add( 3000, testing_port_begin, data );
     1245        gtr_timeout_add_seconds( 3, testing_port_begin, data );
    12461246    }
    12471247}
  • trunk/gtk/tracker-list.c

    r7404 r7464  
    2929#include "util.h"
    3030
    31 #define UPDATE_INTERVAL_MSEC 2000
    3231#define PAGE_KEY "page"
    3332
  • trunk/gtk/util.c

    r6873 r7464  
    642642}
    643643
     644/***
     645****
     646***/
     647
     648guint
     649gtr_timeout_add_seconds( guint        interval,
     650                         GSourceFunc  function,
     651                         gpointer     data )
     652{
     653#if GLIB_CHECK_VERSION( 2,14,0 )
     654    return g_timeout_add_seconds( interval, function, data );
     655#else
     656    return g_timeout_add( interval*1000, function, data );
     657#endif
     658}
  • trunk/gtk/util.h

    r7271 r7464  
    9696                                       const char * mnemonic );
    9797
     98guint       gtr_timeout_add_seconds( guint       interval,
     99                                     GSourceFunc function,
     100                                     gpointer    data );
     101
    98102void        addTorrentErrorDialog( GtkWidget *  window_or_child,
    99103                                   int          err,
Note: See TracChangeset for help on using the changeset viewer.