Merge lp:~ballogy/gloobus-preview/drop-gconf into lp:gloobus-preview

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
Reviewer Review Type Date Requested Status
Gloobus Developers Pending
Review via email: mp+245322@code.launchpad.net

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
=== modified file 'configure.ac'
--- configure.ac 2014-12-23 10:30:25 +0000
+++ configure.ac 2014-12-23 10:46:51 +0000
@@ -42,7 +42,6 @@
42PKG_CHECK_MODULES(ATK, atk)42PKG_CHECK_MODULES(ATK, atk)
43PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0)43PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0)
44PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0)44PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0)
45PKG_CHECK_MODULES(GCONF2, gconf-2.0)
46PKG_CHECK_MODULES(CAIRO, cairo)45PKG_CHECK_MODULES(CAIRO, cairo)
47PKG_CHECK_MODULES(GSTREAMER, gstreamer-1.0)46PKG_CHECK_MODULES(GSTREAMER, gstreamer-1.0)
48PKG_CHECK_MODULES(GSTREAMER_PLUGINS, gstreamer-plugins-base-1.0)47PKG_CHECK_MODULES(GSTREAMER_PLUGINS, gstreamer-plugins-base-1.0)
4948
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2014-12-22 06:30:44 +0000
+++ src/Makefile.am 2014-12-23 10:46:51 +0000
@@ -21,7 +21,6 @@
21AM_CPPFLAGS += \21AM_CPPFLAGS += \
22 $(CAIRO_CFLAGS) \22 $(CAIRO_CFLAGS) \
23 $(GTK_CFLAGS) \23 $(GTK_CFLAGS) \
24 $(GCONF2_CFLAGS) \
25 $(PTHREAD_CFLAGS) \24 $(PTHREAD_CFLAGS) \
26 $(GTKSOURCEVIEW_CFLAGS) \25 $(GTKSOURCEVIEW_CFLAGS) \
27 $(GLIB_CFLAGS) \26 $(GLIB_CFLAGS) \
@@ -33,7 +32,6 @@
33 $(PTHREAD_LIBS) \32 $(PTHREAD_LIBS) \
34 $(CAIRO_LIBS) \33 $(CAIRO_LIBS) \
35 $(GTK_LIBS) \34 $(GTK_LIBS) \
36 $(GCONF2_LIBS) \
37 $(GTKSOURCEVIEW_LIBS) \35 $(GTKSOURCEVIEW_LIBS) \
38 $(GLIB_LIBS) \36 $(GLIB_LIBS) \
39 $(DBUS_LIBS) \37 $(DBUS_LIBS) \
4038
=== modified file 'src/gloobus-preview-config.cpp'
--- src/gloobus-preview-config.cpp 2010-08-29 14:37:10 +0000
+++ src/gloobus-preview-config.cpp 2014-12-23 10:46:51 +0000
@@ -1,7 +1,7 @@
1#include <string>1#include <string>
2#include <glib.h>2#include <glib.h>
3#include <gio/gio.h>
3#include "gloobus-preview-config.h"4#include "gloobus-preview-config.h"
4#include <gconf/gconf-client.h>
5#include "config.h"5#include "config.h"
66
7GloobusConfig::GloobusConfig( void )7GloobusConfig::GloobusConfig( void )
@@ -21,20 +21,22 @@
2121
22GloobusConfig::~GloobusConfig( void ){}22GloobusConfig::~GloobusConfig( void ){}
2323
24bool GloobusConfig::get_gconf_win_layout()24bool GloobusConfig::get_gsettings_win_layout()
25{25{
26 GConfClient* client_;26 gchar* button_layout;
27 GError* error = NULL;27 GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default ();
28 client_ = gconf_client_get_default();28 GSettingsSchema *wm_schema = g_settings_schema_source_lookup (schema_source, "org.gnome.desktop.wm.preferences", FALSE);
29 if (!client_) {29 if (wm_schema) {
30 g_debug("Unable to create a gconf client");30 GSettings *wm_settings = g_settings_new ("org.gnome.desktop.wm.preferences");
31 return false;31 button_layout = g_settings_get_string (wm_settings, "button-layout");
32 }32 g_object_unref (wm_settings);
33 gchar* gconf_value = gconf_client_get_string(client_, "/apps/metacity/general/button_layout", &error);33 g_settings_schema_unref (wm_schema);
34 if (!gconf_value) {34 }
35 return false;35
36 }36 if (!button_layout) {
37 if (int(string(gconf_value).find("close")) - int(string(gconf_value).find(":")) > 0)37 return false;
38 }
39 if (int(string(button_layout).find("close")) - int(string(button_layout).find(":")) > 0)
38 m_winbar_layout = false;40 m_winbar_layout = false;
39 else41 else
40 m_winbar_layout = true;42 m_winbar_layout = true;
@@ -42,16 +44,6 @@
42 return true;44 return true;
43}45}
4446
45char* GloobusConfig::get_gconf_value_string( const char* key) {
46 GConfClient* client_;
47 client_ = gconf_client_get_default();
48 if (!client_) {
49 g_debug("Unable to create a gconf client");
50 return 0;
51 }
52 return gconf_client_get_string(client_, key, NULL);
53}
54
55//============== LOAD CONFIG ==============//47//============== LOAD CONFIG ==============//
56bool GloobusConfig::load_config()48bool GloobusConfig::load_config()
57{49{
@@ -67,7 +59,7 @@
67 m_focus = g_key_file_get_boolean( keyFile,"Main","focus", NULL );59 m_focus = g_key_file_get_boolean( keyFile,"Main","focus", NULL );
68 theme_gtk = g_key_file_get_boolean( keyFile,"Theme","gtk", NULL );60 theme_gtk = g_key_file_get_boolean( keyFile,"Theme","gtk", NULL );
69 61
70 if (!get_gconf_win_layout())62 if (!get_gsettings_win_layout())
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 );
72 g_key_file_free ( keyFile );64 g_key_file_free ( keyFile );
7365
7466
=== modified file 'src/gloobus-preview-config.h'
--- src/gloobus-preview-config.h 2010-05-01 14:34:16 +0000
+++ src/gloobus-preview-config.h 2014-12-23 10:46:51 +0000
@@ -45,7 +45,7 @@
45 bool load_config (void);45 bool load_config (void);
4646
47 47
48 bool get_gconf_win_layout(void);48 bool get_gsettings_win_layout(void);
4949
50 /* Returns if show gloobus-preview in taskbar50 /* Returns if show gloobus-preview in taskbar
51 * */51 * */
@@ -78,10 +78,6 @@
78 * */78 * */
79 gp_action get_cli_action (void);79 gp_action get_cli_action (void);
8080
81 /* get a gconf value
82 * */
83 char* get_gconf_value_string( const char*);
84
85 char* get_theme ( void );81 char* get_theme ( void );
8682
87 bool get_theme_gtk ( void );83 bool get_theme_gtk ( void );
8884
=== modified file 'src/gloobus-preview-configuration'
--- src/gloobus-preview-configuration 2014-12-20 21:18:38 +0000
+++ src/gloobus-preview-configuration 2014-12-23 10:46:51 +0000
@@ -6,52 +6,52 @@
6import os6import os
7import sys7import sys
8import glob8import glob
9from gi.repository import Gtk, GConf9from gi.repository import Gtk, GConf, Gio
10import signal10import signal
11import gettext11import gettext
12#import config12#import config
1313
14#=========================== CLASS COLORS =======================================================#14#=========================== CLASS COLORS =======================================================#
15class colors:15class colors:
1616
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"]
18 colors_name = ["white","blue","yellow","red", "reset"]18 colors_name = ["white","blue","yellow","red", "reset"]
19 levels_name = ["info","debug","warning","error","reset"]19 levels_name = ["info","debug","warning","error","reset"]
20 debugMode = False20 debugMode = False
2121
2222
23 #=================== GET CODE BY COLOR ===================#23 #=================== GET CODE BY COLOR ===================#
24 def color(self,color):24 def color(self,color):
25 self.debug = debug25 self.debug = debug
2626
27 for i in range(len(self.colors_name)):27 for i in range(len(self.colors_name)):
28 if color == self.colors_name[i]:28 if color == self.colors_name[i]:
29 return self.colors_code[i]29 return self.colors_code[i]
30 return ""30 return ""
3131
32 #=================== GET CODE BY LEVEL ===================#32 #=================== GET CODE BY LEVEL ===================#
33 def level(self,level):33 def level(self,level):
34 for i in range(len(self.colors_name)):34 for i in range(len(self.colors_name)):
35 if level == self.levels_name[i]:35 if level == self.levels_name[i]:
36 return self.colors_code[i]36 return self.colors_code[i]
37 return ""37 return ""
3838
39 #====================== SET DEBUG =======================#39 #====================== SET DEBUG =======================#
40 def set_debug(self,debug):40 def set_debug(self,debug):
41 self.debugMode = debug41 self.debugMode = debug
4242
43 #================= PREDEFINED MACROS =======================#43 #================= PREDEFINED MACROS =======================#
44 def debug(self,string):44 def debug(self,string):
45 if self.debugMode:45 if self.debugMode:
46 print self.level('debug') + "[DEBUG] " + self.level('reset') + string46 print self.level('debug') + "[DEBUG] " + self.level('reset') + string
4747
48 def info(self,string):48 def info(self,string):
49 print self.level('info') + "[INFO] " + self.level('reset') + string49 print self.level('info') + "[INFO] " + self.level('reset') + string
50 50
51 def warning(self,string):51 def warning(self,string):
52 print self.level('warning') + "[WARNING] " + self.level('reset') + string52 print self.level('warning') + "[WARNING] " + self.level('reset') + string
53 53
54 def error(self,string):54 def error(self,string):
55 print self.level('error') + "[ERROR] " + self.level('reset') + string 55 print self.level('error') + "[ERROR] " + self.level('reset') + string
5656
5757
@@ -62,14 +62,17 @@
62 entry2 = None #Allways on top62 entry2 = None #Allways on top
63 entry3 = None #Quit on lose focus63 entry3 = None #Quit on lose focus
64 entry4 = None #Win bar layout64 entry4 = None #Win bar layout
65 gconf_win_layout = None65 gsettings_win_layout = None
66 config = None66 config = None
6767
68 def __init__(self):68 def __init__(self):
69 self.config = config_load()69 self.config = config_load()
70 70
71 self.client = GConf.Client.get_default()71 schema_source = Gio.SettingsSchemaSource.get_default()
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)
73 if wm_schema:
74 wm_settings = Gio.Settings.new("org.gnome.desktop.wm.preferences")
75 self.gsettings_win_layout = wm_settings.get_string("button-layout")
7376
74 #================= Show In Taskbar ================= #77 #================= Show In Taskbar ================= #
75 self.entry1 = Gtk.CheckButton(label=_("Show in TaskBar"), use_underline=False) 78 self.entry1 = Gtk.CheckButton(label=_("Show in TaskBar"), use_underline=False)
@@ -124,7 +127,7 @@
124 general_container.add(self.entry2) #Always on top127 general_container.add(self.entry2) #Always on top
125 general_container.add(self.entry3) #Always on top128 general_container.add(self.entry3) #Always on top
126 general_container.add(self.theme_gtk_entry)129 general_container.add(self.theme_gtk_entry)
127 if self.gconf_win_layout == None:130 if self.gsettings_win_layout == None:
128 general_container.add(self.entry4) #Always on top131 general_container.add(self.entry4) #Always on top
129132
130 general_container.add(Gtk.HSeparator())133 general_container.add(Gtk.HSeparator())
131134
=== modified file 'src/plugin-pixbuf/plugin-pixbuf.cpp'
--- src/plugin-pixbuf/plugin-pixbuf.cpp 2010-08-29 14:37:10 +0000
+++ src/plugin-pixbuf/plugin-pixbuf.cpp 2014-12-23 10:46:51 +0000
@@ -121,9 +121,15 @@
121121
122void iPixbuf::set_as_background_cb()122void iPixbuf::set_as_background_cb()
123{123{
124 //gconftool-2 --type string --set /desktop/gnome/background/picture_filename /path/to/image.jpg124 const gchar *uri = g_file_get_uri (Gloobus::instance()->get_file());
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);
126126
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 ();
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);
129 if (background_schema) {
130 GSettings *background_settings = g_settings_new ("org.gnome.desktop.background");
131 g_settings_set_string (background_settings, "picture-uri", uri);
132 g_object_unref (background_settings);
133 g_settings_schema_unref (background_schema);
134 }
129}135}
130136
=== modified file 'src/plugin-text/plugin-text.cpp'
--- src/plugin-text/plugin-text.cpp 2010-03-27 15:55:08 +0000
+++ src/plugin-text/plugin-text.cpp 2014-12-23 10:46:51 +0000
@@ -29,8 +29,16 @@
29 return 0;29 return 0;
30 }30 }
3131
32 GloobusConfig * config = Gloobus::instance()->get_config();32 char* theme;
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 ();
34 GSettingsSchema *gedit_schema = g_settings_schema_source_lookup (schema_source, "org.gnome.gedit.preferences.editor", FALSE);
35 if (gedit_schema) {
36 GSettings *gedit_settings = g_settings_new ("org.gnome.gedit.preferences.editor");
37 theme = g_settings_get_string (gedit_settings, "scheme");
38 g_object_unref (gedit_settings);
39 g_settings_schema_unref (gedit_schema);
40 }
41
34 if(theme) {42 if(theme) {
35 GtkSourceStyleSchemeManager * sc_manager;43 GtkSourceStyleSchemeManager * sc_manager;
36 sc_manager = gtk_source_style_scheme_manager_get_default();44 sc_manager = gtk_source_style_scheme_manager_get_default();

Subscribers

People subscribed via source and target branches