SF.net SVN: geany: [2520] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Apr 23 16:53:40 UTC 2008
Revision: 2520
http://geany.svn.sourceforge.net/geany/?rev=2520&view=rev
Author: ntrel
Date: 2008-04-23 09:53:40 -0700 (Wed, 23 Apr 2008)
Log Message:
-----------
Make disk check timeout configurable in the prefs dialog Files tab.
Make a value of zero disable disk checks.
Modified Paths:
--------------
trunk/ChangeLog
trunk/geany.glade
trunk/src/interface.c
trunk/src/keyfile.c
trunk/src/prefs.c
trunk/src/prefs.h
trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/ChangeLog 2008-04-23 16:53:40 UTC (rev 2520)
@@ -4,6 +4,10 @@
src/symbols.c, src/editor.h, doc/geany.txt, doc/geany.html:
Move non-general compile-time constants into their relevant source
files.
+ * src/utils.c, src/interface.c, src/prefs.c, src/prefs.h, src/keyfile.c,
+ geany.glade:
+ Make disk check timeout configurable in the prefs dialog Files tab.
+ Make a value of zero disable disk checks.
2008-04-22 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/geany.glade 2008-04-23 16:53:40 UTC (rev 2520)
@@ -6845,6 +6845,57 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkLabel" id="label208">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Disk check timeout:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="spin_disk_check">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">How often to check for changes to document files on disk, in seconds. Zero disables checking.</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">True</property>
+ <property name="adjustment">30 0 10000 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/src/interface.c 2008-04-23 16:53:40 UTC (rev 2520)
@@ -2680,6 +2680,9 @@
GtkWidget *label147;
GtkObject *spin_mru_adj;
GtkWidget *spin_mru;
+ GtkWidget *label208;
+ GtkObject *spin_disk_check_adj;
+ GtkWidget *spin_disk_check;
GtkWidget *label198;
GtkWidget *label174;
GtkWidget *vbox23;
@@ -3988,6 +3991,23 @@
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_mru), TRUE);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_mru), TRUE);
+ label208 = gtk_label_new (_("Disk check timeout:"));
+ gtk_widget_show (label208);
+ gtk_table_attach (GTK_TABLE (table10), label208, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label208), 0, 0.5);
+
+ spin_disk_check_adj = gtk_adjustment_new (30, 0, 10000, 1, 10, 10);
+ spin_disk_check = gtk_spin_button_new (GTK_ADJUSTMENT (spin_disk_check_adj), 1, 0);
+ gtk_widget_show (spin_disk_check);
+ gtk_table_attach (GTK_TABLE (table10), spin_disk_check, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_tooltips_set_tip (tooltips, spin_disk_check, _("How often to check for changes to document files on disk, in seconds. Zero disables checking."), NULL);
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_disk_check), TRUE);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_disk_check), TRUE);
+
label198 = gtk_label_new (_("<b>Miscellaneous</b>"));
gtk_widget_show (label198);
gtk_frame_set_label_widget (GTK_FRAME (frame17), label198);
@@ -4671,6 +4691,8 @@
GLADE_HOOKUP_OBJECT (prefs_dialog, table10, "table10");
GLADE_HOOKUP_OBJECT (prefs_dialog, label147, "label147");
GLADE_HOOKUP_OBJECT (prefs_dialog, spin_mru, "spin_mru");
+ GLADE_HOOKUP_OBJECT (prefs_dialog, label208, "label208");
+ GLADE_HOOKUP_OBJECT (prefs_dialog, spin_disk_check, "spin_disk_check");
GLADE_HOOKUP_OBJECT (prefs_dialog, label198, "label198");
GLADE_HOOKUP_OBJECT (prefs_dialog, label174, "label174");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox23, "vbox23");
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/src/keyfile.c 2008-04-23 16:53:40 UTC (rev 2520)
@@ -241,6 +241,7 @@
g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", prefs.replace_tabs);
g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", prefs.strip_trailing_spaces);
g_key_file_set_integer(config, PACKAGE, "mru_length", prefs.mru_length);
+ g_key_file_set_integer(config, PACKAGE, "disk_check_timeout", file_prefs.disk_check_timeout);
/* toolbar */
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", prefs.toolbar_visible);
@@ -567,6 +568,8 @@
prefs.final_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
prefs.strip_trailing_spaces = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
prefs.mru_length = utils_get_setting_integer(config, PACKAGE, "mru_length", GEANY_DEFAULT_MRU_LENGTH);
+ file_prefs.disk_check_timeout = utils_get_setting_integer(config, PACKAGE,
+ "disk_check_timeout", GEANY_DISK_CHECK_TIMEOUT);
/* toolbar */
prefs.toolbar_visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/src/prefs.c 2008-04-23 16:53:40 UTC (rev 2520)
@@ -61,6 +61,8 @@
GeanyPrefs prefs;
+GeanyFilePrefs file_prefs;
+
static gchar *dialog_key_name;
static GtkTreeIter g_iter;
static GtkTreeStore *store = NULL;
@@ -163,9 +165,6 @@
GdkColor *color;
/* General settings */
- widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), prefs.mru_length);
-
/* startup */
widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session);
@@ -332,7 +331,13 @@
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_tab_left");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
+ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), prefs.mru_length);
+ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_disk_check");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), file_prefs.disk_check_timeout);
+
+
/* Editor settings */
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width);
@@ -568,9 +573,6 @@
guint i;
/* General settings */
- widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
- prefs.mru_length = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-
/* startup */
widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
prefs.load_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -717,7 +719,13 @@
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_tab_right");
prefs.tab_order_ltr = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
+ prefs.mru_length = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_disk_check");
+ file_prefs.disk_check_timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+
/* Editor settings */
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
Modified: trunk/src/prefs.h
===================================================================
--- trunk/src/prefs.h 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/src/prefs.h 2008-04-23 16:53:40 UTC (rev 2520)
@@ -100,6 +100,15 @@
extern GeanyPrefs prefs;
+typedef struct GeanyFilePrefs
+{
+ gint disk_check_timeout;
+}
+GeanyFilePrefs;
+
+extern GeanyFilePrefs file_prefs;
+
+
void prefs_init_dialog(void);
void prefs_show_dialog(void);
Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c 2008-04-23 16:47:42 UTC (rev 2519)
+++ trunk/src/utils.c 2008-04-23 16:53:40 UTC (rev 2520)
@@ -374,7 +374,7 @@
/* Set force to force a disk check, otherwise it is ignored if there was a check
- * in the last GEANY_CHECK_FILE_DELAY seconds.
+ * in the last file_prefs.disk_check_timeout seconds.
* @return @c TRUE if the file has changed. */
gboolean utils_check_disk_status(gint idx, gboolean force)
{
@@ -383,11 +383,13 @@
gchar *locale_filename;
gboolean ret = FALSE;
+ if (file_prefs.disk_check_timeout == 0) return FALSE;
if (idx == -1 || doc_list[idx].file_name == NULL) return FALSE;
t = time(NULL);
- if (! force && doc_list[idx].last_check > (t - GEANY_CHECK_FILE_DELAY)) return FALSE;
+ if (! force && doc_list[idx].last_check > (t - file_prefs.disk_check_timeout))
+ return FALSE;
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
if (g_stat(locale_filename, &st) != 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list