diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2011-02-14 20:15:52 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2011-02-14 20:15:52 +0000 |
commit | c10b672d05b8b6b68bbc1ccb92da8b5caa451c68 (patch) | |
tree | c7e427e2b4502b1b05872d2693b5cb1ca82347c9 /src/trg-remote-prefs-dialog.c | |
parent | af90b3a34078f1ba5eb1c042ae9f8be1b7499aac (diff) |
cache-size-mb was implemented 2.10, so check if it's present (will support >= 2.0)
Diffstat (limited to 'src/trg-remote-prefs-dialog.c')
-rw-r--r-- | src/trg-remote-prefs-dialog.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/trg-remote-prefs-dialog.c b/src/trg-remote-prefs-dialog.c index c27fc35..5d5d8a5 100644 --- a/src/trg-remote-prefs-dialog.c +++ b/src/trg-remote-prefs-dialog.c @@ -98,8 +98,9 @@ static void update_session(GtkDialog * dlg) args); gtk_toggle_button_json_out(GTK_TOGGLE_BUTTON (priv->start_added_torrent_check), args); - gtk_spin_button_json_int_out(GTK_SPIN_BUTTON(priv->cache_size_mb_spin), - args); + if (priv->cache_size_mb_spin != NULL) + gtk_spin_button_json_int_out(GTK_SPIN_BUTTON + (priv->cache_size_mb_spin), args); /* Connection */ @@ -351,6 +352,7 @@ static GtkWidget *trg_rprefs_generalPage(TrgRemotePrefsDialog * win, GtkWidget *w, *tb, *t; gint row = 0; + gint64 cache_size_mb; t = hig_workarea_create(); @@ -391,12 +393,14 @@ static GtkWidget *trg_rprefs_generalPage(TrgRemotePrefsDialog * win, G_CALLBACK(toggle_active_arg_is_sensitive), w); hig_workarea_add_row_w(t, &row, tb, w, NULL); - w = priv->cache_size_mb_spin = - gtk_spin_button_new_with_range(0, INT_MAX, 1); - widget_set_json_key(w, SGET_CACHE_SIZE_MB); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), - session_get_cache_size_mb(s)); - hig_workarea_add_row(t, &row, "Cache size (MB)", w, w); + cache_size_mb = session_get_cache_size_mb(s); + if (cache_size_mb >= 0) { + w = priv->cache_size_mb_spin = + gtk_spin_button_new_with_range(0, INT_MAX, 1); + widget_set_json_key(w, SGET_CACHE_SIZE_MB); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), cache_size_mb); + hig_workarea_add_row(t, &row, "Cache size (MB)", w, w); + } w = priv->rename_partial_files_check = hig_workarea_add_wide_checkbutton(t, &row, |