SF.net SVN: geany:[5096] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jul 8 11:35:32 UTC 2010


Revision: 5096
          http://geany.svn.sourceforge.net/geany/?rev=5096&view=rev
Author:   ntrel
Date:     2010-07-08 11:35:32 +0000 (Thu, 08 Jul 2010)

Log Message:
-----------
Fix writing empty hidden pref "statusbar_template" key so users can
find it (patch by Dimitar Zhekov, thanks).

Modified Paths:
--------------
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/ui_utils.c

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2010-07-07 21:05:17 UTC (rev 5095)
+++ trunk/doc/geany.html	2010-07-08 11:35:32 UTC (rev 5096)
@@ -4726,8 +4726,10 @@
 </tr>
 </tbody>
 </table>
-<p>statusbar_template default (where <tt class="docutils literal"><span class="pre">\t</span></tt> = tab):</p>
+<p>By default, statusbar_template is empty. This tells Geany to use its
+internal default, which is currently:</p>
 <p><tt class="docutils literal"><span class="pre">line:</span> <span class="pre">%l</span> <span class="pre">/</span> <span class="pre">%L\t</span> <span class="pre">col:</span> <span class="pre">%c\t</span> <span class="pre">sel:</span> <span class="pre">%s\t</span> <span class="pre">%w</span>      <span class="pre">%t</span>      <span class="pre">%mmode:</span> <span class="pre">%M</span>      <span class="pre">encoding:</span> <span class="pre">%e</span>      <span class="pre">filetype:</span> <span class="pre">%f</span>      <span class="pre">scope:</span> <span class="pre">%S</span></tt></p>
+<p>Note that <tt class="docutils literal"><span class="pre">\t</span></tt> = tab.</p>
 <table border="1" class="docutils">
 <colgroup>
 <col width="34%" />
@@ -6135,7 +6137,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-07-06 14:14 UTC.
+Generated on: 2010-07-08 11:31 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2010-07-07 21:05:17 UTC (rev 5095)
+++ trunk/doc/geany.txt	2010-07-08 11:35:32 UTC (rev 5096)
@@ -4065,10 +4065,13 @@
                                   (Search in src/ui_utils.c for details).
 ================================  ===========================================  ==================
 
-statusbar_template default (where ``\t`` = tab):
+By default, statusbar_template is empty. This tells Geany to use its
+internal default, which is currently:
 
 ``line: %l / %L\t col: %c\t sel: %s\t %w      %t      %mmode: %M      encoding: %e      filetype: %f      scope: %S``
 
+Note that ``\t`` = tab.
+
 ================================  ===========================================  ==================
 Key                               Description                                  Default
 ================================  ===========================================  ==================

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2010-07-07 21:05:17 UTC (rev 5095)
+++ trunk/src/ui_utils.c	2010-07-08 11:35:32 UTC (rev 5096)
@@ -170,7 +170,7 @@
 	const gchar *expos;	/* % expansion position */
 	const gchar sp[] = "      ";
 
-	fmt = statusbar_template ? statusbar_template :
+	fmt = NZV(statusbar_template) ? statusbar_template :
 		/* Status bar statistics: col = column, sel = selection. */
 		_("line: %l / %L\t col: %c\t sel: %s\t %w      %t      %m"
 		"mode: %M      encoding: %e      filetype: %f      scope: %S");
@@ -2000,15 +2000,23 @@
 	g_assert(statusbar_template == NULL);
 
 	statusbar_template = utils_get_setting_string(config,
-		PACKAGE, "statusbar_template", NULL);
+		PACKAGE, "statusbar_template", "");
 }
 
 
+static void on_save_settings(GObject *obj, GKeyFile *config)
+{
+	if (!g_key_file_has_key(config, PACKAGE, "statusbar_template", NULL))
+		g_key_file_set_string(config, PACKAGE, "statusbar_template", statusbar_template);
+}
+
+
 void ui_init(void)
 {
 	GtkWidget *item;
 
 	g_signal_connect(geany_object, "load-settings", G_CALLBACK(on_load_settings), NULL);
+	g_signal_connect(geany_object, "save-settings", G_CALLBACK(on_save_settings), NULL);
 
 	init_recent_files();
 


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