Merge lp:~smspillaz/compiz-core/compiz-core.fix_936781 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Approved by: Alan Griffiths
Approved revision: 3012
Merged at revision: 3017
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_936781
Merge into: lp:compiz-core
Diff against target: 36 lines (+9/-6)
1 file modified
gtk/window-decorator/settings.c (+9/-6)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_936781
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Daniel van Vugt Approve
Review via email: mp+93948@code.launchpad.net

This proposal supersedes a proposal from 2012-02-20.

Description of the change

Check if the mutter key exists before using it

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I thought the fallback draggable border width should come from the theme definition. Or is it not in the theme?

review: Needs Information
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Mon, 20 Feb 2012, Daniel van Vugt wrote:

> Review: Needs Information
>
> I thought the fallback draggable border width should come from the theme definition. Or is it not in the theme?

Not anymore, I dropped that patch

> --
> https://code.launchpad.net/~smspillaz/compiz-core/compiz-core.fix_936781/+merge/93776
> You are the owner of lp:~smspillaz/compiz-core/compiz-core.fix_936781.
>

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I think it would be cleaner to use the built-in error detection (last parameter)...
    new_width = gconf_client_get_int (client, MUTTER_DRAGGABLE_BORDER_WIDTH_KEY, &err);
instead of ignoring all the error codes ("NULL").

That would allow you to remove:
    if (gconf_client_dir_exists (client, "/apps/mutter/general", NULL))

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I had a look a the gconf documentation while I was writing this and it wasn't exactly all that clear as to what conditions the error bit would be set. Gconf has some weird semantics with schemaless keys (which is why gsettings exists), and really what I care about is whether or not that option actually exists in the directory, or if gconf is going to give me some default value. As far as I could tell, all it does is give you a default value of zero, which isn't particularly useful.

The reason why I chose to use that API is because 1) that API is there and seems to serve the purpose of checking whether or not a particular key exists in the database and 2) There is no documentation as to when Gconf will return an error condition for a missing key.

Of course, if you can point to something to the contrary I'd be glad to use that.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Ooook, didrocks says the GError gets set in this case. Soooo lets change that :)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Looks good and tests OK.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/window-decorator/settings.c'
2--- gtk/window-decorator/settings.c 2011-10-13 12:22:14 +0000
3+++ gtk/window-decorator/settings.c 2012-02-21 10:23:49 +0000
4@@ -21,10 +21,6 @@
5
6 #include "gtk-window-decorator.h"
7
8-/* TODO: Trash all of this and use a window property
9- * instead - much much cleaner!
10- */
11-
12 gboolean
13 shadow_property_changed (WnckScreen *s)
14 {
15@@ -151,12 +147,19 @@
16 static gboolean
17 mutter_draggable_border_width_changed (GConfClient *client)
18 {
19+ static const unsigned int default_draggable_border_width = 7;
20 int new_width;
21 int width = settings->mutter_draggable_border_width;
22+ GError *error = NULL;
23
24 new_width = gconf_client_get_int (client,
25- MUTTER_DRAGGABLE_BORDER_WIDTH_KEY,
26- NULL);
27+ MUTTER_DRAGGABLE_BORDER_WIDTH_KEY,
28+ &error);
29+ if (error)
30+ {
31+ new_width = default_draggable_border_width;
32+ g_error_free (error);
33+ }
34
35 if (new_width != width)
36 {

Subscribers

People subscribed via source and target branches