[Xfce4-commits] [apps/xfdashboard] 02/02: Add function xfdashboard_toggle_button_toggle() to XfdashboardToggleButton to change between "on" and "off" state easily. Its a convinient function when click actions are handled on its own - automatic toggle mode is disabled (FALSE).

noreply at xfce.org noreply at xfce.org
Wed Jun 22 16:12:43 CEST 2016


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit f0310c98592b13087176c070e04b9fc550fd1c8a
Author: Stephan Haller <nomad at froevel.de>
Date:   Wed Jun 22 16:11:35 2016 +0200

    Add function xfdashboard_toggle_button_toggle() to XfdashboardToggleButton to change between "on" and "off" state easily. Its a convinient function when click actions are handled on its own - automatic toggle mode is disabled (FALSE).
---
 libxfdashboard/toggle-button.c | 20 ++++++++++++++++++++
 libxfdashboard/toggle-button.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/libxfdashboard/toggle-button.c b/libxfdashboard/toggle-button.c
index 002745c..f0368ce 100644
--- a/libxfdashboard/toggle-button.c
+++ b/libxfdashboard/toggle-button.c
@@ -455,3 +455,23 @@ void xfdashboard_toggle_button_set_auto_toggle(XfdashboardToggleButton *self, gb
 		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardToggleButtonProperties[PROP_AUTO_TOGGLE]);
 	}
 }
+
+/**
+ * xfdashboard_toggle_button_toggle:
+ * @self: A #XfdashboardToggleButton
+ *
+ * Toggles the state of @self. That means that the toggle button will change its
+ * state to pressed ("on" state) if it is currently raised ("off" state) or vice
+ * versa.
+ */
+void xfdashboard_toggle_button_toggle(XfdashboardToggleButton *self)
+{
+	XfdashboardToggleButtonPrivate	*priv;
+
+	g_return_if_fail(XFDASHBOARD_IS_TOGGLE_BUTTON(self));
+
+	priv=self->priv;
+
+	/* Set opposite state of current one */
+	xfdashboard_toggle_button_set_toggle_state(self, !priv->toggleState);
+}
diff --git a/libxfdashboard/toggle-button.h b/libxfdashboard/toggle-button.h
index 6fc7f95..9ce1c6e 100644
--- a/libxfdashboard/toggle-button.h
+++ b/libxfdashboard/toggle-button.h
@@ -92,6 +92,8 @@ void xfdashboard_toggle_button_set_toggle_state(XfdashboardToggleButton *self, g
 gboolean xfdashboard_toggle_button_get_auto_toggle(XfdashboardToggleButton *self);
 void xfdashboard_toggle_button_set_auto_toggle(XfdashboardToggleButton *self, gboolean inAuto);
 
+void xfdashboard_toggle_button_toggle(XfdashboardToggleButton *self);
+
 G_END_DECLS
 
 #endif	/* __LIBXFDASHBOARD_TOGGLE_BUTTON__ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list