[evolution/gtk3] Implement GtkScrollable interface on ETree/ETable widgets
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gtk3] Implement GtkScrollable interface on ETree/ETable widgets
- Date: Tue, 14 Dec 2010 19:49:33 +0000 (UTC)
commit b7edc502923a156a1d63f414d41b518bfa4a0e6e
Author: Milan Crha <mcrha redhat com>
Date: Tue Dec 14 20:48:16 2010 +0100
Implement GtkScrollable interface on ETree/ETable widgets
widgets/table/e-table.c | 70 ++++++++++++++++++++++++++++++++++-----------
widgets/table/e-tree.c | 72 +++++++++++++++++++++++++++++++++++------------
2 files changed, 107 insertions(+), 35 deletions(-)
---
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index f611718..509ce0f 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -103,7 +103,11 @@ enum {
PROP_MODEL,
PROP_UNIFORM_ROW_HEIGHT,
PROP_ALWAYS_SEARCH,
- PROP_USE_CLICK_TO_ADD
+ PROP_USE_CLICK_TO_ADD,
+ PROP_HADJUSTMENT,
+ PROP_VADJUSTMENT,
+ PROP_HSCROLL_POLICY,
+ PROP_VSCROLL_POLICY
};
enum {
@@ -166,7 +170,8 @@ static gint et_focus (GtkWidget *container, GtkDirectionType direction);
static void scroll_off (ETable *et);
static void scroll_on (ETable *et, guint scroll_direction);
-G_DEFINE_TYPE (ETable, e_table, GTK_TYPE_TABLE)
+G_DEFINE_TYPE_WITH_CODE (ETable, e_table, GTK_TYPE_TABLE,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
static void
et_disconnect_model (ETable *et)
@@ -2251,6 +2256,30 @@ et_get_property (GObject *object,
case PROP_USE_CLICK_TO_ADD:
g_value_set_boolean (value, etable->use_click_to_add);
break;
+ case PROP_HADJUSTMENT:
+ if (etable->table_canvas)
+ g_object_get_property (G_OBJECT (etable->table_canvas), "hadjustment", value);
+ else
+ g_value_set_object (value, NULL);
+ break;
+ case PROP_VADJUSTMENT:
+ if (etable->table_canvas)
+ g_object_get_property (G_OBJECT (etable->table_canvas), "vadjustment", value);
+ else
+ g_value_set_object (value, NULL);
+ break;
+ case PROP_HSCROLL_POLICY:
+ if (etable->table_canvas)
+ g_object_get_property (G_OBJECT (etable->table_canvas), "hscroll-policy", value);
+ else
+ g_value_set_enum (value, 0);
+ break;
+ case PROP_VSCROLL_POLICY:
+ if (etable->table_canvas)
+ g_object_get_property (G_OBJECT (etable->table_canvas), "vscroll-policy", value);
+ else
+ g_value_set_enum (value, 0);
+ break;
default:
break;
}
@@ -2323,6 +2352,22 @@ et_set_property (GObject *object,
etable->click_to_add = NULL;
}
break;
+ case PROP_HADJUSTMENT:
+ if (etable->table_canvas)
+ g_object_set_property (G_OBJECT (etable->table_canvas), "hadjustment", value);
+ break;
+ case PROP_VADJUSTMENT:
+ if (etable->table_canvas)
+ g_object_set_property (G_OBJECT (etable->table_canvas), "vadjustment", value);
+ break;
+ case PROP_HSCROLL_POLICY:
+ if (etable->table_canvas)
+ g_object_set_property (G_OBJECT (etable->table_canvas), "hscroll-policy", value);
+ break;
+ case PROP_VSCROLL_POLICY:
+ if (etable->table_canvas)
+ g_object_set_property (G_OBJECT (etable->table_canvas), "vscroll-policy", value);
+ break;
}
}
@@ -3449,21 +3494,6 @@ e_table_class_init (ETableClass *class)
G_TYPE_UINT,
G_TYPE_UINT);
- /*FIXME:
- * Implement the GtkScrollable interface as
- * ::set-scroll-adjustments signal on GtkWidget
- * has been deprecated from gtk3
- * 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 (ETableClass, 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",
@@ -3509,5 +3539,11 @@ e_table_class_init (ETableClass *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_table_init ();
}
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index c12f358..08e172c 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -97,7 +97,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 {
@@ -247,7 +251,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)
@@ -1950,6 +1955,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;
@@ -2021,6 +2050,23 @@ et_set_property (GObject *object,
etree->priv->always_search = g_value_get_boolean (value);
clear_current_search_col (etree);
break;
+
+ 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;
}
}
@@ -3488,22 +3534,6 @@ e_tree_class_init (ETreeClass *class)
G_TYPE_UINT,
G_TYPE_UINT);
- /*FIXME:
- * Implement the GtkScrollable interface as
- * ::set-scroll-adjustments signal on GtkWidget
- * has been deprecated from gtk3
- 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",
@@ -3559,6 +3589,12 @@ e_tree_class_init (ETreeClass *class)
10,
G_PARAM_READABLE));
+ /* 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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]