summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/gcr/Makefile.am4
-rw-r--r--gcr/gcr-display-view.c113
-rw-r--r--gcr/tests/Makefile.am11
-rw-r--r--tool/Makefile.am4
-rw-r--r--ui/Makefile.am1
5 files changed, 88 insertions, 45 deletions
diff --git a/docs/reference/gcr/Makefile.am b/docs/reference/gcr/Makefile.am
index fd9955bb..48ab723a 100644
--- a/docs/reference/gcr/Makefile.am
+++ b/docs/reference/gcr/Makefile.am
@@ -78,7 +78,9 @@ expand_content_files=
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS= -I$(top_srcdir) -I$(top_builddir) $(GOBJECT_CFLAGS) -Wno-error
-GTKDOC_LIBS= $(GOBJECT_LIBS) $(top_builddir)/$(DOC_MODULE)/lib$(DOC_MODULE)@GCR_VERSION_SUFFIX@.la
+GTKDOC_LIBS= $(GOBJECT_LIBS) \
+ $(top_builddir)/$(DOC_MODULE)/lib$(DOC_MODULE)@GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gck/libgck.la
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
diff --git a/gcr/gcr-display-view.c b/gcr/gcr-display-view.c
index ad0dd0c4..2871fc05 100644
--- a/gcr/gcr-display-view.c
+++ b/gcr/gcr-display-view.c
@@ -259,6 +259,49 @@ on_renderer_data_changed (GcrRenderer *renderer, GcrViewer *self)
gcr_renderer_render (renderer, self);
}
+static void
+paint_widget_icons (GcrDisplayView *self, cairo_t *cr)
+{
+ GHashTableIter hit;
+ GtkTextView *view;
+ GdkRectangle visible;
+ GdkRectangle location;
+ GcrDisplayItem *item;
+ gpointer value;
+ GtkTextIter iter;
+
+ view = GTK_TEXT_VIEW (self);
+ gtk_text_view_get_visible_rect (view, &visible);
+
+ g_hash_table_iter_init (&hit, self->pv->items);
+ while (g_hash_table_iter_next (&hit, NULL, &value)) {
+
+ item = value;
+ if (item->pixbuf == NULL)
+ continue;
+
+ gtk_text_buffer_get_iter_at_mark (self->pv->buffer, &iter, item->beginning);
+ gtk_text_view_get_iter_location (view, &iter, &location);
+
+ location.height = gdk_pixbuf_get_height (item->pixbuf);
+ location.width = gdk_pixbuf_get_width (item->pixbuf);
+ location.x = visible.width - location.width - ICON_MARGIN;
+
+ if (!gdk_rectangle_intersect (&visible, &location, NULL))
+ continue;
+
+ gtk_text_view_buffer_to_window_coords (view, GTK_TEXT_WINDOW_TEXT,
+ location.x, location.y,
+ &location.x, &location.y);
+
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, item->pixbuf, location.x, location.y);
+ cairo_rectangle (cr, location.x, location.y, location.width, location.height);
+ cairo_fill (cr);
+ cairo_restore (cr);
+ }
+}
+
/* -----------------------------------------------------------------------------
* OBJECT
*/
@@ -376,18 +419,32 @@ _gcr_display_view_realize (GtkWidget *widget)
style_display_item (widget, value);
}
+#if GTK_CHECK_VERSION (2,91,0)
+
+static gboolean
+_gcr_display_view_draw (GtkWidget *widget, cairo_t *cr)
+{
+ GdkWindow *window;
+ gboolean handled;
+
+ /* Have GtkTextView draw the text first. */
+ if (GTK_WIDGET_CLASS (_gcr_display_view_parent_class)->draw)
+ handled = GTK_WIDGET_CLASS (_gcr_display_view_parent_class)->draw (widget, cr);
+
+ window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT);
+ if (gtk_cairo_should_draw_window (cr, window))
+ paint_widget_icons (GCR_DISPLAY_VIEW (widget), cr);
+
+ return handled;
+}
+
+#else /* GTK 2.x */
+
static gboolean
_gcr_display_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
{
GcrDisplayView *self = GCR_DISPLAY_VIEW (widget);
- GtkTextView *view = GTK_TEXT_VIEW (widget);
gboolean handled = FALSE;
- GdkRectangle visible;
- GdkRectangle location;
- GHashTableIter hit;
- GcrDisplayItem *item;
- gpointer value;
- GtkTextIter iter;
cairo_t *cr;
/* Have GtkTextView draw the text first. */
@@ -395,42 +452,17 @@ _gcr_display_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
handled = GTK_WIDGET_CLASS (_gcr_display_view_parent_class)->expose_event (widget, event);
/* Render the pixbuf if it's available */
- if (event->window == gtk_text_view_get_window (view, GTK_TEXT_WINDOW_TEXT)) {
-
- gtk_text_view_get_visible_rect (view, &visible);
-
- g_hash_table_iter_init (&hit, self->pv->items);
- while (g_hash_table_iter_next (&hit, NULL, &value)) {
-
- item = value;
- if (item->pixbuf == NULL)
- continue;
-
- gtk_text_buffer_get_iter_at_mark (self->pv->buffer, &iter, item->beginning);
- gtk_text_view_get_iter_location (view, &iter, &location);
-
- location.height = gdk_pixbuf_get_height (item->pixbuf);
- location.width = gdk_pixbuf_get_width (item->pixbuf);
- location.x = visible.width - location.width - ICON_MARGIN;
-
- if (!gdk_rectangle_intersect (&visible, &location, NULL))
- continue;
-
- gtk_text_view_buffer_to_window_coords (view, GTK_TEXT_WINDOW_TEXT,
- location.x, location.y,
- &location.x, &location.y);
-
- cr = gdk_cairo_create (event->window);
- gdk_cairo_set_source_pixbuf (cr, item->pixbuf, location.x, location.y);
- cairo_rectangle (cr, location.x, location.y, location.width, location.height);
- cairo_fill (cr);
- cairo_destroy (cr);
- }
+ if (event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT)) {
+ cr = gdk_cairo_create (event->window);
+ paint_widget_icons (GCR_DISPLAY_VIEW (self), cr);
+ cairo_destroy (cr);
}
return handled;
}
+#endif /* GTK 2.x */
+
static void
_gcr_display_view_class_init (GcrDisplayViewClass *klass)
{
@@ -445,7 +477,12 @@ _gcr_display_view_class_init (GcrDisplayViewClass *klass)
gobject_class->finalize = _gcr_display_view_finalize;
widget_class->realize = _gcr_display_view_realize;
+
+#if GTK_CHECK_VERSION (2,91,0)
+ widget_class->draw = _gcr_display_view_draw;
+#else
widget_class->expose_event = _gcr_display_view_expose_event;
+#endif
}
static void
diff --git a/gcr/tests/Makefile.am b/gcr/tests/Makefile.am
index cd51b310..1ef23962 100644
--- a/gcr/tests/Makefile.am
+++ b/gcr/tests/Makefile.am
@@ -5,10 +5,10 @@ TESTING_FILES = \
unit-test-parser.c
TESTING_LIBS = \
- $(top_builddir)/gcr/libgcr.la \
+ $(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
$(top_builddir)/egg/libegg.la \
$(top_builddir)/egg/libegg-entry-buffer.la \
- $(top_builddir)/gp11/libgp11.la
+ $(top_builddir)/gck/libgck.la
TESTING_FLAGS = \
-DGCR_API_SUBJECT_TO_CHANGE \
@@ -34,7 +34,8 @@ ui_test_certificate_CFLAGS = \
$(GTK_CFLAGS)
ui_test_certificate_LDADD = \
- $(top_builddir)/gcr/libgcr.la \
+ $(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gck/libgck.la \
$(GTK_LIBS) \
$(LIBGCRYPT_LIBS)
@@ -47,6 +48,7 @@ ui_test_unlock_options_CFLAGS = \
ui_test_unlock_options_LDADD = \
$(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gck/libgck.la \
$(GTK_LIBS) \
$(LIBGCRYPT_LIBS)
@@ -58,6 +60,7 @@ ui_test_key_CFLAGS = \
$(GTK_CFLAGS)
ui_test_key_LDADD = \
- $(top_builddir)/gcr/libgcr.la \
+ $(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gck/libgck.la \
$(GTK_LIBS) \
$(LIBGCRYPT_LIBS)
diff --git a/tool/Makefile.am b/tool/Makefile.am
index f79950a4..75c3aa34 100644
--- a/tool/Makefile.am
+++ b/tool/Makefile.am
@@ -12,15 +12,15 @@ INCLUDES= \
gnome_keyring@GCR_VERSION_SUFFIX@_SOURCES = \
gkr-tool.c gkr-tool.h \
gkr-tool-import.c
-
+
gnome_keyring@GCR_VERSION_SUFFIX@_CFLAGS = \
-DGCR_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
gnome_keyring@GCR_VERSION_SUFFIX@_LDADD = \
- $(top_builddir)/gck/libgck.la \
$(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
$(top_builddir)/egg/libegg.la \
+ $(top_builddir)/gck/libgck.la \
$(GTHREAD_LIBS) \
$(GTK_LIBS) \
$(GCRYPT_LIBS) \
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 50c53707..5073e462 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -69,6 +69,7 @@ gnome_keyring_prompt@GCR_VERSION_SUFFIX@_LDADD = \
$(top_builddir)/egg/libegg-prompt.la \
$(top_builddir)/egg/libegg-entry-buffer.la \
$(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gck/libgck.la \
$(LIBGCRYPT_LIBS) \
$(GTK_LIBS)