Merge lp:~midori/midori/win32theme into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6286
Merged at revision: 6317
Proposed branch: lp:~midori/midori/win32theme
Merge into: lp:midori
Diff against target: 104 lines (+65/-0)
3 files modified
midori/midori-preferences.c (+44/-0)
midori/midori-settings.vala (+20/-0)
win32/makedist/makedist.midori (+1/-0)
To merge this branch: bzr merge lp:~midori/midori/win32theme
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+178462@code.launchpad.net

Commit message

Implement GTK+ theme switching via Preferences (Win32)

To post a comment you must log in.
Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Works nice. Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-preferences.c'
2--- midori/midori-preferences.c 2013-07-26 16:08:27 +0000
3+++ midori/midori-preferences.c 2013-08-04 15:35:32 +0000
4@@ -241,6 +241,17 @@
5 }
6 #endif
7
8+#ifdef G_OS_WIN32
9+static void
10+midori_preferences_theme_changed_cb (GtkWidget* button,
11+ gpointer user_data)
12+{
13+ MidoriSettings* settings = user_data;
14+ midori_settings_set_theme_name (settings,
15+ gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (button)));
16+}
17+#endif
18+
19 /**
20 * midori_preferences_set_settings:
21 * @settings: the settings
22@@ -426,6 +437,39 @@
23 /* Page "Interface" */
24 PAGE_NEW (GTK_STOCK_CONVERT, _("Browsing"));
25 FRAME_NEW (NULL);
26+ #ifdef G_OS_WIN32
27+ INDENTED_ADD (gtk_label_new (_("Theme:")));
28+ button = gtk_combo_box_text_new ();
29+ SPANNED_ADD (button);
30+ guint i = 0;
31+ /* On Windows the default theme may be a built-in specific to the
32+ running system. So we always add the default and skip it later.
33+ */
34+ const gchar* default_theme = midori_settings_get_default_theme_name (MIDORI_SETTINGS (settings));
35+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (button), default_theme);
36+ gtk_combo_box_set_active (GTK_COMBO_BOX (button), i++);
37+
38+ const gchar* current_theme = midori_settings_get_theme_name (MIDORI_SETTINGS (settings));
39+ gchar* theme_path = midori_paths_get_data_filename ("themes", FALSE);
40+ GDir* dir;
41+ if ((dir = g_dir_open (theme_path, 0, NULL)))
42+ {
43+ const gchar* name;
44+ while ((name = g_dir_read_name (dir)))
45+ {
46+ if (!g_strcmp0 (name, default_theme))
47+ continue;
48+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (button), name);
49+ if (!g_strcmp0 (name, current_theme))
50+ gtk_combo_box_set_active (GTK_COMBO_BOX (button), i);
51+ i++;
52+ }
53+ g_dir_close (dir);
54+ g_signal_connect (button, "changed",
55+ G_CALLBACK (midori_preferences_theme_changed_cb), settings);
56+ }
57+ g_free (theme_path);
58+ #endif
59 INDENTED_ADD (gtk_label_new (_("Toolbar Style:")));
60 button = katze_property_proxy (settings, "toolbar-style", NULL);
61 SPANNED_ADD (button);
62
63=== modified file 'midori/midori-settings.vala'
64--- midori/midori-settings.vala 2013-07-07 12:25:55 +0000
65+++ midori/midori-settings.vala 2013-08-04 15:35:32 +0000
66@@ -65,6 +65,26 @@
67 /* Since: 0.4.8 */
68 public uint inactivity_reset { get; set; default = 0; }
69
70+ string? default_theme_name_ = null;
71+ /* Since: 0.5.5 */
72+ public string? default_theme_name { get {
73+ if (default_theme_name_ == null)
74+ default_theme_name_ = Gtk.Settings.get_default ().gtk_theme_name;
75+ return default_theme_name_;
76+ } }
77+ string? theme_name_ = null;
78+ /* Since: 0.5.5 */
79+ public string? theme_name { get {
80+ return theme_name_;
81+ } set {
82+ if (theme_name != value) {
83+ if (default_theme_name_ == null)
84+ default_theme_name_ = Gtk.Settings.get_default ().gtk_theme_name;
85+ theme_name_ = value;
86+ Gtk.Settings.get_default ().gtk_theme_name = theme_name_;
87+ }
88+ } }
89+
90 GLib.Regex? block_uris_regex = null;
91 /* Since: 0.4.8 */
92 public string? block_uris { get {
93
94=== modified file 'win32/makedist/makedist.midori'
95--- win32/makedist/makedist.midori 2013-06-01 22:51:02 +0000
96+++ win32/makedist/makedist.midori 2013-08-04 15:35:32 +0000
97@@ -207,6 +207,7 @@
98 if [ "$GTK3_BUILD" == "1" ]; then
99 grab_files share webkitgtk-3.0
100 grab_files share schemas
101+ grab_files share/themes/Greybird/ gtk-3.0
102 MO_VER=30
103 else
104 grab_files share MS-Windows

Subscribers

People subscribed via source and target branches

to all changes: