aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-05 12:38:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-05 20:36:23 +0800
commit2836a54dd6d61e35d1446f9a23a628064516a309 (patch)
treeb9cb2ab39212de803e935ed28957ee77e73c2d96 /widgets/misc
parentbaa7f20333a5bbb7c8cbb3cf2ce86b57aba79ef2 (diff)
downloadgsoc2013-evolution-2836a54dd6d61e35d1446f9a23a628064516a309.tar.gz
gsoc2013-evolution-2836a54dd6d61e35d1446f9a23a628064516a309.tar.zst
gsoc2013-evolution-2836a54dd6d61e35d1446f9a23a628064516a309.zip
Work around recent GTK+ deprecations.
Diffstat (limited to 'widgets/misc')
-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.c43
-rw-r--r--widgets/misc/e-online-button.c4
-rw-r--r--widgets/misc/e-search-bar.c4
-rw-r--r--widgets/misc/e-spinner.c8
11 files changed, 99 insertions, 1 deletions
diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c
index 248e1c004c..9501f29d6a 100644
--- a/widgets/misc/e-buffer-tagger.c
+++ b/widgets/misc/e-buffer-tagger.c
@@ -308,7 +308,11 @@ 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 84adf6185f..def7019c21 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1552,7 +1552,11 @@ 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 5fb933baa6..27ac031b8d 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -266,7 +266,11 @@ 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;
@@ -558,8 +562,13 @@ 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;
}
@@ -586,7 +595,11 @@ 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;
@@ -636,7 +649,11 @@ 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 ab70082e95..3b4cbadd20 100644
--- a/widgets/misc/e-canvas-background.c
+++ b/widgets/misc/e-canvas-background.c
@@ -437,7 +437,11 @@ 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 8b1a6d2409..db187b6e13 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -568,7 +568,11 @@ 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 acc4cb353d..db63ffaaf8 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -1720,7 +1720,11 @@ 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 0b9708ab60..24bac0087c 100644
--- a/widgets/misc/e-hinted-entry.c
+++ b/widgets/misc/e-hinted-entry.c
@@ -290,7 +290,11 @@ 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 809841b114..f59e33d5cd 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -382,7 +382,11 @@ 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);
@@ -406,8 +410,12 @@ 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);
- return TRUE;
+#endif
+ return TRUE;
}
/* Button release handler for the map view */
@@ -641,7 +649,11 @@ 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);
@@ -694,7 +706,11 @@ 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;
@@ -714,7 +730,11 @@ 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;
@@ -950,7 +970,11 @@ 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);
@@ -1015,8 +1039,13 @@ 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;
@@ -1226,7 +1255,11 @@ 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);
@@ -1540,7 +1573,11 @@ 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);
@@ -1707,7 +1744,11 @@ 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 444296dcef..601aaa4117 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -51,7 +51,11 @@ 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 120f114bb8..06b9ef6e78 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -92,7 +92,11 @@ 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/misc/e-spinner.c b/widgets/misc/e-spinner.c
index c95f26b0a7..5e7833b34f 100644
--- a/widgets/misc/e-spinner.c
+++ b/widgets/misc/e-spinner.c
@@ -647,7 +647,11 @@ e_spinner_expose (GtkWidget *widget,
gint x_offset, y_offset, width, height;
GdkRectangle pix_area, dest;
+#if GTK_CHECK_VERSION(2,19,7)
+ if (!gtk_widget_is_drawable (GTK_WIDGET (spinner)))
+#else
if (!GTK_WIDGET_DRAWABLE (spinner))
+#endif
{
return FALSE;
}
@@ -738,7 +742,11 @@ e_spinner_start (ESpinner *spinner)
details->spinning = TRUE;
+#if GTK_CHECK_VERSION(2,19,7)
+ if (gtk_widget_get_mapped (GTK_WIDGET (spinner)) &&
+#else
if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)) &&
+#endif
details->timer_task == 0 &&
e_spinner_load_images (spinner))
{