1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GCONF_LISTENER_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_GCONF_LISTENER_H_
8 #include <gconf/gconf-client.h>
14 #include "base/basictypes.h"
15 #include "base/callback_forward.h"
16 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
21 // On GNOME desktops, subscribes to the gconf key which controlls button order.
22 // Everywhere else, SetTiltebarButtons() just calls back into BrowserTitlebar
23 // with the default ordering.
26 // Sends data to the Gtk2UI when available.
27 explicit GConfListener(Gtk2UI* delegate);
31 // Called whenever the metacity key changes.
32 CHROMEG_CALLBACK_2(GConfListener, void, OnChangeNotification,
33 GConfClient*, guint, GConfEntry*);
35 void GetAndRegister(const char* key_to_subscribe,
36 const base::Callback<void(GConfValue*)>& initial_setter);
38 // Checks |error|. On error, prints out a message and closes the connection
39 // to GConf and reverts to default mode.
40 bool HandleGError(GError* error, const char* key);
42 // Parses the return data structure from GConf, falling back to the default
43 // value on any error.
44 void ParseAndStoreButtonValue(GConfValue* gconf_value);
45 void ParseAndStoreMiddleClickValue(GConfValue* gconf_value);
49 // Pointer to our gconf context. NULL if we aren't on a desktop that uses
53 DISALLOW_COPY_AND_ASSIGN(GConfListener);
56 } // namespace libgtk2ui
58 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GCONF_LISTENER_H_