diff options
author | Xan Lopez <xan@gnome.org> | 2009-09-10 23:05:54 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-09-10 23:05:54 +0800 |
commit | b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c (patch) | |
tree | 17ddf4e087e8ab7bff4c89cf24da8097ca693119 /embed | |
parent | b2dbd47c3f06203d4394c10599011734ad77ae32 (diff) | |
download | gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar.gz gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar.bz2 gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar.lz gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar.xz gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.tar.zst gsoc2013-epiphany-b93c0ee2b3db46db54b6ae45909fb8b5f54d9f4c.zip |
Get rid of EphyCommandManager
It was just another useless abstraction at this point.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/Makefile.am | 2 | ||||
-rw-r--r-- | embed/ephy-command-manager.c | 119 | ||||
-rw-r--r-- | embed/ephy-command-manager.h | 67 | ||||
-rw-r--r-- | embed/ephy-embed.c | 52 |
4 files changed, 1 insertions, 239 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am index c0001b846..51380435f 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-command-manager.c b/embed/ephy-command-manager.c deleted file mode 100644 index 33cb1babe..000000000 --- a/embed/ephy-command-manager.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright © 2000-2003 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include "ephy-command-manager.h" - -static void -ephy_command_manager_base_init (gpointer g_class); - -GType -ephy_command_manager_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - const GTypeInfo our_info = - { - sizeof (EphyCommandManagerIface), - ephy_command_manager_base_init, - NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "EphyCommandManager", - &our_info, - (GTypeFlags)0); - } - - return type; -} - -static void -ephy_command_manager_base_init (gpointer g_class) -{ - static gboolean initialized = FALSE; - - if (!initialized) - { -/** - * EphyCommandManager::command-changed: - * @manager: - * @command: The command whose avalability has changed - * - * The ::command-changed signal is emitted when @command has changed from being - * available to unavailable, or vice-versa. The new availability can be tested - * with ephy_command_manager_can_do_command(). - **/ - g_signal_new ("command_changed", - EPHY_TYPE_COMMAND_MANAGER, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EphyCommandManagerIface, command_changed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, - 1, - G_TYPE_STRING); - - initialized = TRUE; - } -} - -/** - * ephy_command_manager_do_command: - * @manager: an #EphyCommandManager - * @command: the command - * - * Performs @command. - **/ -void -ephy_command_manager_do_command (EphyCommandManager *manager, - const char *command) -{ - EphyCommandManagerIface *iface; - - g_return_if_fail (command != NULL); - - iface = EPHY_COMMAND_MANAGER_GET_IFACE (manager); - iface->do_command (manager, command); -} - -/** - * ephy_command_manager_can_do_command: - * @manager: an #EphyCommandManager - * @command: the command - * - * Returns %TRUE if @command can be performed. - * - * Return value: %TRUE if @command can be performed. - **/ -gboolean -ephy_command_manager_can_do_command (EphyCommandManager *manager, - const char *command) -{ - EphyCommandManagerIface *iface; - - g_return_val_if_fail (command != NULL, FALSE); - - iface = EPHY_COMMAND_MANAGER_GET_IFACE (manager); - - return iface->can_do_command (manager, command); -} diff --git a/embed/ephy-command-manager.h b/embed/ephy-command-manager.h deleted file mode 100644 index 2c087f7e5..000000000 --- a/embed/ephy-command-manager.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright © 2000-2003 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only <epiphany/epiphany.h> can be included directly." -#endif - -#ifndef EPHY_COMMAND_MANAGER_H -#define EPHY_COMMAND_MANAGER_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_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_COMMAND_MANAGER, EphyCommandManagerIface)) -#define EPHY_IS_COMMAND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_COMMAND_MANAGER)) -#define EPHY_IS_COMMAND_MANAGER_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_COMMAND_MANAGER)) -#define EPHY_COMMAND_MANAGER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_COMMAND_MANAGER, EphyCommandManagerIface)) - -typedef struct _EphyCommandManager EphyCommandManager; -typedef struct _EphyCommandManagerIface EphyCommandManagerIface; - -struct _EphyCommandManagerIface -{ - GTypeInterface base_iface; - - void (* do_command) (EphyCommandManager *manager, - const char *command); - gboolean (* can_do_command) (EphyCommandManager *manager, - const char *command); - - /* Signals */ - - void (* command_changed) (EphyCommandManager *manager, - char *command); -}; - -GType ephy_command_manager_get_type (void); - -void ephy_command_manager_do_command (EphyCommandManager *manager, - const char *command); - -gboolean ephy_command_manager_can_do_command (EphyCommandManager *manager, - const char *command); - -G_END_DECLS - -#endif diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index a773596a5..c1b4e3369 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, |