From 4da68b43f3e86a4e53815b147176942d118f8eab Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 25 Jan 2015 17:52:24 +0100 Subject: fix applet settings path --- mate-applet/mdock-mate-panel-applet.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'mate-applet/mdock-mate-panel-applet.c') diff --git a/mate-applet/mdock-mate-panel-applet.c b/mate-applet/mdock-mate-panel-applet.c index ba18f43..62d0bde 100644 --- a/mate-applet/mdock-mate-panel-applet.c +++ b/mate-applet/mdock-mate-panel-applet.c @@ -17,6 +17,8 @@ * along with MDock. If not, see . */ +#include + #include "mdock-mate-panel-applet.h" #include @@ -71,6 +73,13 @@ static gboolean transform_applet_orient_to_orientation(GBinding *binding, const g_value_set_enum(to_value, applet_orient_to_orientation(orient)); } +static gboolean transform_prefs_path_to_gsettings(GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data) +{ + const gchar *prefs_path = g_value_get_string(from_value); + GSettings *settings = g_settings_new_with_path(MDOCK_WIDGET_GSETTINGS_SCHEMA, prefs_path); + g_value_take_object(to_value, settings); +} + static GtkOrientation mdock_mate_panel_applet_get_orientation(MDockMatePanelApplet *self) { MatePanelAppletOrient orient = mate_panel_applet_get_orient(MATE_PANEL_APPLET(self)); @@ -91,8 +100,6 @@ static void mdock_mate_panel_applet_size_request(GtkWidget *widget, GtkRequisiti gtk_widget_size_request(GTK_WIDGET(self->dock), requisition); - g_debug("size request %dx%d", requisition->width, requisition->height); - // Try to force a square aspect ratio for the icons // by requesting a big enough major panel dimension GtkAllocation allocation; @@ -106,8 +113,6 @@ static void mdock_mate_panel_applet_size_request(GtkWidget *widget, GtkRequisiti requisition->width = MAX(requisition->width, allocation.width); requisition->height = MAX(requisition->height, nitems * (requisition->width + spacing)); } - - g_debug("size request %dx%d", requisition->width, requisition->height); } static void mdock_mate_panel_applet_class_init(MDockMatePanelAppletClass *klass) @@ -120,23 +125,18 @@ static void mdock_mate_panel_applet_class_init(MDockMatePanelAppletClass *klass) static void mdock_mate_panel_applet_init(MDockMatePanelApplet *self) { MatePanelApplet *applet = MATE_PANEL_APPLET(self); - gchar *prefs_path = mate_panel_applet_get_preferences_path(applet); - g_warn_if_fail(prefs_path); - - if (prefs_path) { - self->dock = MDOCK_WIDGET(mdock_widget_new_with_settings_path(prefs_path)); - } else { - self->dock = MDOCK_WIDGET(mdock_widget_new()); - } + self->dock = MDOCK_WIDGET(mdock_widget_new()); gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->dock)); - g_free(prefs_path); - g_object_bind_property_full(self, "orient", self->dock, "orientation", G_BINDING_DEFAULT, transform_applet_orient_to_orientation, NULL, NULL, NULL); + g_object_bind_property_full(self, "prefs-path", self->dock, "settings", + G_BINDING_DEFAULT, + transform_prefs_path_to_gsettings, + NULL, NULL, NULL); GtkActionGroup *action_group = gtk_action_group_new("MDock Mate Panel Applet Actions"); gtk_action_group_add_actions(action_group, -- cgit v1.2.3