[gtksourceview] Bug 615392 - Use accessor functions instead direct access
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Bug 615392 - Use accessor functions instead direct access
- Date: Tue, 11 May 2010 10:02:26 +0000 (UTC)
commit c2480d65e8824c69a4385430a7c188fe3e143478
Author: Garrett Regier <alias301 gmail com>
Date: Sun May 9 14:19:39 2010 -0700
Bug 615392 - Use accessor functions instead direct access
A compatibility header was added: gseal-gtk-compat.h
configure.ac | 2 +-
gtksourceview/Makefile.am | 3 +-
gtksourceview/gseal-gtk-compat.h | 59 ++++++++++++++++++++++++++++++
gtksourceview/gtksourcecompletion.c | 32 +++++++++-------
gtksourceview/gtksourcecompletioninfo.c | 31 ++++++++++------
gtksourceview/gtksourcegutter.c | 5 ++-
gtksourceview/gtksourcestylescheme.c | 3 +-
gtksourceview/gtksourceview.c | 61 +++++++++++++++++++++----------
tests/test-widget.c | 10 ++++--
9 files changed, 153 insertions(+), 53 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ee962a9..58cd43f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,7 @@ PKG_CHECK_EXISTS([gtk+-3.0 >= 2.90],
GTK_REQUIRED_VERSION=2.90.0
],[
GTK_REQUIRED=gtk+-2.0
- GTK_REQUIRED_VERSION=2.12.0
+ GTK_REQUIRED_VERSION=2.16.0
])
PKG_CHECK_MODULES(DEP, [
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index f3781d5..e1911a5 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -55,7 +55,8 @@ NOINST_H_FILES = \
gtksourceundomanagerdefault.h \
gtksourceview-i18n.h \
gtksourceview-utils.h \
- gtktextregion.h
+ gtktextregion.h \
+ gseal-gtk-compat.h
libgtksourceview_2_0_la_SOURCES = \
gtksourcebuffer.c \
diff --git a/gtksourceview/gseal-gtk-compat.h b/gtksourceview/gseal-gtk-compat.h
new file mode 100644
index 0000000..b596e43
--- /dev/null
+++ b/gtksourceview/gseal-gtk-compat.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright © 2009 Thomas H.P. Andersen <phomes gmail com>,
+ * 2009 Javier Jardón <jjardon gnome org>
+ *
+ * This runtime is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This runtime is distributed in the hope runtime it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this runtime; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GSEAL_GTK_COMPAT_H
+#define GSEAL_GTK_COMPAT_H
+
+G_BEGIN_DECLS
+
+#if !GTK_CHECK_VERSION (2, 22, 0)
+#define gtk_widget_is_sensitive(widget) (GTK_WIDGET_IS_SENSITIVE (widget))
+#define gtk_text_view_im_context_filter_keypress(view, event) (gtk_im_context_filter_keypress (GTK_TEXT_VIEW (view)->im_context, event))
+#define gtk_text_view_get_hadjustment(view) (GTK_TEXT_VIEW (view)->hadjustment)
+#endif /* GTK < 2.22.0 */
+
+#if !GTK_CHECK_VERSION (2, 20, 0)
+#define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED (widget))
+#define gtk_widget_get_mapped(widget) (GTK_WIDGET_MAPPED (widget))
+#endif /* GTK < 2.20.0 */
+
+#if !GTK_CHECK_VERSION (2, 18, 0)
+#define gtk_cell_renderer_get_alignment(cell, xalign, yalign) g_object_get (cell, "xalign", xalign, "yalign", yalign, NULL);
+#define gtk_cell_renderer_get_padding(cell, xpad, ypad) g_object_get (cell, "xpad", xpad, "ypad", ypad, NULL);
+#define gtk_cell_renderer_set_padding(cell, xpad, ypad) g_object_set (cell, "xpad", xpad, "ypad", ypad, NULL);
+#define gtk_widget_get_allocation(widget, alloc) (*(alloc) = (widget)->allocation)
+#define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation = *(alloc))
+#define gtk_widget_get_app_paintable(widget) (GTK_WIDGET_APP_PAINTABLE (widget))
+#define gtk_widget_set_can_default(widget, can_default) ((can_default) ? (GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_DEFAULT)))
+#define gtk_widget_set_can_focus(widget, can_focus) ((can_focus) ? (GTK_WIDGET_SET_FLAGS (w, GTK_CAN_FOCUS)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS)))
+#define gtk_widget_set_double_buffered(widget, double_buffered) ((double_buffered) ? (GTK_WIDGET_SET_FLAGS (w, GTK_DOUBLE_BUFFERED)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_DOUBLE_BUFFERED)))
+#define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE (widget))
+#define gtk_widget_has_focus(widget) (GTK_WIDGET_HAS_FOCUS (widget))
+#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW (widget))
+#define gtk_widget_get_state(widget) ((widget)->state)
+#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
+#define gtk_widget_set_window(widget, _window) ((widget)->window= _window)
+#endif /* GTK+ < 2.18.0 */
+
+
+G_END_DECLS
+
+#endif /* GSEAL_GTK_COMPAT_H */
+/* ex:ts=8:noet: */
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index d124c5b..a07209e 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -38,6 +38,7 @@
#include "gtksourcecompletion-private.h"
#include "gtksourcecompletioncontext.h"
#include "gtksourcecompletionui.h"
+#include "gseal-gtk-compat.h"
#include <stdarg.h>
#define WINDOW_WIDTH 350
@@ -352,7 +353,7 @@ select_proposal (GtkSourceCompletion *completion,
GtkTreeModel *model;
gboolean hasselection;
- if (!GTK_WIDGET_VISIBLE (completion->priv->tree_view_proposals))
+ if (!gtk_widget_get_visible (completion->priv->tree_view_proposals))
{
return FALSE;
}
@@ -1052,7 +1053,7 @@ static void
selection_changed_cb (GtkTreeSelection *selection,
GtkSourceCompletion *completion)
{
- if (!GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (!gtk_widget_get_visible (completion->priv->window))
{
return;
}
@@ -1094,7 +1095,7 @@ static void
show_info_cb (GtkWidget *widget,
GtkSourceCompletion *completion)
{
- g_return_if_fail (GTK_WIDGET_VISIBLE (GTK_WIDGET (completion->priv->window)));
+ g_return_if_fail (gtk_widget_get_visible (GTK_WIDGET (completion->priv->window)));
update_info_position (completion);
update_proposal_info (completion);
@@ -1107,7 +1108,7 @@ static void
show_info_after_cb (GtkWidget *widget,
GtkSourceCompletion *completion)
{
- g_return_if_fail (GTK_WIDGET_VISIBLE (GTK_WIDGET (completion->priv->window)));
+ g_return_if_fail (gtk_widget_get_visible (GTK_WIDGET (completion->priv->window)));
/* We do this here because GtkLabel does not properly handle
* can-focus = FALSE and selects all the text when it gets focus from
@@ -1144,7 +1145,7 @@ gtk_source_completion_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
GtkSourceCompletion *completion)
{
- if (GTK_WIDGET_VISIBLE (completion->priv->info_window))
+ if (gtk_widget_get_visible (completion->priv->info_window))
{
update_info_position (completion);
}
@@ -1175,6 +1176,7 @@ update_column_sizes (GtkSourceCompletion *completion)
{
gint cwidth;
GtkTreeView *tv;
+ GtkAllocation allocation;
gint xpad;
gint separator;
GtkStyle *style;
@@ -1203,8 +1205,10 @@ update_column_sizes (GtkSourceCompletion *completion)
}
tv = GTK_TREE_VIEW (completion->priv->tree_view_proposals);
+ gtk_widget_get_allocation (GTK_WIDGET (completion->priv->tree_view_proposals),
+ &allocation);
- set_column_width (tv, 0, completion->priv->tree_view_proposals->allocation.width - cwidth);
+ set_column_width (tv, 0, allocation.width - cwidth);
set_column_width (tv, 1, cwidth);
gtk_tree_view_column_set_visible (completion->priv->tree_view_column_accelerator,
@@ -1243,8 +1247,8 @@ view_focus_out_event_cb (GtkWidget *widget,
{
GtkSourceCompletion *completion = GTK_SOURCE_COMPLETION (user_data);
- if (GTK_WIDGET_VISIBLE (completion->priv->window)
- && !GTK_WIDGET_HAS_FOCUS (completion->priv->window))
+ if (gtk_widget_get_visible (completion->priv->window) &&
+ !gtk_widget_has_focus (completion->priv->window))
{
DEBUG({
g_print ("Lost focus\n");
@@ -1263,7 +1267,7 @@ view_button_press_event_cb (GtkWidget *widget,
{
GtkSourceCompletion *completion = GTK_SOURCE_COMPLETION (user_data);
- if (GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (gtk_widget_get_visible (completion->priv->window))
{
DEBUG({
g_print ("Button press in the view\n");
@@ -1402,7 +1406,7 @@ view_key_press_event_cb (GtkSourceView *view,
mod = gtk_accelerator_get_default_mod_mask () & event->state;
- if (!GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (!gtk_widget_get_visible (completion->priv->window))
{
return FALSE;
}
@@ -1568,7 +1572,7 @@ auto_completion_prematch (GtkSourceCompletion *completion)
completion->priv->show_timed_out_id = 0;
- if (GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (gtk_widget_get_visible (completion->priv->window))
{
return FALSE;
}
@@ -2118,7 +2122,7 @@ on_row_inserted_cb (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkSourceCompletion *completion)
{
- if (!GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (!gtk_widget_get_visible (completion->priv->window))
{
if (!completion->priv->remember_info_visibility)
{
@@ -3128,7 +3132,7 @@ update_completion (GtkSourceCompletion *completion,
update_typing_offsets (completion);
- if (GTK_WIDGET_VISIBLE (completion->priv->info_window))
+ if (gtk_widget_get_visible (completion->priv->info_window))
{
/* Move info window accordingly */
update_info_position (completion);
@@ -3585,7 +3589,7 @@ gtk_source_completion_move_window (GtkSourceCompletion *completion,
g_return_if_fail (GTK_IS_SOURCE_COMPLETION (completion));
g_return_if_fail (iter != NULL);
- if (!GTK_WIDGET_VISIBLE (completion->priv->window))
+ if (!gtk_widget_get_visible (completion->priv->window))
{
return;
}
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index 2224622..095b2d1 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -32,6 +32,7 @@
#include <gtksourceview/gtksourcecompletioninfo.h>
#include "gtksourcecompletionutils.h"
#include "gtksourceview-i18n.h"
+#include "gseal-gtk-compat.h"
#ifndef MIN
#define MIN (a, b) ((a) < (b) ? (a) : (b))
@@ -93,20 +94,24 @@ get_scrolled_window_sizing (GtkSourceCompletionInfo *info,
if (info->priv->scroll != NULL)
{
+ GtkAllocation allocation;
+
*border = gtk_container_get_border_width (GTK_CONTAINER (info));
scrollbar = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW (info->priv->scroll));
- if (GTK_WIDGET_VISIBLE (scrollbar))
+ if (gtk_widget_get_visible (scrollbar))
{
- *hscroll = scrollbar->allocation.height;
+ gtk_widget_get_allocation (scrollbar, &allocation);
+ *hscroll = allocation.height;
}
scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (info->priv->scroll));
- if (GTK_WIDGET_VISIBLE (scrollbar))
+ if (gtk_widget_get_visible (scrollbar))
{
- *vscroll = scrollbar->allocation.height;
+ gtk_widget_get_allocation (scrollbar, &allocation);
+ *vscroll = allocation.height;
}
}
}
@@ -121,7 +126,7 @@ window_resize (GtkSourceCompletionInfo *info)
gint border;
gint hscroll;
gint vscroll;
- GtkStyle *style = GTK_WIDGET (info)->style;
+ GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (info));
gtk_window_get_default_size (GTK_WINDOW (info), &width, &height);
@@ -286,19 +291,23 @@ static gboolean
gtk_source_completion_info_expose (GtkWidget *widget,
GdkEventExpose *expose)
{
+ GtkAllocation allocation;
+
GTK_WIDGET_CLASS (gtk_source_completion_info_parent_class)->expose_event (widget, expose);
- gtk_paint_shadow (widget->style,
- widget->window,
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gtk_paint_shadow (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
NULL,
widget,
NULL,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
+ allocation.x,
+ allocation.y,
+ allocation.width,
+ allocation.height);
return FALSE;
}
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index bebcdcc..084333f 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -908,6 +908,7 @@ on_view_expose_event (GtkSourceView *view,
}
else
{
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
gint x, y;
gint y1, y2;
GArray *numbers;
@@ -946,9 +947,9 @@ on_view_expose_event (GtkSourceView *view,
/* get the line numbers and y coordinates. */
get_lines (text_view, y1, y2, pixels, heights, numbers, &count);
- gtk_text_buffer_get_iter_at_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (buffer,
&cur,
- gtk_text_buffer_get_insert (text_view->buffer));
+ gtk_text_buffer_get_insert (buffer));
cur_line = gtk_text_iter_get_line (&cur);
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 02c0251..0e9db1e 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -23,6 +23,7 @@
#include "gtksourceview.h"
#include "gtksourcelanguage-private.h"
#include "gtksourcestyle-private.h"
+#include "gseal-gtk-compat.h"
#include <libxml/parser.h>
#include <string.h>
@@ -719,7 +720,7 @@ update_cursor_colors (GtkWidget *widget,
if (primary != NULL && secondary == NULL)
{
- secondary_color = widget->style->base[GTK_STATE_NORMAL];
+ secondary_color = gtk_widget_get_style (widget)->base[GTK_STATE_NORMAL];
secondary_color.red = ((gint) secondary_color.red + primary->red) / 2;
secondary_color.green = ((gint) secondary_color.green + primary->green) / 2;
secondary_color.blue = ((gint) secondary_color.blue + primary->blue) / 2;
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index a0928a4..86d02ea 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -42,6 +42,7 @@
#include "gtksourcecompletion-private.h"
#include "gtksourcecompletionutils.h"
#include "gtksourcegutter-private.h"
+#include "gseal-gtk-compat.h"
/**
* SECTION:view
@@ -1909,7 +1910,7 @@ move_cursor (GtkTextView *text_view,
const GtkTextIter *new_location,
gboolean extend_selection)
{
- GtkTextBuffer *buffer = text_view->buffer;
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
if (extend_selection)
gtk_text_buffer_move_mark_by_name (buffer, "insert",
@@ -1982,7 +1983,7 @@ gtk_source_view_move_cursor (GtkTextView *text_view,
gboolean extend_selection)
{
GtkSourceView *source_view = GTK_SOURCE_VIEW (text_view);
- GtkTextBuffer *buffer = text_view->buffer;
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
GtkTextMark *mark;
GtkTextIter cur, iter;
@@ -2151,6 +2152,7 @@ gtk_source_view_paint_line_background (GtkTextView *text_view,
gint win_y;
gint margin;
cairo_t *cr;
+ GtkAdjustment *hadjustment = gtk_text_view_get_hadjustment (text_view);
gtk_text_view_get_visible_rect (text_view, &visible_rect);
@@ -2166,9 +2168,9 @@ gtk_source_view_paint_line_background (GtkTextView *text_view,
line_rect.y = win_y;
line_rect.height = height;
- if (text_view->hadjustment)
+ if (hadjustment)
margin = gtk_text_view_get_left_margin (text_view) -
- (int) text_view->hadjustment->value;
+ (int) gtk_adjustment_get_value (hadjustment);
else
margin = gtk_text_view_get_left_margin (text_view);
@@ -2778,22 +2780,30 @@ gtk_source_view_expose (GtkWidget *widget,
&iter1, &iter2, FALSE);
}
- if (GTK_WIDGET_IS_SENSITIVE(view) && view->priv->highlight_current_line &&
+ if (gtk_widget_is_sensitive (widget) && view->priv->highlight_current_line &&
(event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)))
{
GtkTextIter cur;
gint y, height;
GdkColor *color;
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
- gtk_text_buffer_get_iter_at_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (buffer,
&cur,
- gtk_text_buffer_get_insert (text_view->buffer));
+ gtk_text_buffer_get_insert (buffer));
gtk_text_view_get_line_yrange (text_view, &cur, &y, &height);
if (view->priv->current_line_color_set)
+ {
color = &view->priv->current_line_color;
+ }
else
- color = &widget->style->bg[GTK_WIDGET_STATE (widget)];
+ {
+ GtkStyle *style = gtk_widget_get_style (widget);
+ GtkStateType state = gtk_widget_get_state (widget);
+
+ color = &style->bg[state];
+ }
gtk_source_view_paint_line_background (text_view, event, y, height, color);
}
@@ -3410,11 +3420,13 @@ set_mark_category_tooltip_func (GtkSourceView *view,
GDestroyNotify user_data_notify,
gboolean markup)
{
+ GtkWidget *widget;
MarkCategory *cat;
g_return_if_fail (GTK_IS_SOURCE_VIEW (view));
g_return_if_fail (category != NULL);
+ widget = GTK_WIDGET (view);
cat = gtk_source_view_ensure_category (view, category);
if (cat->tooltip_data_notify)
@@ -3427,10 +3439,10 @@ set_mark_category_tooltip_func (GtkSourceView *view,
if (func != NULL)
{
- gtk_widget_set_has_tooltip (GTK_WIDGET (view), TRUE);
- if (GTK_WIDGET_REALIZED (view))
+ gtk_widget_set_has_tooltip (widget, TRUE);
+ if (gtk_widget_get_realized (widget))
{
- gtk_widget_trigger_tooltip_query (GTK_WIDGET (view));
+ gtk_widget_trigger_tooltip_query (widget);
}
}
}
@@ -4154,7 +4166,7 @@ gtk_source_view_key_press_event (GtkWidget *widget,
/* Allow input methods to internally handle a key press event.
* If this function returns TRUE, then no further processing should be done
* for this keystroke. */
- if (gtk_im_context_filter_keypress (GTK_TEXT_VIEW(view)->im_context, event))
+ if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event))
return TRUE;
/* If an input method has inserted some text while handling the key press event,
@@ -4359,17 +4371,18 @@ view_dnd_drop (GtkTextView *view,
gchar string[] = "#000000";
gint buffer_x;
gint buffer_y;
+ gint length = gtk_selection_data_get_length (selection_data);
- if (selection_data->length < 0)
+ if (length < 0)
return;
- if ((selection_data->format != 16) || (selection_data->length != 8))
+ if (gtk_selection_data_get_format (selection_data) != 16 || length != 8)
{
g_warning ("Received invalid color data\n");
return;
}
- vals = (guint16 *) selection_data->data;
+ vals = (guint16 *) gtk_selection_data_get_data (selection_data);
vals[0] /= 256;
vals[1] /= 256;
@@ -4652,7 +4665,7 @@ update_right_margin_colors (GtkSourceView *view)
{
GtkWidget *widget = GTK_WIDGET (view);
- if (!GTK_WIDGET_REALIZED (view))
+ if (!gtk_widget_get_realized (widget))
return;
if (view->priv->right_margin_line_color != NULL)
@@ -4707,7 +4720,11 @@ update_right_margin_colors (GtkSourceView *view)
}
if (view->priv->right_margin_line_color == NULL)
- view->priv->right_margin_line_color = gdk_color_copy (&widget->style->text[GTK_STATE_NORMAL]);
+ {
+ GtkStyle *style = gtk_widget_get_style (widget);
+
+ view->priv->right_margin_line_color = gdk_color_copy (&style->text[GTK_STATE_NORMAL]);
+ }
}
static void
@@ -4715,7 +4732,7 @@ update_spaces_color (GtkSourceView *view)
{
GtkWidget *widget = GTK_WIDGET (view);
- if (!GTK_WIDGET_REALIZED (view))
+ if (!gtk_widget_get_realized (widget))
return;
if (view->priv->spaces_color != NULL)
@@ -4749,7 +4766,11 @@ update_spaces_color (GtkSourceView *view)
}
if (view->priv->spaces_color == NULL)
- view->priv->spaces_color = gdk_color_copy (&widget->style->text[GTK_STATE_INSENSITIVE]);
+ {
+ GtkStyle *style = gtk_widget_get_style (widget);
+
+ view->priv->spaces_color = gdk_color_copy (&style->text[GTK_STATE_INSENSITIVE]);
+ }
}
static void
@@ -4810,7 +4831,7 @@ gtk_source_view_update_style_scheme (GtkSourceView *view)
if (new_scheme)
g_object_ref (new_scheme);
- if (GTK_WIDGET_REALIZED (view))
+ if (gtk_widget_get_realized (GTK_WIDGET (view)))
{
_gtk_source_style_scheme_apply (new_scheme, GTK_WIDGET (view));
update_current_line_color (view);
diff --git a/tests/test-widget.c b/tests/test-widget.c
index 46f5f4e..d78f0f0 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -53,6 +53,10 @@ static GtkSourceStyleScheme *style_scheme = NULL;
#define MARK_TYPE_1 "one"
#define MARK_TYPE_2 "two"
+#if !GTK_CHECK_VERSION (2, 18, 0)
+#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
+#endif /* GTK+ < 2.18.0 */
+
/* Private prototypes -------------------------------------------------------- */
@@ -727,14 +731,14 @@ search_dialog (GtkWidget *widget,
"text", search_data.what ? search_data.what : "",
"activates-default", TRUE,
NULL);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
GTK_WIDGET (entry1), TRUE, TRUE, 0);
entry2 = g_object_new (GTK_TYPE_ENTRY,
"visible", replace,
"text", search_data.replacement ? search_data.replacement : "",
"activates-default", TRUE,
NULL);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
GTK_WIDGET (entry2), TRUE, TRUE, 0);
case_sensitive = g_object_new (GTK_TYPE_CHECK_BUTTON,
@@ -742,7 +746,7 @@ search_dialog (GtkWidget *widget,
"label", "Case sensitive",
"active", !(search_data.flags & GTK_SOURCE_SEARCH_CASE_INSENSITIVE),
NULL);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
GTK_WIDGET (case_sensitive), FALSE, FALSE, 0);
while (TRUE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]