[gnome-builder] add vfunc to check if we can make a preview



commit 94e11f6d3c16dc08b5b4b92ebeadb443aa120e8f
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 19 15:10:03 2015 -0700

    add vfunc to check if we can make a preview

 src/views/gb-view.c |   19 +++++++++++++++++++
 src/views/gb-view.h |    2 ++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/views/gb-view.c b/src/views/gb-view.c
index 5420855..82c0e36 100644
--- a/src/views/gb-view.c
+++ b/src/views/gb-view.c
@@ -42,6 +42,25 @@ enum {
 static GParamSpec *gParamSpecs [LAST_PROP];
 
 /**
+ * gb_view_get_can_preview:
+ * @self: A #GbView.
+ *
+ * Checks if @self can create a preview view (such as html, markdown, etc).
+ *
+ * Returns: %TRUE if @self can create a preview view.
+ */
+gboolean
+gb_view_get_can_preview (GbView *self)
+{
+  g_return_val_if_fail (GB_IS_VIEW (self), FALSE);
+
+  if (GB_VIEW_GET_CLASS (self)->get_can_preview)
+    return GB_VIEW_GET_CLASS (self)->get_can_preview (self);
+
+  return FALSE;
+}
+
+/**
  * gb_view_get_can_split:
  * @self: A #GbView.
  *
diff --git a/src/views/gb-view.h b/src/views/gb-view.h
index 4d702ee..98f31ee 100644
--- a/src/views/gb-view.h
+++ b/src/views/gb-view.h
@@ -33,6 +33,7 @@ struct _GbViewClass
 {
   GtkBinClass parent;
 
+  gboolean     (*get_can_preview) (GbView   *self);
   gboolean     (*get_can_split)   (GbView   *self);
   GbDocument  *(*get_document)    (GbView   *self);
   const gchar *(*get_title)       (GbView   *self);
@@ -42,6 +43,7 @@ struct _GbViewClass
 };
 
 GbView      *gb_view_create_split    (GbView   *self);
+gboolean     gb_view_get_can_preview (GbView   *self);
 gboolean     gb_view_get_can_split   (GbView   *self);
 GbDocument  *gb_view_get_document    (GbView   *self);
 const gchar *gb_view_get_title       (GbView   *self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]