Merge lp:~mardy/metacity/command-line-conf into lp:~vcs-imports/metacity/master

Proposed by Alberto Mardegan
Status: Superseded
Proposed branch: lp:~mardy/metacity/command-line-conf
Merge into: lp:~vcs-imports/metacity/master
Diff against target: 198 lines (+84/-12)
3 files modified
src/core/main.c (+9/-1)
src/core/prefs.c (+74/-10)
src/include/prefs.h (+1/-1)
To merge this branch: bzr merge lp:~mardy/metacity/command-line-conf
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Pending
Review via email: mp+72842@code.launchpad.net

This proposal has been superseded by a proposal from 2011-08-25.

Description of the change

Allow overriding GConf settings from command line

Accept a new --conf-file <conf-file> command line option, which loads a
GKeyFile containing overrides for keys stored in GConf.

To post a comment you must log in.
Revision history for this message
Alberto Mardegan (mardy) wrote :

Note: these are the same patches sent to upstream ( https://bugzilla.gnome.org/show_bug.cgi?id=657308 ).

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/25/2011 11:15 AM, Alberto Mardegan wrote:
> Note: these are the same patches sent to upstream (
> https://bugzilla.gnome.org/show_bug.cgi?id=657308 ).

I think you wanted to target lp:ubuntu/metacity not lp:metacity.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5WGmcACgkQJdeBCYSNAAPYFQCfSnAYNZVm086NQrX2Jxfxzv/K
t8UAn3ZAePZ0FotWjPQj1gYKMw8g1hwX
=V885
-----END PGP SIGNATURE-----

lp:~mardy/metacity/command-line-conf updated
120. By Alberto Mardegan

Allow overriding GConf settings from command line

Accept a new --conf-file <conf-file> command line option, which loads a
GKeyFile containing overrides for keys stored in GConf.

For a full rationale, please see
https://bugs.launchpad.net/unity-2d/+bug/791205

Unmerged revisions

120. By Alberto Mardegan

Allow overriding GConf settings from command line

Accept a new --conf-file <conf-file> command line option, which loads a
GKeyFile containing overrides for keys stored in GConf.

For a full rationale, please see
https://bugs.launchpad.net/unity-2d/+bug/791205

119. By Rodrigo Moya

releasing version 1:2.34.1-1ubuntu1

118. By Didier Roche-Tolomelli

releasing version 1:2.34.0-0ubuntu2

117. By Didier Roche-Tolomelli

debian/patches/16-capture-before-unmap.patch:
only retrieve scaling down of all the windows' pixmaps when compositor
is in effect (LP: #794080). Thanks Kaleo

116. By Martin Pitt

add bug number

115. By Martin Pitt

* New upstream release
* debian/patches:
  - 02_restart_hint.patch, 19_initialise_all_workspace_names.patch
    dropped, are upstream

114. By Oliver Grawert

releasing version 1:2.30.3-0ubuntu9

113. By Oliver Grawert

merge fixes from the unity-2d team

112. By Oliver Grawert

releasing version 1:2.30.3-0ubuntu8

111. By Oliver Grawert

merge lp:~uriboni/unity-2d/metacity-capture-before-unmap-not-default to set the proper default

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/core/main.c'
2--- src/core/main.c 2011-05-19 15:57:29 +0000
3+++ src/core/main.c 2011-08-25 09:13:50 +0000
4@@ -235,6 +235,7 @@
5 gboolean composite;
6 gboolean no_composite;
7 gboolean no_force_fullscreen;
8+ gchar *conf_file;
9 } MetaArguments;
10
11 #ifdef HAVE_COMPOSITE_EXTENSIONS
12@@ -322,6 +323,12 @@
13 N_("Don't make fullscreen windows that are maximized and have no decorations"),
14 NULL
15 },
16+ {
17+ "conf-file", 0, 0, G_OPTION_ARG_FILENAME,
18+ &my_args.conf_file,
19+ N_("Options from the given configuration file have precedence over GConf ones"),
20+ NULL
21+ },
22 {NULL}
23 };
24 GOptionContext *ctx;
25@@ -491,7 +498,7 @@
26 meta_errors_init ();
27
28 /* Load prefs */
29- meta_prefs_init ();
30+ meta_prefs_init (meta_args.conf_file);
31 meta_prefs_add_listener (prefs_changed_callback, NULL);
32
33
34@@ -571,6 +578,7 @@
35 g_free (meta_args.save_file);
36 g_free (meta_args.display_name);
37 g_free (meta_args.client_id);
38+ g_free (meta_args.conf_file);
39
40 if (meta_args.composite || meta_args.no_composite)
41 meta_prefs_set_compositing_manager (meta_args.composite);
42
43=== modified file 'src/core/prefs.c'
44--- src/core/prefs.c 2011-01-15 22:49:19 +0000
45+++ src/core/prefs.c 2011-08-25 09:13:50 +0000
46@@ -71,6 +71,8 @@
47 static GList *changes = NULL;
48 static guint changed_idle;
49 static GList *listeners = NULL;
50+static GKeyFile *key_file = NULL;
51+static const gchar conf_file_group_name[] = "general";
52 #endif
53
54 static gboolean use_system_font = FALSE;
55@@ -475,6 +477,43 @@
56 { NULL, 0, NULL, 0, 0, 0, },
57 };
58
59+static gchar *
60+conf_get_string (const gchar *key, GError **error)
61+{
62+ if (key_file != NULL)
63+ {
64+ gchar *value = g_key_file_get_string (key_file,
65+ conf_file_group_name,
66+ key,
67+ NULL);
68+ if (value != NULL)
69+ return value;
70+ }
71+ return gconf_client_get_string (default_client,
72+ key,
73+ error);
74+}
75+
76+static gint
77+conf_get_int (const gchar *key, GError **error)
78+{
79+ if (key_file != NULL)
80+ {
81+ GError *key_error = NULL;
82+ gint value = g_key_file_get_integer (key_file,
83+ conf_file_group_name,
84+ key,
85+ &key_error);
86+ if (key_error != NULL)
87+ g_error_free (key_error);
88+ else
89+ return value;
90+ }
91+ return gconf_client_get_int (default_client,
92+ key,
93+ error);
94+}
95+
96 static void
97 handle_preference_init_enum (void)
98 {
99@@ -491,9 +530,8 @@
100 continue;
101 }
102
103- value = gconf_client_get_string (default_client,
104- cursor->key,
105- &error);
106+ value = conf_get_string (cursor->key,
107+ &error);
108 cleanup_error (&error);
109
110 if (value==NULL)
111@@ -542,9 +580,8 @@
112 gboolean dummy = TRUE;
113
114 /* the string "value" will be newly allocated */
115- value = gconf_client_get_string (default_client,
116- cursor->key,
117- &error);
118+ value = conf_get_string (cursor->key,
119+ &error);
120 cleanup_error (&error);
121
122 if (cursor->handler)
123@@ -579,9 +616,8 @@
124 gint value;
125 GError *error = NULL;
126
127- value = gconf_client_get_int (default_client,
128- cursor->key,
129- &error);
130+ value = conf_get_int (cursor->key,
131+ &error);
132 cleanup_error (&error);
133
134 if (value < cursor->minimum || value > cursor->maximum)
135@@ -998,7 +1034,7 @@
136 #endif
137
138 void
139-meta_prefs_init (void)
140+meta_prefs_init (const gchar *conf_file)
141 {
142 #ifdef HAVE_GCONF
143 GError *err = NULL;
144@@ -1021,6 +1057,18 @@
145 cleanup_error (&err);
146 }
147
148+ /* if a configuration file has been specified, settings written in that file
149+ * will override those in GConf */
150+ if (conf_file != NULL)
151+ {
152+ key_file = g_key_file_new ();
153+ g_key_file_load_from_file (key_file,
154+ conf_file,
155+ G_KEY_FILE_NONE,
156+ &err);
157+ cleanup_error (&err);
158+ }
159+
160 /* Pick up initial values. */
161
162 handle_preference_init_enum ();
163@@ -1203,6 +1251,22 @@
164 GConfValue *value;
165 gboolean filled_in = FALSE;
166
167+ if (key_file != NULL)
168+ {
169+ GError *key_error = NULL;
170+ gboolean value = g_key_file_get_boolean (key_file,
171+ conf_file_group_name,
172+ key,
173+ &key_error);
174+ if (key_error != NULL)
175+ g_error_free (key_error);
176+ else
177+ {
178+ *val = value;
179+ return TRUE;
180+ }
181+ }
182+
183 value = gconf_client_get (default_client, key, &err);
184 cleanup_error (&err);
185 if (value)
186
187=== modified file 'src/include/prefs.h'
188--- src/include/prefs.h 2009-07-06 11:51:45 +0000
189+++ src/include/prefs.h 2011-08-25 09:13:50 +0000
190@@ -71,7 +71,7 @@
191 void meta_prefs_remove_listener (MetaPrefsChangedFunc func,
192 gpointer data);
193
194-void meta_prefs_init (void);
195+void meta_prefs_init (const gchar *conf_file);
196 const char* meta_preference_to_string (MetaPreference pref);
197
198 MetaVirtualModifier meta_prefs_get_mouse_button_mods (void);

Subscribers

People subscribed via source and target branches