Branch: refs/heads/1.23
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sat, 16 Mar 2013 15:41:51 UTC
Commit: a97b56e19c36bd083e0c8290da7870e6721927a9
https://github.com/geany/geany/commit/a97b56e19c36bd083e0c8290da7870e672192…
Log Message:
-----------
Fix our custom styles under KDE and for people using gtk-chtheme
We have a custom RC file defining various styles we need, and we want
the user to be able to override them (e.g. if they want -- or need --
other colors). Fair enough, one would simply call gtk_rc_parse() with
the appropriate filename. However, the styling rules applies in the
order they are loaded, then if we load our styles after GTK has loaded
the user's ones we'd override them.
There are 2 solutions to fix this:
1) set our styles' priority to something with lower than "user"
(actually "theme" priority because rules precedence are first
calculated depending on the priority no matter of how precise the
rules is, so we need to override the theme).
2) prepend our custom style to GTK's list while keeping priority to
user (which is the default), so it gets loaded before real user's
ones and so gets overridden by them.
One would normally go for 1 because it's ways simpler and requires less
code: you just have to add the priorities to your styles, which is a
matter of adding a few ":theme" in the RC file. However, KDE being a
bitch it doesn't set the gtk-theme-name but rather directly includes
the style to use in a user gtkrc file, which makes the theme have
"user" priority, hence overriding our styles. So, we cannot set
priorities in the RC file if we want to support running under KDE,
which pretty much leave us with no choice but to go with solution 2,
which unfortunately requires writing ugly code since GTK don't have a
gtk_rc_prepend_default_file() function. Thank you very much KDE.
Though, as a side benefit it also makes the code work with people using
gtk-chtheme, which also found it funny to include the theme in the user
RC file.
Modified Paths:
--------------
data/geany.gtkrc
src/main.c
src/ui_utils.c
Modified: data/geany.gtkrc
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -7,21 +7,21 @@ style "geany-close-tab-button-style" {
xthickness = 0
ythickness = 0
}
-widget "*.geany-close-tab-button" style:theme "geany-close-tab-button-style"
+widget "*.geany-close-tab-button" style "geany-close-tab-button-style"
# use monospaced font in search entries for easier reading of regexp (#1907117)
style "geany-monospace" {
font_name = "Monospace"
}
-widget "GeanyDialogSearch.*.GtkEntry" style:theme "geany-monospace"
-widget "GeanyDialogSearch.*.geany-search-entry-no-match" style:theme "geany-monospace"
+widget "GeanyDialogSearch.*.GtkEntry" style "geany-monospace"
+widget "GeanyDialogSearch.*.geany-search-entry-no-match" style "geany-monospace"
# set red background for GtkEntries showing unmatched searches
style "geany-search-entry-no-match-style" {
base[NORMAL] = "#ffff66666666"
text[NORMAL] = "#ffffffffffff"
}
-widget "*.geany-search-entry-no-match" style:theme "geany-search-entry-no-match-style"
+widget "*.geany-search-entry-no-match" style "geany-search-entry-no-match-style"
# document status colors
style "geany-document-status-changed-style" {
@@ -36,6 +36,6 @@ style "geany-document-status-readonly-style" {
fg[NORMAL] = "#00007fff0000"
fg[ACTIVE] = "#00007fff0000"
}
-widget "*.geany-document-status-changed" style:theme "geany-document-status-changed-style"
-widget "*.geany-document-status-disk-changed" style:theme "geany-document-status-disk-changed-style"
-widget "*.geany-document-status-readonly" style:theme "geany-document-status-readonly-style"
+widget "*.geany-document-status-changed" style "geany-document-status-changed-style"
+widget "*.geany-document-status-disk-changed" style "geany-document-status-disk-changed-style"
+widget "*.geany-document-status-readonly" style "geany-document-status-readonly-style"
Modified: src/main.c
45 files changed, 45 insertions(+), 0 deletions(-)
===================================================================
@@ -969,6 +969,50 @@ static const gchar *get_locale(void)
}
+/* This prepends our own gtkrc file to the list of RC files to be loaded by GTK at startup.
+ * This function *has* to be called before gtk_init().
+ *
+ * We have a custom RC file defining various styles we need, and we want the user to be
+ * able to override them (e.g. if they want -- or need -- other colors). Fair enough, one
+ * would simply call gtk_rc_parse() with the appropriate filename. However, the styling
+ * rules applies in the order they are loaded, then if we load our styles after GTK has
+ * loaded the user's ones we'd override them.
+ *
+ * There are 2 solutions to fix this:
+ * 1) set our styles' priority to something with lower than "user" (actually "theme"
+ * priority because rules precedence are first calculated depending on the priority
+ * no matter of how precise the rules is, so we need to override the theme).
+ * 2) prepend our custom style to GTK's list while keeping priority to user (which is the
+ * default), so it gets loaded before real user's ones and so gets overridden by them.
+ *
+ * One would normally go for 1 because it's ways simpler and requires less code: you just
+ * have to add the priorities to your styles, which is a matter of adding a few ":theme" in
+ * the RC file. However, KDE being a bitch it doesn't set the gtk-theme-name but rather
+ * directly includes the style to use in a user gtkrc file, which makes the theme have
+ * "user" priority, hence overriding our styles. So, we cannot set priorities in the RC
+ * file if we want to support running under KDE, which pretty much leave us with no choice
+ * but to go with solution 2, which unfortunately requires writing ugly code since GTK
+ * don't have a gtk_rc_prepend_default_file() function. Thank you very much KDE.
+ *
+ * Though, as a side benefit it also makes the code work with people using gtk-chtheme,
+ * which also found it funny to include the theme in the user RC file. */
+static void setup_gtk2_styles(void)
+{
+ gchar **gtk_files = gtk_rc_get_default_files();
+ gchar **new_files = g_malloc(sizeof *new_files * (g_strv_length(gtk_files) + 2));
+ guint i = 0;
+
+ new_files[i++] = g_build_filename(app->datadir, "geany.gtkrc", NULL);
+ for (; *gtk_files; gtk_files++)
+ new_files[i++] = g_strdup(*gtk_files);
+ new_files[i] = NULL;
+
+ gtk_rc_set_default_files(new_files);
+
+ g_strfreev(new_files);
+}
+
+
gint main(gint argc, gchar **argv)
{
GeanyDocument *doc;
@@ -990,6 +1034,7 @@ gint main(gint argc, gchar **argv)
memset(&ui_widgets, 0, sizeof(UIWidgets));
setup_paths();
+ setup_gtk2_styles();
#ifdef ENABLE_NLS
main_locale_init(GEANY_LOCALEDIR, GETTEXT_PACKAGE);
#endif
Modified: src/ui_utils.c
11 files changed, 1 insertions(+), 10 deletions(-)
===================================================================
@@ -2158,18 +2158,9 @@ void ui_init_builder(void)
}
-static void init_custom_style(void)
-{
- gchar *gtkrc_file = g_build_filename(app->datadir, "geany.gtkrc", NULL);
-
- gtk_rc_parse(gtkrc_file);
- g_free(gtkrc_file);
-}
-
-
void ui_init(void)
{
- init_custom_style();
+ /* custom styles are initialized in setup_gtk2_styles() in main.c */
init_recent_files();
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sat, 16 Mar 2013 15:19:20 UTC
Commit: 232290aad4be81cd67a309e5f28f867ad69a3fd4
https://github.com/geany/geany/commit/232290aad4be81cd67a309e5f28f867ad69a3…
Log Message:
-----------
Fix our custom styles under KDE and for people using gtk-chtheme
We have a custom RC file defining various styles we need, and we want
the user to be able to override them (e.g. if they want -- or need --
other colors). Fair enough, one would simply call gtk_rc_parse() with
the appropriate filename. However, the styling rules applies in the
order they are loaded, then if we load our styles after GTK has loaded
the user's ones we'd override them.
There are 2 solutions to fix this:
1) set our styles' priority to something with lower than "user"
(actually "theme" priority because rules precedence are first
calculated depending on the priority no matter of how precise the
rules is, so we need to override the theme).
2) prepend our custom style to GTK's list while keeping priority to
user (which is the default), so it gets loaded before real user's
ones and so gets overridden by them.
One would normally go for 1 because it's ways simpler and requires less
code: you just have to add the priorities to your styles, which is a
matter of adding a few ":theme" in the RC file. However, KDE being a
bitch it doesn't set the gtk-theme-name but rather directly includes
the style to use in a user gtkrc file, which makes the theme have
"user" priority, hence overriding our styles. So, we cannot set
priorities in the RC file if we want to support running under KDE,
which pretty much leave us with no choice but to go with solution 2,
which unfortunately requires writing ugly code since GTK don't have a
gtk_rc_prepend_default_file() function. Thank you very much KDE.
Though, as a side benefit it also makes the code work with people using
gtk-chtheme, which also found it funny to include the theme in the user
RC file.
Modified Paths:
--------------
data/geany.gtkrc
src/main.c
src/ui_utils.c
Modified: data/geany.gtkrc
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -7,21 +7,21 @@ style "geany-close-tab-button-style" {
xthickness = 0
ythickness = 0
}
-widget "*.geany-close-tab-button" style:theme "geany-close-tab-button-style"
+widget "*.geany-close-tab-button" style "geany-close-tab-button-style"
# use monospaced font in search entries for easier reading of regexp (#1907117)
style "geany-monospace" {
font_name = "Monospace"
}
-widget "GeanyDialogSearch.*.GtkEntry" style:theme "geany-monospace"
-widget "GeanyDialogSearch.*.geany-search-entry-no-match" style:theme "geany-monospace"
+widget "GeanyDialogSearch.*.GtkEntry" style "geany-monospace"
+widget "GeanyDialogSearch.*.geany-search-entry-no-match" style "geany-monospace"
# set red background for GtkEntries showing unmatched searches
style "geany-search-entry-no-match-style" {
base[NORMAL] = "#ffff66666666"
text[NORMAL] = "#ffffffffffff"
}
-widget "*.geany-search-entry-no-match" style:theme "geany-search-entry-no-match-style"
+widget "*.geany-search-entry-no-match" style "geany-search-entry-no-match-style"
# document status colors
style "geany-document-status-changed-style" {
@@ -36,6 +36,6 @@ style "geany-document-status-readonly-style" {
fg[NORMAL] = "#00007fff0000"
fg[ACTIVE] = "#00007fff0000"
}
-widget "*.geany-document-status-changed" style:theme "geany-document-status-changed-style"
-widget "*.geany-document-status-disk-changed" style:theme "geany-document-status-disk-changed-style"
-widget "*.geany-document-status-readonly" style:theme "geany-document-status-readonly-style"
+widget "*.geany-document-status-changed" style "geany-document-status-changed-style"
+widget "*.geany-document-status-disk-changed" style "geany-document-status-disk-changed-style"
+widget "*.geany-document-status-readonly" style "geany-document-status-readonly-style"
Modified: src/main.c
49 files changed, 49 insertions(+), 0 deletions(-)
===================================================================
@@ -969,6 +969,52 @@ static const gchar *get_locale(void)
}
+#if ! GTK_CHECK_VERSION(3, 0, 0)
+/* This prepends our own gtkrc file to the list of RC files to be loaded by GTK at startup.
+ * This function *has* to be called before gtk_init().
+ *
+ * We have a custom RC file defining various styles we need, and we want the user to be
+ * able to override them (e.g. if they want -- or need -- other colors). Fair enough, one
+ * would simply call gtk_rc_parse() with the appropriate filename. However, the styling
+ * rules applies in the order they are loaded, then if we load our styles after GTK has
+ * loaded the user's ones we'd override them.
+ *
+ * There are 2 solutions to fix this:
+ * 1) set our styles' priority to something with lower than "user" (actually "theme"
+ * priority because rules precedence are first calculated depending on the priority
+ * no matter of how precise the rules is, so we need to override the theme).
+ * 2) prepend our custom style to GTK's list while keeping priority to user (which is the
+ * default), so it gets loaded before real user's ones and so gets overridden by them.
+ *
+ * One would normally go for 1 because it's ways simpler and requires less code: you just
+ * have to add the priorities to your styles, which is a matter of adding a few ":theme" in
+ * the RC file. However, KDE being a bitch it doesn't set the gtk-theme-name but rather
+ * directly includes the style to use in a user gtkrc file, which makes the theme have
+ * "user" priority, hence overriding our styles. So, we cannot set priorities in the RC
+ * file if we want to support running under KDE, which pretty much leave us with no choice
+ * but to go with solution 2, which unfortunately requires writing ugly code since GTK
+ * don't have a gtk_rc_prepend_default_file() function. Thank you very much KDE.
+ *
+ * Though, as a side benefit it also makes the code work with people using gtk-chtheme,
+ * which also found it funny to include the theme in the user RC file. */
+static void setup_gtk2_styles(void)
+{
+ gchar **gtk_files = gtk_rc_get_default_files();
+ gchar **new_files = g_malloc(sizeof *new_files * (g_strv_length(gtk_files) + 2));
+ guint i = 0;
+
+ new_files[i++] = g_build_filename(app->datadir, "geany.gtkrc", NULL);
+ for (; *gtk_files; gtk_files++)
+ new_files[i++] = g_strdup(*gtk_files);
+ new_files[i] = NULL;
+
+ gtk_rc_set_default_files(new_files);
+
+ g_strfreev(new_files);
+}
+#endif
+
+
gint main(gint argc, gchar **argv)
{
GeanyDocument *doc;
@@ -990,6 +1036,9 @@ gint main(gint argc, gchar **argv)
memset(&ui_widgets, 0, sizeof(UIWidgets));
setup_paths();
+#if ! GTK_CHECK_VERSION(3, 0, 0)
+ setup_gtk2_styles();
+#endif
#ifdef ENABLE_NLS
main_locale_init(GEANY_LOCALEDIR, GETTEXT_PACKAGE);
#endif
Modified: src/ui_utils.c
5 files changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -2180,10 +2180,7 @@ static void init_custom_style(void)
g_object_unref(css);
g_free(css_file);
#else
- gchar *gtkrc_file = g_build_filename(app->datadir, "geany.gtkrc", NULL);
-
- gtk_rc_parse(gtkrc_file);
- g_free(gtkrc_file);
+ /* see setup_gtk2_styles() in main.c */
#endif
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Sat, 16 Mar 2013 14:14:41 UTC
Commit: 0cf495a6db90b068c2ec77404e863eef097fea66
https://github.com/geany/geany/commit/0cf495a6db90b068c2ec77404e863eef097fe…
Log Message:
-----------
Add Rust filetype
(See also: rust-lang.org)
Modified Paths:
--------------
data/filetype_extensions.conf
data/filetypes.Rust.conf
Modified: data/filetype_extensions.conf
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -49,6 +49,7 @@ Po=*.po;*.pot;
Python=*.py;*.pyw;SConstruct;SConscript;
reStructuredText=*.rest;*.reST;*.rst;
R=*.R;*.r;
+Rust=*.rs
Ruby=*.rb;*.rhtml;*.ruby;
Scala=*.scala;*.scl;
Sh=*.sh;configure;configure.in;configure.in.in;configure.ac;*.ksh;*.zsh;*.ash;*.bash;*.m4;
@@ -64,7 +65,7 @@ None=*;
# Note: restarting is required after editing groups
[Groups]
-Programming=Cython;Genie;Go;Scala;
+Programming=Cython;Genie;Go;Rust;Scala;
Script=
Markup=
Misc=
Modified: data/filetypes.Rust.conf
61 files changed, 61 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,61 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling=C]
+
+[keywords]
+# all items must be in one line
+primary=as break const copy do drop else enum extern false fn for if impl let log loop match mod mut priv pub pure ref return self static struct super true trait type unsafe use while
+secondary=
+# these are the Doxygen keywords
+docComment=a addindex addtogroup anchor arg attention author authors b brief bug c callergraph callgraph category cite class code cond copybrief copydetails copydoc copyright date def defgroup deprecated details dir dontinclude dot dotfile e else elseif em endcode endcond enddot endhtmlonly endif endinternal endlatexonly endlink endmanonly endmsc endrtfonly endverbatim endxmlonly enum example exception extends file fn headerfile hideinitializer htmlinclude htmlonly if ifnot image implements include includelineno ingroup interface internal invariant latexonly li line link mainpage manonly memberof msc mscfile n name namespace nosubgrouping note overload p package page par paragraph param post pre private privatesection property protected protectedsection protocol public publicsection ref related relatedalso relates relatesalso remark remarks result return returns retval rtfonly sa section see short showinitializer since skip skipline snippet struct subpage subsection subsubsection tableofcontents test throw throws todo tparam typedef union until var verbatim verbinclude version warning weakgroup xmlonly xrefitem
+
+[lexer_properties]
+# preprocessor properties - possibly useful for tweaking #[attribute] highlighting
+#styling.within.preprocessor=1
+#lexer.cpp.track.preprocessor=0
+#preprocessor.symbol.$(file.patterns.cpp)=#
+#preprocessor.start.$(file.patterns.cpp)=if ifdef ifndef
+#preprocessor.middle.$(file.patterns.cpp)=else elif
+#preprocessor.end.$(file.patterns.cpp)=endif
+
+[settings]
+# default extension used when saving files
+extension=rs
+lexer_filetype=C
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# single comments, like # in this file
+comment_single=//
+# multiline comments
+comment_open=/*
+comment_close=*/
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+ #command_example();
+# setting to false would generate this
+# command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
+[build-menu]
+FT_00_LB=_Compile
+FT_00_CM=rustc -c "%f"
+FT_00_WD=
+FT_01_LB=_Build
+FT_01_CM=rustc "%f"
+FT_01_WD=
+EX_00_LB=_Run
+EX_00_CM="./%e"
+EX_00_WD=
+
+
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).