aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-tree.c')
-rw-r--r--widgets/table/e-tree.c105
1 files changed, 58 insertions, 47 deletions
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 39bfd40d6c..4471514d68 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -98,7 +98,11 @@ enum {
PROP_DRAW_FOCUS,
PROP_ETTA,
PROP_UNIFORM_ROW_HEIGHT,
- PROP_ALWAYS_SEARCH
+ PROP_ALWAYS_SEARCH,
+ PROP_HADJUSTMENT,
+ PROP_VADJUSTMENT,
+ PROP_HSCROLL_POLICY,
+ PROP_VSCROLL_POLICY
};
enum {
@@ -248,7 +252,8 @@ static void hover_off (ETree *et);
static void hover_on (ETree *et, gint x, gint y);
static void context_destroyed (gpointer data, GObject *ctx);
-G_DEFINE_TYPE (ETree, e_tree, GTK_TYPE_TABLE)
+G_DEFINE_TYPE_WITH_CODE (ETree, e_tree, GTK_TYPE_TABLE,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
static void
et_disconnect_from_etta (ETree *et)
@@ -1915,6 +1920,30 @@ et_get_property (GObject *object,
case PROP_ALWAYS_SEARCH:
g_value_set_boolean (value, etree->priv->always_search);
break;
+ case PROP_HADJUSTMENT:
+ if (etree->priv->table_canvas)
+ g_object_get_property (G_OBJECT (etree->priv->table_canvas), "hadjustment", value);
+ else
+ g_value_set_object (value, NULL);
+ break;
+ case PROP_VADJUSTMENT:
+ if (etree->priv->table_canvas)
+ g_object_get_property (G_OBJECT (etree->priv->table_canvas), "vadjustment", value);
+ else
+ g_value_set_object (value, NULL);
+ break;
+ case PROP_HSCROLL_POLICY:
+ if (etree->priv->table_canvas)
+ g_object_get_property (G_OBJECT (etree->priv->table_canvas), "hscroll-policy", value);
+ else
+ g_value_set_enum (value, 0);
+ break;
+ case PROP_VSCROLL_POLICY:
+ if (etree->priv->table_canvas)
+ g_object_get_property (G_OBJECT (etree->priv->table_canvas), "vscroll-policy", value);
+ else
+ g_value_set_enum (value, 0);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1986,32 +2015,23 @@ et_set_property (GObject *object,
etree->priv->always_search = g_value_get_boolean (value);
clear_current_search_col (etree);
break;
- }
-}
-
-static void
-set_scroll_adjustments (ETree *tree,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- if (vadjustment != NULL)
- gtk_adjustment_set_step_increment (vadjustment, 20);
-
- if (hadjustment != NULL)
- gtk_adjustment_set_step_increment (hadjustment, 20);
- /* XXX This can be called after our dispose() method has run. */
- if (tree->priv->table_canvas != NULL) {
- GtkScrollable *scrollable;
-
- scrollable = GTK_SCROLLABLE (tree->priv->table_canvas);
- gtk_scrollable_set_hadjustment (scrollable, hadjustment);
- gtk_scrollable_set_vadjustment (scrollable, vadjustment);
-
- if (tree->priv->header_canvas != NULL) {
- scrollable = GTK_SCROLLABLE (tree->priv->header_canvas);
- gtk_scrollable_set_hadjustment (scrollable, hadjustment);
- }
+ case PROP_HADJUSTMENT:
+ if (etree->priv->table_canvas)
+ g_object_set_property (G_OBJECT (etree->priv->table_canvas), "hadjustment", value);
+ break;
+ case PROP_VADJUSTMENT:
+ if (etree->priv->table_canvas)
+ g_object_set_property (G_OBJECT (etree->priv->table_canvas), "vadjustment", value);
+ break;
+ case PROP_HSCROLL_POLICY:
+ if (etree->priv->table_canvas)
+ g_object_set_property (G_OBJECT (etree->priv->table_canvas), "hscroll-policy", value);
+ break;
+ case PROP_VSCROLL_POLICY:
+ if (etree->priv->table_canvas)
+ g_object_set_property (G_OBJECT (etree->priv->table_canvas), "vscroll-policy", value);
+ break;
}
}
@@ -2353,9 +2373,7 @@ struct _ETreeDragSourceSite
GdkModifierType start_button_mask;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction actions; /* Possible actions */
- GdkColormap *colormap; /* Colormap for drag icon */
- GdkPixmap *pixmap; /* Icon for drag data */
- GdkBitmap *mask;
+ GdkPixbuf *pixbuf; /* Icon for drag data */
/* Stored button press information to detect drag beginning */
gint state;
@@ -2576,11 +2594,10 @@ et_real_start_drag (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *e
info = g_dataset_get_data (context, "gtk-info");
if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
+ if (site->pixbuf)
+ gtk_drag_set_icon_pixbuf (context,
+ site->pixbuf,
+ -2, -2);
else
gtk_drag_set_icon_default (context);
}
@@ -3464,18 +3481,6 @@ e_tree_class_init (ETreeClass *class)
G_TYPE_UINT,
G_TYPE_UINT);
- class->set_scroll_adjustments = set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, set_scroll_adjustments),
- NULL, NULL,
- e_marshal_NONE__OBJECT_OBJECT,
- G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-
g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
g_param_spec_int ("length_threshold",
"Length Threshold",
@@ -3542,6 +3547,12 @@ e_tree_class_init (ETreeClass *class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /* Scrollable interface */
+ g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
+ g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
+ g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
+ g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
+
gal_a11y_e_tree_init ();
}