[epiphany] Get rid of EphyCommandManager



commit b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c
Author: Xan Lopez <xan gnome org>
Date:   Thu Sep 10 18:05:54 2009 +0300

    Get rid of EphyCommandManager
    
    It was just another useless abstraction at this point.

 doc/reference/epiphany-docs.sgml    |    1 -
 doc/reference/epiphany-sections.txt |   17 -----
 doc/reference/epiphany.types        |    2 -
 embed/Makefile.am                   |    2 -
 embed/ephy-command-manager.c        |  119 -----------------------------------
 embed/ephy-command-manager.h        |   67 --------------------
 embed/ephy-embed.c                  |   52 +---------------
 src/ephy-window.c                   |   19 +++---
 src/epiphany.h.in                   |    1 -
 src/window-commands.c               |   22 +++----
 10 files changed, 18 insertions(+), 284 deletions(-)
---
diff --git a/doc/reference/epiphany-docs.sgml b/doc/reference/epiphany-docs.sgml
index b412c17..86cc5fa 100644
--- a/doc/reference/epiphany-docs.sgml
+++ b/doc/reference/epiphany-docs.sgml
@@ -12,7 +12,6 @@
     <xi:include href="xml/ephy-window.xml"/>
     <xi:include href="xml/ephy-tab.xml"/>
     <xi:include href="xml/ephy-embed.xml"/>
-    <xi:include href="xml/ephy-command-manager.xml"/>
     <xi:include href="xml/ephy-embed-single.xml"/>
     <xi:include href="xml/ephy-embed-persist.xml"/>
     <xi:include href="xml/ephy-node-db.xml"/>
diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt
index 0c281b6..6e20466 100644
--- a/doc/reference/epiphany-sections.txt
+++ b/doc/reference/epiphany-sections.txt
@@ -145,23 +145,6 @@ EPHY_EMBED_PERSIST_GET_CLASS
 </SECTION>
 
 <SECTION>
-<FILE>ephy-command-manager</FILE>
-<TITLE>EphyCommandManager</TITLE>
-EphyCommandManager
-EphyCommandManagerIface
-ephy_command_manager_do_command
-ephy_command_manager_can_do_command
-<SUBSECTION Standard>
-EPHY_COMMAND_MANAGER
-EPHY_IS_COMMAND_MANAGER
-EPHY_TYPE_COMMAND_MANAGER
-ephy_command_manager_get_type
-EPHY_COMMAND_MANAGER_GET_IFACE
-EPHY_COMMAND_MANAGER_IFACE
-EPHY_IS_COMMAND_MANAGER_IFACE
-</SECTION>
-
-<SECTION>
 <FILE>ephy-node-db</FILE>
 <TITLE>EphyNodeDb</TITLE>
 EphyNodeDb
diff --git a/doc/reference/epiphany.types b/doc/reference/epiphany.types
index e696828..b67d2e1 100644
--- a/doc/reference/epiphany.types
+++ b/doc/reference/epiphany.types
@@ -20,7 +20,6 @@ ephy_zoom_control_get_type
 
 #include <ephy-embed.h>
 #include <downloader-view.h>
-#include <ephy-command-manager.h>
 #include <ephy-embed-dialog.h>
 #include <ephy-embed-event.h>
 #include <ephy-embed-persist.h>
@@ -29,7 +28,6 @@ ephy_zoom_control_get_type
 
 ephy_embed_get_type
 downloader_view_get_type
-ephy_command_manager_get_type
 ephy_embed_dialog_get_type
 ephy_embed_event_get_type
 ephy_embed_persist_get_type
diff --git a/embed/Makefile.am b/embed/Makefile.am
index c0001b8..5138043 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -16,7 +16,6 @@ NOINST_H_FILES = \
 INST_H_FILES = \
 	ephy-adblock.h			\
 	ephy-adblock-manager.h		\
-	ephy-command-manager.h		\
 	ephy-embed.h			\
 	ephy-embed-container.h          \
 	ephy-embed-event.h		\
@@ -38,7 +37,6 @@ libephyembed_la_SOURCES = \
 	ephy-adblock.c			\
 	ephy-adblock-manager.c		\
 	downloader-view.c		\
-	ephy-command-manager.c		\
 	ephy-embed.c			\
 	ephy-embed-container.c          \
 	ephy-embed-dialog.c		\
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index a773596..c1b4e33 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -28,7 +28,6 @@
 #include "downloader-view.h"
 #include "eel-gconf-extensions.h"
 #include "ephy-adblock-manager.h"
-#include "ephy-command-manager.h"
 #include "ephy-debug.h"
 #include "ephy-embed.h"
 #include "ephy-embed-event.h"
@@ -65,56 +64,7 @@ struct EphyEmbedPrivate
   guint is_setting_zoom : 1;
 };
 
