svnno****@sourc*****
svnno****@sourc*****
Fri Mar 30 12:44:23 JST 2007
Revision: 3103 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3103 Author: ikezoe Date: 2007-03-30 12:44:22 +0900 (Fri, 30 Mar 2007) Log Message: ----------- * module/embed/gtk-webcore/kz-gtk-webcore.cpp: Implement kz_gtk_webcore_copy_selection. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-03-30 03:14:43 UTC (rev 3102) +++ kazehakase/trunk/ChangeLog 2007-03-30 03:44:22 UTC (rev 3103) @@ -5,6 +5,8 @@ Partially revert rev.2964 to prevent unpredictable crash. * module/embed/gecko/kz-moz-single.cpp: Remove mozilla_prefs_init(). This function is called in mozilla_init(). + * module/embed/gtk-webcore/kz-gtk-webcore.cpp: Implement + kz_gtk_webcore_copy_selection. 2007-03-30 Kouhei Sutou <kou****@cozmi*****> Modified: kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp =================================================================== --- kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-03-30 03:14:43 UTC (rev 3102) +++ kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-03-30 03:44:22 UTC (rev 3103) @@ -31,7 +31,7 @@ #include "kz-embed.h" #include "kz-prompt-dialog.h" #include "kz-proxy-item.h" -#include "gobject-utils.h" +#include "gtk-utils.h" #undef GTK_WEBCORE_HAS_MOUSE_DOWN @@ -64,30 +64,30 @@ static void kz_gtk_webcore_location (Webi *webi); static void kz_gtk_webcore_title (Webi *webi); static void kz_gtk_webcore_req_js_prompt (Webi *webi, - WebiPromptArgs* args); + WebiPromptArgs* args); static void kz_gtk_webcore_req_auth_prompt (Webi *webi, - WebiAuthArgs* args); + WebiAuthArgs* args); static Webi *kz_gtk_webcore_req_new_window (Webi *webi, - const gchar *url); + const gchar *url); static void kz_gtk_webcore_close_window (Webi *webi); static void kz_gtk_webcore_mouse_over (Webi *webi, - const gchar *link_title, - const gchar *link_label, - const gchar *link_url, - const gchar *link_target); + const gchar *link_title, + const gchar *link_label, + const gchar *link_url, + const gchar *link_target); #ifdef GTK_WEBCORE_HAS_MOUSE_DOWN static gboolean kz_gtk_webcore_mouse_down (Webi *webi, - const gchar *link_url, - guint button); + const gchar *link_url, + guint button); static gboolean kz_gtk_webcore_mouse_up (Webi *webi, - const gchar *link_url, - guint button); + const gchar *link_url, + guint button); #endif static gboolean kz_gtk_webcore_set_cookie (Webi *webi, WebiCookie *cookie); /* embed iface */ static void kz_gtk_webcore_load_url (KzEmbed *kzembed, - const gchar *url); + const gchar *url); static gboolean kz_gtk_webcore_is_loading (KzEmbed *kzembed); static const gchar *kz_gtk_webcore_get_title (KzEmbed *kzembed); static const gchar *kz_gtk_webcore_get_location (KzEmbed *kzembed); @@ -95,26 +95,32 @@ static gchar *kz_gtk_webcore_get_link_message (KzEmbed *kzembed); static void kz_gtk_webcore_reload (KzEmbed *kzembed, - KzEmbedReloadFlag flags); + KzEmbedReloadFlag flags); static void kz_gtk_webcore_stop_load (KzEmbed *kzembed); static void kz_gtk_webcore_go_back (KzEmbed *kzembed); static void kz_gtk_webcore_go_forward (KzEmbed *kzembed); static gboolean kz_gtk_webcore_can_go_back (KzEmbed *kzembed); static gboolean kz_gtk_webcore_can_go_forward (KzEmbed *kzembed); static gboolean kz_gtk_webcore_can_go_nav_link (KzEmbed *kzembed, - KzEmbedNavLink link); + KzEmbedNavLink link); static void kz_gtk_webcore_go_nav_link (KzEmbed *kzembed, - KzEmbedNavLink link); + KzEmbedNavLink link); static void kz_gtk_webcore_set_nth_nav_link (KzEmbed *kzembed, - KzEmbedNavLink link, - KzNavi *navi, - guint n); + KzEmbedNavLink link, + KzNavi *navi, + guint n); static KzNavi *kz_gtk_webcore_get_nth_nav_link (KzEmbed *kzembed, - KzEmbedNavLink link, - guint n); + KzEmbedNavLink link, + guint n); static GList *kz_gtk_webcore_get_nav_links (KzEmbed *kzembed, - KzEmbedNavLink link); + KzEmbedNavLink link); +static void kz_gtk_webcore_shistory_get_nth (KzEmbed *kzembed, + int nth, + gboolean is_relative, + char **aUrl, + char **aTitle); + static gboolean kz_gtk_webcore_can_cut_selection (KzEmbed *kzembed); static gboolean kz_gtk_webcore_can_copy_selection (KzEmbed *kzembed); static gboolean kz_gtk_webcore_can_paste (KzEmbed *kzembed); @@ -127,12 +133,12 @@ static gint kz_gtk_webcore_get_text_size (KzEmbed *kzembed); static void kz_gtk_webcore_set_text_size (KzEmbed *kzembed, - gint zoom, - gboolean reflow); + gint zoom, + gboolean reflow); static gboolean kz_gtk_webcore_find (KzEmbed *kzembed, - const char *keyword, - gboolean backward); + const char *keyword, + gboolean backward); static gboolean kz_gtk_webcore_selection_is_collapsed (KzEmbed *kzembed); @@ -274,7 +280,7 @@ iface->copy_page = NULL; iface->shistory_copy = NULL; iface->shistory_get_pos = NULL; - iface->shistory_get_nth = NULL; + iface->shistory_get_nth = kz_gtk_webcore_shistory_get_nth; iface->reload = kz_gtk_webcore_reload; iface->stop_load = kz_gtk_webcore_stop_load; iface->go_back = kz_gtk_webcore_go_back; @@ -997,6 +1003,16 @@ } static void +kz_gtk_webcore_shistory_get_nth (KzEmbed *kzembed, + int nth, + gboolean is_relative, + char **aUrl, + char **aTitle) +{ + g_return_if_fail(KZ_IS_GTK_WEBCORE(kzembed)); +} + +static void kz_gtk_webcore_reload (KzEmbed *kzembed, KzEmbedReloadFlag flags) { g_return_if_fail(KZ_IS_GTK_WEBCORE(kzembed)); @@ -1128,7 +1144,7 @@ g_return_val_if_fail(KZ_IS_GTK_WEBCORE(kzembed), 100); - multiplier = webi_get_text_multiplier (WEBI(kzembed)); + multiplier = webi_get_text_multiplier(WEBI(kzembed)); if (multiplier == -1.0) return 100; @@ -1145,8 +1161,7 @@ multiplier = (gfloat)(zoom) / 100; - webi_set_text_multiplier (WEBI(kzembed), - multiplier); + webi_set_text_multiplier(WEBI(kzembed), multiplier); } @@ -1171,8 +1186,9 @@ kz_gtk_webcore_can_copy_selection (KzEmbed *kzembed) { g_return_val_if_fail(KZ_IS_GTK_WEBCORE(kzembed), FALSE); - /* not implemented yet */ - return FALSE; + + /* alwasy return TRUE */ + return TRUE; } static gboolean @@ -1187,28 +1203,30 @@ kz_gtk_webcore_cut_selection (KzEmbed *kzembed) { /* not implemented yet */ - return; } static void kz_gtk_webcore_copy_selection (KzEmbed *kzembed) { - /* not implemented yet */ - return; + gchar *selected; + selected = webi_get_current_selection_as_text(WEBI(kzembed)); + + if (selected) + g_free(selected); + + gtkutil_copy_text(selected); } static void kz_gtk_webcore_paste (KzEmbed *kzembed) { /* not implemented yet */ - return; } static void kz_gtk_webcore_select_all (KzEmbed *kzembed) { /* not implemented yet */ - return; } static gboolean