[tracker] tracker-preferences: add hscale for delay before dropping removable devices



commit 5ce7012e026f88d274e49df90767aceab65b0496
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Thu Jan 27 12:26:07 2011 +0000

    tracker-preferences: add hscale for delay before dropping removable devices
    
    Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>

 src/tracker-preferences/tracker-preferences.ui   |   55 ++++++++++++++++++++++
 src/tracker-preferences/tracker-preferences.vala |   12 +++++
 2 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-preferences/tracker-preferences.ui b/src/tracker-preferences/tracker-preferences.ui
index 7f934c4..776f523 100644
--- a/src/tracker-preferences/tracker-preferences.ui
+++ b/src/tracker-preferences/tracker-preferences.ui
@@ -490,6 +490,54 @@
                                     <property name="position">3</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <object class="GtkLabel" id="label_device_drop_threshold1">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="xpad">3</property>
+                                    <property name="ypad">4</property>
+                                    <property name="label" translatable="yes">Drop removable device from database after:</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">hscale_drop_device_threshold</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">4</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkHBox" id="hbox7">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <object class="GtkHScale" id="hscale_drop_device_threshold">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="adjustment">adjustment_drop_device_threshold</property>
+                                        <property name="digits">0</property>
+                                        <signal name="format_value" handler="hscale_drop_device_threshold_format_value_cb"/>
+                                      </object>
+                                      <packing>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel" id="label_days1">
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1</property>
+                                        <property name="label" translatable="yes">Day(s)</property>
+                                        <property name="justify">right</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="position">5</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="position">0</property>
@@ -1297,4 +1345,11 @@ Most commonly this is used to ignore directories like *~, *.o, *.la, etc</proper
     <property name="upper">1000</property>
     <property name="step_increment">1</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment_drop_device_threshold">
+    <property name="value">3</property>
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
+  </object>
 </interface>
diff --git a/src/tracker-preferences/tracker-preferences.vala b/src/tracker-preferences/tracker-preferences.vala
index 13ac702..a637b4d 100644
--- a/src/tracker-preferences/tracker-preferences.vala
+++ b/src/tracker-preferences/tracker-preferences.vala
@@ -38,6 +38,7 @@ public static CheckButton checkbutton_index_removable_media;
 public static CheckButton checkbutton_index_optical_discs;
 public static Scale hscale_disk_space_limit;
 public static Scale hscale_throttle;
+public static Scale hscale_drop_device_threshold;
 public static ListStore liststore_index_recursively;
 public static ListStore liststore_index_single;
 public static ListStore liststore_ignored_directories;
@@ -112,6 +113,14 @@ public static string hscale_throttle_format_value_cb (Scale source, double value
 	return _("%d/20").printf ((int) value);
 }
 
+public static string hscale_drop_device_threshold_format_value_cb (Scale source, double value) {
+	if (((int) value) == 0) {
+		return _("Disabled");
+	}
+
+	return _("%d").printf ((int) value);
+}
+
 public static void add_freevalue (ListStore model) {
 	Dialog dialog;
 	Entry entry;
@@ -274,6 +283,7 @@ public static void button_apply_clicked_cb (Button source) {
 
 	config.low_disk_space_limit = (int) hscale_disk_space_limit.get_value ();
 	config.throttle = (int) hscale_throttle.get_value ();
+	config.removable_days_threshold = (int) hscale_drop_device_threshold.get_value ();
 
 	config.save ();
 	icon_config.save ();
@@ -370,6 +380,8 @@ static int main (string[] args) {
 		hscale_disk_space_limit.set_value ((double) config.low_disk_space_limit);
 		hscale_throttle = builder.get_object ("hscale_throttle") as Scale;
 		hscale_throttle.set_value ((double) config.throttle);
+		hscale_drop_device_threshold = builder.get_object ("hscale_drop_device_threshold") as Scale;
+		hscale_drop_device_threshold.set_value ((double) config.removable_days_threshold);
 		togglebutton_home = builder.get_object ("togglebutton_home") as ToggleButton;
 
 		notebook = builder.get_object ("notebook") as Notebook;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]