summarylogtreecommitdiffstats
path: root/0002-Add-styling-support-for-GTK-3.patch
blob: 22581d89e0acb99426eb45cbd0d2a1b867311f6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
From bf9e12f494b3ca8ba928844bbbaceb6b6ffd8855 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Sat, 25 Jul 2015 00:36:58 +0200
Subject: [PATCH 2/2] Add styling support for GTK+ 3

Styling is done via CSS files. Add a default CSS style.
---
 Makefile.am          |  4 +++-
 README               |  6 ++++--
 data/lxlauncher.1.in |  5 ++++-
 gtk.css              | 26 ++++++++++++++++++++++++++
 src/lxlauncher.c     | 26 ++++++++++++++++++++++++++
 5 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100644 gtk.css

diff --git a/Makefile.am b/Makefile.am
index d939271..e99f472 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,9 @@ conf_in_files=settings.conf.in
 conf_DATA=$(conf_in_files:.conf.in=.conf)
 
 themedir=$(confdir)
-theme_DATA=gtkrc
+theme_DATA=\
+	gtkrc \
+	gtk.css
 
 menufiledir=$(sysconfdir)/xdg/menus
 menufile_DATA=\
diff --git a/README b/README
index 3be4e9c..122ca01 100644
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ Also, if you put the tab icons of Asus launcher under
 /usr/share/lxlauncher/icons, they will be used in the tabs.
 Otherwise, some icons from the gtk+ icon theme will be used instead.
 
-The LXLauncher has two configuration files to be tuned by users:
+The LXLauncher has three configuration files to be tuned by users:
 
 1) ~/.config/lxlauncher/settings.conf which is an init-style file with
 contents defaults as below:
@@ -25,7 +25,9 @@ contents defaults as below:
 BUTTON_SIZE = 120
 IMG_SIZE = 48
 
-2) ~/.config/lxlauncher/gtkrc which is an RC file with custom style.
+2) ~/.config/lxlauncher/gtkrc which is a GTK+ 2 RC file with custom style.
+
+3) ~/.config/lxlauncher/gtk.css which is a GTK+ 3 CSS file with custom style.
 
 Also one additional setting can be set in global GTK settings:
 
diff --git a/data/lxlauncher.1.in b/data/lxlauncher.1.in
index 3ce7193..79514df 100644
--- a/data/lxlauncher.1.in
+++ b/data/lxlauncher.1.in
@@ -17,7 +17,10 @@ specific application programs to one view under tabs.
 An init-style file with display settings
 .TP
 .I ~/.config/lxlauncher/gtkrc
-A GTK+ RC file with style definitions
+A GTK+ 2 RC file with style definitions
+.TP
+.I ~/.config/lxlauncher/gtk.css
+A GTK+ 3 CSS file with style definitions
 .SH AUTHOR
 lxlauncher was written by Hong Jen Yee <pcman.tw@gmail.com>.
 Some code was taken from guification plugin of gaim/pidgin and
diff --git a/gtk.css b/gtk.css
new file mode 100644
index 0000000..93407ee
--- /dev/null
+++ b/gtk.css
@@ -0,0 +1,26 @@
+GtkViewport {
+	background: none;
+}
+
+.notebook {
+	background: #3675AD;
+	font: Sans Bold 11;
+}
+
+.notebook > .frame,
+.notebook > .vertical {
+	background: #B7D6EA;
+}
+
+.notebook > .horizontal .label {
+	color: #B7D6EA;
+}
+
+.notebook > .horizontal.active-page .label {
+	color: #FFFFFF;
+}
+
+.notebook > .vertical .label,
+.button .label {
+	color: #3675AD;
+}
diff --git a/src/lxlauncher.c b/src/lxlauncher.c
index b6f566e..74d9d08 100644
--- a/src/lxlauncher.c
+++ b/src/lxlauncher.c
@@ -908,6 +908,31 @@ int main(int argc, char** argv)
     gchar *file;
 
     i = g_strv_length((char **)system_dirs);
+#if GTK_CHECK_VERSION(3,0,0)
+    while (i > 0)
+    {
+        file=g_build_filename(system_dirs[--i], "lxlauncher/gtk.css", NULL);
+        if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
+        {
+            GtkCssProvider *css = gtk_css_provider_new();
+            gtk_css_provider_load_from_path(css, file, NULL);
+            gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
+                    GTK_STYLE_PROVIDER(css),
+                    GTK_STYLE_PROVIDER_PRIORITY_USER);
+        }
+        free(file);
+    }
+    file=g_build_filename(g_get_user_config_dir(), "lxlauncher/gtk.css", NULL);
+    if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
+    {
+        GtkCssProvider *css = gtk_css_provider_new();
+        gtk_css_provider_load_from_path(css, file, NULL);
+        gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
+                GTK_STYLE_PROVIDER(css),
+                GTK_STYLE_PROVIDER_PRIORITY_USER);
+    }
+    free(file);
+#else
     while (i > 0)
     {
         file = g_build_filename(system_dirs[--i], "lxlauncher/gtkrc", NULL);
@@ -919,6 +944,7 @@ int main(int argc, char** argv)
     if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
         gtk_rc_parse(file);
     free(file);
+#endif
 
     button_size = g_key_file_get_integer(key_file, "Main", "BUTTON_SIZE", NULL);
     img_size = g_key_file_get_integer(key_file, "Main", "IMG_SIZE", NULL);
-- 
2.4.6