svnno****@sourc*****
svnno****@sourc*****
Fri Sep 4 08:30:51 JST 2009
Revision: 3818 http://sourceforge.jp/projects/kazehakase/svn/view?view=rev&revision=3818 Author: ikezoe Date: 2009-09-04 08:30:51 +0900 (Fri, 04 Sep 2009) Log Message: ----------- * src/kz-web.[ch]: Added a new widget which has a KzEmbed as its chid widget. * src/kz-embed.[ch]: Change some APIs name. kz_embed_load_url -> kz_embed_load_uri, kz_embed_set_zoom -> kz_embed_zoom, kz_embed_get_zoom -> kz_embed_get_zoom_ratio. A lot of files affcted these changes. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/dbus/kz-dbus-embed-agent.c kazehakase/trunk/dbus/kz-embed-process.c kazehakase/trunk/dbus/sample-browser.c kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp kazehakase/trunk/module/embed/ie/kz-ie.c kazehakase/trunk/module/embed/per-process/kz-dbus-embed-delegate.c kazehakase/trunk/module/embed/per-process/kz-embed-process.c kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c kazehakase/trunk/src/Makefile.am kazehakase/trunk/src/actions/kz-actions-dynamic.c kazehakase/trunk/src/actions/kz-actions-popup.c kazehakase/trunk/src/actions/kz-actions-tab.c kazehakase/trunk/src/actions/kz-actions.c kazehakase/trunk/src/actions/kz-actions.h kazehakase/trunk/src/actions/kz-navigation-action.c kazehakase/trunk/src/actions/kz-stop-reload-action.c kazehakase/trunk/src/actions/kz-zoom-action.c kazehakase/trunk/src/actions/kz-zoom-action.h kazehakase/trunk/src/bookmarks/kz-bookmark-tab-menu.c kazehakase/trunk/src/dialogs/kz-links-dialog.c kazehakase/trunk/src/dialogs/kz-links-dialog.h kazehakase/trunk/src/dialogs/kz-print-dialog.c kazehakase/trunk/src/kz-app.c kazehakase/trunk/src/kz-app.h kazehakase/trunk/src/kz-autoscroller.c kazehakase/trunk/src/kz-autoscroller.h kazehakase/trunk/src/kz-embed.c kazehakase/trunk/src/kz-embed.h kazehakase/trunk/src/kz-feed-info.c kazehakase/trunk/src/kz-notebook.c kazehakase/trunk/src/kz-notebook.h kazehakase/trunk/src/kz-statusbar.c kazehakase/trunk/src/kz-tab-label.c kazehakase/trunk/src/kz-tab-label.h kazehakase/trunk/src/kz-window.c kazehakase/trunk/src/kz-window.h kazehakase/trunk/src/sidebar/kz-tabtree.c kazehakase/trunk/src/sidebar/kz-thumbnails-sidebar.c kazehakase/trunk/src/utils/utils.c Added Paths: ----------- kazehakase/trunk/src/kz-site.c kazehakase/trunk/src/kz-site.h kazehakase/trunk/src/kz-web.c kazehakase/trunk/src/kz-web.h Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/ChangeLog 2009-09-03 23:30:51 UTC (rev 3818) @@ -1,3 +1,11 @@ +2009-09-04 Hiroyuki Ikezoe <poinc****@ikezo*****> + + * src/kz-web.[ch]: Added a new widget which has a KzEmbed as its chid widget. + * src/kz-embed.[ch]: Change some APIs name. kz_embed_load_url -> + kz_embed_load_uri, kz_embed_set_zoom -> kz_embed_zoom, + kz_embed_get_zoom -> kz_embed_get_zoom_ratio. A lot of files affcted + these changes. + 2009-09-02 Hiroyuki Ikezoe <poinc****@ikezo*****> * src/kz-embed.[ch], src/kz-tab-label.c, src/utils/utils.[ch], Modified: kazehakase/trunk/dbus/kz-dbus-embed-agent.c =================================================================== --- kazehakase/trunk/dbus/kz-dbus-embed-agent.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/dbus/kz-dbus-embed-agent.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -100,8 +100,7 @@ const gchar *keyword, gboolean backward); static void zoom (KzEmbed *embed, - gint zoom, - gboolean reflow); + gdouble zoom); static gboolean kz_dbus_embed_agent_ready (KzDBusEmbedAgent *object, guint32 process_id, gchar **address, guint32 *id, gchar **engine_name, GError **error); static gboolean kz_dbus_embed_agent_location (KzDBusEmbedAgent *object, gchar *location, GError **error); @@ -391,7 +390,7 @@ static void kz_embed_iface_init (KzEmbedIFace *iface) { - iface->load_url = load_uri; + iface->load_uri = load_uri; iface->view_source = NULL; iface->view_current_page_source_in_new = NULL; @@ -444,8 +443,8 @@ iface->save_with_content = NULL; iface->set_text_into_textarea = NULL; iface->get_text_from_textarea = NULL; - iface->zoom_set = zoom; - iface->zoom_get = NULL; + iface->zoom = zoom; + iface->get_zoom_ratio = NULL; iface->set_text_size = NULL; iface->get_text_size = NULL; iface->get_html_with_contents = NULL; @@ -746,11 +745,9 @@ } static void -zoom (KzEmbed *embed, gint zoom, gboolean reflow) +zoom (KzEmbed *embed, gdouble zoom) { - gdouble ratio = zoom / 100; - - g_signal_emit(embed, signals[ZOOM], 0, ratio); + g_signal_emit(embed, signals[ZOOM], 0, zoom); } void Modified: kazehakase/trunk/dbus/kz-embed-process.c =================================================================== --- kazehakase/trunk/dbus/kz-embed-process.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/dbus/kz-embed-process.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -260,7 +260,7 @@ KzEmbedProcess *process) { KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(process); - kz_embed_load_url(priv->embed, uri); + kz_embed_load_uri(priv->embed, uri); } static void @@ -316,7 +316,7 @@ cb_zoom (DBusGProxy *proxy, gdouble ratio, KzEmbedProcess *process) { KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(process); - kz_embed_zoom_set(priv->embed, ratio, TRUE); + kz_embed_zoom(priv->embed, ratio); } static void Modified: kazehakase/trunk/dbus/sample-browser.c =================================================================== --- kazehakase/trunk/dbus/sample-browser.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/dbus/sample-browser.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -50,7 +50,7 @@ current_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); - kz_embed_load_url(KZ_EMBED(current_page), uri); + kz_embed_load_uri(KZ_EMBED(current_page), uri); } static void Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2009-09-03 23:30:51 UTC (rev 3818) @@ -209,7 +209,7 @@ KzEmbedEvent *info); static gchar *kz_gecko_embed_store_history_file (KzGeckoEmbed *kzembed); -static void load_url (KzEmbed *kzembed, +static void load_uri (KzEmbed *kzembed, const gchar *url); static void view_source (KzEmbed *kzembed, const gchar *url); @@ -296,14 +296,12 @@ const gchar *text); static gchar *get_text_from_textarea(KzEmbed *kzembed, gpointer element); -static void zoom_set (KzEmbed *kzembed, - int zoom, - gboolean reflow); -static int zoom_get (KzEmbed *kzembed); +static void zoom (KzEmbed *kzembed, + gdouble zoom); +static gdouble get_zoom_ratio (KzEmbed *kzembed); static void set_text_size (KzEmbed *kzembed, - int zoom, - gboolean reflow); -static int get_text_size (KzEmbed *kzembed); + gdouble zoom); +static gdouble get_text_size (KzEmbed *kzembed); static gchar *get_html_with_contents(KzEmbed *kzembed, const gchar *storedir); @@ -416,7 +414,7 @@ static void kz_gecko_embed_iface_init (KzEmbedIFace *iface) { - iface->load_url = load_url; + iface->load_uri = load_uri; iface->view_source = view_source; iface->view_current_page_source_in_new = view_current_page_source_in_new; @@ -467,8 +465,8 @@ iface->save_with_content = save_with_content; iface->set_text_into_textarea = set_text_into_textarea; iface->get_text_from_textarea = get_text_from_textarea; - iface->zoom_set = zoom_set; - iface->zoom_get = zoom_get; + iface->zoom = zoom; + iface->get_zoom_ratio = get_zoom_ratio; iface->set_text_size = set_text_size; iface->get_text_size = get_text_size; iface->get_html_with_contents = get_html_with_contents; @@ -587,7 +585,7 @@ #endif priv->last_highlight = NULL; - load_url(KZ_EMBED(kzembed), "about:blank"); + load_uri(KZ_EMBED(kzembed), "about:blank"); } static GObject* @@ -747,7 +745,7 @@ static void -load_url (KzEmbed *kzembed, const gchar *url) +load_uri (KzEmbed *kzembed, const gchar *url) { gchar *start_page = NULL; @@ -2302,7 +2300,7 @@ KzNavi *navi = KZ_NAVI(g_list_nth_data(priv->nav_links[link], 0)); g_return_if_fail(navi); - kz_embed_load_url(kzembed, navi->uri); + kz_embed_load_uri(kzembed, navi->uri); } @@ -2805,39 +2803,39 @@ static void -zoom_set (KzEmbed *kzembed, int zoom, gboolean reflow) +zoom (KzEmbed *kzembed, gdouble zoom) { g_return_if_fail(KZ_IS_GECKO_EMBED(kzembed)); KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); - priv->wrapper->SetImageZoom ((float)(zoom) / 100); + priv->wrapper->SetImageZoom(zoom); - set_text_size(kzembed, zoom, reflow); + set_text_size(kzembed, zoom); } -static int -zoom_get (KzEmbed *kzembed) +static gdouble +get_zoom_ratio (KzEmbed *kzembed) { return get_text_size(kzembed); } static void -set_text_size (KzEmbed *kzembed, int zoom, gboolean reflow) +set_text_size (KzEmbed *kzembed, gdouble zoom) { g_return_if_fail(KZ_IS_GECKO_EMBED(kzembed)); KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); - priv->wrapper->SetZoom ((float)(zoom) / 100, reflow); + priv->wrapper->SetZoom(zoom, TRUE); } -static int +static gdouble get_text_size (KzEmbed *kzembed) { float f; - int zoom; + gdouble zoom; g_return_val_if_fail(KZ_IS_GECKO_EMBED(kzembed), 100); @@ -2848,7 +2846,7 @@ nsresult result = priv->wrapper->GetZoom (&f); if (NS_FAILED (result)) return 100; - zoom = (int) rint (f * 100); + zoom = (gdouble)f; return zoom; } Modified: kazehakase/trunk/module/embed/ie/kz-ie.c =================================================================== --- kazehakase/trunk/module/embed/ie/kz-ie.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/module/embed/ie/kz-ie.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -75,8 +75,8 @@ static gboolean kz_ie_embed_close_window (GtkIEEmbed *embed); static void kz_ie_embed_selection_changed(GtkIEEmbed *embed); /* embed iface */ -static void kz_ie_load_url (KzEmbed *kzembed, - const gchar *url); +static void kz_ie_load_uri (KzEmbed *kzembed, + const gchar *uri); 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); @@ -100,9 +100,8 @@ static void kz_ie_print (KzEmbed *kzembed); static void kz_ie_print_preview (KzEmbed *kzembed); static void kz_ie_set_text_size (KzEmbed *kzembed, - gint zoom, - gboolean reflow); -static gint kz_ie_get_text_size (KzEmbed *kzembed); + gdouble zoom); +static gdouble kz_ie_get_text_size (KzEmbed *kzembed); static void kz_ie_set_encoding (KzEmbed *kzembed, const gchar *encoding); static void kz_ie_get_encoding (KzEmbed *kzembed, @@ -226,7 +225,7 @@ static void kz_ie_iface_init (KzEmbedIFace *iface) { - iface->load_url = kz_ie_load_url; + iface->load_uri = kz_ie_load_uri; iface->view_source = NULL; iface->view_current_page_source_in_new = NULL; @@ -497,7 +496,7 @@ } static void -kz_ie_load_url (KzEmbed *kzembed, const gchar *url) +kz_ie_load_uri (KzEmbed *kzembed, const gchar *url) { g_return_if_fail(KZ_IS_IE(kzembed)); @@ -678,19 +677,19 @@ } static void -kz_ie_set_text_size (KzEmbed *kzembed, int zoom, gboolean reflow) +kz_ie_set_text_size (KzEmbed *kzembed, gdouble zoom) { GtkIEEmbedFontSize size; g_return_if_fail(KZ_IS_IE(kzembed)); - if (zoom > 400) + if (zoom > 4.0) size = GTK_IE_EMBED_FONT_LARGEST; - else if (zoom > 200) + else if (zoom > 2.0) size = GTK_IE_EMBED_FONT_LARGE; - else if (zoom > 80) + else if (zoom > 0.80) size = GTK_IE_EMBED_FONT_MEDIUM; - else if (zoom > 50) + else if (zoom > 0.50) size = GTK_IE_EMBED_FONT_SMALL; else size = GTK_IE_EMBED_FONT_SMALLEST; @@ -698,34 +697,34 @@ gtk_ie_embed_set_font_size(GTK_IE_EMBED(kzembed), size); } -static int +static gdouble kz_ie_get_text_size (KzEmbed *kzembed) { GtkIEEmbedFontSize size; gint ret_size; - g_return_val_if_fail(KZ_IS_IE(kzembed), 100); + g_return_val_if_fail(KZ_IS_IE(kzembed), 1.0); size = gtk_ie_embed_get_font_size(GTK_IE_EMBED(kzembed)); switch (size) { case GTK_IE_EMBED_FONT_LARGEST: - ret_size = 400; + ret_size = 4.0; break; case GTK_IE_EMBED_FONT_LARGE: - ret_size = 200; + ret_size = 2.0; break; case GTK_IE_EMBED_FONT_MEDIUM: - ret_size = 80; + ret_size = 0.80; break; case GTK_IE_EMBED_FONT_SMALL: - ret_size = 50; + ret_size = 0.50; break; case GTK_IE_EMBED_FONT_SMALLEST: - ret_size = 20; + ret_size = 0.20; break; default: - ret_size = 100; + ret_size = 1.0; break; } Modified: kazehakase/trunk/module/embed/per-process/kz-dbus-embed-delegate.c =================================================================== --- kazehakase/trunk/module/embed/per-process/kz-dbus-embed-delegate.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/module/embed/per-process/kz-dbus-embed-delegate.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -104,8 +104,7 @@ const gchar *keyword, gboolean backward); static void zoom (KzEmbed *embed, - gint zoom, - gboolean reflow); + gdouble zoom); static const gchar *get_title (KzEmbed *embed); static const gchar *get_location (KzEmbed *embed); static gdouble get_progress (KzEmbed *embed); @@ -138,11 +137,14 @@ { KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(data); -g_print("crash!\n"); if (WIFSIGNALED(status)) { +g_print("crash signals!\n"); } else if (WIFEXITED(status)){ } else { +g_print("crash!\n"); } + g_spawn_close_pid(priv->process_id); + priv->process_id = -1; priv->watch_id = 0; priv->process_id = -1; } @@ -397,7 +399,7 @@ static void kz_embed_iface_init (KzEmbedIFace *iface) { - iface->load_url = load_uri; + iface->load_uri = load_uri; iface->view_source = NULL; iface->view_current_page_source_in_new = NULL; @@ -447,8 +449,8 @@ iface->save_with_content = NULL; iface->set_text_into_textarea = NULL; iface->get_text_from_textarea = NULL; - iface->zoom_set = zoom; - iface->zoom_get = NULL; + iface->zoom = zoom; + iface->get_zoom_ratio = NULL; iface->set_text_size = NULL; iface->get_text_size = NULL; iface->get_html_with_contents = NULL; @@ -536,8 +538,8 @@ } if (priv->process_id > 0) { kill(priv->process_id, SIGTERM); - g_spawn_close_pid(priv->process_id); - priv->process_id = -1; + while (priv->process_id > 0) + g_main_context_iteration(NULL, TRUE); } if (priv->watch_id > 0) { g_source_remove(priv->watch_id); @@ -711,10 +713,9 @@ } static void -zoom (KzEmbed *embed, gint zoom, gboolean reflow) +zoom (KzEmbed *embed, gdouble ratio) { KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - gdouble ratio = zoom / 100; org_kazehakase_Embed_zoom_async(priv->proxy, ratio, cb_async, NULL); } Modified: kazehakase/trunk/module/embed/per-process/kz-embed-process.c =================================================================== --- kazehakase/trunk/module/embed/per-process/kz-embed-process.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/module/embed/per-process/kz-embed-process.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -76,6 +76,7 @@ { KzEmbed *embed; DBusGProxy *proxy; + DBusGConnection *connection; guint32 embed_id; gchar *socket_address; }; @@ -86,6 +87,7 @@ static GObject *constructor (GType type, guint n_props, GObjectConstructParam *props); +static void dispose (GObject *object); static void set_property (GObject *object, guint prop_id, const GValue *value, @@ -136,8 +138,9 @@ { GObjectClass *object_class; - object_class = G_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS(klass); object_class->constructor = constructor; + object_class->dispose = dispose; object_class->set_property = set_property; object_class->get_property = get_property; @@ -381,7 +384,7 @@ { KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); - kz_embed_load_url(priv->embed, uri); + kz_embed_load_uri(priv->embed, uri); return TRUE; } @@ -511,7 +514,7 @@ { KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); - kz_embed_zoom_set(priv->embed, ratio, TRUE); + kz_embed_zoom(priv->embed, ratio); return TRUE; } @@ -608,7 +611,6 @@ static void setup_dbus (GObject *object) { - DBusGConnection *connection; GError *error = NULL; KzEmbedProcessPrivate *priv; guint32 embed_id; @@ -616,17 +618,16 @@ priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); - connection = dbus_g_connection_open(priv->socket_address, &error); + priv->connection = dbus_g_connection_open(priv->socket_address, &error); if (error) { g_print("Error:%s\n", error->message); g_error_free(error); } - dbus_g_connection_register_g_object(connection, + dbus_g_connection_register_g_object(priv->connection, KZ_EMBED_PROCESS_PATH, object); - dbus_g_connection_unref(connection); - priv->proxy = dbus_g_proxy_new_for_peer(connection, + priv->proxy = dbus_g_proxy_new_for_peer(priv->connection, KZ_DBUS_EMBED_DELEGATE_PATH, KZ_DBUS_EMBED_DELEGATE_INTERFACE); if (!org_kazehakase_Embed_Delegate_ready(priv->proxy, getpid(), &embed_id, &engine_name, &error)) { @@ -637,6 +638,27 @@ } static void +dispose (GObject *object) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + + if (priv->proxy) { + g_object_unref(priv->proxy); + priv->proxy = NULL; + } + if (priv->connection) { + dbus_g_connection_unref(priv->connection); + priv->connection = NULL; + } + + g_free(priv->socket_address); + priv->socket_address = NULL; + + if (G_OBJECT_CLASS(kz_embed_process_parent_class)->dispose) + G_OBJECT_CLASS(kz_embed_process_parent_class)->dispose(object); +} + +static void set_property (GObject *object, guint prop_id, const GValue *value, Modified: kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c =================================================================== --- kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -53,8 +53,8 @@ GObjectConstructParam *props); static void dispose (GObject *object); -static void load_url (KzEmbed *kzembed, - const gchar *url); +static void load_uri (KzEmbed *kzembed, + const gchar *uri); static void stop_load (KzEmbed *kzembed); static void reload (KzEmbed *kzembed, KzEmbedReloadFlag flags); @@ -81,10 +81,9 @@ static const gchar *get_location (KzEmbed *kzembed); static gboolean selection_is_collapsed (KzEmbed *kzembed); static gboolean is_loading (KzEmbed *kzembed); -static void zoom_set (KzEmbed *kzembed, - int zoom, - gboolean reflow); -static int zoom_get (KzEmbed *kzembed); +static void zoom (KzEmbed *kzembed, + gdouble zoom); +static gdouble get_zoom_ratio (KzEmbed *kzembed); static gboolean get_lock (KzEmbed *kzembed); static void set_lock (KzEmbed *kzembed, gboolean lock); @@ -214,7 +213,7 @@ static void kz_webkit_gtk_iface_init (KzEmbedIFace *iface) { - iface->load_url = load_url; + iface->load_uri = load_uri; iface->view_source = NULL; iface->view_current_page_source_in_new = NULL; @@ -264,8 +263,8 @@ iface->save_with_content = NULL; iface->set_text_into_textarea = NULL; iface->get_text_from_textarea = NULL; - iface->zoom_set = zoom_set; - iface->zoom_get = zoom_get; + iface->zoom = zoom; + iface->get_zoom_ratio = get_zoom_ratio; iface->set_text_size = NULL; iface->get_text_size = NULL; iface->get_html_with_contents = NULL; @@ -371,11 +370,11 @@ } static void -load_url (KzEmbed *kzembed, const gchar *url) +load_uri (KzEmbed *kzembed, const gchar *uri) { g_return_if_fail(KZ_IS_WEBKIT_GTK(kzembed)); - webkit_web_view_open(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view, url); + webkit_web_view_open(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view, uri); } static void @@ -517,16 +516,16 @@ } static void -zoom_set (KzEmbed *kzembed, int zoom, gboolean reflow) +zoom (KzEmbed *kzembed, gdouble zoom) { webkit_web_view_set_zoom_level(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view, - (gfloat) zoom / 100); + zoom); } -static int -zoom_get (KzEmbed *kzembed) +static gdouble +get_zoom_ratio (KzEmbed *kzembed) { - return (gint)webkit_web_view_get_zoom_level(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view) * 100; + return webkit_web_view_get_zoom_level(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view); } static gboolean @@ -886,7 +885,7 @@ g_signal_emit_by_name(data, "kz-new-window", &embed); uri = webkit_network_request_get_uri(request); - kz_embed_load_url(embed, uri); + kz_embed_load_uri(embed, uri); return TRUE; } Modified: kazehakase/trunk/src/Makefile.am =================================================================== --- kazehakase/trunk/src/Makefile.am 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/Makefile.am 2009-09-03 23:30:51 UTC (rev 3818) @@ -137,6 +137,8 @@ kz-search.h \ kz-statusbar.h \ kz-migemo.h \ + kz-site.h \ + kz-web.h \ kz-ext.h libkazehakase_la_SOURCES = \ @@ -170,6 +172,8 @@ kz-search.c \ kz-statusbar.c \ kz-migemo.c \ + kz-site.c \ + kz-web.c \ kz-ext.c \ $(enum_sources) \ $(libkazehakase_public_h_sources) Modified: kazehakase/trunk/src/actions/kz-actions-dynamic.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions-dynamic.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-actions-dynamic.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -47,7 +47,7 @@ static void cb_copy_in_user_format_menuitem_activate (GtkWidget *menuitem, KzTabLabel *kztab) { - KzEmbed *kzembed; + KzWeb *kzweb; gint idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), KZ_ACTIONS_DYNAMIC_COPY_IN_USER_FORMAT_KEY)); gchar conf_key[] = "copy_document_format99"; @@ -62,10 +62,10 @@ g_return_if_fail(0 < idx && idx < 100); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kzembed = kztab->kzembed; - if (!KZ_IS_EMBED(kzembed)) return; + kzweb = kztab->kzweb; + if (!KZ_IS_WEB(kzweb)) return; - text = kz_embed_get_selection_string(kzembed); + text = kz_web_get_selection_string(kzweb); if (!text) text = g_strdup(""); g_snprintf(conf_key, sizeof(conf_key), "copy_document_format%d", idx); @@ -117,7 +117,7 @@ if (event && event->cinfo.linktext) temp[i] = event->cinfo.linktext; else - temp[i] = (gchar *)kz_embed_get_title(kzembed); + temp[i] = (gchar *)kz_web_get_title(kzweb); st = 2; } @@ -130,7 +130,7 @@ if (event && event->cinfo.link) temp[i] = event->cinfo.link; else - temp[i] = (gchar *)kz_embed_get_location(kzembed); + temp[i] = (gchar *)kz_web_get_location(kzweb); st = 2; } @@ -245,7 +245,7 @@ { GtkWidget *add_feed_bookmark_submenu = NULL; GtkWidget *menuitem; - KzEmbed *kzembed; + KzWeb *kzweb; GList *nav_link, *nav_links; KzNavi *navi; gchar *title; @@ -256,11 +256,11 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), NULL); } - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - nav_links = kz_embed_get_nav_links(kzembed, KZ_EMBED_LINK_RSS); + nav_links = kz_web_get_nav_links(kzweb, KZ_WEB_LINK_RSS); if (!nav_links) return; @@ -295,7 +295,7 @@ cb_open_smart_bookmark_menuitem_activate (GtkWidget *widget, KzWindow *kz) { KzSmartBookmark *smart_bookmark; - KzEmbed *embed; + KzWeb *web; const gchar *text; gchar *smart_uri; gboolean new_tab; @@ -305,8 +305,8 @@ g_return_if_fail(KZ_IS_SMART_BOOKMARK(smart_bookmark)); - embed = KZ_WINDOW_CURRENT_EMBED(kz); - text = kz_embed_get_selection_string(embed); + web = KZ_WINDOW_CURRENT_WEB(kz); + text = kz_web_get_selection_string(web); smart_uri = kz_smart_bookmark_get_smart_uri(smart_bookmark, text); KZ_CONF_GET("Global", "entry_open_in_new_tab", new_tab, BOOL); Modified: kazehakase/trunk/src/actions/kz-actions-popup.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions-popup.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-actions-popup.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -36,7 +36,7 @@ #include "kz-window.h" #include "kz-tab-label.h" #include "kz-actions-download.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-favicon.h" #include "kz-xml.h" #include "kz-actions-dynamic.h" @@ -61,7 +61,7 @@ typedef struct { - KzEmbed *kzembed; + KzWeb *kzweb; gchar *filename; /* file name for edior */ gpointer element; /* pointer indicated textarea */ } EditorInfo; @@ -104,7 +104,7 @@ break; case NEW_TAB: kz_window_open_new_tab_with_parent(kz, uri, - GTK_WIDGET(KZ_WINDOW_CURRENT_EMBED(kz))); + GTK_WIDGET(KZ_WINDOW_CURRENT_WEB(kz))); break; case NEW_WINDOW: { @@ -217,22 +217,22 @@ } static void -cb_embed_changed (KzEmbed *embed, EditorInfo *einfo) +cb_web_changed (KzWeb *web, EditorInfo *einfo) { - g_return_if_fail(KZ_IS_EMBED(embed)); + g_return_if_fail(KZ_IS_WEB(web)); g_return_if_fail(einfo); - g_signal_handlers_disconnect_by_func(embed, - G_CALLBACK(cb_embed_changed), + g_signal_handlers_disconnect_by_func(web, + G_CALLBACK(cb_web_changed), einfo); if (!einfo) return; if (einfo->filename) g_free(einfo->filename); einfo->filename = NULL; - if (einfo->kzembed) - g_object_unref(einfo->kzembed); - einfo->kzembed = NULL; + if (einfo->kzweb) + g_object_unref(einfo->kzweb); + einfo->kzweb = NULL; einfo->element = NULL; } @@ -249,11 +249,11 @@ if (!data) return; einfo = (EditorInfo*)data; - if (einfo->kzembed) + if (einfo->kzweb) { - g_signal_handlers_disconnect_by_func(einfo->kzembed, - G_CALLBACK(cb_embed_changed), - einfo); + g_signal_handlers_disconnect_by_func(einfo->kzweb, + G_CALLBACK(cb_web_changed), + einfo); } if (einfo->filename) @@ -264,9 +264,9 @@ /* set text into textarea */ if (ret) { - if (KZ_EMBED(einfo->kzembed) && einfo->element) + if (KZ_WEB(einfo->kzweb) && einfo->element) { - kz_embed_set_text_into_textarea(einfo->kzembed, + kz_web_set_text_into_textarea(einfo->kzweb, einfo->element, text); } @@ -277,11 +277,11 @@ einfo->filename = NULL; } - if (einfo->kzembed) + if (einfo->kzweb) { - g_object_unref(einfo->kzembed); + g_object_unref(einfo->kzweb); } - einfo->kzembed = NULL; + einfo->kzweb = NULL; einfo->element = NULL; g_free(einfo); @@ -293,7 +293,7 @@ act_popup_launch_editor (GtkAction *action, KzWindow *kz) { const KzEmbedEventMouse *event; - KzEmbed *embed; + KzWeb *web; GPid pid; GSpawnFlags flags; gint argc; @@ -302,8 +302,8 @@ EditorInfo *einfo = NULL; g_return_if_fail(KZ_IS_WINDOW(kz)); - embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!embed) + web = KZ_WINDOW_CURRENT_WEB(kz); + if (!web) return; event = kz_window_get_mouse_event_info(kz); @@ -316,9 +316,9 @@ if (event->cinfo.context & KZ_CONTEXT_TEXTAREA) { einfo = g_new0(EditorInfo, 1); - einfo->kzembed = g_object_ref(embed); + einfo->kzweb = g_object_ref(web); einfo->element = event->cinfo.element; - text = kz_embed_get_text_from_textarea(embed, + text = kz_web_get_text_from_textarea(web, einfo->element); /* text in textare store in temporary file */ if (text) @@ -340,10 +340,10 @@ } /* */ - g_signal_connect(embed, "kz-net-start", - G_CALLBACK(cb_embed_changed), einfo); - g_signal_connect(embed, "destroy", - G_CALLBACK(cb_embed_changed), einfo); + g_signal_connect(web, "kz-net-start", + G_CALLBACK(cb_web_changed), einfo); + g_signal_connect(web, "destroy", + G_CALLBACK(cb_web_changed), einfo); /* launch editor */ g_shell_parse_argv(command, &argc, @@ -511,16 +511,16 @@ static void cb_encoding_menuitem_activate (GtkWidget *menuitem, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - if (GTK_CHECK_MENU_ITEM(menuitem)->active && embed) + if (GTK_CHECK_MENU_ITEM(menuitem)->active && web) { const gchar* code = g_object_get_data(G_OBJECT(menuitem), KZ_ACTIONS_POPUP_LANGUAGE_KEY); GtkAction *action; - kz_embed_set_encoding(embed, code); + kz_web_set_encoding(web, code); action = gtk_action_group_get_action(kz->actions, "Reload"); @@ -608,7 +608,7 @@ GtkWidget *encoding_submenu; GtkWidget *menuitem; GSList *group = NULL; - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); gchar *encodings_xml; gchar *current_encoding = NULL; gboolean forced = FALSE; @@ -628,9 +628,9 @@ encoding_submenu = gtk_menu_new(); /* get current charset */ - if(embed) + if(web) { - kz_embed_get_encoding(embed, + kz_web_get_encoding(web, ¤t_encoding, &forced); } @@ -755,19 +755,19 @@ for (i = 0; i < num; i++) { - KzEmbed *kzembed = KZ_WINDOW_NTH_EMBED(kz, i); + KzWeb *kzweb = KZ_WINDOW_NTH_WEB(kz, i); GtkWidget *favicon; gchar *title, *escaped, *markup_title; GtkWidget *menuitem; KzTabLabel *tab; KzTabLabelState state; - if (!kzembed) + if (!kzweb) continue; - tab = kz_window_get_tab_label(kz, kzembed); + tab = kz_window_get_tab_label(kz, kzweb); state = kz_tab_label_get_state(tab); - title = kz_embed_ensure_title(kzembed); + title = kz_web_ensure_title(kzweb); escaped = g_markup_escape_text(title, strlen(title)); menuitem = gtk_image_menu_item_new_with_label(title); @@ -791,7 +791,7 @@ /* favicon */ favicon = kz_favicon_get_widget(kzfav, - kz_embed_get_location(kzembed), + kz_web_get_location(kzweb), KZ_ICON_SIZE_BOOKMARK_MENU); if (favicon) { @@ -800,7 +800,7 @@ favicon); } - g_object_set_data (G_OBJECT(menuitem), KZ_ACTIONS_POPUP_TAB_KEY, kzembed); + g_object_set_data (G_OBJECT(menuitem), KZ_ACTIONS_POPUP_TAB_KEY, kzweb); g_signal_connect(menuitem, "activate", G_CALLBACK(cb_tablist_menuitem_activate), kz); Modified: kazehakase/trunk/src/actions/kz-actions-tab.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions-tab.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-actions-tab.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -61,8 +61,8 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kz_embed_reload(kztab->kzembed, - KZ_EMBED_RELOAD_NORMAL); + kz_web_reload(kztab->kzweb, + KZ_WEB_RELOAD_NORMAL); } static void @@ -75,7 +75,7 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kz_embed_stop_load(kztab->kzembed); + kz_web_stop_load(kztab->kzweb); } static void @@ -88,7 +88,7 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kz_window_close_tab(kztab->kz, kztab->kzembed); + kz_window_close_tab(kztab->kz, kztab->kzweb); } enum { @@ -111,7 +111,7 @@ g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); notebook = KZ_NOTEBOOK(kztab->kz->notebook); - pos = kz_notebook_page_num(notebook, GTK_WIDGET(kztab->kzembed)); + pos = kz_notebook_page_num(notebook, GTK_WIDGET(kztab->kzweb)); kz_notebook_close_tabs(notebook, condition, pos); } @@ -155,7 +155,7 @@ static void act_tab_close_all_child (GtkAction *action, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; KzTabLabel *kztab; GNode *tree, *parent; GList *list = NULL, *node; @@ -164,9 +164,9 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); - kzembed = kztab->kzembed; + kzweb = kztab->kzweb; tree = kz_window_get_tree(kz); - parent = g_node_find(tree, G_IN_ORDER, G_TRAVERSE_ALL, kzembed); + parent = g_node_find(tree, G_IN_ORDER, G_TRAVERSE_ALL, kzweb); g_return_if_fail(parent); g_node_traverse(parent, G_PRE_ORDER, G_TRAVERSE_ALL, -1, @@ -175,8 +175,8 @@ { GtkWidget *widget = node->data; - if (widget != GTK_WIDGET(kzembed)) - kz_window_close_tab(kz, KZ_EMBED(widget)); + if (widget != GTK_WIDGET(kzweb)) + kz_window_close_tab(kz, KZ_WEB(widget)); } g_list_free(list); } @@ -200,17 +200,17 @@ num = kz_notebook_get_n_pages(notebook); if (num < 2) return; - src = g_strsplit(kz_embed_get_location(KZ_EMBED(kztab->kzembed)), + src = g_strsplit(kz_web_get_location(KZ_WEB(kztab->kzweb)), "/", 0); for (i = num - 1; i >= 0; i--) { - KzEmbed *embed; - embed = KZ_WINDOW_NTH_EMBED(kz, i); - target = g_strsplit(kz_embed_get_location(embed), "/", 0); + KzWeb *web; + web = KZ_WINDOW_NTH_WEB(kz, i); + target = g_strsplit(kz_web_get_location(web), "/", 0); if(!(strcmp(src[2] , target[2]))) - kz_window_close_tab(kz, embed); + kz_window_close_tab(kz, web); g_strfreev(target); } g_strfreev(src); @@ -226,7 +226,7 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - gtkutil_copy_text(kz_embed_get_title(KZ_EMBED(kztab->kzembed))); + gtkutil_copy_text(kz_web_get_title(KZ_WEB(kztab->kzweb))); } static void @@ -239,7 +239,7 @@ kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark); g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - gtkutil_copy_text(kz_embed_get_location(KZ_EMBED(kztab->kzembed))); + gtkutil_copy_text(kz_web_get_location(KZ_WEB(kztab->kzweb))); } static void @@ -254,9 +254,9 @@ g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); str = g_strdup_printf("<a href=\"%s\" title=\"%s\">%s</a>", - kz_embed_get_location(KZ_EMBED(kztab->kzembed)), - kz_embed_get_title(KZ_EMBED(kztab->kzembed)), - kz_embed_get_title(KZ_EMBED(kztab->kzembed))); + kz_web_get_location(KZ_WEB(kztab->kzweb)), + kz_web_get_title(KZ_WEB(kztab->kzweb)), + kz_web_get_title(KZ_WEB(kztab->kzweb))); gtkutil_copy_text(str); g_free(str); } @@ -308,7 +308,7 @@ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)); - kz_embed_set_allow_javascript(KZ_EMBED(kztab->kzembed), active); + kz_web_set_allow_javascript(KZ_WEB(kztab->kzweb), active); kz_tab_label_set_javascript(kztab, active); } @@ -326,22 +326,22 @@ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)); - kz_embed_set_allow_images(KZ_EMBED(kztab->kzembed), active); + kz_web_set_allow_images(KZ_WEB(kztab->kzweb), active); } static void act_tab_copy_tab (GtkAction *action, KzWindow *kz) { - KzEmbed *src_embed, *dest_embed; + KzWeb *src_web, *dest_web; g_return_if_fail(KZ_IS_WINDOW(kz)); - src_embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!src_embed) + src_web = KZ_WINDOW_CURRENT_WEB(kz); + if (!src_web) return; - dest_embed = KZ_EMBED(kz_window_open_new_tab(kz, NULL)); + dest_web = KZ_WEB(kz_window_open_new_tab(kz, NULL)); - kz_embed_copy_page(src_embed, dest_embed); + kz_web_copy_page(src_web, dest_web); } GtkActionEntry kz_actions_tab[] = @@ -450,16 +450,16 @@ g_return_if_fail(KZ_IS_WINDOW(kz)); pos = kz_notebook_page_num(KZ_NOTEBOOK(kztab->kz->notebook), - GTK_WIDGET(kztab->kzembed)); + GTK_WIDGET(kztab->kzweb)); num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kztab->kz->notebook)); action = gtk_action_group_get_action(kz->tabpop_actions, "TabStop"); - gtk_action_set_sensitive(action, kz_embed_is_loading(kztab->kzembed)); + gtk_action_set_sensitive(action, kz_web_is_loading(kztab->kzweb)); action = gtk_action_group_get_action(kz->tabpop_actions, "TabAddFeedBookmark"); - if (kztab->kzembed && - kz_embed_get_nav_link(kztab->kzembed, KZ_EMBED_LINK_RSS)) + if (kztab->kzweb && + kz_web_get_nav_link(kztab->kzweb, KZ_WEB_LINK_RSS)) has_feed = TRUE; else has_feed = FALSE; @@ -489,12 +489,12 @@ action = gtk_action_group_get_action(kz->tabpop_actions, "TabToggleJavascript"); - javascript = kz_embed_get_allow_javascript(KZ_EMBED(kztab->kzembed)); + javascript = kz_web_get_allow_javascript(KZ_WEB(kztab->kzweb)); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), javascript); action = gtk_action_group_get_action(kz->tabpop_actions, "TabToggleImages"); - images = kz_embed_get_allow_images(KZ_EMBED(kztab->kzembed)); + images = kz_web_get_allow_images(KZ_WEB(kztab->kzweb)); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), images); action = gtk_action_group_get_action(kz->tabpop_actions, Modified: kazehakase/trunk/src/actions/kz-actions.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-actions.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -47,7 +47,7 @@ #include "kz-stop-reload-action.h" #include "kz-smart-bookmark-action.h" #include "kz-zoom-action.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-actions-download.h" #include "kz-actions-popup.h" #include "kz-actions-dynamic.h" @@ -91,20 +91,20 @@ static void act_save (GtkAction *action, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; gchar *filename; g_return_if_fail(KZ_IS_WINDOW(kz)); - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; filename = kz_actions_download_open_save_dialog(GTK_WINDOW(kz), - kz_embed_get_location(kzembed), + kz_web_get_location(kzweb), TRUE); if (filename) { - kz_embed_save_with_content(kzembed, filename); + kz_web_save_with_content(kzweb, filename); g_free(filename); } } @@ -122,9 +122,9 @@ static void act_close_tab (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (embed) - kz_window_close_tab(kz, embed); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + if (web) + kz_window_close_tab(kz, web); } @@ -270,13 +270,13 @@ static void act_open_selected_links (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GList *list = NULL, *node; - if (!embed) + if (!web) return; - kz_embed_get_links(embed, &list, TRUE); + kz_web_get_links(web, &list, TRUE); for (node = list; node; node = g_list_next(node)) { @@ -291,7 +291,7 @@ if (kz_bookmark_filter_out(link)) continue; kz_window_open_new_tab_with_parent(KZ_WINDOW(kz), uri, - GTK_WIDGET(embed)); + GTK_WIDGET(web)); } g_list_foreach(list, (GFunc) g_object_unref, NULL); @@ -303,7 +303,7 @@ static void act_open_selected_text (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); gchar *text; GRegex *regex; GMatchInfo *match_info; @@ -323,7 +323,7 @@ return; } - text = kz_embed_get_selection_string(embed); + text = kz_web_get_selection_string(web); if (!text) return; match = g_regex_match(regex, text, 0, &match_info); @@ -337,7 +337,7 @@ { kz_window_open_new_tab_with_parent(KZ_WINDOW(kz), uri[i], - GTK_WIDGET(embed)); + GTK_WIDGET(web)); i++; } if (uri) @@ -353,27 +353,27 @@ static void act_back (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_back(embed); + kz_web_go_back(web); } static void act_forward (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_forward(embed); + kz_web_go_forward(web); } static void act_go_up (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_up(embed); + kz_web_go_up(web); } @@ -415,54 +415,54 @@ static void act_index (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_nav_link(embed, KZ_EMBED_LINK_INDEX); + kz_web_go_nav_link(web, KZ_WEB_LINK_INDEX); } static void act_contents (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_nav_link(embed, KZ_EMBED_LINK_CONTENTS); + kz_web_go_nav_link(web, KZ_WEB_LINK_CONTENTS); } static void act_start (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_nav_link(embed, KZ_EMBED_LINK_START); + kz_web_go_nav_link(web, KZ_WEB_LINK_START); } static void act_prev (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_nav_link(embed, KZ_EMBED_LINK_PREV); + kz_web_go_nav_link(web, KZ_WEB_LINK_PREV); } static void act_next (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_go_nav_link(embed, KZ_EMBED_LINK_NEXT); + kz_web_go_nav_link(web, KZ_WEB_LINK_NEXT); } static void act_stop (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_stop_load(embed); + kz_web_stop_load(web); } @@ -471,16 +471,16 @@ { GdkModifierType state = (GdkModifierType)0; gint x, y; - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); g_return_if_fail(KZ_IS_WINDOW(kz)); gdk_window_get_pointer(NULL, &x, &y, &state); - kz_embed_reload(embed, + kz_web_reload(web, (state & GDK_SHIFT_MASK) ? - KZ_EMBED_RELOAD_BYPASS_PROXY_AND_CACHE : - KZ_EMBED_RELOAD_NORMAL); + KZ_WEB_RELOAD_BYPASS_PROXY_AND_CACHE : + KZ_WEB_RELOAD_NORMAL); } @@ -495,9 +495,9 @@ for (i = num - 1; i >= 0; i--) { - KzEmbed *embed = KZ_WINDOW_NTH_EMBED(kz, i); + KzWeb *web = KZ_WINDOW_NTH_WEB(kz, i); - kz_embed_stop_load(embed); + kz_web_stop_load(web); } } @@ -516,12 +516,12 @@ for (i = num - 1; i >= 0; i--) { - KzEmbed *embed = KZ_WINDOW_NTH_EMBED(kz, i); + KzWeb *web = KZ_WINDOW_NTH_WEB(kz, i); - kz_embed_reload(embed, + kz_web_reload(web, (state & GDK_SHIFT_MASK) ? - KZ_EMBED_RELOAD_BYPASS_CACHE : - KZ_EMBED_RELOAD_NORMAL); + KZ_WEB_RELOAD_BYPASS_CACHE : + KZ_WEB_RELOAD_NORMAL); } } @@ -529,20 +529,20 @@ static void act_view_source (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GtkWidget *newtab; newtab = kz_window_open_new_tab(kz, NULL); - kz_embed_view_current_page_source_in_new(embed, KZ_EMBED(newtab)); + kz_web_view_current_page_source_in_new(web, KZ_WEB(newtab)); } static void act_show_page_certificate (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - kz_embed_show_page_certificate(embed); + kz_web_show_page_certificate(web); } static void @@ -652,12 +652,12 @@ } else { - KzEmbed *kzembed; + KzWeb *kzweb; - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - kz_embed_cut_selection(kzembed); + kz_web_cut_selection(kzweb); } } @@ -677,13 +677,13 @@ } else { - KzEmbed *kzembed; + KzWeb *kzweb; - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - kz_embed_copy_selection(kzembed); + kz_web_copy_selection(kzweb); } } @@ -702,13 +702,13 @@ } else { - KzEmbed *kzembed; + KzWeb *kzweb; - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - kz_embed_paste(kzembed); + kz_web_paste(kzweb); } } @@ -728,13 +728,13 @@ } else { - KzEmbed *kzembed; + KzWeb *kzweb; - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - kz_embed_select_all(kzembed); + kz_web_select_all(kzweb); } } @@ -742,16 +742,16 @@ static void act_copy_title (GtkAction *action, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; const gchar *text; g_return_if_fail(KZ_IS_WINDOW (kz)); - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - text = kz_embed_get_title(kzembed); + text = kz_web_get_title(kzweb); gtkutil_copy_text(text); } @@ -759,32 +759,32 @@ static void act_copy_url (GtkAction *action, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; const gchar *text; g_return_if_fail(KZ_IS_WINDOW (kz)); - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - text = kz_embed_get_location(kzembed); + text = kz_web_get_location(kzweb); gtkutil_copy_text(text); } static void act_get_body_text (GtkAction *action, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; gchar *text; g_return_if_fail(KZ_IS_WINDOW (kz)); - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!kzembed) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (!kzweb) return; - text = kz_embed_get_body_text(kzembed); + text = kz_web_get_body_text(kzweb); } @@ -985,7 +985,7 @@ KzBookmark *bookmark, *sibling = NULL; KzBookmark *file; KzBookmark *folder; - KzEmbed *embed; + KzWeb *web; const gchar *title, *uri; gchar *desc; @@ -1001,12 +1001,12 @@ g_return_if_fail(KZ_IS_BOOKMARK_FOLDER(folder)); } - embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!embed) return; + web = KZ_WINDOW_CURRENT_WEB(kz); + if (!web) return; - title = kz_embed_ensure_title(embed); - uri = kz_embed_get_location(embed); - desc = kz_embed_get_selection_string(embed); + title = kz_web_ensure_title(web); + uri = kz_web_get_location(web); + desc = kz_web_get_selection_string(web); if (!uri) return; @@ -1037,14 +1037,14 @@ static void act_add_first_feed_bookmark (GtkAction *action, KzWindow *kz) { - KzEmbed *embed; + KzWeb *web; g_return_if_fail(KZ_IS_WINDOW(kz)); - embed = KZ_EMBED(KZ_WINDOW_CURRENT_EMBED(kz)); + web = KZ_WEB(KZ_WINDOW_CURRENT_WEB(kz)); - kz_navi_add_bookmark(kz_embed_get_nth_nav_link(embed, - KZ_EMBED_LINK_RSS, + kz_navi_add_bookmark(kz_web_get_nth_nav_link(web, + KZ_WEB_LINK_RSS, 0)); } @@ -1163,7 +1163,7 @@ act_clip_selection (GtkAction *action, KzWindow *kz) { KzBookmark *clip, *bookmark; - KzEmbed *embed; + KzWeb *web; const gchar *title, *uri; gchar *source = NULL; GTimeVal now; @@ -1177,8 +1177,8 @@ if (!KZ_IS_WINDOW(kz)) return; - embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!embed) return; + web = KZ_WINDOW_CURRENT_WEB(kz); + if (!web) return; clip = KZ_GET_CLIP_BOOKMARK; g_get_current_time(&now); @@ -1213,7 +1213,7 @@ clip_dir_name = g_build_filename(KZ_GET_CLIPS_DIR, dir_name, NULL); g_mkdir_with_parents(clip_dir_name, 0700); - source = kz_embed_get_html_with_contents(embed, dir_name); + source = kz_web_get_html_with_contents(web, dir_name); filename = g_build_filename(clip_dir_name, full_htmlname, @@ -1247,12 +1247,12 @@ static void act_extract_links (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GtkWidget *dialog; - if (!embed) return; + if (!web) return; - dialog = kz_links_dialog_new(GTK_WINDOW(kz), embed, FALSE); + dialog = kz_links_dialog_new(GTK_WINDOW(kz), web, FALSE); gtk_widget_show(dialog); } @@ -1260,11 +1260,11 @@ static void act_extract_selected_links (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GtkWidget *dialog; - if (!embed) return; - dialog = kz_links_dialog_new(GTK_WINDOW(kz), embed, TRUE); + if (!web) return; + dialog = kz_links_dialog_new(GTK_WINDOW(kz), web, TRUE); gtk_widget_show(dialog); } @@ -1306,12 +1306,12 @@ static void act_copy_tab (GtkAction *action, KzWindow *kz) { - KzEmbed *src_embed, *dest_embed; + KzWeb *src_web, *dest_web; - src_embed = KZ_WINDOW_CURRENT_EMBED(kz); - dest_embed = KZ_EMBED(kz_window_open_new_tab(kz, NULL)); + src_web = KZ_WINDOW_CURRENT_WEB(kz); + dest_web = KZ_WEB(kz_window_open_new_tab(kz, NULL)); - kz_embed_copy_page(src_embed, dest_embed); + kz_web_copy_page(src_web, dest_web); } @@ -1330,23 +1330,23 @@ static void act_print (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - if (!embed) + if (!web) return; - kz_embed_print(embed); + kz_web_print(web); } static void act_print_preview (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - if (!embed) + if (!web) return; - kz_embed_print_preview(embed); + kz_web_print_preview(web); } @@ -1371,19 +1371,19 @@ static void act_decrease_text_size (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - gint ratio; + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + gdouble ratio; - if (!embed) + if (!web) return; - ratio = kz_embed_get_text_size(embed); - ratio = ratio - 10; + ratio = kz_web_get_text_size(web); + ratio = ratio * 0.9; if (ratio > 0) { GtkAction *zoom; - kz_embed_set_text_size(embed, ratio, TRUE); + kz_web_set_text_size(web, ratio); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), @@ -1394,19 +1394,19 @@ static void act_increase_text_size (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - gint ratio; + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + gdouble ratio; - if (!embed) + if (!web) return; - ratio = kz_embed_get_text_size(embed); - ratio = ratio + 10; + ratio = kz_web_get_text_size(web); + ratio = ratio * 1.1; - if (ratio < 1000) + if (ratio < 10) { GtkAction *zoom; - kz_embed_set_text_size(embed, ratio, TRUE); + kz_web_set_text_size(web, ratio); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), @@ -1418,13 +1418,13 @@ static void act_normal_text_size (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GtkAction *zoom; - if (!embed) + if (!web) return; - kz_embed_set_text_size(embed, 100, TRUE); + kz_web_set_text_size(web, 100); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), 100); @@ -1434,19 +1434,19 @@ static void act_zoom_out (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - gint ratio; + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + gdouble ratio; - if (!embed) + if (!web) return; - ratio = kz_embed_zoom_get(embed); - ratio = ratio - 10; + ratio = kz_web_get_zoom_ratio(web); + ratio = ratio * 0.9; if (ratio > 0) { GtkAction *zoom; - kz_embed_zoom_set(embed, ratio, TRUE); + kz_web_zoom(web, ratio); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), @@ -1457,19 +1457,19 @@ static void act_zoom_in (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - gint ratio; + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + gdouble ratio; - if (!embed) + if (!web) return; - ratio = kz_embed_zoom_get(embed); - ratio = ratio + 10; + ratio = kz_web_get_zoom_ratio(web); + ratio = ratio * 1.1; - if (ratio < 1000) + if (ratio < 10) { GtkAction *zoom; - kz_embed_zoom_set(embed, ratio, TRUE); + kz_web_zoom(web, ratio); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), @@ -1481,13 +1481,13 @@ static void act_zoom_100 (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); GtkAction *zoom; - if (!embed) + if (!web) return; - kz_embed_zoom_set(embed, 100, TRUE); + kz_web_zoom(web, 1.0); zoom = gtk_action_group_get_action(kz->actions, "Zoom"); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(zoom), @@ -1498,12 +1498,12 @@ static void act_page_up (GtkAction *action, KzWindow *kz) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); - if (!embed) + if (!web) return; - kz_embed_page_up(embed); + kz_web_page_up(web); } static void @@ -1525,8 +1525,8 @@ } else { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - kz_embed_page_down(embed); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + kz_web_page_down(web); } } @@ -1535,19 +1535,19 @@ { gint x, y; GdkDisplay *display; - KzEmbed *embed; + KzWeb *web; KzAutoscroller *as; g_return_if_fail(KZ_IS_WINDOW(kz)); - embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!embed) + web = KZ_WINDOW_CURRENT_WEB(kz); + if (!web) return; - display = gtk_widget_get_display(GTK_WIDGET(embed)); + display = gtk_widget_get_display(GTK_WIDGET(web)); as = kz_autoscroller_new (); gdk_display_get_pointer (display, NULL, &x, &y, NULL); - kz_autoscroller_set_embed (as, embed); + kz_autoscroller_set_web (as, web); kz_autoscroller_start_scroll (as, GTK_WIDGET(kz), x, y); g_object_unref (as); } @@ -1862,7 +1862,7 @@ set_popup_menu_sensitive (KzWindow *kz, KzBookmark *bookmark) { KzBookmark *bookmark_file; - KzEmbed *kzembed; + KzWeb *kzweb; GtkAction *action; gboolean has_link, is_folder, is_file, has_children = FALSE; gboolean children_is_editable, is_editable, has_feed; @@ -1883,8 +1883,8 @@ children_is_editable = TRUE; else children_is_editable = FALSE; - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (kzembed && kz_embed_get_nav_link(kzembed, KZ_EMBED_LINK_RSS)) + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (kzweb && kz_web_get_nav_link(kzweb, KZ_WEB_LINK_RSS)) has_feed = TRUE; else has_feed = FALSE; @@ -1968,7 +1968,7 @@ void -kz_actions_set_selection_sensitive (KzWindow *kz, KzEmbed *kzembed) +kz_actions_set_selection_sensitive (KzWindow *kz, KzWeb *kzweb) { GtkWidget *focus; gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE; @@ -1976,7 +1976,7 @@ focus = gtk_window_get_focus(GTK_WINDOW(kz)); #warning FIXME! should track all GtkEditable's event and Embed's selection - if (kzembed && !kz_embed_selection_is_collapsed(kzembed)) + if (kzweb && !kz_web_selection_is_collapsed(kzweb)) { KZ_WINDOW_SET_SENSITIVE(kz, "OpenSelectedLinks", TRUE); } @@ -1997,11 +1997,11 @@ } can_paste = TRUE; } - else if (KZ_IS_EMBED(kzembed)) + else if (KZ_IS_WEB(kzweb)) { - can_cut = kz_embed_can_cut_selection(kzembed); - can_copy = kz_embed_can_copy_selection(kzembed); - can_paste = kz_embed_can_paste(kzembed); + can_cut = kz_web_can_cut_selection(kzweb); + can_copy = kz_web_can_copy_selection(kzweb); + can_paste = kz_web_can_paste(kzweb); } can_cut = TRUE; @@ -2016,7 +2016,7 @@ } void -kz_actions_set_tab_sensitive (KzWindow *kz, KzEmbed *kzembed) +kz_actions_set_tab_sensitive (KzWindow *kz, KzWeb *kzweb) { gint num, pos = 0; GtkAction *action; @@ -2027,7 +2027,7 @@ if (!num) return; pos = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook), - GTK_WIDGET(kzembed)); + GTK_WIDGET(kzweb)); if (num > 1) { action = gtk_action_group_get_action(kz->actions, @@ -2040,8 +2040,8 @@ } else { - KzEmbed *prev = KZ_WINDOW_NTH_EMBED(kz, pos - 1); - const gchar* uri = kz_embed_get_location(prev); + KzWeb *prev = KZ_WINDOW_NTH_WEB(kz, pos - 1); + const gchar* uri = kz_web_get_location(prev); /* set favicon */ combine_favicon(action, uri, kz); KZ_WINDOW_SET_SENSITIVE(kz, "CloseAllBackwardTab", TRUE); @@ -2057,8 +2057,8 @@ } else { - KzEmbed *next = KZ_WINDOW_NTH_EMBED(kz, pos + 1); - const gchar* uri = kz_embed_get_location(next); + KzWeb *next = KZ_WINDOW_NTH_WEB(kz, pos + 1); + const gchar* uri = kz_web_get_location(next); /* set favicon */ combine_favicon(action, uri, kz); KZ_WINDOW_SET_SENSITIVE(kz, "CloseAllForwardTab", TRUE); @@ -2072,7 +2072,7 @@ KZ_WINDOW_SET_SENSITIVE(kz, "CloseAllInactiveTabs", FALSE); } - if (kzembed && kz_embed_get_nav_link(kzembed, KZ_EMBED_LINK_RSS)) + if (kzweb && kz_web_get_nav_link(kzweb, KZ_WEB_LINK_RSS)) { KZ_WINDOW_SET_SENSITIVE(kz, "AddFirstFeedBookmark", TRUE); } @@ -2083,7 +2083,7 @@ } void -kz_actions_set_sensitive (KzWindow *kz, KzEmbed *kzembed) +kz_actions_set_sensitive (KzWindow *kz, KzWeb *kzweb) { gboolean can_go_back = FALSE; gboolean can_go_forward = FALSE; @@ -2099,41 +2099,41 @@ gboolean active; g_return_if_fail (KZ_IS_WINDOW(kz)); - /* g_return_if_fail (KZ_IS_EMBED (kzembed)); */ + /* g_return_if_fail (KZ_IS_WEB (kzweb)); */ num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook)); - if (kzembed) + if (kzweb) { GtkAction *nav; gchar *uri = NULL, *title = NULL; - can_stop = kz_embed_is_loading(kzembed); - can_go_back = kz_embed_can_go_back(kzembed); - can_go_forward = kz_embed_can_go_forward(kzembed); - can_go_up = kz_embed_can_go_up(kzembed); + can_stop = kz_web_is_loading(kzweb); + can_go_back = kz_web_can_go_back(kzweb); + can_go_forward = kz_web_can_go_forward(kzweb); + can_go_up = kz_web_can_go_up(kzweb); - can_go_index = kz_embed_can_go_nav_link(kzembed, KZ_EMBED_LINK_INDEX); - can_go_contents = kz_embed_can_go_nav_link(kzembed, KZ_EMBED_LINK_CONTENTS); - can_go_start = kz_embed_can_go_nav_link(kzembed, KZ_EMBED_LINK_START); - can_go_prev = kz_embed_can_go_nav_link(kzembed, KZ_EMBED_LINK_PREV); - can_go_next = kz_embed_can_go_nav_link(kzembed, KZ_EMBED_LINK_NEXT); + can_go_index = kz_web_can_go_nav_link(kzweb, KZ_WEB_LINK_INDEX); + can_go_contents = kz_web_can_go_nav_link(kzweb, KZ_WEB_LINK_CONTENTS); + can_go_start = kz_web_can_go_nav_link(kzweb, KZ_WEB_LINK_START); + can_go_prev = kz_web_can_go_nav_link(kzweb, KZ_WEB_LINK_PREV); + can_go_next = kz_web_can_go_nav_link(kzweb, KZ_WEB_LINK_NEXT); - can_add_feed = (kz_embed_get_nav_link(kzembed, KZ_EMBED_LINK_RSS) != NULL); - can_close_tab = !kz_embed_get_lock(kzembed); + can_add_feed = (kz_web_get_nav_link(kzweb, KZ_WEB_LINK_RSS) != NULL); + can_close_tab = !kz_web_get_lock(kzweb); for (i = 0; i< num; i++) { - KzEmbed *embed; + KzWeb *web; - embed = KZ_WINDOW_NTH_EMBED(kz, i); - if (!embed) + web = KZ_WINDOW_NTH_WEB(kz, i); + if (!web) continue; - can_stop_all = kz_embed_is_loading(embed); + can_stop_all = kz_web_is_loading(web); if (can_stop_all) break; } - kz_embed_shistory_get_nth(kzembed, -1, TRUE, &uri, &title); + kz_web_shistory_get_nth(kzweb, -1, TRUE, &uri, &title); action = gtk_action_group_get_action(kz->actions, "Back"); combine_favicon(action, uri, kz); @@ -2145,7 +2145,7 @@ uri = NULL; title = NULL; - kz_embed_shistory_get_nth(kzembed, 1, TRUE, &uri, &title); + kz_web_shistory_get_nth(kzweb, 1, TRUE, &uri, &title); action = gtk_action_group_get_action(kz->actions, "Forward"); combine_favicon(action, uri, kz); @@ -2189,7 +2189,7 @@ KZ_STOP_RELOAD_ACTION(action), can_stop?KZ_STOP_RELOAD_ACTION_STATE_STOP:KZ_STOP_RELOAD_ACTION_STATE_RELOAD); - kz_actions_set_selection_sensitive(kz, kzembed); + kz_actions_set_selection_sensitive(kz, kzweb); /* Sidebar position menu */ action = gtk_action_group_get_action(kz->actions, Modified: kazehakase/trunk/src/actions/kz-actions.h =================================================================== --- kazehakase/trunk/src/actions/kz-actions.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-actions.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -32,7 +32,7 @@ #include <gtk/gtk.h> #include "kz-window.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-bookmark.h" G_BEGIN_DECLS @@ -43,11 +43,11 @@ GtkActionGroup *kz_actions_create_group (KzWindow *kz); void kz_actions_set_sensitive (KzWindow *kz, - KzEmbed *kzembed); + KzWeb *kzweb); void kz_actions_set_tab_sensitive (KzWindow *kz, - KzEmbed *kzembed); + KzWeb *kzweb); void kz_actions_set_selection_sensitive (KzWindow *kz, - KzEmbed *kzembed); + KzWeb *kzweb); KzBookmark *kz_actions_get_bookmark_for_action (KzWindow *kz); void kz_actions_set_bookmark_for_action (KzWindow *kz, Modified: kazehakase/trunk/src/actions/kz-navigation-action.c =================================================================== --- kazehakase/trunk/src/actions/kz-navigation-action.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-navigation-action.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -164,15 +164,15 @@ static void activate (GtkAction *action) { - KzEmbed *embed; + KzWeb *web; g_return_if_fail(KZ_NAVIGATION_ACTION(action)); - embed = KZ_WINDOW_CURRENT_EMBED(KZ_NAVIGATION_ACTION(action)->kz); + web = KZ_WINDOW_CURRENT_WEB(KZ_NAVIGATION_ACTION(action)->kz); - if (!embed) return; + if (!web) return; - kz_embed_go_back(embed); + kz_web_go_back(web); } static void @@ -180,11 +180,11 @@ { gint go_nth; - KzEmbed *kzembed = KZ_WINDOW_CURRENT_EMBED(action->kz); + KzWeb *kzweb = KZ_WINDOW_CURRENT_WEB(action->kz); go_nth = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "go_nth")); - kz_embed_go_history_index(kzembed, go_nth); + kz_web_go_history_index(kzweb, go_nth); } static void @@ -198,7 +198,7 @@ { int i, pos, count; GtkWidget *menu; - KzEmbed *kzembed = KZ_WINDOW_CURRENT_EMBED(action->kz); + KzWeb *kzweb = KZ_WINDOW_CURRENT_WEB(action->kz); KzFavicon *kzfav = KZ_GET_FAVICON; menu = gtk_menu_tool_button_get_menu(b); @@ -212,7 +212,7 @@ menu = gtk_menu_new(); } - kz_embed_shistory_get_pos(kzembed, &pos, &count); + kz_web_shistory_get_pos(kzweb, &pos, &count); for (i = 0; i < pos; i++) { @@ -220,7 +220,7 @@ GtkWidget *item; GtkWidget *favicon = NULL; - kz_embed_shistory_get_nth (kzembed, i, FALSE, + kz_web_shistory_get_nth (kzweb, i, FALSE, &uri, &title); item = gtk_image_menu_item_new_with_label(title); Modified: kazehakase/trunk/src/actions/kz-stop-reload-action.c =================================================================== --- kazehakase/trunk/src/actions/kz-stop-reload-action.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-stop-reload-action.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -195,7 +195,7 @@ KzWindow *kz; GdkModifierType state = (GdkModifierType)0; gint x, y; - KzEmbed *embed; + KzWeb *web; KzStopReloadActionPrivate *priv = KZ_STOP_RELOAD_ACTION_GET_PRIVATE (action); kz = priv->kz; @@ -203,20 +203,20 @@ gdk_window_get_pointer(NULL, &x, &y, &state); - embed = KZ_WINDOW_CURRENT_EMBED(kz); - if (!embed) + web = KZ_WINDOW_CURRENT_WEB(kz); + if (!web) return; switch (priv->state) { case KZ_STOP_RELOAD_ACTION_STATE_STOP: - kz_embed_stop_load(embed); + kz_web_stop_load(web); break; case KZ_STOP_RELOAD_ACTION_STATE_RELOAD: - kz_embed_reload(embed, + kz_web_reload(web, (state & GDK_SHIFT_MASK) ? - KZ_EMBED_RELOAD_BYPASS_PROXY_AND_CACHE : - KZ_EMBED_RELOAD_NORMAL); + KZ_WEB_RELOAD_BYPASS_PROXY_AND_CACHE : + KZ_WEB_RELOAD_NORMAL); break; default: break; Modified: kazehakase/trunk/src/actions/kz-zoom-action.c =================================================================== --- kazehakase/trunk/src/actions/kz-zoom-action.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-zoom-action.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -202,25 +202,25 @@ cb_spin_value_changed (GtkSpinButton *spin, KzZoomAction *action) { gint ratio; - KzEmbed *embed; + KzWeb *web; KzZoomActionPrivate *priv = KZ_ZOOM_ACTION_GET_PRIVATE (action); if (!priv->spin || !GTK_WIDGET_VISIBLE(priv->spin)) return; - embed = KZ_WINDOW_CURRENT_EMBED(priv->kz); - if (!embed) + web = KZ_WINDOW_CURRENT_WEB(priv->kz); + if (!web) return; ratio = gtk_spin_button_get_value_as_int (spin); - kz_embed_zoom_set(embed, ratio, TRUE); + kz_web_zoom(web, (gdouble)ratio / 100); } void kz_zoom_action_set_ratio (KzZoomAction *action, - gint ratio) + gdouble ratio) { GtkWidget *spin; KzZoomActionPrivate *priv; @@ -234,24 +234,24 @@ spin = priv->spin; g_signal_handlers_block_by_func(spin, G_CALLBACK(cb_spin_value_changed), action); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), ratio); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), ratio * 100); g_signal_handlers_unblock_by_func(spin, G_CALLBACK(cb_spin_value_changed), action); } -gint +gdouble kz_zoom_action_get_ratio (KzZoomAction *action) { gint ratio; KzZoomActionPrivate *priv; - g_return_val_if_fail(KZ_IS_ZOOM_ACTION(action), 100); + g_return_val_if_fail(KZ_IS_ZOOM_ACTION(action), 1.0); priv = KZ_ZOOM_ACTION_GET_PRIVATE (action); if (!priv->spin || !GTK_WIDGET_VISIBLE(priv->spin)) - return 100; - ratio = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(priv->spin)); + return 1.0; + ratio = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(priv->spin)) / 100; return ratio; } Modified: kazehakase/trunk/src/actions/kz-zoom-action.h =================================================================== --- kazehakase/trunk/src/actions/kz-zoom-action.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/actions/kz-zoom-action.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -49,7 +49,7 @@ KzZoomAction *kz_zoom_action_new (KzWindow *kz); void kz_zoom_action_set_ratio (KzZoomAction *action, - gint ratio); -gint kz_zoom_action_get_ratio (KzZoomAction *action); + gdouble ratio); +gdouble kz_zoom_action_get_ratio (KzZoomAction *action); #endif /* KZ_ZOOM_ACTION_H */ Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-tab-menu.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark-tab-menu.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/bookmarks/kz-bookmark-tab-menu.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -506,7 +506,7 @@ cb_tab_menu_item_activate (GtkWidget *widget, KzWindow *kz) { KzBookmarkFolder *item; - GtkWidget *kzembed; + GtkWidget *kzweb; KzTabLabel *kztab; g_return_if_fail(KZ_IS_WINDOW(kz)); @@ -515,8 +515,8 @@ KZ_BOOKMARK_TAB_MENU_BOOKMARK_KEY); g_return_if_fail(item); - kzembed = kz_window_open_new_tab(kz, NULL); - kztab = kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), KZ_EMBED(kzembed)); + kzweb = kz_window_open_new_tab(kz, NULL); + kztab = kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), KZ_WEB(kzweb)); kz_tab_label_set_history(KZ_TAB_LABEL(kztab), item); /* FIXME! should use parent bookmark */ Modified: kazehakase/trunk/src/dialogs/kz-links-dialog.c =================================================================== --- kazehakase/trunk/src/dialogs/kz-links-dialog.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/dialogs/kz-links-dialog.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -32,7 +32,7 @@ enum { PROP_0, PROP_PARENT_WINDOW, - PROP_KZ_EMBED, + PROP_KZ_WEB, PROP_SELECTED_ONLY }; @@ -109,11 +109,11 @@ G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, - PROP_KZ_EMBED, - g_param_spec_object("kz-embed", - _("KzEmbed"), - _("The embed widget to extract links"), - KZ_TYPE_EMBED, + PROP_KZ_WEB, + g_param_spec_object("kz-web", + _("KzWeb"), + _("The web widget to extract links"), + KZ_TYPE_WEB, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property @@ -138,7 +138,7 @@ GtkTreeSelection *selection; kzlinks->parent_window = NULL; - kzlinks->kzembed = NULL; + kzlinks->kzweb = NULL; kzlinks->selected_only = FALSE; main_vbox = GTK_DIALOG(kzlinks)->vbox; @@ -231,16 +231,16 @@ g_signal_connect(kzlinks->parent_window, "destroy", G_CALLBACK(cb_parent_destroy), kzlinks); - g_signal_connect(kzlinks->kzembed, "destroy", + g_signal_connect(kzlinks->kzweb, "destroy", G_CALLBACK(cb_parent_destroy), kzlinks); g_snprintf(buf, sizeof(buf), _("Extracted links - %s"), - kz_embed_get_title(kzlinks->kzembed)); + kz_web_get_title(kzlinks->kzweb)); gtk_window_set_title(GTK_WINDOW(kzlinks), buf); gtk_window_set_transient_for(GTK_WINDOW(kzlinks), GTK_WINDOW(kzlinks->parent_window)); - result = kz_embed_get_links(kzlinks->kzembed, &list, + result = kz_web_get_links(kzlinks->kzweb, &list, kzlinks->selected_only); if (!result || !list) return object; @@ -285,14 +285,14 @@ kzlinks->parent_window = NULL; } - if (kzlinks->kzembed) + if (kzlinks->kzweb) { g_signal_handlers_disconnect_by_func - (kzlinks->kzembed, + (kzlinks->kzweb, G_CALLBACK(cb_parent_destroy), kzlinks); - g_object_unref(kzlinks->kzembed); - kzlinks->kzembed = NULL; + g_object_unref(kzlinks->kzweb); + kzlinks->kzweb = NULL; } if (kzlinks->list_store) @@ -319,8 +319,8 @@ case PROP_PARENT_WINDOW: kzlinks->parent_window = g_object_ref(g_value_get_object(value)); break; - case PROP_KZ_EMBED: - kzlinks->kzembed = g_object_ref(g_value_get_object(value)); + case PROP_KZ_WEB: + kzlinks->kzweb = g_object_ref(g_value_get_object(value)); break; case PROP_SELECTED_ONLY: kzlinks->selected_only = g_value_get_boolean(value); @@ -345,8 +345,8 @@ case PROP_PARENT_WINDOW: g_value_set_object(value, kzlinks->parent_window); break; - case PROP_KZ_EMBED: - g_value_set_object(value, kzlinks->kzembed); + case PROP_KZ_WEB: + g_value_set_object(value, kzlinks->kzweb); break; case PROP_SELECTED_ONLY: g_value_set_boolean(value, kzlinks->selected_only); @@ -359,13 +359,13 @@ GtkWidget * -kz_links_dialog_new (GtkWindow *parent_window, KzEmbed *kzembed, gboolean selected_only) +kz_links_dialog_new (GtkWindow *parent_window, KzWeb *kzweb, gboolean selected_only) { GtkWidget *widget; widget = GTK_WIDGET(g_object_new(KZ_TYPE_LINKS_DIALOG, "parent-window", parent_window, - "kz-embed", kzembed, + "kz-web", kzweb, "selected-only", selected_only, NULL)); @@ -495,7 +495,7 @@ g_return_if_fail (KZ_IS_LINKS_DIALOG(dialog)); kzlinks = KZ_LINKS_DIALOG(dialog); - if (!kzlinks->parent_window || !kzlinks->kzembed) return; + if (!kzlinks->parent_window || !kzlinks->kzweb) return; switch (arg) { case GTK_RESPONSE_YES: @@ -540,7 +540,7 @@ if (url && *url) { kz_window_open_new_tab_with_parent(KZ_WINDOW(kzlinks->parent_window), - url, GTK_WIDGET(kzlinks->kzembed)); + url, GTK_WIDGET(kzlinks->kzweb)); } g_free(url); Modified: kazehakase/trunk/src/dialogs/kz-links-dialog.h =================================================================== --- kazehakase/trunk/src/dialogs/kz-links-dialog.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/dialogs/kz-links-dialog.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -23,7 +23,7 @@ #include <gtk/gtk.h> -#include "kz-embed.h" +#include "kz-web.h" G_BEGIN_DECLS @@ -43,7 +43,7 @@ GtkDialog parent; GtkWindow *parent_window; - KzEmbed *kzembed; + KzWeb *kzweb; GtkWidget *scrolled_window; GtkTreeView *tree_view; @@ -59,7 +59,7 @@ GType kz_links_dialog_get_type (void) G_GNUC_CONST; GtkWidget *kz_links_dialog_new (GtkWindow *parent_window, - KzEmbed *kzembed, + KzWeb *kzweb, gboolean selected_only); #endif /* __KZ_LINKS_DIALOG_H__ */ Modified: kazehakase/trunk/src/dialogs/kz-print-dialog.c =================================================================== --- kazehakase/trunk/src/dialogs/kz-print-dialog.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/dialogs/kz-print-dialog.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -263,7 +263,7 @@ GObjectConstructParam *props) { GtkWidget *widget; - KzEmbed *embed; + KzWeb *web; KzPrintDialog *print; GObject *object; GObjectClass *klass = G_OBJECT_CLASS(kz_print_dialog_parent_class); @@ -278,13 +278,13 @@ gtk_window_set_title(GTK_WINDOW(print), _("Print")); gtk_window_set_transient_for(GTK_WINDOW(print), GTK_WINDOW(print->parent_window)); - embed = KZ_WINDOW_CURRENT_EMBED(KZ_WINDOW(print->parent_window)); + web = KZ_WINDOW_CURRENT_WEB(KZ_WINDOW(print->parent_window)); - if (embed) + if (web) { GList *printer_list, *node; - printer_list = kz_embed_get_printer_list(embed); + printer_list = kz_web_get_printer_list(web); for (node = g_list_first(printer_list); node; node = g_list_next(node)) { Modified: kazehakase/trunk/src/kz-app.c =================================================================== --- kazehakase/trunk/src/kz-app.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-app.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -317,7 +317,7 @@ "etc", PACKAGE, NULL); priv->system_embed_module_dir = g_build_filename(priv->system_lib_dir, - "embed", NULL); + "web", NULL); priv->system_search_module_dir = g_build_filename(priv->system_lib_dir, "search", NULL); @@ -892,7 +892,7 @@ } GtkWidget * -kz_app_get_window_from_embed (KzApp *app, KzEmbed *embed) +kz_app_get_window_from_web (KzApp *app, KzWeb *web) { KzAppPrivate *priv = KZ_APP_GET_PRIVATE(app); GList *node; @@ -905,7 +905,7 @@ if (!KZ_IS_WINDOW(kz)) continue; label = kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), - embed); + web); if (label) return GTK_WIDGET(kz); } Modified: kazehakase/trunk/src/kz-app.h =================================================================== --- kazehakase/trunk/src/kz-app.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-app.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -28,7 +28,7 @@ #include "kz-profile.h" #include "kz-root-bookmark.h" #include "kz-migemo.h" -#include "kz-embed.h" +#include "kz-web.h" #include "egg-pixbuf-thumbnail.h" @@ -115,8 +115,8 @@ KzProfile *kz_app_get_profile (KzApp *app); KzProfile *kz_app_get_proxy (KzApp *app); const GList *kz_app_get_window_list (KzApp *app); -GtkWidget *kz_app_get_window_from_embed - (KzApp *app, KzEmbed *embed); +GtkWidget *kz_app_get_window_from_web + (KzApp *app, KzWeb *web); void kz_app_freeze_session (KzApp *app); void kz_app_thaw_session (KzApp *app); #if USE_MIGEMO Modified: kazehakase/trunk/src/kz-autoscroller.c =================================================================== --- kazehakase/trunk/src/kz-autoscroller.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-autoscroller.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -29,6 +29,7 @@ #endif #include "kz-autoscroller.h" +#include "kazehakase.h" #include <gtk/gtk.h> #include <stdlib.h> @@ -36,7 +37,7 @@ typedef struct _KzAutoscrollerPriv KzAutoscrollerPriv; struct _KzAutoscrollerPriv { - KzEmbed *embed; + KzWeb *web; GtkWidget *widget; guint start_x; guint start_y; @@ -136,7 +137,7 @@ { KzAutoscrollerPriv *priv = KZ_AUTOSCROLLER_GET_PRIVATE (as); - priv->embed = NULL; + priv->web = NULL; priv->widget = NULL; priv->active = FALSE; priv->msecs = 33; @@ -148,15 +149,15 @@ KzAutoscroller *as = KZ_AUTOSCROLLER (object); KzAutoscrollerPriv *priv = KZ_AUTOSCROLLER_GET_PRIVATE (as); - if (priv->embed) + if (priv->web) { - g_object_unref (priv->embed); - priv->embed = NULL; + g_object_unref(priv->web); + priv->web = NULL; } if (priv->timeout_id) { - g_source_remove (priv->timeout_id); + g_source_remove(priv->timeout_id); priv->timeout_id = 0; } @@ -167,22 +168,22 @@ KzAutoscroller * kz_autoscroller_new (void) { - KzAutoscroller *as = g_object_new (KZ_TYPE_AUTOSCROLLER, NULL); + KzAutoscroller *as = g_object_new(KZ_TYPE_AUTOSCROLLER, NULL); return as; } void -kz_autoscroller_set_embed (KzAutoscroller *as, - KzEmbed *embed) +kz_autoscroller_set_web (KzAutoscroller *as, + KzWeb *web) { KzAutoscrollerPriv *priv = KZ_AUTOSCROLLER_GET_PRIVATE (as); - if (priv->embed) + if (priv->web) { - g_object_unref (priv->embed); + g_object_unref(priv->web); } - priv->embed = g_object_ref (embed); + priv->web = g_object_ref (web); } void @@ -192,7 +193,7 @@ static GdkCursor *cursor = NULL; KzAutoscrollerPriv *priv = KZ_AUTOSCROLLER_GET_PRIVATE (as); - g_return_if_fail (priv->embed); + g_return_if_fail (priv->web); g_return_if_fail (autoscroll_icon); if (priv->active) @@ -321,7 +322,7 @@ gint scroll_step_x_int; g_return_val_if_fail (KZ_IS_AUTOSCROLLER (as), FALSE); - g_return_val_if_fail (KZ_IS_EMBED (priv->embed), FALSE); + g_return_val_if_fail (KZ_IS_WEB (priv->web), FALSE); /* return if we're not supposed to scroll */ if (!priv->step_y && !priv->step_x) @@ -353,7 +354,7 @@ /* exit if we're not supposed to scroll yet */ if (!scroll_step_y_int && !scroll_step_x_int) return TRUE; - /* get the time before we tell the embed to scroll */ + /* get the time before we tell the web to scroll */ g_get_current_time(&start_time); /* do scrolling, moving at a constart speed regardless of the @@ -362,7 +363,7 @@ /* FIXME: if mozilla is able to do diagonal scrolling in a * reasonable manner at some point, this should be changed to * calculate x and pass both values instead of just y */ - kz_embed_fine_scroll (priv->embed, scroll_step_x_int, scroll_step_y_int); + kz_web_fine_scroll (priv->web, scroll_step_x_int, scroll_step_y_int); /* find out how long the scroll took */ g_get_current_time(&finish_time); Modified: kazehakase/trunk/src/kz-autoscroller.h =================================================================== --- kazehakase/trunk/src/kz-autoscroller.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-autoscroller.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -27,7 +27,7 @@ #define __KZ_AUTOSCROLLER_H__ #include <gtk/gtk.h> -#include "kz-embed.h" +#include "kz-web.h" G_BEGIN_DECLS @@ -53,8 +53,8 @@ GType kz_autoscroller_get_type (void) G_GNUC_CONST; KzAutoscroller *kz_autoscroller_new (void); -void kz_autoscroller_set_embed (KzAutoscroller *as, - KzEmbed *embed); +void kz_autoscroller_set_web (KzAutoscroller *as, + KzWeb *web); void kz_autoscroller_start_scroll (KzAutoscroller *as, GtkWidget *widget, gint x, gint y); Modified: kazehakase/trunk/src/kz-embed.c =================================================================== --- kazehakase/trunk/src/kz-embed.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-embed.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -170,8 +170,6 @@ static void kz_embed_base_init (gpointer g_class); static gint kz_embed_signals[LAST_SIGNAL] = {0}; -static gchar *kz_embed_get_up_location(KzEmbed *kzembed); - GType kz_embed_get_type (void) { @@ -394,7 +392,7 @@ void -kz_embed_load_url (KzEmbed *kzembed, const gchar *url) +kz_embed_load_uri (KzEmbed *kzembed, const gchar *uri) { KzEmbed *target_embed = kzembed; g_return_if_fail(KZ_IS_EMBED(kzembed)); @@ -405,7 +403,7 @@ "new-window", &target_embed, 0); } - KZ_EMBED_GET_IFACE(kzembed)->load_url(target_embed, url); + KZ_EMBED_GET_IFACE(kzembed)->load_uri(target_embed, uri); } @@ -464,34 +462,6 @@ } -gchar * -kz_embed_ensure_title (KzEmbed *kzembed) -{ - const gchar *title; - gboolean is_loading; - - g_return_val_if_fail(KZ_IS_EMBED(kzembed), NULL); - - title = kz_embed_get_title(kzembed); - if (title) - return g_strdup(title); - - is_loading = kz_embed_is_loading(kzembed); - title = kz_embed_get_location(kzembed); - if (title && strlen(title) != 0) - { - if (is_loading) - return g_strdup_printf(_("Loading %s ..."), title); - else - return g_strdup(title); - } - if (is_loading) - return g_strdup(_("Loading...")); - - return g_strdup(_("No title")); -} - - gdouble kz_embed_get_progress (KzEmbed *kzembed) { @@ -747,7 +717,6 @@ KZ_EMBED_GET_IFACE(kzembed)->go_back(kzembed); } - void kz_embed_go_forward (KzEmbed *kzembed) { @@ -757,19 +726,6 @@ KZ_EMBED_GET_IFACE(kzembed)->go_forward(kzembed); } - -void -kz_embed_go_up (KzEmbed *kzembed) -{ - gchar *location; - g_return_if_fail(KZ_IS_EMBED(kzembed)); - - location = kz_embed_get_up_location(kzembed); - kz_embed_load_url(kzembed, location); - g_free(location); -} - - gboolean kz_embed_can_go_back (KzEmbed *kzembed) { @@ -780,7 +736,6 @@ return KZ_EMBED_GET_IFACE(kzembed)->can_go_back(kzembed); } - gboolean kz_embed_can_go_forward (KzEmbed *kzembed) { @@ -791,34 +746,7 @@ return KZ_EMBED_GET_IFACE(kzembed)->can_go_forward(kzembed); } - gboolean -kz_embed_can_go_up (KzEmbed *kzembed) -{ - gboolean ret; - gchar *location; - - g_return_val_if_fail(KZ_IS_EMBED(kzembed), FALSE); - - location = kz_embed_get_up_location(kzembed); - - if (!location) return FALSE; - - /* stupid! */ - if (strcmp(location, "http://") && - strcmp(location, "https://") && - strcmp(location, "ftp://") && - strcmp(location, "file://")) - ret = TRUE; - else - ret = FALSE; - g_free(location); - - return ret; -} - - -gboolean kz_embed_can_go_nav_link (KzEmbed *kzembed, KzEmbedNavLink link) { g_return_val_if_fail(KZ_IS_EMBED(kzembed), FALSE); @@ -1061,39 +989,39 @@ void -kz_embed_zoom_set (KzEmbed *kzembed, gint zoom, gboolean reflow) +kz_embed_zoom (KzEmbed *kzembed, gdouble zoom) { g_return_if_fail(KZ_IS_EMBED(kzembed)); - if (!KZ_EMBED_GET_IFACE(kzembed)->zoom_set) + if (!KZ_EMBED_GET_IFACE(kzembed)->zoom) return; - KZ_EMBED_GET_IFACE(kzembed)->zoom_set(kzembed, zoom, reflow); + KZ_EMBED_GET_IFACE(kzembed)->zoom(kzembed, zoom); } -gint -kz_embed_zoom_get (KzEmbed *kzembed) +gdouble +kz_embed_get_zoom_ratio (KzEmbed *kzembed) { - g_return_val_if_fail(KZ_IS_EMBED(kzembed), 100); - if (!KZ_EMBED_GET_IFACE(kzembed)->zoom_get) - return 100; + g_return_val_if_fail(KZ_IS_EMBED(kzembed), 1.0); + if (!KZ_EMBED_GET_IFACE(kzembed)->get_zoom_ratio) + return 1.0; - return KZ_EMBED_GET_IFACE(kzembed)->zoom_get(kzembed); + return KZ_EMBED_GET_IFACE(kzembed)->get_zoom_ratio(kzembed); } void -kz_embed_set_text_size (KzEmbed *kzembed, gint zoom, gboolean reflow) +kz_embed_set_text_size (KzEmbed *kzembed, gdouble zoom) { g_return_if_fail(KZ_IS_EMBED(kzembed)); if (!KZ_EMBED_GET_IFACE(kzembed)->set_text_size) return; - KZ_EMBED_GET_IFACE(kzembed)->set_text_size(kzembed, zoom, reflow); + KZ_EMBED_GET_IFACE(kzembed)->set_text_size(kzembed, zoom); } -gint +gdouble kz_embed_get_text_size (KzEmbed *kzembed) { g_return_val_if_fail(KZ_IS_EMBED(kzembed), 100); @@ -1230,57 +1158,3 @@ return KZ_EMBED_GET_IFACE(kzembed)->show_page_certificate(kzembed); } -static gchar * -kz_embed_get_up_location(KzEmbed *kzembed) -{ - const gchar *location; - gchar *up_location = NULL; - gchar *pos, *dummy; - int len; - - location = kz_embed_get_location(kzembed); - if (!location) return NULL; - - len = strlen(location); - if (location[len - 1] == '/') - dummy = g_strndup(location, len - 1); - else - dummy = g_strndup(location, len); - pos = strrchr(dummy, '/'); - if (pos) - up_location = g_strndup(dummy, pos - dummy + 1); - g_free(dummy); - - return up_location; -} - -KzSite * -kz_site_new (const gchar *title, const gchar *uri) -{ - KzSite *site; - - site = g_new0(KzSite, 1); - site->title = g_strdup(title); - site->uri = g_strdup(uri); - return site; -} - -void -kz_site_free (KzSite *site) -{ - if (!site) - return; - g_free(site->title); - g_free(site->uri); - g_free(site); -} - -void -kz_site_list_free (GList *list) -{ - if (!list) - return; - g_list_foreach(list, (GFunc)kz_site_free, NULL); - g_list_free(list); -} - Modified: kazehakase/trunk/src/kz-embed.h =================================================================== --- kazehakase/trunk/src/kz-embed.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-embed.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -24,6 +24,7 @@ #include "kz-embed-event.h" #include "kz-navi.h" #include "egg-pixbuf-thumbnail.h" +#include "kz-site.h" #ifndef __KZ_EMBED_H__ #define __KZ_EMBED_H__ @@ -35,16 +36,6 @@ #define KZ_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), KZ_TYPE_EMBED)) #define KZ_EMBED_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), KZ_TYPE_EMBED, KzEmbedIFace)) -typedef struct _KzSite KzSite; -struct _KzSite { - gchar *uri; - gchar *title; -}; - -KzSite *kz_site_new (const gchar *title, const gchar *uri); -void kz_site_free (KzSite *site); -void kz_site_list_free (GList *list); - typedef struct _KzEmbed KzEmbed; typedef struct _KzEmbedIFace KzEmbedIFace; @@ -87,8 +78,8 @@ GTypeInterface g_iface; /* vtable */ - void (*load_url) (KzEmbed *kzembed, - const gchar *url); + void (*load_uri) (KzEmbed *kzembed, + const gchar *uri); void (*view_source) (KzEmbed *kzembed, const gchar *url); void (*view_current_page_source_in_new) @@ -146,11 +137,9 @@ void (*stop_load) (KzEmbed *kzembed); void (*go_back) (KzEmbed *kzembed); void (*go_forward) (KzEmbed *kzembed); - void (*go_up) (KzEmbed *kzembed); gboolean (*can_go_back) (KzEmbed *kzembed); gboolean (*can_go_forward) (KzEmbed *kzembed); - gboolean (*can_go_up) (KzEmbed *kzembed); gboolean (*can_go_nav_link) (KzEmbed *kzembed, KzEmbedNavLink link); @@ -205,14 +194,12 @@ gpointer element); - void (*zoom_set) (KzEmbed *kzembed, - gint zoom, - gboolean reflow); - gint (*zoom_get) (KzEmbed *kzembed); + void (*zoom) (KzEmbed *kzembed, + gdouble zoom); + gdouble (*get_zoom_ratio) (KzEmbed *kzembed); void (*set_text_size) (KzEmbed *kzembed, - gint zoom, - gboolean reflow); - gint (*get_text_size) (KzEmbed *kzembed); + gdouble zoom); + gdouble (*get_text_size) (KzEmbed *kzembed); gchar *(*get_html_with_contents) (KzEmbed *kzembed, @@ -299,8 +286,8 @@ GList *kz_embed_engine_ids (void); GtkWidget *kz_embed_new (const gchar *module_name); -void kz_embed_load_url (KzEmbed *kzembed, - const gchar *url); +void kz_embed_load_uri (KzEmbed *kzembed, + const gchar *uri); void kz_embed_view_source (KzEmbed *kzembed, const gchar *url); void kz_embed_view_current_page_source_in_new @@ -311,7 +298,6 @@ const gchar *kz_embed_get_title (KzEmbed *kzembed); const gchar *kz_embed_get_location (KzEmbed *kzembed); -gchar *kz_embed_ensure_title (KzEmbed *kzembed); gdouble kz_embed_get_progress (KzEmbed *kzembed); @@ -360,11 +346,9 @@ void kz_embed_stop_load (KzEmbed *kzembed); void kz_embed_go_back (KzEmbed *kzembed); void kz_embed_go_forward (KzEmbed *kzembed); -void kz_embed_go_up (KzEmbed *kzembed); gboolean kz_embed_can_go_back (KzEmbed *kzembed); gboolean kz_embed_can_go_forward (KzEmbed *kzembed); -gboolean kz_embed_can_go_up (KzEmbed *kzembed); gboolean kz_embed_can_go_nav_link (KzEmbed *kzembed, KzEmbedNavLink link); @@ -418,14 +402,12 @@ gpointer element); -void kz_embed_zoom_set (KzEmbed *kzembed, - gint zoom, - gboolean reflow); -gint kz_embed_zoom_get (KzEmbed *kzembed); +void kz_embed_zoom (KzEmbed *kzembed, + gdouble zoom); +gdouble kz_embed_get_zoom_ratio (KzEmbed *kzembed); void kz_embed_set_text_size (KzEmbed *kzembed, - gint zoom, - gboolean reflow); -gint kz_embed_get_text_size (KzEmbed *kzembed); + gdouble zoom); +gdouble kz_embed_get_text_size (KzEmbed *kzembed); gchar *kz_embed_get_html_with_contents (KzEmbed *kzembed, Modified: kazehakase/trunk/src/kz-feed-info.c =================================================================== --- kazehakase/trunk/src/kz-feed-info.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-feed-info.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -137,8 +137,8 @@ void kz_feed_info_change_state (KzFeedInfo *info) { - if (kz_embed_get_nav_links(KZ_WINDOW_CURRENT_EMBED(info->kz), - KZ_EMBED_LINK_RSS)) + if (kz_web_get_nav_links(KZ_WINDOW_CURRENT_WEB(info->kz), + KZ_WEB_LINK_RSS)) kz_feed_info_setup_for_with_feed(info); else kz_feed_info_setup_for_without_feed(info); @@ -194,16 +194,16 @@ { GList *nav_links, *nav_link; GtkWidget *menu, *menuitem; - KzEmbed *embed; + KzWeb *web; gchar *label; - embed = KZ_WINDOW_CURRENT_EMBED(info->kz); - if (!embed) return; + web = KZ_WINDOW_CURRENT_WEB(info->kz); + if (!web) return; switch (event->button) { case 1: case 3: - nav_links = kz_embed_get_nav_links(embed, KZ_EMBED_LINK_RSS); + nav_links = kz_web_get_nav_links(web, KZ_WEB_LINK_RSS); if (!nav_links) return; menu = gtk_menu_new(); Modified: kazehakase/trunk/src/kz-notebook.c =================================================================== --- kazehakase/trunk/src/kz-notebook.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-notebook.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -326,9 +326,9 @@ KzTabLabel *tab; gchar *title; KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE(notebook); - KzEmbed *kzembed = kz_notebook_get_nth_embed(KZ_NOTEBOOK(notebook), page_num); + KzWeb *kzweb = kz_notebook_get_nth_web(KZ_NOTEBOOK(notebook), page_num); - title = kz_embed_ensure_title(kzembed); + title = kz_web_ensure_title(kzweb); if (title) { gtk_window_set_title(GTK_WINDOW(priv->kz), title); @@ -339,10 +339,10 @@ gtk_window_set_title(GTK_WINDOW(priv->kz), _("Kazehakase")); } - priv->view_hist = g_list_remove(priv->view_hist, kzembed); - priv->view_hist = g_list_prepend(priv->view_hist, kzembed); + priv->view_hist = g_list_remove(priv->view_hist, kzweb); + priv->view_hist = g_list_prepend(priv->view_hist, kzweb); - tab = kz_notebook_get_tab_label(KZ_NOTEBOOK(notebook), kzembed); + tab = kz_notebook_get_tab_label(KZ_NOTEBOOK(notebook), kzweb); g_return_if_fail(tab); if (kz_tab_label_get_state(tab) == KZ_TAB_LABEL_STATE_LOADED) @@ -350,7 +350,7 @@ const gchar *location; gboolean focus; kz_tab_label_set_state(tab, KZ_TAB_LABEL_STATE_NORMAL); - location = kz_embed_get_location(kzembed); + location = kz_web_get_location(kzweb); if((!location || *location == 0) && KZ_CONF_GET("Tab", "focus_loc_ent_new", focus, BOOL) && focus) @@ -450,14 +450,14 @@ } gint -kz_notebook_open_new_tab_at_pos (KzNotebook *notebook, KzEmbed *embed, KzTabLabel *label, gint pos) +kz_notebook_open_new_tab_at_pos (KzNotebook *notebook, KzWeb *web, KzTabLabel *label, gint pos) { KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE(notebook); gint inserted_pos; GtkWidget *bin; bin = kz_bin_new(); - gtk_container_add(GTK_CONTAINER(bin), GTK_WIDGET(embed)); + gtk_container_add(GTK_CONTAINER(bin), GTK_WIDGET(web)); gtk_widget_show(bin); inserted_pos = gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), bin, @@ -465,13 +465,13 @@ pos); /* add to this notebook's history */ - priv->open_hist = g_list_prepend(priv->open_hist, embed); + priv->open_hist = g_list_prepend(priv->open_hist, web); return inserted_pos; } gint -kz_notebook_open_new_tab (KzNotebook *notebook, KzEmbed *embed, KzTabLabel *label) +kz_notebook_open_new_tab (KzNotebook *notebook, KzWeb *web, KzTabLabel *label) { gint pos; GNode *node; @@ -479,17 +479,17 @@ pos = get_insert_tab_position(notebook); - pos = kz_notebook_open_new_tab_at_pos(notebook, embed, label, pos); + pos = kz_notebook_open_new_tab_at_pos(notebook, web, label, pos); /* insret node */ - node = g_node_new(embed); + node = g_node_new(web); g_node_append(priv->tab_tree, node); return pos; } gint -kz_notebook_open_new_tab_with_parent (KzNotebook *notebook, KzEmbed *embed, KzTabLabel *label, KzEmbed *parent) +kz_notebook_open_new_tab_with_parent (KzNotebook *notebook, KzWeb *web, KzTabLabel *label, KzWeb *parent) { gint pos; GNode *node, *parent_node; @@ -497,10 +497,10 @@ pos = get_insert_tab_position(notebook); - pos = kz_notebook_open_new_tab_at_pos(notebook, embed, label, pos); + pos = kz_notebook_open_new_tab_at_pos(notebook, web, label, pos); /* insret node */ - node = g_node_new(embed); + node = g_node_new(web); parent_node = g_node_find(priv->tab_tree, G_IN_ORDER, G_TRAVERSE_ALL, parent); if (parent_node) @@ -512,23 +512,23 @@ } gint -kz_notebook_prepend_new_tab (KzNotebook *notebook, KzEmbed *embed, KzTabLabel *label) +kz_notebook_prepend_new_tab (KzNotebook *notebook, KzWeb *web, KzTabLabel *label) { gint pos; GNode *node; KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE(notebook); - pos = kz_notebook_open_new_tab_at_pos(notebook, embed, label, -1); + pos = kz_notebook_open_new_tab_at_pos(notebook, web, label, -1); /* insret node */ - node = g_node_new(embed); + node = g_node_new(web); g_node_append(priv->tab_tree, node); return pos; } gboolean -kz_notebook_close_tab (KzNotebook *notebook, KzEmbed *embed) +kz_notebook_close_tab (KzNotebook *notebook, KzWeb *web) { gchar *ret_page = NULL; KzTabLabel *kztab = NULL; @@ -536,16 +536,16 @@ KzNotebookPrivate *priv = KZ_NOTEBOOK_GET_PRIVATE(notebook); KzWindow *kz = priv->kz; GNode *node, *child; - KzEmbed *current = kz_notebook_get_nth_embed(notebook, + KzWeb *current = kz_notebook_get_nth_web(notebook, gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); - kztab = kz_notebook_get_tab_label(notebook, embed); + kztab = kz_notebook_get_tab_label(notebook, web); if (kztab && kz_tab_label_get_lock(kztab)) { /* kztab is locked, so return without closing tab */ return FALSE; } - else if (current != embed) + else if (current != web) { /* close tab which is not current , so there is nothing to consider */ goto CLOSE_TAB; @@ -596,9 +596,9 @@ g_free(ret_page); CLOSE_TAB: - priv->view_hist = g_list_remove(priv->view_hist, embed); + priv->view_hist = g_list_remove(priv->view_hist, web); node = g_node_find(priv->tab_tree, - G_IN_ORDER, G_TRAVERSE_ALL, embed); + G_IN_ORDER, G_TRAVERSE_ALL, web); if (node) { /* move children */ @@ -613,7 +613,7 @@ g_node_destroy(node); } - gtk_widget_destroy(gtk_widget_get_parent(GTK_WIDGET(embed))); + gtk_widget_destroy(gtk_widget_get_parent(GTK_WIDGET(web))); if (kz && gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)) == 0) { @@ -636,13 +636,13 @@ for (i = num - 1; i >= 0; i--) { - KzEmbed *embed = kz_notebook_get_nth_embed(notebook, i); + KzWeb *web = kz_notebook_get_nth_web(notebook, i); if (i == pos) continue; if (i > pos && condition == KZ_NOTEBOOK_CLOSE_BACKWARD) continue; if (i < pos && condition == KZ_NOTEBOOK_CLOSE_FORWARD) continue; - kz_notebook_close_tab(notebook, embed); + kz_notebook_close_tab(notebook, web); } return TRUE; } @@ -670,7 +670,7 @@ /* create new tab label */ dest_priv = KZ_NOTEBOOK_GET_PRIVATE(dest_notebook); - new_kztab = KZ_TAB_LABEL(kz_tab_label_new(dest_priv->kz, KZ_EMBED(widget))); + new_kztab = KZ_TAB_LABEL(kz_tab_label_new(dest_priv->kz, KZ_WEB(widget))); /* move the page to this window */ g_object_ref(widget); @@ -785,8 +785,8 @@ return FALSE; } -KzEmbed * -kz_notebook_get_nth_embed (KzNotebook *notebook, gint page_num) +KzWeb * +kz_notebook_get_nth_web (KzNotebook *notebook, gint page_num) { GtkWidget *widget; @@ -794,15 +794,15 @@ widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num); - return widget ? KZ_EMBED(gtk_bin_get_child(GTK_BIN(widget))) : NULL; + return widget ? KZ_WEB(gtk_bin_get_child(GTK_BIN(widget))) : NULL; } KzTabLabel * -kz_notebook_get_tab_label (KzNotebook *notebook, KzEmbed *embed) +kz_notebook_get_tab_label (KzNotebook *notebook, KzWeb *web) { GtkWidget *widget; - widget = gtk_widget_get_parent(GTK_WIDGET(embed)); + widget = gtk_widget_get_parent(GTK_WIDGET(web)); return widget ? KZ_TAB_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), widget)) : NULL; } @@ -853,42 +853,42 @@ return gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); } -KzEmbed * -kz_notebook_get_sibling_embed (KzNotebook *notebook, KzEmbed *embed) +KzWeb * +kz_notebook_get_sibling_web (KzNotebook *notebook, KzWeb *web) { gint pos; - GtkWidget *sibembed; + GtkWidget *sibweb; g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), NULL); - g_return_val_if_fail(KZ_IS_EMBED(embed), NULL); + g_return_val_if_fail(KZ_IS_WEB(web), NULL); - pos = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), GTK_WIDGET(embed)); + pos = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), GTK_WIDGET(web)); if (pos < 0) return NULL; pos++; if (pos >= gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook))) return NULL; - sibembed = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), pos); + sibweb = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), pos); - return sibembed ? KZ_EMBED(sibembed) : NULL; + return sibweb ? KZ_WEB(sibweb) : NULL; } KzTabLabel * kz_notebook_get_sibling_tab_label (KzNotebook *notebook, KzTabLabel *label) { - KzEmbed *sibembed; + KzWeb *sibweb; KzTabLabel *kztab; g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), NULL); g_return_val_if_fail(KZ_IS_TAB_LABEL(label), NULL); - g_return_val_if_fail(KZ_IS_EMBED(label->kzembed), NULL); + g_return_val_if_fail(KZ_IS_WEB(label->kzweb), NULL); - sibembed = kz_notebook_get_sibling_embed(notebook, label->kzembed); - if (!sibembed) + sibweb = kz_notebook_get_sibling_web(notebook, label->kzweb); + if (!sibweb) return NULL; - kztab = kz_notebook_get_tab_label(notebook, sibembed); + kztab = kz_notebook_get_tab_label(notebook, sibweb); return kztab; } @@ -898,10 +898,10 @@ return KZ_NOTEBOOK_GET_PRIVATE(notebook)->dragged_page; } -KzEmbed * -kz_notebook_get_dragged_embed (KzNotebook *notebook) +KzWeb * +kz_notebook_get_dragged_web (KzNotebook *notebook) { - return KZ_EMBED(KZ_NOTEBOOK_GET_PRIVATE(notebook)->dragged_page); + return KZ_WEB(KZ_NOTEBOOK_GET_PRIVATE(notebook)->dragged_page); } GNode * @@ -911,7 +911,7 @@ } void -kz_notebook_foreach_embed (KzNotebook *notebook, +kz_notebook_foreach_web (KzNotebook *notebook, GFunc func, gpointer user_data) { @@ -924,11 +924,11 @@ for (node = pages; node; node = g_list_next(node)) { GtkWidget *bin = node->data; - GtkWidget *embed; - embed = gtk_bin_get_child(GTK_BIN(bin)); - if (!embed) + GtkWidget *web; + web = gtk_bin_get_child(GTK_BIN(bin)); + if (!web) continue; - func(embed, user_data); + func(web, user_data); } g_list_free(pages); } Modified: kazehakase/trunk/src/kz-notebook.h =================================================================== --- kazehakase/trunk/src/kz-notebook.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-notebook.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -4,7 +4,7 @@ #define __KZ_NOTEBOOK_H__ #include "kz-tab-label.h" -#include "kz-embed.h" +#include "kz-web.h" G_BEGIN_DECLS @@ -37,22 +37,22 @@ GType kz_notebook_get_type (void) G_GNUC_CONST; GtkWidget *kz_notebook_new (KzWindow *kz); gint kz_notebook_open_new_tab (KzNotebook *notebook, - KzEmbed *embed, + KzWeb *web, KzTabLabel *label); gint kz_notebook_open_new_tab_with_parent (KzNotebook *notebook, - KzEmbed *embed, + KzWeb *web, KzTabLabel *label, - KzEmbed *parent); + KzWeb *parent); gint kz_notebook_open_new_tab_at_pos (KzNotebook *notebook, - KzEmbed *embed, + KzWeb *web, KzTabLabel *label, gint pos); gint kz_notebook_prepend_new_tab (KzNotebook *notebook, - KzEmbed *embed, + KzWeb *web, KzTabLabel *label); gboolean kz_notebook_close_tab (KzNotebook *notebook, - KzEmbed *embed); + KzWeb *web); gboolean kz_notebook_close_tabs (KzNotebook *notebook, KzNotebookCloseCondition condition, gint pos); @@ -65,10 +65,10 @@ gboolean kz_notebook_scroll_tab (KzNotebook *notebook, GdkScrollDirection direction); KzTabLabel *kz_notebook_get_tab_label (KzNotebook *notebook, - KzEmbed *embed); + KzWeb *web); KzTabLabel *kz_notebook_get_nth_tab_label (KzNotebook *notebook, gint page_num); -KzEmbed *kz_notebook_get_nth_embed (KzNotebook *notebook, +KzWeb *kz_notebook_get_nth_web (KzNotebook *notebook, gint page_num); gint kz_notebook_page_num (KzNotebook *notebook, GtkWidget *child); @@ -76,14 +76,14 @@ void kz_notebook_set_current_page (KzNotebook *notebook, gint page_num); gint kz_notebook_get_n_pages (KzNotebook *notebook); -KzEmbed *kz_notebook_get_sibling_embed (KzNotebook *notebook, - KzEmbed *embed); +KzWeb *kz_notebook_get_sibling_web (KzNotebook *notebook, + KzWeb *web); KzTabLabel *kz_notebook_get_sibling_tab_label (KzNotebook *notebook, KzTabLabel *label); GtkWidget *kz_notebook_get_dragged_page (KzNotebook *notebook); -KzEmbed *kz_notebook_get_dragged_embed (KzNotebook *notebook); +KzWeb *kz_notebook_get_dragged_web (KzNotebook *notebook); GNode *kz_notebook_get_tree (KzNotebook *notebook); -void kz_notebook_foreach_embed (KzNotebook *notebook, +void kz_notebook_foreach_web (KzNotebook *notebook, GFunc func, gpointer user_data); Added: kazehakase/trunk/src/kz-site.c =================================================================== --- kazehakase/trunk/src/kz-site.c (rev 0) +++ kazehakase/trunk/src/kz-site.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -0,0 +1,55 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + * Copyright (C) 2009 Hiroyuki Ikezoe + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "kz-site.h" + +KzSite * +kz_site_new (const gchar *title, const gchar *uri) +{ + KzSite *site; + + site = g_new0(KzSite, 1); + site->title = g_strdup(title); + site->uri = g_strdup(uri); + return site; +} + +void +kz_site_free (KzSite *site) +{ + if (!site) + return; + g_free(site->title); + g_free(site->uri); + g_free(site); +} + +void +kz_site_list_free (GList *list) +{ + if (!list) + return; + g_list_foreach(list, (GFunc)kz_site_free, NULL); + g_list_free(list); +} + +/* +vi:ts=4:nowrap:ai:expandtab:sw=4 +*/ Added: kazehakase/trunk/src/kz-site.h =================================================================== --- kazehakase/trunk/src/kz-site.h (rev 0) +++ kazehakase/trunk/src/kz-site.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -0,0 +1,45 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + * Copyright (C) 2009 Hiroyuki Ikezoe + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __KZ_SITE_H__ +#define __KZ_SITE_H__ + +#include <glib.h> + +G_BEGIN_DECLS + +typedef struct _KzSite KzSite; +struct _KzSite { + gchar *uri; + gchar *title; +}; + +KzSite *kz_site_new (const gchar *title, + const gchar *uri); +void kz_site_free (KzSite *site); +void kz_site_list_free (GList *list); + + +G_END_DECLS + +#endif /* __KZ_SITE_H__ */ +/* +vi:ts=4:nowrap:ai:expandtab:sw=4 +*/ Modified: kazehakase/trunk/src/kz-statusbar.c =================================================================== --- kazehakase/trunk/src/kz-statusbar.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-statusbar.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -414,14 +414,14 @@ cb_find_keyword (GtkWidget *widget, KzStatusbar *bar) { KzStatusbarPrivate *priv = KZ_STATUSBAR_GET_PRIVATE (bar); - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(priv->kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(priv->kz); GtkToggleButton *toggle = GTK_TOGGLE_BUTTON(priv->find_direction); const gchar *text = gtk_entry_get_text(GTK_ENTRY(widget)); gboolean back = gtk_toggle_button_get_active(toggle); gint x, y; GdkModifierType modifier; - if (!embed) return; + if (!web) return; if (!text || !(*text)) { @@ -432,7 +432,7 @@ gdk_window_get_pointer(NULL, &x, &y, &modifier); if (modifier & GDK_SHIFT_MASK) back = !back; - priv->did_find = kz_embed_find(embed, text, back); + priv->did_find = kz_web_find(web, text, back); if(priv->did_find) search_found(widget, bar); else @@ -457,15 +457,15 @@ static void cb_find_changed (GtkWidget *widget, KzStatusbar *bar) { - KzEmbed *embed; + KzWeb *web; GtkToggleButton *toggle; const gchar *text; KzStatusbarPrivate *priv; gboolean back; priv = KZ_STATUSBAR_GET_PRIVATE(bar); - embed = KZ_WINDOW_CURRENT_EMBED(priv->kz); - if (!embed) return; + web = KZ_WINDOW_CURRENT_WEB(priv->kz); + if (!web) return; toggle = GTK_TOGGLE_BUTTON(priv->find_direction); text = gtk_entry_get_text(GTK_ENTRY(widget)); @@ -476,7 +476,7 @@ } back = gtk_toggle_button_get_active(toggle); - priv->did_find = kz_embed_incremental_search(embed, text, back); + priv->did_find = kz_web_incremental_search(web, text, back); if(priv->did_find) search_found(widget, bar); Modified: kazehakase/trunk/src/kz-tab-label.c =================================================================== --- kazehakase/trunk/src/kz-tab-label.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-tab-label.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -38,7 +38,7 @@ enum { PROP_0, PROP_KZ_WINDOW, - PROP_KZ_EMBED + PROP_KZ_WEB }; @@ -112,12 +112,12 @@ const gchar *old_value, KzTabLabel *kztab); -/* callbacks for embed */ -static void cb_title_changed (KzEmbed *embed, const gchar *title, KzTabLabel *kztab); -static void cb_location_changed (KzEmbed *embed, const gchar *location, KzTabLabel *kztab); -static void cb_net_start (KzEmbed *embed, KzTabLabel *kztab); -static void cb_net_stop (KzEmbed *embed, KzTabLabel *kztab); -static void cb_progress (KzEmbed *embed, gdouble ratio, KzTabLabel *kztab); +/* callbacks for web */ +static void cb_title_changed (KzWeb *web, const gchar *title, KzTabLabel *kztab); +static void cb_location_changed (KzWeb *web, const gchar *location, KzTabLabel *kztab); +static void cb_net_start (KzWeb *web, KzTabLabel *kztab); +static void cb_net_stop (KzWeb *web, KzTabLabel *kztab); +static void cb_progress (KzWeb *web, gdouble ratio, KzTabLabel *kztab); static void make_progress_circle (GtkWidget *widget); @@ -176,11 +176,11 @@ g_object_class_install_property (gobject_class, - PROP_KZ_EMBED, - g_param_spec_object ("kz-embed", - _("KzEmbed"), - _("The KzEmbed object to observe"), - KZ_TYPE_EMBED, + PROP_KZ_WEB, + g_param_spec_object ("kz-web", + _("KzWeb"), + _("The KzWeb object to observe"), + KZ_TYPE_WEB, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_type_class_add_private (gobject_class, sizeof(KzTabLabelPrivate)); @@ -195,7 +195,7 @@ KzTabLabelPrivate *priv = KZ_TAB_LABEL_GET_PRIVATE (kztab); kztab->kz = NULL; - kztab->kzembed = NULL; + kztab->kzweb = NULL; kztab->state = KZ_TAB_LABEL_STATE_NORMAL; kztab->favicon = gtk_image_new(); kztab->eventbox = gtk_event_box_new(); @@ -291,32 +291,32 @@ } static void -connect_embed_signals (KzTabLabel *kztab) +connect_web_signals (KzTabLabel *kztab) { - g_signal_connect(kztab->kzembed, "kz-title", + g_signal_connect(kztab->kzweb, "kz-title", G_CALLBACK(cb_title_changed), kztab); - g_signal_connect(kztab->kzembed, "kz-location", + g_signal_connect(kztab->kzweb, "kz-location", G_CALLBACK(cb_location_changed), kztab); - g_signal_connect(kztab->kzembed, "kz-net-start", + g_signal_connect(kztab->kzweb, "kz-net-start", G_CALLBACK(cb_net_start), kztab); - g_signal_connect(kztab->kzembed, "kz-net-stop", + g_signal_connect(kztab->kzweb, "kz-net-stop", G_CALLBACK(cb_net_stop), kztab); - g_signal_connect(kztab->kzembed, "kz-progress", + g_signal_connect(kztab->kzweb, "kz-progress", G_CALLBACK(cb_progress), kztab); } static void -disconnect_embed_signals (KzTabLabel *kztab) +disconnect_web_signals (KzTabLabel *kztab) { - g_signal_handlers_disconnect_by_func(kztab->kzembed, + g_signal_handlers_disconnect_by_func(kztab->kzweb, cb_net_start, kztab); - g_signal_handlers_disconnect_by_func(kztab->kzembed, + g_signal_handlers_disconnect_by_func(kztab->kzweb, cb_net_stop, kztab); - g_signal_handlers_disconnect_by_func(kztab->kzembed, + g_signal_handlers_disconnect_by_func(kztab->kzweb, cb_title_changed, kztab); - g_signal_handlers_disconnect_by_func(kztab->kzembed, + g_signal_handlers_disconnect_by_func(kztab->kzweb, cb_location_changed, kztab); - g_signal_handlers_disconnect_by_func(kztab->kzembed, + g_signal_handlers_disconnect_by_func(kztab->kzweb, cb_progress, kztab); } @@ -334,10 +334,10 @@ kztab = KZ_TAB_LABEL(object); - connect_embed_signals(kztab); + connect_web_signals(kztab); /* set label text */ - title = kz_embed_ensure_title(kztab->kzembed); + title = kz_web_ensure_title(kztab->kzweb); kz_tab_label_set_text(kztab, title); g_free(title); @@ -360,8 +360,8 @@ g_signal_handlers_disconnect_by_func(KZ_GET_GLOBAL_PROFILE, G_CALLBACK(cb_global_profile_changed), kztab); - if (kztab->kzembed) - kz_tab_label_set_embed(kztab, NULL); + if (kztab->kzweb) + kz_tab_label_set_web(kztab, NULL); if (kztab->history) { @@ -407,8 +407,8 @@ case PROP_KZ_WINDOW: tablabel->kz = g_object_ref(g_value_get_object(value)); break; - case PROP_KZ_EMBED: - kz_tab_label_set_embed(tablabel, g_value_get_object(value)); + case PROP_KZ_WEB: + kz_tab_label_set_web(tablabel, g_value_get_object(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -430,8 +430,8 @@ case PROP_KZ_WINDOW: g_value_set_object(value, tablabel->kz); break; - case PROP_KZ_EMBED: - g_value_set_object(value, tablabel->kzembed); + case PROP_KZ_WEB: + g_value_set_object(value, tablabel->kzweb); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -441,16 +441,16 @@ GtkWidget * -kz_tab_label_new (KzWindow *kz, KzEmbed *kzembed) +kz_tab_label_new (KzWindow *kz, KzWeb *kzweb) { KzTabLabel *kztab; g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); - g_return_val_if_fail(KZ_IS_EMBED(kzembed), NULL); + g_return_val_if_fail(KZ_IS_WEB(kzweb), NULL); kztab = g_object_new(KZ_TYPE_TAB_LABEL, "kz-window", kz, - "kz-embed", kzembed, + "kz-web", kzweb, NULL); return GTK_WIDGET(kztab); @@ -480,7 +480,7 @@ idle_create_thumbnail (gpointer data) { KzTabLabel *kztab; - KzEmbed *embed; + KzWeb *web; EggPixbufThumbnailSize size = EGG_PIXBUF_THUMBNAIL_LARGE; const gchar *uri; guint last_modified; @@ -488,15 +488,15 @@ kztab = data; g_return_val_if_fail(KZ_IS_TAB_LABEL(kztab), FALSE); - embed = kztab->kzembed; - uri = kz_embed_get_location(embed); + web = kztab->kzweb; + uri = kz_web_get_location(web); if (!uri) return FALSE; if (uri[0] == '\0') return FALSE; - last_modified = kz_embed_get_last_modified(embed); + last_modified = kz_web_get_last_modified(web); if (last_modified > 0) { GTime thumbnail_last_modified; @@ -506,7 +506,7 @@ return FALSE; } - kz_embed_create_thumbnail(embed, size); + kz_web_create_thumbnail(web, size); return FALSE; } @@ -535,7 +535,7 @@ kz_tab_label_set_visited(kztab); } - title = kz_embed_ensure_title(kztab->kzembed); + title = kz_web_ensure_title(kztab->kzweb); kz_tab_label_set_text(kztab, title); g_free(title); } @@ -596,10 +596,10 @@ make_progress_circle(widget); - if (kz_embed_is_loading(kztab->kzembed)) + if (kz_web_is_loading(kztab->kzweb)) kz_tab_label_set_state (kztab, KZ_TAB_LABEL_STATE_LOADING); - priv->javascript = kz_embed_get_allow_javascript(kztab->kzembed); + priv->javascript = kz_web_get_allow_javascript(kztab->kzweb); } static gboolean @@ -622,14 +622,14 @@ #endif if (event->button == 2) { - kz_window_close_tab(kztab->kz, kztab->kzembed); + kz_window_close_tab(kztab->kz, kztab->kzweb); } if (event->type == GDK_2BUTTON_PRESS) { - kz_embed_reload(kztab->kzembed, + kz_web_reload(kztab->kzweb, (event->state & GDK_SHIFT_MASK) ? - KZ_EMBED_RELOAD_BYPASS_PROXY_AND_CACHE : - KZ_EMBED_RELOAD_NORMAL); + KZ_WEB_RELOAD_BYPASS_PROXY_AND_CACHE : + KZ_WEB_RELOAD_NORMAL); } if (GTK_WIDGET_CLASS(kz_tab_label_parent_class)->button_press_event) GTK_WIDGET_CLASS(kz_tab_label_parent_class)->button_press_event(widget, event); @@ -694,7 +694,7 @@ kztab = KZ_TAB_LABEL(widget); - g_return_if_fail (KZ_IS_EMBED(kztab->kzembed)); + g_return_if_fail (KZ_IS_WEB(kztab->kzweb)); switch (info) { @@ -708,8 +708,7 @@ if (data->length < 0) return; strings = g_strsplit((const gchar*)data->data, "\n", 2); - kz_embed_load_url(kztab->kzembed, - strings[0]); + kz_web_load_uri(kztab->kzweb, strings[0]); g_strfreev(strings); break; } @@ -822,7 +821,7 @@ cb_close_button_clicked (GtkWidget *button, KzTabLabel *kztab) { g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kz_window_close_tab(kztab->kz, kztab->kzembed); + kz_window_close_tab(kztab->kz, kztab->kzweb); } static void @@ -862,10 +861,10 @@ } } -/* callbacks for embed */ +/* callbacks for web */ static void -cb_title_changed (KzEmbed *embed, const gchar *title, KzTabLabel *kztab) +cb_title_changed (KzWeb *web, const gchar *title, KzTabLabel *kztab) { g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); @@ -873,7 +872,7 @@ } static void -cb_location_changed (KzEmbed *embed, const gchar *location, KzTabLabel *kztab) +cb_location_changed (KzWeb *web, const gchar *location, KzTabLabel *kztab) { KzBookmark *bookmark; @@ -885,7 +884,7 @@ } static void -cb_net_start (KzEmbed *embed, KzTabLabel *kztab) +cb_net_start (KzWeb *web, KzTabLabel *kztab) { g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); @@ -898,7 +897,7 @@ } static void -cb_net_stop (KzEmbed *embed, KzTabLabel *kztab) +cb_net_stop (KzWeb *web, KzTabLabel *kztab) { KzNotebook *note; KzTabLabelPrivate *priv = KZ_TAB_LABEL_GET_PRIVATE(kztab); @@ -907,12 +906,12 @@ g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); - kz_embed_get_history(KZ_EMBED(embed), &history, ¤t_position); + kz_web_get_history(KZ_WEB(web), &history, ¤t_position); kz_utils_site_list_to_bookmark_folder(history, current_position, kztab->history); kz_site_list_free(history); note = KZ_NOTEBOOK(kztab->kz->notebook); - if(kz_notebook_page_num(note, GTK_WIDGET(embed)) == + if(kz_notebook_page_num(note, GTK_WIDGET(web)) == kz_notebook_get_current_page(KZ_NOTEBOOK(note))) { kz_tab_label_set_state(kztab, KZ_TAB_LABEL_STATE_NORMAL); @@ -925,7 +924,7 @@ bookmark = kz_bookmark_folder_get_current_bookmark(kztab->history); if (bookmark) last_visited = kz_bookmark_get_last_visited(bookmark); - last_modified = kz_embed_get_last_modified(embed); + last_modified = kz_web_get_last_modified(web); if (last_modified != 0 && last_visited > last_modified) kz_tab_label_set_state(kztab, KZ_TAB_LABEL_STATE_NORMAL); @@ -938,7 +937,7 @@ const gchar *uri; GdkPixbuf *favicon_pixbuf; - uri = kz_embed_get_location(KZ_EMBED(kztab->kzembed)); + uri = kz_web_get_location(KZ_WEB(kztab->kzweb)); favicon_pixbuf = kz_favicon_get_pixbuf(KZ_GET_FAVICON, uri, GTK_ICON_SIZE_MENU); gtk_image_set_from_pixbuf(GTK_IMAGE(kztab->favicon), @@ -951,7 +950,7 @@ static void -cb_progress (KzEmbed *embed, gdouble ratio, KzTabLabel *kztab) +cb_progress (KzWeb *web, gdouble ratio, KzTabLabel *kztab) { GtkWidget *widget; GdkGC *gc; @@ -1021,8 +1020,8 @@ g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); priv = KZ_TAB_LABEL_GET_PRIVATE (kztab); priv->lock = lock; - kz_embed_set_lock(kztab->kzembed, lock); - kz_actions_set_sensitive(kztab->kz, kztab->kzembed); + kz_web_set_lock(kztab->kzweb, lock); + kz_actions_set_sensitive(kztab->kz, kztab->kzweb); kz_bookmark_folder_set_lock(kztab->history, lock); kz_tab_label_sync_to_profile(kztab); @@ -1047,8 +1046,8 @@ g_return_if_fail(KZ_IS_TAB_LABEL(kztab)); priv = KZ_TAB_LABEL_GET_PRIVATE (kztab); priv->javascript = javascript; - kz_embed_set_allow_javascript(kztab->kzembed, javascript); - kz_actions_set_tab_sensitive(kztab->kz, kztab->kzembed); + kz_web_set_allow_javascript(kztab->kzweb, javascript); + kz_actions_set_tab_sensitive(kztab->kz, kztab->kzweb); kz_bookmark_folder_set_javascript(kztab->history, javascript); kz_tab_label_sync_to_profile(kztab); @@ -1065,8 +1064,8 @@ priv = KZ_TAB_LABEL_GET_PRIVATE (kztab); KZ_CONF_GET("Tab", "auto_refresh_interval_sec", auto_refresh_interval_sec, INT); - kz_embed_reload(KZ_EMBED(kztab->kzembed), - KZ_EMBED_RELOAD_NORMAL); + kz_web_reload(KZ_WEB(kztab->kzweb), + KZ_WEB_RELOAD_NORMAL); if (priv->auto_refresh_id != 0) g_source_remove(priv->auto_refresh_id); @@ -1115,7 +1114,7 @@ } } priv->auto_refresh = auto_refresh; - kz_actions_set_tab_sensitive(kztab->kz, kztab->kzembed); + kz_actions_set_tab_sensitive(kztab->kz, kztab->kzweb); kz_bookmark_folder_set_auto_refresh(kztab->history, auto_refresh); kz_tab_label_sync_to_profile(kztab); @@ -1140,11 +1139,11 @@ kz_tab_label_set_auto_refresh(kztab, TRUE); allow_javacript = kz_bookmark_folder_get_javascript(history); - kz_embed_set_allow_javascript(KZ_EMBED(kztab->kzembed), allow_javacript); + kz_web_set_allow_javascript(KZ_WEB(kztab->kzweb), allow_javacript); kz_tab_label_set_javascript(kztab, allow_javacript); kz_utils_bookmark_folder_to_site_list(history, &site_list, ¤t_position); - kz_embed_set_history(kztab->kzembed, site_list, current_position); + kz_web_set_history(kztab->kzweb, site_list, current_position); kz_site_list_free(site_list); } static void @@ -1161,7 +1160,7 @@ kz_bookmark_set_last_visited(bookmark, now.tv_sec); /* find the bookmark which has the same uri from the system bookmark */ - uri = kz_embed_get_location(kztab->kzembed); + uri = kz_web_get_location(kztab->kzweb); bookmark = kz_bookmark_folder_find_bookmark_from_uri(KZ_BOOKMARK_FOLDER(KZ_GET_MENU_BOOKMARK), uri); if (bookmark) @@ -1169,19 +1168,19 @@ } void -kz_tab_label_set_embed (KzTabLabel *kztab, KzEmbed *kzembed) +kz_tab_label_set_web (KzTabLabel *kztab, KzWeb *kzweb) { - if (kztab->kzembed) + if (kztab->kzweb) { - disconnect_embed_signals(kztab); - g_object_unref(kztab->kzembed); - kztab->kzembed = NULL; + disconnect_web_signals(kztab); + g_object_unref(kztab->kzweb); + kztab->kzweb = NULL; } - if (kzembed) + if (kzweb) { - kztab->kzembed = g_object_ref(kzembed); - connect_embed_signals(kztab); + kztab->kzweb = g_object_ref(kzweb); + connect_web_signals(kztab); } } Modified: kazehakase/trunk/src/kz-tab-label.h =================================================================== --- kazehakase/trunk/src/kz-tab-label.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-tab-label.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -24,7 +24,7 @@ #include <gtk/gtk.h> #include "kz-objects.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-bookmark-folder.h" G_BEGIN_DECLS @@ -51,7 +51,7 @@ GtkHBox parent; KzWindow *kz; - KzEmbed *kzembed; + KzWeb *kzweb; KzTabLabelState state; @@ -73,7 +73,7 @@ GType kz_tab_label_get_type (void) G_GNUC_CONST; GtkWidget *kz_tab_label_new (KzWindow *kz, - KzEmbed *kzembed); + KzWeb *kzweb); void kz_tab_label_set_text (KzTabLabel *kztab, const gchar *text); @@ -102,8 +102,8 @@ void kz_tab_label_set_history (KzTabLabel *kztab, KzBookmarkFolder *history); -void kz_tab_label_set_embed (KzTabLabel *kztab, - KzEmbed *kzembed); +void kz_tab_label_set_web (KzTabLabel *kztab, + KzWeb *kzweb); G_END_DECLS #endif /* __KZ_TAB_LABEL_H__ */ Added: kazehakase/trunk/src/kz-web.c =================================================================== --- kazehakase/trunk/src/kz-web.c (rev 0) +++ kazehakase/trunk/src/kz-web.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -0,0 +1,1154 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + * Copyright (C) 2009 Hiroyuki Ikezoe + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "kz-web.h" + +#include <glib/gi18n.h> +#include "kz-bookmark-folder.h" +#include "kz-embed.h" +#include "kz-marshalers.h" +#include "utils.h" + +enum { + PROP_0, + PROP_MODULE_NAME, + PROP_ENGINE_NAME, + PROP_EMBED, + PROP_LOCK +}; + +enum { + LINK_MESSAGE, + JS_STATUS, + LOCATION, + TITLE, + PROGRESS, + NET_START, + NET_STOP, + NEW_WINDOW, + OPEN_URI, + SIZE_TO, + DOM_KEY_DOWN, + DOM_KEY_PRESS, + DOM_KEY_UP, + DOM_MOUSE_DOWN, + DOM_MOUSE_UP, + DOM_MOUSE_CLICK, + DOM_MOUSE_DOUBLE_CLICK, + DOM_MOUSE_OVER, + DOM_MOUSE_OUT, + SELECTION, + LAST_SIGNAL +}; + +static gint signals[LAST_SIGNAL] = {0}; + +typedef struct _KzWebPrivate KzWebPrivate; +struct _KzWebPrivate +{ + gchar *module_name; + gchar *engine_name; + GtkWidget *embed; + gboolean lock; + gboolean allow_javascript; + gboolean is_loading; + gchar *title; + gchar *location; + gdouble progress_ratio; + KzBookmarkFolder *history; +}; + +#define KZ_WEB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_WEB, KzWebPrivate)) + +G_DEFINE_TYPE(KzWeb, kz_web, GTK_TYPE_BIN); + +static GObject *constructor (GType type, + guint n_props, + GObjectConstructParam *props); +static void dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void size_allocate(GtkWidget *widget, + GtkAllocation *allocation); + + +static void +kz_web_class_init (KzWebClass *klass) +{ + GObjectClass *object_class; + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + + object_class = G_OBJECT_CLASS(klass); + widget_class = GTK_WIDGET_CLASS(klass); + + object_class->constructor = constructor; + object_class->dispose = dispose; + object_class->set_property = set_property; + object_class->get_property = get_property; + + widget_class->size_allocate = size_allocate; + + signals[LINK_MESSAGE] + = g_signal_new ("kz-link-message", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); + + signals[JS_STATUS] + = g_signal_new ("kz-js-status", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[LOCATION] + = g_signal_new ("kz-location", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); + + signals[TITLE] + = g_signal_new ("kz-title", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); + + signals[PROGRESS] + = g_signal_new ("kz-progress", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); + + signals[NET_START] + = g_signal_new ("kz-net-start", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[NET_STOP] + = g_signal_new ("kz-net-stop", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[NEW_WINDOW] + = g_signal_new ("kz-new-window", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); + + signals[OPEN_URI] + = g_signal_new ("kz-open-uri", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_INT__STRING, + G_TYPE_INT, 1, G_TYPE_STRING); + + signals[SIZE_TO] + = g_signal_new ("kz-size-to", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + _kz_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + + signals[DOM_KEY_DOWN] + = g_signal_new ("kz-dom-key-down", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_KEY_PRESS] + = g_signal_new ("kz-dom-key-press", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_KEY_UP] + = g_signal_new ("kz-dom-key-up", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_DOWN] + = g_signal_new ("kz-dom-mouse-down", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_UP] + = g_signal_new ("kz-dom-mouse-up", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_CLICK] + = g_signal_new ("kz-dom-mouse-click", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_DOUBLE_CLICK] + = g_signal_new ("kz-dom-mouse-double-click", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_OVER] + = g_signal_new ("kz-dom-mouse-over", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[DOM_MOUSE_OUT] + = g_signal_new ("kz-dom-mouse-out", + KZ_TYPE_WEB, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + + signals[SELECTION] + = g_signal_new ("kz-selection", + KZ_TYPE_WEB, + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + g_object_class_install_property + (object_class, + PROP_MODULE_NAME, + g_param_spec_string("module-name", + _("Module Name"), + _("Module Name"), + "gecko", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property + (object_class, + PROP_ENGINE_NAME, + g_param_spec_string("engine-name", + _("Engine Name"), + _("Engine Name"), + "gecko", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property + (object_class, + PROP_LOCK, + g_param_spec_boolean("lock", + _("Lock"), + _("Lock"), + FALSE, + G_PARAM_READWRITE)); + + g_type_class_add_private(object_class, sizeof(KzWebPrivate)); +} + +static void +kz_web_init (KzWeb *bin) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(bin); + + priv->embed = NULL; + priv->module_name = NULL; + priv->engine_name = NULL; + priv->lock = FALSE; + priv->is_loading = FALSE; + priv->title = NULL; + priv->location = NULL; + priv->history = KZ_BOOKMARK_FOLDER(kz_bookmark_folder_new(_("Tab"))); +} + +GtkWidget * +kz_web_new (const gchar *module_name, const gchar *engine_name) +{ + return GTK_WIDGET(g_object_new(KZ_TYPE_WEB, + "module-name", module_name, + "engine-name", engine_name, + NULL)); +} + +static void +cb_kz_link_message (KzEmbed *embed, const gchar *message, KzWeb *web) +{ + g_signal_emit(web, signals[LINK_MESSAGE], 0, message); +} + +static void +cb_kz_title (KzEmbed *embed, const gchar *title, KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + g_free(priv->title); + priv->title = g_strdup(title); + + g_signal_emit(web, signals[TITLE], 0, title); +} + +static void +cb_kz_location (KzEmbed *embed, const gchar *location, KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + g_free(priv->location); + priv->location = g_strdup(location); + + g_signal_emit(web, signals[LOCATION], 0, location); +} + +static void +cb_kz_progress (KzEmbed *embed, gdouble ratio, KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + priv->progress_ratio = ratio; + + g_signal_emit(web, signals[PROGRESS], 0, ratio); +} + +static void +cb_kz_net_start (KzEmbed *embed, KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + priv->is_loading = TRUE; + priv->progress_ratio = 0.0; + g_signal_emit(web, signals[NET_START], 0); +} + +static void +cb_kz_net_stop (KzEmbed *embed, KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + GList *history = NULL; + guint current_position = 0; + + priv->is_loading = FALSE; + priv->progress_ratio = 1.0; + + kz_embed_get_history(KZ_EMBED(priv->embed), &history, ¤t_position); + kz_utils_site_list_to_bookmark_folder(history, current_position, priv->history); + kz_site_list_free(history); + + g_signal_emit(web, signals[NET_STOP], 0); +} + +static gboolean +cb_kz_dom_mouse_up (KzEmbed *embed, KzEmbedEventMouse *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_MOUSE_UP], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_mouse_down (KzEmbed *embed, KzEmbedEventMouse *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_MOUSE_DOWN], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_mouse_click (KzEmbed *embed, KzEmbedEventMouse *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_MOUSE_CLICK], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_mouse_over (KzEmbed *embed, KzEmbedEventMouse *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_MOUSE_OVER], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_key_up (KzEmbed *embed, KzEmbedEventKey *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_KEY_UP], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_key_down (KzEmbed *embed, KzEmbedEventKey *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_KEY_DOWN], 0, event, &ret); + return ret; +} + +static gboolean +cb_kz_dom_key_press (KzEmbed *embed, KzEmbedEventKey *event, KzWeb *web) +{ + gboolean ret = FALSE; + g_signal_emit(web, signals[DOM_KEY_PRESS], 0, event, &ret); + return ret; +} + +static void +cb_kz_new_window (KzEmbed *embed, KzEmbed **newembed, KzWeb *web) +{ + g_signal_emit(web, signals[NEW_WINDOW], 0, newembed); +} + +static void +connect_embed_signals (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + +#define CONNECT(name) \ + g_signal_connect(priv->embed, #name, \ + G_CALLBACK(cb_ ## name), web) + CONNECT(kz_net_start); + CONNECT(kz_net_stop); + CONNECT(kz_title); + CONNECT(kz_location); + CONNECT(kz_progress); + CONNECT(kz_link_message); + CONNECT(kz_dom_mouse_up); + CONNECT(kz_dom_mouse_down); + CONNECT(kz_dom_mouse_click); + CONNECT(kz_dom_mouse_over); + CONNECT(kz_dom_key_up); + CONNECT(kz_dom_key_down); + CONNECT(kz_dom_key_press); + CONNECT(kz_new_window); +#undef CONNECT +} + +static void +disconnect_embed_signals (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + +#define DISCONNECT(name) \ + g_signal_handlers_disconnect_by_func(priv->embed, \ + G_CALLBACK(cb_ ## name), \ + web) + DISCONNECT(kz_net_start); + DISCONNECT(kz_net_stop); + DISCONNECT(kz_title); + DISCONNECT(kz_location); + DISCONNECT(kz_progress); + DISCONNECT(kz_link_message); + DISCONNECT(kz_dom_mouse_up); + DISCONNECT(kz_dom_mouse_down); + DISCONNECT(kz_dom_mouse_click); + DISCONNECT(kz_dom_mouse_over); + DISCONNECT(kz_dom_key_up); + DISCONNECT(kz_dom_key_down); + DISCONNECT(kz_dom_key_press); + DISCONNECT(kz_new_window); +#undef CONNECT +} + +static void +kz_web_set_embed (KzWeb *web, GtkWidget *embed) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + if (priv->embed) { + disconnect_embed_signals(web); + kz_embed_copy_page(KZ_EMBED(priv->embed), KZ_EMBED(embed)); + gtk_container_remove(GTK_CONTAINER(web), priv->embed); + } + priv->embed = embed; + if (embed) { + connect_embed_signals(web); + gtk_container_add(GTK_CONTAINER(web), embed); + gtk_widget_show(embed); + } +} + +static GObject* +constructor (GType type, + guint n_props, + GObjectConstructParam *props) +{ + GObject *object; + GObjectClass *klass = G_OBJECT_CLASS(kz_web_parent_class); + KzWebPrivate *priv; + + object = klass->constructor(type, n_props, props); + priv = KZ_WEB_GET_PRIVATE(object); + kz_web_set_embed(KZ_WEB(object), kz_embed_new(priv->module_name)); + + return object; +} + +static void +dispose (GObject *object) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(object); + + if (priv->history) { + g_object_unref(priv->history); + priv->history = NULL; + } + g_free(priv->module_name); + g_free(priv->engine_name); + g_free(priv->title); + g_free(priv->location); + priv->module_name = NULL; + priv->engine_name = NULL; + priv->title = NULL; + priv->location = NULL; +} + +static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(object); + + switch (prop_id) + { + case PROP_MODULE_NAME: + priv->module_name = g_value_dup_string(value); + break; + case PROP_ENGINE_NAME: + priv->engine_name = g_value_dup_string(value); + break; + case PROP_LOCK: + priv->lock = g_value_get_boolean(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(object); + + switch (prop_id) + { + case PROP_MODULE_NAME: + g_value_set_string(value, priv->module_name); + break; + case PROP_ENGINE_NAME: + g_value_set_string(value, priv->engine_name); + break; + case PROP_LOCK: + g_value_set_boolean(value, priv->lock); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +size_allocate (GtkWidget *widget, GtkAllocation *allocation) +{ + GtkWidget *child; + GtkAllocation child_allocation; + + widget->allocation = *allocation; + + if (GTK_WIDGET_NO_WINDOW(widget)) + { + child_allocation.x = allocation->x + GTK_CONTAINER(widget)->border_width; + child_allocation.y = allocation->y + GTK_CONTAINER(widget)->border_width; + } + else + { + child_allocation.x = 0; + child_allocation.y = 0; + } + + child_allocation.width = MAX(allocation->width - GTK_CONTAINER(widget)->border_width * 2, 0); + child_allocation.height = MAX(allocation->height - GTK_CONTAINER(widget)->border_width * 2, 0); + + child = gtk_bin_get_child(GTK_BIN(widget)); + if (child) + gtk_widget_size_allocate(child, &child_allocation); + +} + +void +kz_web_load_uri (KzWeb *bin, const gchar *uri) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(bin); + + kz_embed_load_uri(KZ_EMBED(priv->embed), uri); +} + +void +kz_web_change_engine (KzWeb *web, const gchar *new_engine_name) +{ + GtkWidget *new_embed; + + new_embed = kz_embed_new(new_engine_name); + kz_web_set_embed(web, new_embed); +} + +const gchar * +kz_web_get_title (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->title; +} + +const gchar * +kz_web_get_location (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->location; +} + +gdouble +kz_web_get_progress (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->progress_ratio; +} + +gboolean +kz_web_is_loading (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->is_loading; +} + +gboolean +kz_web_get_lock (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->lock; +} + +void +kz_web_set_lock (KzWeb *web, gboolean lock) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + priv->lock = lock; + kz_bookmark_folder_set_lock(priv->history, lock); +} + +gboolean +kz_web_get_allow_javascript (KzWeb *web) +{ + return KZ_WEB_GET_PRIVATE(web)->allow_javascript; +} + +void +kz_web_set_allow_javascript (KzWeb *web, gboolean allow) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + priv->allow_javascript = allow; + kz_bookmark_folder_set_javascript(priv->history, allow); +} + +gchar * +kz_web_ensure_title (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + if (priv->title) + return g_strdup(priv->title); + + if (priv->location && strlen(priv->location) != 0) + { + if (priv->is_loading) + return g_strdup_printf(_("Loading %s ..."), priv->location); + else + return g_strdup(priv->location); + } + if (priv->is_loading) + return g_strdup(_("Loading...")); + + return g_strdup(_("No title")); +} + +static gchar * +get_up_location (KzWeb *web) +{ + gchar *up_location = NULL; + gchar *pos, *dummy; + int len; + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + if (!priv->location) + return NULL; + + len = strlen(priv->location); + if (priv->location[len - 1] == '/') + dummy = g_strndup(priv->location, len - 1); + else + dummy = g_strndup(priv->location, len); + pos = strrchr(dummy, '/'); + if (pos) + up_location = g_strndup(dummy, pos - dummy + 1); + g_free(dummy); + + return up_location; +} + +void +kz_web_go_up (KzWeb *web) +{ + gchar *location; + + location = get_up_location(web); + kz_web_load_uri(web, location); + g_free(location); +} + +gboolean +kz_web_can_go_up (KzWeb *web) +{ + gboolean ret; + gchar *location; + + location = get_up_location(web); + if (!location) + return FALSE; + + /* stupid! */ + if (strcmp(location, "http://") && + strcmp(location, "https://") && + strcmp(location, "ftp://") && + strcmp(location, "file://")) + ret = TRUE; + else + ret = FALSE; + g_free(location); + + return ret; +} + +#define DEFINE_SIMPLE_METHOD(method) \ +void \ +kz_web_ ## method (KzWeb *web) \ +{ \ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); \ + kz_embed_ ## method (KZ_EMBED(priv->embed)); \ +} + +DEFINE_SIMPLE_METHOD(copy_selection) +DEFINE_SIMPLE_METHOD(cut_selection) +DEFINE_SIMPLE_METHOD(paste) +DEFINE_SIMPLE_METHOD(select_all) +DEFINE_SIMPLE_METHOD(stop_load) +DEFINE_SIMPLE_METHOD(go_back) +DEFINE_SIMPLE_METHOD(go_forward) +DEFINE_SIMPLE_METHOD(print) +DEFINE_SIMPLE_METHOD(print_preview) +DEFINE_SIMPLE_METHOD(page_up) +DEFINE_SIMPLE_METHOD(page_down) +DEFINE_SIMPLE_METHOD(show_page_certificate) + +#define DEFINE_SET_BOOLEAN_VALUE_METHOD(method) \ +void \ +kz_web_set_ ## method (KzWeb *web, gboolean value) \ +{ \ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); \ + kz_embed_set_ ## method (KZ_EMBED(priv->embed), value); \ +} \ + +#define DEFINE_GET_BOOLEAN_VALUE_METHOD(method) \ +gboolean \ +kz_web_ ## method (KzWeb *web) \ +{ \ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); \ + return kz_embed_ ## method (KZ_EMBED(priv->embed)); \ +} + +#define DEFINE_BOOLEAN_METHODS(method) \ + DEFINE_SET_BOOLEAN_VALUE_METHOD(method) \ + DEFINE_GET_BOOLEAN_VALUE_METHOD(get_ ## method) + +DEFINE_GET_BOOLEAN_VALUE_METHOD(can_go_back) +DEFINE_GET_BOOLEAN_VALUE_METHOD(can_go_forward) +DEFINE_GET_BOOLEAN_VALUE_METHOD(can_cut_selection) +DEFINE_GET_BOOLEAN_VALUE_METHOD(can_copy_selection) +DEFINE_GET_BOOLEAN_VALUE_METHOD(can_paste) +DEFINE_GET_BOOLEAN_VALUE_METHOD(selection_is_collapsed) + +DEFINE_BOOLEAN_METHODS(allow_images) + +guint +kz_web_get_last_modified (KzWeb*web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_last_modified(KZ_EMBED(priv->embed)); +} + +gboolean +kz_web_get_links (KzWeb *web, GList **list, gboolean selected_only) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_links(KZ_EMBED(priv->embed), list, selected_only); +} + +gboolean +kz_web_set_text_into_textarea (KzWeb *web, + gpointer element, + const gchar *text) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_set_text_into_textarea(KZ_EMBED(priv->embed), element, text); +} + +gchar * +kz_web_get_text_from_textarea(KzWeb *web, gpointer element) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_text_from_textarea(KZ_EMBED(priv->embed), element); +} + +void +kz_web_set_encoding (KzWeb *web, const gchar *encoding) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_set_encoding(KZ_EMBED(priv->embed), encoding); +} + +void +kz_web_get_encoding (KzWeb *web, gchar **encoding, gboolean *forced) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_get_encoding(KZ_EMBED(priv->embed), encoding, forced); +} + +void +kz_web_create_thumbnail (KzWeb *web, EggPixbufThumbnailSize size) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_create_thumbnail(KZ_EMBED(priv->embed), size); +} + +gboolean +kz_web_save_with_content (KzWeb *web, const char *raw_filename) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_save_with_content(KZ_EMBED(priv->embed), raw_filename); +} + +void +kz_web_zoom (KzWeb *web, gdouble zoom) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_zoom(KZ_EMBED(priv->embed), zoom); +} + +gdouble +kz_web_get_zoom_ratio (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_zoom_ratio(KZ_EMBED(priv->embed)); +} + +void +kz_web_set_text_size (KzWeb *web, gdouble zoom) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_set_text_size(KZ_EMBED(priv->embed), zoom); +} + +gdouble +kz_web_get_text_size (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_text_size(KZ_EMBED(priv->embed)); +} + +gchar * +kz_web_get_html_with_contents(KzWeb *web, const gchar *target_dir) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_html_with_contents(KZ_EMBED(priv->embed), target_dir); +} + +void +kz_web_set_history (KzWeb *web, const GList *history, guint current_position) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_set_history(KZ_EMBED(priv->embed), history, current_position); +} + +void +kz_web_get_history (KzWeb*web, GList **history, guint *current_position) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_get_history(KZ_EMBED(priv->embed), history, current_position); +} + +void +kz_web_fine_scroll (KzWeb*web, gint horiz, gint vert) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_fine_scroll(KZ_EMBED(priv->embed), horiz, vert); +} + +gboolean +kz_web_can_go_nav_link (KzWeb *web, KzWebNavLink link) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_can_go_nav_link(KZ_EMBED(priv->embed), link); +} + +void +kz_web_go_nav_link (KzWeb *web, KzWebNavLink link) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_go_nav_link(KZ_EMBED(priv->embed), link); +} + +void +kz_web_append_nav_link (KzWeb *web, KzWebNavLink link, KzNavi *navi) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_append_nav_link(KZ_EMBED(priv->embed), link, navi); +} + +void +kz_web_set_nav_link (KzWeb *web, KzWebNavLink link, KzNavi *navi) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_set_nav_link(KZ_EMBED(priv->embed), link, navi); +} + +void +kz_web_set_nth_nav_link (KzWeb *web, + KzWebNavLink link, + KzNavi *navi, + guint nth) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_set_nth_nav_link(KZ_EMBED(priv->embed), link, navi, nth); +} + +KzNavi * +kz_web_get_nav_link (KzWeb *web, KzWebNavLink link) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_nav_link(KZ_EMBED(priv->embed), link); +} + +KzNavi * +kz_web_get_nth_nav_link (KzWeb *web, KzWebNavLink link, guint nth) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_nth_nav_link(KZ_EMBED(priv->embed), link, nth); +} + +GList * +kz_web_get_nav_links (KzWeb *web, KzWebNavLink link) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_nav_links(KZ_EMBED(priv->embed), link); +} + +void +kz_web_go_history_index (KzWeb *web, gint index) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_go_history_index(KZ_EMBED(priv->embed), index); +} + +gchar * +kz_web_get_body_text (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_body_text(KZ_EMBED(priv->embed)); +} + +void +kz_web_copy_page (KzWeb *src, KzWeb *dest) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(src); + + kz_embed_copy_page(KZ_EMBED(priv->embed), KZ_EMBED(KZ_WEB_GET_PRIVATE(dest))); +} + +gboolean +kz_web_shistory_get_pos (KzWeb *web, gint *pos, gint *count) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_shistory_get_pos(KZ_EMBED(priv->embed), pos, count); +} + +void +kz_web_shistory_get_nth (KzWeb *web, + gint nth, + gboolean is_relative, + gchar **uri, + gchar **title) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_shistory_get_nth(KZ_EMBED(priv->embed), nth, is_relative, uri, title); +} + +void +kz_web_reload (KzWeb *web, KzWebReloadFlag flags) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_reload(KZ_EMBED(priv->embed), flags); +} + +GList * +kz_web_get_printer_list (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_printer_list(KZ_EMBED(priv->embed)); +} + +gboolean +kz_web_find (KzWeb *web, const gchar *keyword, gboolean backward) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_find(KZ_EMBED(priv->embed), keyword, backward); +} + +gboolean +kz_web_incremental_search (KzWeb *web, + const gchar *keyword, + gboolean backward) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_incremental_search(KZ_EMBED(priv->embed), + keyword, backward); +} + +gchar * +kz_web_get_selection_string (KzWeb *web) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + return kz_embed_get_selection_string(KZ_EMBED(priv->embed)); +} + +void +kz_web_view_current_page_source_in_new (KzWeb *web, + KzWeb *new_embed) +{ + KzWebPrivate *priv = KZ_WEB_GET_PRIVATE(web); + + kz_embed_view_current_page_source_in_new(KZ_EMBED(priv->embed), + KZ_EMBED(KZ_WEB_GET_PRIVATE(new_embed))); +} + +/* +vi:ts=4:nowrap:ai:expandtab:sw=4 +*/ Added: kazehakase/trunk/src/kz-web.h =================================================================== --- kazehakase/trunk/src/kz-web.h (rev 0) +++ kazehakase/trunk/src/kz-web.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -0,0 +1,223 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + * Copyright (C) 2009 Hiroyuki Ikezoe + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __KZ_WEB_H__ +#define __KZ_WEB_H__ + +#include <gtk/gtk.h> +#include "kz-navi.h" +#include "egg-pixbuf-thumbnail.h" + +G_BEGIN_DECLS + +#define KZ_TYPE_WEB (kz_web_get_type ()) +#define KZ_WEB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KZ_TYPE_WEB, KzWeb)) +#define KZ_WEB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KZ_TYPE_WEB, KzWebClass)) +#define KZ_IS_WEB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KZ_TYPE_WEB)) +#define KZ_IS_WEB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KZ_TYPE_WEB)) +#define KZ_WEB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KZ_TYPE_WEB, KzWebClass)) + +typedef enum { + KZ_WEB_NORMAL_FLAG = 0, + KZ_WEB_SOURCE_FLAG = 1 << 0 +} KzWebLoadFlag; + +typedef enum { + KZ_WEB_RELOAD_NORMAL = 0, + KZ_WEB_RELOAD_BYPASS_CACHE = 1, + KZ_WEB_RELOAD_BYPASS_PROXY = 2, + KZ_WEB_RELOAD_BYPASS_PROXY_AND_CACHE = 3, + KZ_WEB_RELOAD_CHARSET_CHANGE = 4 +} KzWebReloadFlag; + +typedef enum { + KZ_WEB_GO_NONE, + KZ_WEB_GO_BACK, + KZ_WEB_GO_FORWARD, + KZ_WEB_GO_UP, + KZ_WEB_GO_INDEX, + KZ_WEB_GO_CONTENTS, + KZ_WEB_GO_START, + KZ_WEB_GO_PREV, + KZ_WEB_GO_NEXT +} KzWebGoAction; + +typedef enum { + KZ_WEB_LINK_NEXT, + KZ_WEB_LINK_PREV, + KZ_WEB_LINK_INDEX, + KZ_WEB_LINK_CONTENTS, + KZ_WEB_LINK_START, + KZ_WEB_LINK_RSS, + KZ_WEB_LINK_GUARD +} KzWebNavLink; + +typedef struct _KzWeb KzWeb; +typedef struct _KzWebClass KzWebClass; + +struct _KzWeb +{ + GtkBin parent; +}; + +struct _KzWebClass +{ + GtkBinClass parent_class; +}; + +GType kz_web_get_type (void) G_GNUC_CONST; +GtkWidget *kz_web_new (const gchar *module_name, + const gchar *engine_name); +void kz_web_change_engine (KzWeb *bin, + const gchar *new_engine_name); +void kz_web_load_uri (KzWeb *bin, + const gchar *uri); +const gchar *kz_web_get_title (KzWeb *web); +const gchar *kz_web_get_location (KzWeb *web); +gdouble kz_web_get_progress (KzWeb *web); +gboolean kz_web_get_lock (KzWeb *web); +void kz_web_set_lock (KzWeb *web, + gboolean lock); +gboolean kz_web_get_allow_javascript (KzWeb *web); +void kz_web_set_allow_javascript (KzWeb *web, + gboolean enable); +gboolean kz_web_is_loading (KzWeb *web); +void kz_web_view_source (KzWeb *web, + const gchar *url); +void kz_web_view_current_page_source_in_new + (KzWeb *web, + KzWeb *new_embed); +gchar *kz_web_ensure_title (KzWeb *web); +gboolean kz_web_can_cut_selection (KzWeb *web); +gboolean kz_web_can_copy_selection (KzWeb *web); +gboolean kz_web_can_paste (KzWeb *web); +void kz_web_cut_selection (KzWeb *web); +void kz_web_copy_selection (KzWeb *web); +void kz_web_paste (KzWeb *web); +void kz_web_select_all (KzWeb *web); +gchar *kz_web_get_selection_string (KzWeb *web); +gboolean kz_web_find (KzWeb *web, + const gchar *keyword, + gboolean backward); +gboolean kz_web_incremental_search (KzWeb *web, + const gchar *keyword, + gboolean backward); +gboolean kz_web_selection_is_collapsed + (KzWeb *web); +gboolean kz_web_get_links (KzWeb *web, + GList **list, + gboolean selected_only); +gboolean kz_web_get_dest_anchors (KzWeb *web, + GList **list); +void kz_web_copy_page (KzWeb *src_embed, + KzWeb *dest_embed); +gboolean kz_web_shistory_get_pos (KzWeb *web, + gint *pos, + gint *count); +void kz_web_shistory_get_nth (KzWeb *web, + gint nth, + gboolean is_relative, + gchar **uri, + gchar **title); +void kz_web_reload (KzWeb *web, + KzWebReloadFlag flags); +void kz_web_stop_load (KzWeb *web); +void kz_web_go_back (KzWeb *web); +void kz_web_go_forward (KzWeb *web); +void kz_web_go_up (KzWeb *web); +gboolean kz_web_can_go_back (KzWeb *web); +gboolean kz_web_can_go_forward (KzWeb *web); +gboolean kz_web_can_go_up (KzWeb *web); +gboolean kz_web_can_go_nav_link (KzWeb *web, + KzWebNavLink link); +void kz_web_go_nav_link (KzWeb *web, + KzWebNavLink link); +void kz_web_append_nav_link (KzWeb *web, + KzWebNavLink link, + KzNavi *navi); +void kz_web_set_nav_link (KzWeb *web, + KzWebNavLink link, + KzNavi *navi); +void kz_web_set_nth_nav_link (KzWeb *web, + KzWebNavLink link, + KzNavi *navi, + guint n); +KzNavi *kz_web_get_nav_link (KzWeb *web, + KzWebNavLink link); +KzNavi *kz_web_get_nth_nav_link (KzWeb *web, + KzWebNavLink link, + guint n); +GList *kz_web_get_nav_links (KzWeb *web, + KzWebNavLink link); +void kz_web_go_history_index (KzWeb *web, + gint index); +gchar *kz_web_get_body_text (KzWeb *web); +void kz_web_set_encoding (KzWeb *web, + const gchar *encoding); +void kz_web_get_encoding (KzWeb *web, + gchar **encoding, + gboolean *forced); +void kz_web_print (KzWeb *web); +void kz_web_print_preview (KzWeb *web); +GList *kz_web_get_printer_list (KzWeb *web); +void kz_web_create_thumbnail (KzWeb *web, + EggPixbufThumbnailSize size); +gboolean kz_web_save_with_content (KzWeb *web, + const char *rawfilename); +gboolean kz_web_set_text_into_textarea(KzWeb *web, + gpointer element, + const gchar *text); +gchar *kz_web_get_text_from_textarea(KzWeb *web, + gpointer element); +void kz_web_zoom (KzWeb *web, + gdouble zoom); +gdouble kz_web_get_zoom_ratio (KzWeb *web); +void kz_web_set_text_size (KzWeb *web, + gdouble zoom); +gdouble kz_web_get_text_size (KzWeb *web); +gchar *kz_web_get_html_with_contents(KzWeb *web, + const gchar *storedir); +void kz_web_set_history (KzWeb *web, + const GList *history, + guint current_position); +void kz_web_get_history (KzWeb*web, + GList **history, + guint *current_position); +guint kz_web_get_last_modified (KzWeb*web); +void kz_web_fine_scroll (KzWeb*web, + gint horiz, + gint vert); +void kz_web_page_up (KzWeb*web); +void kz_web_page_down (KzWeb*web); +gboolean kz_web_get_allow_javascript (KzWeb *web); +void kz_web_set_allow_javascript (KzWeb *web, + gboolean allow); +gboolean kz_web_get_allow_images (KzWeb *web); +void kz_web_set_allow_images (KzWeb *web, + gboolean allow); +void kz_web_show_page_certificate (KzWeb *web); + + +G_END_DECLS + +#endif /* __KZ_WEB_H__ */ +/* +vi:ts=4:nowrap:ai:expandtab:sw=4 +*/ Modified: kazehakase/trunk/src/kz-window.c =================================================================== --- kazehakase/trunk/src/kz-window.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-window.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -37,7 +37,7 @@ #include "kz-actions-popup.h" #include "kz-actions-tab.h" #include "kz-bookmark-bar.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-tab-label.h" #include "kz-icons.h" #include "kazehakase.h" @@ -57,6 +57,7 @@ #include "kz-statusbar.h" #include "kz-session.h" #include "kz-bin.h" +#include "kz-web.h" #define MAX_CLOSED_TABS 10 @@ -141,7 +142,7 @@ GdkEventScroll *event); /* * mozilla doesn't accept these signals, so we connect these funtions to - * KzWindow instead of KzEmbed. + * KzWindow instead of KzWeb. */ static gboolean motion_notify_event (GtkWidget *widget, @@ -156,16 +157,16 @@ static void kz_window_remove_tab (KzWindow *kz, GtkWidget *widget); -static KzEmbed *kz_window_create_embed (KzWindow *kz); +static KzWeb *kz_window_create_web (KzWindow *kz); -static void kz_window_set_cur_embed_callbacks (KzWindow *kz, - KzEmbed *kzembed); -static void kz_window_unset_cur_embed_callbacks(KzWindow *kz, - KzEmbed *kzembed); -static void kz_window_set_embed_callbacks (KzWindow *kz, - KzEmbed *kzembed); -static void kz_window_unset_embed_callbacks (KzWindow *kz, - KzEmbed *kzembed); +static void kz_window_set_cur_web_callbacks (KzWindow *kz, + KzWeb *web); +static void kz_window_unset_cur_web_callbacks(KzWindow *kz, + KzWeb *web); +static void kz_window_set_web_callbacks (KzWindow *kz, + KzWeb *web); +static void kz_window_unset_web_callbacks (KzWindow *kz, + KzWeb *web); /* callbacks */ static void cb_profile_global_changed (KzProfile *profile, @@ -228,39 +229,39 @@ static void cb_sidebar_unmap (GtkWidget *widget, GtkToggleAction *action); -/* callbacks for embed */ -static void cb_embed_title_changed (KzEmbed *embed, - const gchar *title, - KzWindow *kz); -static void cb_embed_location_changed (KzEmbed *embed, - const gchar *location, - KzWindow *kz); -static void cb_embed_link_message (KzEmbed *embed, +/* callbacks for web */ +static void cb_web_title_changed (KzWeb *web, + const gchar *title, + KzWindow *kz); +static void cb_web_location_changed (KzWeb *web, + const gchar *location, + KzWindow *kz); +static void cb_web_link_message (KzWeb *web, const gchar *message, KzWindow *kz); -static void cb_embed_load_started (KzEmbed *embed, +static void cb_web_load_started (KzWeb *web, KzWindow *kz); -static void cb_embed_load_finished (KzEmbed *embed, +static void cb_web_load_finished (KzWeb *web, KzWindow *kz); -static void cb_embed_new_window (KzEmbed *embed, - KzEmbed **new_embed, +static void cb_web_new_window (KzWeb *web, + KzWeb **new_web, KzWindow *kz); -static void cb_embed_close_tab (GtkObject *obj, +static void cb_web_close_tab (GtkObject *obj, KzWindow *kz); -static gboolean cb_embed_dom_key_event (KzEmbed *embed, +static gboolean cb_web_dom_key_event (KzWeb *web, KzEmbedEventKey *event, KzWindow *kz); -static gboolean cb_embed_dom_mouse_click (KzEmbed *embed, +static gboolean cb_web_dom_mouse_click (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz); -static gboolean cb_embed_dom_mouse_down (KzEmbed *embed, +static gboolean cb_web_dom_mouse_down (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz); -static gboolean cb_embed_dom_mouse_up (KzEmbed *embed, +static gboolean cb_web_dom_mouse_up (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz); -static gboolean cb_embed_dom_mouse_over (KzEmbed *embed, +static gboolean cb_web_dom_mouse_over (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz); @@ -607,22 +608,22 @@ kz_window_append_tab (KzWindow *kz, GtkWidget *widget, GtkWidget *parent) { g_return_if_fail(KZ_IS_WINDOW(kz)); - kz_actions_set_tab_sensitive(kz, KZ_WINDOW_CURRENT_EMBED(kz)); + kz_actions_set_tab_sensitive(kz, KZ_WINDOW_CURRENT_WEB(kz)); } static void kz_window_remove_tab (KzWindow *kz, GtkWidget *widget) { - KzEmbed *embed; + KzWeb *web; g_return_if_fail(KZ_IS_WINDOW(kz)); if (!GTK_WIDGET_REALIZED(kz)) return; - embed = KZ_WINDOW_CURRENT_EMBED(kz); - kz_actions_set_sensitive(kz, embed); - kz_actions_set_tab_sensitive(kz, embed); + web = KZ_WINDOW_CURRENT_WEB(kz); + kz_actions_set_sensitive(kz, web); + kz_actions_set_tab_sensitive(kz, web); } @@ -651,7 +652,7 @@ GError *err = NULL; gchar *ui_file; GtkWidget *widget; - KzEmbed *kzembed; + KzWeb *kzweb; KzWindowPrivate *priv; g_return_if_fail(KZ_IS_WINDOW(kz)); @@ -771,9 +772,9 @@ kz_window_sync_proxy(kz); /* for stop/reload button updating */ - kzembed = KZ_WINDOW_CURRENT_EMBED(kz); - if (kzembed) - kz_actions_set_sensitive(kz, kzembed); + kzweb = KZ_WINDOW_CURRENT_WEB(kz); + if (kzweb) + kz_actions_set_sensitive(kz, kzweb); /* smart bookmark */ kz_actions_update_smartbookmarks(kz, KZ_GET_SMART_BOOKMARK); @@ -821,29 +822,29 @@ } /* It's temporary implementation */ -static KzEmbed * -kz_window_create_embed (KzWindow *kz) +static KzWeb * +kz_window_create_web (KzWindow *kz) { gchar *engine; - KzEmbed *kz_embed = NULL; + KzWeb *web = NULL; g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); engine = KZ_CONF_GET_STR("Browser", "layout_engine"); if (engine) { - kz_embed = KZ_EMBED(kz_embed_new(engine)); + web = KZ_WEB(kz_web_new(engine, "gecko")); g_free(engine); } - if (!kz_embed) - kz_embed = KZ_EMBED(kz_embed_new("gecko")); - if (!kz_embed) - kz_embed = KZ_EMBED(kz_embed_new("webkit_gtk")); - if (!kz_embed) - kz_embed = KZ_EMBED(kz_embed_new("ie")); + if (!web) + web = KZ_WEB(kz_web_new("gecko", "gecko")); + if (!web) + web = KZ_WEB(kz_web_new("webkit_gtk", "webkit_gtk")); + if (!web) + web = KZ_WEB(kz_web_new("ie", "ie")); - return kz_embed; + return web; } @@ -851,34 +852,34 @@ kz_window_open_new_tab_with_parent (KzWindow *kz, const gchar *url, GtkWidget *parent) { - KzEmbed *kzembed; + KzWeb *web; KzTabLabel *kztab, *sibtab; g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); if (url) g_return_val_if_fail(g_utf8_validate(url, strlen(url), NULL), NULL); - kzembed = kz_window_create_embed(kz); - g_return_val_if_fail(kzembed, NULL); - kztab = KZ_TAB_LABEL(kz_tab_label_new(kz, kzembed)); + web = kz_window_create_web(kz); + g_return_val_if_fail(web, NULL); + kztab = KZ_TAB_LABEL(kz_tab_label_new(kz, web)); - gtk_widget_show_all(GTK_WIDGET(kzembed)); + gtk_widget_show_all(GTK_WIDGET(web)); gtk_widget_show(GTK_WIDGET(kztab)); - kz_notebook_open_new_tab(KZ_NOTEBOOK(kz->notebook), kzembed, kztab); + kz_notebook_open_new_tab(KZ_NOTEBOOK(kz->notebook), web, kztab); sibtab = kz_notebook_get_sibling_tab_label(KZ_NOTEBOOK(kz->notebook), kztab); /* insert tab bookmark */ kz_bookmark_folder_insert_before(kz->tabs, KZ_BOOKMARK(kztab->history), sibtab ? KZ_BOOKMARK(sibtab->history) : NULL); - kz_window_set_embed_callbacks(kz, kzembed); + kz_window_set_web_callbacks(kz, web); g_signal_emit(kz, kz_window_signals[APPEND_TAB_SIGNAL], - 0, kzembed, parent); + 0, web, parent); - kz_embed_load_url(kzembed, url); + kz_web_load_uri(web, url); - return GTK_WIDGET(kzembed); + return GTK_WIDGET(web); } @@ -887,7 +888,7 @@ { GList *childtabs, *tabnode; KzWindowPrivate *priv; - KzEmbed *curembed; + KzWeb *curweb; gint pos; g_return_if_fail(KZ_IS_WINDOW(kz)); @@ -901,57 +902,57 @@ /* tabs */ for (tabnode = childtabs; tabnode; tabnode = g_list_next(tabnode)) { - KzEmbed *kzembed; + KzWeb *kzweb; KzTabLabel *kztab; KzBookmarkFolder *child; - kzembed = kz_window_create_embed(kz); - kztab = KZ_TAB_LABEL(kz_tab_label_new(kz, kzembed)); + kzweb = kz_window_create_web(kz); + kztab = KZ_TAB_LABEL(kz_tab_label_new(kz, kzweb)); child = KZ_BOOKMARK_FOLDER(tabnode->data); - gtk_widget_show_all(GTK_WIDGET(kzembed)); + gtk_widget_show_all(GTK_WIDGET(kzweb)); gtk_widget_show(GTK_WIDGET(kztab)); - kz_notebook_prepend_new_tab(KZ_NOTEBOOK(kz->notebook), kzembed, kztab); - kz_window_set_embed_callbacks(kz, kzembed); + kz_notebook_prepend_new_tab(KZ_NOTEBOOK(kz->notebook), kzweb, kztab); + kz_window_set_web_callbacks(kz, kzweb); kz_tab_label_set_history(kztab, child); } g_list_free(childtabs); pos = kz_bookmark_folder_get_current_position(KZ_BOOKMARK_FOLDER(tabs)); kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), pos); - curembed = KZ_WINDOW_NTH_EMBED(kz, pos); - if (curembed) + curweb = KZ_WINDOW_NTH_WEB(kz, pos); + if (curweb) { - kz_window_set_cur_embed_callbacks(kz, curembed); - kz_actions_set_sensitive(kz, curembed); - kz_actions_set_tab_sensitive(kz, curembed); + kz_window_set_cur_web_callbacks(kz, curweb); + kz_actions_set_sensitive(kz, curweb); + kz_actions_set_tab_sensitive(kz, curweb); } } void -kz_window_close_tab (KzWindow *kz, KzEmbed *embed) +kz_window_close_tab (KzWindow *kz, KzWeb *web) { g_return_if_fail(KZ_IS_WINDOW(kz)); - g_return_if_fail(KZ_IS_EMBED(embed)); + g_return_if_fail(KZ_IS_WEB(web)); - kz_window_unset_cur_embed_callbacks(kz, embed); - kz_window_unset_embed_callbacks(kz, embed); + kz_window_unset_cur_web_callbacks(kz, web); + kz_window_unset_web_callbacks(kz, web); - kz_notebook_close_tab(KZ_NOTEBOOK(kz->notebook), embed); + kz_notebook_close_tab(KZ_NOTEBOOK(kz->notebook), web); } static void -unset_each_embed_callbacks (gpointer data, gpointer user_data) +unset_each_web_callbacks (gpointer data, gpointer user_data) { - kz_window_unset_embed_callbacks(KZ_WINDOW(user_data), - KZ_EMBED(data)); + kz_window_unset_web_callbacks(KZ_WINDOW(user_data), + KZ_WEB(data)); } static void -disconnect_all_embed_signals (KzWindow *kz) +disconnect_all_web_signals (KzWindow *kz) { - kz_notebook_foreach_embed(KZ_NOTEBOOK(kz->notebook), - unset_each_embed_callbacks, kz); + kz_notebook_foreach_web(KZ_NOTEBOOK(kz->notebook), + unset_each_web_callbacks, kz); } void @@ -959,7 +960,7 @@ { g_return_if_fail(KZ_IS_WINDOW(kz)); - disconnect_all_embed_signals(kz); + disconnect_all_web_signals(kz); kz_notebook_close_all_tab(KZ_NOTEBOOK(kz->notebook)); } @@ -970,44 +971,44 @@ { KzNotebook *src_notebook, *dest_notebook; KzTabLabel *label; - KzEmbed *kzembed; + KzWeb *kzweb; KzTabLabel *new_kztab; g_return_if_fail(KZ_IS_WINDOW(src_kz)); g_return_if_fail(KZ_IS_WINDOW(dest_kz)); - g_return_if_fail(KZ_IS_EMBED(widget)); + g_return_if_fail(KZ_IS_WEB(widget)); src_notebook = KZ_NOTEBOOK(src_kz->notebook); dest_notebook = KZ_NOTEBOOK(dest_kz->notebook); - kzembed = KZ_EMBED(widget); + kzweb = KZ_WEB(widget); - label = kz_notebook_get_tab_label(dest_notebook, kzembed); + label = kz_notebook_get_tab_label(dest_notebook, kzweb); - /* the kzembed is already the kz's child */ + /* the kzweb is already the kz's child */ if (label) return; - label = kz_notebook_get_tab_label(src_notebook, kzembed); + label = kz_notebook_get_tab_label(src_notebook, kzweb); g_return_if_fail(label); /* create new tab label */ - new_kztab = KZ_TAB_LABEL(kz_tab_label_new(dest_kz, kzembed)); + new_kztab = KZ_TAB_LABEL(kz_tab_label_new(dest_kz, kzweb)); /* move the page to this window */ - kz_window_unset_cur_embed_callbacks(src_kz, kzembed); - kz_window_unset_embed_callbacks(src_kz, kzembed); + kz_window_unset_cur_web_callbacks(src_kz, kzweb); + kz_window_unset_web_callbacks(src_kz, kzweb); kz_notebook_move_tab(src_notebook, dest_notebook, widget); kz_bookmark_folder_prepend(dest_kz->tabs, KZ_BOOKMARK(new_kztab->history)); - kz_window_set_embed_callbacks(dest_kz, kzembed); + kz_window_set_web_callbacks(dest_kz, kzweb); g_signal_emit(src_kz, kz_window_signals[REMOVE_TAB_SIGNAL], - 0, kzembed); + 0, kzweb); g_signal_emit(dest_kz, kz_window_signals[APPEND_TAB_SIGNAL], - 0, kzembed, NULL); + 0, kzweb, NULL); } @@ -1090,7 +1091,7 @@ kz = KZ_WINDOW(widget); - /* In an attempt to get the mozembed playing nice with things like emacs keybindings + /* In an attempt to get the mozweb playing nice with things like emacs keybindings * we are passing important events to the focused child widget before letting the window's * base handler see them. This is *completely against* stated gtk2 policy but the * 'correct' behaviour is exceptionally useless. We need to keep an eye out for @@ -1145,7 +1146,7 @@ KzWindowPrivate *priv = KZ_WINDOW_GET_PRIVATE(kz); if (kz->notebook) { - disconnect_all_embed_signals(kz); + disconnect_all_web_signals(kz); kz->notebook = NULL; } @@ -1468,148 +1469,148 @@ static void -kz_window_set_cur_embed_callbacks(KzWindow *kz, KzEmbed *kzembed) +kz_window_set_cur_web_callbacks(KzWindow *kz, KzWeb *kzweb) { g_return_if_fail(KZ_IS_WINDOW(kz)); - g_return_if_fail(KZ_IS_EMBED(kzembed)); + g_return_if_fail(KZ_IS_WEB(kzweb)); /* * key event signal */ - g_signal_connect(kzembed, + g_signal_connect(kzweb, "kz-dom-key-down", - G_CALLBACK(cb_embed_dom_key_event), kz); + G_CALLBACK(cb_web_dom_key_event), kz); /* * mouse event signal */ - g_signal_connect(kzembed, + g_signal_connect(kzweb, "kz-dom-mouse-down", - G_CALLBACK(cb_embed_dom_mouse_down), kz); - g_signal_connect(kzembed, + G_CALLBACK(cb_web_dom_mouse_down), kz); + g_signal_connect(kzweb, "kz-dom-mouse-up", - G_CALLBACK(cb_embed_dom_mouse_up), kz); - g_signal_connect(kzembed, + G_CALLBACK(cb_web_dom_mouse_up), kz); + g_signal_connect(kzweb, "kz-dom-mouse-over", - G_CALLBACK(cb_embed_dom_mouse_over), kz); - g_signal_connect(kzembed, "kz-dom-mouse-click", - G_CALLBACK(cb_embed_dom_mouse_click), kz); + G_CALLBACK(cb_web_dom_mouse_over), kz); + g_signal_connect(kzweb, "kz-dom-mouse-click", + G_CALLBACK(cb_web_dom_mouse_click), kz); /* * other callbacks */ - g_signal_connect(kzembed, "kz-title", - G_CALLBACK(cb_embed_title_changed), kz); - g_signal_connect(kzembed, "kz-location", - G_CALLBACK(cb_embed_location_changed), kz); - g_signal_connect(kzembed, "kz-link-message", - G_CALLBACK(cb_embed_link_message), kz); + g_signal_connect(kzweb, "kz-title", + G_CALLBACK(cb_web_title_changed), kz); + g_signal_connect(kzweb, "kz-location", + G_CALLBACK(cb_web_location_changed), kz); + g_signal_connect(kzweb, "kz-link-message", + G_CALLBACK(cb_web_link_message), kz); } static void -kz_window_unset_cur_embed_callbacks(KzWindow *kz, KzEmbed *kzembed) +kz_window_unset_cur_web_callbacks(KzWindow *kz, KzWeb *kzweb) { g_return_if_fail(KZ_IS_WINDOW(kz)); - g_return_if_fail(KZ_IS_EMBED(kzembed)); + g_return_if_fail(KZ_IS_WEB(kzweb)); /* * key event signal */ g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_dom_key_event), kz); + (kzweb, + G_CALLBACK(cb_web_dom_key_event), kz); /* * mouse event signal */ g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_dom_mouse_down), kz); + (kzweb, + G_CALLBACK(cb_web_dom_mouse_down), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_dom_mouse_up), kz); + (kzweb, + G_CALLBACK(cb_web_dom_mouse_up), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_dom_mouse_over), kz); + (kzweb, + G_CALLBACK(cb_web_dom_mouse_over), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_dom_mouse_click), kz); + (kzweb, + G_CALLBACK(cb_web_dom_mouse_click), kz); /* * other callbacks */ g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_title_changed), kz); + (kzweb, + G_CALLBACK(cb_web_title_changed), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_location_changed), kz); + (kzweb, + G_CALLBACK(cb_web_location_changed), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_link_message), kz); + (kzweb, + G_CALLBACK(cb_web_link_message), kz); } static void -kz_window_set_embed_callbacks(KzWindow *kz, KzEmbed *kzembed) +kz_window_set_web_callbacks(KzWindow *kz, KzWeb *kzweb) { g_return_if_fail(KZ_IS_WINDOW(kz)); - g_return_if_fail(KZ_IS_EMBED(kzembed)); + g_return_if_fail(KZ_IS_WEB(kzweb)); /* * other callbacks */ - g_signal_connect(kzembed, "kz-net-start", - G_CALLBACK(cb_embed_load_started), kz); - g_signal_connect(kzembed, "kz-net-stop", - G_CALLBACK(cb_embed_load_finished), kz); - g_signal_connect(kzembed, "kz-new-window", - G_CALLBACK(cb_embed_new_window), kz); - g_signal_connect(kzembed, "destroy", - G_CALLBACK(cb_embed_close_tab), kz); + g_signal_connect(kzweb, "kz-net-start", + G_CALLBACK(cb_web_load_started), kz); + g_signal_connect(kzweb, "kz-net-stop", + G_CALLBACK(cb_web_load_finished), kz); + g_signal_connect(kzweb, "kz-new-window", + G_CALLBACK(cb_web_new_window), kz); + g_signal_connect(kzweb, "destroy", + G_CALLBACK(cb_web_close_tab), kz); } static void -kz_window_unset_embed_callbacks(KzWindow *kz, KzEmbed *kzembed) +kz_window_unset_web_callbacks(KzWindow *kz, KzWeb *kzweb) { g_return_if_fail(KZ_IS_WINDOW(kz)); - g_return_if_fail(KZ_IS_EMBED(kzembed)); + g_return_if_fail(KZ_IS_WEB(kzweb)); /* * other callbacks */ g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_load_started), kz); + (kzweb, + G_CALLBACK(cb_web_load_started), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_load_finished), kz); + (kzweb, + G_CALLBACK(cb_web_load_finished), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_new_window), kz); + (kzweb, + G_CALLBACK(cb_web_new_window), kz); g_signal_handlers_disconnect_by_func - (kzembed, - G_CALLBACK(cb_embed_close_tab), kz); + (kzweb, + G_CALLBACK(cb_web_close_tab), kz); } void kz_window_load_url (KzWindow *kz, const gchar *url) { - KzEmbed *embed; + KzWeb *web; g_return_if_fail(KZ_IS_WINDOW(kz)); - embed = KZ_WINDOW_CURRENT_EMBED(kz); + web = KZ_WINDOW_CURRENT_WEB(kz); if (kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook)) < 1 || - !embed) + !web) { kz_window_open_new_tab(kz, url); } else { - kz_embed_load_url(embed, url); + kz_web_load_uri(web, url); } } @@ -1617,36 +1618,36 @@ const gchar * kz_window_get_title (KzWindow *kz) { - KzEmbed *embed; + KzWeb *web; g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); - embed = KZ_WINDOW_CURRENT_EMBED(kz); + web = KZ_WINDOW_CURRENT_WEB(kz); - return embed ? kz_embed_get_title(embed) : NULL; + return web ? kz_web_get_title(web) : NULL; } const gchar * kz_window_get_uri (KzWindow *kz) { - KzEmbed *embed; + KzWeb *web; g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); - embed = KZ_WINDOW_CURRENT_EMBED(kz); + web = KZ_WINDOW_CURRENT_WEB(kz); - return embed ? kz_embed_get_location(embed) : NULL; + return web ? kz_web_get_location(web) : NULL; } KzTabLabel * -kz_window_get_tab_label (KzWindow *kz, KzEmbed *embed) +kz_window_get_tab_label (KzWindow *kz, KzWeb *web) { g_return_val_if_fail(KZ_IS_WINDOW(kz), NULL); - g_return_val_if_fail(KZ_IS_EMBED(embed), NULL); + g_return_val_if_fail(KZ_IS_WEB(web), NULL); - return kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), embed); + return kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), web); } @@ -1936,19 +1937,19 @@ cb_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, KzWindow *kz) { - KzEmbed *kzembed = KZ_WINDOW_NTH_EMBED(kz, page_num); - KzEmbed *cur = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *kzweb = KZ_WINDOW_NTH_WEB(kz, page_num); + KzWeb *cur = KZ_WINDOW_CURRENT_WEB(kz); const gchar *location; GtkAction *action; KzTabLabel *tab; - g_return_if_fail(KZ_IS_EMBED(cur)); - g_return_if_fail(KZ_IS_EMBED(kzembed)); + g_return_if_fail(KZ_IS_WEB(cur)); + g_return_if_fail(KZ_IS_WEB(kzweb)); - kz_window_unset_cur_embed_callbacks(kz, cur); - kz_window_set_cur_embed_callbacks(kz, kzembed); + kz_window_unset_cur_web_callbacks(kz, cur); + kz_window_set_cur_web_callbacks(kz, kzweb); - location = kz_embed_get_location(kzembed); + location = kz_web_get_location(kzweb); action = gtk_action_group_get_action(kz->actions, "LocationEntry"); if (KZ_IS_ENTRY_ACTION(action)) @@ -1975,15 +1976,15 @@ if (KZ_IS_ZOOM_ACTION(action)) { gint ratio; - ratio = kz_embed_zoom_get(kzembed); + ratio = kz_web_get_zoom_ratio(kzweb); kz_zoom_action_set_ratio(KZ_ZOOM_ACTION(action), ratio); } - tab = kz_window_get_tab_label(kz, kzembed); + tab = kz_window_get_tab_label(kz, kzweb); g_return_if_fail(tab); - kz_actions_set_sensitive(kz, kzembed); - /* kz_actions_set_tab_sensitive(kz, kzembed); */ + kz_actions_set_sensitive(kz, kzweb); + /* kz_actions_set_tab_sensitive(kz, kzweb); */ /* set current_position in history */ /* FIXME: KzSession should block automatically */ @@ -2049,29 +2050,29 @@ * * *****************************************************************************/ static void -cb_embed_title_changed (KzEmbed *embed, const gchar *title, KzWindow *kz) +cb_web_title_changed (KzWeb *web, const gchar *title, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); - if (embed == KZ_WINDOW_CURRENT_EMBED(kz)) + if (web == KZ_WINDOW_CURRENT_WEB(kz)) gtk_window_set_title(GTK_WINDOW(kz), title); } static void -cb_embed_location_changed (KzEmbed *embed, const gchar *location, KzWindow *kz) +cb_web_location_changed (KzWeb *web, const gchar *location, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); - if (location && embed == KZ_WINDOW_CURRENT_EMBED(kz)) + if (location && web == KZ_WINDOW_CURRENT_WEB(kz)) kz_window_set_location_entry_text(kz, location); - kz_actions_set_sensitive(kz, embed); + kz_actions_set_sensitive(kz, web); } static void -cb_embed_link_message (KzEmbed *embed, const gchar *message, KzWindow *kz) +cb_web_link_message (KzWeb *web, const gchar *message, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); @@ -2081,72 +2082,72 @@ static void -cb_embed_load_started (KzEmbed *embed, KzWindow *kz) +cb_web_load_started (KzWeb *web, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); - kz_actions_set_sensitive(kz, KZ_WINDOW_CURRENT_EMBED(kz)); + kz_actions_set_sensitive(kz, KZ_WINDOW_CURRENT_WEB(kz)); kz_feed_info_change_state(KZ_FEED_INFO(kz->feed_info)); } static void -cb_embed_load_finished (KzEmbed *embed, KzWindow *kz) +cb_web_load_finished (KzWeb *web, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); - kz_actions_set_sensitive(kz, KZ_WINDOW_CURRENT_EMBED(kz)); + kz_actions_set_sensitive(kz, KZ_WINDOW_CURRENT_WEB(kz)); kz_feed_info_change_state(KZ_FEED_INFO(kz->feed_info)); } static void -cb_embed_new_window (KzEmbed *embed, KzEmbed **newEmbed, +cb_web_new_window (KzWeb *web, KzWeb **newEmbed, KzWindow *kz) { g_return_if_fail(KZ_IS_WINDOW(kz)); - *newEmbed = KZ_EMBED(kz_window_open_new_tab(kz, NULL)); + *newEmbed = KZ_WEB(kz_window_open_new_tab(kz, NULL)); gtk_widget_show(GTK_WIDGET(*newEmbed)); } static void -cb_embed_close_tab (GtkObject *obj, KzWindow *kz) +cb_web_close_tab (GtkObject *obj, KzWindow *kz) { - KzEmbed *kzembed; + KzWeb *kzweb; g_return_if_fail(KZ_IS_WINDOW(kz)); - kzembed = KZ_EMBED(obj); + kzweb = KZ_WEB(obj); - kz_window_unset_cur_embed_callbacks(kz, kzembed); - kz_window_unset_embed_callbacks(kz, kzembed); + kz_window_unset_cur_web_callbacks(kz, kzweb); + kz_window_unset_web_callbacks(kz, kzweb); - kz_notebook_close_tab(KZ_NOTEBOOK(kz->notebook), kzembed); + kz_notebook_close_tab(KZ_NOTEBOOK(kz->notebook), kzweb); kz_statusbar_set_link_text(KZ_STATUSBAR(kz->statusbar), NULL); g_signal_emit(kz, kz_window_signals[REMOVE_TAB_SIGNAL], - 0, kzembed); + 0, kzweb); } static gboolean -cb_embed_dom_key_event (KzEmbed *embed, KzEmbedEventKey *event, KzWindow *kz) +cb_web_dom_key_event (KzWeb *web, KzEmbedEventKey *event, KzWindow *kz) { g_return_val_if_fail(KZ_IS_WINDOW(kz), FALSE); - kz_actions_set_sensitive(kz, embed); + kz_actions_set_sensitive(kz, web); return FALSE; } static gboolean -cb_embed_dom_mouse_click (KzEmbed *embed, KzEmbedEventMouse *event, +cb_web_dom_mouse_click (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz) { gint button; @@ -2175,14 +2176,13 @@ (kztab && kz_tab_label_get_lock(kztab))) { kz_window_open_new_tab_with_parent - (kz, event->cinfo.link, GTK_WIDGET(embed)); + (kz, event->cinfo.link, GTK_WIDGET(web)); return TRUE; } - location = kz_embed_get_location(KZ_EMBED(embed)); + location = kz_web_get_location(KZ_WEB(web)); if (!strncmp(location, "history-search:", 15)) { - kz_embed_load_url(KZ_EMBED(embed), - event->cinfo.link); + kz_web_load_uri(KZ_WEB(web), event->cinfo.link); } } break; @@ -2193,7 +2193,7 @@ KZ_CONF_GET("Tab", "focus_mid_click_link", focus_mid_click_link, BOOL); widget = kz_window_open_new_tab_with_parent(kz, event->cinfo.link, - GTK_WIDGET(embed)); + GTK_WIDGET(web)); if(((event->modifier & KZ_SHIFT_KEY) != 0) ^ focus_mid_click_link) { @@ -2217,7 +2217,7 @@ static gboolean -cb_embed_dom_mouse_down (KzEmbed *kzembed, KzEmbedEventMouse *event, +cb_web_dom_mouse_down (KzWeb *kzweb, KzEmbedEventMouse *event, KzWindow *kz) { gint button; @@ -2299,17 +2299,17 @@ } /* start gesture */ - gtk_widget_get_pointer(GTK_WIDGET(kzembed), &x, &y); + gtk_widget_get_pointer(GTK_WIDGET(kzweb), &x, &y); priv->start_x = x; priv->start_y = y; - gdk_window_get_root_origin(GTK_WIDGET(kzembed)->window, + gdk_window_get_root_origin(GTK_WIDGET(kzweb)->window, &win_x, &win_y); - gdk_window_get_position(GTK_WIDGET(kzembed)->window, + gdk_window_get_position(GTK_WIDGET(kzweb)->window, &win_x_pos, &win_y_pos); - gtk_widget_get_pointer(GTK_WIDGET(kzembed), + gtk_widget_get_pointer(GTK_WIDGET(kzweb), &x, &y); kz_gesture_start(priv->gesture, 0, x, y); @@ -2327,25 +2327,25 @@ break; } - kz_actions_set_selection_sensitive(kz, kzembed); + kz_actions_set_selection_sensitive(kz, kzweb); return FALSE; } static gboolean -cb_embed_dom_mouse_up (KzEmbed *embed, KzEmbedEventMouse *event, +cb_web_dom_mouse_up (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz) { g_return_val_if_fail(KZ_IS_WINDOW(kz), FALSE); - kz_actions_set_selection_sensitive(kz, embed); + kz_actions_set_selection_sensitive(kz, web); return FALSE; } static gboolean -cb_embed_dom_mouse_over (KzEmbed *embed, KzEmbedEventMouse *event, +cb_web_dom_mouse_over (KzWeb *web, KzEmbedEventMouse *event, KzWindow *kz) { static glong previous_event_context = KZ_CONTEXT_NONE; @@ -2360,8 +2360,8 @@ type = event->cinfo.context; if ((type & KZ_CONTEXT_LINK) && event->cinfo.link) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); - GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(embed)); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); + GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(web)); gint x, y; gdk_display_get_pointer(display, NULL, &x, &y, NULL); @@ -2374,7 +2374,7 @@ } previous_event_context = type; - kz_actions_set_selection_sensitive(kz, embed); + kz_actions_set_selection_sensitive(kz, web); return FALSE; } @@ -2387,15 +2387,15 @@ gint x, y; /* GdkModifierType state; */ KzWindowPrivate *priv; - KzEmbed *kzembed =KZ_WINDOW_CURRENT_EMBED(KZ_WINDOW(widget)); + KzWeb *kzweb =KZ_WINDOW_CURRENT_WEB(KZ_WINDOW(widget)); - if (!kzembed) + if (!kzweb) return FALSE; kz = KZ_WINDOW(widget); priv = KZ_WINDOW_GET_PRIVATE(kz); - gtk_widget_get_pointer(GTK_WIDGET(kzembed), &x, &y); + gtk_widget_get_pointer(GTK_WIDGET(kzweb), &x, &y); if (abs(x - priv->start_x) > 2 || abs(y - priv->start_y) > 2) @@ -2408,7 +2408,7 @@ kz_gesture_update_position(priv->gesture, x, y); } - kz_actions_set_selection_sensitive(kz, kzembed); + kz_actions_set_selection_sensitive(kz, kzweb); return FALSE; } @@ -2521,33 +2521,33 @@ void kz_window_switch_layout_engine (KzWindow *kz, const gchar *engine_name) { - KzEmbed *embed = KZ_WINDOW_CURRENT_EMBED(kz); + KzWeb *web = KZ_WINDOW_CURRENT_WEB(kz); KzTabLabel *kztab; - GtkWidget *new_embed; + GtkWidget *new_web; GtkWidget *bin; gint position; - if (!embed) + if (!web) return; - new_embed = kz_embed_new(engine_name); - gtk_widget_show_all(new_embed); + new_web = kz_web_new(engine_name, engine_name); + gtk_widget_show_all(new_web); position = gtk_notebook_get_current_page(GTK_NOTEBOOK(kz->notebook)); bin = gtk_notebook_get_nth_page(GTK_NOTEBOOK(kz->notebook), position); kztab = kz_notebook_get_nth_tab_label(KZ_NOTEBOOK(kz->notebook), position); - g_object_ref(embed); - kz_window_unset_cur_embed_callbacks(kz, embed); - kz_window_unset_embed_callbacks(kz, embed); - kz_window_set_cur_embed_callbacks(kz, KZ_EMBED(new_embed)); - kz_window_set_embed_callbacks(kz, KZ_EMBED(new_embed)); - kz_tab_label_set_embed(kztab, KZ_EMBED(new_embed)); + g_object_ref(web); + kz_window_unset_cur_web_callbacks(kz, web); + kz_window_unset_web_callbacks(kz, web); + kz_window_set_cur_web_callbacks(kz, KZ_WEB(new_web)); + kz_window_set_web_callbacks(kz, KZ_WEB(new_web)); + kz_tab_label_set_web(kztab, KZ_WEB(new_web)); - kz_bin_change_child(KZ_BIN(bin), new_embed); + kz_bin_change_child(KZ_BIN(bin), new_web); gtk_widget_show_all(bin); - kz_embed_copy_page(embed, KZ_EMBED(new_embed)); - g_object_unref(embed); + kz_web_copy_page(web, KZ_WEB(new_web)); + g_object_unref(web); } Modified: kazehakase/trunk/src/kz-window.h =================================================================== --- kazehakase/trunk/src/kz-window.h 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/kz-window.h 2009-09-03 23:30:51 UTC (rev 3818) @@ -27,7 +27,7 @@ #include "kz-objects.h" #include "kz-gesture.h" #include "kz-embed-event.h" -#include "kz-embed.h" +#include "kz-web.h" #include "kz-popup-preview.h" #include "kz-bookmark-folder.h" #include "kz-notebook.h" @@ -104,7 +104,7 @@ const gchar *url, GtkWidget *parent); void kz_window_close_tab (KzWindow *kz, - KzEmbed *embed); + KzWeb *web); void kz_window_close_all_tab (KzWindow *kz); void kz_window_move_tab (KzWindow *src_kz, KzWindow *dest_kz, @@ -124,7 +124,7 @@ const gchar *kz_window_get_uri (KzWindow *kz); KzTabLabel *kz_window_get_tab_label (KzWindow *kz, - KzEmbed *embed); + KzWeb *web); GNode *kz_window_get_tree (KzWindow *kz); @@ -145,10 +145,10 @@ void kz_window_switch_layout_engine (KzWindow *kz, const gchar *engine_name); -#define KZ_WINDOW_NTH_EMBED(kz, n) \ - (KZ_IS_WINDOW(kz) ? kz_notebook_get_nth_embed(KZ_NOTEBOOK(KZ_WINDOW(kz)->notebook),n) : NULL) -#define KZ_WINDOW_CURRENT_EMBED(kz) \ - (KZ_IS_WINDOW(kz) ? KZ_WINDOW_NTH_EMBED(kz, kz_notebook_get_current_page(KZ_NOTEBOOK(kz->notebook))) : NULL) +#define KZ_WINDOW_NTH_WEB(kz, n) \ + (KZ_IS_WINDOW(kz) ? kz_notebook_get_nth_web(KZ_NOTEBOOK(KZ_WINDOW(kz)->notebook),n) : NULL) +#define KZ_WINDOW_CURRENT_WEB(kz) \ + (KZ_IS_WINDOW(kz) ? KZ_WINDOW_NTH_WEB(kz, kz_notebook_get_current_page(KZ_NOTEBOOK(kz->notebook))) : NULL) #define KZ_WINDOW_SET_SENSITIVE(kz, action_name, sensitive) \ { \ Modified: kazehakase/trunk/src/sidebar/kz-tabtree.c =================================================================== --- kazehakase/trunk/src/sidebar/kz-tabtree.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/sidebar/kz-tabtree.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -41,7 +41,7 @@ COLUMN_ICON, COLUMN_TITLE, COLUMN_TITLE_COLOR, - COLUMN_EMBEDER, + COLUMN_WEBER, N_COLUMNS }; @@ -69,8 +69,8 @@ GNode *parent); static void build_tab_list (KzTabTree *tabtree); static GtkTreeIter *find_node (GtkTreeStore *store, - KzEmbed *kzembed); -static void remove_all_embed_signals + KzWeb *kzweb); +static void remove_all_web_signals (KzTabTree *tabtree); /* signal handlers for TreeView */ @@ -95,7 +95,7 @@ GtkWidget *parent, KzTabTree *tabtree); static void parent_append (KzTabTree * tabtree, - KzEmbed * kzembed, + KzWeb * kzweb, GtkTreeIter * parent, GtkTreeIter * iter); static void cb_remove_tab (KzWindow *kz, @@ -106,12 +106,12 @@ gint pos, KzTabTree *tabtree); -/* signal handlers for embed */ -static void cb_net_start (KzEmbed *embed, +/* signal handlers for web */ +static void cb_net_start (KzWeb *web, KzTabTree *tabtree); -static void cb_net_stop (KzEmbed *embed, +static void cb_net_stop (KzWeb *web, KzTabTree *tabtree); -static void cb_title_changed (KzEmbed *embed, +static void cb_title_changed (KzWeb *web, const gchar *title, KzTabTree *tabtree); @@ -349,7 +349,7 @@ if (tabtree->store) { - remove_all_embed_signals(tabtree); + remove_all_web_signals(tabtree); g_object_unref(tabtree->store); tabtree->store = NULL; } @@ -453,12 +453,12 @@ node = g_node_first_child(parent); for (; node; node = g_node_next_sibling(node)) { - KzEmbed *kzembed = node->data; + KzWeb *kzweb = node->data; GNode *child = g_node_first_child(node); - if (KZ_IS_EMBED(kzembed)) + if (KZ_IS_WEB(kzweb)) { - parent_append(tabtree, kzembed, parent_iter, &iter); + parent_append(tabtree, kzweb, parent_iter, &iter); } else { @@ -492,15 +492,15 @@ for (i = 0; i < num; i++) { - KzEmbed *kzembed = KZ_WINDOW_NTH_EMBED(kz, i); - parent_append(tabtree, kzembed, NULL, &iter); + KzWeb *kzweb = KZ_WINDOW_NTH_WEB(kz, i); + parent_append(tabtree, kzweb, NULL, &iter); } } typedef struct _FindNode { - KzEmbed *kzembed; + KzWeb *kzweb; GtkTreeIter *iter; } FindNode; @@ -510,14 +510,14 @@ GtkTreePath *path, GtkTreeIter *iter, FindNode *data) { - KzEmbed *kzembed = NULL; + KzWeb *kzweb = NULL; if (!iter) return FALSE; gtk_tree_model_get(model, iter, - COLUMN_EMBEDER, &kzembed, + COLUMN_WEBER, &kzweb, COLUMN_TERMINATOR); - if (kzembed && data->kzembed && kzembed == data->kzembed) + if (kzweb && data->kzweb && kzweb == data->kzweb) { data->iter = gtk_tree_iter_copy(iter); return TRUE; @@ -528,11 +528,11 @@ static GtkTreeIter * -find_node (GtkTreeStore *store, KzEmbed *kzembed) +find_node (GtkTreeStore *store, KzWeb *kzweb) { FindNode data; data.iter = NULL; - data.kzembed = kzembed; + data.kzweb = kzweb; gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc) find_node_func, &data); @@ -541,11 +541,11 @@ static gboolean -remove_embed_signal_func (GtkTreeModel *model, +remove_web_signal_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { - KzEmbed *kzembed = NULL; + KzWeb *kzweb = NULL; KzTabTree *tabtree; g_return_val_if_fail(KZ_IS_TAB_TREE(data), FALSE); @@ -554,17 +554,17 @@ g_return_val_if_fail(iter, FALSE); gtk_tree_model_get(model, iter, - COLUMN_EMBEDER, &kzembed, + COLUMN_WEBER, &kzweb, COLUMN_TERMINATOR); - g_return_val_if_fail(kzembed, FALSE); + g_return_val_if_fail(kzweb, FALSE); - g_signal_handlers_disconnect_by_func(kzembed, + g_signal_handlers_disconnect_by_func(kzweb, G_CALLBACK(cb_title_changed), tabtree); - g_signal_handlers_disconnect_by_func(kzembed, + g_signal_handlers_disconnect_by_func(kzweb, G_CALLBACK(cb_net_start), tabtree); - g_signal_handlers_disconnect_by_func(kzembed, + g_signal_handlers_disconnect_by_func(kzweb, G_CALLBACK(cb_net_stop), tabtree); @@ -573,13 +573,13 @@ static void -remove_all_embed_signals (KzTabTree *tabtree) +remove_all_web_signals (KzTabTree *tabtree) { g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); g_return_if_fail(GTK_IS_TREE_MODEL(tabtree->store)); gtk_tree_model_foreach(GTK_TREE_MODEL(tabtree->store), - remove_embed_signal_func, + remove_web_signal_func, tabtree); } @@ -596,7 +596,7 @@ GtkTreePath *treepath; GtkTreeIter iter; KzWindow *kz; - KzEmbed *kzembed = NULL; + KzWeb *kzweb = NULL; gint num; g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); @@ -612,12 +612,12 @@ &iter, treepath); gtk_tree_path_free(treepath); gtk_tree_model_get(GTK_TREE_MODEL(tabtree->store), &iter, - COLUMN_EMBEDER, &kzembed, + COLUMN_WEBER, &kzweb, COLUMN_TERMINATOR); - if (!kzembed) return; + if (!kzweb) return; num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook), - GTK_WIDGET(kzembed)); + GTK_WIDGET(kzweb)); g_return_if_fail(num >= 0); tabtree->switching = TRUE; @@ -633,7 +633,7 @@ GtkTreePath *treepath; GtkTreeIter iter; KzWindow *kz; - KzEmbed *kzembed = NULL; + KzWeb *kzweb = NULL; KzTabLabel *label; g_return_val_if_fail(KZ_IS_TAB_TREE(tabtree), FALSE); @@ -647,13 +647,13 @@ &iter, treepath); gtk_tree_path_free(treepath); gtk_tree_model_get(GTK_TREE_MODEL(tabtree->store), &iter, - COLUMN_EMBEDER, &kzembed, + COLUMN_WEBER, &kzweb, COLUMN_TERMINATOR); - if (!kzembed) return FALSE; + if (!kzweb) return FALSE; switch (event->button) { case 3: - label = kz_window_get_tab_label(kz, kzembed); + label = kz_window_get_tab_label(kz, kzweb); g_return_val_if_fail(label, FALSE); kz_actions_tab_popup_menu_modal(label, @@ -699,7 +699,7 @@ cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, KzTabTree *tabtree) { - KzEmbed *embed; + KzWeb *web; GtkTreeIter *iter; GtkTreePath *treepath; KzTabLabel *label; @@ -708,8 +708,8 @@ if (tabtree->switching) return; - embed = kz_notebook_get_nth_embed(KZ_NOTEBOOK(notebook), page_num); - iter = find_node(tabtree->store, embed); + web = kz_notebook_get_nth_web(KZ_NOTEBOOK(notebook), page_num); + iter = find_node(tabtree->store, web); /* g_return_if_fail(iter); */ if (!iter) return; @@ -720,10 +720,10 @@ tabtree->switching = TRUE; gtk_tree_view_set_cursor(tabtree->tree_view, treepath, NULL, FALSE); - label = kz_notebook_get_tab_label(KZ_NOTEBOOK(notebook), embed); + label = kz_notebook_get_tab_label(KZ_NOTEBOOK(notebook), web); gtk_tree_store_set(tabtree->store, iter, - COLUMN_TITLE, kz_embed_ensure_title(embed), + COLUMN_TITLE, kz_web_ensure_title(web), COLUMN_TITLE_COLOR, label_color[label->state], COLUMN_TERMINATOR); @@ -745,12 +745,12 @@ { GtkTreeIter iter; GtkTreePath *path; - KzEmbed * kzembed = KZ_EMBED(widget); + KzWeb * kzweb = KZ_WEB(widget); g_return_if_fail(GTK_IS_WIDGET(widget)); g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - parent_append(tabtree, kzembed, find_node(tabtree->store, KZ_EMBED(parent)), &iter); + parent_append(tabtree, kzweb, find_node(tabtree->store, KZ_WEB(parent)), &iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(tabtree->store), &iter); gtk_tree_view_expand_to_path(tabtree->tree_view, path); @@ -759,16 +759,16 @@ static void -parent_append(KzTabTree * tabtree, KzEmbed * kzembed, GtkTreeIter * parent, GtkTreeIter * iter) { +parent_append(KzTabTree * tabtree, KzWeb * kzweb, GtkTreeIter * parent, GtkTreeIter * iter) { const gchar *color; - gchar *title = kz_embed_ensure_title(kzembed); - const gchar *uri = kz_embed_get_location(kzembed); + gchar *title = kz_web_ensure_title(kzweb); + const gchar *uri = kz_web_get_location(kzweb); GdkPixbuf *favicon = kz_favicon_get_pixbuf(KZ_GET_FAVICON, uri, GTK_ICON_SIZE_MENU); - KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), kzembed); + KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), kzweb); color = label_color[label->state]; gtk_tree_store_append(tabtree->store, iter, parent); @@ -776,16 +776,16 @@ COLUMN_ICON, favicon, COLUMN_TITLE, title, COLUMN_TITLE_COLOR, color, - COLUMN_EMBEDER, kzembed, + COLUMN_WEBER, kzweb, COLUMN_TERMINATOR); - g_signal_connect(kzembed, "kz-title", + g_signal_connect(kzweb, "kz-title", G_CALLBACK(cb_title_changed), tabtree); - g_signal_connect(kzembed, "kz-net-start", + g_signal_connect(kzweb, "kz-net-start", G_CALLBACK(cb_net_start), tabtree); - g_signal_connect(kzembed, "kz-net-stop", + g_signal_connect(kzweb, "kz-net-stop", G_CALLBACK(cb_net_stop), tabtree); @@ -798,14 +798,14 @@ static void move_to(KzTabTree * tabtree, GtkTreeIter * child, GtkTreeIter * parent) { - KzEmbed * kzembed; + KzWeb * kzweb; GtkTreeIter newparent, newchild; GtkTreePath *path; g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - gtk_tree_model_get(GTK_TREE_MODEL(tabtree->store), child, COLUMN_EMBEDER, &kzembed, COLUMN_TERMINATOR); - parent_append(tabtree, kzembed, parent, &newparent); + gtk_tree_model_get(GTK_TREE_MODEL(tabtree->store), child, COLUMN_WEBER, &kzweb, COLUMN_TERMINATOR); + parent_append(tabtree, kzweb, parent, &newparent); path = gtk_tree_model_get_path(GTK_TREE_MODEL(tabtree->store), child); @@ -837,7 +837,7 @@ g_return_if_fail(GTK_IS_WIDGET(widget)); g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - parent = find_node(tabtree->store, KZ_EMBED(widget)); + parent = find_node(tabtree->store, KZ_WEB(widget)); while (gtk_tree_model_iter_children(GTK_TREE_MODEL(tabtree->store), &child, parent)) { @@ -879,16 +879,16 @@ * * *****************************************************************************/ static void -cb_net_start (KzEmbed *embed, KzTabTree *tabtree) +cb_net_start (KzWeb *web, KzTabTree *tabtree) { GtkTreeIter *iter; gchar *title; g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - title = kz_embed_ensure_title(KZ_EMBED(embed)); + title = kz_web_ensure_title(KZ_WEB(web)); - iter = find_node(tabtree->store, KZ_EMBED(embed)); + iter = find_node(tabtree->store, KZ_WEB(web)); if (iter) { gtk_tree_store_set(tabtree->store, iter, @@ -903,19 +903,19 @@ static void -cb_net_stop (KzEmbed *embed, KzTabTree *tabtree) +cb_net_stop (KzWeb *web, KzTabTree *tabtree) { GtkTreeIter *iter; gchar *title; g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - title = kz_embed_ensure_title(KZ_EMBED(embed)); + title = kz_web_ensure_title(KZ_WEB(web)); - iter = find_node(tabtree->store, KZ_EMBED(embed)); + iter = find_node(tabtree->store, KZ_WEB(web)); if (iter) { - KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), embed); + KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), web); gtk_tree_store_set(tabtree->store, iter, COLUMN_TITLE, title, @@ -931,16 +931,16 @@ static void -cb_title_changed (KzEmbed *embed, const gchar *title, KzTabTree *tabtree) +cb_title_changed (KzWeb *web, const gchar *title, KzTabTree *tabtree) { GtkTreeIter *iter; g_return_if_fail(KZ_IS_TAB_TREE(tabtree)); - iter = find_node(tabtree->store, KZ_EMBED(embed)); + iter = find_node(tabtree->store, KZ_WEB(web)); if (iter) { - KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), embed); + KzTabLabel * label = kz_notebook_get_tab_label(KZ_NOTEBOOK(tabtree->sidebar->kz->notebook), web); gtk_tree_store_set(tabtree->store, iter, COLUMN_TITLE, title, Modified: kazehakase/trunk/src/sidebar/kz-thumbnails-sidebar.c =================================================================== --- kazehakase/trunk/src/sidebar/kz-thumbnails-sidebar.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/sidebar/kz-thumbnails-sidebar.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -290,7 +290,7 @@ KzWindow *kz) { KzBookmarkFolder *tab; - GtkWidget *kzembed; + GtkWidget *kzweb; KzTabLabel *kztab; g_return_if_fail(KZ_IS_BOOKMARK(bookmark)); @@ -299,8 +299,8 @@ tab = KZ_BOOKMARK_FOLDER(kz_bookmark_folder_get_nth_child(kz->closed_tabs, index)); g_return_if_fail(tab); - kzembed = kz_window_open_new_tab(kz, NULL); - kztab = kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), KZ_EMBED(kzembed)); + kzweb = kz_window_open_new_tab(kz, NULL); + kztab = kz_notebook_get_tab_label(KZ_NOTEBOOK(kz->notebook), KZ_WEB(kzweb)); kz_tab_label_set_history(KZ_TAB_LABEL(kztab), tab); kz_bookmark_folder_remove(kz->closed_tabs, KZ_BOOKMARK(tab)); Modified: kazehakase/trunk/src/utils/utils.c =================================================================== --- kazehakase/trunk/src/utils/utils.c 2009-09-02 10:18:06 UTC (rev 3817) +++ kazehakase/trunk/src/utils/utils.c 2009-09-03 23:30:51 UTC (rev 3818) @@ -41,6 +41,7 @@ #include "config.h" #include "kazehakase.h" #include "kz-search.h" +#include "kz-site.h" #ifdef G_OS_WIN32 # include <windows.h>