-static void
-impl_manager_do_command (EphyCommandManager *manager,
-                         const char *command)
-{
-  WebKitWebView *web_view = EPHY_EMBED (manager)->priv->web_view;
-
-  if (! strcmp (command, "cmd_copy"))
-    return webkit_web_view_copy_clipboard (web_view);
-  else if (! strcmp (command, "cmd_cut"))
-    return webkit_web_view_cut_clipboard (web_view);
-  else if (! strcmp (command, "cmd_paste"))
-    return webkit_web_view_paste_clipboard (web_view);
-  else if (! strcmp (command, "cmd_selectAll"))
-    return webkit_web_view_select_all (web_view);
-  else if (! strcmp (command, "cmd_undo"))
-    return webkit_web_view_undo (web_view);
-  else if (! strcmp (command, "cmd_redo"))
-    return webkit_web_view_redo (web_view);
-}
-
-static gboolean
-impl_manager_can_do_command (EphyCommandManager *manager,
-                             const char *command)
-{
-  WebKitWebView *web_view = EPHY_EMBED (manager)->priv->web_view;
-
-  if (! strcmp (command, "cmd_copy"))
-    return webkit_web_view_can_copy_clipboard (web_view);
-  else if (! strcmp (command, "cmd_cut"))
-    return webkit_web_view_can_cut_clipboard (web_view);
-  else if (! strcmp (command, "cmd_paste"))
-    return webkit_web_view_can_paste_clipboard (web_view);
-  else if (! strcmp (command, "cmd_undo"))
-    return webkit_web_view_can_undo (web_view);
-  else if (! strcmp (command, "cmd_redo"))
-    return webkit_web_view_can_redo (web_view);
-
-  return FALSE;
-}
-
-static void
-ephy_command_manager_iface_init (EphyCommandManagerIface *iface)
-{
-  iface->do_command = impl_manager_do_command;
-  iface->can_do_command = impl_manager_can_do_command;
-}
-
-G_DEFINE_TYPE_WITH_CODE (EphyEmbed, ephy_embed, GTK_TYPE_SCROLLED_WINDOW,
-                         G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER,
-                                                ephy_command_manager_iface_init))
+G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_SCROLLED_WINDOW)
 
 static void
 uri_changed_cb (WebKitWebView *web_view,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d4d29c2..635a779 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -24,7 +24,6 @@
 #include "ephy-window.h"
 #include "ephy-type-builtins.h"
 #include "ephy-embed-type-builtins.h"
-#include "ephy-command-manager.h"
 #include "ephy-state.h"
 #include "ppview-toolbar.h"
 #include "window-commands.h"
@@ -1179,20 +1178,18 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
 	else
 	{
 		EphyEmbed *embed;
+		WebKitWebView *view;
 
 		embed = window->priv->active_embed;
 		g_return_if_fail (embed != NULL);
 
-		can_copy = ephy_command_manager_can_do_command
-				(EPHY_COMMAND_MANAGER (embed), "cmd_copy");
-		can_cut = ephy_command_manager_can_do_command
-				(EPHY_COMMAND_MANAGER (embed), "cmd_cut");
-		can_paste = ephy_command_manager_can_do_command
-				(EPHY_COMMAND_MANAGER (embed), "cmd_paste");
-		can_undo = ephy_command_manager_can_do_command
-				(EPHY_COMMAND_MANAGER (embed), "cmd_undo");
-		can_redo = ephy_command_manager_can_do_command
-				(EPHY_COMMAND_MANAGER (embed), "cmd_redo");
+		view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+		can_copy = webkit_web_view_can_copy_clipboard (view);
+		can_cut = webkit_web_view_can_cut_clipboard (view);
+		can_paste = webkit_web_view_can_paste_clipboard (view);
+		can_undo = webkit_web_view_can_undo (view);
+		can_redo = webkit_web_view_can_redo (view);
 	}
 
 	action_group = window->priv->action_group;
diff --git a/src/epiphany.h.in b/src/epiphany.h.in
index 7618782..656037a 100644
--- a/src/epiphany.h.in
+++ b/src/epiphany.h.in
@@ -37,7 +37,6 @@
 #include <epiphany/ephy-adblock-manager.h>
 #include <epiphany/ephy-bookmarks.h>
 #include <epiphany/ephy-bookmarks-type-builtins.h>
-#include <epiphany/ephy-command-manager.h>
 #include <epiphany/ephy-dialog.h>
 #include <epiphany/ephy-embed-container.h>
 #include <epiphany/ephy-embed-event.h>
diff --git a/src/window-commands.c b/src/window-commands.c
index c819ac5..e6790c7 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -28,7 +28,6 @@
 #include "ephy-shell.h"
 #include "ephy-embed-persist.h"
 #include "ephy-debug.h"
-#include "ephy-command-manager.h"
 #include "window-commands.h"
 #include "eel-gconf-extensions.h"
 #include "ephy-prefs.h"
@@ -376,8 +375,7 @@ window_cmd_edit_undo (GtkAction *action,
 
 		if (embed)
 		{
-			ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed), 
-							 "cmd_undo");
+			webkit_web_view_undo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 		}
 	}
 }
@@ -402,8 +400,7 @@ window_cmd_edit_redo (GtkAction *action,
 		embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED);
 		if (embed)
 		{
-			ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed), 
-							 "cmd_redo");
+			webkit_web_view_redo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 		}
 	}
 }
@@ -423,8 +420,7 @@ window_cmd_edit_cut (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
-		ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
-						 "cmd_cut");
+		webkit_web_view_cut_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 	}
 }
 
@@ -445,8 +441,7 @@ window_cmd_edit_copy (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
-		ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
-						 "cmd_copy");
+		webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 	}
 }
 
@@ -467,8 +462,7 @@ window_cmd_edit_paste (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
-		ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
-						 "cmd_paste");
+		webkit_web_view_paste_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 	}
 }
 
@@ -489,8 +483,11 @@ window_cmd_edit_delete (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
+		/* FIXME: TODO */
+#if 0
 		ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
 						 "cmd_delete");
+#endif
 	}
 }
 
@@ -512,8 +509,7 @@ window_cmd_edit_select_all (GtkAction *action,
                   (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
-		ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
-						 "cmd_selectAll");
+		webkit_web_view_select_all (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]