Revision: 5751 http://geany.svn.sourceforge.net/geany/?rev=5751&view=rev Author: ntrel Date: 2011-04-30 16:24:53 +0000 (Sat, 30 Apr 2011)
Log Message: ----------- Read color scheme name and description for menu item label and tooltip (based on patch by Matthew Brush, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/data/colorschemes/alt.conf trunk/doc/geany.html trunk/doc/geany.txt trunk/src/highlighting.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-04-30 15:25:09 UTC (rev 5750) +++ trunk/ChangeLog 2011-04-30 16:24:53 UTC (rev 5751) @@ -5,6 +5,10 @@ agree on whether e.g. Java is a compiled language). * doc/geany.txt, doc/geany.html: Add section 'Filetype group membership'. + * src/highlighting.c, doc/geany.txt, doc/geany.html, + data/colorschemes/alt.conf: + Read color scheme name and description for menu item label and + tooltip (based on patch by Matthew Brush, thanks).
2011-04-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/data/colorschemes/alt.conf =================================================================== --- trunk/data/colorschemes/alt.conf 2011-04-30 15:25:09 UTC (rev 5750) +++ trunk/data/colorschemes/alt.conf 2011-04-30 16:24:53 UTC (rev 5751) @@ -1,4 +1,6 @@ -# Set of styles like the Geany <= 0.19 Python/script defaults with gray comments. +[theme_info] +name=Alternate +description=Alternate Geany color scheme with styles like the Geany <= 0.19 Python/script defaults with gray comments.
[named_styles] # see filetypes.common for details
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2011-04-30 15:25:09 UTC (rev 5750) +++ trunk/doc/geany.html 2011-04-30 16:24:53 UTC (rev 5751) @@ -6,7 +6,7 @@ <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <title>Geany</title> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> -<meta name="date" content="2011-04-26" /> +<meta name="date" content="2011-04-30" /> <style type="text/css">
/* @@ -139,7 +139,7 @@ <br />Nick Treleaven <br />Frank Lanitz</td></tr> <tr><th class="docinfo-name">Date:</th> -<td>2011-04-26</td></tr> +<td>2011-04-30</td></tr> <tr><th class="docinfo-name">Version:</th> <td>0.21</td></tr> </tbody> @@ -1891,13 +1891,17 @@ on what color scheme files Geany found at startup.</p> <p>Color scheme files are read from the <a class="reference" href="#configuration-file-paths">Configuration file paths</a> under the <tt class="docutils literal"><span class="pre">colorschemes</span></tt> subdirectory. They should have the extension -<tt class="docutils literal"><span class="pre">.conf</span></tt> and currently only contain a <a class="reference" href="#named-styles-section">[named_styles] section</a>. The -default color scheme is read from <tt class="docutils literal"><span class="pre">filetypes.common</span></tt>.</p> +<tt class="docutils literal"><span class="pre">.conf</span></tt>. The default color scheme +is read from <tt class="docutils literal"><span class="pre">filetypes.common</span></tt>.</p> +<p>The <a class="reference" href="#named-styles-section">[named_styles] section</a> is the same as for <tt class="docutils literal"><span class="pre">filetypes.common</span></tt>.</p> <div class="note"> <p class="first admonition-title">Note</p> <p class="last">Some filetypes do not yet support named styles so will ignore any chosen color scheme.</p> </div> +<p>The <tt class="docutils literal"><span class="pre">[theme_info]</span></tt> section can contain information about the +theme. The <tt class="docutils literal"><span class="pre">name</span></tt> and <tt class="docutils literal"><span class="pre">description</span></tt> keys are read to set the +menu item text and tooltip, respectively.</p> </div> </div> <div class="section"> @@ -6556,7 +6560,7 @@ <div class="footer"> <hr class="footer" /> <a class="reference" href="geany.txt">View document source</a>. -Generated on: 2011-04-30 15:22 UTC. +Generated on: 2011-04-30 16:23 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 2011-04-30 15:25:09 UTC (rev 5750) +++ trunk/doc/geany.txt 2011-04-30 16:24:53 UTC (rev 5751) @@ -1478,13 +1478,19 @@
Color scheme files are read from the `Configuration file paths`_ under the ``colorschemes`` subdirectory. They should have the extension -``.conf`` and currently only contain a `[named_styles] section`_. The -default color scheme is read from ``filetypes.common``. +``.conf``. The default color scheme +is read from ``filetypes.common``.
+The `[named_styles] section`_ is the same as for ``filetypes.common``. + .. note:: Some filetypes do not yet support named styles so will ignore any chosen color scheme.
+The ``[theme_info]`` section can contain information about the +theme. The ``name`` and ``description`` keys are read to set the +menu item text and tooltip, respectively. + Tags ----
Modified: trunk/src/highlighting.c =================================================================== --- trunk/src/highlighting.c 2011-04-30 15:25:09 UTC (rev 5750) +++ trunk/src/highlighting.c 2011-04-30 16:24:53 UTC (rev 5751) @@ -3600,7 +3600,7 @@ filetypes_reload(); return; } - fname = ui_menu_item_get_text(menuitem); + fname = g_strdup(g_object_get_data(G_OBJECT(menuitem), "colorscheme_file")); setptr(fname, utils_get_locale_from_utf8(fname));
/* fname is just the basename from the menu item, so prepend the custom files path */ @@ -3632,16 +3632,37 @@ static GSList *group = NULL; GtkWidget *item;
- if (fname) + if (!fname) { - gchar *label = utils_get_utf8_from_locale(fname); - - item = gtk_radio_menu_item_new_with_label(group, label); - g_free(label); + item = gtk_radio_menu_item_new_with_mnemonic(group, _("_Default")); } else - item = gtk_radio_menu_item_new_with_mnemonic(group, _("_Default")); + { + GKeyFile *hkeyfile, *skeyfile; + gchar *path, *theme_name, *tooltip; + gchar *theme_fn = utils_get_utf8_from_locale(fname);
+ path = utils_build_path(app->configdir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL); + hkeyfile = utils_key_file_new(path); + setptr(path, utils_build_path(app->datadir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL)); + skeyfile = utils_key_file_new(path); + + theme_name = utils_get_setting(string, hkeyfile, skeyfile, "theme_info", "name", theme_fn); + item = gtk_radio_menu_item_new_with_label(group, theme_name); + g_object_set_data_full(G_OBJECT(item), "colorscheme_file", theme_fn, g_free); + + tooltip = utils_get_setting(string, hkeyfile, skeyfile, "theme_info", "description", NULL); + if (tooltip != NULL) + { + ui_widget_set_tooltip_text(item, tooltip); + g_free(tooltip); + } + g_free(path); + g_free(theme_name); + g_key_file_free(hkeyfile); + g_key_file_free(skeyfile); + } + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item)); if (utils_str_equal(editor_prefs.color_scheme, fname)) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.