svnno****@sourc*****
svnno****@sourc*****
Tue Sep 1 20:09:16 JST 2009
Revision: 3810 http://sourceforge.jp/projects/kazehakase/svn/view?view=rev&revision=3810 Author: ikezoe Date: 2009-09-01 20:09:16 +0900 (Tue, 01 Sep 2009) Log Message: ----------- * src/kz-embed.[ch]: Remove get_link_message interface. It does not need any more. Remove "undo" and "redo" interfaces. These were not used. * module/embed/per-process/kz-dbus-embed-delegate.c: Implement get_encoding and set_encoding interfaces. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/dbus/kz-dbus-embed-agent.c kazehakase/trunk/ext/ruby/kz-rb-embed.c kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp kazehakase/trunk/module/embed/ie/kz-ie.c kazehakase/trunk/module/embed/moz-web-view/kz-moz-web-view.c kazehakase/trunk/module/embed/per-process/kazehakase-embed.xml 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/kz-embed.c kazehakase/trunk/src/kz-embed.h Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/ChangeLog 2009-09-01 11:09:16 UTC (rev 3810) @@ -7,6 +7,10 @@ * src/actions/kz-actions.c: Remove "undo" and "redo" actions. cleanup in kz_actions_set_sensitive(). * src/actions/kz-actions.c: Cleanup in combine_favicon. + * src/kz-embed.[ch]: Remove get_link_message interface. It does not need + any more. Remove "undo" and "redo" interfaces. These were not used. + * module/embed/per-process/kz-dbus-embed-delegate.c: Implement get_encoding + and set_encoding interfaces. 2009-08-31 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/dbus/kz-dbus-embed-agent.c =================================================================== --- kazehakase/trunk/dbus/kz-dbus-embed-agent.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/dbus/kz-dbus-embed-agent.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -206,7 +206,7 @@ gchar **engine_name, GError **error) { - *engine_name = g_strdup("gecko"); + *engine_name = g_strdup("webkit_gtk"); *embed_id = kz_dbus_embed_agent_get_embed_id(object); return TRUE; @@ -398,7 +398,6 @@ iface->is_loading = NULL; iface->get_title = NULL; iface->get_location = NULL; - iface->get_link_message = NULL; iface->get_progress = NULL; iface->can_cut_selection = NULL; iface->can_copy_selection = NULL; @@ -430,8 +429,6 @@ iface->get_nth_nav_link = NULL; iface->get_nav_links = NULL; iface->go_history_index = NULL; - iface->do_command = NULL; - iface->can_do_command = NULL; iface->get_lock = NULL; iface->set_lock = NULL; iface->get_body_text = NULL; Modified: kazehakase/trunk/ext/ruby/kz-rb-embed.c =================================================================== --- kazehakase/trunk/ext/ruby/kz-rb-embed.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/ext/ruby/kz-rb-embed.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -394,22 +394,6 @@ } static VALUE -rb_kz_embed_do_command(VALUE self, VALUE command) -{ - kz_embed_do_command(_SELF(self), STR2CSTR(command)); - return self; -} - -static VALUE -rb_kz_embed_can_do_command(VALUE self, VALUE command) -{ - gboolean can_do_command; - can_do_command = kz_embed_can_do_command(_SELF(self), - STR2CSTR(command)); - return RVAL2CBOOL(can_do_command); -} - -static VALUE rb_kz_embed_get_lock(VALUE self) { gboolean get_lock; @@ -700,9 +684,6 @@ rb_kz_embed_get_nav_links, 1); rb_define_method(cKzEmbed, "go_history_index", rb_kz_embed_go_history_index, 1); - rb_define_method(cKzEmbed, "do_command", rb_kz_embed_do_command, 1); - rb_define_method(cKzEmbed, "can_do_command?", - rb_kz_embed_can_do_command, 1); rb_define_method(cKzEmbed, "lock?", rb_kz_embed_get_lock, 0); rb_define_method(cKzEmbed, "set_lock", rb_kz_embed_set_lock, 0); rb_define_method(cKzEmbed, "get_body_text", Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2009-09-01 11:09:16 UTC (rev 3810) @@ -219,7 +219,6 @@ static gboolean is_loading (KzEmbed *kzembed); static const gchar *get_title (KzEmbed *kzembed); static const gchar *get_location (KzEmbed *kzembed); -static gchar *get_link_message (KzEmbed *kzembed); static gdouble get_progress (KzEmbed *kzembed); static gboolean can_cut_selection (KzEmbed *kzembed); static gboolean can_copy_selection (KzEmbed *kzembed); @@ -276,10 +275,6 @@ KzEmbedNavLink link); static void go_history_index (KzEmbed *kzembed, gint index); -static void do_command (KzEmbed *kzembed, - const char *command); -static gboolean can_do_command (KzEmbed *kzembed, - const char *command); static gboolean get_lock (KzEmbed *kzembed); static void set_lock (KzEmbed *kzembed, gboolean lock); @@ -426,7 +421,6 @@ iface->is_loading = is_loading; iface->get_title = get_title; iface->get_location = get_location; - iface->get_link_message = get_link_message; iface->get_progress = get_progress; iface->can_cut_selection = can_cut_selection; iface->can_copy_selection = can_copy_selection; @@ -459,8 +453,6 @@ iface->get_nth_nav_link = get_nth_nav_link; iface->get_nav_links = get_nav_links; iface->go_history_index = go_history_index; - iface->do_command = do_command; - iface->can_do_command = can_do_command; iface->get_lock = get_lock; iface->set_lock = set_lock; iface->get_body_text = get_body_text; @@ -584,7 +576,7 @@ _("The current URL"), NULL, (GParamFlags) G_PARAM_READWRITE)); - g_type_class_add_private (gobject_class, sizeof(KzGeckoEmbedPrivate)); + g_type_class_add_private(gobject_class, sizeof(KzGeckoEmbedPrivate)); } static void @@ -854,15 +846,6 @@ return KZ_GECKO_EMBED_GET_PRIVATE(kzembed)->title; } -static gchar * -get_link_message (KzEmbed *kzembed) -{ - g_return_val_if_fail(KZ_GECKO_EMBED(kzembed), NULL); - - return gtk_moz_embed_get_link_message(GTK_MOZ_EMBED(kzembed)); -} - - static gdouble get_progress (KzEmbed *kzembed) { @@ -914,7 +897,7 @@ { g_return_if_fail(KZ_IS_GECKO_EMBED(embed)); - gchar *link_message = get_link_message(KZ_EMBED(embed)); + gchar *link_message = gtk_moz_embed_get_link_message(GTK_MOZ_EMBED(embed)); g_signal_emit_by_name(embed, "kz-link-message", link_message); g_free(link_message); @@ -2508,7 +2491,7 @@ *aUrl = (NS_SUCCEEDED (rv) && url.Length()) ? g_strdup(url.get()) : NULL; - PRUnichar *title; + PRUnichar *title = NULL; rv = wrapper->GetSHTitleAtIndex(nth, &title); nsEmbedCString str; @@ -2841,36 +2824,6 @@ } -void -do_command (KzEmbed *kzembed, const char *command) -{ - g_return_if_fail(KZ_IS_GECKO_EMBED(kzembed)); - - KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); - nsCOMPtr<nsICommandManager> commandManager; - commandManager = do_GetInterface(priv->wrapper->mWebBrowser); - if (!commandManager) return; - - commandManager->DoCommand(command, nsnull, nsnull); - -} - -static gboolean -can_do_command (KzEmbed *kzembed, const char *command) -{ - g_return_val_if_fail(KZ_IS_GECKO_EMBED(kzembed), FALSE); - - KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); - nsCOMPtr<nsICommandManager> commandManager; - commandManager = do_GetInterface(priv->wrapper->mWebBrowser); - if (!commandManager) return FALSE; - - PRBool enabled; - commandManager->IsCommandEnabled(command, nsnull, &enabled); - - return (enabled == PR_TRUE); -} - static void zoom_set (KzEmbed *kzembed, int zoom, gboolean reflow) { Modified: kazehakase/trunk/module/embed/ie/kz-ie.c =================================================================== --- kazehakase/trunk/module/embed/ie/kz-ie.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/ie/kz-ie.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -233,7 +233,6 @@ iface->is_loading = kz_ie_is_loading; iface->get_title = kz_ie_get_title; iface->get_location = kz_ie_get_location; - iface->get_link_message = NULL; iface->get_progress = kz_ie_get_progress; iface->can_cut_selection = kz_ie_can_cut_selection; iface->can_copy_selection = kz_ie_can_copy_selection; @@ -265,8 +264,6 @@ iface->get_nth_nav_link = NULL; iface->get_nav_links = NULL; iface->go_history_index = go_history_index; - iface->do_command = NULL; - iface->can_do_command = NULL; iface->get_lock = kz_ie_get_lock; iface->set_lock = kz_ie_set_lock; iface->get_body_text = NULL; Modified: kazehakase/trunk/module/embed/moz-web-view/kz-moz-web-view.c =================================================================== --- kazehakase/trunk/module/embed/moz-web-view/kz-moz-web-view.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/moz-web-view/kz-moz-web-view.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -83,7 +83,6 @@ static gdouble get_progress (KzEmbed *kzembed); static const gchar *get_title (KzEmbed *kzembed); static const gchar *get_location (KzEmbed *kzembed); -static gchar *get_link_message (KzEmbed *kzembed); static gboolean selection_is_collapsed (KzEmbed *kzembed); static gboolean is_loading (KzEmbed *kzembed); static void zoom_set (KzEmbed *kzembed, @@ -172,7 +171,6 @@ iface->is_loading = is_loading; iface->get_title = get_title; iface->get_location = get_location; - iface->get_link_message = get_link_message; iface->get_progress = get_progress; iface->can_cut_selection = can_cut_selection; iface->can_copy_selection = can_copy_selection; @@ -204,8 +202,6 @@ iface->get_nth_nav_link = get_nth_nav_link; iface->get_nav_links = get_nav_links; iface->go_history_index = NULL; - iface->do_command = NULL; - iface->can_do_command = NULL; iface->get_lock = get_lock; iface->set_lock = set_lock; iface->get_body_text = NULL; @@ -445,14 +441,6 @@ return moz_web_view_get_location(MOZ_WEB_VIEW(kzembed)); } -static gchar * -get_link_message (KzEmbed *kzembed) -{ - g_return_val_if_fail(KZ_IS_MOZ_WEB_VIEW(kzembed), NULL); - - return g_strdup(KZ_MOZ_WEB_VIEW_GET_PRIVATE(kzembed)->link_message); -} - static gdouble get_progress (KzEmbed *kzembed) { Modified: kazehakase/trunk/module/embed/per-process/kazehakase-embed.xml =================================================================== --- kazehakase/trunk/module/embed/per-process/kazehakase-embed.xml 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/per-process/kazehakase-embed.xml 2009-09-01 11:09:16 UTC (rev 3810) @@ -19,13 +19,22 @@ <method name="StopLoad" /> <method name="Reload" /> <method name="LoadUri"> - <arg type="s" name="uri" /> + <arg type="s" name="uri" direction="in" /> </method> <method name="GoBack" /> <method name="GoForward" /> <method name="Paste" /> <method name="Copy" /> <method name="Cut" /> + <method name="CanCopySelection"> + <arg type="b" name="possible" direction="out" /> + </method> + <method name="CanCutSelection"> + <arg type="b" name="possible" direction="out" /> + </method> + <method name="CanPaste"> + <arg type="b" name="possible" direction="out" /> + </method> <method name="CanGoBack"> <arg type="b" name="possible" direction="out" /> </method> @@ -48,6 +57,12 @@ <arg type="as" name="titles" direction="in" /> <arg type="as" name="uris" direction="in" /> </method> + <method name="SetEncoding"> + <arg type="s" name="encoding" direction="in" /> + </method> + <method name="GetEncoding"> + <arg type="s" name="encoding" direction="out" /> + </method> </interface> </node> 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-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/per-process/kz-dbus-embed-delegate.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -95,6 +95,10 @@ static void cut (KzEmbed *embed); static void copy (KzEmbed *embed); static void paste (KzEmbed *embed); +static gboolean can_copy_selection + (KzEmbed *embed); +static gboolean can_cut_selection(KzEmbed *embed); +static gboolean can_paste (KzEmbed *embed); static gboolean find (KzEmbed *embed, const gchar *keyword, gboolean backward); @@ -104,11 +108,15 @@ static const gchar *get_title (KzEmbed *embed); static const gchar *get_location (KzEmbed *embed); static gdouble get_progress (KzEmbed *embed); -static gchar *get_link_message (KzEmbed *embed); static void get_history (KzEmbed *embed, KzBookmarkFolder *history); static void set_history (KzEmbed *embed, KzBookmarkFolder *history); +static void set_encoding (KzEmbed *embed, + const gchar *encoding); +static void get_encoding (KzEmbed *embed, + gchar **encoding, + gboolean *forced); static gboolean kz_dbus_embed_delegate_ready(KzDBusEmbedDelegate *object, gint process_id, guint *embed_id, gchar **engine_name, @@ -473,11 +481,10 @@ iface->is_loading = NULL; iface->get_title = get_title; iface->get_location = get_location; - iface->get_link_message = get_link_message; iface->get_progress = get_progress; - iface->can_cut_selection = NULL; - iface->can_copy_selection = NULL; - iface->can_paste = NULL; + iface->can_cut_selection = can_cut_selection; + iface->can_copy_selection = can_copy_selection; + iface->can_paste = can_paste; iface->cut_selection = cut; iface->copy_selection = copy; iface->paste = paste; @@ -505,16 +512,14 @@ iface->get_nth_nav_link = NULL; iface->get_nav_links = NULL; iface->go_history_index = NULL; - iface->do_command = NULL; - iface->can_do_command = NULL; iface->get_lock = NULL; iface->set_lock = NULL; iface->get_body_text = NULL; #if 0 iface->get_selection_source = NULL; #endif - iface->set_encoding = NULL; - iface->get_encoding = NULL; + iface->set_encoding = set_encoding; + iface->get_encoding = get_encoding; iface->print = NULL; iface->print_preview = NULL; iface->get_printer_list = NULL; @@ -727,18 +732,6 @@ } static void -stop_load (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!org_kazehakase_Embed_stop_load(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } -} - -static void reload (KzEmbed *embed, KzEmbedReloadFlag flags) { GError *error = NULL; @@ -750,100 +743,50 @@ } } -static void -go_back (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!org_kazehakase_Embed_go_back(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } +#define DEFINE_SIMPLE_METHOD(method) \ +static void \ +method (KzEmbed *embed) \ +{ \ + GError *error = NULL; \ + KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); \ + \ + if (!org_kazehakase_Embed_ ## method(priv->proxy, &error)) { \ + g_print("%s\n", error->message); \ + g_error_free(error); \ + } \ } -static void -go_forward (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); +DEFINE_SIMPLE_METHOD(go_back) +DEFINE_SIMPLE_METHOD(go_forward) +DEFINE_SIMPLE_METHOD(cut) +DEFINE_SIMPLE_METHOD(copy) +DEFINE_SIMPLE_METHOD(paste) +DEFINE_SIMPLE_METHOD(stop_load) - if (!org_kazehakase_Embed_go_forward(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } +#define DEFINE_CAN_GETTER(method) \ +static gboolean \ +can_ ## method (KzEmbed *embed) \ +{ \ + GError *error = NULL; \ + gboolean possible = FALSE; \ + KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); \ + \ + if (!priv->proxy) \ + return FALSE; \ + if (!org_kazehakase_Embed_can_ ## method(priv->proxy, &possible, &error)) { \ + g_print("%s\n", error->message); \ + g_error_free(error); \ + } \ + return possible; \ } -static gboolean -can_go_back (KzEmbed *embed) -{ - GError *error = NULL; - gboolean possible = FALSE; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); +DEFINE_CAN_GETTER(go_back) +DEFINE_CAN_GETTER(go_forward) +DEFINE_CAN_GETTER(copy_selection) +DEFINE_CAN_GETTER(cut_selection) +DEFINE_CAN_GETTER(paste) - if (!priv->proxy) - return FALSE; - if (!org_kazehakase_Embed_can_go_back(priv->proxy, &possible, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } - - return possible; -} - static gboolean -can_go_forward (KzEmbed *embed) -{ - GError *error = NULL; - gboolean possible = FALSE; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!priv->proxy) - return FALSE; - if (!org_kazehakase_Embed_can_go_forward(priv->proxy, &possible, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } - return possible; -} - -static void -copy (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!org_kazehakase_Embed_copy(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } -} - -static void -cut (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!org_kazehakase_Embed_cut(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } -} - -static void -paste (KzEmbed *embed) -{ - GError *error = NULL; - KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); - - if (!org_kazehakase_Embed_paste(priv->proxy, &error)) { - g_print("%s\n", error->message); - g_error_free(error); - } -} - -static gboolean find (KzEmbed *embed, const gchar *keyword, gboolean backward) { GError *error = NULL; @@ -963,12 +906,6 @@ return KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed)->progress; } -static gchar * -get_link_message (KzEmbed *embed) -{ - return g_strdup(KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed)->link_message); -} - static void get_history (KzEmbed *embed, KzBookmarkFolder *history) { @@ -1026,6 +963,27 @@ } } +static void +set_encoding (KzEmbed *embed, const gchar *encoding) +{ + KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); + + org_kazehakase_Embed_set_encoding_async(priv->proxy, encoding, cb_async, NULL); +} + +static void +get_encoding (KzEmbed *embed, gchar **encoding, gboolean *forced) +{ + GError *error = NULL; + KzDBusEmbedDelegatePrivate *priv = KZ_DBUS_EMBED_DELEGATE_GET_PRIVATE(embed); + + if (!org_kazehakase_Embed_get_encoding(priv->proxy, encoding, &error)) { + g_print("%s\n", error->message); + g_error_free(error); + } + *forced = TRUE; +} + /* vi:ts=4:nowrap:ai:expandtab:sw=4 */ Modified: kazehakase/trunk/module/embed/per-process/kz-embed-process.c =================================================================== --- kazehakase/trunk/module/embed/per-process/kz-embed-process.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/per-process/kz-embed-process.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -105,10 +105,15 @@ static gboolean kz_embed_process_paste (KzEmbedProcess *object, GError **error); static gboolean kz_embed_process_copy (KzEmbedProcess *object, GError **error); static gboolean kz_embed_process_cut (KzEmbedProcess *object, GError **error); +static gboolean kz_embed_process_can_copy_selection (KzEmbedProcess *object, gboolean *possible, GError **error); +static gboolean kz_embed_process_can_cut_selection (KzEmbedProcess *object, gboolean *possible, GError **error); +static gboolean kz_embed_process_can_paste (KzEmbedProcess *object, gboolean *possible, GError **error); static gboolean kz_embed_process_find (KzEmbedProcess *object, const gchar *keyword, gboolean backward, gboolean *found, GError **error); static gboolean kz_embed_process_zoom (KzEmbedProcess *object, gdouble ratio, GError **error); static gboolean kz_embed_process_get_history (KzEmbedProcess *object, gchar ***titles, gchar ***uris, GError **error); static gboolean kz_embed_process_set_history (KzEmbedProcess *object, const gchar **titles, const gchar **uris, GError **error); +static gboolean kz_embed_process_set_encoding (KzEmbedProcess *object, const gchar *encoding, GError **error); +static gboolean kz_embed_process_get_encoding (KzEmbedProcess *object, gchar **encoding, GError **error); #include "kz-embed-process-server-bindings.h" @@ -472,6 +477,36 @@ } static gboolean +kz_embed_process_can_copy_selection (KzEmbedProcess *object, gboolean *possible, GError **error) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + + *possible = kz_embed_can_copy_selection(priv->embed); + + return TRUE; +} + +static gboolean +kz_embed_process_can_cut_selection (KzEmbedProcess *object, gboolean *possible, GError **error) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + + *possible = kz_embed_can_cut_selection(priv->embed); + + return TRUE; +} + +static gboolean +kz_embed_process_can_paste (KzEmbedProcess *object, gboolean *possible, GError **error) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + + *possible = kz_embed_can_cut_selection(priv->embed); + + return TRUE; +} + +static gboolean kz_embed_process_zoom (KzEmbedProcess *object, gdouble ratio, GError **error) { KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); @@ -546,6 +581,27 @@ return TRUE; } +static gboolean +kz_embed_process_set_encoding (KzEmbedProcess *object, const gchar *encoding, GError **error) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + + kz_embed_set_encoding(priv->embed, encoding); + + return TRUE; +} + +static gboolean +kz_embed_process_get_encoding (KzEmbedProcess *object, gchar **encoding, GError **error) +{ + KzEmbedProcessPrivate *priv = KZ_EMBED_PROCESS_GET_PRIVATE(object); + gboolean forced = FALSE; + + kz_embed_get_encoding(priv->embed, encoding, &forced); + + return TRUE; +} + static void setup_dbus (GObject *object) { Modified: kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c =================================================================== --- kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -79,7 +79,6 @@ static gdouble get_progress (KzEmbed *kzembed); static const gchar *get_title (KzEmbed *kzembed); static const gchar *get_location (KzEmbed *kzembed); -static gchar *get_link_message (KzEmbed *kzembed); static gboolean selection_is_collapsed (KzEmbed *kzembed); static gboolean is_loading (KzEmbed *kzembed); static void zoom_set (KzEmbed *kzembed, @@ -220,7 +219,6 @@ iface->is_loading = is_loading; iface->get_title = get_title; iface->get_location = get_location; - iface->get_link_message = get_link_message; iface->get_progress = get_progress; iface->can_cut_selection = can_cut_selection; iface->can_copy_selection = can_copy_selection; @@ -252,8 +250,6 @@ iface->get_nth_nav_link = get_nth_nav_link; iface->get_nav_links = get_nav_links; iface->go_history_index = NULL; - iface->do_command = NULL; - iface->can_do_command = NULL; iface->get_lock = get_lock; iface->set_lock = set_lock; iface->get_body_text = NULL; @@ -522,14 +518,6 @@ return KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->location; } -static gchar * -get_link_message (KzEmbed *kzembed) -{ - g_return_val_if_fail(KZ_IS_WEBKIT_GTK(kzembed), NULL); - - return g_strdup(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->link_message); -} - static gdouble get_progress (KzEmbed *kzembed) { Modified: kazehakase/trunk/src/kz-embed.c =================================================================== --- kazehakase/trunk/src/kz-embed.c 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/src/kz-embed.c 2009-09-01 11:09:16 UTC (rev 3810) @@ -192,7 +192,7 @@ type = g_type_register_static(G_TYPE_INTERFACE, "KzEmbed", &info, 0); g_type_interface_add_prerequisite(type, - G_TYPE_OBJECT); + GTK_TYPE_WIDGET); } return type; } @@ -202,214 +202,210 @@ { static gboolean initialized = FALSE; - if (initialized) return; + if (!initialized) + { + initialized = TRUE; - kz_embed_signals[LINK_MESSAGE_SIGNAL] - = g_signal_new ("kz-link-message", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, link_message), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + kz_embed_signals[LINK_MESSAGE_SIGNAL] + = g_signal_new ("kz-link-message", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, link_message), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); - kz_embed_signals[JS_STATUS_SIGNAL] - = g_signal_new ("kz-js-status", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, js_status), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + kz_embed_signals[JS_STATUS_SIGNAL] + = g_signal_new ("kz-js-status", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, js_status), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); - kz_embed_signals[LOCATION_SIGNAL] - = g_signal_new ("kz-location", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, location), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + kz_embed_signals[LOCATION_SIGNAL] + = g_signal_new ("kz-location", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, location), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); - kz_embed_signals[TITLE_SIGNAL] - = g_signal_new ("kz-title", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, title), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + kz_embed_signals[TITLE_SIGNAL] + = g_signal_new ("kz-title", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, title), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); - kz_embed_signals[PROGRESS_SIGNAL] - = g_signal_new ("kz-progress", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, progress), - NULL, NULL, - g_cclosure_marshal_VOID__DOUBLE, - G_TYPE_NONE, 1, - G_TYPE_DOUBLE); + kz_embed_signals[PROGRESS_SIGNAL] + = g_signal_new ("kz-progress", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, progress), + NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); - kz_embed_signals[NET_START_SIGNAL] - = g_signal_new ("kz-net-start", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, net_start), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + kz_embed_signals[NET_START_SIGNAL] + = g_signal_new ("kz-net-start", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, net_start), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); - kz_embed_signals[NET_STOP_SIGNAL] - = g_signal_new ("kz-net-stop", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, net_stop), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + kz_embed_signals[NET_STOP_SIGNAL] + = g_signal_new ("kz-net-stop", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, net_stop), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); - kz_embed_signals[NEW_WINDOW_SIGNAL] - = g_signal_new ("kz-new-window", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, new_window), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + kz_embed_signals[NEW_WINDOW_SIGNAL] + = g_signal_new ("kz-new-window", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, new_window), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); - kz_embed_signals[OPEN_URI_SIGNAL] - = g_signal_new ("kz-open-uri", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, open_uri), - NULL, NULL, - _kz_marshal_INT__STRING, - G_TYPE_INT, 1, G_TYPE_STRING); + kz_embed_signals[OPEN_URI_SIGNAL] + = g_signal_new ("kz-open-uri", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, open_uri), + NULL, NULL, + _kz_marshal_INT__STRING, + G_TYPE_INT, 1, G_TYPE_STRING); - kz_embed_signals[SIZE_TO_SIGNAL] - = g_signal_new ("kz-size-to", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, size_to), - NULL, NULL, - _kz_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + kz_embed_signals[SIZE_TO_SIGNAL] + = g_signal_new ("kz-size-to", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, size_to), + NULL, NULL, + _kz_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - kz_embed_signals[DOM_KEY_DOWN_SIGNAL] - = g_signal_new ("kz-dom-key-down", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_key_down), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_KEY_DOWN_SIGNAL] + = g_signal_new ("kz-dom-key-down", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_key_down), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_KEY_PRESS_SIGNAL] - = g_signal_new ("kz-dom-key-press", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_key_press), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_KEY_PRESS_SIGNAL] + = g_signal_new ("kz-dom-key-press", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_key_press), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_KEY_UP_SIGNAL] - = g_signal_new ("kz-dom-key-up", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_key_up), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_KEY_UP_SIGNAL] + = g_signal_new ("kz-dom-key-up", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_key_up), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_DOWN_SIGNAL] - = g_signal_new ("kz-dom-mouse-down", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_down), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_MOUSE_DOWN_SIGNAL] + = g_signal_new ("kz-dom-mouse-down", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_down), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_UP_SIGNAL] - = g_signal_new ("kz-dom-mouse-up", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_up), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_MOUSE_UP_SIGNAL] + = g_signal_new ("kz-dom-mouse-up", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_up), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_CLICK_SIGNAL] - = g_signal_new ("kz-dom-mouse-click", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_click), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_MOUSE_CLICK_SIGNAL] + = g_signal_new ("kz-dom-mouse-click", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_click), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_DBL_CLICK_SIGNAL] - = g_signal_new ("kz-dom-mouse-dbl-click", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_dbl_click), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_MOUSE_DBL_CLICK_SIGNAL] + = g_signal_new ("kz-dom-mouse-dbl-click", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_dbl_click), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_OVER_SIGNAL] - = g_signal_new ("kz-dom-mouse-over", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_over), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); + kz_embed_signals[DOM_MOUSE_OVER_SIGNAL] + = g_signal_new ("kz-dom-mouse-over", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_over), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - kz_embed_signals[DOM_MOUSE_OUT_SIGNAL] - = g_signal_new ("kz-dom-mouse-out", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_out), - NULL, NULL, - _kz_marshal_BOOLEAN__POINTER, - G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - - kz_embed_signals[SELECTION_SIGNAL] - = g_signal_new ("kz-selection", - KZ_TYPE_EMBED, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET(KzEmbedIFace, selection), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + kz_embed_signals[DOM_MOUSE_OUT_SIGNAL] + = g_signal_new ("kz-dom-mouse-out", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(KzEmbedIFace, dom_mouse_out), + NULL, NULL, + _kz_marshal_BOOLEAN__POINTER, + G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); - - initialized = TRUE; + kz_embed_signals[SELECTION_SIGNAL] + = g_signal_new ("kz-selection", + KZ_TYPE_EMBED, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(KzEmbedIFace, selection), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + } } void kz_embed_load_url (KzEmbed *kzembed, const gchar *url) { + KzEmbed *target_embed = kzembed; g_return_if_fail(KZ_IS_EMBED(kzembed)); if (kz_embed_get_lock(kzembed)) { - KzEmbed *newembed = NULL; g_signal_emit_by_name(kzembed, "new-window", - &newembed, 0); - KZ_EMBED_GET_IFACE(kzembed)->load_url(newembed, url); + &target_embed, 0); } - else - { - KZ_EMBED_GET_IFACE(kzembed)->load_url(kzembed, url); - } + KZ_EMBED_GET_IFACE(kzembed)->load_url(target_embed, url); } @@ -496,17 +492,6 @@ } -gchar * -kz_embed_get_link_message (KzEmbed *kzembed) -{ - g_return_val_if_fail(KZ_IS_EMBED(kzembed), NULL); - if (!KZ_EMBED_GET_IFACE(kzembed)->get_link_message) - return NULL; - - return KZ_EMBED_GET_IFACE(kzembed)->get_link_message(kzembed); -} - - gdouble kz_embed_get_progress (KzEmbed *kzembed) { @@ -938,29 +923,7 @@ } -void -kz_embed_do_command (KzEmbed *kzembed, const gchar *command) -{ - g_return_if_fail(KZ_IS_EMBED(kzembed)); - if (!KZ_EMBED_GET_IFACE(kzembed)->do_command) - return; - - KZ_EMBED_GET_IFACE(kzembed)->do_command(kzembed, command); -} - - gboolean -kz_embed_can_do_command (KzEmbed *kzembed, const gchar *command) -{ - g_return_val_if_fail(KZ_IS_EMBED(kzembed), FALSE); - if (!KZ_EMBED_GET_IFACE(kzembed)->can_do_command) - return FALSE; - - return KZ_EMBED_GET_IFACE(kzembed)->can_do_command(kzembed, command); -} - - -gboolean kz_embed_get_lock (KzEmbed *kzembed) { g_return_val_if_fail(KZ_IS_EMBED(kzembed), FALSE); @@ -1290,3 +1253,4 @@ return up_location; } + Modified: kazehakase/trunk/src/kz-embed.h =================================================================== --- kazehakase/trunk/src/kz-embed.h 2009-09-01 10:30:02 UTC (rev 3809) +++ kazehakase/trunk/src/kz-embed.h 2009-09-01 11:09:16 UTC (rev 3810) @@ -89,7 +89,6 @@ const gchar *(*get_title) (KzEmbed *kzembed); const gchar *(*get_location) (KzEmbed *kzembed); - gchar *(*get_link_message) (KzEmbed *kzembed); gdouble (*get_progress) (KzEmbed *kzembed); @@ -167,11 +166,6 @@ void (*go_history_index) (KzEmbed *kzembed, gint index); - void (*do_command) (KzEmbed *kzembed, - const gchar *command); - gboolean (*can_do_command) (KzEmbed *kzembed, - const gchar *command); - gboolean (*get_lock) (KzEmbed *kzembed); void (*set_lock) (KzEmbed *kzembed, gboolean lock); @@ -313,7 +307,6 @@ const gchar *kz_embed_get_title (KzEmbed *kzembed); const gchar *kz_embed_get_location (KzEmbed *kzembed); gchar *kz_embed_ensure_title (KzEmbed *kzembed); -gchar *kz_embed_get_link_message (KzEmbed *kzembed); gdouble kz_embed_get_progress (KzEmbed *kzembed); @@ -392,11 +385,6 @@ void kz_embed_go_history_index (KzEmbed *kzembed, gint index); -void kz_embed_do_command (KzEmbed *kzembed, - const gchar *command); -gboolean kz_embed_can_do_command (KzEmbed *kzembed, - const gchar *command); - gboolean kz_embed_get_lock (KzEmbed *kzembed); void kz_embed_set_lock (KzEmbed *kzembed, gboolean lock);