diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-10-25 23:15:35 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-10-25 23:15:35 +0800 |
commit | 38956a20d942387e3d5b839c4b962713bd60cdf0 (patch) | |
tree | 6ac41837526e3b5aab171741e0803ff87492a2ea | |
parent | 20602830fa6d28dd28cab60de0698ec523b1c6b9 (diff) | |
download | gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar.gz gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar.bz2 gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar.lz gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar.xz gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.tar.zst gsoc2013-epiphany-38956a20d942387e3d5b839c4b962713bd60cdf0.zip |
Interface for commands. Useful for undo. (cmd_undo works).
2003-10-25 Marco Pesenti Gritti <marco@gnome.org>
* embed/Makefile.am:
* embed/ephy-command-manager.c: (ephy_command_manager_get_type),
(ephy_command_manager_base_init),
(ephy_command_manager_do_command),
(ephy_command_manager_can_do_command),
(ephy_command_manager_observe_command):
* embed/ephy-command-manager.h:
Interface for commands. Useful for undo. (cmd_undo works).
* embed/ephy-embed.c:
* embed/ephy-embed.h:
Remove all clipboard calls.
* embed/mozilla/EphyWrapper.cpp:
* embed/mozilla/EphyWrapper.h:
* embed/mozilla/Makefile.am:
* embed/mozilla/mozilla-embed.cpp:
Implement part of the commands interface.
No regressions.
* src/window-commands.c: (window_cmd_edit_cut),
(window_cmd_edit_copy), (window_cmd_edit_paste),
(window_cmd_edit_select_all):
Implement clipboard using commands.
-rw-r--r-- | ChangeLog | 31 | ||||
-rw-r--r-- | embed/Makefile.am | 2 | ||||
-rw-r--r-- | embed/ephy-command-manager.c | 104 | ||||
-rw-r--r-- | embed/ephy-command-manager.h | 69 | ||||
-rw-r--r-- | embed/ephy-embed.c | 49 | ||||
-rw-r--r-- | embed/ephy-embed.h | 22 | ||||
-rw-r--r-- | embed/mozilla/EphyWrapper.cpp | 53 | ||||
-rw-r--r-- | embed/mozilla/EphyWrapper.h | 16 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 1 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 179 |
10 files changed, 273 insertions, 253 deletions
@@ -1,3 +1,34 @@ +2003-10-25 Marco Pesenti Gritti <marco@gnome.org> + + * embed/Makefile.am: + * embed/ephy-command-manager.c: (ephy_command_manager_get_type), + (ephy_command_manager_base_init), + (ephy_command_manager_do_command), + (ephy_command_manager_can_do_command), + (ephy_command_manager_observe_command): + * embed/ephy-command-manager.h: + + Interface for commands. Useful for undo. (cmd_undo works). + + * embed/ephy-embed.c: + * embed/ephy-embed.h: + + Remove all clipboard calls. + + * embed/mozilla/EphyWrapper.cpp: + * embed/mozilla/EphyWrapper.h: + * embed/mozilla/Makefile.am: + * embed/mozilla/mozilla-embed.cpp: + + Implement part of the commands interface. + No regressions. + + * src/window-commands.c: (window_cmd_edit_cut), + (window_cmd_edit_copy), (window_cmd_edit_paste), + (window_cmd_edit_select_all): + + Implement clipboard using commands. + 2003-10-25 Xan Lopez <xan@masilla.org> * embed/downloader-view.c: (downloader_view_build_ui), diff --git a/embed/Makefile.am b/embed/Makefile.am index 35d86aea8..36fc9f247 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -29,6 +29,7 @@ NOINST_H_FILES = \ print-dialog.h INST_H_FILES = \ + ephy-command-manager.h \ ephy-embed.h \ ephy-embed-event.h \ ephy-embed-persist.h \ @@ -41,6 +42,7 @@ INST_H_FILES = \ libephyembed_la_SOURCES = \ downloader-view.c \ + ephy-command-manager.c \ ephy-download.c \ ephy-embed.c \ ephy-embed-dialog.c \ diff --git a/embed/ephy-command-manager.c b/embed/ephy-command-manager.c new file mode 100644 index 000000000..ab4ccdace --- /dev/null +++ b/embed/ephy-command-manager.c @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti + * + * 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "ephy-command-manager.h" + +enum +{ + COMMAND_CHANGED, + LAST_SIGNAL +}; + +static void +ephy_command_manager_base_init (gpointer base_class); + +static guint ephy_command_manager_signals[LAST_SIGNAL] = { 0 }; + +GType +ephy_command_manager_get_type (void) +{ + static GType ephy_command_manager_type = 0; + + if (ephy_command_manager_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (EphyCommandManagerClass), + ephy_command_manager_base_init, + NULL, + }; + + ephy_command_manager_type = g_type_register_static (G_TYPE_INTERFACE, + "EphyCommandManager", + &our_info, + (GTypeFlags)0); + } + + return ephy_command_manager_type; +} + +static void +ephy_command_manager_base_init (gpointer g_class) +{ + static gboolean initialized = FALSE; + + if (!initialized) + { + ephy_command_manager_signals[COMMAND_CHANGED] = + g_signal_new ("command_changed", + EPHY_TYPE_COMMAND_MANAGER, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EphyCommandManagerClass, command_changed), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + initialized = TRUE; + } +} + +gresult +ephy_command_manager_do_command (EphyCommandManager *manager, + const char *command) +{ + EphyCommandManagerClass *klass = EPHY_COMMAND_MANAGER_GET_CLASS (manager); + return klass->do_command (manager, command); +} + +gresult +ephy_command_manager_can_do_command (EphyCommandManager *manager, + const char *command) +{ + EphyCommandManagerClass *klass = EPHY_COMMAND_MANAGER_GET_CLASS (manager); + return klass->can_do_command (manager, command); +} + +gresult +ephy_command_manager_observe_command (EphyCommandManager *manager, + const char *command) +{ + EphyCommandManagerClass *klass = EPHY_COMMAND_MANAGER_GET_CLASS (manager); + return klass->observe_command (manager, command); +} diff --git a/embed/ephy-command-manager.h b/embed/ephy-command-manager.h new file mode 100644 index 000000000..043d2c90d --- /dev/null +++ b/embed/ephy-command-manager.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti + * + * 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 EPHY_COMMAND_MANAGER_H +#define EPHY_COMMAND_MANAGER_H + +#include "ephy-embed-types.h" + +#include <glib-object.h> +#include <glib.h> + +G_BEGIN_DECLS + +#define EPHY_TYPE_COMMAND_MANAGER (ephy_command_manager_get_type ()) +#define EPHY_COMMAND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_COMMAND_MANAGER, EphyCommandManager)) +#define EPHY_COMMAND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_COMMAND_MANAGER, EphyCommandManagerClass)) +#define EPHY_IS_COMMAND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_COMMAND_MANAGER)) +#define EPHY_IS_COMMAND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_COMMAND_MANAGER)) +#define EPHY_COMMAND_MANAGER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_COMMAND_MANAGER, EphyCommandManagerClass)) + +typedef struct EphyCommandManagerClass EphyCommandManagerClass; +typedef struct _EphyCommandManager EphyCommandManager; + +struct EphyCommandManagerClass +{ + GTypeInterface base_iface; + + gresult (* do_command) (EphyCommandManager *manager, + const char *command); + gresult (* can_do_command) (EphyCommandManager *manager, + const char *command); + gresult (* observe_command) (EphyCommandManager *manager, + const char *command); + + /* Signals */ + + void (* command_changed) (EphyCommandManager *manager, + char *command); +}; + +GType ephy_command_manager_get_type (void); + +gresult ephy_command_manager_do_command (EphyCommandManager *manager, + const char *command); + +gresult ephy_command_manager_can_do_command (EphyCommandManager *manager, + const char *command); + +gresult ephy_command_manager_observe_command (EphyCommandManager *manager, + const char *command); + +G_END_DECLS + +#endif diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 4bc9de42e..c40ec74c4 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -441,55 +441,6 @@ ephy_embed_zoom_get (EphyEmbed *embed, } gresult -ephy_embed_selection_can_cut (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->selection_can_cut (embed); -} - -gresult -ephy_embed_selection_can_copy (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->selection_can_copy (embed); -} - -gresult -ephy_embed_can_paste (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->can_paste (embed); -} - -gresult -ephy_embed_select_all (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->select_all (embed); -} - -gresult -ephy_embed_selection_cut (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->selection_cut (embed); -} - -gresult -ephy_embed_selection_copy (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->selection_copy (embed); -} - -gresult -ephy_embed_paste (EphyEmbed *embed) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); - return klass->paste (embed); -} - -gresult ephy_embed_shistory_count (EphyEmbed *embed, int *count) { diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 811fa91e6..66678e404 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -231,13 +231,6 @@ struct EphyEmbedClass gboolean reflow); gresult (* zoom_get) (EphyEmbed *embed, float *zoom); - gresult (* selection_can_cut) (EphyEmbed *embed); - gresult (* selection_can_copy) (EphyEmbed *embed); - gresult (* can_paste) (EphyEmbed *embed); - gresult (* selection_cut) (EphyEmbed *embed); - gresult (* selection_copy) (EphyEmbed *embed); - gresult (* paste) (EphyEmbed *embed); - gresult (* select_all) (EphyEmbed *embed); gresult (* shistory_count) (EphyEmbed *embed, int *count); gresult (* shistory_get_nth) (EphyEmbed *embed, @@ -342,21 +335,6 @@ gresult ephy_embed_zoom_set (EphyEmbed *embed, gresult ephy_embed_zoom_get (EphyEmbed *embed, float *zoom); -/* Clipboard */ -gresult ephy_embed_selection_can_cut (EphyEmbed *embed); - -gresult ephy_embed_selection_can_copy (EphyEmbed *embed); - -gresult ephy_embed_can_paste (EphyEmbed *embed); - -gresult ephy_embed_selection_cut (EphyEmbed *embed); - -gresult ephy_embed_selection_copy (EphyEmbed *embed); - -gresult ephy_embed_paste (EphyEmbed *embed); - -gresult ephy_embed_select_all (EphyEmbed *embed); - /* Session history */ gresult ephy_embed_shistory_count (EphyEmbed *embed, int *count); diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp index 5cb399201..bea527fe2 100644 --- a/embed/mozilla/EphyWrapper.cpp +++ b/embed/mozilla/EphyWrapper.cpp @@ -30,6 +30,7 @@ #include <gtkmozembed_internal.h> #include <unistd.h> +#include "nsICommandManager.h" #include "nsIContentViewer.h" #include "nsIGlobalHistory.h" #include "nsIDocShellHistory.h" @@ -51,7 +52,6 @@ #include "nsCWebBrowserPersist.h" #include "nsNetUtil.h" #include "nsIChromeEventHandler.h" -#include "nsIClipboardCommands.h" #include "nsIDOMDocumentStyle.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" @@ -712,48 +712,6 @@ nsresult EphyWrapper::ForceEncoding (const char *encoding) return result; } -nsresult EphyWrapper::CanCutSelection(PRBool *result) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->CanCutSelection (result); -} - -nsresult EphyWrapper::CanCopySelection(PRBool *result) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->CanCopySelection (result); -} - -nsresult EphyWrapper::CanPaste(PRBool *result) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->CanPaste (result); -} - -nsresult EphyWrapper::CutSelection(void) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->CutSelection (); -} - -nsresult EphyWrapper::CopySelection(void) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->CopySelection (); -} - -nsresult EphyWrapper::Paste(void) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->Paste (); -} - -nsresult EphyWrapper::SelectAll (void) -{ - nsCOMPtr<nsIClipboardCommands> clipboard (do_GetInterface(mWebBrowser)); - return clipboard->SelectAll (); -} - nsresult EphyWrapper::PushTargetDocument (nsIDOMDocument *domDoc) { mTargetDocument = domDoc; @@ -894,3 +852,12 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr) return NS_OK; } + +nsresult EphyWrapper::DoCommand (const char *command) +{ + nsCOMPtr<nsICommandManager> cmdManager; + cmdManager = do_GetInterface (mWebBrowser); + if (!cmdManager) return NS_ERROR_FAILURE; + + return cmdManager->DoCommand (command, nsnull, nsnull); +} diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h index 64cf99026..3867d053d 100644 --- a/embed/mozilla/EphyWrapper.h +++ b/embed/mozilla/EphyWrapper.h @@ -48,6 +48,8 @@ public: nsresult Init (GtkMozEmbed *mozembed); nsresult Destroy (void); + nsresult DoCommand (const char *command); + nsresult SetZoom (float aTextZoom, PRBool reflow); nsresult GetZoom (float *aTextZoom); @@ -81,22 +83,8 @@ public: nsresult GetEncodingInfo (EphyEncodingInfo **infoptr); - nsresult CanCutSelection(PRBool *result); - - nsresult CanCopySelection(PRBool *result); - - nsresult CanPaste(PRBool *result); - - nsresult CutSelection(void); - - nsresult CopySelection(void); - - nsresult Paste(void); - nsresult GetMainDOMDocument (nsIDOMDocument **aDOMDocument); - nsresult SelectAll (void); - nsresult PushTargetDocument (nsIDOMDocument *domDoc); nsresult PopTargetDocument (); diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index b31e1c6e2..9f80eb1c1 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -10,6 +10,7 @@ INCLUDES = \ -I$(MOZILLA_INCLUDE_ROOT)/chrome \ -I$(MOZILLA_INCLUDE_ROOT)/content \ -I$(MOZILLA_INCLUDE_ROOT)/cookie \ + -I$(MOZILLA_INCLUDE_ROOT)/commandhandler \ -I$(MOZILLA_INCLUDE_ROOT)/docshell \ -I$(MOZILLA_INCLUDE_ROOT)/dom \ -I$(MOZILLA_INCLUDE_ROOT)/exthandler \ diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index e00738e4f..defa2fc12 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -18,8 +18,7 @@ * $Id$ */ -#include "gtkmozembed.h" -#include "gtkmozembed_internal.h" +#include "ephy-command-manager.h" #include "ephy-string.h" #include "ephy-embed.h" #include "ephy-debug.h" @@ -29,6 +28,8 @@ #include "EventContext.h" #include "ephy-debug.h" +#include <gtkmozembed.h> +#include <gtkmozembed_internal.h> #include <nsIWindowWatcher.h> #include <nsIURI.h> #include <nsIURL.h> @@ -108,20 +109,6 @@ impl_zoom_set (EphyEmbed *embed, static gresult impl_zoom_get (EphyEmbed *embed, float *zoom); -static gresult -impl_selection_can_cut (EphyEmbed *embed); -static gresult -impl_selection_can_copy (EphyEmbed *embed); -static gresult -impl_can_paste (EphyEmbed *embed); -static gresult -impl_select_all (EphyEmbed *embed); -static gresult -impl_selection_cut (EphyEmbed *embed); -static gresult -impl_selection_copy (EphyEmbed *embed); -static gresult -impl_paste (EphyEmbed *embed); static gresult impl_shistory_count (EphyEmbed *embed, int *count); @@ -256,6 +243,43 @@ static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); static GObjectClass *parent_class = NULL; +static gresult +impl_manager_do_command (EphyCommandManager *manager, + const char *command) +{ + nsresult result = NS_OK; + EphyWrapper *wrapper; + + wrapper = MOZILLA_EMBED(manager)->priv->wrapper; + g_return_val_if_fail (wrapper != NULL, G_FAILED); + + result = wrapper->DoCommand (command); + + return result ? G_OK : G_FAILED; +} + +static gresult +impl_manager_can_do_command (EphyCommandManager *manager, + const char *command) +{ + return G_NOT_IMPLEMENTED; +} + +static gresult +impl_manager_observe_command (EphyCommandManager *manager, + const char *command) +{ + return G_NOT_IMPLEMENTED; +} + +static void +ephy_command_manager_init (EphyCommandManagerClass *manager_class) +{ + manager_class->do_command = impl_manager_do_command; + manager_class->can_do_command = impl_manager_can_do_command; + manager_class->observe_command = impl_manager_observe_command; +} + GType mozilla_embed_get_type (void) { @@ -278,11 +302,18 @@ mozilla_embed_get_type (void) static const GInterfaceInfo embed_info = { - (GInterfaceInitFunc) ephy_embed_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ + (GInterfaceInitFunc) ephy_embed_init, + NULL, + NULL + }; + + static const GInterfaceInfo ephy_command_manager_info = + { + (GInterfaceInitFunc) ephy_command_manager_init, + NULL, + NULL }; - + mozilla_embed_type = g_type_register_static (GTK_TYPE_MOZ_EMBED, "MozillaEmbed", &our_info, @@ -290,6 +321,9 @@ mozilla_embed_get_type (void) g_type_add_interface_static (mozilla_embed_type, EPHY_TYPE_EMBED, &embed_info); + g_type_add_interface_static (mozilla_embed_type, + EPHY_TYPE_COMMAND_MANAGER, + &ephy_command_manager_info); } return mozilla_embed_type; @@ -364,12 +398,6 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->copy_page = impl_copy_page; embed_class->zoom_set = impl_zoom_set; embed_class->zoom_get = impl_zoom_get; - embed_class->selection_can_cut = impl_selection_can_cut; - embed_class->selection_can_copy = impl_selection_can_copy; - embed_class->can_paste = impl_can_paste; - embed_class->selection_cut = impl_selection_cut; - embed_class->selection_copy = impl_selection_copy; - embed_class->paste = impl_paste; embed_class->shistory_count = impl_shistory_count; embed_class->shistory_get_nth = impl_shistory_get_nth; embed_class->shistory_get_pos = impl_shistory_get_pos; @@ -381,7 +409,6 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->find_set_properties = impl_find_set_properties; embed_class->set_encoding = impl_set_encoding; embed_class->get_encoding_info = impl_get_encoding_info; - embed_class->select_all = impl_select_all; embed_class->print = impl_print; embed_class->print_preview_close = impl_print_preview_close; embed_class->print_preview_num_pages = impl_print_preview_num_pages; @@ -860,104 +887,6 @@ impl_zoom_get (EphyEmbed *embed, } } -static gresult -impl_selection_can_cut (EphyEmbed *embed) -{ - gboolean result; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - wrapper->CanCutSelection (&result); - - return result ? G_OK : G_FAILED; -} - -static gresult -impl_selection_can_copy (EphyEmbed *embed) -{ - gboolean result; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - wrapper->CanCopySelection (&result); - - return result ? G_OK : G_FAILED; -} - -static gresult -impl_can_paste (EphyEmbed *embed) -{ - gboolean result; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - wrapper->CanPaste (&result); - - return result ? G_OK : G_FAILED; -} - -static gresult -impl_select_all (EphyEmbed *embed) -{ - nsresult result; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - result = wrapper->SelectAll (); - - return result ? G_OK : G_FAILED; -} - -static gresult -impl_selection_cut (EphyEmbed *embed) -{ - nsresult rv; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - rv = wrapper->CutSelection (); - - return NS_SUCCEEDED(rv) ? G_OK : G_FAILED; -} - -static gresult -impl_selection_copy (EphyEmbed *embed) -{ - nsresult rv; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - rv = wrapper->CopySelection (); - - return NS_SUCCEEDED(rv) ? G_OK : G_FAILED; -} - -static gresult -impl_paste (EphyEmbed *embed) -{ - nsresult rv; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - rv = wrapper->Paste (); - - return NS_SUCCEEDED(rv) ? G_OK : G_FAILED; -} - static gresult impl_shistory_count (EphyEmbed *embed, int *count) |