[Xfce4-commits] <ristretto:stephan/icon-bar> Improve indenting
Stephan Arts
noreply at xfce.org
Sat Feb 4 12:32:03 CET 2012
Updating branch refs/heads/stephan/icon-bar
to 9c7d0d4990923462b150045da6fcd441f010bd11 (commit)
from aa9c7d328cb12ee4cc863182887f395420d8f795 (commit)
commit 9c7d0d4990923462b150045da6fcd441f010bd11
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Feb 4 11:31:45 2012 +0100
Improve indenting
src/icon_bar.c | 2580 ++++++++++++++++++++++--------------------
src/xfce_wallpaper_manager.c | 5 +
2 files changed, 1349 insertions(+), 1236 deletions(-)
diff --git a/src/icon_bar.c b/src/icon_bar.c
index 684e228..85f7b0e 100644
--- a/src/icon_bar.c
+++ b/src/icon_bar.c
@@ -90,8 +90,8 @@
#define RSTTO_ICON_BAR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RSTTO_TYPE_ICON_BAR, RsttoIconBarPrivate))
#define RSTTO_ICON_BAR_VALID_MODEL_AND_COLUMNS(obj) ((obj)->priv->model != NULL && \
- (obj)->priv->pixbuf_column != -1 && \
- (obj)->priv->text_column != -1)
+ (obj)->priv->pixbuf_column != -1 && \
+ (obj)->priv->text_column != -1)
@@ -99,354 +99,436 @@ typedef struct _RsttoIconBarItem RsttoIconBarItem;
enum
{
- PROP_0,
- PROP_ORIENTATION,
- PROP_PIXBUF_COLUMN,
- PROP_TEXT_COLUMN,
- PROP_MODEL,
- PROP_ACTIVE,
- PROP_SHOW_TEXT,
+ PROP_0,
+ PROP_ORIENTATION,
+ PROP_PIXBUF_COLUMN,
+ PROP_TEXT_COLUMN,
+ PROP_MODEL,
+ PROP_ACTIVE,
+ PROP_SHOW_TEXT,
};
enum
{
- SELECTION_CHANGED,
- LAST_SIGNAL,
+ SELECTION_CHANGED,
+ LAST_SIGNAL,
};
-static void rstto_icon_bar_destroy (GtkObject *object);
-static void rstto_icon_bar_finalize (GObject *object);
-static void rstto_icon_bar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void rstto_icon_bar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void rstto_icon_bar_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static void rstto_icon_bar_realize (GtkWidget *widget);
-static void rstto_icon_bar_unrealize (GtkWidget *widget);
-static void rstto_icon_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void rstto_icon_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gboolean rstto_icon_bar_expose (GtkWidget *widget,
- GdkEventExpose *expose);
-static gboolean rstto_icon_bar_leave (GtkWidget *widget,
- GdkEventCrossing *event);
-static gboolean rstto_icon_bar_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gboolean rstto_icon_bar_scroll (GtkWidget *widget,
- GdkEventScroll *event);
-static gboolean rstto_icon_bar_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean rstto_icon_bar_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static void rstto_icon_bar_set_adjustments (RsttoIconBar *icon_bar,
- GtkAdjustment *hadj,
- GtkAdjustment *vadj);
-static void rstto_icon_bar_adjustment_changed (GtkAdjustment *adjustment,
- RsttoIconBar *icon_bar);
-static void rstto_icon_bar_invalidate (RsttoIconBar *icon_bar);
-static RsttoIconBarItem *rstto_icon_bar_get_item_at_pos (RsttoIconBar *icon_bar,
- gint x,
- gint y);
-static void rstto_icon_bar_queue_draw_item (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item);
-static void rstto_icon_bar_paint_item (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item,
- GdkRectangle *area);
-static void rstto_icon_bar_calculate_item_size (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item);
-static void rstto_icon_bar_update_item_text (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item);
-static GdkPixbuf *rstto_icon_bar_get_item_icon (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item);
-static RsttoIconBarItem *rstto_icon_bar_item_new (void);
-static void rstto_icon_bar_item_free (RsttoIconBarItem *item);
-static void rstto_icon_bar_item_invalidate (RsttoIconBarItem *item);
-static void rstto_icon_bar_build_items (RsttoIconBar *icon_bar);
-static void rstto_icon_bar_row_changed (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- RsttoIconBar *icon_bar);
-static void rstto_icon_bar_row_inserted (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- RsttoIconBar *icon_bar);
-static void rstto_icon_bar_row_deleted (GtkTreeModel *model,
- GtkTreePath *path,
- RsttoIconBar *icon_bar);
-static void rstto_icon_bar_rows_reordered (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gint *new_order,
- RsttoIconBar *icon_bar);
+static void
+rstto_icon_bar_destroy (GtkObject *object);
+
+static void
+rstto_icon_bar_finalize (GObject *object);
+
+static void
+rstto_icon_bar_get_property (
+ GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void
+rstto_icon_bar_set_property (
+ GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void
+rstto_icon_bar_style_set (
+ GtkWidget *widget,
+ GtkStyle *previous_style);
+
+static void
+rstto_icon_bar_realize (GtkWidget *widget);
+static void
+rstto_icon_bar_unrealize (GtkWidget *widget);
+
+static void
+rstto_icon_bar_size_request (
+ GtkWidget *widget,
+ GtkRequisition *requisition);
+
+static void
+rstto_icon_bar_size_allocate (
+ GtkWidget *widget,
+ GtkAllocation *allocation);
+
+static gboolean
+rstto_icon_bar_expose (
+ GtkWidget *widget,
+ GdkEventExpose *expose);
+
+static gboolean
+rstto_icon_bar_leave (
+ GtkWidget *widget,
+ GdkEventCrossing *event);
+
+static gboolean
+rstto_icon_bar_motion (
+ GtkWidget *widget,
+ GdkEventMotion *event);
+
+static gboolean
+rstto_icon_bar_scroll (
+ GtkWidget *widget,
+ GdkEventScroll *event);
+
+static gboolean
+rstto_icon_bar_button_press (
+ GtkWidget *widget,
+ GdkEventButton *event);
+
+static gboolean
+rstto_icon_bar_button_release (
+ GtkWidget *widget,
+ GdkEventButton *event);
+
+static void
+rstto_icon_bar_set_adjustments (
+ RsttoIconBar *icon_bar,
+ GtkAdjustment *hadj,
+ GtkAdjustment *vadj);
+
+static void
+rstto_icon_bar_adjustment_changed (
+ GtkAdjustment *adjustment,
+ RsttoIconBar *icon_bar);
+
+static void
+rstto_icon_bar_invalidate (RsttoIconBar *icon_bar);
+
+static RsttoIconBarItem *
+rstto_icon_bar_get_item_at_pos (
+ RsttoIconBar *icon_bar,
+ gint x,
+ gint y);
+
+static void
+rstto_icon_bar_queue_draw_item (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item);
+
+static void
+rstto_icon_bar_paint_item (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item,
+ GdkRectangle *area);
+
+static void
+rstto_icon_bar_calculate_item_size (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item);
+
+static void
+rstto_icon_bar_update_item_text (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item);
+
+static GdkPixbuf *
+rstto_icon_bar_get_item_icon (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item);
+
+static RsttoIconBarItem *
+rstto_icon_bar_item_new (void);
+
+static void
+rstto_icon_bar_item_free (RsttoIconBarItem *item);
+
+static void
+rstto_icon_bar_item_invalidate (RsttoIconBarItem *item);
+
+static void
+rstto_icon_bar_build_items (RsttoIconBar *icon_bar);
+
+static void
+rstto_icon_bar_row_changed (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ RsttoIconBar *icon_bar);
+
+static void
+rstto_icon_bar_row_inserted (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ RsttoIconBar *icon_bar);
+
+static void
+rstto_icon_bar_row_deleted (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ RsttoIconBar *icon_bar);
+
+static void
+rstto_icon_bar_rows_reordered (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gint *new_order,
+ RsttoIconBar *icon_bar);
struct _RsttoIconBarItem
{
- GtkTreeIter iter;
- gint index;
+ GtkTreeIter iter;
+ gint index;
- gint width;
- gint height;
+ gint width;
+ gint height;
- gint pixbuf_width;
- gint pixbuf_height;
+ gint pixbuf_width;
+ gint pixbuf_height;
- gint layout_width;
- gint layout_height;
+ gint layout_width;
+ gint layout_height;
};
struct _RsttoIconBarPrivate
{
- GdkWindow *bin_window;
+ GdkWindow *bin_window;
- gint width;
- gint height;
+ gint width;
+ gint height;
- gint pixbuf_column;
- gint text_column;
+ gint pixbuf_column;
+ gint text_column;
- RsttoIconBarItem *active_item;
- RsttoIconBarItem *single_click_item;
- RsttoIconBarItem *cursor_item;
+ RsttoIconBarItem *active_item;
+ RsttoIconBarItem *single_click_item;
+ RsttoIconBarItem *cursor_item;
- GList *items;
- gint item_width;
- gint item_height;
+ GList *items;
+ gint item_width;
+ gint item_height;
- GtkAdjustment *hadjustment;
- GtkAdjustment *vadjustment;
+ GtkAdjustment *hadjustment;
+ GtkAdjustment *vadjustment;
- gboolean auto_center; /* automatically center the active item */
+ gboolean auto_center; /* automatically center the active item */
- GtkOrientation orientation;
+ GtkOrientation orientation;
- GtkTreeModel *model;
+ GtkTreeModel *model;
- PangoLayout *layout;
+ PangoLayout *layout;
- gboolean show_text;
+ gboolean show_text;
};
static guint icon_bar_signals[LAST_SIGNAL];
-
-
G_DEFINE_TYPE (RsttoIconBar, rstto_icon_bar, GTK_TYPE_CONTAINER)
-
static void
rstto_icon_bar_class_init (RsttoIconBarClass *klass)
{
- GtkObjectClass *gtkobject_class;
- GtkWidgetClass *gtkwidget_class;
- GObjectClass *gobject_class;
-
- g_type_class_add_private (klass, sizeof (RsttoIconBarPrivate));
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = rstto_icon_bar_finalize;
- gobject_class->get_property = rstto_icon_bar_get_property;
- gobject_class->set_property = rstto_icon_bar_set_property;
-
- gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = rstto_icon_bar_destroy;
-
- gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->style_set = rstto_icon_bar_style_set;
- gtkwidget_class->realize = rstto_icon_bar_realize;
- gtkwidget_class->unrealize = rstto_icon_bar_unrealize;
- gtkwidget_class->size_request = rstto_icon_bar_size_request;
- gtkwidget_class->size_allocate = rstto_icon_bar_size_allocate;
- gtkwidget_class->expose_event = rstto_icon_bar_expose;
- gtkwidget_class->leave_notify_event = rstto_icon_bar_leave;
- gtkwidget_class->motion_notify_event = rstto_icon_bar_motion;
- gtkwidget_class->scroll_event = rstto_icon_bar_scroll;
- gtkwidget_class->button_press_event = rstto_icon_bar_button_press;
- gtkwidget_class->button_release_event = rstto_icon_bar_button_release;
-
- klass->set_scroll_adjustments = rstto_icon_bar_set_adjustments;
-
- /**
- * RsttoIconBar:orientation:
- *
- * The orientation of the icon bar.
- *
- * Default value: %GTK_ORIENTATION_VERTICAL
- **/
- g_object_class_install_property (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation",
- _("Orientation"),
- _("The orientation of the iconbar"),
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_VERTICAL,
- G_PARAM_READWRITE));
-
- /**
- * RsttoIconBar:pixbuf-column:
- *
- * The ::pixbuf-column property contains the number of the model column
- * containing the pixbufs which are displyed. The pixbuf column must be
- * of type #GDK_TYPE_PIXBUF. Setting this property to -1 turns off the
- * display of pixbufs.
- **/
- g_object_class_install_property (gobject_class,
- PROP_PIXBUF_COLUMN,
- g_param_spec_int ("pixbuf-column",
- _("Pixbuf column"),
- _("Model column used to retrieve the icon pixbuf from"),
- -1, G_MAXINT, -1,
- G_PARAM_READWRITE));
-
- /**
- * RsttoIconBar:text-column:
- *
- * The ::text-column property contains the number of the model column
- * containing the texts which are displayed. The text column must be
- * of type #G_TYPE_STRING. If this property is set to -1, no texts
- * are displayed.
- **/
- g_object_class_install_property (gobject_class,
- PROP_TEXT_COLUMN,
- g_param_spec_int ("text-column",
- _("Text column"),
- _("Model column used to retrieve the text from"),
- -1, G_MAXINT, -1,
- G_PARAM_READWRITE));
-
- /**
- * RsttoIconBar:model:
- *
- * The model for the icon bar.
- **/
- g_object_class_install_property (gobject_class,
- PROP_MODEL,
- g_param_spec_object ("model",
- _("Icon Bar Model"),
- _("Model for the icon bar"),
- GTK_TYPE_TREE_MODEL,
- G_PARAM_READWRITE));
-
- /**
- * RsttoIconBar:active:
- *
- * The item which is currently active.
- *
- * Allowed values: >= -1
- *
- * Default value: -1
- **/
- g_object_class_install_property (gobject_class,
- PROP_ACTIVE,
- g_param_spec_int ("active",
- _("Active"),
- _("Active item index"),
- -1, G_MAXINT, -1,
- G_PARAM_READWRITE));
-
- /**
- * RsttoIconBar:show-text:
- *
- * Show text under icon.
- *
- * Allowed values: TRUE, FALSE
- *
- * Default value: TRUE
- **/
- g_object_class_install_property (gobject_class,
- PROP_SHOW_TEXT,
- g_param_spec_boolean ("show-text",
- _("Show Text"),
- _("Show Text"),
- TRUE,
- G_PARAM_READWRITE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("active-item-fill-color",
- _("Active item fill color"),
- _("Active item fill color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("active-item-border-color",
- _("Active item border color"),
- _("Active item border color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("active-item-text-color",
- _("Active item text color"),
- _("Active item text color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("cursor-item-fill-color",
- _("Cursor item fill color"),
- _("Cursor item fill color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("cursor-item-border-color",
- _("Cursor item border color"),
- _("Cursor item border color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (gtkwidget_class,
- g_param_spec_boxed ("cursor-item-text-color",
- _("Cursor item text color"),
- _("Cursor item text color"),
- GDK_TYPE_COLOR,
- G_PARAM_READABLE));
-
- /**
- * RsttoIconBar::set-scroll-adjustments:
- * @icon_bar : The #RsttoIconBar.
- * @hadjustment : The horizontal adjustment.
- * @vadjustment : The vertical adjustment.
- *
- * Used internally to make the #RsttoIconBar scrollable.
- **/
- gtkwidget_class->set_scroll_adjustments_signal =
- g_signal_new ("set-scroll-adjustments",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (RsttoIconBarClass, set_scroll_adjustments),
- NULL, NULL,
- _rstto_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-
- /**
- * RsttoIconBar::selection-changed:
- * @icon_bar : The #RsttoIconBar.
- *
- * This signal is emitted whenever the currently selected icon
- * changes.
- **/
- icon_bar_signals[SELECTION_CHANGED] =
- g_signal_new ("selection-changed",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (RsttoIconBarClass, selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ GtkObjectClass *gtkobject_class;
+ GtkWidgetClass *gtkwidget_class;
+ GObjectClass *gobject_class;
+
+ g_type_class_add_private (klass, sizeof (RsttoIconBarPrivate));
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = rstto_icon_bar_finalize;
+ gobject_class->get_property = rstto_icon_bar_get_property;
+ gobject_class->set_property = rstto_icon_bar_set_property;
+
+ gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = rstto_icon_bar_destroy;
+
+ gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->style_set = rstto_icon_bar_style_set;
+ gtkwidget_class->realize = rstto_icon_bar_realize;
+ gtkwidget_class->unrealize = rstto_icon_bar_unrealize;
+ gtkwidget_class->size_request = rstto_icon_bar_size_request;
+ gtkwidget_class->size_allocate = rstto_icon_bar_size_allocate;
+ gtkwidget_class->expose_event = rstto_icon_bar_expose;
+ gtkwidget_class->leave_notify_event = rstto_icon_bar_leave;
+ gtkwidget_class->motion_notify_event = rstto_icon_bar_motion;
+ gtkwidget_class->scroll_event = rstto_icon_bar_scroll;
+ gtkwidget_class->button_press_event = rstto_icon_bar_button_press;
+ gtkwidget_class->button_release_event = rstto_icon_bar_button_release;
+
+ klass->set_scroll_adjustments = rstto_icon_bar_set_adjustments;
+
+ /**
+ * RsttoIconBar:orientation:
+ *
+ * The orientation of the icon bar.
+ *
+ * Default value: %GTK_ORIENTATION_VERTICAL
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation",
+ _("Orientation"),
+ _("The orientation of the iconbar"),
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_VERTICAL,
+ G_PARAM_READWRITE));
+
+ /**
+ * RsttoIconBar:pixbuf-column:
+ *
+ * The ::pixbuf-column property contains the number of the model column
+ * containing the pixbufs which are displyed. The pixbuf column must be
+ * of type #GDK_TYPE_PIXBUF. Setting this property to -1 turns off the
+ * display of pixbufs.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_PIXBUF_COLUMN,
+ g_param_spec_int ("pixbuf-column",
+ _("Pixbuf column"),
+ _("Model column used to retrieve the icon pixbuf from"),
+ -1, G_MAXINT, -1,
+ G_PARAM_READWRITE));
+
+ /**
+ * RsttoIconBar:text-column:
+ *
+ * The ::text-column property contains the number of the model column
+ * containing the texts which are displayed. The text column must be
+ * of type #G_TYPE_STRING. If this property is set to -1, no texts
+ * are displayed.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_TEXT_COLUMN,
+ g_param_spec_int ("text-column",
+ _("Text column"),
+ _("Model column used to retrieve the text from"),
+ -1, G_MAXINT, -1,
+ G_PARAM_READWRITE));
+
+ /**
+ * RsttoIconBar:model:
+ *
+ * The model for the icon bar.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_MODEL,
+ g_param_spec_object ("model",
+ _("Icon Bar Model"),
+ _("Model for the icon bar"),
+ GTK_TYPE_TREE_MODEL,
+ G_PARAM_READWRITE));
+
+ /**
+ * RsttoIconBar:active:
+ *
+ * The item which is currently active.
+ *
+ * Allowed values: >= -1
+ *
+ * Default value: -1
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_ACTIVE,
+ g_param_spec_int ("active",
+ _("Active"),
+ _("Active item index"),
+ -1, G_MAXINT, -1,
+ G_PARAM_READWRITE));
+
+ /**
+ * RsttoIconBar:show-text:
+ *
+ * Show text under icon.
+ *
+ * Allowed values: TRUE, FALSE
+ *
+ * Default value: TRUE
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_SHOW_TEXT,
+ g_param_spec_boolean ("show-text",
+ _("Show Text"),
+ _("Show Text"),
+ TRUE,
+ G_PARAM_READWRITE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("active-item-fill-color",
+ _("Active item fill color"),
+ _("Active item fill color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("active-item-border-color",
+ _("Active item border color"),
+ _("Active item border color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("active-item-text-color",
+ _("Active item text color"),
+ _("Active item text color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("cursor-item-fill-color",
+ _("Cursor item fill color"),
+ _("Cursor item fill color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("cursor-item-border-color",
+ _("Cursor item border color"),
+ _("Cursor item border color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (gtkwidget_class,
+ g_param_spec_boxed ("cursor-item-text-color",
+ _("Cursor item text color"),
+ _("Cursor item text color"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ /**
+ * RsttoIconBar::set-scroll-adjustments:
+ * @icon_bar : The #RsttoIconBar.
+ * @hadjustment : The horizontal adjustment.
+ * @vadjustment : The vertical adjustment.
+ *
+ * Used internally to make the #RsttoIconBar scrollable.
+ **/
+ gtkwidget_class->set_scroll_adjustments_signal =
+ g_signal_new ("set-scroll-adjustments",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (RsttoIconBarClass, set_scroll_adjustments),
+ NULL, NULL,
+ _rstto_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2,
+ GTK_TYPE_ADJUSTMENT,
+ GTK_TYPE_ADJUSTMENT);
+
+ /**
+ * RsttoIconBar::selection-changed:
+ * @icon_bar : The #RsttoIconBar.
+ *
+ * This signal is emitted whenever the currently selected icon
+ * changes.
+ **/
+ icon_bar_signals[SELECTION_CHANGED] =
+ g_signal_new ("selection-changed",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (RsttoIconBarClass, selection_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
@@ -454,24 +536,24 @@ rstto_icon_bar_class_init (RsttoIconBarClass *klass)
static void
rstto_icon_bar_init (RsttoIconBar *icon_bar)
{
- icon_bar->priv = RSTTO_ICON_BAR_GET_PRIVATE (icon_bar);
+ icon_bar->priv = RSTTO_ICON_BAR_GET_PRIVATE (icon_bar);
- icon_bar->priv->orientation = GTK_ORIENTATION_VERTICAL;
- icon_bar->priv->pixbuf_column = -1;
- icon_bar->priv->text_column = -1;
- icon_bar->priv->show_text = TRUE;
- icon_bar->priv->auto_center = TRUE;
+ icon_bar->priv->orientation = GTK_ORIENTATION_VERTICAL;
+ icon_bar->priv->pixbuf_column = -1;
+ icon_bar->priv->text_column = -1;
+ icon_bar->priv->show_text = TRUE;
+ icon_bar->priv->auto_center = TRUE;
- icon_bar->priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (icon_bar), NULL);
- pango_layout_set_width (icon_bar->priv->layout, -1);
- pango_layout_set_wrap (icon_bar->priv->layout,
- PANGO_WRAP_WORD_CHAR);
- pango_layout_set_ellipsize (icon_bar->priv->layout,
- PANGO_ELLIPSIZE_END);
+ icon_bar->priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (icon_bar), NULL);
+ pango_layout_set_width (icon_bar->priv->layout, -1);
+ pango_layout_set_wrap (icon_bar->priv->layout,
+ PANGO_WRAP_WORD_CHAR);
+ pango_layout_set_ellipsize (icon_bar->priv->layout,
+ PANGO_ELLIPSIZE_END);
- GTK_WIDGET_UNSET_FLAGS (icon_bar, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (icon_bar, GTK_CAN_FOCUS);
- rstto_icon_bar_set_adjustments (icon_bar, NULL, NULL);
+ rstto_icon_bar_set_adjustments (icon_bar, NULL, NULL);
}
@@ -479,11 +561,11 @@ rstto_icon_bar_init (RsttoIconBar *icon_bar)
static void
rstto_icon_bar_destroy (GtkObject *object)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
- rstto_icon_bar_set_model (icon_bar, NULL);
+ rstto_icon_bar_set_model (icon_bar, NULL);
- (*GTK_OBJECT_CLASS (rstto_icon_bar_parent_class)->destroy) (object);
+ (*GTK_OBJECT_CLASS (rstto_icon_bar_parent_class)->destroy) (object);
}
@@ -491,111 +573,114 @@ rstto_icon_bar_destroy (GtkObject *object)
static void
rstto_icon_bar_finalize (GObject *object)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
- g_object_unref (G_OBJECT (icon_bar->priv->layout));
+ g_object_unref (G_OBJECT (icon_bar->priv->layout));
- (*G_OBJECT_CLASS (rstto_icon_bar_parent_class)->finalize) (object);
+ (*G_OBJECT_CLASS (rstto_icon_bar_parent_class)->finalize) (object);
}
static void
-rstto_icon_bar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+rstto_icon_bar_get_property (
+ GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
- switch (prop_id)
+ switch (prop_id)
{
- case PROP_ORIENTATION:
- g_value_set_enum (value, icon_bar->priv->orientation);
- break;
+ case PROP_ORIENTATION:
+ g_value_set_enum (value, icon_bar->priv->orientation);
+ break;
- case PROP_PIXBUF_COLUMN:
- g_value_set_int (value, icon_bar->priv->pixbuf_column);
- break;
+ case PROP_PIXBUF_COLUMN:
+ g_value_set_int (value, icon_bar->priv->pixbuf_column);
+ break;
- case PROP_TEXT_COLUMN:
- g_value_set_int (value, icon_bar->priv->text_column);
- break;
+ case PROP_TEXT_COLUMN:
+ g_value_set_int (value, icon_bar->priv->text_column);
+ break;
- case PROP_MODEL:
- g_value_set_object (value, icon_bar->priv->model);
- break;
+ case PROP_MODEL:
+ g_value_set_object (value, icon_bar->priv->model);
+ break;
- case PROP_ACTIVE:
- g_value_set_int (value, rstto_icon_bar_get_active (icon_bar));
- break;
+ case PROP_ACTIVE:
+ g_value_set_int (value, rstto_icon_bar_get_active (icon_bar));
+ break;
- case PROP_SHOW_TEXT:
- g_value_set_boolean (value, rstto_icon_bar_get_show_text (icon_bar));
- break;
+ case PROP_SHOW_TEXT:
+ g_value_set_boolean (value, rstto_icon_bar_get_show_text (icon_bar));
+ break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-rstto_icon_bar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+rstto_icon_bar_set_property (
+ GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (object);
- switch (prop_id)
+ switch (prop_id)
{
- case PROP_ORIENTATION:
- rstto_icon_bar_set_orientation (icon_bar, g_value_get_enum (value));
- break;
+ case PROP_ORIENTATION:
+ rstto_icon_bar_set_orientation (icon_bar, g_value_get_enum (value));
+ break;
- case PROP_PIXBUF_COLUMN:
- rstto_icon_bar_set_pixbuf_column (icon_bar, g_value_get_int (value));
- break;
+ case PROP_PIXBUF_COLUMN:
+ rstto_icon_bar_set_pixbuf_column (icon_bar, g_value_get_int (value));
+ break;
- case PROP_TEXT_COLUMN:
- rstto_icon_bar_set_text_column (icon_bar, g_value_get_int (value));
- break;
+ case PROP_TEXT_COLUMN:
+ rstto_icon_bar_set_text_column (icon_bar, g_value_get_int (value));
+ break;
- case PROP_MODEL:
- rstto_icon_bar_set_model (icon_bar, g_value_get_object (value));
- break;
+ case PROP_MODEL:
+ rstto_icon_bar_set_model (icon_bar, g_value_get_object (value));
+ break;
- case PROP_ACTIVE:
- rstto_icon_bar_set_active (icon_bar, g_value_get_int (value));
- break;
+ case PROP_ACTIVE:
+ rstto_icon_bar_set_active (icon_bar, g_value_get_int (value));
+ break;
- case PROP_SHOW_TEXT:
- rstto_icon_bar_set_show_text (icon_bar, g_value_get_boolean (value));
- break;
+ case PROP_SHOW_TEXT:
+ rstto_icon_bar_set_show_text (icon_bar, g_value_get_boolean (value));
+ break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-rstto_icon_bar_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
+rstto_icon_bar_style_set (
+ GtkWidget *widget,
+ GtkStyle *previous_style)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- (*GTK_WIDGET_CLASS (rstto_icon_bar_parent_class)->style_set) (widget, previous_style);
+ (*GTK_WIDGET_CLASS (rstto_icon_bar_parent_class)->style_set) (widget, previous_style);
- if (GTK_WIDGET_REALIZED (widget))
+ if (GTK_WIDGET_REALIZED (widget))
{
- gdk_window_set_background (icon_bar->priv->bin_window,
- &widget->style->base[widget->state]);
+ gdk_window_set_background (icon_bar->priv->bin_window,
+ &widget->style->base[widget->state]);
}
}
@@ -604,50 +689,50 @@ rstto_icon_bar_style_set (GtkWidget *widget,
static void
rstto_icon_bar_realize (GtkWidget *widget)
{
- GdkWindowAttr attributes;
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- gint attributes_mask;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- attributes.x = 0;
- attributes.y = 0;
- attributes.width = MAX (icon_bar->priv->width, widget->allocation.width);
- attributes.height = MAX (icon_bar->priv->height, widget->allocation.height);
- attributes.event_mask = (GDK_SCROLL_MASK
- | GDK_EXPOSURE_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_KEY_RELEASE_MASK)
- | gtk_widget_get_events (widget);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- icon_bar->priv->bin_window = gdk_window_new (widget->window,
- &attributes, attributes_mask);
- gdk_window_set_user_data (icon_bar->priv->bin_window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
- gdk_window_set_background (icon_bar->priv->bin_window, &widget->style->base[widget->state]);
- gdk_window_show (icon_bar->priv->bin_window);
+ GdkWindowAttr attributes;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ gint attributes_mask;
+
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (widget->window, widget);
+
+ attributes.x = 0;
+ attributes.y = 0;
+ attributes.width = MAX (icon_bar->priv->width, widget->allocation.width);
+ attributes.height = MAX (icon_bar->priv->height, widget->allocation.height);
+ attributes.event_mask = (GDK_SCROLL_MASK
+ | GDK_EXPOSURE_MASK
+ | GDK_LEAVE_NOTIFY_MASK
+ | GDK_POINTER_MOTION_MASK
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK
+ | GDK_KEY_PRESS_MASK
+ | GDK_KEY_RELEASE_MASK)
+ | gtk_widget_get_events (widget);
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ icon_bar->priv->bin_window = gdk_window_new (widget->window,
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (icon_bar->priv->bin_window, widget);
+
+ widget->style = gtk_style_attach (widget->style, widget->window);
+ gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
+ gdk_window_set_background (icon_bar->priv->bin_window, &widget->style->base[widget->state]);
+ gdk_window_show (icon_bar->priv->bin_window);
}
@@ -655,149 +740,151 @@ rstto_icon_bar_realize (GtkWidget *widget)
static void
rstto_icon_bar_unrealize (GtkWidget *widget)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- gdk_window_set_user_data (icon_bar->priv->bin_window, NULL);
- gdk_window_destroy (icon_bar->priv->bin_window);
- icon_bar->priv->bin_window = NULL;
+ gdk_window_set_user_data (icon_bar->priv->bin_window, NULL);
+ gdk_window_destroy (icon_bar->priv->bin_window);
+ icon_bar->priv->bin_window = NULL;
- /* GtkWidget::unrealize destroys children and widget->window */
- (*GTK_WIDGET_CLASS (rstto_icon_bar_parent_class)->unrealize) (widget);
+ /* GtkWidget::unrealize destroys children and widget->window */
+ (*GTK_WIDGET_CLASS (rstto_icon_bar_parent_class)->unrealize) (widget);
}
static void
-rstto_icon_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+rstto_icon_bar_size_request (
+ GtkWidget *widget,
+ GtkRequisition *requisition)
{
- RsttoIconBarItem *item;
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- GList *lp;
- gint n = 0;
- gint max_width = 0;
- gint max_height = 0;
-
- if (!RSTTO_ICON_BAR_VALID_MODEL_AND_COLUMNS (icon_bar)
- || icon_bar->priv->items == NULL)
+ RsttoIconBarItem *item;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ GList *lp;
+ gint n = 0;
+ gint max_width = 0;
+ gint max_height = 0;
+
+ if (!RSTTO_ICON_BAR_VALID_MODEL_AND_COLUMNS (icon_bar)
+ || icon_bar->priv->items == NULL)
{
- icon_bar->priv->width = requisition->width = 0;
- icon_bar->priv->height = requisition->height = 0;
- return;
+ icon_bar->priv->width = requisition->width = 0;
+ icon_bar->priv->height = requisition->height = 0;
+ return;
}
- /* calculate max item size */
- for (lp = icon_bar->priv->items; lp != NULL; ++n, lp = lp->next)
+ /* calculate max item size */
+ for (lp = icon_bar->priv->items; lp != NULL; ++n, lp = lp->next)
{
- item = lp->data;
- rstto_icon_bar_calculate_item_size (icon_bar, item);
- if (item->width > max_width)
- max_width = item->width;
- if (item->height > max_height)
- max_height = item->height;
+ item = lp->data;
+ rstto_icon_bar_calculate_item_size (icon_bar, item);
+ if (item->width > max_width)
+ max_width = item->width;
+ if (item->height > max_height)
+ max_height = item->height;
}
- icon_bar->priv->item_width = max_width;
- icon_bar->priv->item_height = max_height;
+ icon_bar->priv->item_width = max_width;
+ icon_bar->priv->item_height = max_height;
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- icon_bar->priv->width = requisition->width = icon_bar->priv->item_width;
- icon_bar->priv->height = requisition->height = icon_bar->priv->item_height * n;
+ icon_bar->priv->width = requisition->width = icon_bar->priv->item_width;
+ icon_bar->priv->height = requisition->height = icon_bar->priv->item_height * n;
}
- else
+ else
{
- icon_bar->priv->width = requisition->width = icon_bar->priv->item_width * n;
- icon_bar->priv->height = requisition->height = icon_bar->priv->item_height;
+ icon_bar->priv->width = requisition->width = icon_bar->priv->item_width * n;
+ icon_bar->priv->height = requisition->height = icon_bar->priv->item_height;
}
}
static void
-rstto_icon_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+rstto_icon_bar_size_allocate (
+ GtkWidget *widget,
+ GtkAllocation *allocation)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- gdouble value = 0.0;
- gdouble page_size = 0.0;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ gdouble value = 0.0;
+ gdouble page_size = 0.0;
- widget->allocation = *allocation;
+ widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
+ if (GTK_WIDGET_REALIZED (widget))
{
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- gdk_window_resize (icon_bar->priv->bin_window,
- MAX (icon_bar->priv->width, allocation->width),
- MAX (icon_bar->priv->height, allocation->height));
+ gdk_window_move_resize (widget->window,
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+ gdk_window_resize (icon_bar->priv->bin_window,
+ MAX (icon_bar->priv->width, allocation->width),
+ MAX (icon_bar->priv->height, allocation->height));
}
- icon_bar->priv->hadjustment->page_size = allocation->width;
- icon_bar->priv->hadjustment->page_increment = allocation->width * 0.9;
- icon_bar->priv->hadjustment->step_increment = allocation->width * 0.1;
- icon_bar->priv->hadjustment->lower = 0;
- icon_bar->priv->hadjustment->upper = MAX (allocation->width, icon_bar->priv->width);
- gtk_adjustment_changed (icon_bar->priv->hadjustment);
-
- icon_bar->priv->vadjustment->page_size = allocation->height;
- icon_bar->priv->vadjustment->page_increment = allocation->height * 0.9;
- icon_bar->priv->vadjustment->step_increment = allocation->height * 0.1;
- icon_bar->priv->vadjustment->lower = 0;
- icon_bar->priv->vadjustment->upper = MAX (allocation->height, icon_bar->priv->height);
- gtk_adjustment_changed (icon_bar->priv->vadjustment);
-
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ icon_bar->priv->hadjustment->page_size = allocation->width;
+ icon_bar->priv->hadjustment->page_increment = allocation->width * 0.9;
+ icon_bar->priv->hadjustment->step_increment = allocation->width * 0.1;
+ icon_bar->priv->hadjustment->lower = 0;
+ icon_bar->priv->hadjustment->upper = MAX (allocation->width, icon_bar->priv->width);
+ gtk_adjustment_changed (icon_bar->priv->hadjustment);
+
+ icon_bar->priv->vadjustment->page_size = allocation->height;
+ icon_bar->priv->vadjustment->page_increment = allocation->height * 0.9;
+ icon_bar->priv->vadjustment->step_increment = allocation->height * 0.1;
+ icon_bar->priv->vadjustment->lower = 0;
+ icon_bar->priv->vadjustment->upper = MAX (allocation->height, icon_bar->priv->height);
+ gtk_adjustment_changed (icon_bar->priv->vadjustment);
+
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- icon_bar->priv->width = allocation->width;
- icon_bar->priv->item_width = icon_bar->priv->width;
- icon_bar->priv->hadjustment->value = 0;
+ icon_bar->priv->width = allocation->width;
+ icon_bar->priv->item_width = icon_bar->priv->width;
+ icon_bar->priv->hadjustment->value = 0;
- /* If auto-center is true, center the selected item */
- if (icon_bar->priv->auto_center == TRUE)
+ /* If auto-center is true, center the selected item */
+ if (icon_bar->priv->auto_center == TRUE)
{
- page_size = gtk_adjustment_get_page_size (icon_bar->priv->vadjustment);
- value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
+ page_size = gtk_adjustment_get_page_size (icon_bar->priv->vadjustment);
+ value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
- if (value > (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size))
- value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
+ if (value > (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size))
+ value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
- gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
- gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
- gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
- icon_bar->priv->auto_center = TRUE;
+ gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
+ gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
+ gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
+ icon_bar->priv->auto_center = TRUE;
}
- else
+ else
{
- gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
+ gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
}
}
- else
+ else
{
- icon_bar->priv->height = allocation->height;
- icon_bar->priv->item_height = icon_bar->priv->height;
- icon_bar->priv->vadjustment->value = 0;
+ icon_bar->priv->height = allocation->height;
+ icon_bar->priv->item_height = icon_bar->priv->height;
+ icon_bar->priv->vadjustment->value = 0;
- /* If auto-center is true, center the selected item */
- if (icon_bar->priv->auto_center == TRUE)
+ /* If auto-center is true, center the selected item */
+ if (icon_bar->priv->auto_center == TRUE)
{
- page_size = gtk_adjustment_get_page_size (icon_bar->priv->hadjustment);
- value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
+ page_size = gtk_adjustment_get_page_size (icon_bar->priv->hadjustment);
+ value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
- if (value > (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size))
- value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
+ if (value > (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size))
+ value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
- gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
- gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
- gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
- icon_bar->priv->auto_center = TRUE;
+ gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
+ gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
+ gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
+ icon_bar->priv->auto_center = TRUE;
}
- else
+ else
{
- gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
+ gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
}
}
}
@@ -805,528 +892,534 @@ rstto_icon_bar_size_allocate (GtkWidget *widget,
static gboolean
-rstto_icon_bar_expose (GtkWidget *widget,
- GdkEventExpose *expose)
+rstto_icon_bar_expose (
+ GtkWidget *widget,
+ GdkEventExpose *expose)
{
- RsttoIconBarItem *item;
- GdkRectangle area;
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- GList *lp;
+ RsttoIconBarItem *item;
+ GdkRectangle area;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ GList *lp;
- if (expose->window != icon_bar->priv->bin_window)
- return FALSE;
+ if (expose->window != icon_bar->priv->bin_window)
+ return FALSE;
- for (lp = icon_bar->priv->items; lp != NULL; lp = lp->next)
+ for (lp = icon_bar->priv->items; lp != NULL; lp = lp->next)
{
- item = lp->data;
+ item = lp->data;
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- area.x = 0;
- area.y = item->index * icon_bar->priv->item_height;
+ area.x = 0;
+ area.y = item->index * icon_bar->priv->item_height;
}
- else
+ else
{
- area.x = item->index * icon_bar->priv->item_width;
- area.y = 0;
+ area.x = item->index * icon_bar->priv->item_width;
+ area.y = 0;
}
- area.width = icon_bar->priv->item_width;
- area.height = icon_bar->priv->item_height;
+ area.width = icon_bar->priv->item_width;
+ area.height = icon_bar->priv->item_height;
- if (gdk_region_rect_in (expose->region, &area) != GDK_OVERLAP_RECTANGLE_OUT)
- rstto_icon_bar_paint_item (icon_bar, item, &expose->area);
+ if (gdk_region_rect_in (expose->region, &area) != GDK_OVERLAP_RECTANGLE_OUT)
+ rstto_icon_bar_paint_item (icon_bar, item, &expose->area);
}
- return TRUE;
+ return TRUE;
}
static gboolean
-rstto_icon_bar_leave (GtkWidget *widget,
- GdkEventCrossing *event)
+rstto_icon_bar_leave (
+ GtkWidget *widget,
+ GdkEventCrossing *event)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- if (icon_bar->priv->cursor_item != NULL)
+ if (icon_bar->priv->cursor_item != NULL)
{
- rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
- icon_bar->priv->cursor_item = NULL;
+ rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
+ icon_bar->priv->cursor_item = NULL;
}
- return FALSE;
+ return FALSE;
}
static gboolean
-rstto_icon_bar_motion (GtkWidget *widget,
- GdkEventMotion *event)
+rstto_icon_bar_motion (
+ GtkWidget *widget,
+ GdkEventMotion *event)
{
- RsttoIconBarItem *item;
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- GtkTreePath *path;
- GtkTreeIter iter;
- gchar *text;
-
- item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
- if (item != NULL && icon_bar->priv->cursor_item != item)
- {
- if (icon_bar->priv->cursor_item != NULL)
- rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
- icon_bar->priv->cursor_item = item;
- rstto_icon_bar_queue_draw_item (icon_bar, item);
+ RsttoIconBarItem *item;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gchar *text;
+
+ item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
+ if (item != NULL && icon_bar->priv->cursor_item != item)
+ {
+ if (icon_bar->priv->cursor_item != NULL)
+ rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
+ icon_bar->priv->cursor_item = item;
+ rstto_icon_bar_queue_draw_item (icon_bar, item);
- iter = item->iter;
- gtk_tree_model_get (icon_bar->priv->model, &iter,
- icon_bar->priv->text_column, &text,
- -1);
+ iter = item->iter;
+ gtk_tree_model_get (icon_bar->priv->model, &iter,
+ icon_bar->priv->text_column, &text,
+ -1);
- gtk_widget_set_tooltip_text (widget, text);
+ gtk_widget_set_tooltip_text (widget, text);
- if (text)
- {
- g_free (text);
- }
- gtk_widget_trigger_tooltip_query (widget);
+ if (text)
+ {
+ g_free (text);
+ }
+ gtk_widget_trigger_tooltip_query (widget);
}
- else if (icon_bar->priv->cursor_item != NULL
- && icon_bar->priv->cursor_item != item)
+ else if (icon_bar->priv->cursor_item != NULL
+ && icon_bar->priv->cursor_item != item)
{
- rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
- icon_bar->priv->cursor_item = NULL;
+ rstto_icon_bar_queue_draw_item (icon_bar, icon_bar->priv->cursor_item);
+ icon_bar->priv->cursor_item = NULL;
}
- return TRUE;
+ return TRUE;
}
static gboolean
-rstto_icon_bar_scroll (GtkWidget *widget,
- GdkEventScroll *event)
+rstto_icon_bar_scroll (
+ GtkWidget *widget,
+ GdkEventScroll *event)
{
- RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
- GtkAdjustment *adjustment = NULL;
- gdouble val = 0;
- gdouble step_size = 0;
- gdouble max_value = 0;
+ RsttoIconBar *icon_bar = RSTTO_ICON_BAR (widget);
+ GtkAdjustment *adjustment = NULL;
+ gdouble val = 0;
+ gdouble step_size = 0;
+ gdouble max_value = 0;
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- adjustment = icon_bar->priv->vadjustment;
- step_size = icon_bar->priv->item_height / 2;
+ adjustment = icon_bar->priv->vadjustment;
+ step_size = icon_bar->priv->item_height / 2;
}
- else
+ else
{
- adjustment = icon_bar->priv->hadjustment;
- step_size = icon_bar->priv->item_width / 2;
+ adjustment = icon_bar->priv->hadjustment;
+ step_size = icon_bar->priv->item_width / 2;
}
- val = gtk_adjustment_get_value (adjustment);
- max_value = gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_page_size (adjustment);
+ val = gtk_adjustment_get_value (adjustment);
+ max_value = gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_page_size (adjustment);
- switch (event->direction)
+ switch (event->direction)
{
- case GDK_SCROLL_UP:
- case GDK_SCROLL_LEFT:
- val-=step_size;
- if (val<0) val = 0.0;
- break;
- case GDK_SCROLL_DOWN:
- case GDK_SCROLL_RIGHT:
- val+=step_size;
- if (val > max_value) val = max_value;
- break;
+ case GDK_SCROLL_UP:
+ case GDK_SCROLL_LEFT:
+ val-=step_size;
+ if (val<0) val = 0.0;
+ break;
+ case GDK_SCROLL_DOWN:
+ case GDK_SCROLL_RIGHT:
+ val+=step_size;
+ if (val > max_value) val = max_value;
+ break;
}
- gtk_adjustment_set_value (adjustment, val);
- return TRUE;
+ gtk_adjustment_set_value (adjustment, val);
+ return TRUE;
}
-
static gboolean
-rstto_icon_bar_button_press (GtkWidget *widget,
- GdkEventButton *event)
+rstto_icon_bar_button_press (
+ GtkWidget *widget,
+ GdkEventButton *event)
{
- RsttoIconBar *icon_bar;
- RsttoIconBarItem *item;
+ RsttoIconBar *icon_bar;
+ RsttoIconBarItem *item;
- icon_bar = RSTTO_ICON_BAR (widget);
+ icon_bar = RSTTO_ICON_BAR (widget);
- if (G_UNLIKELY (!GTK_WIDGET_HAS_FOCUS (widget)))
- gtk_widget_grab_focus (widget);
+ if (G_UNLIKELY (!GTK_WIDGET_HAS_FOCUS (widget)))
+ gtk_widget_grab_focus (widget);
- if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
+ if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
{
- item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
- icon_bar->priv->single_click_item = item;
+ item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
+ icon_bar->priv->single_click_item = item;
}
- return TRUE;
+ return TRUE;
}
static gboolean
-rstto_icon_bar_button_release (GtkWidget *widget,
- GdkEventButton *event)
+rstto_icon_bar_button_release (
+ GtkWidget *widget,
+ GdkEventButton *event)
{
- RsttoIconBar *icon_bar;
- RsttoIconBarItem *item;
+ RsttoIconBar *icon_bar;
+ RsttoIconBarItem *item;
- icon_bar = RSTTO_ICON_BAR (widget);
+ icon_bar = RSTTO_ICON_BAR (widget);
- if (event->button == 1 && event->type == GDK_BUTTON_RELEASE)
+ if (event->button == 1 && event->type == GDK_BUTTON_RELEASE)
{
- item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
- if (G_LIKELY (item != NULL && item != icon_bar->priv->active_item && item == icon_bar->priv->single_click_item))
- rstto_icon_bar_set_active (icon_bar, item->index);
+ item = rstto_icon_bar_get_item_at_pos (icon_bar, event->x, event->y);
+ if (G_LIKELY (item != NULL && item != icon_bar->priv->active_item && item == icon_bar->priv->single_click_item))
+ rstto_icon_bar_set_active (icon_bar, item->index);
}
- return TRUE;
+ return TRUE;
}
static void
-rstto_icon_bar_set_adjustments (RsttoIconBar *icon_bar,
- GtkAdjustment *hadj,
- GtkAdjustment *vadj)
+rstto_icon_bar_set_adjustments (
+ RsttoIconBar *icon_bar,
+ GtkAdjustment *hadj,
+ GtkAdjustment *vadj)
{
- gboolean need_adjust = FALSE;
+ gboolean need_adjust = FALSE;
- if (hadj != NULL)
- g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
- else
- hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
+ if (hadj != NULL)
+ g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
+ else
+ hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
- if (vadj != NULL)
- g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
- else
- vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
+ if (vadj != NULL)
+ g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
+ else
+ vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
- if (icon_bar->priv->hadjustment && (icon_bar->priv->hadjustment != hadj))
+ if (icon_bar->priv->hadjustment && (icon_bar->priv->hadjustment != hadj))
{
- g_signal_handlers_disconnect_matched (icon_bar->priv->hadjustment, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, icon_bar);
- g_object_unref (icon_bar->priv->hadjustment);
+ g_signal_handlers_disconnect_matched (icon_bar->priv->hadjustment, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, icon_bar);
+ g_object_unref (icon_bar->priv->hadjustment);
}
- if (icon_bar->priv->vadjustment && (icon_bar->priv->vadjustment != vadj))
+ if (icon_bar->priv->vadjustment && (icon_bar->priv->vadjustment != vadj))
{
- g_signal_handlers_disconnect_matched (icon_bar->priv->vadjustment, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, icon_bar);
- g_object_unref (icon_bar->priv->vadjustment);
+ g_signal_handlers_disconnect_matched (icon_bar->priv->vadjustment, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, icon_bar);
+ g_object_unref (icon_bar->priv->vadjustment);
}
- if (icon_bar->priv->hadjustment != hadj)
+ if (icon_bar->priv->hadjustment != hadj)
{
- icon_bar->priv->hadjustment = hadj;
- g_object_ref (icon_bar->priv->hadjustment);
- gtk_object_sink (GTK_OBJECT (icon_bar->priv->hadjustment));
+ icon_bar->priv->hadjustment = hadj;
+ g_object_ref (icon_bar->priv->hadjustment);
+ gtk_object_sink (GTK_OBJECT (icon_bar->priv->hadjustment));
- g_signal_connect (icon_bar->priv->hadjustment, "value_changed",
- G_CALLBACK (rstto_icon_bar_adjustment_changed), icon_bar);
- need_adjust = TRUE;
+ g_signal_connect (icon_bar->priv->hadjustment, "value_changed",
+ G_CALLBACK (rstto_icon_bar_adjustment_changed), icon_bar);
+ need_adjust = TRUE;
}
- if (icon_bar->priv->vadjustment != vadj)
+ if (icon_bar->priv->vadjustment != vadj)
{
- icon_bar->priv->vadjustment = vadj;
- g_object_ref (icon_bar->priv->vadjustment);
- gtk_object_sink (GTK_OBJECT (icon_bar->priv->vadjustment));
+ icon_bar->priv->vadjustment = vadj;
+ g_object_ref (icon_bar->priv->vadjustment);
+ gtk_object_sink (GTK_OBJECT (icon_bar->priv->vadjustment));
- g_signal_connect (icon_bar->priv->vadjustment, "value_changed",
- G_CALLBACK (rstto_icon_bar_adjustment_changed), icon_bar);
- need_adjust = TRUE;
+ g_signal_connect (icon_bar->priv->vadjustment, "value_changed",
+ G_CALLBACK (rstto_icon_bar_adjustment_changed), icon_bar);
+ need_adjust = TRUE;
}
- if (need_adjust)
- rstto_icon_bar_adjustment_changed (NULL, icon_bar);
+ if (need_adjust)
+ rstto_icon_bar_adjustment_changed (NULL, icon_bar);
}
static void
-rstto_icon_bar_adjustment_changed (GtkAdjustment *adjustment,
- RsttoIconBar *icon_bar)
+rstto_icon_bar_adjustment_changed (
+ GtkAdjustment *adjustment,
+ RsttoIconBar *icon_bar)
{
- if (GTK_WIDGET_REALIZED (icon_bar))
+ if (GTK_WIDGET_REALIZED (icon_bar))
{
- /* Set auto_center to false, this should be the default behaviour
- * in case a user changes the value of the adjustments.
- *
- * If the value is set internally, and auto-center was enabled
- * the function calling gtk_adjustment_value_changed should set
- * auto_center to TRUE afterwards.
- */
- icon_bar->priv->auto_center = FALSE;
-
- gdk_window_move (icon_bar->priv->bin_window,
- - icon_bar->priv->hadjustment->value,
- - icon_bar->priv->vadjustment->value);
-
- gdk_window_process_updates (icon_bar->priv->bin_window, TRUE);
+ /* Set auto_center to false, this should be the default behaviour
+ * in case a user changes the value of the adjustments.
+ *
+ * If the value is set internally, and auto-center was enabled
+ * the function calling gtk_adjustment_value_changed should set
+ * auto_center to TRUE afterwards.
+ */
+ icon_bar->priv->auto_center = FALSE;
+
+ gdk_window_move (icon_bar->priv->bin_window,
+ - icon_bar->priv->hadjustment->value,
+ - icon_bar->priv->vadjustment->value);
+
+ gdk_window_process_updates (icon_bar->priv->bin_window, TRUE);
}
}
-
-
static void
rstto_icon_bar_invalidate (RsttoIconBar *icon_bar)
{
- g_list_foreach (icon_bar->priv->items, (GFunc) rstto_icon_bar_item_invalidate, NULL);
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
+ g_list_foreach (icon_bar->priv->items, (GFunc) rstto_icon_bar_item_invalidate, NULL);
+ gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
}
-
-
static RsttoIconBarItem*
-rstto_icon_bar_get_item_at_pos (RsttoIconBar *icon_bar,
- gint x,
- gint y)
+rstto_icon_bar_get_item_at_pos (
+ RsttoIconBar *icon_bar,
+ gint x,
+ gint y)
{
- GList *lp;
+ GList *lp;
- if (G_UNLIKELY (icon_bar->priv->item_height == 0))
- return NULL;
+ if (G_UNLIKELY (icon_bar->priv->item_height == 0))
+ return NULL;
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
- lp = g_list_nth (icon_bar->priv->items, y / icon_bar->priv->item_height);
- else
- lp = g_list_nth (icon_bar->priv->items, x / icon_bar->priv->item_width);
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ lp = g_list_nth (icon_bar->priv->items, y / icon_bar->priv->item_height);
+ else
+ lp = g_list_nth (icon_bar->priv->items, x / icon_bar->priv->item_width);
- return (lp != NULL) ? lp->data : NULL;
+ return (lp != NULL) ? lp->data : NULL;
}
static void
-rstto_icon_bar_queue_draw_item (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item)
+rstto_icon_bar_queue_draw_item (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item)
{
- GdkRectangle area;
+ GdkRectangle area;
- if (GTK_WIDGET_REALIZED (icon_bar))
+ if (GTK_WIDGET_REALIZED (icon_bar))
{
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- area.x = 0;
- area.y = icon_bar->priv->item_height * item->index;
+ area.x = 0;
+ area.y = icon_bar->priv->item_height * item->index;
}
- else
+ else
{
- area.x = icon_bar->priv->item_width * item->index;
- area.y = 0;
+ area.x = icon_bar->priv->item_width * item->index;
+ area.y = 0;
}
- area.width = icon_bar->priv->item_width;
- area.height = icon_bar->priv->item_height;
+ area.width = icon_bar->priv->item_width;
+ area.height = icon_bar->priv->item_height;
- gdk_window_invalidate_rect (icon_bar->priv->bin_window, &area, TRUE);
+ gdk_window_invalidate_rect (icon_bar->priv->bin_window, &area, TRUE);
}
}
static void
-rstto_icon_bar_paint_item (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item,
- GdkRectangle *area)
+rstto_icon_bar_paint_item (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item,
+ GdkRectangle *area)
{
- GdkPixbuf *pixbuf;
- GdkColor *border_color;
- GdkColor *fill_color;
- GdkColor *text_color;
- GdkGC *gc;
- gint focus_width;
- gint focus_pad;
- gint x, y;
- gint px, py;
- gint lx, ly;
-
- if (!RSTTO_ICON_BAR_VALID_MODEL_AND_COLUMNS (icon_bar))
- return;
-
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- NULL);
-
- /* calculate pixbuf/layout location */
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ GdkPixbuf *pixbuf;
+ GdkColor *border_color;
+ GdkColor *fill_color;
+ GdkColor *text_color;
+ GdkGC *gc;
+ gint focus_width;
+ gint focus_pad;
+ gint x, y;
+ gint px, py;
+ gint lx, ly;
+
+ if (!RSTTO_ICON_BAR_VALID_MODEL_AND_COLUMNS (icon_bar))
+ return;
+
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ /* calculate pixbuf/layout location */
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- x = 0;
- y = icon_bar->priv->item_height * item->index;
+ x = 0;
+ y = icon_bar->priv->item_height * item->index;
- px = (icon_bar->priv->item_width - item->pixbuf_width) / 2;
- if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
+ px = (icon_bar->priv->item_width - item->pixbuf_width) / 2;
+ if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
{
- py = (icon_bar->priv->item_height - (item->pixbuf_height + item->layout_height + ICON_TEXT_PADDING)) / 2
- + icon_bar->priv->item_height * item->index;
+ py = (icon_bar->priv->item_height - (item->pixbuf_height + item->layout_height + ICON_TEXT_PADDING)) / 2
+ + icon_bar->priv->item_height * item->index;
}
- else
+ else
{
- py = (icon_bar->priv->item_height - (item->pixbuf_height)) / 2
- + icon_bar->priv->item_height * item->index;
+ py = (icon_bar->priv->item_height - (item->pixbuf_height)) / 2
+ + icon_bar->priv->item_height * item->index;
}
- lx = (icon_bar->priv->item_width - (item->layout_width + ICON_TEXT_PADDING)) / 2 + focus_pad;
- ly = py + item->pixbuf_height + ICON_TEXT_PADDING;
+ lx = (icon_bar->priv->item_width - (item->layout_width + ICON_TEXT_PADDING)) / 2 + focus_pad;
+ ly = py + item->pixbuf_height + ICON_TEXT_PADDING;
}
- else
+ else
{
- x = icon_bar->priv->item_width * item->index;
- y = 0;
+ x = icon_bar->priv->item_width * item->index;
+ y = 0;
- px = (icon_bar->priv->item_width - item->pixbuf_width) / 2;
- + icon_bar->priv->item_width * item->index;
- if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
+ px = (icon_bar->priv->item_width - item->pixbuf_width) / 2;
+ + icon_bar->priv->item_width * item->index;
+ if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
{
- py = (icon_bar->priv->item_height - (item->pixbuf_height + item->layout_height)) / 2;
+ py = (icon_bar->priv->item_height - (item->pixbuf_height + item->layout_height)) / 2;
}
- else
+ else
{
- py = (icon_bar->priv->item_height - (item->pixbuf_height)) / 2;
+ py = (icon_bar->priv->item_height - (item->pixbuf_height)) / 2;
}
- lx = (icon_bar->priv->item_width - (item->layout_width)) / 2 + x;
- ly = py + item->pixbuf_height + ICON_TEXT_PADDING;
+ lx = (icon_bar->priv->item_width - (item->layout_width)) / 2 + x;
+ ly = py + item->pixbuf_height + ICON_TEXT_PADDING;
}
- if (icon_bar->priv->active_item == item)
+ if (icon_bar->priv->active_item == item)
{
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "active-item-fill-color", &fill_color,
- "active-item-border-color", &border_color,
- NULL);
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "active-item-fill-color", &fill_color,
+ "active-item-border-color", &border_color,
+ NULL);
- if (fill_color == NULL)
+ if (fill_color == NULL)
{
- fill_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#c1d2ee", fill_color);
+ fill_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#c1d2ee", fill_color);
}
- if (border_color == NULL)
+ if (border_color == NULL)
{
- border_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#316ac5", border_color);
+ border_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#316ac5", border_color);
}
- gc = gdk_gc_new (icon_bar->priv->bin_window);
- gdk_gc_set_clip_rectangle (gc, area);
- gdk_gc_set_rgb_fg_color (gc, fill_color);
- gdk_draw_rectangle (icon_bar->priv->bin_window, gc, TRUE,
- x + focus_pad + focus_width,
- y + focus_pad + focus_width,
- icon_bar->priv->item_width - 2 * (focus_width + focus_pad),
- icon_bar->priv->item_height - 2 * (focus_width + focus_pad));
- gdk_gc_set_rgb_fg_color (gc, border_color);
- gdk_gc_set_line_attributes (gc, focus_width, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
- gdk_draw_rectangle (icon_bar->priv->bin_window, gc, FALSE,
- x + focus_pad + focus_width / 2,
- y + focus_pad + focus_width / 2,
- icon_bar->priv->item_width - (2 * focus_pad + focus_width),
- icon_bar->priv->item_height - (2 * focus_pad + focus_width));
- gdk_color_free (border_color);
- gdk_color_free (fill_color);
- g_object_unref (gc);
+ gc = gdk_gc_new (icon_bar->priv->bin_window);
+ gdk_gc_set_clip_rectangle (gc, area);
+ gdk_gc_set_rgb_fg_color (gc, fill_color);
+ gdk_draw_rectangle (icon_bar->priv->bin_window, gc, TRUE,
+ x + focus_pad + focus_width,
+ y + focus_pad + focus_width,
+ icon_bar->priv->item_width - 2 * (focus_width + focus_pad),
+ icon_bar->priv->item_height - 2 * (focus_width + focus_pad));
+ gdk_gc_set_rgb_fg_color (gc, border_color);
+ gdk_gc_set_line_attributes (gc, focus_width, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
+ gdk_draw_rectangle (icon_bar->priv->bin_window, gc, FALSE,
+ x + focus_pad + focus_width / 2,
+ y + focus_pad + focus_width / 2,
+ icon_bar->priv->item_width - (2 * focus_pad + focus_width),
+ icon_bar->priv->item_height - (2 * focus_pad + focus_width));
+ gdk_color_free (border_color);
+ gdk_color_free (fill_color);
+ g_object_unref (gc);
}
- else if (icon_bar->priv->cursor_item == item)
+ else if (icon_bar->priv->cursor_item == item)
{
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "cursor-item-fill-color", &fill_color,
- "cursor-item-border-color", &border_color,
- NULL);
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "cursor-item-fill-color", &fill_color,
+ "cursor-item-border-color", &border_color,
+ NULL);
- if (fill_color == NULL)
+ if (fill_color == NULL)
{
- fill_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#e0e8f6", fill_color);
+ fill_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#e0e8f6", fill_color);
}
- if (border_color == NULL)
+ if (border_color == NULL)
{
- border_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#98b4e2", border_color);
+ border_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#98b4e2", border_color);
}
- gc = gdk_gc_new (icon_bar->priv->bin_window);
- gdk_gc_set_clip_rectangle (gc, area);
- gdk_gc_set_rgb_fg_color (gc, fill_color);
- gdk_draw_rectangle (icon_bar->priv->bin_window, gc, TRUE,
- x + focus_pad + focus_width,
- y + focus_pad + focus_width,
- icon_bar->priv->item_width - 2 * (focus_width + focus_pad),
- icon_bar->priv->item_height - 2 * (focus_width + focus_pad));
- gdk_gc_set_rgb_fg_color (gc, border_color);
- gdk_gc_set_line_attributes (gc, focus_width, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
- gdk_draw_rectangle (icon_bar->priv->bin_window, gc, FALSE,
- x + focus_pad + focus_width / 2,
- y + focus_pad + focus_width / 2,
- icon_bar->priv->item_width - (2 * focus_pad + focus_width),
- icon_bar->priv->item_height - (2 * focus_pad + focus_width));
- gdk_color_free (border_color);
- gdk_color_free (fill_color);
- g_object_unref (gc);
+ gc = gdk_gc_new (icon_bar->priv->bin_window);
+ gdk_gc_set_clip_rectangle (gc, area);
+ gdk_gc_set_rgb_fg_color (gc, fill_color);
+ gdk_draw_rectangle (icon_bar->priv->bin_window, gc, TRUE,
+ x + focus_pad + focus_width,
+ y + focus_pad + focus_width,
+ icon_bar->priv->item_width - 2 * (focus_width + focus_pad),
+ icon_bar->priv->item_height - 2 * (focus_width + focus_pad));
+ gdk_gc_set_rgb_fg_color (gc, border_color);
+ gdk_gc_set_line_attributes (gc, focus_width, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
+ gdk_draw_rectangle (icon_bar->priv->bin_window, gc, FALSE,
+ x + focus_pad + focus_width / 2,
+ y + focus_pad + focus_width / 2,
+ icon_bar->priv->item_width - (2 * focus_pad + focus_width),
+ icon_bar->priv->item_height - (2 * focus_pad + focus_width));
+ gdk_color_free (border_color);
+ gdk_color_free (fill_color);
+ g_object_unref (gc);
}
- if (icon_bar->priv->pixbuf_column != -1)
+ if (icon_bar->priv->pixbuf_column != -1)
{
- pixbuf = rstto_icon_bar_get_item_icon (icon_bar, item);
- if (G_LIKELY (pixbuf != NULL))
+ pixbuf = rstto_icon_bar_get_item_icon (icon_bar, item);
+ if (G_LIKELY (pixbuf != NULL))
{
- gdk_draw_pixbuf (icon_bar->priv->bin_window, NULL, pixbuf, 0, 0,
- px, py, item->pixbuf_width, item->pixbuf_height,
- GDK_RGB_DITHER_NORMAL, item->pixbuf_width,
- item->pixbuf_height);
- g_object_unref (pixbuf);
+ gdk_draw_pixbuf (icon_bar->priv->bin_window, NULL, pixbuf, 0, 0,
+ px, py, item->pixbuf_width, item->pixbuf_height,
+ GDK_RGB_DITHER_NORMAL, item->pixbuf_width,
+ item->pixbuf_height);
+ g_object_unref (pixbuf);
}
}
- if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
+ if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
{
- rstto_icon_bar_update_item_text (icon_bar, item);
+ rstto_icon_bar_update_item_text (icon_bar, item);
- if (icon_bar->priv->active_item == item)
+ if (icon_bar->priv->active_item == item)
{
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "active-item-text-color", &text_color,
- NULL);
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "active-item-text-color", &text_color,
+ NULL);
- if (text_color == NULL)
+ if (text_color == NULL)
{
- text_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#000000", text_color);
+ text_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#000000", text_color);
}
- gc = gdk_gc_new (GDK_DRAWABLE (icon_bar->priv->bin_window));
- gdk_gc_copy (gc, GTK_WIDGET (icon_bar)->style->text_gc[GTK_STATE_SELECTED]);
- gdk_gc_set_clip_rectangle (gc, area);
- gdk_gc_set_rgb_fg_color (gc, text_color);
- gdk_draw_layout (icon_bar->priv->bin_window, gc, lx, ly, icon_bar->priv->layout);
- g_object_unref (G_OBJECT (gc));
- gdk_color_free (text_color);
+ gc = gdk_gc_new (GDK_DRAWABLE (icon_bar->priv->bin_window));
+ gdk_gc_copy (gc, GTK_WIDGET (icon_bar)->style->text_gc[GTK_STATE_SELECTED]);
+ gdk_gc_set_clip_rectangle (gc, area);
+ gdk_gc_set_rgb_fg_color (gc, text_color);
+ gdk_draw_layout (icon_bar->priv->bin_window, gc, lx, ly, icon_bar->priv->layout);
+ g_object_unref (G_OBJECT (gc));
+ gdk_color_free (text_color);
}
- else if (icon_bar->priv->cursor_item == item)
+ else if (icon_bar->priv->cursor_item == item)
{
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "cursor-item-text-color", &text_color,
- NULL);
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "cursor-item-text-color", &text_color,
+ NULL);
- if (text_color == NULL)
+ if (text_color == NULL)
{
- text_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
- gdk_color_parse ("#000000", text_color);
+ text_color = gdk_color_copy (>K_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+ gdk_color_parse ("#000000", text_color);
}
- gc = gdk_gc_new (GDK_DRAWABLE (icon_bar->priv->bin_window));
- gdk_gc_copy (gc, GTK_WIDGET (icon_bar)->style->text_gc[GTK_STATE_SELECTED]);
- gdk_gc_set_clip_rectangle (gc, area);
- gdk_gc_set_rgb_fg_color (gc, text_color);
- gdk_draw_layout (icon_bar->priv->bin_window, gc, lx, ly, icon_bar->priv->layout);
- g_object_unref (G_OBJECT (gc));
- gdk_color_free (text_color);
+ gc = gdk_gc_new (GDK_DRAWABLE (icon_bar->priv->bin_window));
+ gdk_gc_copy (gc, GTK_WIDGET (icon_bar)->style->text_gc[GTK_STATE_SELECTED]);
+ gdk_gc_set_clip_rectangle (gc, area);
+ gdk_gc_set_rgb_fg_color (gc, text_color);
+ gdk_draw_layout (icon_bar->priv->bin_window, gc, lx, ly, icon_bar->priv->layout);
+ g_object_unref (G_OBJECT (gc));
+ gdk_color_free (text_color);
}
- else
+ else
{
- gtk_paint_layout (GTK_WIDGET (icon_bar)->style,
- icon_bar->priv->bin_window,
- GTK_STATE_NORMAL, TRUE, area,
- GTK_WIDGET (icon_bar), "icon_bar",
- lx, ly, icon_bar->priv->layout);
+ gtk_paint_layout (GTK_WIDGET (icon_bar)->style,
+ icon_bar->priv->bin_window,
+ GTK_STATE_NORMAL, TRUE, area,
+ GTK_WIDGET (icon_bar), "icon_bar",
+ lx, ly, icon_bar->priv->layout);
}
}
}
@@ -1334,141 +1427,144 @@ rstto_icon_bar_paint_item (RsttoIconBar *icon_bar,
static void
-rstto_icon_bar_calculate_item_size (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item)
+rstto_icon_bar_calculate_item_size (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item)
{
- GdkPixbuf *pixbuf;
- gint focus_width;
- gint focus_pad;
- gint int_pad;
+ GdkPixbuf *pixbuf;
+ gint focus_width;
+ gint focus_pad;
+ gint int_pad;
- if (G_LIKELY (item->width != -1 && item->width != -1))
- return;
+ if (G_LIKELY (item->width != -1 && item->width != -1))
+ return;
- gtk_widget_style_get (GTK_WIDGET (icon_bar),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- NULL);
- int_pad = focus_pad;
+ gtk_widget_style_get (GTK_WIDGET (icon_bar),
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+ int_pad = focus_pad;
- if (icon_bar->priv->pixbuf_column != -1)
+ if (icon_bar->priv->pixbuf_column != -1)
{
- pixbuf = rstto_icon_bar_get_item_icon (icon_bar, item);
- if (G_LIKELY (pixbuf != NULL))
+ pixbuf = rstto_icon_bar_get_item_icon (icon_bar, item);
+ if (G_LIKELY (pixbuf != NULL))
{
- item->pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- item->pixbuf_height = gdk_pixbuf_get_height (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
+ item->pixbuf_width = gdk_pixbuf_get_width (pixbuf);
+ item->pixbuf_height = gdk_pixbuf_get_height (pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
}
- else
+ else
{
- item->pixbuf_width = 0;
- item->pixbuf_height = 0;
+ item->pixbuf_width = 0;
+ item->pixbuf_height = 0;
}
}
- else
+ else
{
- item->pixbuf_width = 0;
- item->pixbuf_height = 0;
+ item->pixbuf_width = 0;
+ item->pixbuf_height = 0;
}
- if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
+ if (icon_bar->priv->text_column != -1 && icon_bar->priv->show_text == TRUE)
{
- rstto_icon_bar_update_item_text (icon_bar, item);
- pango_layout_get_pixel_size (icon_bar->priv->layout,
- &item->layout_width,
- &item->layout_height);
- item->width = MAX (item->layout_width, item->pixbuf_width) + 2 * ICON_TEXT_PADDING
- + 2 * (int_pad + focus_width + focus_pad);
- item->height = item->layout_height + 2 * (int_pad + focus_width + focus_pad + ICON_TEXT_PADDING)
- + item->pixbuf_height;
+ rstto_icon_bar_update_item_text (icon_bar, item);
+ pango_layout_get_pixel_size (icon_bar->priv->layout,
+ &item->layout_width,
+ &item->layout_height);
+ item->width = MAX (item->layout_width, item->pixbuf_width) + 2 * ICON_TEXT_PADDING
+ + 2 * (int_pad + focus_width + focus_pad);
+ item->height = item->layout_height + 2 * (int_pad + focus_width + focus_pad + ICON_TEXT_PADDING)
+ + item->pixbuf_height;
}
- else
+ else
{
- item->layout_width = 0;
- item->layout_height = 0;
+ item->layout_width = 0;
+ item->layout_height = 0;
- item->width = MAX (item->layout_width, item->pixbuf_width) + 2 *
-(int_pad + focus_width + focus_pad);
- item->height = item->layout_height + 2 * (int_pad + focus_width + focus_pad ) + item->pixbuf_height;
+ item->width = MAX (item->layout_width, item->pixbuf_width) + 2 *
+ (int_pad + focus_width + focus_pad);
+ item->height = item->layout_height + 2 * (int_pad + focus_width + focus_pad ) + item->pixbuf_height;
}
- if (item->width < item->height)
- {
- item->width = item->height;
- }
+ if (item->width < item->height)
+ {
+ item->width = item->height;
+ }
}
static void
-rstto_icon_bar_update_item_text (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item)
+rstto_icon_bar_update_item_text (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item)
{
- GtkTreePath *path;
- GtkTreeIter iter;
- gchar *text;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gchar *text;
- if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
+ if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
{
- path = gtk_tree_path_new_from_indices (item->index, -1);
- gtk_tree_model_get_iter (icon_bar->priv->model, &iter, path);
- gtk_tree_path_free (path);
+ path = gtk_tree_path_new_from_indices (item->index, -1);
+ gtk_tree_model_get_iter (icon_bar->priv->model, &iter, path);
+ gtk_tree_path_free (path);
}
- else
+ else
{
- iter = item->iter;
+ iter = item->iter;
}
- gtk_tree_model_get (icon_bar->priv->model, &iter,
- icon_bar->priv->text_column, &text,
- -1);
- pango_layout_set_text (icon_bar->priv->layout, text, -1);
- g_free (text);
+ gtk_tree_model_get (icon_bar->priv->model, &iter,
+ icon_bar->priv->text_column, &text,
+ -1);
+ pango_layout_set_text (icon_bar->priv->layout, text, -1);
+ g_free (text);
}
-static GdkPixbuf*
-rstto_icon_bar_get_item_icon (RsttoIconBar *icon_bar,
- RsttoIconBarItem *item)
+static GdkPixbuf *
+rstto_icon_bar_get_item_icon (
+ RsttoIconBar *icon_bar,
+ RsttoIconBarItem *item)
{
- GtkTreePath *path;
- GtkTreeIter iter;
- GdkPixbuf *pixbuf;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GdkPixbuf *pixbuf;
- if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
+ if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
{
- path = gtk_tree_path_new_from_indices (item->index, -1);
- gtk_tree_model_get_iter (icon_bar->priv->model, &iter, path);
- gtk_tree_path_free (path);
+ path = gtk_tree_path_new_from_indices (item->index, -1);
+ gtk_tree_model_get_iter (icon_bar->priv->model, &iter, path);
+ gtk_tree_path_free (path);
}
- else
+ else
{
- iter = item->iter;
+ iter = item->iter;
}
- gtk_tree_model_get (icon_bar->priv->model, &iter,
- icon_bar->priv->pixbuf_column, &pixbuf,
- -1);
+ gtk_tree_model_get (icon_bar->priv->model, &iter,
+ icon_bar->priv->pixbuf_column, &pixbuf,
+ -1);
- return pixbuf;
+ return pixbuf;
}
-static RsttoIconBarItem*
+static RsttoIconBarItem *
rstto_icon_bar_item_new (void)
{
- RsttoIconBarItem *item;
+ RsttoIconBarItem *item;
- item = g_slice_new0 (RsttoIconBarItem);
- item->width = -1;
- item->height = -1;
+ item = g_slice_new0 (RsttoIconBarItem);
+ item->width = -1;
+ item->height = -1;
- return item;
+ return item;
}
@@ -1476,7 +1572,7 @@ rstto_icon_bar_item_new (void)
static void
rstto_icon_bar_item_free (RsttoIconBarItem *item)
{
- g_slice_free (RsttoIconBarItem, item);
+ g_slice_free (RsttoIconBarItem, item);
}
@@ -1484,8 +1580,8 @@ rstto_icon_bar_item_free (RsttoIconBarItem *item)
static void
rstto_icon_bar_item_invalidate (RsttoIconBarItem *item)
{
- item->width = -1;
- item->height = -1;
+ item->width = -1;
+ item->height = -1;
}
@@ -1493,158 +1589,161 @@ rstto_icon_bar_item_invalidate (RsttoIconBarItem *item)
static void
rstto_icon_bar_build_items (RsttoIconBar *icon_bar)
{
- RsttoIconBarItem *item;
- GtkTreeIter iter;
- GList *items = NULL;
- gint i = 0;
+ RsttoIconBarItem *item;
+ GtkTreeIter iter;
+ GList *items = NULL;
+ gint i = 0;
- if (!gtk_tree_model_get_iter_first (icon_bar->priv->model, &iter))
- return;
+ if (!gtk_tree_model_get_iter_first (icon_bar->priv->model, &iter))
+ return;
- do
+ do
{
- item = rstto_icon_bar_item_new ();
- item->iter = iter;
- item->index = i++;
+ item = rstto_icon_bar_item_new ();
+ item->iter = iter;
+ item->index = i++;
- items = g_list_prepend (items, item);
+ items = g_list_prepend (items, item);
}
- while (gtk_tree_model_iter_next (icon_bar->priv->model, &iter));
+ while (gtk_tree_model_iter_next (icon_bar->priv->model, &iter));
- icon_bar->priv->items = g_list_reverse (items);
+ icon_bar->priv->items = g_list_reverse (items);
}
static void
-rstto_icon_bar_row_changed (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- RsttoIconBar *icon_bar)
+rstto_icon_bar_row_changed (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ RsttoIconBar *icon_bar)
{
- RsttoIconBarItem *item;
- gint idx;
+ RsttoIconBarItem *item;
+ gint idx;
- idx = gtk_tree_path_get_indices (path)[0];
- item = g_list_nth (icon_bar->priv->items, idx)->data;
- rstto_icon_bar_item_invalidate (item);
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
+ idx = gtk_tree_path_get_indices (path)[0];
+ item = g_list_nth (icon_bar->priv->items, idx)->data;
+ rstto_icon_bar_item_invalidate (item);
+ gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
}
static void
-rstto_icon_bar_row_inserted (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- RsttoIconBar *icon_bar)
+rstto_icon_bar_row_inserted (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ RsttoIconBar *icon_bar)
{
- RsttoIconBarItem *item;
- GList *lp;
- gint idx;
+ RsttoIconBarItem *item;
+ GList *lp;
+ gint idx;
- idx = gtk_tree_path_get_indices (path)[0];
- item = rstto_icon_bar_item_new ();
+ idx = gtk_tree_path_get_indices (path)[0];
+ item = rstto_icon_bar_item_new ();
- if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) != 0)
- item->iter = *iter;
- item->index = idx;
+ if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) != 0)
+ item->iter = *iter;
+ item->index = idx;
- icon_bar->priv->items = g_list_insert (icon_bar->priv->items, item, idx);
+ icon_bar->priv->items = g_list_insert (icon_bar->priv->items, item, idx);
- for (lp = g_list_nth (icon_bar->priv->items, idx + 1); lp != NULL; lp = lp->next)
+ for (lp = g_list_nth (icon_bar->priv->items, idx + 1); lp != NULL; lp = lp->next)
{
- item = lp->data;
- item->index++;
+ item = lp->data;
+ item->index++;
}
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
+ gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
}
static void
-rstto_icon_bar_row_deleted (GtkTreeModel *model,
- GtkTreePath *path,
- RsttoIconBar *icon_bar)
+rstto_icon_bar_row_deleted (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ RsttoIconBar *icon_bar)
{
- RsttoIconBarItem *item;
- gboolean active = FALSE;
- GList *lnext;
- GList *lp;
- gint idx;
+ RsttoIconBarItem *item;
+ gboolean active = FALSE;
+ GList *lnext;
+ GList *lp;
+ gint idx;
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- idx = gtk_tree_path_get_indices (path)[0];
- lp = g_list_nth (icon_bar->priv->items, idx);
- item = lp->data;
+ idx = gtk_tree_path_get_indices (path)[0];
+ lp = g_list_nth (icon_bar->priv->items, idx);
+ item = lp->data;
- if (item == icon_bar->priv->active_item)
+ if (item == icon_bar->priv->active_item)
{
- icon_bar->priv->active_item = NULL;
- active = TRUE;
+ icon_bar->priv->active_item = NULL;
+ active = TRUE;
}
- if (item == icon_bar->priv->cursor_item)
- icon_bar->priv->cursor_item = NULL;
+ if (item == icon_bar->priv->cursor_item)
+ icon_bar->priv->cursor_item = NULL;
- rstto_icon_bar_item_free (item);
+ rstto_icon_bar_item_free (item);
- for (lnext = lp->next; lnext != NULL; lnext = lnext->next)
+ for (lnext = lp->next; lnext != NULL; lnext = lnext->next)
{
- item = lnext->data;
- item->index--;
+ item = lnext->data;
+ item->index--;
}
- icon_bar->priv->items = g_list_delete_link (icon_bar->priv->items, lp);
+ icon_bar->priv->items = g_list_delete_link (icon_bar->priv->items, lp);
- if (active && icon_bar->priv->items != NULL)
- icon_bar->priv->active_item = icon_bar->priv->items->data;
+ if (active && icon_bar->priv->items != NULL)
+ icon_bar->priv->active_item = icon_bar->priv->items->data;
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
+ gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
- if (active)
- rstto_icon_bar_set_active (icon_bar, -1);
+ if (active)
+ rstto_icon_bar_set_active (icon_bar, -1);
}
-
static void
-rstto_icon_bar_rows_reordered (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gint *new_order,
- RsttoIconBar *icon_bar)
+rstto_icon_bar_rows_reordered (
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gint *new_order,
+ RsttoIconBar *icon_bar)
{
- RsttoIconBarItem **item_array;
- GList *items = NULL;
- GList *lp;
- gint *inverted_order;
- gint length;
- gint i;
+ RsttoIconBarItem **item_array;
+ GList *items = NULL;
+ GList *lp;
+ gint *inverted_order;
+ gint length;
+ gint i;
- length = gtk_tree_model_iter_n_children (model, NULL);
- inverted_order = g_newa (gint, length);
+ length = gtk_tree_model_iter_n_children (model, NULL);
+ inverted_order = g_newa (gint, length);
- /* invert the array */
- for (i = 0; i < length; ++i)
- inverted_order[new_order[i]] = i;
+ /* invert the array */
+ for (i = 0; i < length; ++i)
+ inverted_order[new_order[i]] = i;
- item_array = g_newa (RsttoIconBarItem *, length);
- for (i = 0, lp = icon_bar->priv->items; lp != NULL; ++i, lp = lp->next)
- item_array[inverted_order[i]] = lp->data;
+ item_array = g_newa (RsttoIconBarItem *, length);
+ for (i = 0, lp = icon_bar->priv->items; lp != NULL; ++i, lp = lp->next)
+ item_array[inverted_order[i]] = lp->data;
- for (i = 0; i < length; ++i)
+ for (i = 0; i < length; ++i)
{
- item_array[i]->index = i;
- items = g_list_append (items, item_array[i]);
+ item_array[i]->index = i;
+ items = g_list_append (items, item_array[i]);
}
- g_list_free (icon_bar->priv->items);
- icon_bar->priv->items = g_list_reverse (items);
+ g_list_free (icon_bar->priv->items);
+ icon_bar->priv->items = g_list_reverse (items);
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
+ gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
}
@@ -1656,10 +1755,10 @@ rstto_icon_bar_rows_reordered (GtkTreeModel *model,
*
* Returns: a newly allocated #RsttoIconBar.
**/
-GtkWidget*
+GtkWidget *
rstto_icon_bar_new (void)
{
- return g_object_new (RSTTO_TYPE_ICON_BAR, NULL);
+ return g_object_new (RSTTO_TYPE_ICON_BAR, NULL);
}
@@ -1673,14 +1772,14 @@ rstto_icon_bar_new (void)
*
* Returns: a newly allocated #RsttoIconBar, which is associated with @model.
**/
-GtkWidget*
+GtkWidget *
rstto_icon_bar_new_with_model (GtkTreeModel *model)
{
- g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
+ g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
- return g_object_new (RSTTO_TYPE_ICON_BAR,
- "model", model,
- NULL);
+ return g_object_new (RSTTO_TYPE_ICON_BAR,
+ "model", model,
+ NULL);
}
@@ -1697,8 +1796,8 @@ rstto_icon_bar_new_with_model (GtkTreeModel *model)
GtkTreeModel*
rstto_icon_bar_get_model (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), NULL);
- return icon_bar->priv->model;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), NULL);
+ return icon_bar->priv->model;
}
@@ -1713,86 +1812,87 @@ rstto_icon_bar_get_model (RsttoIconBar *icon_bar)
* then it will unset the old model.
**/
void
-rstto_icon_bar_set_model (RsttoIconBar *icon_bar,
- GtkTreeModel *model)
+rstto_icon_bar_set_model (
+ RsttoIconBar *icon_bar,
+ GtkTreeModel *model)
{
- GType pixbuf_column_type;
- GType text_column_type;
- gint active = -1;
+ GType pixbuf_column_type;
+ GType text_column_type;
+ gint active = -1;
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- g_return_if_fail (GTK_IS_TREE_MODEL (model) || model == NULL);
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (GTK_IS_TREE_MODEL (model) || model == NULL);
- if (G_UNLIKELY (model == icon_bar->priv->model))
- return;
+ if (G_UNLIKELY (model == icon_bar->priv->model))
+ return;
- if (model != NULL)
+ if (model != NULL)
{
- g_return_if_fail (gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_LIST_ONLY);
+ g_return_if_fail (gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_LIST_ONLY);
- if (icon_bar->priv->pixbuf_column != -1)
+ if (icon_bar->priv->pixbuf_column != -1)
{
- pixbuf_column_type = gtk_tree_model_get_column_type (model, icon_bar->priv->pixbuf_column);
- g_return_if_fail (pixbuf_column_type == GDK_TYPE_PIXBUF);
+ pixbuf_column_type = gtk_tree_model_get_column_type (model, icon_bar->priv->pixbuf_column);
+ g_return_if_fail (pixbuf_column_type == GDK_TYPE_PIXBUF);
}
- if (icon_bar->priv->text_column != -1)
+ if (icon_bar->priv->text_column != -1)
{
- text_column_type = gtk_tree_model_get_column_type (model, icon_bar->priv->text_column);
- g_return_if_fail (text_column_type == G_TYPE_STRING);
+ text_column_type = gtk_tree_model_get_column_type (model, icon_bar->priv->text_column);
+ g_return_if_fail (text_column_type == G_TYPE_STRING);
}
}
- if (icon_bar->priv->model)
+ if (icon_bar->priv->model)
{
- g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
- rstto_icon_bar_row_changed,
- icon_bar);
- g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
- rstto_icon_bar_row_inserted,
- icon_bar);
- g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
- rstto_icon_bar_row_deleted,
- icon_bar);
- g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
- rstto_icon_bar_rows_reordered,
- icon_bar);
-
- g_object_unref (G_OBJECT (icon_bar->priv->model));
-
- g_list_foreach (icon_bar->priv->items, (GFunc) rstto_icon_bar_item_free, NULL);
- g_list_free (icon_bar->priv->items);
- icon_bar->priv->active_item = NULL;
- icon_bar->priv->cursor_item = NULL;
- icon_bar->priv->items = NULL;
+ g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
+ rstto_icon_bar_row_changed,
+ icon_bar);
+ g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
+ rstto_icon_bar_row_inserted,
+ icon_bar);
+ g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
+ rstto_icon_bar_row_deleted,
+ icon_bar);
+ g_signal_handlers_disconnect_by_func (icon_bar->priv->model,
+ rstto_icon_bar_rows_reordered,
+ icon_bar);
+
+ g_object_unref (G_OBJECT (icon_bar->priv->model));
+
+ g_list_foreach (icon_bar->priv->items, (GFunc) rstto_icon_bar_item_free, NULL);
+ g_list_free (icon_bar->priv->items);
+ icon_bar->priv->active_item = NULL;
+ icon_bar->priv->cursor_item = NULL;
+ icon_bar->priv->items = NULL;
}
- icon_bar->priv->model = model;
+ icon_bar->priv->model = model;
- if (model != NULL)
+ if (model != NULL)
{
- g_object_ref (G_OBJECT (model));
+ g_object_ref (G_OBJECT (model));
- g_signal_connect (G_OBJECT (model), "row-changed",
- G_CALLBACK (rstto_icon_bar_row_changed), icon_bar);
- g_signal_connect (G_OBJECT (model), "row-inserted",
- G_CALLBACK (rstto_icon_bar_row_inserted), icon_bar);
- g_signal_connect (G_OBJECT (model), "row-deleted",
- G_CALLBACK (rstto_icon_bar_row_deleted), icon_bar);
- g_signal_connect (G_OBJECT (model), "rows-reordered",
- G_CALLBACK (rstto_icon_bar_rows_reordered), icon_bar);
+ g_signal_connect (G_OBJECT (model), "row-changed",
+ G_CALLBACK (rstto_icon_bar_row_changed), icon_bar);
+ g_signal_connect (G_OBJECT (model), "row-inserted",
+ G_CALLBACK (rstto_icon_bar_row_inserted), icon_bar);
+ g_signal_connect (G_OBJECT (model), "row-deleted",
+ G_CALLBACK (rstto_icon_bar_row_deleted), icon_bar);
+ g_signal_connect (G_OBJECT (model), "rows-reordered",
+ G_CALLBACK (rstto_icon_bar_rows_reordered), icon_bar);
- rstto_icon_bar_build_items (icon_bar);
+ rstto_icon_bar_build_items (icon_bar);
- if (icon_bar->priv->items != NULL)
- active = ((RsttoIconBarItem *) icon_bar->priv->items->data)->index;
+ if (icon_bar->priv->items != NULL)
+ active = ((RsttoIconBarItem *) icon_bar->priv->items->data)->index;
}
- rstto_icon_bar_invalidate (icon_bar);
+ rstto_icon_bar_invalidate (icon_bar);
- g_object_notify (G_OBJECT (icon_bar), "model");
+ g_object_notify (G_OBJECT (icon_bar), "model");
- rstto_icon_bar_set_active (icon_bar, active);
+ rstto_icon_bar_set_active (icon_bar, active);
}
@@ -1808,8 +1908,8 @@ rstto_icon_bar_set_model (RsttoIconBar *icon_bar,
gint
rstto_icon_bar_get_pixbuf_column (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
- return icon_bar->priv->pixbuf_column;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
+ return icon_bar->priv->pixbuf_column;
}
@@ -1823,34 +1923,35 @@ rstto_icon_bar_get_pixbuf_column (RsttoIconBar *icon_bar)
* column must be of type #GDK_TYPE_PIXBUF.
**/
void
-rstto_icon_bar_set_pixbuf_column (RsttoIconBar *icon_bar,
- gint column)
+rstto_icon_bar_set_pixbuf_column (
+ RsttoIconBar *icon_bar,
+ gint column)
{
- GType pixbuf_column_type;
+ GType pixbuf_column_type;
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- if (column == icon_bar->priv->pixbuf_column)
- return;
+ if (column == icon_bar->priv->pixbuf_column)
+ return;
- if (column == -1)
+ if (column == -1)
{
- icon_bar->priv->pixbuf_column = -1;
+ icon_bar->priv->pixbuf_column = -1;
}
- else
+ else
{
- if (icon_bar->priv->model != NULL)
+ if (icon_bar->priv->model != NULL)
{
- pixbuf_column_type = gtk_tree_model_get_column_type (icon_bar->priv->model, column);
- g_return_if_fail (pixbuf_column_type == GDK_TYPE_PIXBUF);
+ pixbuf_column_type = gtk_tree_model_get_column_type (icon_bar->priv->model, column);
+ g_return_if_fail (pixbuf_column_type == GDK_TYPE_PIXBUF);
}
- icon_bar->priv->pixbuf_column = column;
+ icon_bar->priv->pixbuf_column = column;
}
- rstto_icon_bar_invalidate (icon_bar);
+ rstto_icon_bar_invalidate (icon_bar);
- g_object_notify (G_OBJECT (icon_bar), "pixbuf-column");
+ g_object_notify (G_OBJECT (icon_bar), "pixbuf-column");
}
@@ -1866,8 +1967,8 @@ rstto_icon_bar_set_pixbuf_column (RsttoIconBar *icon_bar,
gint
rstto_icon_bar_get_text_column (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
- return icon_bar->priv->text_column;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
+ return icon_bar->priv->text_column;
}
@@ -1882,34 +1983,35 @@ rstto_icon_bar_get_text_column (RsttoIconBar *icon_bar)
* text column must be of type #G_TYPE_STRING.
**/
void
-rstto_icon_bar_set_text_column (RsttoIconBar *icon_bar,
- gint column)
+rstto_icon_bar_set_text_column (
+ RsttoIconBar *icon_bar,
+ gint column)
{
- GType text_column_type;
+ GType text_column_type;
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- if (column == icon_bar->priv->text_column)
- return;
+ if (column == icon_bar->priv->text_column)
+ return;
- if (column == -1)
+ if (column == -1)
{
- icon_bar->priv->text_column = -1;
+ icon_bar->priv->text_column = -1;
}
- else
+ else
{
- if (icon_bar->priv->model != NULL)
+ if (icon_bar->priv->model != NULL)
{
- text_column_type = gtk_tree_model_get_column_type (icon_bar->priv->model, column);
- g_return_if_fail (text_column_type == G_TYPE_STRING);
+ text_column_type = gtk_tree_model_get_column_type (icon_bar->priv->model, column);
+ g_return_if_fail (text_column_type == G_TYPE_STRING);
}
- icon_bar->priv->text_column = column;
+ icon_bar->priv->text_column = column;
}
- rstto_icon_bar_invalidate (icon_bar);
+ rstto_icon_bar_invalidate (icon_bar);
- g_object_notify (G_OBJECT (icon_bar), "text-column");
+ g_object_notify (G_OBJECT (icon_bar), "text-column");
}
@@ -1926,8 +2028,8 @@ rstto_icon_bar_set_text_column (RsttoIconBar *icon_bar,
GtkOrientation
rstto_icon_bar_get_orientation (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), GTK_ORIENTATION_VERTICAL);
- return icon_bar->priv->orientation;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), GTK_ORIENTATION_VERTICAL);
+ return icon_bar->priv->orientation;
}
@@ -1941,20 +2043,21 @@ rstto_icon_bar_get_orientation (RsttoIconBar *icon_bar)
* or vertically.
**/
void
-rstto_icon_bar_set_orientation (RsttoIconBar *icon_bar,
- GtkOrientation orientation)
+rstto_icon_bar_set_orientation (
+ RsttoIconBar *icon_bar,
+ GtkOrientation orientation)
{
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- if (icon_bar->priv->orientation != orientation)
+ if (icon_bar->priv->orientation != orientation)
{
- icon_bar->priv->orientation = orientation;
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
+ icon_bar->priv->orientation = orientation;
+ gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
- /* If the orientation changes, focus the active item */
- rstto_icon_bar_show_active (icon_bar);
+ /* If the orientation changes, focus the active item */
+ rstto_icon_bar_show_active (icon_bar);
- g_object_notify (G_OBJECT (icon_bar), "orientation");
+ g_object_notify (G_OBJECT (icon_bar), "orientation");
}
}
@@ -1973,9 +2076,9 @@ rstto_icon_bar_set_orientation (RsttoIconBar *icon_bar,
gint
rstto_icon_bar_get_active (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), -1);
- return (icon_bar->priv->active_item != NULL)
+ return (icon_bar->priv->active_item != NULL)
? icon_bar->priv->active_item->index
: -1;
}
@@ -1991,24 +2094,25 @@ rstto_icon_bar_get_active (RsttoIconBar *icon_bar)
* Sets the active item of @icon_bar to be the item at @idx.
**/
void
-rstto_icon_bar_set_active (RsttoIconBar *icon_bar,
- gint idx)
+rstto_icon_bar_set_active (
+ RsttoIconBar *icon_bar,
+ gint idx)
{
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- g_return_if_fail (idx == -1 || g_list_nth (icon_bar->priv->items, idx) != NULL);
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (idx == -1 || g_list_nth (icon_bar->priv->items, idx) != NULL);
- if ((icon_bar->priv->active_item == NULL && idx == -1)
- || (icon_bar->priv->active_item != NULL && idx == icon_bar->priv->active_item->index))
- return;
+ if ((icon_bar->priv->active_item == NULL && idx == -1)
+ || (icon_bar->priv->active_item != NULL && idx == icon_bar->priv->active_item->index))
+ return;
- if (G_UNLIKELY (idx >= 0))
- icon_bar->priv->active_item = g_list_nth (icon_bar->priv->items, idx)->data;
- else
- icon_bar->priv->active_item = NULL;
+ if (G_UNLIKELY (idx >= 0))
+ icon_bar->priv->active_item = g_list_nth (icon_bar->priv->items, idx)->data;
+ else
+ icon_bar->priv->active_item = NULL;
- g_signal_emit (G_OBJECT (icon_bar), icon_bar_signals[SELECTION_CHANGED], 0);
- g_object_notify (G_OBJECT (icon_bar), "active");
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
+ g_signal_emit (G_OBJECT (icon_bar), icon_bar_signals[SELECTION_CHANGED], 0);
+ g_object_notify (G_OBJECT (icon_bar), "active");
+ gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
}
@@ -2023,31 +2127,32 @@ rstto_icon_bar_set_active (RsttoIconBar *icon_bar,
* Returns: %TRUE if @iter was set.
**/
gboolean
-rstto_icon_bar_get_active_iter (RsttoIconBar *icon_bar,
- GtkTreeIter *iter)
+rstto_icon_bar_get_active_iter (
+ RsttoIconBar *icon_bar,
+ GtkTreeIter *iter)
{
- RsttoIconBarItem *item;
- GtkTreePath *path;
+ RsttoIconBarItem *item;
+ GtkTreePath *path;
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
- g_return_val_if_fail (iter != NULL, FALSE);
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
+ g_return_val_if_fail (iter != NULL, FALSE);
- item = icon_bar->priv->active_item;
- if (item == NULL)
- return FALSE;
+ item = icon_bar->priv->active_item;
+ if (item == NULL)
+ return FALSE;
- if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
+ if ((gtk_tree_model_get_flags (icon_bar->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST) == 0)
{
- path = gtk_tree_path_new_from_indices (item->index, -1);
- gtk_tree_model_get_iter (icon_bar->priv->model, iter, path);
- gtk_tree_path_free (path);
+ path = gtk_tree_path_new_from_indices (item->index, -1);
+ gtk_tree_model_get_iter (icon_bar->priv->model, iter, path);
+ gtk_tree_path_free (path);
}
- else
+ else
{
- *iter = item->iter;
+ *iter = item->iter;
}
- return TRUE;
+ return TRUE;
}
@@ -2063,20 +2168,21 @@ rstto_icon_bar_get_active_iter (RsttoIconBar *icon_bar,
* This can only be called if @icon_bar is associated with #GtkTreeModel.
**/
void
-rstto_icon_bar_set_active_iter (RsttoIconBar *icon_bar,
- GtkTreeIter *iter)
+rstto_icon_bar_set_active_iter (
+ RsttoIconBar *icon_bar,
+ GtkTreeIter *iter)
{
- GtkTreePath *path;
+ GtkTreePath *path;
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- g_return_if_fail (icon_bar->priv->model != NULL);
- g_return_if_fail (iter != NULL);
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ g_return_if_fail (icon_bar->priv->model != NULL);
+ g_return_if_fail (iter != NULL);
- path = gtk_tree_model_get_path (icon_bar->priv->model, iter);
- if (G_LIKELY (path != NULL))
+ path = gtk_tree_model_get_path (icon_bar->priv->model, iter);
+ if (G_LIKELY (path != NULL))
{
- rstto_icon_bar_set_active (icon_bar, gtk_tree_path_get_indices (path)[0]);
- gtk_tree_path_free (path);
+ rstto_icon_bar_set_active (icon_bar, gtk_tree_path_get_indices (path)[0]);
+ gtk_tree_path_free (path);
}
}
@@ -2087,12 +2193,13 @@ rstto_icon_bar_get_item_width (RsttoIconBar *icon_bar)
}
void
-rstto_icon_bar_set_item_width (RsttoIconBar *icon_bar,
- gint item_width)
+rstto_icon_bar_set_item_width (
+ RsttoIconBar *icon_bar,
+ gint item_width)
{
- pango_layout_set_width (icon_bar->priv->layout,
- item_width*PANGO_SCALE);
- return;
+ pango_layout_set_width (icon_bar->priv->layout,
+ item_width*PANGO_SCALE);
+ return;
}
/**
@@ -2104,11 +2211,12 @@ rstto_icon_bar_set_item_width (RsttoIconBar *icon_bar,
* Toggles the visibility of the text-label
**/
void
-rstto_icon_bar_set_show_text (RsttoIconBar *icon_bar,
- gboolean show_text)
+rstto_icon_bar_set_show_text (
+ RsttoIconBar *icon_bar,
+ gboolean show_text)
{
- g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
- icon_bar->priv->show_text = show_text;
+ g_return_if_fail (RSTTO_IS_ICON_BAR (icon_bar));
+ icon_bar->priv->show_text = show_text;
}
/**
@@ -2120,8 +2228,8 @@ rstto_icon_bar_set_show_text (RsttoIconBar *icon_bar,
gboolean
rstto_icon_bar_get_show_text (RsttoIconBar *icon_bar)
{
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
- return icon_bar->priv->show_text;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
+ return icon_bar->priv->show_text;
}
/**
@@ -2133,40 +2241,40 @@ rstto_icon_bar_get_show_text (RsttoIconBar *icon_bar)
gboolean
rstto_icon_bar_show_active (RsttoIconBar *icon_bar)
{
- gint page_size = 0;
- gint value = 0;
+ gint page_size = 0;
+ gint value = 0;
- g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
- if (NULL == icon_bar->priv->active_item)
- return FALSE;
+ g_return_val_if_fail (RSTTO_IS_ICON_BAR (icon_bar), FALSE);
+ if (NULL == icon_bar->priv->active_item)
+ return FALSE;
- icon_bar->priv->auto_center = TRUE;
+ icon_bar->priv->auto_center = TRUE;
- if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- page_size = gtk_adjustment_get_page_size (icon_bar->priv->vadjustment);
- value = icon_bar->priv->active_item->index * icon_bar->priv->item_height - ((page_size-icon_bar->priv->item_height)/2);
+ page_size = gtk_adjustment_get_page_size (icon_bar->priv->vadjustment);
+ value = icon_bar->priv->active_item->index * icon_bar->priv->item_height - ((page_size-icon_bar->priv->item_height)/2);
- if (value > (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size))
- value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
+ if (value > (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size))
+ value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
- gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
- gtk_adjustment_changed (icon_bar->priv->vadjustment);
- icon_bar->priv->auto_center = TRUE;
- return TRUE;
+ gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
+ gtk_adjustment_changed (icon_bar->priv->vadjustment);
+ icon_bar->priv->auto_center = TRUE;
+ return TRUE;
}
- else
+ else
{
- page_size = gtk_adjustment_get_page_size (icon_bar->priv->hadjustment);
- value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
+ page_size = gtk_adjustment_get_page_size (icon_bar->priv->hadjustment);
+ value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
- if (value > (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size))
- value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
+ if (value > (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size))
+ value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
- gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
- gtk_adjustment_changed (icon_bar->priv->hadjustment);
- icon_bar->priv->auto_center = TRUE;
- return TRUE;
+ gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
+ gtk_adjustment_changed (icon_bar->priv->hadjustment);
+ icon_bar->priv->auto_center = TRUE;
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
diff --git a/src/xfce_wallpaper_manager.c b/src/xfce_wallpaper_manager.c
index f7e3470..07d1011 100644
--- a/src/xfce_wallpaper_manager.c
+++ b/src/xfce_wallpaper_manager.c
@@ -409,6 +409,11 @@ rstto_xfce_wallpaper_manager_init (GObject *object)
monitor_geometry.height);
}
+ rstto_monitor_chooser_add (
+ RSTTO_MONITOR_CHOOSER (manager->priv->monitor_chooser),
+ 800,
+ 600);
+
gtk_box_pack_start (
GTK_BOX (vbox),
manager->priv->monitor_chooser,
More information about the Xfce4-commits
mailing list