[Xfce4-commits] [apps/xfdashboard] 01/01: Refactor XfdashboardButton into XfdashboardLabel and make XfdashboardButton a sub-class of it.
noreply at xfce.org
noreply at xfce.org
Wed Dec 7 12:00:39 CET 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 d22ed42a21109602963d583688aa0a2c55c8eb2a
Author: Stephan Haller <nomad at froevel.de>
Date: Wed Dec 7 11:46:28 2016 +0100
Refactor XfdashboardButton into XfdashboardLabel and make XfdashboardButton a sub-class of it.
XfdashboardLabel is like the previous XfdashboardButton but without "click" signal and XfdashboardButton is now a sub-class of it which just handles the additional "click" signal.
---
libxfdashboard/Makefile.am | 2 +
libxfdashboard/application-button.c | 10 +-
libxfdashboard/applications-view.c | 16 +-
libxfdashboard/button.c | 2103 +-------------------
libxfdashboard/button.h | 75 +-
libxfdashboard/{button.c => label.c} | 560 +++---
libxfdashboard/label.h | 148 ++
libxfdashboard/live-window.c | 6 +-
libxfdashboard/live-workspace.c | 2 +-
libxfdashboard/popup-menu.c | 36 +-
libxfdashboard/quicklaunch.c | 44 +-
libxfdashboard/search-result-container.c | 14 +-
libxfdashboard/text-box.c | 4 +-
libxfdashboard/toggle-button.c | 12 +-
libxfdashboard/view-selector.c | 2 +-
.../gnome-shell-search-provider.c | 8 +-
16 files changed, 560 insertions(+), 2482 deletions(-)
diff --git a/libxfdashboard/Makefile.am b/libxfdashboard/Makefile.am
index 51ad25d..4e6d2f4 100644
--- a/libxfdashboard/Makefile.am
+++ b/libxfdashboard/Makefile.am
@@ -49,6 +49,7 @@ libxfdashboard_la_headers = \
focusable.h \
focus-manager.h \
image-content.h \
+ label.h \
live-window.h \
live-workspace.h \
model.h \
@@ -118,6 +119,7 @@ libxfdashboard_la_SOURCES = \
focusable.c \
focus-manager.c \
image-content.c \
+ label.c \
live-window.c \
live-workspace.c \
model.c \
diff --git a/libxfdashboard/application-button.c b/libxfdashboard/application-button.c
index b74914a..a41aa97 100644
--- a/libxfdashboard/application-button.c
+++ b/libxfdashboard/application-button.c
@@ -119,7 +119,7 @@ static void _xfdashboard_application_button_update_text(XfdashboardApplicationBu
else text=g_strdup_printf("%s\n%s", title ? title : "", description ? description : "");
}
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(self), text);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(self), text);
if(text) g_free(text);
}
@@ -141,8 +141,8 @@ static void _xfdashboard_application_button_update_icon(XfdashboardApplicationBu
gicon=g_app_info_get_icon(G_APP_INFO(priv->appInfo));
}
- if(gicon) xfdashboard_button_set_gicon(XFDASHBOARD_BUTTON(self), gicon);
- else xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(self), "image-missing");
+ if(gicon) xfdashboard_label_set_gicon(XFDASHBOARD_LABEL(self), gicon);
+ else xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(self), "image-missing");
/* Release allocated resources */
if(gicon) g_object_unref(gicon);
@@ -403,7 +403,7 @@ static void xfdashboard_application_button_init(XfdashboardApplicationButton *se
ClutterActor* xfdashboard_application_button_new(void)
{
return(g_object_new(XFDASHBOARD_TYPE_APPLICATION_BUTTON,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
"single-line", FALSE,
NULL));
}
@@ -413,7 +413,7 @@ ClutterActor* xfdashboard_application_button_new_from_app_info(GAppInfo *inAppIn
g_return_val_if_fail(G_IS_APP_INFO(inAppInfo), NULL);
return(g_object_new(XFDASHBOARD_TYPE_APPLICATION_BUTTON,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
"single-line", FALSE,
"app-info", inAppInfo,
NULL));
diff --git a/libxfdashboard/applications-view.c b/libxfdashboard/applications-view.c
index 37d9c1a..b8e83e3 100644
--- a/libxfdashboard/applications-view.c
+++ b/libxfdashboard/applications-view.c
@@ -396,11 +396,11 @@ static void _xfdashboard_applications_view_on_all_applications_menu_clicked(Xfda
/* Create parent menu item */
actor=xfdashboard_button_new();
- if(priv->parentMenuIcon) xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(actor), priv->parentMenuIcon);
+ if(priv->parentMenuIcon) xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(actor), priv->parentMenuIcon);
if(priv->viewMode==XFDASHBOARD_VIEW_MODE_LIST) actorText=g_markup_printf_escaped(priv->formatTitleDescription, _("Back"), _("Go back to previous menu"));
else actorText=g_markup_printf_escaped(priv->formatTitleOnly, _("Back"));
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(actor), actorText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(actor), actorText);
g_free(actorText);
/* Add to view and layout */
@@ -502,11 +502,11 @@ static void _xfdashboard_applications_view_on_filter_changed(XfdashboardApplicat
/* Create and adjust of "parent menu" button to application buttons */
actor=xfdashboard_button_new();
- if(priv->parentMenuIcon) xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(actor), priv->parentMenuIcon);
+ if(priv->parentMenuIcon) xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(actor), priv->parentMenuIcon);
if(priv->viewMode==XFDASHBOARD_VIEW_MODE_LIST) actorText=g_markup_printf_escaped(priv->formatTitleDescription, _("Back"), _("Go back to previous menu"));
else actorText=g_markup_printf_escaped(priv->formatTitleOnly, _("Back"));
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(actor), actorText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(actor), actorText);
g_free(actorText);
/* Add to view and layout */
@@ -530,11 +530,11 @@ static void _xfdashboard_applications_view_on_filter_changed(XfdashboardApplicat
/* Create and adjust of "parent menu" button to application buttons */
actor=xfdashboard_button_new();
- xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(actor), ALL_APPLICATIONS_MENU_ICON);
+ xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(actor), ALL_APPLICATIONS_MENU_ICON);
if(priv->viewMode==XFDASHBOARD_VIEW_MODE_LIST) actorText=g_markup_printf_escaped(priv->formatTitleDescription, _("All applications"), _("List of all installed applications"));
else actorText=g_markup_printf_escaped(priv->formatTitleOnly, _("All applications"));
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(actor), actorText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(actor), actorText);
g_free(actorText);
/* Add to view and layout */
@@ -589,7 +589,7 @@ static void _xfdashboard_applications_view_on_filter_changed(XfdashboardApplicat
actor=xfdashboard_button_new();
iconName=garcon_menu_element_get_icon_name(menuElement);
- if(iconName) xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(actor), iconName);
+ if(iconName) xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(actor), iconName);
title=garcon_menu_element_get_name(menuElement);
description=garcon_menu_element_get_comment(menuElement);
@@ -605,7 +605,7 @@ static void _xfdashboard_applications_view_on_filter_changed(XfdashboardApplicat
actorText=g_markup_printf_escaped(priv->formatTitleOnly,
title ? title : "");
}
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(actor), actorText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(actor), actorText);
g_free(actorText);
g_signal_connect(actor, "clicked", G_CALLBACK(_xfdashboard_applications_view_on_menu_clicked), menuElement);
diff --git a/libxfdashboard/button.c b/libxfdashboard/button.c
index 7e868d7..d0bc30a 100644
--- a/libxfdashboard/button.c
+++ b/libxfdashboard/button.c
@@ -1,6 +1,5 @@
/*
- * button: An actor representing a label and an icon (both optional)
- * and can react on click actions
+ * button: A label actor which can react on click actions
*
* Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
*
@@ -32,25 +31,14 @@
#include <gdk/gdk.h>
#include <math.h>
-#include <libxfdashboard/enums.h>
#include <libxfdashboard/click-action.h>
-#include <libxfdashboard/image-content.h>
#include <libxfdashboard/compat.h>
-/* Forward declarations */
-typedef enum /*< skip,prefix=XFDASHBOARD_BUTTON_ICON_TYPE >*/
-{
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NONE,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON
-} XfdashboardButtonIconType;
-
/* Define this class in GObject system */
G_DEFINE_TYPE(XfdashboardButton,
xfdashboard_button,
- XFDASHBOARD_TYPE_BACKGROUND)
+ XFDASHBOARD_TYPE_LABEL)
/* Private structure - access only by public API if needed */
#define XFDASHBOARD_BUTTON_GET_PRIVATE(obj) \
@@ -58,61 +46,10 @@ G_DEFINE_TYPE(XfdashboardButton,
struct _XfdashboardButtonPrivate
{
- /* Properties related */
- gfloat padding;
- gfloat spacing;
- XfdashboardButtonStyle style;
-
- gchar *iconName;
- ClutterImage *iconImage;
- GIcon *iconGIcon;
- gboolean iconSyncSize;
- gint iconSize;
- XfdashboardOrientation iconOrientation;
-
- gchar *font;
- ClutterColor *labelColor;
- PangoEllipsizeMode labelEllipsize;
- gboolean isSingleLineMode;
- PangoAlignment textJustification;
-
/* Instance related */
- ClutterActor *actorIcon;
- ClutterActor *actorLabel;
ClutterAction *clickAction;
-
- gboolean iconLoaded;
- XfdashboardButtonIconType iconType;
-};
-
-/* Properties */
-enum
-{
- PROP_0,
-
- PROP_PADDING,
- PROP_SPACING,
- PROP_STYLE,
-
- PROP_ICON_NAME,
- PROP_ICON_IMAGE,
- PROP_ICON_GICON,
- PROP_ICON_SYNC_SIZE,
- PROP_ICON_SIZE,
- PROP_ICON_ORIENTATION,
-
- PROP_TEXT,
- PROP_TEXT_FONT,
- PROP_TEXT_COLOR,
- PROP_TEXT_ELLIPSIZE_MODE,
- PROP_TEXT_SINGLE_LINE,
- PROP_TEXT_JUSTIFY,
-
- PROP_LAST
};
-static GParamSpec* XfdashboardButtonProperties[PROP_LAST]={ 0, };
-
/* Signals */
enum
{
@@ -125,2011 +62,113 @@ static guint XfdashboardButtonSignals[SIGNAL_LAST]={ 0, };
/* IMPLEMENTATION: Private variables and methods */
-/* Get preferred width of icon and label child actors
- * We do not respect paddings here so if height is given it must be
- * reduced by padding on all affected sides. The returned sizes are also
- * without these paddings.
- */
-static void _xfdashboard_button_get_preferred_width_intern(XfdashboardButton *self,
- gboolean inGetPreferred,
- gfloat inForHeight,
- gfloat *outIconSize,
- gfloat *outLabelSize)
+/* Proxy ClickAction signals */
+static void _xfdashboard_button_clicked(XfdashboardClickAction *inAction,
+ ClutterActor *self,
+ gpointer inUserData)
{
- XfdashboardButtonPrivate *priv;
- gfloat iconWidth, iconHeight, iconScale;
- gfloat iconSize, labelSize;
- gfloat minSize, naturalSize;
-
+ g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(inAction));
g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- priv=self->priv;
-
- /* Initialize sizes */
- iconSize=labelSize=0.0f;
-
- /* Calculate sizes
- * No size given so natural layout is requested */
- if(inForHeight<0.0f)
+ /* Only emit signal if click was perform with left button */
+ if(xfdashboard_click_action_get_button(inAction)==XFDASHBOARD_CLICK_ACTION_LEFT_BUTTON)
{
- /* Special case: both actors visible and icon size
- * synchronization is turned on
- */
- if(clutter_actor_is_visible(priv->actorLabel) &&
- clutter_actor_is_visible(priv->actorIcon) &&
- priv->iconSyncSize==TRUE)
- {
- gfloat labelHeight;
-
- /* Get size of label */
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- inForHeight,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* Get size of icon depending on orientation */
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_LEFT ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_RIGHT)
- {
- /* Get both sizes of label to calculate icon size */
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- labelSize,
- &minSize, &naturalSize);
- labelHeight=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* Get size of icon depending on opposize size of label */
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- iconSize=(iconWidth/iconHeight)*labelHeight;
- }
- else iconSize=labelHeight;
- }
- else iconSize=labelSize;
- }
- /* Just get sizes of visible actors */
- else
- {
- /* Get size of label if visible */
- if(clutter_actor_is_visible(priv->actorLabel))
- {
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- inForHeight,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
-
- /* Get size of icon if visible */
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorIcon),
- inForHeight,
- &minSize, &naturalSize);
- iconSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
- }
+ /* Emit 'clicked' signal */
+ g_signal_emit(self, XfdashboardButtonSignals[SIGNAL_CLICKED], 0);
}
- /* Special case: Size is given, both actors visible,
- * icon size synchronization is turned on
- */
- else if(clutter_actor_is_visible(priv->actorLabel) &&
- clutter_actor_is_visible(priv->actorIcon) &&
- priv->iconSyncSize==TRUE &&
- (priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM))
- {
- gfloat labelMinimumSize;
- gfloat requestSize, newRequestSize;
-
- /* Reduce size by padding and spacing */
- inForHeight-=priv->spacing;
- inForHeight-=2*priv->padding;
- inForHeight=MAX(0.0f, inForHeight);
-
- /* Get scale factor of icon */
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- iconScale=(iconWidth/iconHeight);
- iconWidth=(iconHeight/iconWidth)*inForHeight;
- iconHeight=iconWidth/iconScale;
- }
- else iconScale=iconWidth=iconHeight=0.0f;
-
- /* Get minimum size of label because we should never
- * go down below this minimum size
- */
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- -1.0f,
- &labelMinimumSize, NULL);
-
- /* Initialize height with value if it could occupy 100% width and
- * set icon size to negative value to show that its value was not
- * found yet
- */
- iconSize=-1.0f;
-
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- inForHeight,
- &minSize, &naturalSize);
- requestSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- if(priv->labelEllipsize==PANGO_ELLIPSIZE_NONE ||
- clutter_text_get_single_line_mode(CLUTTER_TEXT(priv->actorLabel))==FALSE)
- {
- do
- {
- /* Get size of icon */
- iconHeight=requestSize;
- iconWidth=iconHeight*iconScale;
-
- /* Reduce size for label by size of icon and
- * get its opposize size
- */
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- inForHeight-iconHeight,
- &minSize, &naturalSize);
- newRequestSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* If new opposite size is equal (or unexpectly lower) than
- * initial opposize size we found the sizes
- */
- if(newRequestSize<=requestSize)
- {
- iconSize=iconWidth;
- labelSize=newRequestSize;
- }
- requestSize=newRequestSize;
- }
- while(iconSize<0.0f && (inForHeight-iconHeight)>labelMinimumSize);
- }
- else
- {
- /* Get size of icon */
- iconWidth=requestSize;
- iconHeight=iconWidth/iconScale;
- iconSize=iconWidth;
-
- /* Adjust label size */
- labelSize=requestSize-iconWidth;
- }
- }
- /* Size is given but nothing special */
- else
- {
- /* Reduce size by padding and if both icon and label are visible
- * also reduce by spacing
- */
- if(clutter_actor_is_visible(priv->actorIcon) &&
- (clutter_actor_is_visible(priv->actorLabel)))
- {
- inForHeight-=priv->spacing;
- }
- inForHeight-=2*priv->padding;
- inForHeight=MAX(0.0f, inForHeight);
-
- /* Get icon size if visible */
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- if(priv->iconSyncSize==TRUE &&
- (priv->iconOrientation==XFDASHBOARD_ORIENTATION_LEFT ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_RIGHT))
- {
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- /* Get scale factor of icon and scale icon */
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- minSize=naturalSize=inForHeight*(iconWidth/iconHeight);
- }
- else minSize=naturalSize=0.0f;
- }
- else
- {
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorIcon),
- inForHeight,
- &minSize, &naturalSize);
- }
-
- iconSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
-
- /* Get label size if visible */
- if(clutter_actor_is_visible(priv->actorLabel))
- {
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM)
- {
- inForHeight-=iconSize;
- }
-
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- inForHeight,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
- }
-
- /* Set computed sizes */
- if(outIconSize) *outIconSize=iconSize;
- if(outLabelSize) *outLabelSize=labelSize;
}
-/* Get preferred height of icon and label child actors
- * We do not respect paddings here so if width is given it must be
- * reduced by paddings and spacing. The returned sizes are alsowithout
- * these paddings and spacing.
- */
-static void _xfdashboard_button_get_preferred_height_intern(XfdashboardButton *self,
- gboolean inGetPreferred,
- gfloat inForWidth,
- gfloat *outIconSize,
- gfloat *outLabelSize)
-{
- XfdashboardButtonPrivate *priv;
- gfloat iconWidth, iconHeight, iconScale;
- gfloat iconSize, labelSize;
- gfloat minSize, naturalSize;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Initialize sizes */
- iconSize=labelSize=0.0f;
-
- /* Calculate sizes
- * No size given so natural layout is requested */
- if(inForWidth<0.0f)
- {
- /* Special case: both actors visible and icon size
- * synchronization is turned on
- */
- if(clutter_actor_is_visible(priv->actorLabel) &&
- clutter_actor_is_visible(priv->actorIcon) &&
- priv->iconSyncSize==TRUE)
- {
- gfloat labelWidth;
-
- /* Get size of label */
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- inForWidth,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* Get size of icon depending on orientation */
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM)
- {
- /* Get both sizes of label to calculate icon size */
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- labelSize,
- &minSize, &naturalSize);
- labelWidth=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* Get size of icon depending on opposize size of label */
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- iconSize=(iconHeight/iconWidth)*labelWidth;
- }
- else iconSize=labelWidth;
- }
- else iconSize=labelSize;
- }
- /* Just get sizes of visible actors */
- else
- {
- /* Get sizes of visible actors */
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorIcon),
- inForWidth,
- &minSize, &naturalSize);
- iconSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
-
- if(clutter_actor_is_visible(priv->actorLabel))
- {
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- inForWidth,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
- }
- }
- /* Special case: Size is given, both actors visible,
- * icon size synchronization is turned on
- */
- else if(clutter_actor_is_visible(priv->actorLabel) &&
- clutter_actor_is_visible(priv->actorIcon) &&
- priv->iconSyncSize==TRUE &&
- (priv->iconOrientation==XFDASHBOARD_ORIENTATION_LEFT ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_RIGHT))
- {
- gfloat labelMinimumSize;
- gfloat requestSize, newRequestSize;
-
- /* Reduce size by padding and spacing */
- inForWidth-=priv->spacing;
- inForWidth-=2*priv->padding;
- inForWidth=MAX(0.0f, inForWidth);
-
- /* Get scale factor of icon */
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- iconScale=(iconWidth/iconHeight);
- iconWidth=(iconHeight/iconWidth)*inForWidth;
- iconHeight=iconWidth/iconScale;
- }
- else iconScale=iconWidth=iconHeight=0.0f;
-
- /* Get minimum size of label because we should never
- * go down below this minimum size
- */
- clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorLabel),
- -1.0f,
- &labelMinimumSize, NULL);
-
- /* Initialize height with value if it could occupy 100% width and
- * set icon size to negative value to show that its value was not
- * found yet
- */
- iconSize=-1.0f;
-
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- inForWidth,
- &minSize, &naturalSize);
- requestSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- if(priv->labelEllipsize==PANGO_ELLIPSIZE_NONE ||
- clutter_text_get_single_line_mode(CLUTTER_TEXT(priv->actorLabel))==FALSE)
- {
- do
- {
- /* Get size of icon */
- iconHeight=requestSize;
- iconWidth=iconHeight*iconScale;
-
- /* Reduce size for label by size of icon and
- * get its opposize size
- */
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- inForWidth-iconWidth,
- &minSize, &naturalSize);
- newRequestSize=(inGetPreferred==TRUE ? naturalSize : minSize);
-
- /* If new opposite size is equal (or unexpectly lower) than
- * initial opposize size we found the sizes
- */
- if(newRequestSize<=requestSize)
- {
- iconSize=iconHeight;
- labelSize=newRequestSize;
- }
- requestSize=newRequestSize;
- }
- while(iconSize<0.0f && (inForWidth-iconWidth)>labelMinimumSize);
- }
- else
- {
- /* Get size of icon */
- iconHeight=requestSize;
- iconWidth=iconHeight*iconScale;
- iconSize=iconHeight;
-
- /* Adjust label size */
- labelSize=requestSize-iconHeight;
- }
- }
- /* Size is given but nothing special */
- else
- {
- /* Reduce size by padding and if both icon and label are visible
- * also reduce by spacing
- */
- if(clutter_actor_is_visible(priv->actorIcon) &&
- (clutter_actor_is_visible(priv->actorLabel)))
- {
- inForWidth-=priv->spacing;
- }
- inForWidth-=2*priv->padding;
- inForWidth=MAX(0.0f, inForWidth);
-
- /* Get icon size if visible */
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- if(priv->iconSyncSize==TRUE &&
- (priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM))
- {
- if(CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- /* Get scale factor of icon and scale icon */
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- minSize=naturalSize=inForWidth*(iconHeight/iconWidth);
- }
- else minSize=naturalSize=0.0f;
- }
- else
- {
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorIcon),
- inForWidth,
- &minSize, &naturalSize);
- }
- iconSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
-
- /* Get label size if visible */
- if(clutter_actor_is_visible(priv->actorLabel))
- {
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_LEFT ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_RIGHT)
- {
- inForWidth-=iconSize;
- }
-
- clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorLabel),
- inForWidth,
- &minSize, &naturalSize);
- labelSize=(inGetPreferred==TRUE ? naturalSize : minSize);
- }
- }
-
- /* Set computed sizes */
- if(outIconSize) *outIconSize=iconSize;
- if(outLabelSize) *outLabelSize=labelSize;
-}
+/* IMPLEMENTATION: GObject */
-/* Update icon */
-static void _xfdashboard_button_update_icon_image_size(XfdashboardButton *self)
+/* Class initialization
+ * Override functions in parent classes and define properties
+ * and signals
+ */
+static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
{
- XfdashboardButtonPrivate *priv;
- gfloat iconWidth, iconHeight;
- gfloat maxSize;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
- iconWidth=iconHeight=-1.0f;
- maxSize=0.0f;
-
- /* Determine maximum size of icon either from label size if icon size
- * should be synchronized or to icon size set if greater than zero.
- * Otherwise the default size of icon will be set
- */
- if(priv->iconSyncSize)
- {
- gfloat labelWidth, labelHeight;
-
- /* Get size of label */
- clutter_actor_get_preferred_size(CLUTTER_ACTOR(priv->actorLabel),
- NULL, NULL,
- &labelWidth, &labelHeight);
-
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM)
- {
- maxSize=labelWidth;
- }
- else
- {
- maxSize=labelHeight;
- }
- }
- else if(priv->iconSize>0.0f) maxSize=priv->iconSize;
-
- /* Get size of icon if maximum size is set */
- if(maxSize>0.0f && CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- /* Get preferred size of icon */
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
-
- /* Determine size of icon */
- if(iconWidth>iconHeight)
- {
- iconHeight=maxSize*(iconHeight/iconWidth);
- iconWidth=maxSize;
- }
- else
- {
- iconWidth=maxSize*(iconWidth/iconHeight);
- iconHeight=maxSize;
- }
- }
-
- /* Update size of icon actor */
- clutter_actor_set_size(priv->actorIcon, iconWidth, iconHeight);
+ /* Set up private structure */
+ g_type_class_add_private(klass, sizeof(XfdashboardButtonPrivate));
- /* Queue a redraw as the actors are now available */
- clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
+ /* Define signals */
+ XfdashboardButtonSignals[SIGNAL_CLICKED]=
+ g_signal_new("clicked",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(XfdashboardButtonClass, clicked),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
-/* Actor was mapped or unmapped */
-static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
- GParamSpec *inSpec,
- gpointer inUserData)
+/* Object initialization
+ * Create private structure and set up default values
+ */
+static void xfdashboard_button_init(XfdashboardButton *self)
{
XfdashboardButtonPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* If actor is mapped now and an image by icon name was set but not
- * loaded yet then set icon image now
- */
- if(clutter_actor_is_mapped(CLUTTER_ACTOR(self)) &&
- priv->iconLoaded==FALSE)
- {
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME)
- {
- ClutterContent *image;
-
- /* Set icon image */
- image=xfdashboard_image_content_new_for_icon_name(priv->iconName, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
-
- priv->iconLoaded=TRUE;
-
- /* Calculate icon size as image content is now available */
- _xfdashboard_button_update_icon_image_size(self);
-
- g_debug("Loaded and set deferred image '%s' at size %d for %s@%p ", priv->iconName, priv->iconSize, G_OBJECT_TYPE_NAME(self), self);
- }
-
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON)
- {
- ClutterContent *image;
-
- /* Set icon image */
- image=xfdashboard_image_content_new_for_gicon(priv->iconGIcon, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
-
- priv->iconLoaded=TRUE;
+ priv=self->priv=XFDASHBOARD_BUTTON_GET_PRIVATE(self);
- /* Calculate icon size as image content is now available */
- _xfdashboard_button_update_icon_image_size(self);
+ /* This actor reacts on events */
+ clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE);
- g_debug("Loaded and set deferred image '%s' at size %d for %s@%p ", priv->iconName, priv->iconSize, G_OBJECT_TYPE_NAME(self), self);
- }
- }
+ /* Connect signals */
+ priv->clickAction=xfdashboard_click_action_new();
+ clutter_actor_add_action(CLUTTER_ACTOR(self), priv->clickAction);
+ g_signal_connect(priv->clickAction, "clicked", G_CALLBACK(_xfdashboard_button_clicked), NULL);
}
-/* IMPLEMENTATION: ClutterActor */
-
-/* Show all children of this actor */
-static void _xfdashboard_button_show_all(ClutterActor *self)
-{
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
-
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_ICON ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
- {
- clutter_actor_show(CLUTTER_ACTOR(priv->actorIcon));
- }
- else clutter_actor_hide(CLUTTER_ACTOR(priv->actorIcon));
-
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_TEXT ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
- {
- clutter_actor_show(CLUTTER_ACTOR(priv->actorLabel));
- }
- else clutter_actor_hide(CLUTTER_ACTOR(priv->actorLabel));
-
- clutter_actor_show(self);
-}
+/* IMPLEMENTATION: Public API */
-/* Hide all children of this actor */
-static void _xfdashboard_button_hide_all(ClutterActor *self)
+/* Create new actor */
+ClutterActor* xfdashboard_button_new(void)
{
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
-
- clutter_actor_hide(self);
- clutter_actor_hide(CLUTTER_ACTOR(priv->actorIcon));
- clutter_actor_hide(CLUTTER_ACTOR(priv->actorLabel));
+ return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ "text", N_(""),
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
+ NULL));
}
-/* Get preferred width/height */
-static void _xfdashboard_button_get_preferred_height(ClutterActor *inActor,
- gfloat inForWidth,
- gfloat *outMinHeight,
- gfloat *outNaturalHeight)
+ClutterActor* xfdashboard_button_new_with_text(const gchar *inText)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
- gfloat minHeight, naturalHeight;
- gfloat minIconHeight, naturalIconHeight;
- gfloat minLabelHeight, naturalLabelHeight;
- gfloat spacing=priv->spacing;
-
- /* Initialize sizes */
- minHeight=naturalHeight=0.0f;
-
- /* Calculate sizes for requested one (means which can and will be stored) */
- if(outMinHeight)
- {
- _xfdashboard_button_get_preferred_height_intern(self,
- FALSE,
- inForWidth,
- &minIconHeight,
- &minLabelHeight);
- }
-
- if(outNaturalHeight)
- {
- _xfdashboard_button_get_preferred_height_intern(self,
- TRUE,
- inForWidth,
- &naturalIconHeight,
- &naturalLabelHeight);
- }
-
- if(clutter_actor_is_visible(priv->actorLabel)!=TRUE ||
- clutter_actor_is_visible(priv->actorIcon)!=TRUE)
- {
- spacing=0.0f;
- }
-
- switch(priv->iconOrientation)
- {
- case XFDASHBOARD_ORIENTATION_TOP:
- case XFDASHBOARD_ORIENTATION_BOTTOM:
- minHeight=minIconHeight+minLabelHeight;
- naturalHeight=naturalIconHeight+naturalLabelHeight;
- break;
-
- default:
- minHeight=MAX(minIconHeight, minLabelHeight);
- naturalHeight=MAX(naturalIconHeight, naturalLabelHeight);
- break;
- }
-
- /* Add spacing to size if orientation is top or bottom.
- * Spacing was initially set to spacing in settings but
- * resetted to zero if either text or icon is not visible.
- */
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_TOP ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_BOTTOM)
- {
- minHeight+=spacing;
- naturalHeight+=spacing;
- }
-
- /* Add padding */
- minHeight+=2*priv->padding;
- naturalHeight+=2*priv->padding;
-
- /* Store sizes computed */
- if(outMinHeight) *outMinHeight=minHeight;
- if(outNaturalHeight) *outNaturalHeight=naturalHeight;
+ return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ "text", inText,
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
+ NULL));
}
-static void _xfdashboard_button_get_preferred_width(ClutterActor *inActor,
- gfloat inForHeight,
- gfloat *outMinWidth,
- gfloat *outNaturalWidth)
+ClutterActor* xfdashboard_button_new_with_icon_name(const gchar *inIconName)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
- gfloat minWidth, naturalWidth;
- gfloat minIconWidth, naturalIconWidth;
- gfloat minLabelWidth, naturalLabelWidth;
- gfloat spacing=priv->spacing;
-
- /* Initialize sizes */
- minWidth=naturalWidth=0.0f;
-
- /* Calculate sizes for requested one (means which can and will be stored) */
- if(outMinWidth)
- {
- _xfdashboard_button_get_preferred_width_intern(self,
- FALSE,
- inForHeight,
- &minIconWidth,
- &minLabelWidth);
- }
-
- if(outNaturalWidth)
- {
- _xfdashboard_button_get_preferred_width_intern(self,
- TRUE,
- inForHeight,
- &naturalIconWidth,
- &naturalLabelWidth);
- }
-
- if(clutter_actor_is_visible(priv->actorLabel)!=TRUE ||
- clutter_actor_is_visible(priv->actorIcon)!=TRUE)
- {
- spacing=0.0f;
- }
-
- switch(priv->iconOrientation)
- {
- case XFDASHBOARD_ORIENTATION_LEFT:
- case XFDASHBOARD_ORIENTATION_RIGHT:
- minWidth=minIconWidth+minLabelWidth;
- naturalWidth=naturalIconWidth+naturalLabelWidth;
- break;
-
- default:
- minWidth=MAX(minIconWidth, minLabelWidth);
- naturalWidth=MAX(naturalIconWidth, naturalLabelWidth);
- break;
- }
-
- /* Add spacing to size if orientation is left or right.
- * Spacing was initially set to spacing in settings but
- * resetted to zero if either text or icon is not visible.
- */
- if(priv->iconOrientation==XFDASHBOARD_ORIENTATION_LEFT ||
- priv->iconOrientation==XFDASHBOARD_ORIENTATION_RIGHT)
- {
- minWidth+=spacing;
- naturalWidth+=spacing;
- }
-
- /* Add padding */
- minWidth+=2*priv->padding;
- naturalWidth+=2*priv->padding;
-
- /* Store sizes computed */
- if(outMinWidth) *outMinWidth=minWidth;
- if(outNaturalWidth) *outNaturalWidth=naturalWidth;
+ return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ "icon-name", inIconName,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
+ NULL));
}
-/* Allocate position and size of actor and its children */
-static void _xfdashboard_button_allocate(ClutterActor *inActor,
- const ClutterActorBox *inBox,
- ClutterAllocationFlags inFlags)
+ClutterActor* xfdashboard_button_new_with_gicon(GIcon *inIcon)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
- ClutterActorBox *boxLabel=NULL;
- ClutterActorBox *boxIcon=NULL;
- gfloat left, right, top, bottom;
- gfloat textWidth, textHeight;
- gfloat iconWidth, iconHeight;
- gfloat spacing=priv->spacing;
-
- /* Chain up to store the allocation of the actor */
- CLUTTER_ACTOR_CLASS(xfdashboard_button_parent_class)->allocate(inActor, inBox, inFlags);
-
- /* Get sizes of children and determine if we need
- * to add spacing between text and icon. If either
- * icon or text is not visible reset its size to zero
- * and also reset spacing to zero.
- */
- if(!clutter_actor_is_visible(priv->actorIcon) ||
- !clutter_actor_is_visible(priv->actorLabel))
- {
- spacing=0.0f;
- }
-
- /* Get icon sizes */
- iconWidth=iconHeight=0.0f;
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- gfloat iconScale=1.0f;
-
- if(priv->iconSyncSize==TRUE &&
- CLUTTER_IS_CONTENT(clutter_actor_get_content(priv->actorIcon)))
- {
- clutter_content_get_preferred_size(clutter_actor_get_content(priv->actorIcon),
- &iconWidth, &iconHeight);
- iconScale=(iconWidth/iconHeight);
- }
-
- if(clutter_actor_get_request_mode(CLUTTER_ACTOR(self))==CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- _xfdashboard_button_get_preferred_height_intern(self,
- TRUE,
- clutter_actor_box_get_width(inBox),
- &iconHeight,
- NULL);
- if(priv->iconSyncSize==TRUE) iconWidth=iconHeight*iconScale;
- else clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorIcon), iconHeight, NULL, &iconWidth);
- }
- else
- {
- _xfdashboard_button_get_preferred_width_intern(self,
- TRUE,
- clutter_actor_box_get_height(inBox),
- &iconWidth,
- NULL);
- if(priv->iconSyncSize==TRUE) iconHeight=iconWidth/iconScale;
- else clutter_actor_get_preferred_height(CLUTTER_ACTOR(priv->actorIcon), iconWidth, NULL, &iconHeight);
- }
- }
-
- /* Set allocation of label if visible*/
- textWidth=textHeight=0.0f;
- if(clutter_actor_is_visible(priv->actorLabel))
- {
- switch(priv->iconOrientation)
- {
- case XFDASHBOARD_ORIENTATION_TOP:
- textWidth=MAX(0.0f, clutter_actor_box_get_width(inBox)-2*priv->padding);
-
- textHeight=clutter_actor_box_get_height(inBox)-iconHeight-2*priv->padding;
- if(clutter_actor_is_visible(priv->actorIcon)) textHeight-=priv->spacing;
- textHeight=MAX(0.0f, textHeight);
-
- left=((clutter_actor_box_get_width(inBox)-textWidth)/2.0f);
- right=left+textWidth;
- top=priv->padding+iconHeight+spacing;
- bottom=top+textHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_BOTTOM:
- textWidth=MAX(0.0f, clutter_actor_box_get_width(inBox)-2*priv->padding);
-
- textHeight=clutter_actor_box_get_height(inBox)-iconHeight-2*priv->padding;
- if(clutter_actor_is_visible(priv->actorIcon)) textHeight-=priv->spacing;
- textHeight=MAX(0.0f, textHeight);
-
- left=((clutter_actor_box_get_width(inBox)-textWidth)/2.0f);
- right=left+textWidth;
- top=priv->padding;
- bottom=top+textHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_RIGHT:
- textWidth=clutter_actor_box_get_width(inBox)-iconWidth-2*priv->padding;
- if(clutter_actor_is_visible(priv->actorIcon)) textWidth-=priv->spacing;
- textWidth=MAX(0.0f, textWidth);
-
- textHeight=MAX(0.0f, clutter_actor_box_get_height(inBox)-2*priv->padding);
-
- left=priv->padding;
- right=left+textWidth;
- top=priv->padding;
- bottom=top+textHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_LEFT:
- default:
- textWidth=clutter_actor_box_get_width(inBox)-iconWidth-2*priv->padding;
- if(clutter_actor_is_visible(priv->actorIcon)) textWidth-=priv->spacing;
- textWidth=MAX(0.0f, textWidth);
-
- textHeight=MAX(0.0f, clutter_actor_box_get_height(inBox)-2*priv->padding);
-
- left=priv->padding+iconWidth+spacing;
- right=left+textWidth;
- top=priv->padding;
- bottom=top+textHeight;
- break;
- }
-
- right=MAX(left, right);
- bottom=MAX(top, bottom);
-
- boxLabel=clutter_actor_box_new(floor(left), floor(top), floor(right), floor(bottom));
- clutter_actor_allocate(CLUTTER_ACTOR(priv->actorLabel), boxLabel, inFlags);
- }
-
- /* Set allocation of icon if visible*/
- if(clutter_actor_is_visible(priv->actorIcon))
- {
- switch(priv->iconOrientation)
- {
- case XFDASHBOARD_ORIENTATION_TOP:
- left=((clutter_actor_box_get_width(inBox)-iconWidth)/2.0f);
- right=left+iconWidth;
- top=priv->padding;
- bottom=top+iconHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_BOTTOM:
- left=((clutter_actor_box_get_width(inBox)-iconWidth)/2.0f);
- right=left+iconWidth;
- top=priv->padding+textHeight+spacing;
- bottom=top+iconHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_RIGHT:
- left=clutter_actor_box_get_width(inBox)-priv->padding-iconWidth;
- right=clutter_actor_box_get_width(inBox)-priv->padding;
- top=priv->padding;
- bottom=top+iconHeight;
- break;
-
- case XFDASHBOARD_ORIENTATION_LEFT:
- default:
- left=priv->padding;
- right=left+iconWidth;
- top=priv->padding;
- bottom=top+iconHeight;
- break;
- }
-
- right=MAX(left, right);
- bottom=MAX(top, bottom);
-
- boxIcon=clutter_actor_box_new(floor(left), floor(top), floor(right), floor(bottom));
- clutter_actor_allocate(CLUTTER_ACTOR(priv->actorIcon), boxIcon, inFlags);
- }
-
- /* Release allocated memory */
- if(boxLabel) clutter_actor_box_free(boxLabel);
- if(boxIcon) clutter_actor_box_free(boxIcon);
+ return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ "icon-gicon", inIcon,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
+ NULL));
}
-/* proxy ClickAction signals */
-static void _xfdashboard_button_clicked(XfdashboardClickAction *inAction,
- ClutterActor *self,
- gpointer inUserData)
+ClutterActor* xfdashboard_button_new_full_with_icon_name(const gchar *inIconName, const gchar *inText)
{
- g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(inAction));
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- /* Only emit signal if click was perform with left button */
- if(xfdashboard_click_action_get_button(inAction)==XFDASHBOARD_CLICK_ACTION_LEFT_BUTTON)
- {
- /* Emit 'clicked' signal */
- g_signal_emit(self, XfdashboardButtonSignals[SIGNAL_CLICKED], 0);
- }
+ return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ "text", inText,
+ "icon-name", inIconName,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
+ NULL));
}
-/* Destroy this actor */
-static void _xfdashboard_button_destroy(ClutterActor *self)
-{
- /* Destroy each child actor when this actor is destroyed */
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
-
- if(priv->actorIcon)
- {
- clutter_actor_destroy(CLUTTER_ACTOR(priv->actorIcon));
- priv->actorIcon=NULL;
- }
-
- if(priv->actorLabel)
- {
- clutter_actor_destroy(CLUTTER_ACTOR(priv->actorLabel));
- priv->actorLabel=NULL;
- }
-
- /* Call parent's class destroy method */
- CLUTTER_ACTOR_CLASS(xfdashboard_button_parent_class)->destroy(self);
-}
-
-/* IMPLEMENTATION: GObject */
-
-/* Dispose this object */
-static void _xfdashboard_button_dispose(GObject *inObject)
-{
- /* Release our allocated variables */
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
- XfdashboardButtonPrivate *priv=self->priv;
-
- if(priv->iconName)
- {
- g_free(priv->iconName);
- priv->iconName=NULL;
- }
-
- if(priv->iconImage)
- {
- g_object_unref(priv->iconImage);
- priv->iconImage=NULL;
- }
-
- if(priv->font)
- {
- g_free(priv->font);
- priv->font=NULL;
- }
-
- if(priv->labelColor)
- {
- clutter_color_free(priv->labelColor);
- priv->labelColor=NULL;
- }
-
- /* Call parent's class dispose method */
- G_OBJECT_CLASS(xfdashboard_button_parent_class)->dispose(inObject);
-}
-
-/* Set/get properties */
-static void _xfdashboard_button_set_property(GObject *inObject,
- guint inPropID,
- const GValue *inValue,
- GParamSpec *inSpec)
-{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
-
- switch(inPropID)
- {
- case PROP_PADDING:
- xfdashboard_button_set_padding(self, g_value_get_float(inValue));
- break;
-
- case PROP_SPACING:
- xfdashboard_button_set_spacing(self, g_value_get_float(inValue));
- break;
-
- case PROP_STYLE:
- xfdashboard_button_set_style(self, g_value_get_enum(inValue));
- break;
-
- case PROP_ICON_NAME:
- xfdashboard_button_set_icon_name(self, g_value_get_string(inValue));
- break;
-
- case PROP_ICON_GICON:
- xfdashboard_button_set_gicon(self, G_ICON(g_value_get_object(inValue)));
- break;
-
- case PROP_ICON_IMAGE:
- xfdashboard_button_set_icon_image(self, g_value_get_object(inValue));
- break;
-
- case PROP_ICON_SYNC_SIZE:
- xfdashboard_button_set_sync_icon_size(self, g_value_get_boolean(inValue));
- break;
-
- case PROP_ICON_SIZE:
- xfdashboard_button_set_icon_size(self, g_value_get_uint(inValue));
- break;
-
- case PROP_ICON_ORIENTATION:
- xfdashboard_button_set_icon_orientation(self, g_value_get_enum(inValue));
- break;
-
- case PROP_TEXT:
- xfdashboard_button_set_text(self, g_value_get_string(inValue));
- break;
-
- case PROP_TEXT_FONT:
- xfdashboard_button_set_font(self, g_value_get_string(inValue));
- break;
-
- case PROP_TEXT_COLOR:
- xfdashboard_button_set_color(self, clutter_value_get_color(inValue));
- break;
-
- case PROP_TEXT_ELLIPSIZE_MODE:
- xfdashboard_button_set_ellipsize_mode(self, g_value_get_enum(inValue));
- break;
-
- case PROP_TEXT_SINGLE_LINE:
- xfdashboard_button_set_single_line_mode(self, g_value_get_boolean(inValue));
- break;
-
- case PROP_TEXT_JUSTIFY:
- xfdashboard_button_set_text_justification(self, g_value_get_enum(inValue));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(inObject, inPropID, inSpec);
- break;
- }
-}
-
-static void _xfdashboard_button_get_property(GObject *inObject,
- guint inPropID,
- GValue *outValue,
- GParamSpec *inSpec)
-{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
- XfdashboardButtonPrivate *priv=self->priv;
-
- switch(inPropID)
- {
- case PROP_PADDING:
- g_value_set_float(outValue, priv->padding);
- break;
-
- case PROP_SPACING:
- g_value_set_float(outValue, priv->spacing);
- break;
-
- case PROP_STYLE:
- g_value_set_enum(outValue, priv->style);
- break;
-
- case PROP_ICON_NAME:
- g_value_set_string(outValue, priv->iconName);
- break;
-
- case PROP_ICON_GICON:
- g_value_set_object(outValue, priv->iconGIcon);
- break;
-
- case PROP_ICON_IMAGE:
- g_value_set_object(outValue, priv->iconImage);
- break;
-
- case PROP_ICON_SYNC_SIZE:
- g_value_set_boolean(outValue, priv->iconSyncSize);
- break;
-
- case PROP_ICON_SIZE:
- g_value_set_uint(outValue, priv->iconSize);
- break;
-
- case PROP_ICON_ORIENTATION:
- g_value_set_enum(outValue, priv->iconOrientation);
- break;
-
- case PROP_TEXT:
- g_value_set_string(outValue, clutter_text_get_text(CLUTTER_TEXT(priv->actorLabel)));
- break;
-
- case PROP_TEXT_FONT:
- g_value_set_string(outValue, priv->font);
- break;
-
- case PROP_TEXT_COLOR:
- clutter_value_set_color(outValue, priv->labelColor);
- break;
-
- case PROP_TEXT_ELLIPSIZE_MODE:
- g_value_set_enum(outValue, priv->labelEllipsize);
- break;
-
- case PROP_TEXT_SINGLE_LINE:
- g_value_set_boolean(outValue, priv->isSingleLineMode);
- break;
-
- case PROP_TEXT_JUSTIFY:
- g_value_set_enum(outValue, priv->textJustification);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(inObject, inPropID, inSpec);
- break;
- }
-}
-
-/* Class initialization
- * Override functions in parent classes and define properties
- * and signals
- */
-static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
-{
- XfdashboardActorClass *actorClass=XFDASHBOARD_ACTOR_CLASS(klass);
- ClutterActorClass *clutterActorClass=CLUTTER_ACTOR_CLASS(klass);
- GObjectClass *gobjectClass=G_OBJECT_CLASS(klass);
-
- /* Override functions */
- gobjectClass->dispose=_xfdashboard_button_dispose;
- gobjectClass->set_property=_xfdashboard_button_set_property;
- gobjectClass->get_property=_xfdashboard_button_get_property;
-
- clutterActorClass->show_all=_xfdashboard_button_show_all;
- clutterActorClass->hide_all=_xfdashboard_button_hide_all;
- clutterActorClass->get_preferred_width=_xfdashboard_button_get_preferred_width;
- clutterActorClass->get_preferred_height=_xfdashboard_button_get_preferred_height;
- clutterActorClass->allocate=_xfdashboard_button_allocate;
- clutterActorClass->destroy=_xfdashboard_button_destroy;
-
- /* Set up private structure */
- g_type_class_add_private(klass, sizeof(XfdashboardButtonPrivate));
-
- /* Define properties */
- XfdashboardButtonProperties[PROP_PADDING]=
- g_param_spec_float("padding",
- _("Padding"),
- _("Padding between background and elements"),
- 0.0f, G_MAXFLOAT,
- 4.0f,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
-
- XfdashboardButtonProperties[PROP_SPACING]=
- g_param_spec_float("spacing",
- _("Spacing"),
- _("Spacing between text and icon"),
- 0.0f, G_MAXFLOAT,
- 4.0f,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
-
- XfdashboardButtonProperties[PROP_STYLE]=
- g_param_spec_enum("button-style",
- _("Button style"),
- _("Style of button showing text and/or icon"),
- XFDASHBOARD_TYPE_BUTTON_STYLE,
- XFDASHBOARD_BUTTON_STYLE_TEXT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
-
- XfdashboardButtonProperties[PROP_ICON_NAME]=
- g_param_spec_string("icon-name",
- _("Icon name"),
- _("Themed icon name or file name of icon"),
- N_(""),
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_ICON_GICON]=
- g_param_spec_object("icon-gicon",
- _("Icon GIcon"),
- _("The GIcon of icon"),
- G_TYPE_ICON,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_ICON_IMAGE]=
- g_param_spec_object("icon-image",
- _("Icon image"),
- _("Image of icon"),
- CLUTTER_TYPE_IMAGE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]=
- g_param_spec_boolean("sync-icon-size",
- _("Synchronize icon size"),
- _("Synchronize icon size with text size"),
- TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_ICON_SIZE]=
- g_param_spec_uint("icon-size",
- _("Icon size"),
- _("Size of icon if size of icon is not synchronized. -1 is valid for icon images and sets icon image's default size."),
- 1, G_MAXUINT,
- 16,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_ICON_ORIENTATION]=
- g_param_spec_enum("icon-orientation",
- _("Icon orientation"),
- _("Orientation of icon to label"),
- XFDASHBOARD_TYPE_ORIENTATION,
- XFDASHBOARD_ORIENTATION_LEFT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
-
- XfdashboardButtonProperties[PROP_TEXT]=
- g_param_spec_string("text",
- _("Label text"),
- _("Text of label"),
- N_(""),
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_TEXT_FONT]=
- g_param_spec_string("font",
- _("Font"),
- _("Font of label"),
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_TEXT_COLOR]=
- clutter_param_spec_color("color",
- _("Color"),
- _("Color of label"),
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]=
- g_param_spec_enum("ellipsize-mode",
- _("Ellipsize mode"),
- _("Mode of ellipsize if text in label is too long"),
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_MIDDLE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
-
- XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]=
- g_param_spec_boolean("single-line",
- _("Single line"),
- _("Flag to determine if text can only be in one or multiple lines"),
- TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- XfdashboardButtonProperties[PROP_TEXT_JUSTIFY]=
- g_param_spec_enum("text-justify",
- _("Text justify"),
- _("Justification (line alignment) of label"),
- PANGO_TYPE_ALIGNMENT,
- PANGO_ALIGN_LEFT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(gobjectClass, PROP_LAST, XfdashboardButtonProperties);
-
- /* Define stylable properties */
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_PADDING]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_SPACING]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_STYLE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_NAME]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_IMAGE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_SIZE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_ORIENTATION]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_FONT]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_COLOR]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_JUSTIFY]);
-
- /* Define signals */
- XfdashboardButtonSignals[SIGNAL_CLICKED]=
- g_signal_new("clicked",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(XfdashboardButtonClass, clicked),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-}
-
-/* Object initialization
- * Create private structure and set up default values
- */
-static void xfdashboard_button_init(XfdashboardButton *self)
-{
- XfdashboardButtonPrivate *priv;
-
- priv=self->priv=XFDASHBOARD_BUTTON_GET_PRIVATE(self);
-
- /* This actor reacts on events */
- clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE);
-
- /* Set up default values */
- priv->padding=0.0f;
- priv->spacing=0.0f;
- priv->style=-1;
- priv->iconName=NULL;
- priv->iconImage=NULL;
- priv->iconSyncSize=TRUE;
- priv->iconSize=16;
- priv->iconOrientation=-1;
- priv->font=NULL;
- priv->labelColor=NULL;
- priv->labelEllipsize=-1;
- priv->isSingleLineMode=TRUE;
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NONE;
-
- /* Create actors */
- priv->actorIcon=clutter_actor_new();
- clutter_actor_add_child(CLUTTER_ACTOR(self), priv->actorIcon);
- clutter_actor_set_reactive(priv->actorIcon, FALSE);
-
- priv->actorLabel=clutter_text_new();
- clutter_actor_add_child(CLUTTER_ACTOR(self), priv->actorLabel);
- clutter_actor_set_reactive(CLUTTER_ACTOR(priv->actorLabel), FALSE);
- clutter_text_set_selectable(CLUTTER_TEXT(priv->actorLabel), FALSE);
- clutter_text_set_line_wrap(CLUTTER_TEXT(priv->actorLabel), TRUE);
- clutter_text_set_single_line_mode(CLUTTER_TEXT(priv->actorLabel), priv->isSingleLineMode);
-
- /* Connect signals */
- g_signal_connect(self, "notify::mapped", G_CALLBACK(_xfdashboard_button_on_mapped_changed), NULL);
-
- priv->clickAction=xfdashboard_click_action_new();
- clutter_actor_add_action(CLUTTER_ACTOR(self), priv->clickAction);
- g_signal_connect(priv->clickAction, "clicked", G_CALLBACK(_xfdashboard_button_clicked), NULL);
-}
-
-/* IMPLEMENTATION: Public API */
-
-/* Create new actor */
-ClutterActor* xfdashboard_button_new(void)
-{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
- "text", N_(""),
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
- NULL));
-}
-
-ClutterActor* xfdashboard_button_new_with_text(const gchar *inText)
-{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
- "text", inText,
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
- NULL));
-}
-
-ClutterActor* xfdashboard_button_new_with_icon_name(const gchar *inIconName)
-{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
- "icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
- NULL));
-}
-
-ClutterActor* xfdashboard_button_new_with_gicon(GIcon *inIcon)
-{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
- "icon-gicon", inIcon,
- "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
- NULL));
-}
-
-ClutterActor* xfdashboard_button_new_full_with_icon_name(const gchar *inIconName, const gchar *inText)
-{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
- "text", inText,
- "icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
- NULL));
-}
-
-ClutterActor* xfdashboard_button_new_full_with_gicon(GIcon *inIcon, const gchar *inText)
+ClutterActor* xfdashboard_button_new_full_with_gicon(GIcon *inIcon, const gchar *inText)
{
return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
"text", inText,
"icon-gicon", inIcon,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
NULL));
}
-
-/* Get/set padding of background to text and icon actors */
-gfloat xfdashboard_button_get_padding(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
-
- return(self->priv->padding);
-}
-
-void xfdashboard_button_set_padding(XfdashboardButton *self, const gfloat inPadding)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(inPadding>=0.0f);
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->padding!=inPadding)
- {
- /* Set value */
- priv->padding=inPadding;
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Update actor */
- xfdashboard_background_set_corner_radius(XFDASHBOARD_BACKGROUND(self), priv->padding);
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_PADDING]);
- }
-}
-
-/* Get/set spacing between text and icon actors */
-gfloat xfdashboard_button_get_spacing(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
-
- return(self->priv->spacing);
-}
-
-void xfdashboard_button_set_spacing(XfdashboardButton *self, const gfloat inSpacing)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(inSpacing>=0.0f);
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->spacing!=inSpacing)
- {
- /* Set value */
- priv->spacing=inSpacing;
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_SPACING]);
- }
-}
-
-/* Get/set style of button */
-XfdashboardButtonStyle xfdashboard_button_get_style(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), XFDASHBOARD_BUTTON_STYLE_TEXT);
-
- return(self->priv->style);
-}
-
-void xfdashboard_button_set_style(XfdashboardButton *self, const XfdashboardButtonStyle inStyle)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->style!=inStyle)
- {
- /* Set value */
- priv->style=inStyle;
-
- /* Show actors depending on style */
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_TEXT ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
- {
- clutter_actor_show(CLUTTER_ACTOR(priv->actorLabel));
- }
- else clutter_actor_hide(CLUTTER_ACTOR(priv->actorLabel));
-
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_ICON ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
- {
- clutter_actor_show(CLUTTER_ACTOR(priv->actorIcon));
- }
- else clutter_actor_hide(CLUTTER_ACTOR(priv->actorIcon));
-
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_STYLE]);
- }
-}
-
-/* Get/set icon */
-const gchar* xfdashboard_button_get_icon_name(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- return(self->priv->iconName);
-}
-
-void xfdashboard_button_set_icon_name(XfdashboardButton *self, const gchar *inIconName)
-{
- XfdashboardButtonPrivate *priv;
- ClutterContent *image;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(inIconName);
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME ||
- g_strcmp0(priv->iconName, inIconName)!=0)
- {
- /* Set value */
- if(priv->iconName)
- {
- g_free(priv->iconName);
- priv->iconName=NULL;
- }
-
- if(priv->iconGIcon)
- {
- g_object_unref(priv->iconGIcon);
- priv->iconGIcon=NULL;
- }
-
- if(priv->iconImage)
- {
- g_object_unref(priv->iconImage);
- priv->iconImage=NULL;
- }
-
- priv->iconName=g_strdup(inIconName);
- priv->iconLoaded=FALSE;
-
- if(clutter_actor_is_mapped(CLUTTER_ACTOR(self)))
- {
- /* Actor is mapped so we cannot defer loading and setting image */
- image=xfdashboard_image_content_new_for_icon_name(priv->iconName, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
-
- priv->iconLoaded=TRUE;
- }
- else clutter_actor_set_content(priv->actorIcon, NULL);
-
- _xfdashboard_button_update_icon_image_size(self);
-
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME;
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_NAME]);
- }
-}
-
-GIcon* xfdashboard_button_get_gicon(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- return(self->priv->iconGIcon);
-}
-
-void xfdashboard_button_set_gicon(XfdashboardButton *self, GIcon *inIcon)
-{
- XfdashboardButtonPrivate *priv;
- ClutterContent *image;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(G_IS_ICON(inIcon));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON ||
- !g_icon_equal(priv->iconGIcon, inIcon))
- {
- /* Set value */
- if(priv->iconName)
- {
- g_free(priv->iconName);
- priv->iconName=NULL;
- }
-
- if(priv->iconGIcon)
- {
- g_object_unref(priv->iconGIcon);
- priv->iconGIcon=NULL;
- }
-
- if(priv->iconImage)
- {
- g_object_unref(priv->iconImage);
- priv->iconImage=NULL;
- }
-
- priv->iconGIcon=G_ICON(g_object_ref(inIcon));
- priv->iconLoaded=FALSE;
-
- if(clutter_actor_is_mapped(CLUTTER_ACTOR(self)))
- {
- /* Actor is mapped so we cannot defer loading and setting image */
- image=xfdashboard_image_content_new_for_gicon(priv->iconGIcon, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
-
- priv->iconLoaded=TRUE;
- }
- else clutter_actor_set_content(priv->actorIcon, NULL);
-
- _xfdashboard_button_update_icon_image_size(self);
-
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON;
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_GICON]);
- }
-}
-
-ClutterImage* xfdashboard_button_get_icon_image(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- return(self->priv->iconImage);
-}
-
-void xfdashboard_button_set_icon_image(XfdashboardButton *self, ClutterImage *inIconImage)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(CLUTTER_IS_IMAGE(inIconImage));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE ||
- inIconImage!=priv->iconImage)
- {
- /* Set value */
- if(priv->iconName)
- {
- g_free(priv->iconName);
- priv->iconName=NULL;
- }
-
- if(priv->iconGIcon)
- {
- g_object_unref(priv->iconGIcon);
- priv->iconGIcon=NULL;
- }
-
- if(priv->iconImage)
- {
- g_object_unref(priv->iconImage);
- priv->iconImage=NULL;
- }
-
- priv->iconImage=g_object_ref(inIconImage);
- priv->iconLoaded=TRUE;
- clutter_actor_set_content(priv->actorIcon, CLUTTER_CONTENT(priv->iconImage));
-
- _xfdashboard_button_update_icon_image_size(self);
-
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE;
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_IMAGE]);
- }
-}
-
-/* Get/set size of icon */
-gint xfdashboard_button_get_icon_size(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
-
- return(self->priv->iconSize);
-}
-
-void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(inSize==-1 || inSize>0);
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconSize!=inSize)
- {
- /* Set value */
- priv->iconSize=inSize;
-
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME)
- {
- ClutterContent *image;
-
- image=xfdashboard_image_content_new_for_icon_name(priv->iconName, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
- }
-
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON)
- {
- ClutterContent *image;
-
- image=xfdashboard_image_content_new_for_gicon(priv->iconGIcon, priv->iconSize);
- clutter_actor_set_content(priv->actorIcon, image);
- g_object_unref(image);
- }
-
- _xfdashboard_button_update_icon_image_size(self);
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_SIZE]);
- }
-}
-
-/* Get/set state if icon size will be synchronized */
-gboolean xfdashboard_button_get_sync_icon_size(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), FALSE);
-
- return(self->priv->iconSyncSize);
-}
-
-void xfdashboard_button_set_sync_icon_size(XfdashboardButton *self, gboolean inSync)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconSyncSize!=inSync)
- {
- /* Set value */
- priv->iconSyncSize=inSync;
-
- _xfdashboard_button_update_icon_image_size(self);
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]);
- }
-}
-
-/* Get/set orientation of icon to label */
-XfdashboardOrientation xfdashboard_button_get_icon_orientation(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), XFDASHBOARD_ORIENTATION_LEFT);
-
- return(self->priv->iconOrientation);
-}
-
-void xfdashboard_button_set_icon_orientation(XfdashboardButton *self, const XfdashboardOrientation inOrientation)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->iconOrientation!=inOrientation)
- {
- /* Set value */
- priv->iconOrientation=inOrientation;
-
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_ORIENTATION]);
- }
-}
-
-/* Get/set text of label */
-const gchar* xfdashboard_button_get_text(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- return(clutter_text_get_text(CLUTTER_TEXT(self->priv->actorLabel)));
-}
-
-void xfdashboard_button_set_text(XfdashboardButton *self, const gchar *inMarkupText)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(g_strcmp0(clutter_text_get_text(CLUTTER_TEXT(priv->actorLabel)), inMarkupText)!=0)
- {
- /* Set value */
- clutter_text_set_markup(CLUTTER_TEXT(priv->actorLabel), inMarkupText);
- clutter_actor_queue_relayout(CLUTTER_ACTOR(priv->actorLabel));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT]);
- }
-}
-
-/* Get/set font of label */
-const gchar* xfdashboard_button_get_font(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- if(self->priv->actorLabel) return(self->priv->font);
- return(NULL);
-}
-
-void xfdashboard_button_set_font(XfdashboardButton *self, const gchar *inFont)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(g_strcmp0(priv->font, inFont)!=0)
- {
- /* Set value */
- if(priv->font) g_free(priv->font);
- priv->font=(inFont ? g_strdup(inFont) : NULL);
-
- clutter_text_set_font_name(CLUTTER_TEXT(priv->actorLabel), priv->font);
- clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_FONT]);
- }
-}
-
-/* Get/set color of text in label */
-const ClutterColor* xfdashboard_button_get_color(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
-
- return(self->priv->labelColor);
-}
-
-void xfdashboard_button_set_color(XfdashboardButton *self, const ClutterColor *inColor)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
- g_return_if_fail(inColor);
-
- priv=self->priv;
-
- /* Set value if changed */
- if(!priv->labelColor || !clutter_color_equal(inColor, priv->labelColor))
- {
- /* Set value */
- if(priv->labelColor) clutter_color_free(priv->labelColor);
- priv->labelColor=clutter_color_copy(inColor);
-
- clutter_text_set_color(CLUTTER_TEXT(priv->actorLabel), priv->labelColor);
- clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_COLOR]);
- }
-}
-
-/* Get/set ellipsize mode if label's text is getting too long */
-PangoEllipsizeMode xfdashboard_button_get_ellipsize_mode(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
-
- return(self->priv->labelEllipsize);
-}
-
-void xfdashboard_button_set_ellipsize_mode(XfdashboardButton *self, const PangoEllipsizeMode inMode)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->labelEllipsize!=inMode)
- {
- /* Set value */
- priv->labelEllipsize=inMode;
-
- clutter_text_set_ellipsize(CLUTTER_TEXT(priv->actorLabel), priv->labelEllipsize);
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]);
- }
-}
-
-/* Get/set single line mode */
-gboolean xfdashboard_button_get_single_line_mode(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), FALSE);
-
- return(self->priv->isSingleLineMode);
-}
-
-void xfdashboard_button_set_single_line_mode(XfdashboardButton *self, const gboolean inSingleLineMode)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->isSingleLineMode!=inSingleLineMode)
- {
- /* Set value */
- priv->isSingleLineMode=inSingleLineMode;
-
- clutter_text_set_single_line_mode(CLUTTER_TEXT(priv->actorLabel), priv->isSingleLineMode);
- clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
- }
-}
-
-/* Get/set justification (line alignment) of label */
-PangoAlignment xfdashboard_button_get_text_justification(XfdashboardButton *self)
-{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), PANGO_ALIGN_LEFT);
-
- return(self->priv->textJustification);
-}
-
-void xfdashboard_button_set_text_justification(XfdashboardButton *self, const PangoAlignment inJustification)
-{
- XfdashboardButtonPrivate *priv;
-
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- priv=self->priv;
-
- /* Set value if changed */
- if(priv->textJustification!=inJustification)
- {
- /* Set value */
- priv->textJustification=inJustification;
-
- clutter_text_set_line_alignment(CLUTTER_TEXT(priv->actorLabel), priv->textJustification);
- clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
-
- /* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
- }
-}
diff --git a/libxfdashboard/button.h b/libxfdashboard/button.h
index 0436cf2..4aad533 100644
--- a/libxfdashboard/button.h
+++ b/libxfdashboard/button.h
@@ -1,6 +1,5 @@
/*
- * button: An actor representing a label and an icon (both optional)
- * and can react on click actions
+ * button: A label actor which can react on click actions
*
* Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
*
@@ -31,28 +30,10 @@
#include <clutter/clutter.h>
-#include <libxfdashboard/background.h>
-#include <libxfdashboard/types.h>
+#include <libxfdashboard/label.h>
G_BEGIN_DECLS
-/* Public definitions */
-/**
- * XfdashboardButtonStyle:
- * @XFDASHBOARD_BUTTON_STYLE_TEXT: The actor will show only text labels.
- * @XFDASHBOARD_BUTTON_STYLE_ICON: The actor will show only icons.
- * @XFDASHBOARD_BUTTON_STYLE_BOTH: The actor will show both, text labels and icons.
- *
- * Determines the style of an actor, e.g. text labels and icons at buttons.
- */
-typedef enum /*< prefix=XFDASHBOARD_BUTTON_STYLE >*/
-{
- XFDASHBOARD_BUTTON_STYLE_TEXT=0,
- XFDASHBOARD_BUTTON_STYLE_ICON,
- XFDASHBOARD_BUTTON_STYLE_BOTH
-} XfdashboardButtonStyle;
-
-
/* Object declaration */
#define XFDASHBOARD_TYPE_BUTTON (xfdashboard_button_get_type())
#define XFDASHBOARD_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_BUTTON, XfdashboardButton))
@@ -69,7 +50,7 @@ struct _XfdashboardButton
{
/*< private >*/
/* Parent instance */
- XfdashboardBackground parent_instance;
+ XfdashboardLabel parent_instance;
/* Private structure */
XfdashboardButtonPrivate *priv;
@@ -79,7 +60,7 @@ struct _XfdashboardButtonClass
{
/*< private >*/
/* Parent class */
- XfdashboardBackgroundClass parent_class;
+ XfdashboardLabelClass parent_class;
/*< public >*/
/* Virtual functions */
@@ -96,54 +77,6 @@ ClutterActor* xfdashboard_button_new_with_gicon(GIcon *inIcon);
ClutterActor* xfdashboard_button_new_full_with_icon_name(const gchar *inIconName, const gchar *inText);
ClutterActor* xfdashboard_button_new_full_with_gicon(GIcon *inIcon, const gchar *inText);
-/* General functions */
-gfloat xfdashboard_button_get_padding(XfdashboardButton *self);
-void xfdashboard_button_set_padding(XfdashboardButton *self, const gfloat inPadding);
-
-gfloat xfdashboard_button_get_spacing(XfdashboardButton *self);
-void xfdashboard_button_set_spacing(XfdashboardButton *self, const gfloat inSpacing);
-
-XfdashboardButtonStyle xfdashboard_button_get_style(XfdashboardButton *self);
-void xfdashboard_button_set_style(XfdashboardButton *self, const XfdashboardButtonStyle inStyle);
-
-/* Icon functions */
-const gchar* xfdashboard_button_get_icon_name(XfdashboardButton *self);
-void xfdashboard_button_set_icon_name(XfdashboardButton *self, const gchar *inIconName);
-
-GIcon* xfdashboard_button_get_gicon(XfdashboardButton *self);
-void xfdashboard_button_set_gicon(XfdashboardButton *self, GIcon *inIcon);
-
-ClutterImage* xfdashboard_button_get_icon_image(XfdashboardButton *self);
-void xfdashboard_button_set_icon_image(XfdashboardButton *self, ClutterImage *inIconImage);
-
-gint xfdashboard_button_get_icon_size(XfdashboardButton *self);
-void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize);
-
-gboolean xfdashboard_button_get_sync_icon_size(XfdashboardButton *self);
-void xfdashboard_button_set_sync_icon_size(XfdashboardButton *self, gboolean inSync);
-
-XfdashboardOrientation xfdashboard_button_get_icon_orientation(XfdashboardButton *self);
-void xfdashboard_button_set_icon_orientation(XfdashboardButton *self, const XfdashboardOrientation inOrientation);
-
-/* Label functions */
-const gchar* xfdashboard_button_get_text(XfdashboardButton *self);
-void xfdashboard_button_set_text(XfdashboardButton *self, const gchar *inMarkupText);
-
-const gchar* xfdashboard_button_get_font(XfdashboardButton *self);
-void xfdashboard_button_set_font(XfdashboardButton *self, const gchar *inFont);
-
-const ClutterColor* xfdashboard_button_get_color(XfdashboardButton *self);
-void xfdashboard_button_set_color(XfdashboardButton *self, const ClutterColor *inColor);
-
-PangoEllipsizeMode xfdashboard_button_get_ellipsize_mode(XfdashboardButton *self);
-void xfdashboard_button_set_ellipsize_mode(XfdashboardButton *self, const PangoEllipsizeMode inMode);
-
-gboolean xfdashboard_button_get_single_line_mode(XfdashboardButton *self);
-void xfdashboard_button_set_single_line_mode(XfdashboardButton *self, const gboolean inSingleLine);
-
-PangoAlignment xfdashboard_button_get_text_justification(XfdashboardButton *self);
-void xfdashboard_button_set_text_justification(XfdashboardButton *self, const PangoAlignment inJustification);
-
G_END_DECLS
#endif /* __LIBXFDASHBOARD_BUTTON__ */
diff --git a/libxfdashboard/button.c b/libxfdashboard/label.c
similarity index 73%
copy from libxfdashboard/button.c
copy to libxfdashboard/label.c
index 7e868d7..244ac9e 100644
--- a/libxfdashboard/button.c
+++ b/libxfdashboard/label.c
@@ -1,6 +1,5 @@
/*
- * button: An actor representing a label and an icon (both optional)
- * and can react on click actions
+ * label: An actor representing a label and an icon (both optional)
*
* Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
*
@@ -26,42 +25,41 @@
#include "config.h"
#endif
-#include <libxfdashboard/button.h>
+#include <libxfdashboard/label.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <math.h>
#include <libxfdashboard/enums.h>
-#include <libxfdashboard/click-action.h>
#include <libxfdashboard/image-content.h>
#include <libxfdashboard/compat.h>
/* Forward declarations */
-typedef enum /*< skip,prefix=XFDASHBOARD_BUTTON_ICON_TYPE >*/
+typedef enum /*< skip,prefix=XFDASHBOARD_LABEL_ICON_TYPE >*/
{
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NONE,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE,
- XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON
-} XfdashboardButtonIconType;
+ XFDASHBOARD_LABEL_ICON_TYPE_ICON_NONE,
+ XFDASHBOARD_LABEL_ICON_TYPE_ICON_NAME,
+ XFDASHBOARD_LABEL_ICON_TYPE_ICON_IMAGE,
+ XFDASHBOARD_LABEL_ICON_TYPE_ICON_GICON
+} XfdashboardLabelIconType;
/* Define this class in GObject system */
-G_DEFINE_TYPE(XfdashboardButton,
- xfdashboard_button,
+G_DEFINE_TYPE(XfdashboardLabel,
+ xfdashboard_label,
XFDASHBOARD_TYPE_BACKGROUND)
/* Private structure - access only by public API if needed */
-#define XFDASHBOARD_BUTTON_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), XFDASHBOARD_TYPE_BUTTON, XfdashboardButtonPrivate))
+#define XFDASHBOARD_LABEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), XFDASHBOARD_TYPE_LABEL, XfdashboardLabelPrivate))
-struct _XfdashboardButtonPrivate
+struct _XfdashboardLabelPrivate
{
/* Properties related */
gfloat padding;
gfloat spacing;
- XfdashboardButtonStyle style;
+ XfdashboardLabelStyle style;
gchar *iconName;
ClutterImage *iconImage;
@@ -79,10 +77,9 @@ struct _XfdashboardButtonPrivate
/* Instance related */
ClutterActor *actorIcon;
ClutterActor *actorLabel;
- ClutterAction *clickAction;
gboolean iconLoaded;
- XfdashboardButtonIconType iconType;
+ XfdashboardLabelIconType iconType;
};
/* Properties */
@@ -111,17 +108,8 @@ enum
PROP_LAST
};
-static GParamSpec* XfdashboardButtonProperties[PROP_LAST]={ 0, };
+static GParamSpec* XfdashboardLabelProperties[PROP_LAST]={ 0, };
-/* Signals */
-enum
-{
- SIGNAL_CLICKED,
-
- SIGNAL_LAST
-};
-
-static guint XfdashboardButtonSignals[SIGNAL_LAST]={ 0, };
/* IMPLEMENTATION: Private variables and methods */
@@ -130,18 +118,18 @@ static guint XfdashboardButtonSignals[SIGNAL_LAST]={ 0, };
* reduced by padding on all affected sides. The returned sizes are also
* without these paddings.
*/
-static void _xfdashboard_button_get_preferred_width_intern(XfdashboardButton *self,
+static void _xfdashboard_label_get_preferred_width_intern(XfdashboardLabel *self,
gboolean inGetPreferred,
gfloat inForHeight,
gfloat *outIconSize,
gfloat *outLabelSize)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
gfloat iconWidth, iconHeight, iconScale;
gfloat iconSize, labelSize;
gfloat minSize, naturalSize;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -362,18 +350,18 @@ static void _xfdashboard_button_get_preferred_width_intern(XfdashboardButton *se
* reduced by paddings and spacing. The returned sizes are alsowithout
* these paddings and spacing.
*/
-static void _xfdashboard_button_get_preferred_height_intern(XfdashboardButton *self,
+static void _xfdashboard_label_get_preferred_height_intern(XfdashboardLabel *self,
gboolean inGetPreferred,
gfloat inForWidth,
gfloat *outIconSize,
gfloat *outLabelSize)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
gfloat iconWidth, iconHeight, iconScale;
gfloat iconSize, labelSize;
gfloat minSize, naturalSize;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -588,13 +576,13 @@ static void _xfdashboard_button_get_preferred_height_intern(XfdashboardButton *s
}
/* Update icon */
-static void _xfdashboard_button_update_icon_image_size(XfdashboardButton *self)
+static void _xfdashboard_label_update_icon_image_size(XfdashboardLabel *self)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
gfloat iconWidth, iconHeight;
gfloat maxSize;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
iconWidth=iconHeight=-1.0f;
@@ -653,13 +641,13 @@ static void _xfdashboard_button_update_icon_image_size(XfdashboardButton *self)
}
/* Actor was mapped or unmapped */
-static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
+static void _xfdashboard_label_on_mapped_changed(XfdashboardLabel *self,
GParamSpec *inSpec,
gpointer inUserData)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -669,7 +657,7 @@ static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
if(clutter_actor_is_mapped(CLUTTER_ACTOR(self)) &&
priv->iconLoaded==FALSE)
{
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME)
+ if(priv->iconType==XFDASHBOARD_LABEL_ICON_TYPE_ICON_NAME)
{
ClutterContent *image;
@@ -681,12 +669,12 @@ static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
priv->iconLoaded=TRUE;
/* Calculate icon size as image content is now available */
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
g_debug("Loaded and set deferred image '%s' at size %d for %s@%p ", priv->iconName, priv->iconSize, G_OBJECT_TYPE_NAME(self), self);
}
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON)
+ if(priv->iconType==XFDASHBOARD_LABEL_ICON_TYPE_ICON_GICON)
{
ClutterContent *image;
@@ -698,7 +686,7 @@ static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
priv->iconLoaded=TRUE;
/* Calculate icon size as image content is now available */
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
g_debug("Loaded and set deferred image '%s' at size %d for %s@%p ", priv->iconName, priv->iconSize, G_OBJECT_TYPE_NAME(self), self);
}
@@ -708,19 +696,19 @@ static void _xfdashboard_button_on_mapped_changed(XfdashboardButton *self,
/* IMPLEMENTATION: ClutterActor */
/* Show all children of this actor */
-static void _xfdashboard_button_show_all(ClutterActor *self)
+static void _xfdashboard_label_show_all(ClutterActor *self)
{
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
+ XfdashboardLabelPrivate *priv=XFDASHBOARD_LABEL(self)->priv;
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_ICON ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
+ if(priv->style==XFDASHBOARD_LABEL_STYLE_ICON ||
+ priv->style==XFDASHBOARD_LABEL_STYLE_BOTH)
{
clutter_actor_show(CLUTTER_ACTOR(priv->actorIcon));
}
else clutter_actor_hide(CLUTTER_ACTOR(priv->actorIcon));
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_TEXT ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
+ if(priv->style==XFDASHBOARD_LABEL_STYLE_TEXT ||
+ priv->style==XFDASHBOARD_LABEL_STYLE_BOTH)
{
clutter_actor_show(CLUTTER_ACTOR(priv->actorLabel));
}
@@ -730,9 +718,9 @@ static void _xfdashboard_button_show_all(ClutterActor *self)
}
/* Hide all children of this actor */
-static void _xfdashboard_button_hide_all(ClutterActor *self)
+static void _xfdashboard_label_hide_all(ClutterActor *self)
{
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
+ XfdashboardLabelPrivate *priv=XFDASHBOARD_LABEL(self)->priv;
clutter_actor_hide(self);
clutter_actor_hide(CLUTTER_ACTOR(priv->actorIcon));
@@ -740,13 +728,13 @@ static void _xfdashboard_button_hide_all(ClutterActor *self)
}
/* Get preferred width/height */
-static void _xfdashboard_button_get_preferred_height(ClutterActor *inActor,
+static void _xfdashboard_label_get_preferred_height(ClutterActor *inActor,
gfloat inForWidth,
gfloat *outMinHeight,
gfloat *outNaturalHeight)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inActor);
+ XfdashboardLabelPrivate *priv=self->priv;
gfloat minHeight, naturalHeight;
gfloat minIconHeight, naturalIconHeight;
gfloat minLabelHeight, naturalLabelHeight;
@@ -758,7 +746,7 @@ static void _xfdashboard_button_get_preferred_height(ClutterActor *inActor,
/* Calculate sizes for requested one (means which can and will be stored) */
if(outMinHeight)
{
- _xfdashboard_button_get_preferred_height_intern(self,
+ _xfdashboard_label_get_preferred_height_intern(self,
FALSE,
inForWidth,
&minIconHeight,
@@ -767,7 +755,7 @@ static void _xfdashboard_button_get_preferred_height(ClutterActor *inActor,
if(outNaturalHeight)
{
- _xfdashboard_button_get_preferred_height_intern(self,
+ _xfdashboard_label_get_preferred_height_intern(self,
TRUE,
inForWidth,
&naturalIconHeight,
@@ -814,13 +802,13 @@ static void _xfdashboard_button_get_preferred_height(ClutterActor *inActor,
if(outNaturalHeight) *outNaturalHeight=naturalHeight;
}
-static void _xfdashboard_button_get_preferred_width(ClutterActor *inActor,
+static void _xfdashboard_label_get_preferred_width(ClutterActor *inActor,
gfloat inForHeight,
gfloat *outMinWidth,
gfloat *outNaturalWidth)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inActor);
+ XfdashboardLabelPrivate *priv=self->priv;
gfloat minWidth, naturalWidth;
gfloat minIconWidth, naturalIconWidth;
gfloat minLabelWidth, naturalLabelWidth;
@@ -832,7 +820,7 @@ static void _xfdashboard_button_get_preferred_width(ClutterActor *inActor,
/* Calculate sizes for requested one (means which can and will be stored) */
if(outMinWidth)
{
- _xfdashboard_button_get_preferred_width_intern(self,
+ _xfdashboard_label_get_preferred_width_intern(self,
FALSE,
inForHeight,
&minIconWidth,
@@ -841,7 +829,7 @@ static void _xfdashboard_button_get_preferred_width(ClutterActor *inActor,
if(outNaturalWidth)
{
- _xfdashboard_button_get_preferred_width_intern(self,
+ _xfdashboard_label_get_preferred_width_intern(self,
TRUE,
inForHeight,
&naturalIconWidth,
@@ -889,12 +877,12 @@ static void _xfdashboard_button_get_preferred_width(ClutterActor *inActor,
}
/* Allocate position and size of actor and its children */
-static void _xfdashboard_button_allocate(ClutterActor *inActor,
+static void _xfdashboard_label_allocate(ClutterActor *inActor,
const ClutterActorBox *inBox,
ClutterAllocationFlags inFlags)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inActor);
- XfdashboardButtonPrivate *priv=self->priv;
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inActor);
+ XfdashboardLabelPrivate *priv=self->priv;
ClutterActorBox *boxLabel=NULL;
ClutterActorBox *boxIcon=NULL;
gfloat left, right, top, bottom;
@@ -903,7 +891,7 @@ static void _xfdashboard_button_allocate(ClutterActor *inActor,
gfloat spacing=priv->spacing;
/* Chain up to store the allocation of the actor */
- CLUTTER_ACTOR_CLASS(xfdashboard_button_parent_class)->allocate(inActor, inBox, inFlags);
+ CLUTTER_ACTOR_CLASS(xfdashboard_label_parent_class)->allocate(inActor, inBox, inFlags);
/* Get sizes of children and determine if we need
* to add spacing between text and icon. If either
@@ -932,7 +920,7 @@ static void _xfdashboard_button_allocate(ClutterActor *inActor,
if(clutter_actor_get_request_mode(CLUTTER_ACTOR(self))==CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
{
- _xfdashboard_button_get_preferred_height_intern(self,
+ _xfdashboard_label_get_preferred_height_intern(self,
TRUE,
clutter_actor_box_get_width(inBox),
&iconHeight,
@@ -942,7 +930,7 @@ static void _xfdashboard_button_allocate(ClutterActor *inActor,
}
else
{
- _xfdashboard_button_get_preferred_width_intern(self,
+ _xfdashboard_label_get_preferred_width_intern(self,
TRUE,
clutter_actor_box_get_height(inBox),
&iconWidth,
@@ -1066,27 +1054,11 @@ static void _xfdashboard_button_allocate(ClutterActor *inActor,
if(boxIcon) clutter_actor_box_free(boxIcon);
}
-/* proxy ClickAction signals */
-static void _xfdashboard_button_clicked(XfdashboardClickAction *inAction,
- ClutterActor *self,
- gpointer inUserData)
-{
- g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(inAction));
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
-
- /* Only emit signal if click was perform with left button */
- if(xfdashboard_click_action_get_button(inAction)==XFDASHBOARD_CLICK_ACTION_LEFT_BUTTON)
- {
- /* Emit 'clicked' signal */
- g_signal_emit(self, XfdashboardButtonSignals[SIGNAL_CLICKED], 0);
- }
-}
-
/* Destroy this actor */
-static void _xfdashboard_button_destroy(ClutterActor *self)
+static void _xfdashboard_label_destroy(ClutterActor *self)
{
/* Destroy each child actor when this actor is destroyed */
- XfdashboardButtonPrivate *priv=XFDASHBOARD_BUTTON(self)->priv;
+ XfdashboardLabelPrivate *priv=XFDASHBOARD_LABEL(self)->priv;
if(priv->actorIcon)
{
@@ -1101,17 +1073,17 @@ static void _xfdashboard_button_destroy(ClutterActor *self)
}
/* Call parent's class destroy method */
- CLUTTER_ACTOR_CLASS(xfdashboard_button_parent_class)->destroy(self);
+ CLUTTER_ACTOR_CLASS(xfdashboard_label_parent_class)->destroy(self);
}
/* IMPLEMENTATION: GObject */
/* Dispose this object */
-static void _xfdashboard_button_dispose(GObject *inObject)
+static void _xfdashboard_label_dispose(GObject *inObject)
{
/* Release our allocated variables */
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
- XfdashboardButtonPrivate *priv=self->priv;
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inObject);
+ XfdashboardLabelPrivate *priv=self->priv;
if(priv->iconName)
{
@@ -1138,77 +1110,77 @@ static void _xfdashboard_button_dispose(GObject *inObject)
}
/* Call parent's class dispose method */
- G_OBJECT_CLASS(xfdashboard_button_parent_class)->dispose(inObject);
+ G_OBJECT_CLASS(xfdashboard_label_parent_class)->dispose(inObject);
}
/* Set/get properties */
-static void _xfdashboard_button_set_property(GObject *inObject,
+static void _xfdashboard_label_set_property(GObject *inObject,
guint inPropID,
const GValue *inValue,
GParamSpec *inSpec)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inObject);
switch(inPropID)
{
case PROP_PADDING:
- xfdashboard_button_set_padding(self, g_value_get_float(inValue));
+ xfdashboard_label_set_padding(self, g_value_get_float(inValue));
break;
case PROP_SPACING:
- xfdashboard_button_set_spacing(self, g_value_get_float(inValue));
+ xfdashboard_label_set_spacing(self, g_value_get_float(inValue));
break;
case PROP_STYLE:
- xfdashboard_button_set_style(self, g_value_get_enum(inValue));
+ xfdashboard_label_set_style(self, g_value_get_enum(inValue));
break;
case PROP_ICON_NAME:
- xfdashboard_button_set_icon_name(self, g_value_get_string(inValue));
+ xfdashboard_label_set_icon_name(self, g_value_get_string(inValue));
break;
case PROP_ICON_GICON:
- xfdashboard_button_set_gicon(self, G_ICON(g_value_get_object(inValue)));
+ xfdashboard_label_set_gicon(self, G_ICON(g_value_get_object(inValue)));
break;
case PROP_ICON_IMAGE:
- xfdashboard_button_set_icon_image(self, g_value_get_object(inValue));
+ xfdashboard_label_set_icon_image(self, g_value_get_object(inValue));
break;
case PROP_ICON_SYNC_SIZE:
- xfdashboard_button_set_sync_icon_size(self, g_value_get_boolean(inValue));
+ xfdashboard_label_set_sync_icon_size(self, g_value_get_boolean(inValue));
break;
case PROP_ICON_SIZE:
- xfdashboard_button_set_icon_size(self, g_value_get_uint(inValue));
+ xfdashboard_label_set_icon_size(self, g_value_get_uint(inValue));
break;
case PROP_ICON_ORIENTATION:
- xfdashboard_button_set_icon_orientation(self, g_value_get_enum(inValue));
+ xfdashboard_label_set_icon_orientation(self, g_value_get_enum(inValue));
break;
case PROP_TEXT:
- xfdashboard_button_set_text(self, g_value_get_string(inValue));
+ xfdashboard_label_set_text(self, g_value_get_string(inValue));
break;
case PROP_TEXT_FONT:
- xfdashboard_button_set_font(self, g_value_get_string(inValue));
+ xfdashboard_label_set_font(self, g_value_get_string(inValue));
break;
case PROP_TEXT_COLOR:
- xfdashboard_button_set_color(self, clutter_value_get_color(inValue));
+ xfdashboard_label_set_color(self, clutter_value_get_color(inValue));
break;
case PROP_TEXT_ELLIPSIZE_MODE:
- xfdashboard_button_set_ellipsize_mode(self, g_value_get_enum(inValue));
+ xfdashboard_label_set_ellipsize_mode(self, g_value_get_enum(inValue));
break;
case PROP_TEXT_SINGLE_LINE:
- xfdashboard_button_set_single_line_mode(self, g_value_get_boolean(inValue));
+ xfdashboard_label_set_single_line_mode(self, g_value_get_boolean(inValue));
break;
case PROP_TEXT_JUSTIFY:
- xfdashboard_button_set_text_justification(self, g_value_get_enum(inValue));
+ xfdashboard_label_set_text_justification(self, g_value_get_enum(inValue));
break;
default:
@@ -1217,13 +1189,13 @@ static void _xfdashboard_button_set_property(GObject *inObject,
}
}
-static void _xfdashboard_button_get_property(GObject *inObject,
+static void _xfdashboard_label_get_property(GObject *inObject,
guint inPropID,
GValue *outValue,
GParamSpec *inSpec)
{
- XfdashboardButton *self=XFDASHBOARD_BUTTON(inObject);
- XfdashboardButtonPrivate *priv=self->priv;
+ XfdashboardLabel *self=XFDASHBOARD_LABEL(inObject);
+ XfdashboardLabelPrivate *priv=self->priv;
switch(inPropID)
{
@@ -1297,29 +1269,29 @@ static void _xfdashboard_button_get_property(GObject *inObject,
* Override functions in parent classes and define properties
* and signals
*/
-static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
+static void xfdashboard_label_class_init(XfdashboardLabelClass *klass)
{
XfdashboardActorClass *actorClass=XFDASHBOARD_ACTOR_CLASS(klass);
ClutterActorClass *clutterActorClass=CLUTTER_ACTOR_CLASS(klass);
GObjectClass *gobjectClass=G_OBJECT_CLASS(klass);
/* Override functions */
- gobjectClass->dispose=_xfdashboard_button_dispose;
- gobjectClass->set_property=_xfdashboard_button_set_property;
- gobjectClass->get_property=_xfdashboard_button_get_property;
+ gobjectClass->dispose=_xfdashboard_label_dispose;
+ gobjectClass->set_property=_xfdashboard_label_set_property;
+ gobjectClass->get_property=_xfdashboard_label_get_property;
- clutterActorClass->show_all=_xfdashboard_button_show_all;
- clutterActorClass->hide_all=_xfdashboard_button_hide_all;
- clutterActorClass->get_preferred_width=_xfdashboard_button_get_preferred_width;
- clutterActorClass->get_preferred_height=_xfdashboard_button_get_preferred_height;
- clutterActorClass->allocate=_xfdashboard_button_allocate;
- clutterActorClass->destroy=_xfdashboard_button_destroy;
+ clutterActorClass->show_all=_xfdashboard_label_show_all;
+ clutterActorClass->hide_all=_xfdashboard_label_hide_all;
+ clutterActorClass->get_preferred_width=_xfdashboard_label_get_preferred_width;
+ clutterActorClass->get_preferred_height=_xfdashboard_label_get_preferred_height;
+ clutterActorClass->allocate=_xfdashboard_label_allocate;
+ clutterActorClass->destroy=_xfdashboard_label_destroy;
/* Set up private structure */
- g_type_class_add_private(klass, sizeof(XfdashboardButtonPrivate));
+ g_type_class_add_private(klass, sizeof(XfdashboardLabelPrivate));
/* Define properties */
- XfdashboardButtonProperties[PROP_PADDING]=
+ XfdashboardLabelProperties[PROP_PADDING]=
g_param_spec_float("padding",
_("Padding"),
_("Padding between background and elements"),
@@ -1327,7 +1299,7 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
4.0f,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
- XfdashboardButtonProperties[PROP_SPACING]=
+ XfdashboardLabelProperties[PROP_SPACING]=
g_param_spec_float("spacing",
_("Spacing"),
_("Spacing between text and icon"),
@@ -1335,43 +1307,43 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
4.0f,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
- XfdashboardButtonProperties[PROP_STYLE]=
- g_param_spec_enum("button-style",
- _("Button style"),
+ XfdashboardLabelProperties[PROP_STYLE]=
+ g_param_spec_enum("label-style",
+ _("Label style"),
_("Style of button showing text and/or icon"),
- XFDASHBOARD_TYPE_BUTTON_STYLE,
- XFDASHBOARD_BUTTON_STYLE_TEXT,
+ XFDASHBOARD_TYPE_LABEL_STYLE,
+ XFDASHBOARD_LABEL_STYLE_TEXT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
- XfdashboardButtonProperties[PROP_ICON_NAME]=
+ XfdashboardLabelProperties[PROP_ICON_NAME]=
g_param_spec_string("icon-name",
_("Icon name"),
_("Themed icon name or file name of icon"),
N_(""),
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_ICON_GICON]=
+ XfdashboardLabelProperties[PROP_ICON_GICON]=
g_param_spec_object("icon-gicon",
_("Icon GIcon"),
_("The GIcon of icon"),
G_TYPE_ICON,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_ICON_IMAGE]=
+ XfdashboardLabelProperties[PROP_ICON_IMAGE]=
g_param_spec_object("icon-image",
_("Icon image"),
_("Image of icon"),
CLUTTER_TYPE_IMAGE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]=
+ XfdashboardLabelProperties[PROP_ICON_SYNC_SIZE]=
g_param_spec_boolean("sync-icon-size",
_("Synchronize icon size"),
_("Synchronize icon size with text size"),
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_ICON_SIZE]=
+ XfdashboardLabelProperties[PROP_ICON_SIZE]=
g_param_spec_uint("icon-size",
_("Icon size"),
_("Size of icon if size of icon is not synchronized. -1 is valid for icon images and sets icon image's default size."),
@@ -1379,7 +1351,7 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
16,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_ICON_ORIENTATION]=
+ XfdashboardLabelProperties[PROP_ICON_ORIENTATION]=
g_param_spec_enum("icon-orientation",
_("Icon orientation"),
_("Orientation of icon to label"),
@@ -1387,28 +1359,28 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
XFDASHBOARD_ORIENTATION_LEFT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
- XfdashboardButtonProperties[PROP_TEXT]=
+ XfdashboardLabelProperties[PROP_TEXT]=
g_param_spec_string("text",
_("Label text"),
_("Text of label"),
N_(""),
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_TEXT_FONT]=
+ XfdashboardLabelProperties[PROP_TEXT_FONT]=
g_param_spec_string("font",
_("Font"),
_("Font of label"),
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_TEXT_COLOR]=
+ XfdashboardLabelProperties[PROP_TEXT_COLOR]=
clutter_param_spec_color("color",
_("Color"),
_("Color of label"),
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]=
+ XfdashboardLabelProperties[PROP_TEXT_ELLIPSIZE_MODE]=
g_param_spec_enum("ellipsize-mode",
_("Ellipsize mode"),
_("Mode of ellipsize if text in label is too long"),
@@ -1416,14 +1388,14 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
PANGO_ELLIPSIZE_MIDDLE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
- XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]=
+ XfdashboardLabelProperties[PROP_TEXT_SINGLE_LINE]=
g_param_spec_boolean("single-line",
_("Single line"),
_("Flag to determine if text can only be in one or multiple lines"),
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- XfdashboardButtonProperties[PROP_TEXT_JUSTIFY]=
+ XfdashboardLabelProperties[PROP_TEXT_JUSTIFY]=
g_param_spec_enum("text-justify",
_("Text justify"),
_("Justification (line alignment) of label"),
@@ -1431,45 +1403,33 @@ static void xfdashboard_button_class_init(XfdashboardButtonClass *klass)
PANGO_ALIGN_LEFT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties(gobjectClass, PROP_LAST, XfdashboardButtonProperties);
+ g_object_class_install_properties(gobjectClass, PROP_LAST, XfdashboardLabelProperties);
/* Define stylable properties */
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_PADDING]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_SPACING]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_STYLE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_NAME]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_IMAGE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_SIZE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_ICON_ORIENTATION]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_FONT]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_COLOR]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
- xfdashboard_actor_install_stylable_property(actorClass, XfdashboardButtonProperties[PROP_TEXT_JUSTIFY]);
-
- /* Define signals */
- XfdashboardButtonSignals[SIGNAL_CLICKED]=
- g_signal_new("clicked",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(XfdashboardButtonClass, clicked),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_PADDING]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_SPACING]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_STYLE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_ICON_NAME]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_ICON_IMAGE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_ICON_SYNC_SIZE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_ICON_SIZE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_ICON_ORIENTATION]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT_FONT]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT_COLOR]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT_ELLIPSIZE_MODE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT_SINGLE_LINE]);
+ xfdashboard_actor_install_stylable_property(actorClass, XfdashboardLabelProperties[PROP_TEXT_JUSTIFY]);
}
/* Object initialization
* Create private structure and set up default values
*/
-static void xfdashboard_button_init(XfdashboardButton *self)
+static void xfdashboard_label_init(XfdashboardLabel *self)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- priv=self->priv=XFDASHBOARD_BUTTON_GET_PRIVATE(self);
+ priv=self->priv=XFDASHBOARD_LABEL_GET_PRIVATE(self);
/* This actor reacts on events */
clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE);
@@ -1487,7 +1447,7 @@ static void xfdashboard_button_init(XfdashboardButton *self)
priv->labelColor=NULL;
priv->labelEllipsize=-1;
priv->isSingleLineMode=TRUE;
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NONE;
+ priv->iconType=XFDASHBOARD_LABEL_ICON_TYPE_ICON_NONE;
/* Create actors */
priv->actorIcon=clutter_actor_new();
@@ -1502,79 +1462,75 @@ static void xfdashboard_button_init(XfdashboardButton *self)
clutter_text_set_single_line_mode(CLUTTER_TEXT(priv->actorLabel), priv->isSingleLineMode);
/* Connect signals */
- g_signal_connect(self, "notify::mapped", G_CALLBACK(_xfdashboard_button_on_mapped_changed), NULL);
-
- priv->clickAction=xfdashboard_click_action_new();
- clutter_actor_add_action(CLUTTER_ACTOR(self), priv->clickAction);
- g_signal_connect(priv->clickAction, "clicked", G_CALLBACK(_xfdashboard_button_clicked), NULL);
+ g_signal_connect(self, "notify::mapped", G_CALLBACK(_xfdashboard_label_on_mapped_changed), NULL);
}
/* IMPLEMENTATION: Public API */
/* Create new actor */
-ClutterActor* xfdashboard_button_new(void)
+ClutterActor* xfdashboard_label_new(void)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"text", N_(""),
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
NULL));
}
-ClutterActor* xfdashboard_button_new_with_text(const gchar *inText)
+ClutterActor* xfdashboard_label_new_with_text(const gchar *inText)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"text", inText,
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
NULL));
}
-ClutterActor* xfdashboard_button_new_with_icon_name(const gchar *inIconName)
+ClutterActor* xfdashboard_label_new_with_icon_name(const gchar *inIconName)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
NULL));
}
-ClutterActor* xfdashboard_button_new_with_gicon(GIcon *inIcon)
+ClutterActor* xfdashboard_label_new_with_gicon(GIcon *inIcon)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"icon-gicon", inIcon,
- "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
NULL));
}
-ClutterActor* xfdashboard_button_new_full_with_icon_name(const gchar *inIconName, const gchar *inText)
+ClutterActor* xfdashboard_label_new_full_with_icon_name(const gchar *inIconName, const gchar *inText)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"text", inText,
"icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
NULL));
}
-ClutterActor* xfdashboard_button_new_full_with_gicon(GIcon *inIcon, const gchar *inText)
+ClutterActor* xfdashboard_label_new_full_with_gicon(GIcon *inIcon, const gchar *inText)
{
- return(g_object_new(XFDASHBOARD_TYPE_BUTTON,
+ return(g_object_new(XFDASHBOARD_TYPE_LABEL,
"text", inText,
"icon-gicon", inIcon,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
NULL));
}
/* Get/set padding of background to text and icon actors */
-gfloat xfdashboard_button_get_padding(XfdashboardButton *self)
+gfloat xfdashboard_label_get_padding(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), 0);
return(self->priv->padding);
}
-void xfdashboard_button_set_padding(XfdashboardButton *self, const gfloat inPadding)
+void xfdashboard_label_set_padding(XfdashboardLabel *self, const gfloat inPadding)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(inPadding>=0.0f);
priv=self->priv;
@@ -1590,23 +1546,23 @@ void xfdashboard_button_set_padding(XfdashboardButton *self, const gfloat inPadd
xfdashboard_background_set_corner_radius(XFDASHBOARD_BACKGROUND(self), priv->padding);
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_PADDING]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_PADDING]);
}
}
/* Get/set spacing between text and icon actors */
-gfloat xfdashboard_button_get_spacing(XfdashboardButton *self)
+gfloat xfdashboard_label_get_spacing(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), 0);
return(self->priv->spacing);
}
-void xfdashboard_button_set_spacing(XfdashboardButton *self, const gfloat inSpacing)
+void xfdashboard_label_set_spacing(XfdashboardLabel *self, const gfloat inSpacing)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(inSpacing>=0.0f);
priv=self->priv;
@@ -1619,23 +1575,23 @@ void xfdashboard_button_set_spacing(XfdashboardButton *self, const gfloat inSpac
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_SPACING]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_SPACING]);
}
}
/* Get/set style of button */
-XfdashboardButtonStyle xfdashboard_button_get_style(XfdashboardButton *self)
+XfdashboardLabelStyle xfdashboard_label_get_style(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), XFDASHBOARD_BUTTON_STYLE_TEXT);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), XFDASHBOARD_LABEL_STYLE_TEXT);
return(self->priv->style);
}
-void xfdashboard_button_set_style(XfdashboardButton *self, const XfdashboardButtonStyle inStyle)
+void xfdashboard_label_set_style(XfdashboardLabel *self, const XfdashboardLabelStyle inStyle)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -1646,15 +1602,15 @@ void xfdashboard_button_set_style(XfdashboardButton *self, const XfdashboardButt
priv->style=inStyle;
/* Show actors depending on style */
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_TEXT ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
+ if(priv->style==XFDASHBOARD_LABEL_STYLE_TEXT ||
+ priv->style==XFDASHBOARD_LABEL_STYLE_BOTH)
{
clutter_actor_show(CLUTTER_ACTOR(priv->actorLabel));
}
else clutter_actor_hide(CLUTTER_ACTOR(priv->actorLabel));
- if(priv->style==XFDASHBOARD_BUTTON_STYLE_ICON ||
- priv->style==XFDASHBOARD_BUTTON_STYLE_BOTH)
+ if(priv->style==XFDASHBOARD_LABEL_STYLE_ICON ||
+ priv->style==XFDASHBOARD_LABEL_STYLE_BOTH)
{
clutter_actor_show(CLUTTER_ACTOR(priv->actorIcon));
}
@@ -1663,30 +1619,30 @@ void xfdashboard_button_set_style(XfdashboardButton *self, const XfdashboardButt
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_STYLE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_STYLE]);
}
}
/* Get/set icon */
-const gchar* xfdashboard_button_get_icon_name(XfdashboardButton *self)
+const gchar* xfdashboard_label_get_icon_name(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
return(self->priv->iconName);
}
-void xfdashboard_button_set_icon_name(XfdashboardButton *self, const gchar *inIconName)
+void xfdashboard_label_set_icon_name(XfdashboardLabel *self, const gchar *inIconName)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
ClutterContent *image;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(inIconName);
priv=self->priv;
/* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME ||
+ if(priv->iconType!=XFDASHBOARD_LABEL_ICON_TYPE_ICON_NAME ||
g_strcmp0(priv->iconName, inIconName)!=0)
{
/* Set value */
@@ -1722,34 +1678,34 @@ void xfdashboard_button_set_icon_name(XfdashboardButton *self, const gchar *inIc
}
else clutter_actor_set_content(priv->actorIcon, NULL);
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME;
+ priv->iconType=XFDASHBOARD_LABEL_ICON_TYPE_ICON_NAME;
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_NAME]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_NAME]);
}
}
-GIcon* xfdashboard_button_get_gicon(XfdashboardButton *self)
+GIcon* xfdashboard_label_get_gicon(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
return(self->priv->iconGIcon);
}
-void xfdashboard_button_set_gicon(XfdashboardButton *self, GIcon *inIcon)
+void xfdashboard_label_set_gicon(XfdashboardLabel *self, GIcon *inIcon)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
ClutterContent *image;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(G_IS_ICON(inIcon));
priv=self->priv;
/* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON ||
+ if(priv->iconType!=XFDASHBOARD_LABEL_ICON_TYPE_ICON_GICON ||
!g_icon_equal(priv->iconGIcon, inIcon))
{
/* Set value */
@@ -1785,33 +1741,33 @@ void xfdashboard_button_set_gicon(XfdashboardButton *self, GIcon *inIcon)
}
else clutter_actor_set_content(priv->actorIcon, NULL);
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON;
+ priv->iconType=XFDASHBOARD_LABEL_ICON_TYPE_ICON_GICON;
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_GICON]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_GICON]);
}
}
-ClutterImage* xfdashboard_button_get_icon_image(XfdashboardButton *self)
+ClutterImage* xfdashboard_label_get_icon_image(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
return(self->priv->iconImage);
}
-void xfdashboard_button_set_icon_image(XfdashboardButton *self, ClutterImage *inIconImage)
+void xfdashboard_label_set_icon_image(XfdashboardLabel *self, ClutterImage *inIconImage)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(CLUTTER_IS_IMAGE(inIconImage));
priv=self->priv;
/* Set value if changed */
- if(priv->iconType!=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE ||
+ if(priv->iconType!=XFDASHBOARD_LABEL_ICON_TYPE_ICON_IMAGE ||
inIconImage!=priv->iconImage)
{
/* Set value */
@@ -1837,28 +1793,28 @@ void xfdashboard_button_set_icon_image(XfdashboardButton *self, ClutterImage *in
priv->iconLoaded=TRUE;
clutter_actor_set_content(priv->actorIcon, CLUTTER_CONTENT(priv->iconImage));
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
- priv->iconType=XFDASHBOARD_BUTTON_ICON_TYPE_ICON_IMAGE;
+ priv->iconType=XFDASHBOARD_LABEL_ICON_TYPE_ICON_IMAGE;
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_IMAGE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_IMAGE]);
}
}
/* Get/set size of icon */
-gint xfdashboard_button_get_icon_size(XfdashboardButton *self)
+gint xfdashboard_label_get_icon_size(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), 0);
return(self->priv->iconSize);
}
-void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize)
+void xfdashboard_label_set_icon_size(XfdashboardLabel *self, gint inSize)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(inSize==-1 || inSize>0);
priv=self->priv;
@@ -1869,7 +1825,7 @@ void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize)
/* Set value */
priv->iconSize=inSize;
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_NAME)
+ if(priv->iconType==XFDASHBOARD_LABEL_ICON_TYPE_ICON_NAME)
{
ClutterContent *image;
@@ -1878,7 +1834,7 @@ void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize)
g_object_unref(image);
}
- if(priv->iconType==XFDASHBOARD_BUTTON_ICON_TYPE_ICON_GICON)
+ if(priv->iconType==XFDASHBOARD_LABEL_ICON_TYPE_ICON_GICON)
{
ClutterContent *image;
@@ -1887,26 +1843,26 @@ void xfdashboard_button_set_icon_size(XfdashboardButton *self, gint inSize)
g_object_unref(image);
}
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_SIZE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_SIZE]);
}
}
/* Get/set state if icon size will be synchronized */
-gboolean xfdashboard_button_get_sync_icon_size(XfdashboardButton *self)
+gboolean xfdashboard_label_get_sync_icon_size(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), FALSE);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), FALSE);
return(self->priv->iconSyncSize);
}
-void xfdashboard_button_set_sync_icon_size(XfdashboardButton *self, gboolean inSync)
+void xfdashboard_label_set_sync_icon_size(XfdashboardLabel *self, gboolean inSync)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -1916,26 +1872,26 @@ void xfdashboard_button_set_sync_icon_size(XfdashboardButton *self, gboolean inS
/* Set value */
priv->iconSyncSize=inSync;
- _xfdashboard_button_update_icon_image_size(self);
+ _xfdashboard_label_update_icon_image_size(self);
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_SYNC_SIZE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_SYNC_SIZE]);
}
}
/* Get/set orientation of icon to label */
-XfdashboardOrientation xfdashboard_button_get_icon_orientation(XfdashboardButton *self)
+XfdashboardOrientation xfdashboard_label_get_icon_orientation(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), XFDASHBOARD_ORIENTATION_LEFT);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), XFDASHBOARD_ORIENTATION_LEFT);
return(self->priv->iconOrientation);
}
-void xfdashboard_button_set_icon_orientation(XfdashboardButton *self, const XfdashboardOrientation inOrientation)
+void xfdashboard_label_set_icon_orientation(XfdashboardLabel *self, const XfdashboardOrientation inOrientation)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -1948,23 +1904,23 @@ void xfdashboard_button_set_icon_orientation(XfdashboardButton *self, const Xfda
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_ICON_ORIENTATION]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_ICON_ORIENTATION]);
}
}
/* Get/set text of label */
-const gchar* xfdashboard_button_get_text(XfdashboardButton *self)
+const gchar* xfdashboard_label_get_text(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
return(clutter_text_get_text(CLUTTER_TEXT(self->priv->actorLabel)));
}
-void xfdashboard_button_set_text(XfdashboardButton *self, const gchar *inMarkupText)
+void xfdashboard_label_set_text(XfdashboardLabel *self, const gchar *inMarkupText)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -1976,24 +1932,24 @@ void xfdashboard_button_set_text(XfdashboardButton *self, const gchar *inMarkupT
clutter_actor_queue_relayout(CLUTTER_ACTOR(priv->actorLabel));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT]);
}
}
/* Get/set font of label */
-const gchar* xfdashboard_button_get_font(XfdashboardButton *self)
+const gchar* xfdashboard_label_get_font(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
if(self->priv->actorLabel) return(self->priv->font);
return(NULL);
}
-void xfdashboard_button_set_font(XfdashboardButton *self, const gchar *inFont)
+void xfdashboard_label_set_font(XfdashboardLabel *self, const gchar *inFont)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -2008,23 +1964,23 @@ void xfdashboard_button_set_font(XfdashboardButton *self, const gchar *inFont)
clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_FONT]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT_FONT]);
}
}
/* Get/set color of text in label */
-const ClutterColor* xfdashboard_button_get_color(XfdashboardButton *self)
+const ClutterColor* xfdashboard_label_get_color(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), NULL);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), NULL);
return(self->priv->labelColor);
}
-void xfdashboard_button_set_color(XfdashboardButton *self, const ClutterColor *inColor)
+void xfdashboard_label_set_color(XfdashboardLabel *self, const ClutterColor *inColor)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
g_return_if_fail(inColor);
priv=self->priv;
@@ -2040,23 +1996,23 @@ void xfdashboard_button_set_color(XfdashboardButton *self, const ClutterColor *i
clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_COLOR]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT_COLOR]);
}
}
/* Get/set ellipsize mode if label's text is getting too long */
-PangoEllipsizeMode xfdashboard_button_get_ellipsize_mode(XfdashboardButton *self)
+PangoEllipsizeMode xfdashboard_label_get_ellipsize_mode(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), 0);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), 0);
return(self->priv->labelEllipsize);
}
-void xfdashboard_button_set_ellipsize_mode(XfdashboardButton *self, const PangoEllipsizeMode inMode)
+void xfdashboard_label_set_ellipsize_mode(XfdashboardLabel *self, const PangoEllipsizeMode inMode)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -2070,23 +2026,23 @@ void xfdashboard_button_set_ellipsize_mode(XfdashboardButton *self, const PangoE
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_ELLIPSIZE_MODE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT_ELLIPSIZE_MODE]);
}
}
/* Get/set single line mode */
-gboolean xfdashboard_button_get_single_line_mode(XfdashboardButton *self)
+gboolean xfdashboard_label_get_single_line_mode(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), FALSE);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), FALSE);
return(self->priv->isSingleLineMode);
}
-void xfdashboard_button_set_single_line_mode(XfdashboardButton *self, const gboolean inSingleLineMode)
+void xfdashboard_label_set_single_line_mode(XfdashboardLabel *self, const gboolean inSingleLineMode)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -2100,23 +2056,23 @@ void xfdashboard_button_set_single_line_mode(XfdashboardButton *self, const gboo
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT_SINGLE_LINE]);
}
}
/* Get/set justification (line alignment) of label */
-PangoAlignment xfdashboard_button_get_text_justification(XfdashboardButton *self)
+PangoAlignment xfdashboard_label_get_text_justification(XfdashboardLabel *self)
{
- g_return_val_if_fail(XFDASHBOARD_IS_BUTTON(self), PANGO_ALIGN_LEFT);
+ g_return_val_if_fail(XFDASHBOARD_IS_LABEL(self), PANGO_ALIGN_LEFT);
return(self->priv->textJustification);
}
-void xfdashboard_button_set_text_justification(XfdashboardButton *self, const PangoAlignment inJustification)
+void xfdashboard_label_set_text_justification(XfdashboardLabel *self, const PangoAlignment inJustification)
{
- XfdashboardButtonPrivate *priv;
+ XfdashboardLabelPrivate *priv;
- g_return_if_fail(XFDASHBOARD_IS_BUTTON(self));
+ g_return_if_fail(XFDASHBOARD_IS_LABEL(self));
priv=self->priv;
@@ -2130,6 +2086,6 @@ void xfdashboard_button_set_text_justification(XfdashboardButton *self, const Pa
clutter_actor_queue_redraw(CLUTTER_ACTOR(self));
/* Notify about property change */
- g_object_notify_by_pspec(G_OBJECT(self), XfdashboardButtonProperties[PROP_TEXT_SINGLE_LINE]);
+ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardLabelProperties[PROP_TEXT_SINGLE_LINE]);
}
}
diff --git a/libxfdashboard/label.h b/libxfdashboard/label.h
new file mode 100644
index 0000000..3478b66
--- /dev/null
+++ b/libxfdashboard/label.h
@@ -0,0 +1,148 @@
+/*
+ * label: An actor representing a label and an icon (both optional)
+ *
+ * Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ *
+ */
+
+#ifndef __LIBXFDASHBOARD_LABEL__
+#define __LIBXFDASHBOARD_LABEL__
+
+#if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION)
+#error "Only <libxfdashboard/libxfdashboard.h> can be included directly."
+#endif
+
+#include <clutter/clutter.h>
+
+#include <libxfdashboard/background.h>
+#include <libxfdashboard/types.h>
+
+G_BEGIN_DECLS
+
+/* Public definitions */
+/**
+ * XfdashboardLabelStyle:
+ * @XFDASHBOARD_LABEL_STYLE_TEXT: The actor will show only text labels.
+ * @XFDASHBOARD_LABEL_STYLE_ICON: The actor will show only icons.
+ * @XFDASHBOARD_LABEL_STYLE_BOTH: The actor will show both, text labels and icons.
+ *
+ * Determines the style of an actor, e.g. text labels and icons at labels.
+ */
+typedef enum /*< prefix=XFDASHBOARD_LABEL_STYLE >*/
+{
+ XFDASHBOARD_LABEL_STYLE_TEXT=0,
+ XFDASHBOARD_LABEL_STYLE_ICON,
+ XFDASHBOARD_LABEL_STYLE_BOTH
+} XfdashboardLabelStyle;
+
+
+/* Object declaration */
+#define XFDASHBOARD_TYPE_LABEL (xfdashboard_label_get_type())
+#define XFDASHBOARD_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_LABEL, XfdashboardLabel))
+#define XFDASHBOARD_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_LABEL))
+#define XFDASHBOARD_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_LABEL, XfdashboardLabelClass))
+#define XFDASHBOARD_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_LABEL))
+#define XFDASHBOARD_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_LABEL, XfdashboardLabelClass))
+
+typedef struct _XfdashboardLabel XfdashboardLabel;
+typedef struct _XfdashboardLabelClass XfdashboardLabelClass;
+typedef struct _XfdashboardLabelPrivate XfdashboardLabelPrivate;
+
+struct _XfdashboardLabel
+{
+ /*< private >*/
+ /* Parent instance */
+ XfdashboardBackground parent_instance;
+
+ /* Private structure */
+ XfdashboardLabelPrivate *priv;
+};
+
+struct _XfdashboardLabelClass
+{
+ /*< private >*/
+ /* Parent class */
+ XfdashboardBackgroundClass parent_class;
+
+ /*< public >*/
+ /* Virtual functions */
+ void (*clicked)(XfdashboardLabel *self);
+};
+
+/* Public API */
+GType xfdashboard_label_get_type(void) G_GNUC_CONST;
+
+ClutterActor* xfdashboard_label_new(void);
+ClutterActor* xfdashboard_label_new_with_text(const gchar *inText);
+ClutterActor* xfdashboard_label_new_with_icon_name(const gchar *inIconName);
+ClutterActor* xfdashboard_label_new_with_gicon(GIcon *inIcon);
+ClutterActor* xfdashboard_label_new_full_with_icon_name(const gchar *inIconName, const gchar *inText);
+ClutterActor* xfdashboard_label_new_full_with_gicon(GIcon *inIcon, const gchar *inText);
+
+/* General functions */
+gfloat xfdashboard_label_get_padding(XfdashboardLabel *self);
+void xfdashboard_label_set_padding(XfdashboardLabel *self, const gfloat inPadding);
+
+gfloat xfdashboard_label_get_spacing(XfdashboardLabel *self);
+void xfdashboard_label_set_spacing(XfdashboardLabel *self, const gfloat inSpacing);
+
+XfdashboardLabelStyle xfdashboard_label_get_style(XfdashboardLabel *self);
+void xfdashboard_label_set_style(XfdashboardLabel *self, const XfdashboardLabelStyle inStyle);
+
+/* Icon functions */
+const gchar* xfdashboard_label_get_icon_name(XfdashboardLabel *self);
+void xfdashboard_label_set_icon_name(XfdashboardLabel *self, const gchar *inIconName);
+
+GIcon* xfdashboard_label_get_gicon(XfdashboardLabel *self);
+void xfdashboard_label_set_gicon(XfdashboardLabel *self, GIcon *inIcon);
+
+ClutterImage* xfdashboard_label_get_icon_image(XfdashboardLabel *self);
+void xfdashboard_label_set_icon_image(XfdashboardLabel *self, ClutterImage *inIconImage);
+
+gint xfdashboard_label_get_icon_size(XfdashboardLabel *self);
+void xfdashboard_label_set_icon_size(XfdashboardLabel *self, gint inSize);
+
+gboolean xfdashboard_label_get_sync_icon_size(XfdashboardLabel *self);
+void xfdashboard_label_set_sync_icon_size(XfdashboardLabel *self, gboolean inSync);
+
+XfdashboardOrientation xfdashboard_label_get_icon_orientation(XfdashboardLabel *self);
+void xfdashboard_label_set_icon_orientation(XfdashboardLabel *self, const XfdashboardOrientation inOrientation);
+
+/* Label functions */
+const gchar* xfdashboard_label_get_text(XfdashboardLabel *self);
+void xfdashboard_label_set_text(XfdashboardLabel *self, const gchar *inMarkupText);
+
+const gchar* xfdashboard_label_get_font(XfdashboardLabel *self);
+void xfdashboard_label_set_font(XfdashboardLabel *self, const gchar *inFont);
+
+const ClutterColor* xfdashboard_label_get_color(XfdashboardLabel *self);
+void xfdashboard_label_set_color(XfdashboardLabel *self, const ClutterColor *inColor);
+
+PangoEllipsizeMode xfdashboard_label_get_ellipsize_mode(XfdashboardLabel *self);
+void xfdashboard_label_set_ellipsize_mode(XfdashboardLabel *self, const PangoEllipsizeMode inMode);
+
+gboolean xfdashboard_label_get_single_line_mode(XfdashboardLabel *self);
+void xfdashboard_label_set_single_line_mode(XfdashboardLabel *self, const gboolean inSingleLine);
+
+PangoAlignment xfdashboard_label_get_text_justification(XfdashboardLabel *self);
+void xfdashboard_label_set_text_justification(XfdashboardLabel *self, const PangoAlignment inJustification);
+
+G_END_DECLS
+
+#endif /* __LIBXFDASHBOARD_LABEL__ */
diff --git a/libxfdashboard/live-window.c b/libxfdashboard/live-window.c
index d20536d..593ca46 100644
--- a/libxfdashboard/live-window.c
+++ b/libxfdashboard/live-window.c
@@ -229,7 +229,7 @@ static void _xfdashboard_live_window_on_icon_changed(XfdashboardLiveWindow *self
/* Set new icon in title actor */
icon=xfdashboard_image_content_new_for_pixbuf(xfdashboard_window_tracker_window_get_icon(inWindow));
- xfdashboard_button_set_icon_image(XFDASHBOARD_BUTTON(priv->actorTitle), CLUTTER_IMAGE(icon));
+ xfdashboard_label_set_icon_image(XFDASHBOARD_LABEL(priv->actorTitle), CLUTTER_IMAGE(icon));
g_object_unref(icon);
}
@@ -251,7 +251,7 @@ static void _xfdashboard_live_window_on_name_changed(XfdashboardLiveWindow *self
/* Set new name in title actor */
windowName=g_markup_printf_escaped("%s", xfdashboard_window_tracker_window_get_title(inWindow));
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->actorTitle), windowName);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->actorTitle), windowName);
g_free(windowName);
}
@@ -366,7 +366,7 @@ static void _xfdashboard_live_window_set_window_number(XfdashboardLiveWindow *se
/* Update text in window number */
numberText=g_markup_printf_escaped("%u", priv->windowNumber % 10);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->actorWindowNumber), numberText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->actorWindowNumber), numberText);
g_free(numberText);
/* Show window number and hide close button */
diff --git a/libxfdashboard/live-workspace.c b/libxfdashboard/live-workspace.c
index 4495212..9a36769 100644
--- a/libxfdashboard/live-workspace.c
+++ b/libxfdashboard/live-workspace.c
@@ -416,7 +416,7 @@ static void _xfdashboard_live_workspace_on_workspace_name_changed(XfdashboardLiv
/* Set new name in title actor */
workspaceName=g_markup_printf_escaped("%s", xfdashboard_window_tracker_workspace_get_name(inWorkspace));
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->actorTitle), workspaceName);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->actorTitle), workspaceName);
g_free(workspaceName);
}
diff --git a/libxfdashboard/popup-menu.c b/libxfdashboard/popup-menu.c
index 1cd27e5..7bbb4b9 100644
--- a/libxfdashboard/popup-menu.c
+++ b/libxfdashboard/popup-menu.c
@@ -296,8 +296,8 @@ static void _xfdashboard_popup_menu_on_meta_activated(XfdashboardPopupMenu *self
static void _xfdashboard_popup_menu_update_title_actors_visibility(XfdashboardPopupMenu *self)
{
XfdashboardPopupMenuPrivate *priv;
- XfdashboardButtonStyle oldStyle;
- XfdashboardButtonStyle newStyle;
+ XfdashboardLabelStyle oldStyle;
+ XfdashboardLabelStyle newStyle;
gboolean oldVisible;
gboolean newVisible;
@@ -307,22 +307,22 @@ static void _xfdashboard_popup_menu_update_title_actors_visibility(XfdashboardPo
/* Get current visibility state */
oldVisible=clutter_actor_is_visible(priv->title);
- oldStyle=xfdashboard_button_get_style(XFDASHBOARD_BUTTON(priv->title));
+ oldStyle=xfdashboard_label_get_style(XFDASHBOARD_LABEL(priv->title));
/* Determine new visibility state depending on if title and/or icon of title
* should be shown or not.
*/
newStyle=0;
newVisible=TRUE;
- if(priv->showTitle && priv->showTitleIcon) newStyle=XFDASHBOARD_BUTTON_STYLE_BOTH;
- else if(priv->showTitle) newStyle=XFDASHBOARD_BUTTON_STYLE_TEXT;
- else if(priv->showTitleIcon) newStyle=XFDASHBOARD_BUTTON_STYLE_ICON;
+ if(priv->showTitle && priv->showTitleIcon) newStyle=XFDASHBOARD_LABEL_STYLE_BOTH;
+ else if(priv->showTitle) newStyle=XFDASHBOARD_LABEL_STYLE_TEXT;
+ else if(priv->showTitleIcon) newStyle=XFDASHBOARD_LABEL_STYLE_ICON;
else newVisible=FALSE;
/* Set new visibility style if changed and re-layout title actor */
if(newStyle!=oldStyle)
{
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(priv->title), newStyle);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(priv->title), newStyle);
clutter_actor_queue_relayout(priv->title);
}
@@ -1131,8 +1131,8 @@ static void xfdashboard_popup_menu_init(XfdashboardPopupMenu *self)
/* Set up title actor */
priv->title=xfdashboard_button_new();
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(priv->title), XFDASHBOARD_BUTTON_STYLE_TEXT);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->title), NULL);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(priv->title), XFDASHBOARD_LABEL_STYLE_TEXT);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->title), NULL);
clutter_actor_set_x_expand(priv->title, TRUE);
clutter_actor_set_y_expand(priv->title, TRUE);
clutter_actor_hide(priv->title);
@@ -1388,7 +1388,7 @@ const gchar* xfdashboard_popup_menu_get_title(XfdashboardPopupMenu *self)
{
g_return_val_if_fail(XFDASHBOARD_IS_POPUP_MENU(self), NULL);
- return(xfdashboard_button_get_text(XFDASHBOARD_BUTTON(self->priv->title)));
+ return(xfdashboard_label_get_text(XFDASHBOARD_LABEL(self->priv->title)));
}
/**
@@ -1409,10 +1409,10 @@ void xfdashboard_popup_menu_set_title(XfdashboardPopupMenu *self, const gchar *i
priv=self->priv;
/* Set value if changed */
- if(g_strcmp0(xfdashboard_button_get_text(XFDASHBOARD_BUTTON(priv->title)), inMarkupTitle)!=0)
+ if(g_strcmp0(xfdashboard_label_get_text(XFDASHBOARD_LABEL(priv->title)), inMarkupTitle)!=0)
{
/* Set value */
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->title), inMarkupTitle);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->title), inMarkupTitle);
/* Notify about property change */
g_object_notify_by_pspec(G_OBJECT(self), XfdashboardPopupMenuProperties[PROP_TITLE]);
@@ -1478,7 +1478,7 @@ const gchar* xfdashboard_popup_menu_get_title_icon_name(XfdashboardPopupMenu *se
{
g_return_val_if_fail(XFDASHBOARD_IS_POPUP_MENU(self), NULL);
- return(xfdashboard_button_get_icon_name(XFDASHBOARD_BUTTON(self->priv->title)));
+ return(xfdashboard_label_get_icon_name(XFDASHBOARD_LABEL(self->priv->title)));
}
/**
@@ -1500,10 +1500,10 @@ void xfdashboard_popup_menu_set_title_icon_name(XfdashboardPopupMenu *self, cons
priv=self->priv;
/* Set value if changed */
- if(g_strcmp0(xfdashboard_button_get_icon_name(XFDASHBOARD_BUTTON(priv->title)), inIconName)!=0)
+ if(g_strcmp0(xfdashboard_label_get_icon_name(XFDASHBOARD_LABEL(priv->title)), inIconName)!=0)
{
/* Set value */
- xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(priv->title), inIconName);
+ xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(priv->title), inIconName);
/* Notify about property change */
g_object_notify_by_pspec(G_OBJECT(self), XfdashboardPopupMenuProperties[PROP_TITLE_ICON_NAME]);
@@ -1522,7 +1522,7 @@ GIcon* xfdashboard_popup_menu_get_title_gicon(XfdashboardPopupMenu *self)
{
g_return_val_if_fail(XFDASHBOARD_IS_POPUP_MENU(self), NULL);
- return(xfdashboard_button_get_gicon(XFDASHBOARD_BUTTON(self->priv->title)));
+ return(xfdashboard_label_get_gicon(XFDASHBOARD_LABEL(self->priv->title)));
}
/**
@@ -1544,12 +1544,12 @@ void xfdashboard_popup_menu_set_title_gicon(XfdashboardPopupMenu *self, GIcon *i
priv=self->priv;
/* Set value if changed */
- icon=xfdashboard_button_get_gicon(XFDASHBOARD_BUTTON(priv->title));
+ icon=xfdashboard_label_get_gicon(XFDASHBOARD_LABEL(priv->title));
if(icon!=inIcon ||
(icon && inIcon && !g_icon_equal(icon, inIcon)))
{
/* Set value */
- xfdashboard_button_set_gicon(XFDASHBOARD_BUTTON(priv->title), inIcon);
+ xfdashboard_label_set_gicon(XFDASHBOARD_LABEL(priv->title), inIcon);
/* Notify about property change */
g_object_notify_by_pspec(G_OBJECT(self), XfdashboardPopupMenuProperties[PROP_TITLE_GICON]);
diff --git a/libxfdashboard/quicklaunch.c b/libxfdashboard/quicklaunch.c
index 0763181..6cb9d4d 100644
--- a/libxfdashboard/quicklaunch.c
+++ b/libxfdashboard/quicklaunch.c
@@ -757,7 +757,7 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
/* Create menu item for window */
menuItem=xfdashboard_button_new();
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(menuItem), xfdashboard_window_tracker_window_get_title(window));
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), xfdashboard_window_tracker_window_get_title(window));
clutter_actor_set_x_expand(menuItem, TRUE);
xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup),
menuItem,
@@ -778,7 +778,7 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
{
menuItem=xfdashboard_button_new();
clutter_actor_set_x_expand(menuItem, TRUE);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(menuItem), _("Launch"));
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), _("Launch"));
xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup),
menuItem,
_xfdashboard_quicklaunch_on_favourite_popup_menu_item_launch,
@@ -792,7 +792,7 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
{
menuItem=xfdashboard_button_new();
clutter_actor_set_x_expand(menuItem, TRUE);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(menuItem), _("Remove from favourites"));
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), _("Remove from favourites"));
xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup),
menuItem,
_xfdashboard_quicklaunch_on_favourite_popup_menu_item_remove_from_favourite,
@@ -804,7 +804,7 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
{
menuItem=xfdashboard_button_new();
clutter_actor_set_x_expand(menuItem, TRUE);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(menuItem), _("Add to favourites"));
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), _("Add to favourites"));
xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup),
menuItem,
_xfdashboard_quicklaunch_on_favourite_popup_menu_item_add_to_favourite,
@@ -850,9 +850,9 @@ static void _xfdashboard_quicklaunch_on_favourite_drag_begin(ClutterDragAction *
dragHandle=xfdashboard_application_button_new_from_app_info(appInfo);
clutter_actor_set_position(dragHandle, inStageX, inStageY);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(dragHandle), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(dragHandle), FALSE);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(dragHandle), XFDASHBOARD_BUTTON_STYLE_ICON);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(dragHandle), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(dragHandle), FALSE);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(dragHandle), XFDASHBOARD_LABEL_STYLE_ICON);
clutter_actor_add_child(CLUTTER_ACTOR(stage), dragHandle);
clutter_drag_action_set_drag_handle(inAction, dragHandle);
@@ -951,9 +951,9 @@ static gboolean _xfdashboard_quicklaunch_on_drop_begin(XfdashboardQuicklaunch *s
appInfo=xfdashboard_application_button_get_app_info(XFDASHBOARD_APPLICATION_BUTTON(draggedActor));
priv->dragPreviewIcon=xfdashboard_application_button_new_from_app_info(appInfo);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(priv->dragPreviewIcon), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(priv->dragPreviewIcon), FALSE);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(priv->dragPreviewIcon), XFDASHBOARD_BUTTON_STYLE_ICON);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(priv->dragPreviewIcon), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(priv->dragPreviewIcon), FALSE);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(priv->dragPreviewIcon), XFDASHBOARD_LABEL_STYLE_ICON);
if(priv->dragMode==DRAG_MODE_CREATE) clutter_actor_hide(priv->dragPreviewIcon);
clutter_actor_add_child(CLUTTER_ACTOR(self), priv->dragPreviewIcon);
@@ -1445,9 +1445,9 @@ static ClutterActor* _xfdashboard_quicklaunch_create_dynamic_actor(XfdashboardQu
/* Create and set up actor */
actor=xfdashboard_application_button_new_from_app_info(inAppInfo);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(actor), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(actor), FALSE);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(actor), XFDASHBOARD_BUTTON_STYLE_ICON);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(actor), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(actor), FALSE);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(actor), XFDASHBOARD_LABEL_STYLE_ICON);
xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(actor), "dynamic-app");
/* Set up and add click action */
@@ -1482,9 +1482,9 @@ static ClutterActor* _xfdashboard_quicklaunch_create_favourite_actor(Xfdashboard
/* Create and set up actor */
actor=xfdashboard_application_button_new_from_app_info(inAppInfo);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(actor), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(actor), FALSE);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(actor), XFDASHBOARD_BUTTON_STYLE_ICON);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(actor), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(actor), FALSE);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(actor), XFDASHBOARD_LABEL_STYLE_ICON);
xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(actor), "favourite-app");
/* Set up and add click action */
@@ -3285,16 +3285,16 @@ static void xfdashboard_quicklaunch_init(XfdashboardQuicklaunch *self)
/* Add "applications" button */
priv->appsButton=xfdashboard_toggle_button_new_with_text(_("Applications"));
clutter_actor_set_name(priv->appsButton, "applications-button");
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(priv->appsButton), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(priv->appsButton), FALSE);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(priv->appsButton), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(priv->appsButton), FALSE);
clutter_actor_add_child(CLUTTER_ACTOR(self), priv->appsButton);
/* Next add trash button to box but initially hidden and register as drop target */
priv->trashButton=xfdashboard_toggle_button_new_with_text( _("Remove"));
clutter_actor_set_name(priv->trashButton, "trash-button");
clutter_actor_hide(priv->trashButton);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(priv->trashButton), priv->normalIconSize);
- xfdashboard_button_set_sync_icon_size(XFDASHBOARD_BUTTON(priv->trashButton), FALSE);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(priv->trashButton), priv->normalIconSize);
+ xfdashboard_label_set_sync_icon_size(XFDASHBOARD_LABEL(priv->trashButton), FALSE);
clutter_actor_add_child(CLUTTER_ACTOR(self), priv->trashButton);
dropAction=xfdashboard_drop_action_new();
@@ -3377,8 +3377,8 @@ void xfdashboard_quicklaunch_set_normal_icon_size(XfdashboardQuicklaunch *self,
priv->normalIconSize=inIconSize;
clutter_actor_queue_relayout(CLUTTER_ACTOR(self));
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(priv->appsButton), priv->normalIconSize);
- xfdashboard_button_set_icon_size(XFDASHBOARD_BUTTON(priv->trashButton), priv->normalIconSize);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(priv->appsButton), priv->normalIconSize);
+ xfdashboard_label_set_icon_size(XFDASHBOARD_LABEL(priv->trashButton), priv->normalIconSize);
/* Notify about property change */
g_object_notify_by_pspec(G_OBJECT(self), XfdashboardQuicklaunchProperties[PROP_NORMAL_ICON_SIZE]);
diff --git a/libxfdashboard/search-result-container.c b/libxfdashboard/search-result-container.c
index 884e0fe..4d48c45 100644
--- a/libxfdashboard/search-result-container.c
+++ b/libxfdashboard/search-result-container.c
@@ -665,7 +665,7 @@ static void _xfdashboard_search_result_container_update_result_items(Xfdashboard
labelText=g_strdup_printf(_("Show %d more results..."), moreCount);
/* Set text at "more"-label */
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->moreResultsLabelActor), labelText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->moreResultsLabelActor), labelText);
/* Release allocated resources */
if(labelText) g_free(labelText);
@@ -673,7 +673,7 @@ static void _xfdashboard_search_result_container_update_result_items(Xfdashboard
else
{
/* Set empty text at "more"-label */
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->moreResultsLabelActor), NULL);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->moreResultsLabelActor), NULL);
}
/* If we have more result items in result set than result items actors shown
@@ -687,7 +687,7 @@ static void _xfdashboard_search_result_container_update_result_items(Xfdashboard
labelText=g_strdup_printf(_("Show all %d results..."), allItemsCount);
/* Set text at "all"-label */
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->allResultsLabelActor), labelText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->allResultsLabelActor), labelText);
/* Release allocated resources */
if(labelText) g_free(labelText);
@@ -695,7 +695,7 @@ static void _xfdashboard_search_result_container_update_result_items(Xfdashboard
else
{
/* Set empty text at "all"-label */
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->allResultsLabelActor), NULL);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->allResultsLabelActor), NULL);
}
}
@@ -1391,13 +1391,13 @@ static void xfdashboard_search_result_container_init(XfdashboardSearchResultCont
priv->moreResultsLabelActor=xfdashboard_button_new();
clutter_actor_set_x_expand(priv->moreResultsLabelActor, TRUE);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(priv->moreResultsLabelActor), XFDASHBOARD_BUTTON_STYLE_TEXT);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(priv->moreResultsLabelActor), XFDASHBOARD_LABEL_STYLE_TEXT);
xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(priv->moreResultsLabelActor), "more-results");
priv->allResultsLabelActor=xfdashboard_button_new();
clutter_actor_set_x_expand(priv->allResultsLabelActor, TRUE);
clutter_actor_set_x_align(priv->allResultsLabelActor, CLUTTER_ACTOR_ALIGN_END);
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(priv->allResultsLabelActor), XFDASHBOARD_BUTTON_STYLE_TEXT);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(priv->allResultsLabelActor), XFDASHBOARD_LABEL_STYLE_TEXT);
xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(priv->allResultsLabelActor), "all-results");
layout=clutter_box_layout_new();
@@ -1734,7 +1734,7 @@ void xfdashboard_search_result_container_set_more_result_size(XfdashboardSearchR
moreCount=MIN(allResultsCount-currentResultsCount, priv->moreResultsCount);
labelText=g_strdup_printf(_("Show %d more results..."), moreCount);
- xfdashboard_button_set_text(XFDASHBOARD_BUTTON(priv->moreResultsLabelActor), labelText);
+ xfdashboard_label_set_text(XFDASHBOARD_LABEL(priv->moreResultsLabelActor), labelText);
if(labelText) g_free(labelText);
/* Notify about property change */
diff --git a/libxfdashboard/text-box.c b/libxfdashboard/text-box.c
index 231d37e..75b4677 100644
--- a/libxfdashboard/text-box.c
+++ b/libxfdashboard/text-box.c
@@ -1574,7 +1574,7 @@ void xfdashboard_text_box_set_primary_icon(XfdashboardTextBox *self, const gchar
{
/* Load and set new icon */
priv->primaryIconName=g_strdup(inIconName);
- xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(priv->actorPrimaryIcon), priv->primaryIconName);
+ xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(priv->actorPrimaryIcon), priv->primaryIconName);
/* Show icon */
priv->showPrimaryIcon=TRUE;
@@ -1625,7 +1625,7 @@ void xfdashboard_text_box_set_secondary_icon(XfdashboardTextBox *self, const gch
{
/* Load and set new icon */
priv->secondaryIconName=g_strdup(inIconName);
- xfdashboard_button_set_icon_name(XFDASHBOARD_BUTTON(priv->actorSecondaryIcon), priv->secondaryIconName);
+ xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(priv->actorSecondaryIcon), priv->secondaryIconName);
/* Show icon */
priv->showSecondaryIcon=TRUE;
diff --git a/libxfdashboard/toggle-button.c b/libxfdashboard/toggle-button.c
index 8e595e6..8d12b4c 100644
--- a/libxfdashboard/toggle-button.c
+++ b/libxfdashboard/toggle-button.c
@@ -263,7 +263,7 @@ ClutterActor* xfdashboard_toggle_button_new(void)
{
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"text", N_(""),
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
NULL));
}
@@ -279,7 +279,7 @@ ClutterActor* xfdashboard_toggle_button_new_with_text(const gchar *inText)
{
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"text", inText,
- "button-style", XFDASHBOARD_BUTTON_STYLE_TEXT,
+ "label-style", XFDASHBOARD_LABEL_STYLE_TEXT,
NULL));
}
@@ -296,7 +296,7 @@ ClutterActor* xfdashboard_toggle_button_new_with_icon_name(const gchar *inIconNa
{
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_ICON,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
NULL));
}
@@ -312,7 +312,7 @@ 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,
+ "label-style", XFDASHBOARD_LABEL_STYLE_ICON,
NULL));
}
@@ -332,7 +332,7 @@ ClutterActor* xfdashboard_toggle_button_new_full_with_icon_name(const gchar *inI
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"text", inText,
"icon-name", inIconName,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
NULL));
}
@@ -351,7 +351,7 @@ ClutterActor* xfdashboard_toggle_button_new_full_with_gicon(GIcon *inIcon,
return(g_object_new(XFDASHBOARD_TYPE_TOGGLE_BUTTON,
"text", inText,
"icon-gicon", inIcon,
- "button-style", XFDASHBOARD_BUTTON_STYLE_BOTH,
+ "label-style", XFDASHBOARD_LABEL_STYLE_BOTH,
NULL));
}
diff --git a/libxfdashboard/view-selector.c b/libxfdashboard/view-selector.c
index 9580103..5f05bdf 100644
--- a/libxfdashboard/view-selector.c
+++ b/libxfdashboard/view-selector.c
@@ -172,7 +172,7 @@ static void _xfdashboard_view_selector_on_view_icon_changed(XfdashboardView *inV
g_return_if_fail(XFDASHBOARD_IS_TOGGLE_BUTTON(inUserData));
button=XFDASHBOARD_BUTTON(inUserData);
- xfdashboard_button_set_icon_name(button, xfdashboard_view_get_icon(inView));
+ xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(button), xfdashboard_view_get_icon(inView));
}
/* Called when the name of a view has changed */
diff --git a/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c
index ef3b98b..f2be453 100644
--- a/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c
+++ b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c
@@ -809,13 +809,13 @@ static ClutterActor* _xfdashboard_gnome_shell_search_provider_create_result_acto
if(icon)
{
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(actor), XFDASHBOARD_BUTTON_STYLE_BOTH);
- xfdashboard_button_set_gicon(XFDASHBOARD_BUTTON(actor), icon);
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(actor), XFDASHBOARD_LABEL_STYLE_BOTH);
+ xfdashboard_label_set_gicon(XFDASHBOARD_LABEL(actor), icon);
}
else if(iconImage)
{
- xfdashboard_button_set_style(XFDASHBOARD_BUTTON(actor), XFDASHBOARD_BUTTON_STYLE_BOTH);
- xfdashboard_button_set_icon_image(XFDASHBOARD_BUTTON(actor), CLUTTER_IMAGE(iconImage));
+ xfdashboard_label_set_style(XFDASHBOARD_LABEL(actor), XFDASHBOARD_LABEL_STYLE_BOTH);
+ xfdashboard_label_set_icon_image(XFDASHBOARD_LABEL(actor), CLUTTER_IMAGE(iconImage));
}
clutter_actor_show(actor);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list