[Xfce4-commits] [apps/xfdashboard] 01/02: Because XfdashboardToggleButton is derived from XfdashboardButton it should have the same creation functions.
noreply at xfce.org
noreply at xfce.org
Wed Jun 22 16:12:42 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 8669f34b96a45e35a6f32d4d906c5bd38999394a
Author: Stephan Haller <nomad at froevel.de>
Date: Wed Jun 22 16:07:15 2016 +0200
Because XfdashboardToggleButton is derived from XfdashboardButton it should have the same creation functions.
---
libxfdashboard/toggle-button.c | 45 +++++++++++++++++++++++++++++++++++++-----
libxfdashboard/toggle-button.h | 6 ++++--
libxfdashboard/view-selector.c | 2 +-
3 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/libxfdashboard/toggle-button.c b/libxfdashboard/toggle-button.c
index 271c44f..002745c 100644
--- a/libxfdashboard/toggle-button.c
+++ b/libxfdashboard/toggle-button.c
@@ -285,7 +285,7 @@ ClutterActor* xfdashboard_toggle_button_new_with_text(const gchar *inText)
}
/**
- * xfdashboard_toggle_button_new_with_icon:
+ * xfdashboard_toggle_button_new_with_icon_name:
* @inIconName: A string containing the stock icon name or file name for the icon
* to be place in the toogle button
*
@@ -293,7 +293,7 @@ ClutterActor* xfdashboard_toggle_button_new_with_text(const gchar *inText)
*
* Return value: The newly created #XfdashboardToggleButton
*/
-ClutterActor* xfdashboard_toggle_button_new_with_icon(const gchar *inIconName)
+ClutterActor* xfdashboard_toggle_button_new_with_icon_name(const gchar *inIconName)
{
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"icon-name", inIconName,
@@ -302,7 +302,23 @@ ClutterActor* xfdashboard_toggle_button_new_with_icon(const gchar *inIconName)
}
/**
- * xfdashboard_toggle_button_new_full:
+ * xfdashboard_toggle_button_new_with_gicon:
+ * @inIcon: A #GIcon containing the icon image
+ *
+ * Creates a new #XfdashboardToggleButton actor with an icon.
+ *
+ * Return value: The newly created #XfdashboardToggleButton
+ */
+ClutterActor* xfdashboard_toggle_button_new_with_gicon(GIcon *inIcon)
+{
+ return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
+ "icon-gicon", inIcon,
+ "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
+ NULL));
+}
+
+/**
+ * xfdashboard_toggle_button_new_full_with_icon_name:
* @inIconName: A string containing the stock icon name or file name for the icon
* to be place in the toogle button
* @inText: A string containing the text to be placed in the toggle button
@@ -311,8 +327,8 @@ ClutterActor* xfdashboard_toggle_button_new_with_icon(const gchar *inIconName)
*
* Return value: The newly created #XfdashboardToggleButton
*/
-ClutterActor* xfdashboard_toggle_button_new_full(const gchar *inIconName,
- const gchar *inText)
+ClutterActor* xfdashboard_toggle_button_new_full_with_icon_name(const gchar *inIconName,
+ const gchar *inText)
{
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"text", inText,
@@ -322,6 +338,25 @@ ClutterActor* xfdashboard_toggle_button_new_full(const gchar *inIconName,
}
/**
+ * xfdashboard_toggle_button_new_full_with_gicon:
+ * @inIcon: A #GIcon containing the icon image
+ * @inText: A string containing the text to be placed in the toggle button
+ *
+ * Creates a new #XfdashboardToggleButton actor with a text label and an icon.
+ *
+ * Return value: The newly created #XfdashboardToggleButton
+ */
+ClutterActor* xfdashboard_toggle_button_new_full_with_gicon(GIcon *inIcon,
+ const gchar *inText)
+{
+ return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
+ "text", inText,
+ "icon-gicon", inIcon,
+ "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ NULL));
+}
+
+/**
* xfdashboard_toggle_button_get_toggle_state:
* @self: A #XfdashboardToggleButton
*
diff --git a/libxfdashboard/toggle-button.h b/libxfdashboard/toggle-button.h
index 08c3570..6fc7f95 100644
--- a/libxfdashboard/toggle-button.h
+++ b/libxfdashboard/toggle-button.h
@@ -81,8 +81,10 @@ GType xfdashboard_toggle_button_get_type(void) G_GNUC_CONST;
ClutterActor* xfdashboard_toggle_button_new(void);
ClutterActor* xfdashboard_toggle_button_new_with_text(const gchar *inText);
-ClutterActor* xfdashboard_toggle_button_new_with_icon(const gchar *inIconName);
-ClutterActor* xfdashboard_toggle_button_new_full(const gchar *inIconName, const gchar *inText);
+ClutterActor* xfdashboard_toggle_button_new_with_icon_name(const gchar *inIconName);
+ClutterActor* xfdashboard_toggle_button_new_with_gicon(GIcon *inIcon);
+ClutterActor* xfdashboard_toggle_button_new_full_with_icon_name(const gchar *inIconName, const gchar *inText);
+ClutterActor* xfdashboard_toggle_button_new_full_with_gicon(GIcon *inIcon, const gchar *inText);
gboolean xfdashboard_toggle_button_get_toggle_state(XfdashboardToggleButton *self);
void xfdashboard_toggle_button_set_toggle_state(XfdashboardToggleButton *self, gboolean inToggleState);
diff --git a/libxfdashboard/view-selector.c b/libxfdashboard/view-selector.c
index 358ea24..4da4ff2 100644
--- a/libxfdashboard/view-selector.c
+++ b/libxfdashboard/view-selector.c
@@ -208,7 +208,7 @@ static void _xfdashboard_view_selector_on_view_added(XfdashboardViewSelector *se
viewName=g_markup_printf_escaped("%s", xfdashboard_view_get_name(inView));
viewIcon=xfdashboard_view_get_icon(inView);
- button=xfdashboard_toggle_button_new_full(viewIcon, viewName);
+ button=xfdashboard_toggle_button_new_full_with_icon_name(viewIcon, viewName);
xfdashboard_toggle_button_set_auto_toggle(XFDASHBOARD_TOGGLE_BUTTON(button), FALSE);
g_object_set_data(G_OBJECT(button), "view", inView);
g_signal_connect_swapped(button, "clicked", G_CALLBACK(_xfdashboard_view_selector_on_view_button_clicked), self);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list