[gnome-builder/wip/chergert/perspective] devhelp: update document title



commit b88dae5f1c7a58f7a6eb00f08ba384a864a0613c
Author: Christian Hergert <christian hergert me>
Date:   Thu Nov 19 14:09:53 2015 -0800

    devhelp: update document title

 plugins/devhelp/gbp-devhelp-view.c |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/plugins/devhelp/gbp-devhelp-view.c b/plugins/devhelp/gbp-devhelp-view.c
index 27b54ae..29c0863 100644
--- a/plugins/devhelp/gbp-devhelp-view.c
+++ b/plugins/devhelp/gbp-devhelp-view.c
@@ -50,10 +50,25 @@ gbp_devhelp_view_set_uri (GbpDevhelpView *self,
   webkit_web_view_load_uri (self->web_view1, uri);
 }
 
+static const gchar *
+gbp_devhelp_view_get_title (IdeLayoutView *view)
+{
+  GbpDevhelpView *self = (GbpDevhelpView *)view;
+
+  g_assert (GBP_IS_DEVHELP_VIEW (view));
+
+  return webkit_web_view_get_title (self->web_view1);
+}
+
 static void
-gbp_devhelp_view_finalize (GObject *object)
+gbp_devhelp_view_notify_title (GbpDevhelpView *self,
+                               GParamSpec     *pspec,
+                               WebKitWebView  *web_view)
 {
-  G_OBJECT_CLASS (gbp_devhelp_view_parent_class)->finalize (object);
+  g_assert (GBP_IS_DEVHELP_VIEW (self));
+  g_assert (WEBKIT_IS_WEB_VIEW (web_view));
+
+  g_object_notify (G_OBJECT (self), "title");
 }
 
 static void
@@ -80,10 +95,12 @@ gbp_devhelp_view_class_init (GbpDevhelpViewClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  IdeLayoutViewClass *view_class = IDE_LAYOUT_VIEW_CLASS (klass);
 
-  object_class->finalize = gbp_devhelp_view_finalize;
   object_class->set_property = gbp_devhelp_view_set_property;
 
+  view_class->get_title = gbp_devhelp_view_get_title;
+
   properties [PROP_URI] =
     g_param_spec_string ("uri",
                          "Uri",
@@ -103,4 +120,10 @@ static void
 gbp_devhelp_view_init (GbpDevhelpView *self)
 {
   gtk_widget_init_template (GTK_WIDGET (self));
+
+  g_signal_connect_object (self->web_view1,
+                           "notify::title",
+                           G_CALLBACK (gbp_devhelp_view_notify_title),
+                           self,
+                           G_CONNECT_SWAPPED);
 }


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