aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-01-31 03:03:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-08 23:05:26 +0800
commit72797decc12602b181f69dba7c54df7a0d1b9326 (patch)
treeecd1314c92bc26b59647b351b2d47e446f4ed21d /widgets
parent3ba0b61f9f447b01c3a83bfb78ee33a45d413700 (diff)
downloadgsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.gz
gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.zst
gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.zip
Giant leap towards GSEAL compliance.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c10
-rw-r--r--widgets/menus/gal-define-views-dialog.c11
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.c11
-rw-r--r--widgets/menus/gal-view-new-dialog.c20
-rw-r--r--widgets/misc/e-activity-proxy.c2
-rw-r--r--widgets/misc/e-buffer-tagger.c4
-rw-r--r--widgets/misc/e-calendar-item.c4
-rw-r--r--widgets/misc/e-calendar.c17
-rw-r--r--widgets/misc/e-canvas-background.c4
-rw-r--r--widgets/misc/e-canvas.c4
-rw-r--r--widgets/misc/e-dateedit.c4
-rw-r--r--widgets/misc/e-hinted-entry.c4
-rw-r--r--widgets/misc/e-map.c41
-rw-r--r--widgets/misc/e-online-button.c4
-rw-r--r--widgets/misc/e-search-bar.c4
-rw-r--r--widgets/table/e-cell-combo.c102
-rw-r--r--widgets/table/e-cell-date-edit.c38
-rw-r--r--widgets/table/e-cell-popup.c8
-rw-r--r--widgets/table/e-cell-text.c53
-rw-r--r--widgets/table/e-cell-toggle.c4
-rw-r--r--widgets/table/e-cell-tree.c72
-rw-r--r--widgets/table/e-table-click-to-add.c67
-rw-r--r--widgets/table/e-table-config.c50
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c17
-rw-r--r--widgets/table/e-table-field-chooser-item.c40
-rw-r--r--widgets/table/e-table-field-chooser.c4
-rw-r--r--widgets/table/e-table-group-container.c4
-rw-r--r--widgets/table/e-table-header-item.c160
-rw-r--r--widgets/table/e-table-header-utils.c4
-rw-r--r--widgets/table/e-table-item.c53
-rw-r--r--widgets/table/e-table-utils.c5
-rw-r--r--widgets/table/e-table.c286
-rw-r--r--widgets/table/e-tree.c364
-rw-r--r--widgets/table/gal-a11y-e-cell-popup.c5
-rw-r--r--widgets/table/gal-a11y-e-cell-toggle.c9
-rw-r--r--widgets/table/gal-a11y-e-table-click-to-add.c28
-rw-r--r--widgets/table/gal-a11y-e-table.c8
-rw-r--r--widgets/text/e-reflow.c193
-rw-r--r--widgets/text/e-text.c12
-rw-r--r--widgets/text/gal-a11y-e-text.c4
40 files changed, 1066 insertions, 668 deletions
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 3dc5f35709..250cc1d32d 100644
--- a/widgets/e-timezone-dialog/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -261,6 +261,7 @@ ETimezoneDialog *
e_timezone_dialog_construct (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
+ GtkWidget *widget;
GtkWidget *map;
g_return_val_if_fail (etd != NULL, NULL);
@@ -280,10 +281,11 @@ e_timezone_dialog_construct (ETimezoneDialog *etd)
goto error;
}
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (priv->app)->vbox), 0);
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (priv->app)->action_area), 12);
+ widget = gtk_dialog_get_content_area (GTK_DIALOG (priv->app));
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (GTK_DIALOG (priv->app));
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
priv->map = e_map_new ();
map = GTK_WIDGET (priv->map);
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
index ba50623b44..54d0677cdc 100644
--- a/widgets/menus/gal-define-views-dialog.c
+++ b/widgets/menus/gal-define-views-dialog.c
@@ -223,6 +223,8 @@ dialog_response (GalDefineViewsDialog *dialog, gint response_id, gpointer data)
static void
gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->collection = NULL;
@@ -236,11 +238,16 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 270);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c
index 14e8d79d3c..b713f68000 100644
--- a/widgets/menus/gal-view-instance-save-as-dialog.c
+++ b/widgets/menus/gal-view-instance-save-as-dialog.c
@@ -229,6 +229,8 @@ gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *k
static void
gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->instance = NULL;
@@ -245,11 +247,16 @@ gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
/* TODO: add position/size saving/restoring */
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 360);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
index 356813c6fa..f364bf0779 100644
--- a/widgets/menus/gal-view-new-dialog.c
+++ b/widgets/menus/gal-view-new-dialog.c
@@ -73,6 +73,8 @@ gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
static void
gal_view_new_dialog_init (GalViewNewDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->builder = gtk_builder_new ();
@@ -83,15 +85,21 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog)
if (!widget) {
return;
}
+
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_resizable (GTK_WINDOW(dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
diff --git a/widgets/misc/e-activity-proxy.c b/widgets/misc/e-activity-proxy.c
index 825aae04d6..c503e5e26d 100644
--- a/widgets/misc/e-activity-proxy.c
+++ b/widgets/misc/e-activity-proxy.c
@@ -278,7 +278,7 @@ activity_proxy_init (EActivityProxy *proxy)
widget = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (widget));
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 3);
proxy->priv->spinner = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c
index 9501f29d6a..b3d5a4e61e 100644
--- a/widgets/misc/e-buffer-tagger.c
+++ b/widgets/misc/e-buffer-tagger.c
@@ -308,11 +308,7 @@ update_mouse_cursor (GtkTextView *text_view, gint x, gint y)
if (hovering != hovering_over_link) {
update_state (buffer, E_BUFFER_TAGGER_STATE_IS_HOVERING, hovering);
-#if GTK_CHECK_VERSION(2,19,7)
if (hovering && gtk_widget_has_focus (GTK_WIDGET (text_view)))
-#else
- if (hovering && GTK_WIDGET_HAS_FOCUS (text_view))
-#endif
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
else
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 4d7506e05d..27519528c2 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1557,11 +1557,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
day_style = calitem->styles[(month_offset + 1) * 32 + day_num];
/* Get the colors & style to use for the day.*/
-#if GTK_CHECK_VERSION(2,19,7)
if ((gtk_widget_has_focus (GTK_WIDGET (item->canvas))) &&
-#else
- if ((GTK_WIDGET_HAS_FOCUS(item->canvas)) &&
-#endif
item->canvas->focused_item == item)
has_focus = TRUE;
else
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index 27ac031b8d..3164b7b976 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -266,11 +266,7 @@ e_calendar_style_set (GtkWidget *widget,
/* Set the background of the canvas window to the normal color,
or the arrow buttons are not displayed properly. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (widget)) {
-#else
- if (GTK_WIDGET_REALIZED (widget)) {
-#endif
GtkStyle *style;
GdkWindow *window;
@@ -562,13 +558,8 @@ e_calendar_button_has_focus (ECalendar *cal)
prev_widget = GNOME_CANVAS_WIDGET(cal->prev_item)->widget;
next_widget = GNOME_CANVAS_WIDGET(cal->next_item)->widget;
-#if GTK_CHECK_VERSION(2,19,7)
ret_val = gtk_widget_has_focus (prev_widget) ||
gtk_widget_has_focus (next_widget);
-#else
- ret_val = GTK_WIDGET_HAS_FOCUS (prev_widget) ||
- GTK_WIDGET_HAS_FOCUS (next_widget);
-#endif
return ret_val;
}
@@ -595,11 +586,7 @@ e_calendar_focus (GtkWidget *widget, GtkDirectionType direction)
children[2] = cal->next_item;
/* get current focused item, if e-calendar has had focus */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget) || e_calendar_button_has_focus (cal))
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget) || e_calendar_button_has_focus (cal))
-#endif
for (index = 0; index < E_CALENDAR_FOCUS_CHILDREN_NUM; ++index) {
if (canvas->focused_item == NULL)
break;
@@ -649,11 +636,7 @@ e_calendar_set_focusable (ECalendar *cal, gboolean focusable)
GTK_WIDGET_SET_FLAGS (next_widget, GTK_CAN_FOCUS);
}
else {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (cal)) || e_calendar_button_has_focus (cal)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (cal) || e_calendar_button_has_focus (cal)) {
-#endif
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (cal));
if (toplevel)
gtk_widget_grab_focus (toplevel);
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
index 68c2488508..28875725b3 100644
--- a/widgets/misc/e-canvas-background.c
+++ b/widgets/misc/e-canvas-background.c
@@ -437,11 +437,7 @@ ecb_style_set (ECanvasBackground *ecb,
style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (GTK_WIDGET (item->canvas))) {
-#else
- if (GTK_WIDGET_REALIZED (item->canvas)) {
-#endif
gdk_gc_set_foreground (
ecb->priv->gc, &style->base[GTK_STATE_NORMAL]);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb));
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index db187b6e13..593c9c4530 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -568,11 +568,7 @@ e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too)
item->canvas->focused_item = item;
-#if GTK_CHECK_VERSION(2,19,7)
if (widget_too && !gtk_widget_has_focus (GTK_WIDGET(item->canvas))) {
-#else
- if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
-#endif
gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
}
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 03c8f2fd47..73b649defd 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -1699,11 +1699,7 @@ on_date_edit_time_selected (GtkComboBox *combo,
if (gtk_combo_box_get_active (combo) == -1)
return;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_mapped (child))
-#else
- if (!GTK_WIDGET_MAPPED (child))
-#endif
return;
e_date_edit_check_time_changed (dedit);
diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c
index 24bac0087c..51131cedcd 100644
--- a/widgets/misc/e-hinted-entry.c
+++ b/widgets/misc/e-hinted-entry.c
@@ -290,11 +290,7 @@ e_hinted_entry_set_text (EHintedEntry *entry,
if (text == NULL)
text = "";
-#if GTK_CHECK_VERSION(2,19,7)
if (*text == '\0' && !gtk_widget_has_focus (GTK_WIDGET (entry)))
-#else
- if (*text == '\0' && !GTK_WIDGET_HAS_FOCUS (entry))
-#endif
hinted_entry_show_hint (entry);
else {
hinted_entry_hide_hint (entry);
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index ff13e41be8..4ce8d75084 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -382,11 +382,7 @@ e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gtk_widget_set_allocation (widget, allocation);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (widget)) {
-#else
- if (GTK_WIDGET_REALIZED (widget)) {
-#endif
GdkWindow *window;
window = gtk_widget_get_window (widget);
@@ -410,11 +406,7 @@ e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
static gint
e_map_button_press (GtkWidget *widget, GdkEventButton *event)
{
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (widget)) gtk_widget_grab_focus (widget);
-#else
- if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget);
-#endif
return TRUE;
}
@@ -649,11 +641,7 @@ e_map_window_to_world (EMap *map, gdouble win_x, gdouble win_y, gdouble *world_l
g_return_if_fail (map);
priv = map->priv;
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
@@ -706,11 +694,7 @@ e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude)
EMapPrivate *priv;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
priv = map->priv;
@@ -730,11 +714,7 @@ e_map_zoom_out (EMap *map)
EMapPrivate *priv;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
priv = map->priv;
@@ -970,11 +950,7 @@ update_render_pixbuf (EMap *map,
gdouble zoom;
gint i;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (GTK_WIDGET (map)))
-#else
- if (!GTK_WIDGET_REALIZED (map))
-#endif
return;
gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
@@ -1039,13 +1015,8 @@ request_paint_area (EMap *view, GdkRectangle *area)
EMapPrivate *priv;
gint width, height;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_is_drawable (GTK_WIDGET (view)) ||
!gtk_widget_get_realized (GTK_WIDGET (view))) return;
-#else
- if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (view)) ||
- !GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
-#endif
priv = view->priv;
if (!priv->map_render_pixbuf) return;
@@ -1255,11 +1226,7 @@ scroll_to (EMap *view, gint x, gint y)
priv->xofs = x;
priv->yofs = y;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_is_drawable (GTK_WIDGET (view)))
-#else
- if (!GTK_WIDGET_DRAWABLE (view))
-#endif
return;
gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
@@ -1573,11 +1540,7 @@ zoom_in_smooth (EMap *map)
gdouble x, y;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
@@ -1744,11 +1707,7 @@ set_scroll_area (EMap *view)
priv = view->priv;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (GTK_WIDGET (view))) return;
-#else
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
-#endif
if (!priv->hadj || !priv->vadj) return;
g_object_freeze_notify (G_OBJECT (priv->hadj));
diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c
index 7c5c23b760..cb7dab1453 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -51,11 +51,7 @@ online_button_update_tooltip (EOnlineButton *button)
if (e_online_button_get_online (button))
tooltip = ONLINE_TOOLTIP;
-#if GTK_CHECK_VERSION(2,19,7)
else if (gtk_widget_get_sensitive (GTK_WIDGET (button)))
-#else
- else if (GTK_WIDGET_SENSITIVE (button))
-#endif
tooltip = OFFLINE_TOOLTIP;
else
tooltip = NETWORK_UNAVAILABLE_TOOLTIP;
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 06b9ef6e78..aaf18b3912 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -92,11 +92,7 @@ search_bar_update_tokenizer (ESearchBar *search_bar)
tokenizer = e_search_bar_get_tokenizer (search_bar);
case_sensitive = e_search_bar_get_case_sensitive (search_bar);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (GTK_WIDGET (search_bar)))
-#else
- if (GTK_WIDGET_VISIBLE (search_bar))
-#endif
active_search = search_bar->priv->active_search;
else
active_search = NULL;
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 31e6c29b99..47e1a87eac 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -126,6 +126,7 @@ e_cell_combo_init (ECellCombo *ecc)
AtkObject *a11y;
GtkListStore *store;
GtkTreeSelection *selection;
+ GtkScrolledWindow *scrolled_window;
/* We create one popup window for the ECell, since there will only
ever be one popup in use at a time. */
@@ -140,11 +141,17 @@ e_cell_combo_init (ECellCombo *ecc)
gtk_widget_show (frame);
ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window),
+ scrolled_window = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
+
+ gtk_scrolled_window_set_policy (scrolled_window,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (
+ gtk_scrolled_window_get_hscrollbar (scrolled_window),
+ GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (
+ gtk_scrolled_window_get_vscrollbar (scrolled_window),
+ GTK_CAN_FOCUS);
gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window);
gtk_widget_show (ecc->popup_scrolled_window);
@@ -330,24 +337,33 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
static void
e_cell_combo_show_popup (ECellCombo *ecc, gint row, gint view_col)
{
+ GdkWindow *window;
+ GtkAllocation allocation;
gint x, y, width, height, old_width, old_height;
+ gtk_widget_get_allocation (ecc->popup_window, &allocation);
+
/* This code is practically copied from GtkCombo. */
- old_width = ecc->popup_window->allocation.width;
- old_height = ecc->popup_window->allocation.height;
+ old_width = allocation.width;
+ old_height = allocation.height;
e_cell_combo_get_popup_pos (ecc, row, view_col, &x, &y, &height, &width);
/* workaround for gtk_scrolled_window_size_allocate bug */
if (old_width != width || old_height != height) {
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar);
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar);
+ gtk_widget_hide (
+ gtk_scrolled_window_get_hscrollbar (
+ GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
+ gtk_widget_hide (
+ gtk_scrolled_window_get_vscrollbar (
+ GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
}
gtk_window_move (GTK_WINDOW (ecc->popup_window), x, y);
gtk_widget_set_size_request (ecc->popup_window, width, height);
gtk_widget_realize (ecc->popup_window);
- gdk_window_resize (ecc->popup_window->window, width, height);
+ window = gtk_widget_get_window (ecc->popup_window);
+ gdk_window_resize (window, width, height);
gtk_widget_show (ecc->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecc), TRUE);
@@ -367,8 +383,15 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
ECellPopup *ecp = E_CELL_POPUP (ecc);
ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ GtkWidget *widget;
+ GtkWidget *popwin_child;
+ GtkWidget *popup_child;
+ GtkStyle *popwin_style;
+ GtkStyle *popup_style;
+ GdkWindow *window;
GtkBin *popwin;
GtkScrolledWindow *popup;
+ GtkRequisition requisition;
GtkRequisition list_requisition;
gboolean show_vscroll = FALSE, show_hscroll = FALSE;
gint avail_height, avail_width, min_height, work_height, screen_width;
@@ -380,7 +403,8 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
popwin = GTK_BIN (ecc->popup_window);
- gdk_window_get_origin (canvas->window, x, y);
+ window = gtk_widget_get_window (canvas);
+ gdk_window_get_origin (window, x, y);
x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
y1 = e_table_item_row_diff (eti, 0, row + 1);
@@ -402,10 +426,16 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
*x += x1;
/* The ETable positions don't include the grid lines, I think, so we add 1. */
*y += y1 + 1
- - (gint)((GnomeCanvas *)canvas)->layout.vadjustment->value
+ - (gint)gtk_adjustment_get_value (
+ gtk_layout_get_vadjustment (
+ &((GnomeCanvas *)canvas)->layout))
+ ((GnomeCanvas *)canvas)->zoom_yofs;
- scrollbar_width = popup->vscrollbar->requisition.width
+ widget = gtk_scrolled_window_get_vscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
+
+ scrollbar_width =
+ requisition.width
+ GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing;
avail_height = gdk_screen_height () - *y;
@@ -415,19 +445,27 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
screen_width = gdk_screen_width ();
avail_width = screen_width - scrollbar_width;
+ widget = gtk_scrolled_window_get_vscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
+
gtk_widget_size_request (ecc->popup_tree_view, &list_requisition);
- min_height = MIN (list_requisition.height,
- popup->vscrollbar->requisition.height);
+ min_height = MIN (list_requisition.height, requisition.height);
if (!gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)), NULL))
list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT;
+ popwin_child = gtk_bin_get_child (popwin);
+ popwin_style = gtk_widget_get_style (popwin_child);
+
+ popup_child = gtk_bin_get_child (GTK_BIN (popup));
+ popup_style = gtk_widget_get_style (popup_child);
+
/* Calculate the desired width. */
*width = list_requisition.width
- + 2 * popwin->child->style->xthickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->xthickness;
+ + 2 * popwin_style->xthickness
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popwin_child))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup_child))
+ + 2 * popup_style->xthickness;
/* Use at least the same width as the column. */
if (*width < column_width)
@@ -441,15 +479,19 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
}
/* Calculate all the borders etc. that we need to add to the height. */
- work_height = (2 * popwin->child->style->ythickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->xthickness);
+ work_height = (2 * popwin_style->ythickness
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popwin_child))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup_child))
+ + 2 * popup_style->xthickness);
+
+ widget = gtk_scrolled_window_get_hscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
/* Add on the height of the horizontal scrollbar if we need it. */
if (show_hscroll)
- work_height += popup->hscrollbar->requisition.height +
+ work_height +=
+ requisition.height +
GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing;
/* Check if it fits in the available height. */
@@ -494,11 +536,7 @@ e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc)
GtkTreeIter iter;
GtkTreeModel *model;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter))
-#else
- if (!GTK_WIDGET_REALIZED (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter))
-#endif
return;
e_cell_combo_update_cell (ecc);
@@ -526,7 +564,7 @@ e_cell_combo_button_press (GtkWidget *popup_window,
presses outside the application will be reported to this window,
which is why we hide the popup in this case. */
while (event_widget) {
- event_widget = event_widget->parent;
+ event_widget = gtk_widget_get_parent (event_widget);
if (event_widget == ecc->popup_tree_view)
return FALSE;
}
@@ -564,7 +602,7 @@ e_cell_combo_button_release (GtkWidget *popup_window,
/* See if the button was released in the list (or its children). */
while (event_widget && event_widget != ecc->popup_tree_view)
- event_widget = event_widget->parent;
+ event_widget = gtk_widget_get_parent (event_widget);
/* If it wasn't, then we just ignore the event. */
if (event_widget != ecc->popup_tree_view)
@@ -601,11 +639,7 @@ e_cell_combo_key_press (GtkWidget *popup_window,
&& event->keyval != GDK_3270_Enter)
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
if (event->keyval == GDK_Escape && (!ecc->popup_window||!gtk_widget_get_visible (ecc->popup_window)))
-#else
- if (event->keyval == GDK_Escape && (!ecc->popup_window||!GTK_WIDGET_VISIBLE (ecc->popup_window)))
-#endif
return FALSE;
gtk_grab_remove (ecc->popup_window);
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index 692614ff14..cab6c816ee 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -383,32 +383,16 @@ e_cell_date_edit_get_property (GObject *object,
switch (property_id) {
case PROP_SHOW_TIME:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->time_entry));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->time_entry));
-#endif
return;
case PROP_SHOW_NOW_BUTTON:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->now_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->now_button));
-#endif
return;
case PROP_SHOW_TODAY_BUTTON:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->today_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->today_button));
-#endif
return;
case PROP_ALLOW_NO_DATE_SET:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->none_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->none_button));
-#endif
return;
case PROP_USE_24_HOUR_FORMAT:
g_value_set_boolean (value, ecde->use_24_hour_format);
@@ -503,6 +487,7 @@ e_cell_date_edit_do_popup (ECellPopup *ecp,
gint view_col)
{
ECellDateEdit *ecde = E_CELL_DATE_EDIT (ecp);
+ GdkWindow *window;
e_cell_date_edit_show_popup (ecde, row, view_col);
e_cell_date_edit_set_popup_values (ecde);
@@ -511,7 +496,8 @@ e_cell_date_edit_do_popup (ECellPopup *ecp,
/* Set the focus to the first widget. */
gtk_widget_grab_focus (ecde->time_entry);
- gdk_window_focus (ecde->popup_window->window, GDK_CURRENT_TIME);
+ window = gtk_widget_get_window (ecde->popup_window);
+ gdk_window_focus (window, GDK_CURRENT_TIME);
return TRUE;
}
@@ -627,6 +613,7 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
gint row,
gint view_col)
{
+ GdkWindow *window;
gint x, y, width, height;
if (ecde->need_time_list_rebuild)
@@ -636,10 +623,11 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
e_cell_date_edit_get_popup_pos (ecde, row, view_col, &x, &y, &height, &width);
+ window = gtk_widget_get_window (ecde->popup_window);
gtk_window_move (GTK_WINDOW (ecde->popup_window), x, y);
gtk_widget_set_size_request (ecde->popup_window, width, height);
gtk_widget_realize (ecde->popup_window);
- gdk_window_resize (ecde->popup_window->window, width, height);
+ gdk_window_resize (window, width, height);
gtk_widget_show (ecde->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecde), TRUE);
@@ -659,10 +647,15 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
GtkRequisition popup_requisition;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ GdkWindow *window;
gint avail_height, screen_width, column_width, row_height;
gdouble x1, y1, wx, wy;
+ gint value;
- gdk_window_get_origin (canvas->window, x, y);
+ window = gtk_widget_get_window (canvas);
+ gdk_window_get_origin (window, x, y);
x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
y1 = e_table_item_row_diff (eti, 0, row + 1);
@@ -684,9 +677,10 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
*x += x1;
/* The ETable positions don't include the grid lines, I think, so we
add 1. */
- *y += y1 + 1
- - (gint)((GnomeCanvas *)canvas)->layout.vadjustment->value
- + ((GnomeCanvas *)canvas)->zoom_yofs;
+ layout = &GNOME_CANVAS (canvas)->layout;
+ adjustment = gtk_layout_get_vadjustment (layout);
+ value = (gint) gtk_adjustment_get_value (adjustment);
+ *y += y1 + 1 - value + ((GnomeCanvas *)canvas)->zoom_yofs;
avail_height = gdk_screen_height () - *y;
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c
index 6deb4c46a9..32de41ecb4 100644
--- a/widgets/table/e-cell-popup.c
+++ b/widgets/table/e-cell-popup.c
@@ -277,6 +277,8 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable,
ecp->popup_arrow_shown = show_popup_arrow;
if (show_popup_arrow) {
+ GtkStyle *style;
+
e_cell_draw (ecp_view->child_view, drawable, model_col,
view_col, row, flags,
x1, y1, x2 - E_CELL_POPUP_ARROW_WIDTH, y2);
@@ -291,11 +293,13 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable,
else
shadow = GTK_SHADOW_OUT;
- gtk_paint_box (canvas->style, drawable,
+ style = gtk_widget_get_style (canvas);
+
+ gtk_paint_box (style, drawable,
GTK_STATE_NORMAL, shadow,
&rect, canvas, "ecellpopup",
rect.x, rect.y, rect.width, rect.height);
- gtk_paint_arrow (canvas->style, drawable,
+ gtk_paint_arrow (style, drawable,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&rect, canvas, NULL,
GTK_ARROW_DOWN, TRUE,
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index b501c47c10..ba246316bb 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -274,6 +274,7 @@ ect_queue_redraw (ECellTextView *text_view, gint view_col, gint view_row)
static void
ect_stop_editing (ECellTextView *text_view, gboolean commit)
{
+ GdkWindow *window;
CellEdit *edit = text_view->edit;
gint row, view_col, model_col;
gchar *old_text, *text;
@@ -281,6 +282,8 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit)
if (!edit)
return;
+ window = gtk_widget_get_window (GTK_WIDGET (text_view->canvas));
+
row = edit->row;
view_col = edit->view_col;
model_col = edit->model_col;
@@ -290,7 +293,7 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit)
if (edit->tep)
g_object_unref (edit->tep);
if (!edit->default_cursor_shown) {
- gdk_window_set_cursor (GTK_WIDGET(text_view->canvas)->window, NULL);
+ gdk_window_set_cursor (window, NULL);
edit->default_cursor_shown = TRUE;
}
if (edit->timeout_id) {
@@ -389,8 +392,10 @@ static void
ect_realize (ECellView *ecell_view)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
+ GdkWindow *window;
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (text_view->canvas));
+ text_view->gc = gdk_gc_new (window);
text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
@@ -730,21 +735,20 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkColor *foreground;
GtkWidget *canvas = GTK_WIDGET (text_view->canvas);
GdkRectangle clip_rect;
+ GtkStyle *style;
gint x_origin, y_origin, vspacing;
+ style = gtk_widget_get_style (canvas);
+
selected = flags & E_CELL_SELECTED;
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS (canvas))
-#endif
- foreground = &canvas->style->fg [GTK_STATE_SELECTED];
+ foreground = &style->fg[GTK_STATE_SELECTED];
else
- foreground = &canvas->style->fg [GTK_STATE_ACTIVE];
+ foreground = &style->fg[GTK_STATE_ACTIVE];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text[GTK_STATE_NORMAL];
if (ect->color_column != -1) {
gchar *color_spec;
@@ -805,11 +809,11 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
end_index = edit->selection_start ^ edit->selection_end ^ start_index;
if (edit->has_selection) {
- selection_gc = canvas->style->base_gc [GTK_STATE_SELECTED];
- text_gc = canvas->style->text_gc[GTK_STATE_SELECTED];
+ selection_gc = style->base_gc[GTK_STATE_SELECTED];
+ text_gc = style->text_gc[GTK_STATE_SELECTED];
} else {
- selection_gc = canvas->style->base_gc [GTK_STATE_ACTIVE];
- text_gc = canvas->style->text_gc[GTK_STATE_ACTIVE];
+ selection_gc = style->base_gc [GTK_STATE_ACTIVE];
+ text_gc = style->text_gc[GTK_STATE_ACTIVE];
}
gdk_gc_set_clip_rectangle (selection_gc, &clip_rect);
@@ -1126,7 +1130,10 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
#endif
if (edit_display) {
if (edit->default_cursor_shown) {
- gdk_window_set_cursor (canvas->window, text_view->i_cursor);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (canvas);
+ gdk_window_set_cursor (window, text_view->i_cursor);
edit->default_cursor_shown = FALSE;
}
}
@@ -1137,7 +1144,10 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
#endif
if (edit_display) {
if (!edit->default_cursor_shown) {
- gdk_window_set_cursor (canvas->window, NULL);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (canvas);
+ gdk_window_set_cursor (window, NULL);
edit->default_cursor_shown = TRUE;
}
}
@@ -1334,6 +1344,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
ECellTextView *ectView = (ECellTextView *)ecell_view;
GtkWidget *canvas = GTK_WIDGET(ectView->canvas);
+ GtkStyle *style;
PangoDirection dir;
gboolean strikeout, underline;
cairo_t *cr;
@@ -1355,12 +1366,14 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
cairo_rectangle (cr, 2, 2, width + 2, height + 2);
cairo_clip(cr);
+ style = gtk_widget_get_style (canvas);
pango_context = gtk_widget_get_pango_context (canvas);
- font_metrics = pango_context_get_metrics (pango_context,
- canvas->style->font_desc, pango_context_get_language(pango_context));
- ty = (gdouble)(text_height
- - pango_font_metrics_get_ascent (font_metrics)
- - pango_font_metrics_get_descent (font_metrics)) / 2.0 /(gdouble)PANGO_SCALE;
+ font_metrics = pango_context_get_metrics (
+ pango_context, style->font_desc,
+ pango_context_get_language(pango_context));
+ ty = (gdouble)(text_height -
+ pango_font_metrics_get_ascent (font_metrics) -
+ pango_font_metrics_get_descent (font_metrics)) / 2.0 /(gdouble)PANGO_SCALE;
strikeout = ect->strikeout_column >= 0 && row >= 0 &&
e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 5f7cc66321..08a9d8dcc3 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -173,8 +173,10 @@ static void
cell_toggle_realize (ECellView *ecell_view)
{
ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
+ GdkWindow *window;
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (toggle_view->canvas));
+ toggle_view->gc = gdk_gc_new (window);
}
static void
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 8a8017e2e7..b5506af13b 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -169,11 +169,13 @@ static void
ect_realize (ECellView *ecell_view)
{
ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
+ GdkWindow *window;
/* realize our subcell view */
e_cell_realize (tree_view->subcell_view);
- tree_view->gc = gdk_gc_new (GTK_WIDGET (tree_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (tree_view->canvas));
+ tree_view->gc = gdk_gc_new (window);
gdk_gc_set_line_attributes (tree_view->gc, 1,
GDK_LINE_ON_OFF_DASH,
@@ -229,11 +231,19 @@ draw_retro_expander (ECellTreeView *ectv, GdkDrawable *drawable, gboolean expand
static void
draw_expander (ECellTreeView *ectv, GdkDrawable *drawable, GtkExpanderStyle expander_style, GtkStateType state, GdkRectangle *rect)
{
- GtkWidget *tree = GTK_WIDGET (ectv->canvas)->parent;
+ GtkStyle *style;
+ GtkWidget *tree;
gint exp_size;
+
+ tree = gtk_widget_get_parent (GTK_WIDGET (ectv->canvas));
+ style = gtk_widget_get_style (tree);
+
gtk_widget_style_get (tree, "expander_size", &exp_size, NULL);
- gtk_paint_expander (tree->style, drawable, state, rect, tree, "treeview", rect->x + rect->width - exp_size / 2, rect->y + rect->height / 2, expander_style);
+ gtk_paint_expander (
+ style, drawable, state, rect, tree, "treeview",
+ rect->x + rect->width - exp_size / 2,
+ rect->y + rect->height / 2, expander_style);
}
/*
@@ -250,12 +260,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
ETreePath node;
GdkRectangle rect, *clip_rect = NULL;
GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
- GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
+ GtkStyle *style;
+ GdkGC *fg_gc;
GdkColor *foreground;
gboolean selected;
gint offset, subcell_offset;
+ style = gtk_widget_get_style (canvas);
+ fg_gc = style->fg_gc[GTK_STATE_ACTIVE];
+
selected = flags & E_CELL_SELECTED;
/* only draw the tree effects if we're the active sort */
@@ -263,7 +277,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkPixbuf *node_image;
gint node_image_width = 0, node_image_height = 0;
ETreePath parent_node;
- ETree *tree = E_TREE (canvas->parent);
+ ETree *tree;
+
+ tree = E_TREE (gtk_widget_get_parent (canvas));
gtk_widget_style_get (GTK_WIDGET (tree),
"retro_look", &tree_view->retro_look,
@@ -295,9 +311,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
clip_rect = &rect;
if (selected) {
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
+ foreground = &style->text [GTK_STATE_SELECTED];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text [GTK_STATE_NORMAL];
}
gdk_gc_set_foreground (tree_view->gc, foreground);
@@ -445,6 +461,8 @@ typedef struct {
static gboolean
animate_expander (gpointer data)
{
+ GtkLayout *layout;
+ GdkWindow *window;
animate_closure_t *closure = (animate_closure_t *) data;
if (closure->finish) {
@@ -454,9 +472,14 @@ animate_expander (gpointer data)
return FALSE;
}
- draw_expander (closure->ectv, GTK_LAYOUT (closure->ectv->canvas)->bin_window,
- closure->expanded ? GTK_EXPANDER_SEMI_COLLAPSED : GTK_EXPANDER_SEMI_EXPANDED,
- GTK_STATE_NORMAL, &closure->area);
+ layout = GTK_LAYOUT (closure->ectv->canvas);
+ window = gtk_layout_get_bin_window (layout);
+
+ draw_expander (
+ closure->ectv, window, closure->expanded ?
+ GTK_EXPANDER_SEMI_COLLAPSED :
+ GTK_EXPANDER_SEMI_EXPANDED,
+ GTK_STATE_NORMAL, &closure->area);
closure->finish = TRUE;
return TRUE;
@@ -468,6 +491,8 @@ animate_expander (gpointer data)
static gint
ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col, gint row, ECellFlags flags, ECellActions *actions)
{
+ GtkLayout *layout;
+ GdkWindow *window;
ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
ETreeTableAdapter *etta = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
@@ -475,6 +500,9 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
gint offset = offset_of_node (ecell_view->e_table_model, row);
gint result;
+ layout = GTK_LAYOUT (tree_view->canvas);
+ window = gtk_layout_get_bin_window (layout);
+
switch (event->type) {
case GDK_BUTTON_PRESS:
@@ -497,9 +525,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
if (hgt != area.height) /* Composite cells */
area.height += hgt;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- expanded ? GTK_EXPANDER_SEMI_EXPANDED : GTK_EXPANDER_SEMI_COLLAPSED,
- GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window, expanded ?
+ GTK_EXPANDER_SEMI_EXPANDED :
+ GTK_EXPANDER_SEMI_COLLAPSED,
+ GTK_STATE_NORMAL, &area);
closure->ectv = tree_view;
closure->etta = etta;
closure->node = node;
@@ -526,9 +556,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
&tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- in_expander ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window,
+ e_tree_table_adapter_node_is_expanded (etta, node) ?
+ GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
+ in_expander ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, &area);
tree_view->prelit = in_expander;
return TRUE;
}
@@ -544,9 +576,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
&tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window,
+ e_tree_table_adapter_node_is_expanded (etta, node) ?
+ GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
+ GTK_STATE_NORMAL, &area);
tree_view->prelit = FALSE;
}
return TRUE;
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index deebd7939c..e50d0f4274 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -73,21 +73,24 @@ etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *et
static void
etcta_style_set (ETableClickToAdd *etcta, GtkStyle *previous_style)
{
- GtkWidget *widget = GTK_WIDGET(GNOME_CANVAS_ITEM(etcta)->canvas);
+ GtkWidget *widget;
+ GtkStyle *style;
- if (etcta->rect) {
- gnome_canvas_item_set (etcta->rect,
- "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
- "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
- NULL );
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etcta)->canvas);
+ style = gtk_widget_get_style (widget);
- }
+ if (etcta->rect)
+ gnome_canvas_item_set (
+ etcta->rect,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
+ NULL);
if (etcta->text)
- gnome_canvas_item_set (etcta->text,
- "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
- NULL);
-
+ gnome_canvas_item_set (
+ etcta->text,
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
+ NULL);
}
static void
@@ -237,28 +240,34 @@ etcta_set_property (GObject *object,
static void
create_rect_and_text (ETableClickToAdd *etcta)
{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM(etcta)->canvas);
+ GtkWidget *widget;
+ GtkStyle *style;
+
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etcta)->canvas);
+ style = gtk_widget_get_style (widget);
if (!etcta->rect)
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- gnome_canvas_rect_get_type(),
- "x1", (gdouble) 0,
- "y1", (gdouble) 0,
- "x2", (gdouble) etcta->width - 1,
- "y2", (gdouble) etcta->height - 1,
- "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
- "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
- NULL);
+ etcta->rect = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (etcta),
+ gnome_canvas_rect_get_type (),
+ "x1", (gdouble) 0,
+ "y1", (gdouble) 0,
+ "x2", (gdouble) etcta->width - 1,
+ "y2", (gdouble) etcta->height - 1,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
+ NULL);
if (!etcta->text)
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
- NULL);
+ etcta->text = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (etcta),
+ e_text_get_type (),
+ "text", etcta->message ? etcta->message : "",
+ "anchor", GTK_ANCHOR_NW,
+ "width", etcta->width - 4,
+ "draw_background", FALSE,
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
+ NULL);
}
static void
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 23046c717a..736473a81c 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -549,18 +549,27 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
static void
do_fields_config_dialog (ETableConfig *config)
{
+ GtkDialog *dialog;
+ GtkWidget *widget;
gint response, running = 1;
+ dialog = GTK_DIALOG (config->dialog_show_fields);
+
gtk_widget_ensure_style (config->dialog_show_fields);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_show_fields)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_show_fields)->action_area), 12);
+
+ widget = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
config->temp_state = e_table_state_duplicate (config->state);
setup_fields (config);
- gtk_window_set_transient_for (GTK_WINDOW (config->dialog_show_fields),
- GTK_WINDOW (config->dialog_toplevel));
+ gtk_window_set_transient_for (
+ GTK_WINDOW (config->dialog_show_fields),
+ GTK_WINDOW (config->dialog_toplevel));
do {
response = gtk_dialog_run (GTK_DIALOG(config->dialog_show_fields));
@@ -759,6 +768,7 @@ sort_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *sort)
ETableConfig *config = sort->e_table_config;
ETableSortInfo *sort_info = config->temp_state->sort_info;
ETableConfigSortWidgets *base = &config->sort[0];
+ GtkToggleButton *toggle_button;
gint idx = sort - base;
gchar *s;
@@ -775,8 +785,9 @@ sort_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *sort)
return;
}
- c.ascending = GTK_TOGGLE_BUTTON (
- config->sort [idx].radio_ascending)->active;
+ toggle_button = GTK_TOGGLE_BUTTON (
+ config->sort[idx].radio_ascending);
+ c.ascending = gtk_toggle_button_get_active (toggle_button);
c.column = col;
e_table_sort_info_sorting_set_nth (sort_info, idx, c);
@@ -799,7 +810,7 @@ sort_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *sort)
ETableSortColumn c;
c = e_table_sort_info_sorting_get_nth (si, idx);
- c.ascending = t->active;
+ c.ascending = gtk_toggle_button_get_active (t);
e_table_sort_info_sorting_set_nth (si, idx, c);
}
@@ -877,6 +888,7 @@ group_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *group)
s = configure_combo_box_get_active (combo_box);
if (s != NULL) {
+ GtkToggleButton *toggle_button;
ETableSortColumn c;
gint col;
@@ -887,8 +899,9 @@ group_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *group)
return;
}
- c.ascending = GTK_TOGGLE_BUTTON (
- config->group [idx].radio_ascending)->active;
+ toggle_button = GTK_TOGGLE_BUTTON (
+ config->group[idx].radio_ascending);
+ c.ascending = gtk_toggle_button_get_active (toggle_button);
c.column = col;
e_table_sort_info_grouping_set_nth (sort_info, idx, c);
@@ -911,7 +924,7 @@ group_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *group)
ETableSortColumn c;
c = e_table_sort_info_grouping_get_nth (si, idx);
- c.ascending = t->active;
+ c.ascending = gtk_toggle_button_get_active (t);
e_table_sort_info_grouping_set_nth (si, idx, c);
}
@@ -1324,15 +1337,23 @@ e_table_config_new (const gchar *header,
GtkWindow *parent_window)
{
ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);
+ GtkDialog *dialog;
+ GtkWidget *widget;
if (e_table_config_construct (config, header, spec, state, parent_window) == NULL) {
g_object_unref (config);
return NULL;
}
+ dialog = GTK_DIALOG (config->dialog_toplevel);
+
gtk_widget_ensure_style (config->dialog_toplevel);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->action_area), 12);
+
+ widget = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
GTK_RESPONSE_APPLY, FALSE);
@@ -1350,6 +1371,9 @@ e_table_config_new (const gchar *header,
void
e_table_config_raise (ETableConfig *config)
{
- gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (GTK_WIDGET (config->dialog_toplevel));
+ gdk_window_raise (window);
}
diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c
index 9641f6c58e..c05506d953 100644
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ b/widgets/table/e-table-field-chooser-dialog.c
@@ -85,17 +85,20 @@ e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass)
static void
e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog)
{
+ GtkDialog *dialog;
+ GtkWidget *content_area;
GtkWidget *widget;
+ dialog = GTK_DIALOG (e_table_field_chooser_dialog);
+
e_table_field_chooser_dialog->etfc = NULL;
e_table_field_chooser_dialog->dnd_code = g_strdup("");
e_table_field_chooser_dialog->full_header = NULL;
e_table_field_chooser_dialog->header = NULL;
- gtk_dialog_add_button(GTK_DIALOG(e_table_field_chooser_dialog),
- GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
+ gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
- gtk_window_set_resizable(GTK_WINDOW(e_table_field_chooser_dialog), TRUE);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
widget = e_table_field_chooser_new();
e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER(widget);
@@ -106,12 +109,12 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos
"header", e_table_field_chooser_dialog->header,
NULL);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_table_field_chooser_dialog)->vbox),
- widget, TRUE, TRUE, 0);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
- gtk_widget_show(GTK_WIDGET(widget));
+ gtk_widget_show (GTK_WIDGET(widget));
- gtk_window_set_title (GTK_WINDOW (e_table_field_chooser_dialog), _("Add a Column"));
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column"));
}
GtkWidget*
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
index 69c0b58249..a04e4f3742 100644
--- a/widgets/table/e-table-field-chooser-item.c
+++ b/widgets/table/e-table-field-chooser-item.c
@@ -214,12 +214,14 @@ etfci_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint fl
static void
etfci_font_load (ETableFieldChooserItem *etfci)
{
+ GtkWidget *widget;
GtkStyle *style;
if (etfci->font_desc)
pango_font_description_free (etfci->font_desc);
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style;
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas);
+ style = gtk_widget_get_style (widget);
etfci->font_desc = pango_font_description_copy (style->font_desc);
}
@@ -462,7 +464,7 @@ etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint w
rows = e_table_header_count (etfci->combined_header);
- style = GTK_WIDGET (canvas)->style;
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
state = gtk_widget_get_state (GTK_WIDGET (canvas));
y1 = y2 = 0;
@@ -519,6 +521,8 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo
GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas);
GtkTargetList *list;
GdkDragContext *context;
+ GdkWindow *window;
+ GtkStyle *style;
GtkStateType state;
ETableCol *ecol;
GdkPixmap *pixmap;
@@ -551,24 +555,26 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo
g_free(etfci_drag_types[0].target);
button_height = e_table_header_compute_height (ecol, widget);
- pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1);
+ window = gtk_widget_get_window (widget);
+ pixmap = gdk_pixmap_new (window, etfci->width, button_height, -1);
+ style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
- e_table_header_draw_button (pixmap, ecol,
- widget->style, state,
- widget,
- 0, 0,
- etfci->width, button_height,
- etfci->width, button_height,
- E_TABLE_COL_ARROW_NONE);
-
- gtk_drag_set_icon_pixmap (context,
- gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)),
- pixmap,
- NULL,
- etfci->width / 2,
- button_height / 2);
+ e_table_header_draw_button (
+ pixmap, ecol, style,
+ state, widget, 0, 0,
+ etfci->width, button_height,
+ etfci->width, button_height,
+ E_TABLE_COL_ARROW_NONE);
+
+ gtk_drag_set_icon_pixmap (
+ context,
+ gdk_drawable_get_colormap (GDK_DRAWABLE (window)),
+ pixmap, NULL,
+ etfci->width / 2,
+ button_height / 2);
+
g_object_unref (pixmap);
etfci->maybe_drag = FALSE;
}
diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c
index 2e73bafcfc..e56293b111 100644
--- a/widgets/table/e-table-field-chooser.c
+++ b/widgets/table/e-table-field-chooser.c
@@ -94,9 +94,9 @@ ensure_nonzero_step_increments (ETableFieldChooser *etfc)
so use 16 pixels which should be OK
*/
if (va)
- va->step_increment = 16.0;
+ gtk_adjustment_set_step_increment (va, 16.0);
if (ha)
- ha->step_increment = 16.0;
+ gtk_adjustment_set_step_increment (ha, 16.0);
}
static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, ETableFieldChooser *etfc)
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index e99270bd4b..72f2323acd 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -146,6 +146,7 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
{
ETableCol *col;
ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, n);
+ GtkWidget *widget;
GtkStyle *style;
col = e_table_header_get_column_by_col_idx(full_header, column.column);
@@ -160,7 +161,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->n = n;
etgc->ascending = column.ascending;
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style;
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas);
+ style = gtk_widget_get_style (widget);
etgc->font_desc = pango_font_description_copy (style->font_desc);
etgc->open = TRUE;
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 57e0e42a82..133a368754 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -498,6 +498,9 @@ make_shaped_window_from_xpm (const gchar **xpm)
static void
ethi_add_drop_marker (ETableHeaderItem *ethi, gint col, gboolean recreate)
{
+ GnomeCanvas *canvas;
+ GtkAdjustment *adjustment;
+ GdkWindow *window;
gint rx, ry;
gint x;
@@ -515,14 +518,15 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, gint col, gboolean recreate)
arrow_down = make_shaped_window_from_xpm (arrow_down_xpm);
}
- gdk_window_get_origin (
- GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->window,
- &rx, &ry);
+ canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_get_origin (window, &rx, &ry);
- rx -= gtk_layout_get_hadjustment (
- GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
- ry -= gtk_layout_get_vadjustment (
- GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (canvas));
+ rx -= gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (canvas));
+ ry -= gtk_adjustment_get_value (adjustment);
gtk_window_move (
GTK_WINDOW (arrow_down),
@@ -645,7 +649,13 @@ scroll_timeout (gpointer data)
{
ETableHeaderItem *ethi = data;
gint dx = 0;
- GtkAdjustment *h, *v;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble hadjustment_value;
+ gdouble vadjustment_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
gdouble value;
if (ethi->scroll_direction & ET_SCROLL_RIGHT)
@@ -653,20 +663,35 @@ scroll_timeout (gpointer data)
if (ethi->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->hadjustment;
- v = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->vadjustment;
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ vadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ value = hadjustment_value;
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
- value = h->value;
+ gtk_adjustment_set_value (
+ adjustment, CLAMP (
+ hadjustment_value + dx, lower, upper - page_size));
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
- if (h->value != value)
- do_drag_motion(ethi,
- ethi->last_drop_context,
- ethi->last_drop_x + h->value,
- ethi->last_drop_y + v->value,
- ethi->last_drop_time,
- TRUE);
+ if (hadjustment_value != value)
+ do_drag_motion(
+ ethi,
+ ethi->last_drop_context,
+ ethi->last_drop_x + hadjustment_value,
+ ethi->last_drop_y + vadjustment_value,
+ ethi->last_drop_time,
+ TRUE);
return TRUE;
}
@@ -723,6 +748,10 @@ ethi_drag_motion (GtkWidget *widget,
guint time,
ETableHeaderItem *ethi)
{
+ GtkAllocation allocation;
+ GtkAdjustment *adjustment;
+ gdouble hadjustment_value;
+ gdouble vadjustment_value;
gchar *droptype, *headertype;
guint direction = 0;
@@ -739,9 +768,11 @@ ethi_drag_motion (GtkWidget *widget,
g_free (headertype);
+ gtk_widget_get_allocation (widget, &allocation);
+
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
ethi->last_drop_x = x;
@@ -750,12 +781,17 @@ ethi_drag_motion (GtkWidget *widget,
ethi->last_drop_context = context;
context_connect (ethi, context);
- do_drag_motion (ethi,
- context,
- x + GTK_LAYOUT(widget)->hadjustment->value,
- y + GTK_LAYOUT(widget)->vadjustment->value,
- time,
- FALSE);
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (widget));
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
+ vadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ do_drag_motion (
+ ethi, context,
+ x + hadjustment_value,
+ y + vadjustment_value,
+ time, FALSE);
if (direction != 0)
scroll_on (ethi, direction);
@@ -781,20 +817,23 @@ ethi_drag_data_received (GtkWidget *canvas,
GdkDragContext *drag_context,
gint x,
gint y,
- GtkSelectionData *data,
+ GtkSelectionData *selection_data,
guint info,
guint time,
ETableHeaderItem *ethi)
{
+ const guchar *data;
gint found = FALSE;
gint count;
gint column;
gint drop_col;
gint i;
- if (data->data) {
+ data = gtk_selection_data_get_data (selection_data);
+
+ if (data != NULL) {
count = e_table_header_count(ethi->eth);
- column = atoi((gchar *)data->data);
+ column = atoi((gchar *)data);
drop_col = ethi->drop_col;
ethi->drop_col = -1;
@@ -891,6 +930,7 @@ static void
ethi_realize (GnomeCanvasItem *item)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
+ GtkStyle *style;
GtkTargetEntry ethi_drop_types [] = {
{ (gchar *) TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
};
@@ -898,8 +938,10 @@ ethi_realize (GnomeCanvasItem *item)
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize)
(*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item);
+ style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
+
if (!ethi->font_desc)
- ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font_desc);
+ ethi_font_set (ethi, style->font_desc);
/*
* Now, configure DnD
@@ -972,6 +1014,11 @@ ethi_draw (GnomeCanvasItem *item,
gint x1, x2;
gint col;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
+ GtkStateType state;
+ GtkStyle *style;
+
+ state = gtk_widget_get_state (GTK_WIDGET (canvas));
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
if (ethi->sort_info) {
gint length = e_table_sort_info_grouping_get_count(ethi->sort_info);
@@ -1018,15 +1065,13 @@ ethi_draw (GnomeCanvasItem *item,
state = gtk_widget_get_state (GTK_WIDGET (canvas));
- e_table_header_draw_button (drawable, ecol,
- GTK_WIDGET (canvas)->style,
- state,
- GTK_WIDGET (canvas),
- x1 - x, -y,
- width, height,
- x2 - x1, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, GINT_TO_POINTER (ecol->col_idx)));
+ e_table_header_draw_button (
+ drawable, ecol,
+ style, state, GTK_WIDGET (canvas),
+ x1 - x, -y, width, height,
+ x2 - x1, ethi->height,
+ (ETableColArrow) g_hash_table_lookup (
+ arrows, GINT_TO_POINTER (ecol->col_idx)));
}
g_hash_table_destroy (arrows);
@@ -1088,12 +1133,16 @@ is_pointer_on_division (ETableHeaderItem *ethi,
static void
set_cursor (ETableHeaderItem *ethi, gint pos)
{
- gint col;
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
+ GnomeCanvas *canvas;
+ GdkWindow *window;
gboolean resizable = FALSE;
+ gint col;
+
+ canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
/* We might be invoked before we are realized */
- if (!canvas->window)
+ if (window == NULL)
return;
if (is_pointer_on_division (ethi, pos, NULL, &col)) {
@@ -1119,9 +1168,9 @@ set_cursor (ETableHeaderItem *ethi, gint pos)
}
if (resizable)
- gdk_window_set_cursor (canvas->window, ethi->resize_cursor);
+ gdk_window_set_cursor (window, ethi->resize_cursor);
else
- gdk_window_set_cursor (canvas->window, NULL);
+ gdk_window_set_cursor (window, NULL);
}
static void
@@ -1157,17 +1206,24 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
GtkTargetList *list;
GdkDragContext *context;
- GtkStateType state;
ETableCol *ecol;
gint col_width;
GdkPixmap *pixmap;
gint group_indent = 0;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
+ GtkStateType state;
+ GtkStyle *style;
+ GdkWindow *window;
GtkTargetEntry ethi_drag_types [] = {
{ (gchar *) TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
};
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
+ window = gtk_widget_get_window (widget);
+ state = gtk_widget_get_state (widget);
+ style = gtk_widget_get_style (widget);
+
ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
if (ethi->drag_col == -1)
@@ -1212,23 +1268,21 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
col_width = ecol->width;
- pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
+ pixmap = gdk_pixmap_new (window, col_width, ethi->height, -1);
state = gtk_widget_get_state (widget);
e_table_header_draw_button (
pixmap, ecol,
- widget->style,
- state,
- widget,
- 0, 0,
+ style, state,
+ widget, 0, 0,
col_width, ethi->height,
col_width, ethi->height,
(ETableColArrow) g_hash_table_lookup (
arrows, GINT_TO_POINTER (ecol->col_idx)));
gtk_drag_set_icon_pixmap (
context,
- gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)),
+ gdk_drawable_get_colormap (GDK_DRAWABLE (window)),
pixmap,
NULL,
col_width / 2,
@@ -1754,6 +1808,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
GnomeCanvas *canvas = item->canvas;
+ GdkWindow *window;
const gboolean resizing = ETHI_RESIZING (ethi);
gint x, y, start, col;
gint was_maybe_drag = 0;
@@ -1765,7 +1820,8 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
break;
case GDK_LEAVE_NOTIFY:
- gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL);
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_set_cursor (window, NULL);
break;
case GDK_MOTION_NOTIFY:
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index f2a3c1a826..ecb906d093 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -349,12 +349,12 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_ensure_style (window);
gtk_widget_ensure_style (button);
- g_label = GTK_BIN(button)->child;
+ g_label = gtk_bin_get_child (GTK_BIN (button));
g_object_add_weak_pointer (G_OBJECT (g_label), &g_label);
gtk_widget_ensure_style (g_label);
}
- gc = GTK_WIDGET (g_label)->style->fg_gc[state];
+ gc = gtk_widget_get_style (GTK_WIDGET (g_label))->fg_gc[state];
gdk_gc_set_clip_rectangle (gc, NULL);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 3c0fa33bb0..b2c27590c7 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -245,22 +245,22 @@ inline static GdkColor *
eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean selected, gboolean *allocatedp)
{
ECellView *ecell_view = eti->cell_views [col];
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
+ GtkWidget *canvas;
GdkColor *background, bg;
+ GtkStyle *style;
gchar *color_spec = NULL;
gboolean allocated = FALSE;
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ style = gtk_widget_get_style (canvas);
+
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS(canvas))
-#endif
- background = &canvas->style->bg [GTK_STATE_SELECTED];
+ background = &style->bg [GTK_STATE_SELECTED];
else
- background = &canvas->style->bg [GTK_STATE_ACTIVE];
+ background = &style->bg [GTK_STATE_ACTIVE];
} else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
+ background = &style->base [GTK_STATE_NORMAL];
}
color_spec = e_cell_get_bg_color (ecell_view, row);
@@ -268,7 +268,7 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
if (color_spec != NULL) {
if (gdk_color_parse (color_spec, &bg)) {
background = gdk_color_copy (&bg);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background,
+ gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
FALSE, TRUE);
allocated = TRUE;
}
@@ -283,7 +283,7 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
allocated = TRUE;
}
e_hsv_tweak (background, 0.0f, 0.0f, -0.07f);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background,
+ gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
FALSE, TRUE);
}
}
@@ -296,23 +296,23 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
inline static GdkColor *
eti_get_cell_foreground_color (ETableItem *eti, gint row, gint col, gboolean selected, gboolean *allocated)
{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
+ GtkWidget *canvas;
GdkColor *foreground;
+ GtkStyle *style;
+
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ style = gtk_widget_get_style (canvas);
if (allocated)
*allocated = FALSE;
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS (canvas))
-#endif
- foreground = &canvas->style->fg [GTK_STATE_SELECTED];
+ foreground = &style->fg [GTK_STATE_SELECTED];
else
- foreground = &canvas->style->fg [GTK_STATE_ACTIVE];
+ foreground = &style->fg [GTK_STATE_ACTIVE];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text [GTK_STATE_NORMAL];
}
return foreground;
@@ -1631,8 +1631,9 @@ static void
eti_realize (GnomeCanvasItem *item)
{
ETableItem *eti = E_TABLE_ITEM (item);
- GtkWidget *canvas_widget = GTK_WIDGET (item->canvas);
GdkWindow *window;
+ GtkWidget *widget;
+ GtkStyle *style;
if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)
(*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item);
@@ -1642,15 +1643,17 @@ eti_realize (GnomeCanvasItem *item)
/*
* Gdk Resource allocation
*/
- window = canvas_widget->window;
+ widget = GTK_WIDGET (item->canvas);
+ style = gtk_widget_get_style (widget);
+ window = gtk_widget_get_window (widget);
eti->fill_gc = gdk_gc_new (window);
eti->grid_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->dark [GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground (eti->grid_gc, &style->dark [GTK_STATE_NORMAL]);
eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground (eti->focus_gc, &style->bg [GTK_STATE_NORMAL]);
+ gdk_gc_set_background (eti->focus_gc, &style->fg [GTK_STATE_NORMAL]);
eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
@@ -1933,11 +1936,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
gdk_color_free (background);
flags = col_selected ? E_CELL_SELECTED : 0;
-#if GTK_CHECK_VERSION(2,19,7)
flags |= gtk_widget_has_focus (canvas) ? E_CELL_FOCUSED : 0;
-#else
- flags |= GTK_WIDGET_HAS_FOCUS(canvas) ? E_CELL_FOCUSED : 0;
-#endif
flags |= cursor ? E_CELL_CURSOR : 0;
switch (ecol->justification) {
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index 89affd357d..f3bce34487 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -36,6 +36,7 @@ ETableHeader *
e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableState *state)
{
ETableHeader *nh;
+ GtkStyle *style;
const gint max_cols = e_table_header_count (full_header);
gint column;
GValue *val = g_new0 (GValue, 1);
@@ -44,9 +45,11 @@ e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableSta
g_return_val_if_fail (full_header, NULL);
g_return_val_if_fail (state, NULL);
+ style = gtk_widget_get_style (widget);
+
nh = e_table_header_new ();
g_value_init (val, G_TYPE_DOUBLE);
- g_value_set_double (val, e_table_header_width_extras (widget->style));
+ g_value_set_double (val, e_table_header_width_extras (style));
g_object_set_property (G_OBJECT(nh), "width_extras", val);
g_free (val);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 5c35eb26e6..ce2253bc66 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -509,11 +509,9 @@ et_finalize (GObject *object)
static void
e_table_init (ETable *e_table)
{
- GtkTable *gtk_table = GTK_TABLE (e_table);
-
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_table), GTK_CAN_FOCUS);
- gtk_table->homogeneous = FALSE;
+ gtk_table_set_homogeneous (GTK_TABLE (e_table), FALSE);
e_table->sort_info = NULL;
e_table->group_info_change_id = 0;
@@ -582,7 +580,7 @@ et_focus (GtkWidget *container, GtkDirectionType direction)
e_table = E_TABLE (container);
- if (GTK_CONTAINER (container)->focus_child) {
+ if (gtk_container_get_focus_child (GTK_CONTAINER (container))) {
gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
return FALSE;
}
@@ -615,14 +613,18 @@ set_header_canvas_width (ETable *e_table)
static void
header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
{
+ GtkAllocation allocation;
+
set_header_canvas_width (e_table);
+ gtk_widget_get_allocation (
+ GTK_WIDGET (e_table->header_canvas), &allocation);
+
/* When the header item is created ->height == 0,
as the font is only created when everything is realized.
So we set the usize here as well, so that the size of the
header is correct */
- if (GTK_WIDGET (e_table->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_table->header_item)->height)
+ if (allocation.height != E_TABLE_HEADER_ITEM (e_table->header_item)->height)
g_object_set (
e_table->header_canvas, "height-request",
E_TABLE_HEADER_ITEM (e_table->header_item)->height,
@@ -688,14 +690,16 @@ table_canvas_reflow_idle (ETable *e_table)
{
gdouble height, width;
gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation);
+ GtkAllocation allocation;
- g_object_get (e_table->canvas_vbox,
- "height", &height,
- "width", &width,
- NULL);
- height = MAX ((gint)height, alloc->height);
- width = MAX((gint)width, alloc->width);
+ gtk_widget_get_allocation (
+ GTK_WIDGET (e_table->table_canvas), &allocation);
+
+ g_object_get (
+ e_table->canvas_vbox,
+ "height", &height, "width", &width, NULL);
+ height = MAX ((gint)height, allocation.height);
+ width = MAX((gint)width, allocation.width);
/* I have no idea why this needs to be -1, but it works. */
gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
NULL, NULL, &oldwidth, &oldheight);
@@ -805,14 +809,24 @@ group_key_press (ETableGroup *etg, gint row, gint col, GdkEvent *event, ETable *
gboolean return_val = FALSE;
GdkEventKey *key = (GdkEventKey *) event;
gint y, row_local, col_local;
- GtkAdjustment *vadj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
+
+ layout = GTK_LAYOUT (et->table_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
switch (key->keyval) {
case GDK_Page_Down:
case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_value (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ y = CLAMP (value + (2 * page_size - 50), 0, upper);
+ y -= value;
e_table_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -825,9 +839,12 @@ group_key_press (ETableGroup *etg, gint row, gint col, GdkEvent *event, ETable *
break;
case GDK_Page_Up:
case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ y = CLAMP (value - (page_size - 50), 0, upper);
+ y -= value;
e_table_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -1029,9 +1046,15 @@ changed_idle (gpointer data)
static void
et_canvas_realize (GtkWidget *canvas, ETable *e_table)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
+ widget = GTK_WIDGET (e_table->table_canvas);
+ style = gtk_widget_get_style (widget);
+
gnome_canvas_item_set(
e_table->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
CHECK_HORIZONTAL(e_table);
@@ -1052,11 +1075,7 @@ et_eti_leave_edit (ETable *et)
{
GnomeCanvas *canvas = et->table_canvas;
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (canvas))) {
-#else
- if (GTK_WIDGET_HAS_FOCUS(canvas)) {
-#endif
GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item;
if (E_IS_TABLE_ITEM(item)) {
@@ -1208,6 +1227,9 @@ static void
e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header,
ETableModel *model)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
e_table->table_canvas = GNOME_CANVAS (e_canvas_new ());
g_signal_connect (
G_OBJECT (e_table->table_canvas), "size_allocate",
@@ -1247,12 +1269,15 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
g_signal_connect (G_OBJECT(e_table->table_canvas), "reflow",
G_CALLBACK (table_canvas_reflow), e_table);
- gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
+ widget = GTK_WIDGET (e_table->table_canvas);
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_show (widget);
e_table->white_item = gnome_canvas_item_new(
gnome_canvas_root(e_table->table_canvas),
e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
g_signal_connect (G_OBJECT (e_table->white_item), "event",
@@ -1321,12 +1346,19 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
void
e_table_set_state_object(ETable *e_table, ETableState *state)
{
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkWidget *widget;
+ GtkAllocation allocation;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_DOUBLE);
connect_header (e_table, state);
- g_value_set_double (val, (gdouble) (GTK_WIDGET(e_table->table_canvas)->allocation.width));
+ widget = GTK_WIDGET (e_table->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_value_set_double (val, (gdouble) allocation.width);
g_object_set_property (G_OBJECT (e_table->header), "width", val);
g_free (val);
@@ -1528,7 +1560,11 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
{
gint row = 0;
gint col_count, i;
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_OBJECT);
if (ete)
@@ -1607,15 +1643,16 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
e_table_setup_table (e_table, e_table->full_header, e_table->header, etm);
e_table_fill_table (e_table, etm);
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas)));
+ layout = GTK_LAYOUT (e_table->table_canvas);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
if (!specification->no_headers) {
- /*
- * The header
- */
+ /* The header */
gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
@@ -2237,25 +2274,22 @@ set_scroll_adjustments (ETable *table,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
+ if (vadjustment != NULL)
+ gtk_adjustment_set_step_increment (vadjustment, 20);
+
+ if (hadjustment != NULL)
+ gtk_adjustment_set_step_increment (hadjustment, 20);
if (table->table_canvas != NULL) {
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(table->table_canvas),
- vadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(table->table_canvas), hadjustment);
+ gtk_layout_set_vadjustment (
+ GTK_LAYOUT(table->table_canvas), vadjustment);
}
if (table->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->header_canvas),
- hadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(table->header_canvas), hadjustment);
}
/**
@@ -2384,7 +2418,9 @@ e_table_get_cell_at (ETable *table,
gint x, gint y,
gint *row_return, gint *col_return)
{
- g_return_if_fail (table != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TABLE (table));
g_return_if_fail (row_return != NULL);
g_return_if_fail (col_return != NULL);
@@ -2392,9 +2428,16 @@ e_table_get_cell_at (ETable *table,
/* FIXME it would be nice if it could handle a NULL row_return or
* col_return gracefully. */
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- e_table_group_compute_location(table->group, &x, &y, row_return, col_return);
+ layout = GTK_LAYOUT (table->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
+
+ e_table_group_compute_location (
+ table->group, &x, &y, row_return, col_return);
}
/**
@@ -2416,18 +2459,35 @@ e_table_get_cell_geometry (ETable *table,
gint *x_return, gint *y_return,
gint *width_return, gint *height_return)
{
- g_return_if_fail (table != NULL);
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TABLE (table));
- e_table_group_get_cell_geometry(table->group, &row, &col, x_return, y_return, width_return, height_return);
+ layout = GTK_LAYOUT (table->table_canvas);
+
+ e_table_group_get_cell_geometry (
+ table->group, &row, &col, x_return, y_return,
+ width_return, height_return);
+
+ if (x_return && table->table_canvas) {
+ adjustment = gtk_layout_get_hadjustment (layout);
+ (*x_return) -= gtk_adjustment_get_value (adjustment);
+ }
- if (x_return && table->table_canvas)
- (*x_return) -= GTK_LAYOUT(table->table_canvas)->hadjustment->value;
if (y_return) {
- if (table->table_canvas)
- (*y_return) -= GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- if (table->header_canvas)
- (*y_return) += GTK_WIDGET(table->header_canvas)->allocation.height;
+ if (table->table_canvas) {
+ adjustment = gtk_layout_get_vadjustment (layout);
+ (*y_return) -= gtk_adjustment_get_value (adjustment);
+ }
+
+ if (table->header_canvas) {
+ gtk_widget_get_allocation (
+ GTK_WIDGET (table->header_canvas),
+ &allocation);
+ (*y_return) += allocation.height;
+ }
}
}
@@ -2578,30 +2638,39 @@ e_table_drag_highlight (ETable *table,
gint row,
gint col)
{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+ GtkStyle *style;
+
+ g_return_if_fail (E_IS_TABLE (table));
+
+ layout = GTK_LAYOUT (table->table_canvas);
+ style = gtk_widget_get_style (GTK_WIDGET (table));
+ gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
if (row != -1) {
gint x, y, width, height;
if (col == -1) {
e_table_get_cell_geometry (table, row, 0, &x, &y, &width, &height);
x = 0;
- width = GTK_WIDGET (table->table_canvas)->allocation.width;
+ width = allocation.width;
} else {
e_table_get_cell_geometry (table, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
}
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
if (table->drop_highlight == NULL) {
- table->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (table->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (table)->style->fg[GTK_STATE_NORMAL]),
- NULL);
+ table->drop_highlight = gnome_canvas_item_new (
+ gnome_canvas_root (table->table_canvas),
+ gnome_canvas_rect_get_type (),
+ "fill_color", NULL,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ NULL);
}
gnome_canvas_item_set (table->drop_highlight,
"x1", (gdouble) x,
@@ -2901,8 +2970,15 @@ scroll_timeout (gpointer data)
{
ETable *et = data;
gint dx = 0, dy = 0;
- GtkAdjustment *h, *v;
- gdouble hvalue, vvalue;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble old_h_value;
+ gdouble new_h_value;
+ gdouble old_v_value;
+ gdouble new_v_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
if (et->scroll_direction & ET_SCROLL_DOWN)
dy += 20;
@@ -2914,22 +2990,37 @@ scroll_timeout (gpointer data)
if (et->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(et->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->table_canvas)->vadjustment;
+ layout = GTK_LAYOUT (et->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
- hvalue = h->value;
- vvalue = v->value;
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
+ old_h_value = gtk_adjustment_get_value (adjustment);
+ new_h_value = CLAMP (old_h_value + dx, lower, upper - page_size);
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->last_drop_context,
- et->last_drop_x,
- et->last_drop_y,
- et->last_drop_time);
+ gtk_adjustment_set_value (adjustment, new_h_value);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+
+ old_v_value = gtk_adjustment_get_value (adjustment);
+ new_v_value = CLAMP (old_v_value + dy, lower, upper - page_size);
+
+ gtk_adjustment_set_value (adjustment, new_v_value);
+
+ if (new_h_value != old_h_value || new_v_value != old_v_value)
+ do_drag_motion (
+ et,
+ et->last_drop_context,
+ et->last_drop_x,
+ et->last_drop_y,
+ et->last_drop_time);
return TRUE;
}
@@ -3001,28 +3092,27 @@ et_drag_motion(GtkWidget *widget,
guint time,
ETable *et)
{
+ GtkAllocation allocation;
gboolean ret_val;
guint direction = 0;
+ gtk_widget_get_allocation (widget, &allocation);
+
et->last_drop_x = x;
et->last_drop_y = y;
et->last_drop_time = time;
et->last_drop_context = context;
context_connect (et, context);
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
+ ret_val = do_drag_motion (et, context, x, y, time);
if (y < 20)
direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
+ if (y > allocation.height - 20)
direction |= ET_SCROLL_DOWN;
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
if (direction != 0)
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index c093255518..3f7ab111fa 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -538,11 +538,9 @@ et_search_accept (ETableSearch *search, ETree *et)
static void
e_tree_init (ETree *e_tree)
{
- GtkTable *gtk_table = GTK_TABLE (e_tree);
-
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_tree), GTK_CAN_FOCUS);
- gtk_table->homogeneous = FALSE;
+ gtk_table_set_homogeneous (GTK_TABLE (e_tree), FALSE);
e_tree->priv = g_new(ETreePriv, 1);
@@ -656,7 +654,7 @@ et_focus (GtkWidget *container, GtkDirectionType direction)
e_tree = E_TREE (container);
- if (GTK_CONTAINER (container)->focus_child) {
+ if (gtk_container_get_focus_child (GTK_CONTAINER (container))) {
gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
return FALSE;
}
@@ -689,16 +687,21 @@ set_header_canvas_width (ETree *e_tree)
static void
header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *e_tree)
{
+ GtkAllocation allocation;
+
set_header_canvas_width (e_tree);
+ widget = GTK_WIDGET (e_tree->priv->header_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
/* When the header item is created ->height == 0,
as the font is only created when everything is realized.
So we set the usize here as well, so that the size of the
header is correct */
- if (GTK_WIDGET (e_tree->priv->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
- gtk_widget_set_size_request (GTK_WIDGET (e_tree->priv->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
+ if (allocation.height != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
+ gtk_widget_set_size_request (
+ widget, -1,
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
}
static void
@@ -737,23 +740,39 @@ static void
scroll_to_cursor (ETree *e_tree)
{
ETreePath path;
- GtkAdjustment *adj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
gint x, y, w, h;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
path = e_tree_get_cursor (e_tree);
- adj = GTK_LAYOUT (e_tree->priv->table_canvas)->vadjustment;
x = y = w = h = 0;
+
if (path) {
gint row = e_tree_row_of_node(e_tree, path);
gint col = 0;
if (row >= 0)
- e_table_item_get_cell_geometry (E_TABLE_ITEM (e_tree->priv->item),
- &row, &col, &x, &y, &w, &h);
+ e_table_item_get_cell_geometry (
+ E_TABLE_ITEM (e_tree->priv->item),
+ &row, &col, &x, &y, &w, &h);
}
- if (y < adj->value || y + h > adj->value + adj->page_size)
- gtk_adjustment_set_value(adj, CLAMP(y - adj->page_size / 2, adj->lower, adj->upper - adj->page_size));
+ layout = GTK_LAYOUT (e_tree->priv->table_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ if (y < value || y + h > value + page_size) {
+ value = CLAMP (y - page_size / 2, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, value);
+ }
}
static gboolean
@@ -761,24 +780,32 @@ tree_canvas_reflow_idle (ETree *e_tree)
{
gdouble height, width;
gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_tree->priv->table_canvas)->allocation);
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_object_get (
+ e_tree->priv->item,
+ "height", &height, "width", &width, NULL);
+
+ height = MAX ((gint)height, allocation.height);
+ width = MAX((gint)width, allocation.width);
- g_object_get (e_tree->priv->item,
- "height", &height,
- "width", &width,
- NULL);
- height = MAX ((gint)height, alloc->height);
- width = MAX((gint)width, alloc->width);
/* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- NULL, NULL, &oldwidth, &oldheight);
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (e_tree->priv->table_canvas),
+ NULL, NULL, &oldwidth, &oldheight);
if (oldwidth != width - 1 ||
oldheight != height - 1) {
- gnome_canvas_set_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- 0, 0, width - 1, height - 1);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_tree->priv->table_canvas),
+ 0, 0, width - 1, height - 1);
set_header_canvas_width (e_tree);
}
+
e_tree->priv->reflow_idle_id = 0;
if (e_tree->priv->show_cursor_after_reflow) {
@@ -881,14 +908,24 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et)
GdkEventKey *key = (GdkEventKey *) event;
ETreePath path;
gint y, row_local, col_local;
- GtkAdjustment *vadj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
+
+ layout = GTK_LAYOUT (et->priv->table_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
switch (key->keyval) {
case GDK_Page_Down:
case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ y = CLAMP (value + (2 * page_size - 50), 0, upper);
+ y -= value;
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -902,9 +939,8 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et)
break;
case GDK_Page_Up:
case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ y = CLAMP (value - (page_size - 50), 0, upper);
+ y -= value;
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -1029,9 +1065,13 @@ et_build_item (ETree *et)
static void
et_canvas_style_set (GtkWidget *widget, GtkStyle *prev_style)
{
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
gnome_canvas_item_set(
E_TREE(widget)->priv->white_item,
- "fill_color_gdk", &widget->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
}
@@ -1053,11 +1093,7 @@ et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETree *e_tree)
case GDK_2BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.button != 4 && event->button.button != 5) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (root->canvas))) {
-#else
- if (GTK_WIDGET_HAS_FOCUS(root->canvas)) {
-#endif
GnomeCanvasItem *item = GNOME_CANVAS(root->canvas)->focused_item;
if (E_IS_TABLE_ITEM(item)) {
@@ -1102,6 +1138,9 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d
static void
e_tree_setup_table (ETree *e_tree)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
e_tree->priv->table_canvas = GNOME_CANVAS (e_canvas_new ());
g_signal_connect (
e_tree->priv->table_canvas, "size_allocate",
@@ -1141,16 +1180,20 @@ e_tree_setup_table (ETree *e_tree)
g_signal_connect (e_tree->priv->table_canvas, "reflow",
G_CALLBACK (tree_canvas_reflow), e_tree);
- gtk_widget_show (GTK_WIDGET (e_tree->priv->table_canvas));
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_show (widget);
- e_tree->priv->white_item = gnome_canvas_item_new(
- gnome_canvas_root(e_tree->priv->table_canvas),
+ e_tree->priv->white_item = gnome_canvas_item_new (
+ gnome_canvas_root (e_tree->priv->table_canvas),
e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
- g_signal_connect (e_tree->priv->white_item, "event",
- G_CALLBACK (white_item_event), e_tree);
+ g_signal_connect (
+ e_tree->priv->white_item, "event",
+ G_CALLBACK (white_item_event), e_tree);
g_signal_connect (
gnome_canvas_root (e_tree->priv->table_canvas), "event",
G_CALLBACK(et_canvas_root_event), e_tree);
@@ -1182,12 +1225,19 @@ e_tree_set_search_column (ETree *e_tree, gint col)
void
e_tree_set_state_object(ETree *e_tree, ETableState *state)
{
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_DOUBLE);
connect_header (e_tree, state);
- g_value_set_double (val, (gdouble) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width));
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_value_set_double (val, (gdouble) allocation.width);
g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val);
g_free (val);
@@ -1424,6 +1474,8 @@ static gboolean
et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
ETableSpecification *specification, ETableState *state)
{
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
gint row = 0;
if (ete)
@@ -1475,10 +1527,13 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
}
e_tree_setup_table (e_tree);
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
+ layout = GTK_LAYOUT (e_tree->priv->table_canvas);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
if (!specification->no_headers) {
/*
@@ -1930,24 +1985,24 @@ set_scroll_adjustments (ETree *tree,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
+ GtkLayout *layout;
+
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ if (vadjustment != NULL)
+ gtk_adjustment_set_step_increment (vadjustment, 20);
+
+ if (hadjustment != NULL)
+ gtk_adjustment_set_step_increment (hadjustment, 20);
if (tree->priv) {
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- vadjustment);
+ gtk_layout_set_hadjustment (layout, hadjustment);
+ gtk_layout_set_vadjustment (layout, vadjustment);
if (tree->priv->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->header_canvas),
- hadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(tree->priv->header_canvas),
+ hadjustment);
}
}
@@ -2383,37 +2438,48 @@ e_tree_drag_highlight (ETree *tree,
gint row,
gint col)
{
- g_return_if_fail(tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+ GtkStyle *style;
+
g_return_if_fail(E_IS_TREE(tree));
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+ style = gtk_widget_get_style (GTK_WIDGET (tree));
+ gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
+
if (row != -1) {
gint x, y, width, height;
if (col == -1) {
e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
x = 0;
- width = GTK_WIDGET (tree->priv->table_canvas)->allocation.width;
+ width = allocation.width;
} else {
e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
}
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
if (tree->priv->drop_highlight == NULL) {
- tree->priv->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (tree->priv->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (tree)->style->fg[GTK_STATE_NORMAL]),
- NULL);
+ tree->priv->drop_highlight = gnome_canvas_item_new (
+ gnome_canvas_root (tree->priv->table_canvas),
+ gnome_canvas_rect_get_type (),
+ "fill_color", NULL,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ NULL);
}
- gnome_canvas_item_set (tree->priv->drop_highlight,
- "x1", (gdouble) x,
- "x2", (gdouble) x + width - 1,
- "y1", (gdouble) y,
- "y2", (gdouble) y + height - 1,
- NULL);
+
+ gnome_canvas_item_set (
+ tree->priv->drop_highlight,
+ "x1", (gdouble) x,
+ "x2", (gdouble) x + width - 1,
+ "y1", (gdouble) y,
+ "y2", (gdouble) y + height - 1,
+ NULL);
} else {
gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
tree->priv->drop_highlight = NULL;
@@ -2617,7 +2683,9 @@ e_tree_get_cell_at (ETree *tree,
gint x, gint y,
gint *row_return, gint *col_return)
{
- g_return_if_fail (tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TREE (tree));
g_return_if_fail (row_return != NULL);
g_return_if_fail (col_return != NULL);
@@ -2630,9 +2698,17 @@ e_tree_get_cell_at (ETree *tree,
if (col_return)
*col_return = -1;
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- e_table_item_compute_location(E_TABLE_ITEM(tree->priv->item), &x, &y, row_return, col_return);
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
+
+ e_table_item_compute_location (
+ E_TABLE_ITEM (tree->priv->item),
+ &x, &y, row_return, col_return);
}
/**
@@ -2653,7 +2729,9 @@ e_tree_get_cell_geometry (ETree *tree,
gint *x_return, gint *y_return,
gint *width_return, gint *height_return)
{
- g_return_if_fail (tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TREE (tree));
g_return_if_fail (row >= 0);
g_return_if_fail (col >= 0);
@@ -2661,12 +2739,22 @@ e_tree_get_cell_geometry (ETree *tree,
/* FIXME it would be nice if it could handle a NULL row_return or
* col_return gracefully. */
- e_table_item_get_cell_geometry(E_TABLE_ITEM(tree->priv->item), &row, &col, x_return, y_return, width_return, height_return);
+ e_table_item_get_cell_geometry (
+ E_TABLE_ITEM (tree->priv->item),
+ &row, &col, x_return, y_return,
+ width_return, height_return);
+
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ if (x_return) {
+ adjustment = gtk_layout_get_hadjustment (layout);
+ (*x_return) -= gtk_adjustment_get_value (adjustment);
+ }
- if (x_return)
- (*x_return) -= GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- if (y_return)
- (*y_return) -= GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
+ if (y_return) {
+ adjustment = gtk_layout_get_vadjustment (layout);
+ (*y_return) -= gtk_adjustment_get_value (adjustment);
+ }
}
static void
@@ -2777,8 +2865,15 @@ scroll_timeout (gpointer data)
{
ETree *et = data;
gint dx = 0, dy = 0;
- GtkAdjustment *v, *h;
- gdouble vvalue, hvalue;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble old_h_value;
+ gdouble new_h_value;
+ gdouble old_v_value;
+ gdouble new_v_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
if (et->priv->scroll_direction & ET_SCROLL_DOWN)
dy += 20;
@@ -2790,22 +2885,37 @@ scroll_timeout (gpointer data)
if (et->priv->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(et->priv->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->priv->table_canvas)->vadjustment;
+ layout = GTK_LAYOUT (et->priv->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
- hvalue = h->value;
- vvalue = v->value;
+ old_h_value = gtk_adjustment_get_value (adjustment);
+ new_h_value = CLAMP (old_h_value + dx, lower, upper - page_size);
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
+ gtk_adjustment_set_value (adjustment, new_h_value);
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->priv->last_drop_context,
- et->priv->last_drop_x,
- et->priv->last_drop_y,
- et->priv->last_drop_time);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+
+ old_v_value = gtk_adjustment_get_value (adjustment);
+ new_v_value = CLAMP (old_v_value + dy, lower, upper - page_size);
+
+ gtk_adjustment_set_value (adjustment, new_v_value);
+
+ if (new_h_value != old_h_value || new_v_value != old_v_value)
+ do_drag_motion (
+ et,
+ et->priv->last_drop_context,
+ et->priv->last_drop_x,
+ et->priv->last_drop_y,
+ et->priv->last_drop_time);
return TRUE;
}
@@ -2969,6 +3079,7 @@ et_drag_motion(GtkWidget *widget,
guint time,
ETree *et)
{
+ GtkAllocation allocation;
gint ret_val;
guint direction = 0;
@@ -2987,19 +3098,17 @@ et_drag_motion(GtkWidget *widget,
hover_on (et, x, y);
}
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
+ ret_val = do_drag_motion (et, context, x, y, time);
+
+ gtk_widget_get_allocation (widget, &allocation);
if (y < 20)
direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
+ if (y > allocation.height - 20)
direction |= ET_SCROLL_DOWN;
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
if (direction != 0)
@@ -3453,6 +3562,9 @@ tree_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *tree)
void
e_tree_set_info_message (ETree *tree, const gchar *info_message)
{
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
g_return_if_fail (tree != NULL);
g_return_if_fail (tree->priv != NULL);
@@ -3466,18 +3578,22 @@ e_tree_set_info_message (ETree *tree, const gchar *info_message)
return;
}
+ widget = GTK_WIDGET (tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
if (!tree->priv->info_text) {
- tree->priv->info_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (gnome_canvas_root (tree->priv->table_canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "line_wrap", TRUE,
- "clip", TRUE,
- "justification", GTK_JUSTIFY_LEFT,
- "text", info_message,
- "draw_background", FALSE,
- "width", (gdouble) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
- "clip_width", (gdouble) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
- NULL);
+ tree->priv->info_text = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (gnome_canvas_root (tree->priv->table_canvas)),
+ e_text_get_type (),
+ "anchor", GTK_ANCHOR_NW,
+ "line_wrap", TRUE,
+ "clip", TRUE,
+ "justification", GTK_JUSTIFY_LEFT,
+ "text", info_message,
+ "draw_background", FALSE,
+ "width", (gdouble) allocation.width - 60.0,
+ "clip_width", (gdouble) allocation.width - 60.0,
+ NULL);
e_canvas_item_move_absolute (tree->priv->info_text, 30, 30);
diff --git a/widgets/table/gal-a11y-e-cell-popup.c b/widgets/table/gal-a11y-e-cell-popup.c
index 33dcf733a5..921ae8e4d5 100644
--- a/widgets/table/gal-a11y-e-cell-popup.c
+++ b/widgets/table/gal-a11y-e-cell-popup.c
@@ -133,9 +133,12 @@ popup_cell_action (GalA11yECell *cell)
{
gint finished;
GdkEvent event;
+ GtkLayout *layout;
+
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (cell->item)->canvas);
event.key.type = GDK_KEY_PRESS;
- event.key.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;;
+ event.key.window = gtk_layout_get_bin_window (layout);
event.key.send_event = TRUE;
event.key.time = GDK_CURRENT_TIME;
event.key.state = GDK_MOD1_MASK;
diff --git a/widgets/table/gal-a11y-e-cell-toggle.c b/widgets/table/gal-a11y-e-cell-toggle.c
index 25d59496a7..54b1b3586c 100644
--- a/widgets/table/gal-a11y-e-cell-toggle.c
+++ b/widgets/table/gal-a11y-e-cell-toggle.c
@@ -90,6 +90,7 @@ static void
toggle_cell_action (GalA11yECell *cell)
{
gint finished;
+ GtkLayout *layout;
GdkEventButton event;
gint x, y, width, height;
gint row, col;
@@ -97,14 +98,16 @@ toggle_cell_action (GalA11yECell *cell)
row = cell->row;
col = cell->view_col;
- e_table_item_get_cell_geometry (cell->item, &row, &col,
- &x, &y, &width, &height);
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (cell->item)->canvas);
+
+ e_table_item_get_cell_geometry (
+ cell->item, &row, &col, &x, &y, &width, &height);
event.x = x + width / 2 + (gint)(GNOME_CANVAS_ITEM (cell->item)->x1);
event.y = y + height / 2 + (gint)(GNOME_CANVAS_ITEM (cell->item)->y1);
event.type = GDK_BUTTON_PRESS;
- event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;
+ event.window = gtk_layout_get_bin_window (layout);
event.button = 1;
event.send_event = TRUE;
event.time = GDK_CURRENT_TIME;
diff --git a/widgets/table/gal-a11y-e-table-click-to-add.c b/widgets/table/gal-a11y-e-table-click-to-add.c
index 8d788a458b..ebec8681ae 100644
--- a/widgets/table/gal-a11y-e-table-click-to-add.c
+++ b/widgets/table/gal-a11y-e-table-click-to-add.c
@@ -72,26 +72,30 @@ etcta_action_get_name (AtkAction *action, gint i)
static gboolean
idle_do_action (gpointer data)
{
- GdkEventButton event;
+ GtkLayout *layout;
+ GdkEventButton event;
ETableClickToAdd * etcta;
- gint finished;
+ gint finished;
g_return_val_if_fail ( data!= NULL, FALSE);
- etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (data)));
+ etcta = E_TABLE_CLICK_TO_ADD (
+ atk_gobject_accessible_get_object (
+ ATK_GOBJECT_ACCESSIBLE (data)));
g_return_val_if_fail (etcta, FALSE);
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (etcta)->canvas);
+
event.x = 0;
event.y = 0;
-
- event.type = GDK_BUTTON_PRESS;
- event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(etcta)->canvas)->bin_window;
- event.button = 1;
- event.send_event = TRUE;
- event.time = GDK_CURRENT_TIME;
- event.axes = NULL;
-
- g_signal_emit_by_name (etcta, "event", &event, &finished);
+ event.type = GDK_BUTTON_PRESS;
+ event.window = gtk_layout_get_bin_window (layout);
+ event.button = 1;
+ event.send_event = TRUE;
+ event.time = GDK_CURRENT_TIME;
+ event.axes = NULL;
+
+ g_signal_emit_by_name (etcta, "event", &event, &finished);
return FALSE;
}
diff --git a/widgets/table/gal-a11y-e-table.c b/widgets/table/gal-a11y-e-table.c
index 37e5b892d2..6134b2d297 100644
--- a/widgets/table/gal-a11y-e-table.c
+++ b/widgets/table/gal-a11y-e-table.c
@@ -90,11 +90,7 @@ init_child_item (GalA11yETable *a11y)
return FALSE;
table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
-#if GTK_CHECK_VERSION(2,19,7)
if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
-#else
- if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
-#endif
ETableGroupContainer *etgc = (ETableGroupContainer *)table->group;
GList *list;
@@ -288,11 +284,7 @@ gal_a11y_e_table_new (GObject *widget)
GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
/* we need to init all the children for multiple table items */
-#if GTK_CHECK_VERSION(2,19,7)
if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) {
-#else
- if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) {
-#endif
/* Ref it here so that it is still valid in the idle function */
/* It will be unrefed in the idle function */
g_object_ref (a11y);
diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c
index 0e11047408..4e3f36fd19 100644
--- a/widgets/text/e-reflow.c
+++ b/widgets/text/e-reflow.c
@@ -162,20 +162,25 @@ static gboolean
do_adjustment (gpointer user_data)
{
gint row;
- GtkAdjustment *adj;
- gfloat value, min_value, max_value;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble page_size;
+ gdouble value, min_value, max_value;
EReflow *reflow = user_data;
row = reflow->cursor_row;
if (row == -1)
return FALSE;
- adj = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
- value = adj->value;
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ value = gtk_adjustment_get_value (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
if ((!reflow->items) || (!reflow->items[row]))
return TRUE;
- min_value = reflow->items[row]->x2 - adj->page_size;
+ min_value = reflow->items[row]->x2 - page_size;
max_value = reflow->items[row]->x1;
if (value < min_value)
@@ -184,10 +189,8 @@ do_adjustment (gpointer user_data)
if (value > max_value)
value = max_value;
- if (value != adj->value) {
- adj->value = value;
- gtk_adjustment_value_changed (adj);
- }
+ if (value != gtk_adjustment_get_value (adjustment))
+ gtk_adjustment_set_value (adjustment, value);
reflow->do_adjustment_idle_id = 0;
@@ -238,14 +241,23 @@ incarnate (EReflow *reflow)
gint first_cell;
gint last_cell;
gint i;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble value;
+ gdouble page_size;
+
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ value = gtk_adjustment_get_value (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
column_width = reflow->column_width;
- first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH;
+ first_column = value - 1 + E_REFLOW_BORDER_WIDTH;
first_column /= column_width + E_REFLOW_FULL_GUTTER;
- last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
+ last_column = value + page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
last_column /= column_width + E_REFLOW_FULL_GUTTER;
last_column ++;
@@ -733,13 +745,23 @@ e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GPar
break;
case PROP_COLUMN_WIDTH:
if (reflow->column_width != g_value_get_double (value)) {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
gdouble old_width = reflow->column_width;
+ gdouble step_increment;
+ gdouble page_size;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ page_size = gtk_adjustment_get_page_size (adjustment);
reflow->column_width = g_value_get_double (value);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
+ step_increment = (reflow->column_width +
+ E_REFLOW_FULL_GUTTER) / 2;
+ gtk_adjustment_set_step_increment (
+ adjustment, step_increment);
+ gtk_adjustment_set_page_increment (
+ adjustment, page_size - step_increment);
e_reflow_resize_children(item);
e_canvas_item_request_reflow(item);
@@ -827,6 +849,9 @@ e_reflow_realize (GnomeCanvasItem *item)
{
EReflow *reflow;
GtkAdjustment *adjustment;
+ gdouble page_increment;
+ gdouble step_increment;
+ gdouble page_size;
gint count;
gint i;
@@ -851,19 +876,18 @@ e_reflow_realize (GnomeCanvasItem *item)
reflow->need_reflow_columns = TRUE;
e_canvas_item_request_reflow(item);
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (item->canvas));
#if 0
connect_set_adjustment (reflow);
#endif
connect_adjustment (reflow, adjustment);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
-
- if (!item->canvas->aa) {
- }
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
+ page_increment = page_size - step_increment;
+ gtk_adjustment_set_step_increment (adjustment, step_increment);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
}
static void
@@ -873,9 +897,6 @@ e_reflow_unrealize (GnomeCanvasItem *item)
reflow = E_REFLOW (item);
- if (!item->canvas->aa) {
- }
-
gdk_cursor_unref (reflow->arrow_cursor);
gdk_cursor_unref (reflow->default_cursor);
reflow->arrow_cursor = NULL;
@@ -979,20 +1000,34 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
break;
case 4:
{
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value -= adjustment->step_increment;
- gtk_adjustment_set_value(adjustment, new_value);
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ new_value = gtk_adjustment_get_value (adjustment);
+ new_value -= gtk_adjustment_get_step_increment (adjustment);
+ gtk_adjustment_set_value (adjustment, new_value);
}
break;
case 5:
{
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value += adjustment->step_increment;
- if (new_value > adjustment->upper - adjustment->page_size)
- new_value = adjustment->upper - adjustment->page_size;
- gtk_adjustment_set_value(adjustment, new_value);
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+ gdouble page_size;
+ gdouble upper;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ new_value = gtk_adjustment_get_value (adjustment);
+ new_value += gtk_adjustment_get_step_increment (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ if (new_value > upper - page_size)
+ new_value = upper - page_size;
+ gtk_adjustment_set_value (adjustment, new_value);
}
break;
}
@@ -1001,18 +1036,31 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
if (reflow->column_drag) {
gdouble old_width = reflow->column_width;
GdkEventButton *button = (GdkEventButton *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
reflow->temp_column_width = reflow->column_width +
- (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
+ (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, value));
if (reflow->temp_column_width < 50)
reflow->temp_column_width = 50;
reflow->column_drag = FALSE;
if (old_width != reflow->temp_column_width) {
- gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width));
+ gdouble page_increment;
+ gdouble step_increment;
+ gdouble page_size;
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ gtk_adjustment_set_value(adjustment, value + e_reflow_pick_line(reflow, value) * (reflow->temp_column_width - reflow->column_width));
reflow->column_width = reflow->temp_column_width;
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
+ step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
+ page_increment = page_size - step_increment;
+ gtk_adjustment_set_step_increment (adjustment, step_increment);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
e_reflow_resize_children(item);
e_canvas_item_request_reflow(item);
gnome_canvas_request_redraw(item->canvas, 0, 0, reflow->width, reflow->height);
@@ -1028,9 +1076,16 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
if (reflow->column_drag) {
gdouble old_width = reflow->temp_column_width;
GdkEventMotion *motion = (GdkEventMotion *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
reflow->temp_column_width = reflow->column_width +
- (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
+ (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, value));
if (reflow->temp_column_width < 50)
reflow->temp_column_width = 50;
if (old_width != reflow->temp_column_width) {
@@ -1040,20 +1095,23 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
return TRUE;
} else {
GdkEventMotion *motion = (GdkEventMotion *) event;
+ GdkWindow *window;
gdouble n_x;
n_x = motion->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER) {
if (reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
+ gdk_window_set_cursor(window, reflow->arrow_cursor);
reflow->default_cursor_shown = FALSE;
}
} else
if (!reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
+ gdk_window_set_cursor(window, reflow->default_cursor);
reflow->default_cursor_shown = TRUE;
}
@@ -1062,14 +1120,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_ENTER_NOTIFY:
if (!reflow->column_drag) {
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
+ GdkWindow *window;
gdouble n_x;
+
n_x = crossing->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER) {
if (reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
+ gdk_window_set_cursor(window, reflow->arrow_cursor);
reflow->default_cursor_shown = FALSE;
}
}
@@ -1078,13 +1140,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_LEAVE_NOTIFY:
if (!reflow->column_drag) {
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
+ GdkWindow *window;
gdouble n_x;
+
n_x = crossing->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (!( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER )) {
if (!reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
+ gdk_window_set_cursor(window, reflow->default_cursor);
reflow->default_cursor_shown = TRUE;
}
}
@@ -1104,6 +1171,7 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gint x, gint y, gint width, gint height)
{
+ GtkStyle *style;
gint x_rect, y_rect, width_rect, height_rect;
gdouble running_width;
EReflow *reflow = E_REFLOW(item);
@@ -1123,11 +1191,13 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
i /= column_width + E_REFLOW_FULL_GUTTER;
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
+ style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
+
for (; i < reflow->column_count; i++) {
if (running_width > x + width)
break;
x_rect = running_width;
- gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style,
+ gtk_paint_flat_box(style,
drawable,
GTK_STATE_ACTIVE,
GTK_SHADOW_NONE,
@@ -1141,8 +1211,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
}
if (reflow->column_drag) {
- gint start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+ gint start_line;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
+ start_line = e_reflow_pick_line(reflow, value);
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
column_width = reflow->temp_column_width;
@@ -1162,7 +1240,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
break;
x_rect = running_width;
gdk_draw_rectangle(drawable,
- GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL],
+ style->fg_gc[GTK_STATE_NORMAL],
TRUE,
x_rect - x,
y_rect - y,
@@ -1212,12 +1290,19 @@ e_reflow_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gi
gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1);
reflow->need_height_update = FALSE;
} else if (reflow->need_column_resize) {
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
gint x_rect, y_rect, width_rect, height_rect;
- gint start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
+ gint start_line;
gdouble running_width;
gint i;
gdouble column_width;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+ start_line = e_reflow_pick_line (reflow, value);
if (reflow->previous_temp_column_width != -1) {
running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 2a455409ba..92fc67cbfa 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1439,11 +1439,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
widget = gtk_widget_get_parent (widget);
while (widget && !GTK_IS_BUTTON(widget)) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_has_window (widget)) {
-#else
- if (!GTK_WIDGET_NO_WINDOW (widget)) {
-#endif
widget = NULL;
break;
}
@@ -1498,11 +1494,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
thisy += (1 + default_spacing) / 2;
}
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
-#endif
thisx += 1;
thisy += 1;
thiswidth -= 2;
@@ -1522,11 +1514,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
thisx + xoff, thisy + yoff,
thiswidth, thisheight);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
-#endif
thisx -= 1;
thisy -= 1;
thiswidth += 2;
diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c
index 6c6724ea6d..e368e7d68b 100644
--- a/widgets/text/gal-a11y-e-text.c
+++ b/widgets/text/gal-a11y-e-text.c
@@ -533,7 +533,7 @@ et_get_character_extents (AtkText *text,
etext = E_TEXT(obj);
canvas = GNOME_CANVAS_ITEM(etext)->canvas;
widget = GTK_WIDGET(canvas);
- window = widget->window;
+ window = gtk_widget_get_window (widget);
gdk_window_get_origin (window, &x_widget, &y_widget);
pango_layout_index_to_pos (etext->layout, offset, &pango_pos);
@@ -611,7 +611,7 @@ et_get_offset_at_point (AtkText *text,
etext = E_TEXT(obj);
canvas = GNOME_CANVAS_ITEM(etext)->canvas;
widget = GTK_WIDGET(canvas);
- window = widget->window;
+ window = gtk_widget_get_window (widget);
gdk_window_get_origin (window, &x_widget, &y_widget);
if (coords == ATK_XY_SCREEN) {