From e5239736235d6beace1d18c18decaaf6611bb1dd Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 25 Jan 2015 03:50:10 +0100 Subject: adding panel orientation binding --- mate-applet/mdock-mate-panel-applet.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 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 73b7920..1394620 100644 --- a/mate-applet/mdock-mate-panel-applet.c +++ b/mate-applet/mdock-mate-panel-applet.c @@ -51,6 +51,21 @@ static const GtkActionEntry menu_verbs[] = { G_CALLBACK (display_about_dialog) } }; +static gboolean transform_applet_orient_to_orientation(GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data) +{ + MatePanelAppletOrient orient = g_value_get_enum(from_value); + switch (orient) { + case MATE_PANEL_APPLET_ORIENT_DOWN: + case MATE_PANEL_APPLET_ORIENT_UP: + g_value_set_enum(to_value, GTK_ORIENTATION_VERTICAL); + break; + case MATE_PANEL_APPLET_ORIENT_LEFT: + case MATE_PANEL_APPLET_ORIENT_RIGHT: + g_value_set_enum(to_value, GTK_ORIENTATION_HORIZONTAL); + break; + } +} + static void mdock_mate_panel_applet_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { MDockMatePanelApplet *self = MDOCK_MATE_PANEL_APPLET(widget); @@ -80,6 +95,11 @@ static void mdock_mate_panel_applet_init(MDockMatePanelApplet *self) self->dock = MDOCK_WIDGET(mdock_widget_new()); gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->dock)); + g_object_bind_property_full(self, "orient", self->dock, "orientation", + G_BINDING_DEFAULT, + transform_applet_orient_to_orientation, + NULL, NULL, NULL); + GtkActionGroup *action_group = gtk_action_group_new("MDock Mate Panel Applet Actions"); gtk_action_group_add_actions(action_group, menu_verbs, G_N_ELEMENTS(menu_verbs), self); @@ -87,8 +107,8 @@ static void mdock_mate_panel_applet_init(MDockMatePanelApplet *self) mate_panel_applet_set_flags(MATE_PANEL_APPLET(self), MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_setup_menu(MATE_PANEL_APPLET(self), - "" - "", + "" + "", action_group); g_object_unref(action_group); -- cgit v1.2.3