Merge lp:~ballogy/gloobus-preview/drop-gconf into lp:gloobus-preview
- drop-gconf
- Merge into last_working_branch
Proposed by
Balló György
Status: | Merged |
---|---|
Merged at revision: | 297 |
Proposed branch: | lp:~ballogy/gloobus-preview/drop-gconf |
Merge into: | lp:gloobus-preview |
Diff against target: |
305 lines (+86/-84) 7 files modified
configure.ac (+0/-1) src/Makefile.am (+0/-2) src/gloobus-preview-config.cpp (+17/-25) src/gloobus-preview-config.h (+1/-5) src/gloobus-preview-configuration (+48/-45) src/plugin-pixbuf/plugin-pixbuf.cpp (+10/-4) src/plugin-text/plugin-text.cpp (+10/-2) |
To merge this branch: | bzr merge lp:~ballogy/gloobus-preview/drop-gconf |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gloobus Developers | Pending | ||
Review via email:
|
Commit message
Description of the change
Update locations of GNOME configuration
In GNOME 3, these settings were moved from GConf to GSettings. Remove GConf dependency.
To post a comment you must log in.
- 293. By Balló György
-
Small fix
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2014-12-23 10:30:25 +0000 | |||
3 | +++ configure.ac 2014-12-23 10:46:51 +0000 | |||
4 | @@ -42,7 +42,6 @@ | |||
5 | 42 | PKG_CHECK_MODULES(ATK, atk) | 42 | PKG_CHECK_MODULES(ATK, atk) |
6 | 43 | PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0) | 43 | PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0) |
7 | 44 | PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0) | 44 | PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0) |
8 | 45 | PKG_CHECK_MODULES(GCONF2, gconf-2.0) | ||
9 | 46 | PKG_CHECK_MODULES(CAIRO, cairo) | 45 | PKG_CHECK_MODULES(CAIRO, cairo) |
10 | 47 | PKG_CHECK_MODULES(GSTREAMER, gstreamer-1.0) | 46 | PKG_CHECK_MODULES(GSTREAMER, gstreamer-1.0) |
11 | 48 | PKG_CHECK_MODULES(GSTREAMER_PLUGINS, gstreamer-plugins-base-1.0) | 47 | PKG_CHECK_MODULES(GSTREAMER_PLUGINS, gstreamer-plugins-base-1.0) |
12 | 49 | 48 | ||
13 | === modified file 'src/Makefile.am' | |||
14 | --- src/Makefile.am 2014-12-22 06:30:44 +0000 | |||
15 | +++ src/Makefile.am 2014-12-23 10:46:51 +0000 | |||
16 | @@ -21,7 +21,6 @@ | |||
17 | 21 | AM_CPPFLAGS += \ | 21 | AM_CPPFLAGS += \ |
18 | 22 | $(CAIRO_CFLAGS) \ | 22 | $(CAIRO_CFLAGS) \ |
19 | 23 | $(GTK_CFLAGS) \ | 23 | $(GTK_CFLAGS) \ |
20 | 24 | $(GCONF2_CFLAGS) \ | ||
21 | 25 | $(PTHREAD_CFLAGS) \ | 24 | $(PTHREAD_CFLAGS) \ |
22 | 26 | $(GTKSOURCEVIEW_CFLAGS) \ | 25 | $(GTKSOURCEVIEW_CFLAGS) \ |
23 | 27 | $(GLIB_CFLAGS) \ | 26 | $(GLIB_CFLAGS) \ |
24 | @@ -33,7 +32,6 @@ | |||
25 | 33 | $(PTHREAD_LIBS) \ | 32 | $(PTHREAD_LIBS) \ |
26 | 34 | $(CAIRO_LIBS) \ | 33 | $(CAIRO_LIBS) \ |
27 | 35 | $(GTK_LIBS) \ | 34 | $(GTK_LIBS) \ |
28 | 36 | $(GCONF2_LIBS) \ | ||
29 | 37 | $(GTKSOURCEVIEW_LIBS) \ | 35 | $(GTKSOURCEVIEW_LIBS) \ |
30 | 38 | $(GLIB_LIBS) \ | 36 | $(GLIB_LIBS) \ |
31 | 39 | $(DBUS_LIBS) \ | 37 | $(DBUS_LIBS) \ |
32 | 40 | 38 | ||
33 | === modified file 'src/gloobus-preview-config.cpp' | |||
34 | --- src/gloobus-preview-config.cpp 2010-08-29 14:37:10 +0000 | |||
35 | +++ src/gloobus-preview-config.cpp 2014-12-23 10:46:51 +0000 | |||
36 | @@ -1,7 +1,7 @@ | |||
37 | 1 | #include <string> | 1 | #include <string> |
38 | 2 | #include <glib.h> | 2 | #include <glib.h> |
39 | 3 | #include <gio/gio.h> | ||
40 | 3 | #include "gloobus-preview-config.h" | 4 | #include "gloobus-preview-config.h" |
41 | 4 | #include <gconf/gconf-client.h> | ||
42 | 5 | #include "config.h" | 5 | #include "config.h" |
43 | 6 | 6 | ||
44 | 7 | GloobusConfig::GloobusConfig( void ) | 7 | GloobusConfig::GloobusConfig( void ) |
45 | @@ -21,20 +21,22 @@ | |||
46 | 21 | 21 | ||
47 | 22 | GloobusConfig::~GloobusConfig( void ){} | 22 | GloobusConfig::~GloobusConfig( void ){} |
48 | 23 | 23 | ||
50 | 24 | bool GloobusConfig::get_gconf_win_layout() | 24 | bool GloobusConfig::get_gsettings_win_layout() |
51 | 25 | { | 25 | { |
64 | 26 | GConfClient* client_; | 26 | gchar* button_layout; |
65 | 27 | GError* error = NULL; | 27 | GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default (); |
66 | 28 | client_ = gconf_client_get_default(); | 28 | GSettingsSchema *wm_schema = g_settings_schema_source_lookup (schema_source, "org.gnome.desktop.wm.preferences", FALSE); |
67 | 29 | if (!client_) { | 29 | if (wm_schema) { |
68 | 30 | g_debug("Unable to create a gconf client"); | 30 | GSettings *wm_settings = g_settings_new ("org.gnome.desktop.wm.preferences"); |
69 | 31 | return false; | 31 | button_layout = g_settings_get_string (wm_settings, "button-layout"); |
70 | 32 | } | 32 | g_object_unref (wm_settings); |
71 | 33 | gchar* gconf_value = gconf_client_get_string(client_, "/apps/metacity/general/button_layout", &error); | 33 | g_settings_schema_unref (wm_schema); |
72 | 34 | if (!gconf_value) { | 34 | } |
73 | 35 | return false; | 35 | |
74 | 36 | } | 36 | if (!button_layout) { |
75 | 37 | if (int(string(gconf_value).find("close")) - int(string(gconf_value).find(":")) > 0) | 37 | return false; |
76 | 38 | } | ||
77 | 39 | if (int(string(button_layout).find("close")) - int(string(button_layout).find(":")) > 0) | ||
78 | 38 | m_winbar_layout = false; | 40 | m_winbar_layout = false; |
79 | 39 | else | 41 | else |
80 | 40 | m_winbar_layout = true; | 42 | m_winbar_layout = true; |
81 | @@ -42,16 +44,6 @@ | |||
82 | 42 | return true; | 44 | return true; |
83 | 43 | } | 45 | } |
84 | 44 | 46 | ||
85 | 45 | char* GloobusConfig::get_gconf_value_string( const char* key) { | ||
86 | 46 | GConfClient* client_; | ||
87 | 47 | client_ = gconf_client_get_default(); | ||
88 | 48 | if (!client_) { | ||
89 | 49 | g_debug("Unable to create a gconf client"); | ||
90 | 50 | return 0; | ||
91 | 51 | } | ||
92 | 52 | return gconf_client_get_string(client_, key, NULL); | ||
93 | 53 | } | ||
94 | 54 | |||
95 | 55 | //============== LOAD CONFIG ==============// | 47 | //============== LOAD CONFIG ==============// |
96 | 56 | bool GloobusConfig::load_config() | 48 | bool GloobusConfig::load_config() |
97 | 57 | { | 49 | { |
98 | @@ -67,7 +59,7 @@ | |||
99 | 67 | m_focus = g_key_file_get_boolean( keyFile,"Main","focus", NULL ); | 59 | m_focus = g_key_file_get_boolean( keyFile,"Main","focus", NULL ); |
100 | 68 | theme_gtk = g_key_file_get_boolean( keyFile,"Theme","gtk", NULL ); | 60 | theme_gtk = g_key_file_get_boolean( keyFile,"Theme","gtk", NULL ); |
101 | 69 | 61 | ||
103 | 70 | if (!get_gconf_win_layout()) | 62 | if (!get_gsettings_win_layout()) |
104 | 71 | m_winbar_layout = (bool)g_key_file_get_integer ( keyFile,"Main","winbar_layout", NULL ); | 63 | m_winbar_layout = (bool)g_key_file_get_integer ( keyFile,"Main","winbar_layout", NULL ); |
105 | 72 | g_key_file_free ( keyFile ); | 64 | g_key_file_free ( keyFile ); |
106 | 73 | 65 | ||
107 | 74 | 66 | ||
108 | === modified file 'src/gloobus-preview-config.h' | |||
109 | --- src/gloobus-preview-config.h 2010-05-01 14:34:16 +0000 | |||
110 | +++ src/gloobus-preview-config.h 2014-12-23 10:46:51 +0000 | |||
111 | @@ -45,7 +45,7 @@ | |||
112 | 45 | bool load_config (void); | 45 | bool load_config (void); |
113 | 46 | 46 | ||
114 | 47 | 47 | ||
116 | 48 | bool get_gconf_win_layout(void); | 48 | bool get_gsettings_win_layout(void); |
117 | 49 | 49 | ||
118 | 50 | /* Returns if show gloobus-preview in taskbar | 50 | /* Returns if show gloobus-preview in taskbar |
119 | 51 | * */ | 51 | * */ |
120 | @@ -78,10 +78,6 @@ | |||
121 | 78 | * */ | 78 | * */ |
122 | 79 | gp_action get_cli_action (void); | 79 | gp_action get_cli_action (void); |
123 | 80 | 80 | ||
124 | 81 | /* get a gconf value | ||
125 | 82 | * */ | ||
126 | 83 | char* get_gconf_value_string( const char*); | ||
127 | 84 | |||
128 | 85 | char* get_theme ( void ); | 81 | char* get_theme ( void ); |
129 | 86 | 82 | ||
130 | 87 | bool get_theme_gtk ( void ); | 83 | bool get_theme_gtk ( void ); |
131 | 88 | 84 | ||
132 | === modified file 'src/gloobus-preview-configuration' | |||
133 | --- src/gloobus-preview-configuration 2014-12-20 21:18:38 +0000 | |||
134 | +++ src/gloobus-preview-configuration 2014-12-23 10:46:51 +0000 | |||
135 | @@ -6,52 +6,52 @@ | |||
136 | 6 | import os | 6 | import os |
137 | 7 | import sys | 7 | import sys |
138 | 8 | import glob | 8 | import glob |
140 | 9 | from gi.repository import Gtk, GConf | 9 | from gi.repository import Gtk, GConf, Gio |
141 | 10 | import signal | 10 | import signal |
142 | 11 | import gettext | 11 | import gettext |
143 | 12 | #import config | 12 | #import config |
144 | 13 | 13 | ||
145 | 14 | #=========================== CLASS COLORS =======================================================# | 14 | #=========================== CLASS COLORS =======================================================# |
186 | 15 | class colors: | 15 | class colors: |
187 | 16 | 16 | ||
188 | 17 | colors_code = ["\033[1;37m","\033[1;36m","\033[1;33m","\033[1;31m","\033[1;m"] | 17 | colors_code = ["\033[1;37m","\033[1;36m","\033[1;33m","\033[1;31m","\033[1;m"] |
189 | 18 | colors_name = ["white","blue","yellow","red", "reset"] | 18 | colors_name = ["white","blue","yellow","red", "reset"] |
190 | 19 | levels_name = ["info","debug","warning","error","reset"] | 19 | levels_name = ["info","debug","warning","error","reset"] |
191 | 20 | debugMode = False | 20 | debugMode = False |
192 | 21 | 21 | ||
193 | 22 | 22 | ||
194 | 23 | #=================== GET CODE BY COLOR ===================# | 23 | #=================== GET CODE BY COLOR ===================# |
195 | 24 | def color(self,color): | 24 | def color(self,color): |
196 | 25 | self.debug = debug | 25 | self.debug = debug |
197 | 26 | 26 | ||
198 | 27 | for i in range(len(self.colors_name)): | 27 | for i in range(len(self.colors_name)): |
199 | 28 | if color == self.colors_name[i]: | 28 | if color == self.colors_name[i]: |
200 | 29 | return self.colors_code[i] | 29 | return self.colors_code[i] |
201 | 30 | return "" | 30 | return "" |
202 | 31 | 31 | ||
203 | 32 | #=================== GET CODE BY LEVEL ===================# | 32 | #=================== GET CODE BY LEVEL ===================# |
204 | 33 | def level(self,level): | 33 | def level(self,level): |
205 | 34 | for i in range(len(self.colors_name)): | 34 | for i in range(len(self.colors_name)): |
206 | 35 | if level == self.levels_name[i]: | 35 | if level == self.levels_name[i]: |
207 | 36 | return self.colors_code[i] | 36 | return self.colors_code[i] |
208 | 37 | return "" | 37 | return "" |
209 | 38 | 38 | ||
210 | 39 | #====================== SET DEBUG =======================# | 39 | #====================== SET DEBUG =======================# |
211 | 40 | def set_debug(self,debug): | 40 | def set_debug(self,debug): |
212 | 41 | self.debugMode = debug | 41 | self.debugMode = debug |
213 | 42 | 42 | ||
214 | 43 | #================= PREDEFINED MACROS =======================# | 43 | #================= PREDEFINED MACROS =======================# |
215 | 44 | def debug(self,string): | 44 | def debug(self,string): |
216 | 45 | if self.debugMode: | 45 | if self.debugMode: |
217 | 46 | print self.level('debug') + "[DEBUG] " + self.level('reset') + string | 46 | print self.level('debug') + "[DEBUG] " + self.level('reset') + string |
218 | 47 | 47 | ||
219 | 48 | def info(self,string): | 48 | def info(self,string): |
220 | 49 | print self.level('info') + "[INFO] " + self.level('reset') + string | 49 | print self.level('info') + "[INFO] " + self.level('reset') + string |
221 | 50 | 50 | ||
222 | 51 | def warning(self,string): | 51 | def warning(self,string): |
223 | 52 | print self.level('warning') + "[WARNING] " + self.level('reset') + string | 52 | print self.level('warning') + "[WARNING] " + self.level('reset') + string |
224 | 53 | 53 | ||
225 | 54 | def error(self,string): | 54 | def error(self,string): |
226 | 55 | print self.level('error') + "[ERROR] " + self.level('reset') + string | 55 | print self.level('error') + "[ERROR] " + self.level('reset') + string |
227 | 56 | 56 | ||
228 | 57 | 57 | ||
229 | @@ -62,14 +62,17 @@ | |||
230 | 62 | entry2 = None #Allways on top | 62 | entry2 = None #Allways on top |
231 | 63 | entry3 = None #Quit on lose focus | 63 | entry3 = None #Quit on lose focus |
232 | 64 | entry4 = None #Win bar layout | 64 | entry4 = None #Win bar layout |
234 | 65 | gconf_win_layout = None | 65 | gsettings_win_layout = None |
235 | 66 | config = None | 66 | config = None |
236 | 67 | 67 | ||
237 | 68 | def __init__(self): | 68 | def __init__(self): |
238 | 69 | self.config = config_load() | 69 | self.config = config_load() |
239 | 70 | 70 | ||
242 | 71 | self.client = GConf.Client.get_default() | 71 | schema_source = Gio.SettingsSchemaSource.get_default() |
243 | 72 | self.gconf_win_layout = self.client.get_string('/apps/metacity/general/button_layout') | 72 | wm_schema =Gio.SettingsSchemaSource.lookup(schema_source, "org.gnome.desktop.wm.preferences", False) |
244 | 73 | if wm_schema: | ||
245 | 74 | wm_settings = Gio.Settings.new("org.gnome.desktop.wm.preferences") | ||
246 | 75 | self.gsettings_win_layout = wm_settings.get_string("button-layout") | ||
247 | 73 | 76 | ||
248 | 74 | #================= Show In Taskbar ================= # | 77 | #================= Show In Taskbar ================= # |
249 | 75 | self.entry1 = Gtk.CheckButton(label=_("Show in TaskBar"), use_underline=False) | 78 | self.entry1 = Gtk.CheckButton(label=_("Show in TaskBar"), use_underline=False) |
250 | @@ -124,7 +127,7 @@ | |||
251 | 124 | general_container.add(self.entry2) #Always on top | 127 | general_container.add(self.entry2) #Always on top |
252 | 125 | general_container.add(self.entry3) #Always on top | 128 | general_container.add(self.entry3) #Always on top |
253 | 126 | general_container.add(self.theme_gtk_entry) | 129 | general_container.add(self.theme_gtk_entry) |
255 | 127 | if self.gconf_win_layout == None: | 130 | if self.gsettings_win_layout == None: |
256 | 128 | general_container.add(self.entry4) #Always on top | 131 | general_container.add(self.entry4) #Always on top |
257 | 129 | 132 | ||
258 | 130 | general_container.add(Gtk.HSeparator()) | 133 | general_container.add(Gtk.HSeparator()) |
259 | 131 | 134 | ||
260 | === modified file 'src/plugin-pixbuf/plugin-pixbuf.cpp' | |||
261 | --- src/plugin-pixbuf/plugin-pixbuf.cpp 2010-08-29 14:37:10 +0000 | |||
262 | +++ src/plugin-pixbuf/plugin-pixbuf.cpp 2014-12-23 10:46:51 +0000 | |||
263 | @@ -121,9 +121,15 @@ | |||
264 | 121 | 121 | ||
265 | 122 | void iPixbuf::set_as_background_cb() | 122 | void iPixbuf::set_as_background_cb() |
266 | 123 | { | 123 | { |
269 | 124 | //gconftool-2 --type string --set /desktop/gnome/background/picture_filename /path/to/image.jpg | 124 | const gchar *uri = g_file_get_uri (Gloobus::instance()->get_file()); |
270 | 125 | g_debug("Set as background current image %s", Gloobus::instance()->get_filename().c_str()); | 125 | g_debug("Set as background current image %s", uri); |
271 | 126 | 126 | ||
274 | 127 | string cmd = "gconftool-2 --type string --set /desktop/gnome/background/picture_filename "+ Gloobus::instance()->get_filename(); | 127 | GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default (); |
275 | 128 | g_spawn_command_line_async(cmd.c_str(), NULL); | 128 | GSettingsSchema *background_schema = g_settings_schema_source_lookup (schema_source, "org.gnome.desktop.background", FALSE); |
276 | 129 | if (background_schema) { | ||
277 | 130 | GSettings *background_settings = g_settings_new ("org.gnome.desktop.background"); | ||
278 | 131 | g_settings_set_string (background_settings, "picture-uri", uri); | ||
279 | 132 | g_object_unref (background_settings); | ||
280 | 133 | g_settings_schema_unref (background_schema); | ||
281 | 134 | } | ||
282 | 129 | } | 135 | } |
283 | 130 | 136 | ||
284 | === modified file 'src/plugin-text/plugin-text.cpp' | |||
285 | --- src/plugin-text/plugin-text.cpp 2010-03-27 15:55:08 +0000 | |||
286 | +++ src/plugin-text/plugin-text.cpp 2014-12-23 10:46:51 +0000 | |||
287 | @@ -29,8 +29,16 @@ | |||
288 | 29 | return 0; | 29 | return 0; |
289 | 30 | } | 30 | } |
290 | 31 | 31 | ||
293 | 32 | GloobusConfig * config = Gloobus::instance()->get_config(); | 32 | char* theme; |
294 | 33 | char* theme = config->get_gconf_value_string("/apps/gedit-2/preferences/editor/colors/scheme"); | 33 | GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default (); |
295 | 34 | GSettingsSchema *gedit_schema = g_settings_schema_source_lookup (schema_source, "org.gnome.gedit.preferences.editor", FALSE); | ||
296 | 35 | if (gedit_schema) { | ||
297 | 36 | GSettings *gedit_settings = g_settings_new ("org.gnome.gedit.preferences.editor"); | ||
298 | 37 | theme = g_settings_get_string (gedit_settings, "scheme"); | ||
299 | 38 | g_object_unref (gedit_settings); | ||
300 | 39 | g_settings_schema_unref (gedit_schema); | ||
301 | 40 | } | ||
302 | 41 | |||
303 | 34 | if(theme) { | 42 | if(theme) { |
304 | 35 | GtkSourceStyleSchemeManager * sc_manager; | 43 | GtkSourceStyleSchemeManager * sc_manager; |
305 | 36 | sc_manager = gtk_source_style_scheme_manager_get_default(); | 44 | sc_manager = gtk_source_style_scheme_manager_get_default(); |