* Authors: Kristian Rietveld <kris@imendio.com>
*/
-#include <gtk/gtk.h>
-
-#include <libempathy/empathy-utils.h>
+#include "config.h"
#include "empathy-cell-renderer-expander.h"
+#include "empathy-utils.h"
+
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCellRendererExpander)
typedef struct {
GtkExpanderStyle expander_style;
static void
empathy_cell_renderer_expander_finalize (GObject *object)
{
- EmpathyCellRendererExpanderPriv *priv;
-
- priv = GET_PRIV (object);
-
(* G_OBJECT_CLASS (empathy_cell_renderer_expander_parent_class)->finalize) (object);
}
EmpathyCellRendererExpanderPriv *priv;
gint x_offset, y_offset;
guint xpad, ypad;
-
+ GtkStyleContext *style;
+ GtkStateFlags state;
expander = (EmpathyCellRendererExpander *) cell;
priv = GET_PRIV (expander);
"ypad", &ypad,
NULL);
- gtk_render_expander (gtk_widget_get_style_context (widget),
+ style = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (style);
+ gtk_style_context_add_class (style, GTK_STYLE_CLASS_EXPANDER);
+
+ state = gtk_cell_renderer_get_state (cell, widget, flags);
+
+ if (priv->expander_style == GTK_EXPANDER_COLLAPSED)
+ state |= GTK_STATE_FLAG_NORMAL;
+ else
+ state |= GTK_STATE_FLAG_ACTIVE;
+
+ gtk_style_context_set_state (style, state);
+
+ gtk_render_expander (style,
cr,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
priv->expander_size,
priv->expander_size);
+
+ gtk_style_context_restore (style);
}
static gboolean
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
- EmpathyCellRendererExpander *expander;
EmpathyCellRendererExpanderPriv *priv;
GtkTreePath *path;
- expander = EMPATHY_CELL_RENDERER_EXPANDER (cell);
priv = GET_PRIV (cell);
if (!GTK_IS_TREE_VIEW (widget) || !priv->activatable)