1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

(trunk gtk) make it easier to change the periodic refresh intervals at the code level

This commit is contained in:
Charles Kerr 2010-02-01 04:54:10 +00:00
parent 92f67263ee
commit 28726d031d
7 changed files with 16 additions and 10 deletions

View file

@ -30,8 +30,6 @@
#define DETAILS_KEY "details-data"
#define UPDATE_INTERVAL_SECONDS 2
struct DetailsImpl
{
GtkWidget * dialog;
@ -2243,7 +2241,7 @@ torrent_inspector_new( GtkWindow * parent, TrCore * core )
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), n, TRUE, TRUE, 0 );
di->periodic_refresh_tag = gtr_timeout_add_seconds( UPDATE_INTERVAL_SECONDS,
di->periodic_refresh_tag = gtr_timeout_add_seconds( SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS,
periodic_refresh, di );
gtk_widget_show_all( GTK_DIALOG( d )->vbox );
return d;

View file

@ -22,6 +22,7 @@
#include "file-list.h"
#include "hig.h"
#include "icons.h"
#include "tr-prefs.h"
enum
{
@ -521,7 +522,7 @@ file_list_set_torrent( GtkWidget * w, int torrentId )
}
refresh( data );
data->timeout_tag = gtr_timeout_add_seconds( 2, refreshModel, data );
data->timeout_tag = gtr_timeout_add_seconds( SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS, refreshModel, data );
}
gtk_tree_view_set_model( GTK_TREE_VIEW( data->view ), data->model );

View file

@ -61,8 +61,6 @@
#define MY_NAME "transmission"
#define REFRESH_INTERVAL_SECONDS 2
#if GTK_CHECK_VERSION( 2, 8, 0 )
#define SHOW_LICENSE
static const char * LICENSE =
@ -686,7 +684,7 @@ appsetup( TrWindow * wind,
prefschanged( cbdata->core, PREF_KEY_SHOW_TRAY_ICON, cbdata );
/* start model update timer */
cbdata->timer = gtr_timeout_add_seconds( REFRESH_INTERVAL_SECONDS, updatemodel, cbdata );
cbdata->timer = gtr_timeout_add_seconds( MAIN_WINDOW_REFRESH_INTERVAL_SECONDS, updatemodel, cbdata );
updatemodel( cbdata );
/* either show the window or iconify it */

View file

@ -22,6 +22,7 @@
#include "hig.h"
#include "makemeta-ui.h"
#include "tr-core.h"
#include "tr-prefs.h"
#include "util.h"
#define FILE_CHOSEN_KEY "file-is-chosen"
@ -189,7 +190,7 @@ makeProgressDialog( GtkWidget * parent, MakeMetaUI * ui )
ui->progress_bar = w;
gtk_box_pack_start( GTK_BOX( v ), w, FALSE, FALSE, 0 );
ui->progress_tag = gtr_timeout_add_seconds( 1, onProgressDialogRefresh, ui );
ui->progress_tag = gtr_timeout_add_seconds( SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS, onProgressDialogRefresh, ui );
g_object_weak_ref( G_OBJECT( d ), onProgressDialogDestroyed, ui );
onProgressDialogRefresh( ui );

View file

@ -528,7 +528,7 @@ msgwin_new( TrCore * core )
gtk_box_pack_start( GTK_BOX( vbox ), w, TRUE, TRUE, 0 );
gtk_container_add( GTK_CONTAINER( win ), vbox );
data->refresh_tag = gtr_timeout_add_seconds( 2, onRefresh, data );
data->refresh_tag = gtr_timeout_add_seconds( SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS, onRefresh, data );
g_object_weak_ref( G_OBJECT( win ), onWindowDestroyed, data );
gtk_widget_show_all( win );

View file

@ -15,6 +15,7 @@
#include "hig.h"
#include "stats.h"
#include "tr-core.h"
#include "tr-prefs.h"
enum
{
@ -187,7 +188,7 @@ stats_dialog_create( GtkWindow * parent,
updateStats( ui );
g_object_set_data_full( G_OBJECT( d ), "data", ui, g_free );
g_signal_connect( d, "response", G_CALLBACK( dialogResponse ), ui );
i = gtr_timeout_add_seconds( 1, updateStats, ui );
i = gtr_timeout_add_seconds( SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS, updateStats, ui );
g_object_weak_ref( G_OBJECT( d ), dialogDestroyed, GUINT_TO_POINTER( i ) );
return d;
}

View file

@ -52,4 +52,11 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
#define PREF_KEY_MAIN_WINDOW_Y "main-window-y"
#define PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED "main-window-is-maximized"
enum
{
MAIN_WINDOW_REFRESH_INTERVAL_SECONDS = 1,
SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS = 2
};
#endif