summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-06-26 17:55:39 +0000
committerjstebbins <[email protected]>2009-06-26 17:55:39 +0000
commitb045e7801534b4e2549fdae22d90491ee2ec60d7 (patch)
tree7b98a867868946dc9efed429b3e6f79ec6a66020 /gtk/src
parentaf876ffaa55ba8c063703a18c4e0329349362144 (diff)
LinGui: add individual activity log longevity preference option
- options are week, month, year, immortal. default is immortal. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2630 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/callbacks.c12
-rw-r--r--gtk/src/ghb.ui36
-rw-r--r--gtk/src/hb-backend.c15
-rw-r--r--gtk/src/internal_defaults.xml2
4 files changed, 62 insertions, 3 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index cc6ab7643..0b3e0cc12 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1792,7 +1792,7 @@ suspend_cb(countdown_t *cd)
cd->timeout--;
if (cd->timeout == 0)
{
- gtk_widget_destroy (cd->dlg);
+ gtk_widget_destroy (GTK_WIDGET(cd->dlg));
ghb_suspend_gpm();
return FALSE;
}
@@ -1919,13 +1919,19 @@ static void
prune_logs(signal_user_data_t *ud)
{
gchar *dest_dir;
+ gint days;
// Only prune logs stored in the default config dir location
+ days = ghb_settings_combo_int(ud->settings, "LogLongevity");
+ if (days > 365)
+ return;
+
dest_dir = ghb_get_user_config_dir("EncodeLogs");
if (g_file_test(dest_dir, G_FILE_TEST_IS_DIR))
{
const gchar *file;
- int week = 7*24*60*60;
+ gint duration = days * 24 * 60 * 60;
+
GDir *gdir = g_dir_open(dest_dir, 0, NULL);
time_t now;
@@ -1938,7 +1944,7 @@ prune_logs(signal_user_data_t *ud)
path = g_strdup_printf("%s/%s", dest_dir, file);
g_stat(path, &stbuf);
- if (now - stbuf.st_mtime > week)
+ if (now - stbuf.st_mtime > duration)
{
g_unlink(path);
}
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index ee3bfdd7d..03aca9b47 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -3970,6 +3970,42 @@ no-dct-decimate=0:cabac=1</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkAlignment" id="alignment63">
+ <property name="visible">True</property>
+ <property name="left_padding">21</property>
+ <child>
+ <object class="GtkHBox" id="hbox83">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkComboBox" id="LogLongevity">
+ <property name="visible">True</property>
+ <signal name="changed" handler="pref_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labela1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Activity Log Longevity</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index a015eb7a5..50978f0ad 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -120,6 +120,19 @@ combo_opts_t logging_opts =
d_logging_opts
};
+static options_map_t d_log_longevity_opts[] =
+{
+ {"Week", "week", 7, "7"},
+ {"Month", "month", 30, "30"},
+ {"Year", "year", 365, "365"},
+ {"Immortal", "immortal", 366, "366"},
+};
+combo_opts_t log_longevity_opts =
+{
+ sizeof(d_log_longevity_opts)/sizeof(options_map_t),
+ d_log_longevity_opts
+};
+
static options_map_t d_appcast_update_opts[] =
{
{"Never", "never", 0, "never"},
@@ -348,6 +361,7 @@ combo_name_map_t combo_name_map[] =
{"PicturePAR", &par_opts},
{"PictureModulus", &alignment_opts},
{"LoggingLevel", &logging_opts},
+ {"LogLongevity", &log_longevity_opts},
{"check_updates", &appcast_update_opts},
{"VideoQualityGranularity", &vqual_granularity_opts},
{"FileFormat", &container_opts},
@@ -2250,6 +2264,7 @@ ghb_update_ui_combo_box(
generic_opts_set(ud->builder, "PicturePAR", &par_opts);
generic_opts_set(ud->builder, "PictureModulus", &alignment_opts);
generic_opts_set(ud->builder, "LoggingLevel", &logging_opts);
+ generic_opts_set(ud->builder, "LogLongevity", &log_longevity_opts);
generic_opts_set(ud->builder, "check_updates", &appcast_update_opts);
generic_opts_set(ud->builder, "FileFormat", &container_opts);
generic_opts_set(ud->builder, "PictureDeinterlace", &deint_opts);
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index fd8ac4119..fac8c31ff 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -127,6 +127,8 @@
<integer>15</integer>
<key>LoggingLevel</key>
<string>1</string>
+ <key>LogLongevity</key>
+ <string>immortal</string>
<key>nocheckvquality</key>
<false />
<key>use_dvdnav</key>