diff options
author | raveit65 <[email protected]> | 2016-08-07 15:51:22 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-09-01 08:21:55 +0200 |
commit | b56e693edb14526236f921592bb2209e407864db (patch) | |
tree | efce28df40a1dd86dbbc608f757877d5256bc99a /logview/src/logview-prefs.c | |
parent | f400f03c2e7245f903b8d769304dfae67e6e479c (diff) | |
download | mate-utils-b56e693edb14526236f921592bb2209e407864db.tar.bz2 mate-utils-b56e693edb14526236f921592bb2209e407864db.tar.xz |
GTK+-3 logview-prefs: complete migration to GdkRGBA
taken from:
https://git.gnome.org/browse/gnome-system-log/commit/?id=d71f51f
Diffstat (limited to 'logview/src/logview-prefs.c')
-rw-r--r-- | logview/src/logview-prefs.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/logview/src/logview-prefs.c b/logview/src/logview-prefs.c index 0a2e0093..2cf8a366 100644 --- a/logview/src/logview-prefs.c +++ b/logview/src/logview-prefs.c @@ -154,7 +154,11 @@ load_filters (LogviewPrefs *prefs) const gchar *str; LogviewFilter *filter; GtkTextTag *tag; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA color; +#else GdkColor color; +#endif gint idx; filters = g_settings_get_strv (prefs->priv->logview_prefs, @@ -174,6 +178,16 @@ load_filters (LogviewPrefs *prefs) g_str_equal (tokens[FILTER_INVISIBLE], "1"), NULL); if (strlen (tokens[FILTER_FOREGROUND])) { +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_rgba_parse (&color, tokens[FILTER_FOREGROUND]); + g_object_set (tag, "foreground-rgba", &color, + "foreground-set", TRUE, NULL); + } + + if (strlen (tokens[FILTER_BACKGROUND])) { + gdk_rgba_parse (&color, tokens[FILTER_BACKGROUND]); + g_object_set (tag, "paragraph-background-rgba", &color, +#else gdk_color_parse (tokens[FILTER_FOREGROUND], &color); g_object_set (tag, "foreground-gdk", &color, "foreground-set", TRUE, NULL); @@ -182,6 +196,7 @@ load_filters (LogviewPrefs *prefs) if (strlen (tokens[FILTER_BACKGROUND])) { gdk_color_parse (tokens[FILTER_BACKGROUND], &color); g_object_set (tag, "paragraph-background-gdk", &color, +#endif "paragraph-background-set", TRUE, NULL); } @@ -204,9 +219,15 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) GPtrArray *filters; const gchar *name; LogviewFilter *filter; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA *foreground; + gboolean foreground_set; + GdkRGBA *background; +#else GdkColor *foreground; gboolean foreground_set; GdkColor *background; +#endif gboolean background_set; gchar *regex, *color; gboolean invisible; @@ -226,6 +247,41 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) "texttag", &tag, NULL); g_object_get (tag, +#if GTK_CHECK_VERSION (3, 0, 0) + "foreground-set", &foreground_set, + "foreground-rgba", &foreground, + "paragraph-background-set", &background_set, + "paragraph-background-rgba", &background, + "invisible", &invisible, NULL); + + if (invisible) { + g_string_append (prefs_string, "1" DELIMITER); + } else { + g_string_append (prefs_string, "0" DELIMITER); + } + + if (foreground_set) { + color = gdk_rgba_to_string (foreground); + g_string_append (prefs_string, color); + g_free (color); + } + + if (foreground) { + gdk_rgba_free (foreground); + } + + g_string_append (prefs_string, DELIMITER); + + if (background_set) { + color = gdk_rgba_to_string (background); + g_string_append (prefs_string, color); + g_free (color); + } + + if (background) { + gdk_rgba_free (background); + } +#else "foreground-gdk", &foreground, "paragraph-background-gdk", &background, "foreground-set", &foreground_set, @@ -259,6 +315,7 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) if (background) { gdk_color_free (background); } +#endif g_string_append (prefs_string, DELIMITER); g_string_append (prefs_string, regex); |