svnno****@sourc*****
svnno****@sourc*****
Fri Feb 22 11:22:44 JST 2008
Revision: 3388 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3388 Author: ikezoe Date: 2008-02-22 11:22:44 +0900 (Fri, 22 Feb 2008) Log Message: ----------- * module/embed/webkit-gtk/kz-webkit-gtk.c: Show hover over link message on status bar. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2008-02-22 01:41:24 UTC (rev 3387) +++ kazehakase/trunk/ChangeLog 2008-02-22 02:22:44 UTC (rev 3388) @@ -2,6 +2,8 @@ * module/embed/webkit-gtk/kz-webkit-gtk.c: more functional. * module/embed/webkit-gtk/kz-webkit-gtk.c: Set default settings. + * module/embed/webkit-gtk/kz-webkit-gtk.c: Show hover over link + message on status bar. 2008-02-22 Kouhei Sutou <kou****@cozmi*****> Modified: kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c =================================================================== --- kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2008-02-22 01:41:24 UTC (rev 3387) +++ kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2008-02-22 02:22:44 UTC (rev 3388) @@ -31,6 +31,7 @@ gint progress; gchar *location; gchar *title; + gchar *link_message; gboolean lock; gboolean is_loading; }; @@ -64,6 +65,7 @@ static gdouble get_progress (KzEmbed *kzembed); static const gchar *get_title (KzEmbed *kzembed); static const gchar *get_location (KzEmbed *kzembed); +static gchar *get_link_message (KzEmbed *kzembed); static gchar *ensure_title (KzEmbed *kzembed); static gboolean selection_is_collapsed (KzEmbed *kzembed); static gboolean is_loading (KzEmbed *kzembed); @@ -84,6 +86,10 @@ static void cb_load_finished (WebKitWebView* web_view, WebKitWebFrame* frame, gpointer data); +static void cb_hover_link (WebKitWebView* web_view, + const gchar *title, + const gchar *location, + gpointer data); static void set_default_preferences (KzWebKitGtk *webkit); @@ -153,7 +159,7 @@ iface->get_title = get_title; iface->get_location = get_location; iface->ensure_title = ensure_title; - iface->get_link_message = NULL; + iface->get_link_message = get_link_message; iface->get_progress = get_progress; iface->can_cut_selection = can_cut_selection; iface->can_copy_selection = can_copy_selection; @@ -253,6 +259,7 @@ priv->location = NULL; priv->title = NULL; + priv->link_message = NULL; priv->progress = 0; @@ -269,6 +276,8 @@ G_CALLBACK(cb_load_started), NULL); g_signal_connect(webkit, "load-finished", G_CALLBACK(cb_load_finished), NULL); + g_signal_connect(webkit, "hovering-over-link", + G_CALLBACK(cb_hover_link), NULL); set_default_preferences(webkit); } @@ -280,8 +289,11 @@ g_free(priv->location); if (priv->title) g_free(priv->title); + if (priv->link_message) + g_free(priv->link_message); priv->location = NULL; priv->title = NULL; + priv->link_message = NULL; if (G_OBJECT_CLASS(kz_webkit_gtk_parent_class)->dispose) G_OBJECT_CLASS(kz_webkit_gtk_parent_class)->dispose(object); @@ -423,6 +435,14 @@ } static gchar * +get_link_message (KzEmbed *kzembed) +{ + g_return_val_if_fail(KZ_IS_WEBKIT_GTK(kzembed), NULL); + + return g_strdup(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->link_message); +} + +static gchar * ensure_title (KzEmbed *kzembed) { const gchar *title; @@ -513,6 +533,21 @@ } static void +cb_hover_link (WebKitWebView* web_view, + const gchar *title, + const gchar *location, + gpointer data) +{ + KzWebKitGtkPrivate *priv = KZ_WEBKIT_GTK_GET_PRIVATE(web_view); + + if (priv->link_message) + g_free(priv->link_message); + priv->link_message = g_strdup(location); + + g_signal_emit_by_name(web_view, "kz-link-message"); +} + +static void set_font_preferences (KzProfile *profile, WebKitWebSettings *settings) { /* font settings */