Changeset 7463


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

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

Location:
branches/1.4x/gtk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4x/gtk/details.c

    r7141 r7463  
    2929#include "util.h"
    3030
    31 #define UPDATE_INTERVAL_MSEC 2000
     31#define UPDATE_INTERVAL_SECONDS 2
    3232
    3333/****
     
    15351535    gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), n, TRUE, TRUE, 0 );
    15361536
    1537     tag = g_timeout_add ( UPDATE_INTERVAL_MSEC, periodic_refresh, d );
     1537    tag = gtr_timeout_add_seconds( UPDATE_INTERVAL_SECONDS, periodic_refresh, d );
    15381538    g_object_set_data_full ( G_OBJECT( d ), "tag",
    15391539                             GUINT_TO_POINTER( tag ), remove_tag );
  • branches/1.4x/gtk/file-list.c

    r7072 r7463  
    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
  • branches/1.4x/gtk/main.c

    r7395 r7463  
    653653    /* start scheduled rate timer */
    654654    updateScheduledLimits ( tr_core_session( cbdata->core ) );
    655     g_timeout_add( 60 * 1000, updateScheduledLimits,
    656                   tr_core_session( cbdata->core ) );
     655    gtr_timeout_add_seconds( 60, updateScheduledLimits, tr_core_session( cbdata->core ) );
    657656
    658657    /* either show the window or iconify it */
  • branches/1.4x/gtk/msgwin.c

    r6807 r7463  
    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
  • branches/1.4x/gtk/stats.c

    r6998 r7463  
    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;
  • branches/1.4x/gtk/tr-core.c

    r7395 r7463  
    500500                g_slist_append( p->monitor_files, g_strdup( filename ) );
    501501        if( !p->monitor_idle_tag )
    502             p->monitor_idle_tag = g_timeout_add( 1000, watchFolderIdle,
    503                                                  core );
     502            p->monitor_idle_tag = gtr_timeout_add_seconds( 1, watchFolderIdle, core );
    504503    }
    505504}
  • branches/1.4x/gtk/tr-icon.c

    r6795 r7463  
    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(
  • branches/1.4x/gtk/tr-prefs.c

    r7355 r7463  
    13121312        data->label = ndata->label;
    13131313        data->alive = ndata->alive;
    1314         g_timeout_add( 3000, testing_port_begin, data );
     1314        gtr_timeout_add_seconds( 3, testing_port_begin, data );
    13151315    }
    13161316}
  • branches/1.4x/gtk/tracker-list.c

    r7262 r7463  
    2929#include "util.h"
    3030
    31 #define UPDATE_INTERVAL_MSEC 2000
    3231#define PAGE_KEY "page"
    3332
  • branches/1.4x/gtk/util.c

    r6873 r7463  
    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}
  • branches/1.4x/gtk/util.h

    r7270 r7463  
    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.