[gtksourceview] Renamed GtkSourceMarkCategory to GtkSourceMarkAttributes.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Renamed GtkSourceMarkCategory to GtkSourceMarkAttributes.
- Date: Mon, 10 Jan 2011 18:15:16 +0000 (UTC)
commit 801f95451870a56c8e7586a5d20ff2f4bfc87c61
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Mon Dec 27 14:14:21 2010 +0100
Renamed GtkSourceMarkCategory to GtkSourceMarkAttributes.
Also, GtkSourceView is not a factory of categories now.
docs/reference/gtksourceview-3.0-sections.txt | 60 +-
docs/reference/gtksourceview-3.0.types | 4 +-
docs/reference/gtksourceview-docs.sgml | 2 +-
gtksourceview/Makefile.am | 4 +-
gtksourceview/gtksourcegutterrenderermarks.c | 63 +-
gtksourceview/gtksourcemarkattributes.c | 671 +++++++++++++++++++++
gtksourceview/gtksourcemarkattributes.h | 99 +++
gtksourceview/gtksourcemarkcategory.c | 792 -------------------------
gtksourceview/gtksourcemarkcategory.h | 105 ----
gtksourceview/gtksourceview.c | 118 +++-
gtksourceview/gtksourceview.h | 14 +-
po/POTFILES.in | 2 +-
tests/test-widget.c | 32 +-
13 files changed, 956 insertions(+), 1010 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index fa79dd3..6dcd7ff 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -66,7 +66,8 @@ gtk_source_view_set_insert_spaces_instead_of_tabs
gtk_source_view_get_insert_spaces_instead_of_tabs
gtk_source_view_set_smart_home_end
gtk_source_view_get_smart_home_end
-gtk_source_view_get_mark_category
+gtk_source_view_set_mark_attributes
+gtk_source_view_get_mark_attributes
gtk_source_view_set_highlight_current_line
gtk_source_view_get_highlight_current_line
gtk_source_view_set_show_line_marks
@@ -303,37 +304,34 @@ gtk_source_mark_get_type
</SECTION>
<SECTION>
-<FILE>markcategory</FILE>
-<TITLE>GtkSourceMarkCategory</TITLE>
-<INCLUDE>gtksourceview/gtksourcemarkcategory.h</INCLUDE>
-GtkSourceMarkCategory
-gtk_source_mark_category_new
-gtk_source_mark_category_get_id
-gtk_source_mark_category_set_background
-gtk_source_mark_category_get_background
-gtk_source_mark_category_set_priority
-gtk_source_mark_category_get_priority
-gtk_source_mark_category_set_stock_id
-gtk_source_mark_category_get_stock_id
-gtk_source_mark_category_set_icon_name
-gtk_source_mark_category_get_icon_name
-gtk_source_mark_category_set_gicon
-gtk_source_mark_category_get_gicon
-gtk_source_mark_category_set_pixbuf
-gtk_source_mark_category_get_pixbuf
-gtk_source_mark_category_render_icon
-gtk_source_mark_category_get_tooltip_text
-gtk_source_mark_category_get_tooltip_markup
+<FILE>markattributes</FILE>
+<TITLE>GtkSourceMarkAttributes</TITLE>
+<INCLUDE>gtksourceview/gtksourcemarkattributes.h</INCLUDE>
+GtkSourceMarkAttributes
+gtk_source_mark_attributes_new
+gtk_source_mark_attributes_set_background
+gtk_source_mark_attributes_get_background
+gtk_source_mark_attributes_set_stock_id
+gtk_source_mark_attributes_get_stock_id
+gtk_source_mark_attributes_set_icon_name
+gtk_source_mark_attributes_get_icon_name
+gtk_source_mark_attributes_set_gicon
+gtk_source_mark_attributes_get_gicon
+gtk_source_mark_attributes_set_pixbuf
+gtk_source_mark_attributes_get_pixbuf
+gtk_source_mark_attributes_render_icon
+gtk_source_mark_attributes_get_tooltip_text
+gtk_source_mark_attributes_get_tooltip_markup
<SUBSECTION Standard>
-GtkSourceMarkCategoryClass
-GTK_IS_SOURCE_MARK_CATEGORY
-GTK_IS_SOURCE_MARK_CATEGORY_CLASS
-GTK_SOURCE_MARK_CATEGORY
-GTK_SOURCE_MARK_CATEGORY_CLASS
-GTK_SOURCE_MARK_CATEGORY_GET_CLASS
-GTK_TYPE_SOURCE_MARK_CATEGORY
-GtkSourceMarkCategoryPrivate
-gtk_source_mark_category_get_type
+GtkSourceMarkAttributesClass
+GTK_IS_SOURCE_MARK_ATTRIBUTES
+GTK_IS_SOURCE_MARK_ATTRIBUTES_CLASS
+GTK_SOURCE_MARK_ATTRIBUTES
+GTK_SOURCE_MARK_ATTRIBUTES_CLASS
+GTK_SOURCE_MARK_ATTRIBUTES_GET_CLASS
+GTK_TYPE_SOURCE_MARK_ATTRIBUTES
+GtkSourceMarkAttributesPrivate
+gtk_source_mark_attributes_get_type
</SECTION>
<SECTION>
diff --git a/docs/reference/gtksourceview-3.0.types b/docs/reference/gtksourceview-3.0.types
index 16456c6..8521f4f 100644
--- a/docs/reference/gtksourceview-3.0.types
+++ b/docs/reference/gtksourceview-3.0.types
@@ -5,7 +5,7 @@
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcestyleschememanager.h>
#include <gtksourceview/gtksourcemark.h>
-#include <gtksourceview/gtksourcemarkcategory.h>
+#include <gtksourceview/gtksourcemarkattributes.h>
#include <gtksourceview/gtksourcegutter.h>
#include <gtksourceview/gtksourceundomanager.h>
@@ -33,4 +33,4 @@ gtk_source_completion_item_get_type
gtk_source_completion_info_get_type
gtk_source_gutter_get_type
gtk_source_undo_manager_get_type
-gtk_source_mark_category_get_type
+gtk_source_mark_attributes_get_type
diff --git a/docs/reference/gtksourceview-docs.sgml b/docs/reference/gtksourceview-docs.sgml
index 1e779a8..1a9f0f1 100644
--- a/docs/reference/gtksourceview-docs.sgml
+++ b/docs/reference/gtksourceview-docs.sgml
@@ -26,7 +26,7 @@
<xi:include href="xml/gutterrenderertext.xml"/>
<xi:include href="xml/gutterrendererpixbuf.xml"/>
<xi:include href="xml/mark.xml"/>
- <xi:include href="xml/markcategory.xml"/>
+ <xi:include href="xml/markattributes.xml"/>
<xi:include href="xml/view.xml"/>
<xi:include href="xml/language.xml"/>
<xi:include href="xml/languagemanager.xml"/>
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index b0cc83c..1315714 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -35,7 +35,7 @@ libgtksourceview_headers = \
gtksourcelanguage.h \
gtksourcelanguagemanager.h \
gtksourcemark.h \
- gtksourcemarkcategory.h \
+ gtksourcemarkattributes.h \
gtksourceprintcompositor.h \
gtksourcestyle.h \
gtksourcestylescheme.h \
@@ -80,13 +80,13 @@ libgtksourceview_c_files = \
gtksourcegutterrendererpixbuf.c \
gtksourcegutterrendererlines.c \
gtksourcegutterrenderermarks.c \
- gtksourcemarkcategory.c \
gtksourcepixbufhelper.c \
gtksourcelanguage.c \
gtksourcelanguagemanager.c \
gtksourcelanguage-parser-1.c \
gtksourcelanguage-parser-2.c \
gtksourcemark.c \
+ gtksourcemarkattributes.c \
gtksourceprintcompositor.c \
gtksourcestyle.c \
gtksourcestylescheme.c \
diff --git a/gtksourceview/gtksourcegutterrenderermarks.c b/gtksourceview/gtksourcegutterrenderermarks.c
index f1e1c69..12ead32 100644
--- a/gtksourceview/gtksourcegutterrenderermarks.c
+++ b/gtksourceview/gtksourcegutterrenderermarks.c
@@ -21,7 +21,7 @@
#include "gtksourcegutterrenderermarks.h"
#include "gtksourceview.h"
-#include "gtksourcemarkcategory.h"
+#include "gtksourcemarkattributes.h"
#define COMPOSITE_ALPHA 225
@@ -64,20 +64,16 @@ sort_marks_by_priority (gconstpointer m1,
if (line1 == line2)
{
- guint priority1;
- guint priority2;
+ gint priority1 = -1;
+ gint priority2 = -1;
- GtkSourceMarkCategory *c1;
- GtkSourceMarkCategory *c2;
+ gtk_source_view_get_mark_attributes (view,
+ gtk_source_mark_get_category (mark1),
+ &priority1);
- c1 = gtk_source_view_get_mark_category (view,
- gtk_source_mark_get_category (mark1));
-
- c2 = gtk_source_view_get_mark_category (view,
- gtk_source_mark_get_category (mark2));
-
- priority1 = gtk_source_mark_category_get_priority (c1);
- priority2 = gtk_source_mark_category_get_priority (c2);
+ gtk_source_view_get_mark_attributes (view,
+ gtk_source_mark_get_category (mark2),
+ &priority2);
return priority1 - priority2;
}
@@ -124,17 +120,22 @@ composite_marks (GtkSourceView *view,
do
{
GtkSourceMark *mark;
- GtkSourceMarkCategory *category;
-
+ GtkSourceMarkAttributes *attrs;
const GdkPixbuf *pixbuf;
mark = marks->data;
- category = gtk_source_view_get_mark_category (view,
- gtk_source_mark_get_category (mark));
+ attrs = gtk_source_view_get_mark_attributes (view,
+ gtk_source_mark_get_category (mark),
+ NULL);
+
+ if (attrs == NULL)
+ {
+ continue;
+ }
- pixbuf = gtk_source_mark_category_render_icon (category,
- GTK_WIDGET (view),
- size);
+ pixbuf = gtk_source_mark_attributes_render_icon (attrs,
+ GTK_WIDGET (view),
+ size);
if (pixbuf != NULL)
{
@@ -218,7 +219,7 @@ set_tooltip_widget_from_marks (GtkSourceView *view,
{
const gchar *category;
GtkSourceMark *mark;
- GtkSourceMarkCategory *cat;
+ GtkSourceMarkAttributes *attrs;
gchar *text;
gboolean ismarkup = FALSE;
GtkWidget *label;
@@ -229,20 +230,22 @@ set_tooltip_widget_from_marks (GtkSourceView *view,
mark = marks->data;
category = gtk_source_mark_get_category (mark);
- cat = gtk_source_view_get_mark_category (view, category);
+ attrs = gtk_source_view_get_mark_attributes (view,
+ category,
+ NULL);
- if (cat == NULL)
+ if (attrs == NULL)
{
continue;
}
- text = gtk_source_mark_category_get_tooltip_markup (cat,
- mark);
+ text = gtk_source_mark_attributes_get_tooltip_markup (attrs,
+ mark);
if (text == NULL)
{
- text = gtk_source_mark_category_get_tooltip_text (cat,
- mark);
+ text = gtk_source_mark_attributes_get_tooltip_text (attrs,
+ mark);
}
else
{
@@ -279,9 +282,9 @@ set_tooltip_widget_from_marks (GtkSourceView *view,
gtk_widget_show (label);
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &size);
- pixbuf = gtk_source_mark_category_render_icon (cat,
- GTK_WIDGET (view),
- size);
+ pixbuf = gtk_source_mark_attributes_render_icon (attrs,
+ GTK_WIDGET (view),
+ size);
if (pixbuf != NULL)
{
diff --git a/gtksourceview/gtksourcemarkattributes.c b/gtksourceview/gtksourcemarkattributes.c
new file mode 100644
index 0000000..9bd53a4
--- /dev/null
+++ b/gtksourceview/gtksourcemarkattributes.c
@@ -0,0 +1,671 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*-
+ * gtksourcemarkattributes.c
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2010 - Jesse van den Kieboom
+ * Copyright (C) 2010 - Krzesimir Nowak
+ *
+ * GtkSourceView 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 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "gtksourcemarkattributes.h"
+#include "gtksourceview-i18n.h"
+#include "gtksourcepixbufhelper.h"
+#include "gtksourceview-marshal.h"
+
+/**
+ * SECTION:markattributes
+ * @short_description: The source mark attributes object
+ * @title: GtkSourceMarkAttributes
+ * @see_also: #GtkSourceMark
+ *
+ * #GtkSourceMarkAttribute<!-- -->s is an object specifying attributes used by
+ * a GtkSourceView to visually show lines marked with #GtkSourceMark<!-- -->s
+ * of a specific category. It allows you to define a background color of a line,
+ * an icon shown in gutter and tooltips.
+ *
+ * The background color is used as a background of a line where a mark is placed
+ * and it can be set with gtk_source_mark_attributes_set_background(). To check
+ * if any custom background color was defined and what color it is, use
+ * gtk_source_mark_attributes_get_background().
+ *
+ * An icon is a graphic element which is shown in the gutter of a view. An
+ * example use is showing a red filled circle in a debugger to show that a
+ * breakpoint was set in certain line. To get an icon that will be placed in
+ * a gutter first a base for it must be specified and then
+ * gtk_source_mark_attributes_render_icon() must be called.
+ * There are several ways to specify a base for an icon:
+ * <itemizedlist>
+ * <listitem>
+ * <para>
+ * gtk_source_mark_attributes_set_icon_name()
+ * </para>
+ * </listitem>
+ * <listitem>
+ * <para>
+ * gtk_source_mark_attributes_set_stock_id()
+ * </para>
+ * </listitem>
+ * <listitem>
+ * <para>
+ * gtk_source_mark_attributes_set_gicon()
+ * </para>
+ * </listitem>
+ * <listitem>
+ * <para>
+ * gtk_source_mark_attributes_set_pixbuf()
+ * </para>
+ * </listitem>
+ * </itemizedlist>
+ * Using any of the above functions overrides the one used earlier. But note
+ * that a getter counterpart of ealier used function can still return some
+ * value, but it is just not used when rendering the proper icon.
+ *
+ * To provide meaningful tooltips for a given mark of a category, you should
+ * connect to ::query-tooltip-text or ::query-tooltip-markup where the latter
+ * takes precedence.
+ */
+
+#define GTK_SOURCE_MARK_ATTRIBUTES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GTK_TYPE_SOURCE_MARK_ATTRIBUTES, GtkSourceMarkAttributesPrivate))
+
+struct _GtkSourceMarkAttributesPrivate
+{
+ GdkRGBA background;
+
+ GtkSourcePixbufHelper *helper;
+
+ guint background_set : 1;
+};
+
+G_DEFINE_TYPE (GtkSourceMarkAttributes, gtk_source_mark_attributes, G_TYPE_OBJECT)
+
+enum
+{
+ PROP_0,
+ PROP_BACKGROUND,
+ PROP_STOCK_ID,
+ PROP_PIXBUF,
+ PROP_ICON_NAME,
+ PROP_GICON
+};
+
+enum
+{
+ QUERY_TOOLTIP_TEXT,
+ QUERY_TOOLTIP_MARKUP,
+ NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS] = {0,};
+
+static void
+gtk_source_mark_attributes_finalize (GObject *object)
+{
+ GtkSourceMarkAttributes *attributes = GTK_SOURCE_MARK_ATTRIBUTES (object);
+
+ gtk_source_pixbuf_helper_free (attributes->priv->helper);
+
+ G_OBJECT_CLASS (gtk_source_mark_attributes_parent_class)->finalize (object);
+}
+
+static void
+set_background (GtkSourceMarkAttributes *attributes,
+ const GdkRGBA *color)
+{
+ if (color)
+ {
+ attributes->priv->background = *color;
+ }
+
+ attributes->priv->background_set = color != NULL;
+
+ g_object_notify (G_OBJECT (attributes), "background");
+}
+
+static void
+set_stock_id (GtkSourceMarkAttributes *attributes,
+ const gchar *stock_id)
+{
+ if (0 != g_strcmp0 (gtk_source_pixbuf_helper_get_stock_id (attributes->priv->helper),
+ stock_id))
+ {
+ gtk_source_pixbuf_helper_set_stock_id (attributes->priv->helper,
+ stock_id);
+
+ g_object_notify (G_OBJECT (attributes), "stock-id");
+ }
+}
+
+static void
+set_icon_name (GtkSourceMarkAttributes *attributes,
+ const gchar *icon_name)
+{
+ if (g_strcmp0 (gtk_source_pixbuf_helper_get_icon_name (attributes->priv->helper),
+ icon_name) == 0)
+ {
+ return;
+ }
+
+ gtk_source_pixbuf_helper_set_icon_name (attributes->priv->helper,
+ icon_name);
+
+ g_object_notify (G_OBJECT (attributes), "icon-name");
+}
+
+static void
+set_pixbuf (GtkSourceMarkAttributes *attributes,
+ const GdkPixbuf *pixbuf)
+{
+ if (gtk_source_pixbuf_helper_get_pixbuf (attributes->priv->helper) == pixbuf)
+ {
+ return;
+ }
+
+ gtk_source_pixbuf_helper_set_pixbuf (attributes->priv->helper,
+ pixbuf);
+
+ g_object_notify (G_OBJECT (attributes), "pixbuf");
+}
+
+static void
+set_gicon (GtkSourceMarkAttributes *attributes,
+ GIcon *gicon)
+{
+ if (gtk_source_pixbuf_helper_get_gicon (attributes->priv->helper) == gicon)
+ {
+ return;
+ }
+
+ gtk_source_pixbuf_helper_set_gicon (attributes->priv->helper,
+ gicon);
+
+ g_object_notify (G_OBJECT (attributes), "gicon");
+}
+
+static void
+gtk_source_mark_attributes_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceMarkAttributes *self = GTK_SOURCE_MARK_ATTRIBUTES (object);
+
+ switch (prop_id)
+ {
+ case PROP_BACKGROUND:
+ set_background (self, g_value_get_boxed (value));
+ break;
+ case PROP_STOCK_ID:
+ set_stock_id (self, g_value_get_string (value));
+ break;
+ case PROP_PIXBUF:
+ set_pixbuf (self, g_value_get_object (value));
+ break;
+ case PROP_ICON_NAME:
+ set_icon_name (self, g_value_get_string (value));
+ break;
+ case PROP_GICON:
+ set_gicon (self, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_source_mark_attributes_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceMarkAttributes *self = GTK_SOURCE_MARK_ATTRIBUTES (object);
+
+ switch (prop_id)
+ {
+ case PROP_BACKGROUND:
+ if (self->priv->background_set)
+ {
+ g_value_set_boxed (value, &self->priv->background);
+ }
+ else
+ {
+ g_value_set_boxed (value, NULL);
+ }
+ break;
+ case PROP_STOCK_ID:
+ g_value_set_string (value,
+ gtk_source_pixbuf_helper_get_stock_id (self->priv->helper));
+ break;
+ case PROP_PIXBUF:
+ g_value_set_object (value,
+ gtk_source_pixbuf_helper_get_pixbuf (self->priv->helper));
+ break;
+ case PROP_ICON_NAME:
+ g_value_set_string (value,
+ gtk_source_pixbuf_helper_get_icon_name (self->priv->helper));
+ break;
+ case PROP_GICON:
+ g_value_set_object (value,
+ gtk_source_pixbuf_helper_get_gicon (self->priv->helper));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_source_mark_attributes_class_init (GtkSourceMarkAttributesClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gtk_source_mark_attributes_finalize;
+
+ object_class->get_property = gtk_source_mark_attributes_get_property;
+ object_class->set_property = gtk_source_mark_attributes_set_property;
+
+ g_type_class_add_private (object_class, sizeof (GtkSourceMarkAttributesPrivate));
+
+ /**
+ * GtkSourceMarkAttributes:background:
+ *
+ * A color used for background of a line.
+ */
+ g_object_class_install_property (object_class,
+ PROP_BACKGROUND,
+ g_param_spec_boxed ("background",
+ _("Background"),
+ _("The background"),
+ GDK_TYPE_RGBA,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkSourceMarkAttributes:stock-id:
+ *
+ * A stock id that may be a base of a rendered icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_STOCK_ID,
+ g_param_spec_string ("stock-id",
+ _("Stock Id"),
+ _("The stock id"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkSourceMarkAttributes:pixbuf:
+ *
+ * A #GdkPixbuf that may be a base of a rendered icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_PIXBUF,
+ g_param_spec_object ("pixbuf",
+ _("Pixbuf"),
+ _("The pixbuf"),
+ GDK_TYPE_PIXBUF,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkSourceMarkAttributes:icon-name:
+ *
+ * An icon name that may be a base of a rendered icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_ICON_NAME,
+ g_param_spec_string ("icon-name",
+ _("Icon Name"),
+ _("The icon name"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkSourceMarkAttributes:gicon:
+ *
+ * A #GIcon that may be a base of a rendered icon.
+ */
+ g_object_class_install_property (object_class,
+ PROP_GICON,
+ g_param_spec_object ("gicon",
+ _("GIcon"),
+ _("The GIcon"),
+ G_TYPE_ICON,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkSourceMarkAttributes::query-tooltip-text:
+ * @attributes: The #GtkSourceMarkAttributes which emits the signal.
+ * @mark: The #GtkSourceMark.
+ *
+ * The code should connect to this signal to provide a tooltip for given
+ * @mark. The tooltip should be just a plain text.
+ *
+ * Returns: (transfer full): A tooltip. The string should be freed with
+ * g_free() when done with it.
+ */
+ signals[QUERY_TOOLTIP_TEXT] =
+ g_signal_new ("query-tooltip-text",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ _gtksourceview_marshal_STRING__OBJECT,
+ G_TYPE_STRING,
+ 1,
+ GTK_TYPE_SOURCE_MARK);
+
+ /**
+ * GtkSourceMarkAttributes::query-tooltip-markup:
+ * @attributes: The #GtkSourceMarkAttributes which emits the signal.
+ * @mark: The #GtkSourceMark.
+ *
+ * The code should connect to this signal to provide a tooltip for given
+ * @mark. The tooltip can contain a markup.
+ *
+ * Returns: (transfer full): A tooltip. The string should be freed with
+ * g_free() when done with it.
+ */
+ signals[QUERY_TOOLTIP_MARKUP] =
+ g_signal_new ("query-tooltip-markup",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ _gtksourceview_marshal_STRING__OBJECT,
+ G_TYPE_STRING,
+ 1,
+ GTK_TYPE_SOURCE_MARK);
+}
+
+static void
+gtk_source_mark_attributes_init (GtkSourceMarkAttributes *self)
+{
+ self->priv = GTK_SOURCE_MARK_ATTRIBUTES_GET_PRIVATE (self);
+
+ self->priv->helper = gtk_source_pixbuf_helper_new ();
+}
+
+/**
+ * gtk_source_mark_attributes_new:
+ *
+ * Creates a new source mark attributes.
+ *
+ * Returns: (transfer full): a new source mark attributes.
+ */
+GtkSourceMarkAttributes *
+gtk_source_mark_attributes_new ()
+{
+ return g_object_new (GTK_TYPE_SOURCE_MARK_ATTRIBUTES, NULL);
+}
+
+/**
+ * gtk_source_mark_attributes_set_background:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @background: a #GdkRGBA.
+ *
+ * Sets background color to the one given in @background.
+ */
+void
+gtk_source_mark_attributes_set_background (GtkSourceMarkAttributes *attributes,
+ const GdkRGBA *background)
+{
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+
+ set_background (attributes, background);
+}
+
+/**
+ * gtk_source_mark_attributes_get_background:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @background: (out caller-allocates): a #GdkRGBA.
+ *
+ * Stores background color in @background.
+ *
+ * Returns: whether background color for @attributes was set.
+ */
+gboolean
+gtk_source_mark_attributes_get_background (GtkSourceMarkAttributes *attributes,
+ GdkRGBA *background)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), FALSE);
+
+ if (background)
+ {
+ *background = attributes->priv->background;
+ }
+ return attributes->priv->background_set;
+}
+
+/**
+ * gtk_source_mark_attributes_set_stock_id:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @stock_id: a stock id.
+ *
+ * Sets stock id to be used as a base for rendered icon.
+ */
+void
+gtk_source_mark_attributes_set_stock_id (GtkSourceMarkAttributes *attributes,
+ const gchar *stock_id)
+{
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+
+ set_stock_id (attributes, stock_id);
+}
+
+/**
+ * gtk_source_mark_attributes_get_stock_id:
+ * @attributes: a #GtkSourceMarkAttributes.
+ *
+ * Gets a stock id of an icon used by this attributes. Note that the stock id can
+ * be %NULL if it wasn't set earlier.
+ *
+ * Returns: (transfer none): Stock id. Returned string is owned by @attributes and
+ * shouldn't be freed.
+ */
+const gchar *
+gtk_source_mark_attributes_get_stock_id (GtkSourceMarkAttributes *attributes)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+
+ return gtk_source_pixbuf_helper_get_stock_id (attributes->priv->helper);
+}
+
+/**
+ * gtk_source_mark_attributes_set_icon_name:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @icon_name: name of an icon to be used.
+ *
+ * Sets a name of an icon to be used as a base for rendered icon.
+ */
+void
+gtk_source_mark_attributes_set_icon_name (GtkSourceMarkAttributes *attributes,
+ const gchar *icon_name)
+{
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+
+ set_icon_name (attributes, icon_name);
+}
+
+/**
+ * gtk_source_mark_attributes_get_icon_name:
+ * @attributes: a #GtkSourceMarkAttributes.
+ *
+ * Gets a name of an icon to be used as a base for rendered icon. Note that the
+ * icon name can be %NULL if it wasn't set earlier.
+ *
+ * Returns: (transfer none): An icon name. The string belongs to @attributes and
+ * should not be freed.
+ */
+const gchar *
+gtk_source_mark_attributes_get_icon_name (GtkSourceMarkAttributes *attributes)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+
+ return gtk_source_pixbuf_helper_get_icon_name (attributes->priv->helper);
+}
+
+/**
+ * gtk_source_mark_attributes_set_gicon:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @gicon: a #GIcon to be used.
+ *
+ * Sets an icon to be used as a base for rendered icon.
+ */
+void
+gtk_source_mark_attributes_set_gicon (GtkSourceMarkAttributes *attributes,
+ GIcon *gicon)
+{
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+
+ set_gicon (attributes, gicon);
+}
+
+/**
+ * gtk_source_mark_attributes_get_gicon:
+ * @attributes: a #GtkSourceMarkAttributes.
+ *
+ * Gets a #GIcon to be used as a base for rendered icon. Note that the icon can
+ * be %NULL if it wasn't set earlier.
+ *
+ * Returns: (transfer none): An icon. The icon belongs to @attributes and should
+ * not be unreffed.
+ */
+GIcon *
+gtk_source_mark_attributes_get_gicon (GtkSourceMarkAttributes *attributes)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+
+ return gtk_source_pixbuf_helper_get_gicon (attributes->priv->helper);
+}
+
+/**
+ * gtk_source_mark_attributes_set_pixbuf:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @pixbuf: a #GdkPixbuf to be used.
+ *
+ * Sets a pixbuf to be used as a base for rendered icon.
+ */
+void
+gtk_source_mark_attributes_set_pixbuf (GtkSourceMarkAttributes *attributes,
+ const GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+
+ set_pixbuf (attributes, pixbuf);
+}
+
+/**
+ * gtk_source_mark_attributes_get_pixbuf:
+ * @attributes: a #GtkSourceMarkAttributes.
+ *
+ * Gets a #GdkPixbuf to be used as a base for rendered icon. Note that the
+ * pixbuf can be %NULL if it wasn't set earlier.
+ *
+ * Returns: (transfer none): A pixbuf. The pixbuf belongs to @attributes and
+ * should not be unreffed.
+ */
+const GdkPixbuf *
+gtk_source_mark_attributes_get_pixbuf (GtkSourceMarkAttributes *attributes)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+
+ return gtk_source_pixbuf_helper_get_pixbuf (attributes->priv->helper);
+}
+
+/**
+ * gtk_source_mark_attributes_render_icon:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @widget: widget of which style settings may be used.
+ * @size: size of the rendered icon.
+ *
+ * Renders an icon of given size. The base of the icon is set by the last call
+ * to one of: gtk_source_mark_attributes_set_pixbuf(),
+ * gtk_source_mark_attributes_set_gicon(),
+ * gtk_source_mark_attributes_set_icon_name() or
+ * gtk_source_mark_attributes_set_stock_id(). @size cannot be lower than 1.
+ *
+ * Returns: (transfer none): A rendered pixbuf. The pixbuf belongs to @attributes
+ * and should not be unreffed.
+ */
+const GdkPixbuf *
+gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes,
+ GtkWidget *widget,
+ gint size)
+{
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ g_return_val_if_fail (size > 0, NULL);
+
+ return gtk_source_pixbuf_helper_render (attributes->priv->helper,
+ widget,
+ size);
+}
+
+/**
+ * gtk_source_mark_attributes_get_tooltip_text:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @mark: a #GtkSourceMark.
+ *
+ * Queries for a tooltip by emitting
+ * a GtkSourceMarkAttributes::query-tooltip-text signal. The tooltip is a plain
+ * text.
+ *
+ * Returns: (transfer full): A tooltip. The returned string should be freed by
+ * using g_free() when done with it.
+ */
+gchar *
+gtk_source_mark_attributes_get_tooltip_text (GtkSourceMarkAttributes *attributes,
+ GtkSourceMark *mark)
+{
+ gchar *ret;
+
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK (mark), NULL);
+
+ ret = NULL;
+ g_signal_emit (attributes, signals[QUERY_TOOLTIP_TEXT], 0, mark, &ret);
+
+ return ret;
+}
+
+/**
+ * gtk_source_mark_attributes_get_tooltip_markup:
+ * @attributes: a #GtkSourceMarkAttributes.
+ * @mark: a #GtkSourceMark.
+ *
+ * Queries for a tooltip by emitting
+ * a GtkSourceMarkAttributes::query-tooltip-markup signal. The tooltip may contain
+ * a markup.
+ *
+ * Returns: (transfer full): A tooltip. The returned string should be freed by
+ * using g_free() when done with it.
+ */
+gchar *
+gtk_source_mark_attributes_get_tooltip_markup (GtkSourceMarkAttributes *attributes,
+ GtkSourceMark *mark)
+{
+ gchar *ret;
+
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes), NULL);
+ g_return_val_if_fail (GTK_IS_SOURCE_MARK (mark), NULL);
+
+ ret = NULL;
+ g_signal_emit (attributes, signals[QUERY_TOOLTIP_MARKUP], 0, mark, &ret);
+
+ return ret;
+}
+
diff --git a/gtksourceview/gtksourcemarkattributes.h b/gtksourceview/gtksourcemarkattributes.h
new file mode 100644
index 0000000..932fae6
--- /dev/null
+++ b/gtksourceview/gtksourcemarkattributes.h
@@ -0,0 +1,99 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*-
+ * gtksourcemarkattributes.h
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2010 - Jesse van den Kieboom
+ * Copyright (C) 2010 - Krzesimir Nowak
+ *
+ * GtkSourceView 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 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __GTK_SOURCE_MARK_ATTRIBUTES_H__
+#define __GTK_SOURCE_MARK_ATTRIBUTES_H__
+
+#include <gtk/gtk.h>
+#include <gtksourceview/gtksourcemark.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SOURCE_MARK_ATTRIBUTES (gtk_source_mark_attributes_get_type ())
+#define GTK_SOURCE_MARK_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SOURCE_MARK_ATTRIBUTES, GtkSourceMarkAttributes))
+#define GTK_SOURCE_MARK_ATTRIBUTES_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SOURCE_MARK_ATTRIBUTES, GtkSourceMarkAttributes const))
+#define GTK_SOURCE_MARK_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SOURCE_MARK_ATTRIBUTES, GtkSourceMarkAttributesClass))
+#define GTK_IS_SOURCE_MARK_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SOURCE_MARK_ATTRIBUTES))
+#define GTK_IS_SOURCE_MARK_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SOURCE_MARK_ATTRIBUTES))
+#define GTK_SOURCE_MARK_ATTRIBUTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SOURCE_MARK_ATTRIBUTES, GtkSourceMarkAttributesClass))
+
+typedef struct _GtkSourceMarkAttributes GtkSourceMarkAttributes;
+typedef struct _GtkSourceMarkAttributesClass GtkSourceMarkAttributesClass;
+typedef struct _GtkSourceMarkAttributesPrivate GtkSourceMarkAttributesPrivate;
+
+struct _GtkSourceMarkAttributes
+{
+ /*< private >*/
+ GObject parent;
+
+ GtkSourceMarkAttributesPrivate *priv;
+
+ /*< public >*/
+};
+
+struct _GtkSourceMarkAttributesClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+};
+
+GType gtk_source_mark_attributes_get_type (void) G_GNUC_CONST;
+
+GtkSourceMarkAttributes *gtk_source_mark_attributes_new (void);
+
+void gtk_source_mark_attributes_set_background (GtkSourceMarkAttributes *attributes,
+ const GdkRGBA *background);
+
+gboolean gtk_source_mark_attributes_get_background (GtkSourceMarkAttributes *attributes,
+ GdkRGBA *background);
+
+void gtk_source_mark_attributes_set_stock_id (GtkSourceMarkAttributes *attributes,
+ const gchar *stock_id);
+const gchar *gtk_source_mark_attributes_get_stock_id (GtkSourceMarkAttributes *attributes);
+
+void gtk_source_mark_attributes_set_icon_name (GtkSourceMarkAttributes *attributes,
+ const gchar *icon_name);
+const gchar *gtk_source_mark_attributes_get_icon_name (GtkSourceMarkAttributes *attributes);
+
+void gtk_source_mark_attributes_set_gicon (GtkSourceMarkAttributes *attributes,
+ GIcon *gicon);
+GIcon *gtk_source_mark_attributes_get_gicon (GtkSourceMarkAttributes *attributes);
+
+void gtk_source_mark_attributes_set_pixbuf (GtkSourceMarkAttributes *attributes,
+ const GdkPixbuf *pixbuf);
+const GdkPixbuf *gtk_source_mark_attributes_get_pixbuf (GtkSourceMarkAttributes *attributes);
+
+const GdkPixbuf *gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes,
+ GtkWidget *widget,
+ gint size);
+
+gchar *gtk_source_mark_attributes_get_tooltip_text (GtkSourceMarkAttributes *attributes,
+ GtkSourceMark *mark);
+
+gchar *gtk_source_mark_attributes_get_tooltip_markup (GtkSourceMarkAttributes *attributes,
+ GtkSourceMark *mark);
+
+G_END_DECLS
+
+#endif /* __GTK_SOURCE_MARK_ATTRIBUTES_H__ */
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 0463907..3b92abb 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -164,6 +164,13 @@ struct _GtkSourceViewPrivate
guint dispose_has_run : 1;
};
+typedef struct _MarkCategory MarkCategory;
+
+struct _MarkCategory
+{
+ GtkSourceMarkAttributes *attributes;
+ gint priority;
+};
G_DEFINE_TYPE (GtkSourceView, gtk_source_view, GTK_TYPE_TEXT_VIEW)
@@ -245,6 +252,11 @@ static void gtk_source_view_style_updated (GtkWidget *widget);
static void gtk_source_view_realize (GtkWidget *widget);
static void gtk_source_view_update_style_scheme (GtkSourceView *view);
+static MarkCategory *mark_category_new (GtkSourceMarkAttributes *attributes,
+ gint priority);
+static void mark_category_free (MarkCategory *category);
+
+
/* Private functions. */
static void
gtk_source_view_class_init (GtkSourceViewClass *klass)
@@ -988,7 +1000,7 @@ gtk_source_view_init (GtkSourceView *view)
view->priv->mark_categories = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) g_object_unref);
+ (GDestroyNotify) mark_category_free);
init_left_gutter (view);
@@ -1901,17 +1913,21 @@ gtk_source_view_paint_marks_background (GtkSourceView *view,
while (marks != NULL)
{
- GtkSourceMarkCategory *cat;
+ GtkSourceMarkAttributes *attrs;
gint prio;
GdkRGBA bg;
- cat = gtk_source_view_get_mark_category (view,
- gtk_source_mark_get_category (marks->data));
+ attrs = gtk_source_view_get_mark_attributes (view,
+ gtk_source_mark_get_category (marks->data),
+ &prio);
- prio = gtk_source_mark_category_get_priority (cat);
+ if (attrs == NULL)
+ {
+ continue;
+ }
if (prio > priority &&
- gtk_source_mark_category_get_background (cat, &bg))
+ gtk_source_mark_attributes_get_background (attrs, &bg))
{
priority = prio;
background = bg;
@@ -4146,6 +4162,28 @@ gtk_source_view_update_style_scheme (GtkSourceView *view)
}
}
+static MarkCategory *
+mark_category_new (GtkSourceMarkAttributes *attributes,
+ gint priority)
+{
+ MarkCategory* category = g_slice_new (MarkCategory);
+
+ category->attributes = g_object_ref (attributes);
+ category->priority = priority;
+
+ return category;
+}
+
+static void
+mark_category_free (MarkCategory *category)
+{
+ if (category)
+ {
+ g_object_unref (category->attributes);
+ g_slice_free (MarkCategory, category);
+ }
+}
+
/**
* gtk_source_view_get_completion:
* @view: a #GtkSourceView.
@@ -4214,36 +4252,64 @@ gtk_source_view_get_gutter (GtkSourceView *view,
}
/**
- * gtk_source_view_get_mark_category:
- * @view: a #GtkSourceView
- * @category: the category
+ * gtk_source_view_set_mark_attributes:
+ * @view: a #GtkSourceView.
+ * @category: the category.
+ * @attributes: mark attributes.
+ * @priority: priority of the category.
*
- * Get the source mark category object for @category. A
- * #GtkSourceMarkCategory is automatically created for the given category
- * if it does not exist yet.
+ * Sets attributes and priority for the @category.
+ */
+void
+gtk_source_view_set_mark_attributes (GtkSourceView *view,
+ const gchar *category,
+ GtkSourceMarkAttributes *attributes,
+ gint priority)
+{
+ MarkCategory *mark_category;
+
+ g_return_if_fail (GTK_IS_SOURCE_VIEW (view));
+ g_return_if_fail (category != NULL);
+ g_return_if_fail (GTK_IS_SOURCE_MARK_ATTRIBUTES (attributes));
+ g_return_if_fail (priority >= 0);
+
+ mark_category = mark_category_new (attributes, priority);
+ g_hash_table_replace (view->priv->mark_categories,
+ g_strdup (category),
+ mark_category);
+}
+
+/**
+ * gtk_source_view_get_mark_attributes:
+ * @view: a #GtkSourceView.
+ * @category: the category.
+ * @priority: place where priority of the category will be stored.
*
- * Returns: (transfer none): the #GtkSourceMarkCategory object
+ * Gets attributes and priority for the @category.
*
+ * Returns: #GtkSourceMarkAttributes for the @category. The object belongs to
+ * @view, so it shouldn't be unreffed.
*/
-GtkSourceMarkCategory *
-gtk_source_view_get_mark_category (GtkSourceView *view,
- const gchar *category)
+GtkSourceMarkAttributes *
+gtk_source_view_get_mark_attributes (GtkSourceView *view,
+ const gchar *category,
+ gint *priority)
{
- GtkSourceMarkCategory *ret;
+ MarkCategory *mark_category;
g_return_val_if_fail (GTK_IS_SOURCE_VIEW (view), NULL);
g_return_val_if_fail (category != NULL, NULL);
- ret = g_hash_table_lookup (view->priv->mark_categories, category);
+ mark_category = g_hash_table_lookup (view->priv->mark_categories,
+ category);
- if (!ret)
+ if (mark_category)
{
- ret = gtk_source_mark_category_new (category);
-
- g_hash_table_insert (view->priv->mark_categories,
- g_strdup (category),
- ret);
+ if (priority)
+ {
+ *priority = mark_category->priority;
+ }
+ return mark_category->attributes;
}
-
- return ret;
+ return NULL;
}
diff --git a/gtksourceview/gtksourceview.h b/gtksourceview/gtksourceview.h
index 57a1da2..181e356 100644
--- a/gtksourceview/gtksourceview.h
+++ b/gtksourceview/gtksourceview.h
@@ -29,7 +29,7 @@
#include <gtksourceview/gtksourcebuffer.h>
#include <gtksourceview/gtksourcecompletion.h>
#include <gtksourceview/gtksourcegutter.h>
-#include <gtksourceview/gtksourcemarkcategory.h>
+#include <gtksourceview/gtksourcemarkattributes.h>
G_BEGIN_DECLS
@@ -193,9 +193,15 @@ void gtk_source_view_set_show_line_marks (GtkSourceView *view,
gboolean show);
gboolean gtk_source_view_get_show_line_marks (GtkSourceView *view);
-GtkSourceMarkCategory *
- gtk_source_view_get_mark_category (GtkSourceView *view,
- const gchar *category);
+void gtk_source_view_set_mark_attributes (GtkSourceView *view,
+ const gchar *category,
+ GtkSourceMarkAttributes *attributes,
+ gint priority);
+
+GtkSourceMarkAttributes *
+ gtk_source_view_get_mark_attributes (GtkSourceView *view,
+ const gchar *category,
+ gint *priority);
void gtk_source_view_set_smart_home_end (GtkSourceView *view,
GtkSourceSmartHomeEndType smart_he);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7f203c5..5486651 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -104,7 +104,7 @@ gtksourceview/gtksourcelanguage.c
gtksourceview/gtksourcelanguagemanager.c
gtksourceview/gtksourcelanguage-parser-2.c
gtksourceview/gtksourcemark.c
-gtksourceview/gtksourcemarkcategory.c
+gtksourceview/gtksourcemarkattributes.c
gtksourceview/gtksourceprintcompositor.c
gtksourceview/gtksourcestyle.c
gtksourceview/gtksourcestylescheme.c
diff --git a/tests/test-widget.c b/tests/test-widget.c
index 53f980c..1d2d87a 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -1280,9 +1280,9 @@ bracket_matched (GtkSourceBuffer *buffer G_GNUC_UNUSED,
/* Window creation functions -------------------------------------------------------- */
static gchar *
-mark_tooltip_func (GtkSourceMarkCategory *category,
- GtkSourceMark *mark,
- GtkSourceView *view)
+mark_tooltip_func (GtkSourceMarkAttributes *attrs,
+ GtkSourceMark *mark,
+ GtkSourceView *view)
{
GtkTextBuffer *buf;
GtkTextIter iter;
@@ -1294,7 +1294,7 @@ mark_tooltip_func (GtkSourceMarkCategory *category,
line = gtk_text_iter_get_line (&iter) + 1;
column = gtk_text_iter_get_line_offset (&iter);
- if (g_strcmp0 (gtk_source_mark_category_get_id (category), MARK_TYPE_1) == 0)
+ if (g_strcmp0 (gtk_source_mark_get_category (mark), MARK_TYPE_1) == 0)
{
return g_strdup_printf ("Line: %d, Column: %d", line, column);
}
@@ -1308,33 +1308,33 @@ static void
add_source_mark_pixbufs (GtkSourceView *view)
{
GdkRGBA color;
- GtkSourceMarkCategory *cat;
+ GtkSourceMarkAttributes *attrs;
gdk_rgba_parse (&color, "lightgreen");
- cat = gtk_source_view_get_mark_category (view, MARK_TYPE_1);
+ attrs = gtk_source_mark_attributes_new ();
+ gtk_source_mark_attributes_set_background (attrs, &color);
+ gtk_source_mark_attributes_set_stock_id (attrs, GTK_STOCK_YES);
- gtk_source_mark_category_set_background (cat, &color);
- gtk_source_mark_category_set_stock_id (cat, GTK_STOCK_YES);
- gtk_source_mark_category_set_priority (cat, 1);
-
- g_signal_connect (cat,
+ g_signal_connect (attrs,
"query-tooltip-markup",
G_CALLBACK (mark_tooltip_func),
view);
+ gtk_source_view_set_mark_attributes (view, MARK_TYPE_1, attrs, 1);
gdk_rgba_parse (&color, "pink");
- cat = gtk_source_view_get_mark_category (view, MARK_TYPE_2);
+ attrs = gtk_source_mark_attributes_new ();
- gtk_source_mark_category_set_background (cat, &color);
- gtk_source_mark_category_set_stock_id (cat, GTK_STOCK_NO);
- gtk_source_mark_category_set_priority (cat, 2);
+ gtk_source_mark_attributes_set_background (attrs, &color);
+ gtk_source_mark_attributes_set_stock_id (attrs, GTK_STOCK_NO);
- g_signal_connect (cat,
+ g_signal_connect (attrs,
"query-tooltip-markup",
G_CALLBACK (mark_tooltip_func),
view);
+
+ gtk_source_view_set_mark_attributes (view, MARK_TYPE_2, attrs, 2);
}
static GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]