summaryrefslogtreecommitdiff
diff options
-rw-r--r--CMakeLists.txt2
-rw-r--r--services/panel-service.c50
2 files changed, 30 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2aefa298f..bd00a6737 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,7 +134,7 @@ endif (DISABLE_MAINTAINER_CFLAGS)
# Compiz Plugins
#
-set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1")
+set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;dbus-glib-1;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1")
# FIXME: unity-protocol-private shouldn't be there, but building of unityshell is just broken
set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.93.1")
diff --git a/services/panel-service.c b/services/panel-service.c
index b9d77704a..a0ff86812 100644
--- a/services/panel-service.c
+++ b/services/panel-service.c
@@ -30,7 +30,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#include <gconf/gconf-client.h>
#include <X11/extensions/XInput2.h>
#include <X11/XKBlib.h>
@@ -46,8 +45,10 @@ G_DEFINE_TYPE (PanelService, panel_service, G_TYPE_OBJECT);
#define N_TIMEOUT_SLOTS 50
#define MAX_INDICATOR_ENTRIES 50
-#define COMPIZ_OPTIONS_PATH "/apps/compiz-1/plugins/unityshell/screen0/options"
-#define MENU_TOGGLE_KEYBINDING_PATH COMPIZ_OPTIONS_PATH"/panel_first_menu"
+#define COMPIZ_OPTION_PATH "org.compiz"
+#define COMPIZ_CURRENT_PROFILE_KEY "current-profile"
+#define COMPIZ_UNITYSHELL_PATH "org.compiz.profiles.%s.plugins.unityshell" // %s will be replaced with the value of current-profile
+#define MENU_TOGGLE_KEYBINDING_KEY "panel_first_menu"
static PanelService *static_service = NULL;
@@ -76,7 +77,7 @@ struct _PanelServicePrivate
KeyCode toggle_key;
guint32 toggle_modifiers;
- guint32 key_monitor_id;
+ GSettings *gsettings;
IndicatorObjectEntry *pressed_entry;
gboolean use_event;
@@ -135,6 +136,10 @@ static GdkFilterReturn event_filter (GdkXEvent *ev,
GdkEvent *gev,
PanelService *self);
+static void on_keybinding_changed (GSettings *settings,
+ gchar *key,
+ gpointer data);
+
/*
* GObject stuff
*/
@@ -186,11 +191,8 @@ panel_service_class_dispose (GObject *object)
}
}
- if (priv->key_monitor_id)
- {
- gconf_client_notify_remove (gconf_client_get_default(), priv->key_monitor_id);
- priv->key_monitor_id = 0;
- }
+ g_signal_handlers_disconnect_by_func (priv->gsettings, on_keybinding_changed, object);
+ g_object_unref (priv->gsettings);
G_OBJECT_CLASS (panel_service_parent_class)->dispose (object);
}
@@ -479,8 +481,7 @@ initial_resync (PanelService *self)
static void
panel_service_update_menu_keybinding (PanelService *self)
{
- GConfClient *client = gconf_client_get_default ();
- gchar *binding = gconf_client_get_string (client, MENU_TOGGLE_KEYBINDING_PATH, NULL);
+ gchar *binding = g_settings_get_string (self->priv->gsettings, MENU_TOGGLE_KEYBINDING_KEY);
KeyCode keycode = 0;
KeySym keysym = NoSymbol;
@@ -535,8 +536,10 @@ panel_service_update_menu_keybinding (PanelService *self)
g_free (binding);
}
-void
-on_keybinding_changed (GConfClient* client, guint id, GConfEntry* entry, gpointer data)
+static void
+on_keybinding_changed (GSettings *settings,
+ gchar *key,
+ gpointer data)
{
PanelService *self = data;
g_return_if_fail (PANEL_IS_SERVICE (data));
@@ -566,15 +569,20 @@ panel_service_init (PanelService *self)
sort_indicators (self);
suppress_signals = FALSE;
- panel_service_update_menu_keybinding (self);
+ GSettings *gsettings = g_settings_new (COMPIZ_OPTION_PATH);
+ gchar *current_profile = g_settings_get_string (gsettings, COMPIZ_CURRENT_PROFILE_KEY);
- GConfClient *client = gconf_client_get_default ();
- gconf_client_add_dir (client, COMPIZ_OPTIONS_PATH, GCONF_CLIENT_PRELOAD_NONE, NULL);
- priv->key_monitor_id = gconf_client_notify_add (client, MENU_TOGGLE_KEYBINDING_PATH,
- on_keybinding_changed, self,
- NULL, NULL);
+ gchar *unityshell_gsettings_path = g_strdup_printf (COMPIZ_UNITYSHELL_PATH, current_profile);
+ priv->gsettings = g_settings_new (unityshell_gsettings_path);
+ g_signal_connect (priv->gsettings, "changed::"MENU_TOGGLE_KEYBINDING_KEY, G_CALLBACK(on_keybinding_changed), self);
+
+ panel_service_update_menu_keybinding (self);
priv->initial_sync_id = g_idle_add ((GSourceFunc)initial_resync, self);
+
+ g_free (unityshell_gsettings_path);
+ g_free (current_profile);
+ g_object_unref (gsettings);
}
static gboolean
@@ -904,7 +912,7 @@ on_indicator_menu_show (IndicatorObject *object,
PanelService *self)
{
gchar *entry_id;
-
+
g_return_if_fail (PANEL_IS_SERVICE (self));
if (entry == NULL)
{
@@ -924,7 +932,7 @@ on_indicator_menu_show_now_changed (IndicatorObject *object,
PanelService *self)
{
gchar *entry_id;
-
+
g_return_if_fail (PANEL_IS_SERVICE (self));
if (entry == NULL)
{