svnno****@sourc*****
svnno****@sourc*****
Mon Oct 15 19:51:03 JST 2007
Revision: 3282 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3282 Author: ikezoe Date: 2007-10-15 19:51:03 +0900 (Mon, 15 Oct 2007) Log Message: ----------- * module/embed/ie/kz-ie.cpp: Implement more functions. * module/embed/gtk-webcore/kz-gtk-webcore.cpp: Clean. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp kazehakase/trunk/module/embed/ie/kz-ie.cpp Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-10-15 10:38:28 UTC (rev 3281) +++ kazehakase/trunk/ChangeLog 2007-10-15 10:51:03 UTC (rev 3282) @@ -7,6 +7,8 @@ * module/embed/ie/Makefile.am: Add GTKIEEMBED_CFLGAGS. * module/embed/ie/kz-ie.cpp: Parent class is GtkIEEmbed. * module/embed/ie/kz-ie.cpp: Implement some fundamental functions. + * module/embed/ie/kz-ie.cpp: Implement more functions. + * module/embed/gtk-webcore/kz-gtk-webcore.cpp: Clean. 2007-10-15 Kouhei Sutou <kou****@cozmi*****> Modified: kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp =================================================================== --- kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-10-15 10:38:28 UTC (rev 3281) +++ kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-10-15 10:51:03 UTC (rev 3282) @@ -1001,14 +1001,12 @@ kz_gtk_webcore_get_progress (KzEmbed *kzembed) { gdouble progress; - KzGtkWebcore *gtk_webcore; KzGtkWebcorePrivate *priv; g_return_val_if_fail(KZ_IS_GTK_WEBCORE(kzembed), 0.0); priv = KZ_GTK_WEBCORE_GET_PRIVATE (kzembed); - gtk_webcore = KZ_GTK_WEBCORE(kzembed); if (priv->total_requests <= 0 || priv->cur_requests <= 0) { Modified: kazehakase/trunk/module/embed/ie/kz-ie.cpp =================================================================== --- kazehakase/trunk/module/embed/ie/kz-ie.cpp 2007-10-15 10:38:28 UTC (rev 3281) +++ kazehakase/trunk/module/embed/ie/kz-ie.cpp 2007-10-15 10:51:03 UTC (rev 3282) @@ -33,6 +33,8 @@ typedef struct _KzIEPrivate KzIEPrivate; struct _KzIEPrivate { + glong current_progress; + glong max_progress; gchar *location; gchar *title; }; @@ -63,7 +65,7 @@ const gchar *url); static const gchar *kz_ie_get_title (KzEmbed *kzembed); static const gchar *kz_ie_get_location (KzEmbed *kzembed); - +static gdouble kz_ie_get_progress (KzEmbed *kzembed); static void kz_ie_reload (KzEmbed *kzembed, KzEmbedReloadFlag flags); static void kz_ie_stop_load (KzEmbed *kzembed); @@ -156,14 +158,14 @@ static void kz_ie_iface_init (KzEmbedIFace *iface) { - iface->load_url = NULL; + iface->load_url = kz_ie_load_url; iface->view_source = NULL; iface->is_loading = NULL; - iface->get_title = NULL; - iface->get_location = NULL; + iface->get_title = kz_ie_get_title; + iface->get_location = kz_ie_get_location; iface->ensure_title = NULL; iface->get_link_message = NULL; - iface->get_progress = NULL; + iface->get_progress = kz_ie_get_progress; iface->can_cut_selection = NULL; iface->can_copy_selection = NULL; iface->can_paste = NULL; @@ -182,10 +184,10 @@ iface->shistory_get_nth = NULL; iface->reload = NULL; iface->stop_load = NULL; - iface->go_back = NULL; - iface->go_forward = NULL; - iface->can_go_back = NULL; - iface->can_go_forward = NULL; + iface->go_back = kz_ie_go_back; + iface->go_forward = kz_ie_go_forward; + iface->can_go_back = kz_ie_can_go_back; + iface->can_go_forward = kz_ie_can_go_forward; iface->can_go_nav_link = NULL; iface->go_nav_link = NULL; iface->append_nav_link = NULL; @@ -272,6 +274,9 @@ priv->location = NULL; priv->title = NULL; + + priv->current_progress = 0; + priv->max_progress =0; } static void @@ -323,6 +328,10 @@ glong current_progress, glong max_progress) { + KzIEPrivate *priv = KZ_IE_GET_PRIVATE(ieembed); + priv->current_progress = current_progress; + priv->max_progress = max_progress; + g_signal_emit_by_name(ieembed, "kz-progress"); } @@ -347,7 +356,7 @@ } static const gchar * -kz_gtk_ie_embed_get_title (KzEmbed *kzembed) +kz_ie_get_title (KzEmbed *kzembed) { g_return_val_if_fail(KZ_IS_IE(kzembed), NULL); @@ -355,13 +364,35 @@ } static const gchar * -kz_gtk_ie_embed_get_location (KzEmbed *kzembed) +kz_ie_get_location (KzEmbed *kzembed) { g_return_val_if_fail(KZ_IS_IE(kzembed), NULL); return KZ_IE_GET_PRIVATE(kzembed)->location; } +static gdouble +kz_ie_get_progress (KzEmbed *kzembed) +{ + gdouble progress; + KzIEPrivate *priv; + + g_return_val_if_fail(KZ_IS_IE(kzembed), 0.0); + + priv = KZ_IE_GET_PRIVATE(kzembed); + + if (priv->max_progress <= 0 || + priv->current_progress <= 0) + { + return 0.0; + } + + progress = (gdouble) priv->current_progress + / (gdouble) priv->max_progress; + + return (progress < 1.0) ? progress : 1.0; +} + static void kz_ie_reload (KzEmbed *kzembed, KzEmbedReloadFlag flags) {