[epiphany/peas: 4/7] src: dont abuse extension system



commit b5d4ae9113f76d5b1346def22d1696fa880dbd94
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sat Apr 2 12:56:09 2011 -0500

    src: dont abuse extension system

 src/ephy-lockdown.c |   19 ++++---------------
 src/ephy-lockdown.h |    5 +++++
 src/ephy-session.c  |   37 ++++++++-----------------------------
 src/ephy-session.h  |    6 ++++++
 src/ephy-shell.c    |    2 +-
 src/ephy-shell.h    |    2 ++
 6 files changed, 26 insertions(+), 45 deletions(-)
---
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 61aec8d..4cfae89 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -28,7 +28,6 @@
 #include "ephy-embed-utils.h"
 #include "ephy-web-view.h"
 #include "ephy-lockdown.h"
-#include "ephy-extension.h"
 #include "ephy-settings.h"
 #include "ephy-toolbar.h"
 #include "ephy-prefs.h"
@@ -40,7 +39,7 @@
 
 #define LOCKDOWN_FLAG 1 << 8
 
-static void ephy_lockdown_iface_init (EphyExtensionIface *iface);
+G_DEFINE_TYPE (EphyLockdown, ephy_lockdown, G_TYPE_OBJECT)
 
 static int
 find_name (GtkActionGroup *action_group,
@@ -210,9 +209,9 @@ bind_settings_and_actions (GSettings *settings,
 	}
 }
 
-static void
-impl_attach_window (EphyExtension *extension,
-		    EphyWindow *window)
+void
+ephy_lockdown_attach_window (EphyLockdown *lockdown,
+			     EphyWindow *window)
 {
 	GtkUIManager *manager;
 	GtkActionGroup *action_group;
@@ -272,16 +271,6 @@ ephy_lockdown_init (EphyLockdown *lockdown)
 	LOG ("EphyLockdown initialising");
 }
 
-G_DEFINE_TYPE_WITH_CODE (EphyLockdown, ephy_lockdown, G_TYPE_OBJECT,
-			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
-						ephy_lockdown_iface_init))
-
-static void
-ephy_lockdown_iface_init (EphyExtensionIface *iface)
-{
-	iface->attach_window = impl_attach_window;
-}
-
 static void
 ephy_lockdown_class_init (EphyLockdownClass *klass)
 {
diff --git a/src/ephy-lockdown.h b/src/ephy-lockdown.h
index 3fd9238..adb93a6 100644
--- a/src/ephy-lockdown.h
+++ b/src/ephy-lockdown.h
@@ -28,6 +28,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include "ephy-window.h"
+
 G_BEGIN_DECLS
 
 #define EPHY_TYPE_LOCKDOWN		(ephy_lockdown_get_type ())
@@ -56,6 +58,9 @@ struct _EphyLockdown
 
 GType	ephy_lockdown_get_type		(void);
 
+void	ephy_lockdown_attach_window	(EphyLockdown *lockdown,
+					 EphyWindow *window);
+
 G_END_DECLS
 
 #endif
diff --git a/src/ephy-session.c b/src/ephy-session.c
index acd48df..a869935 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -30,7 +30,6 @@
 #include "ephy-embed.h"
 #include "ephy-embed-utils.h"
 #include "ephy-embed-container.h"
-#include "ephy-extension.h"
 #include "ephy-file-helpers.h"
 #include "ephy-gui.h"
 #include "ephy-history-window.h"
@@ -83,20 +82,17 @@ struct _EphySessionPrivate
 #define SESSION_CRASHED		"type:session_crashed"
 
 static void ephy_session_class_init	(EphySessionClass *klass);
-static void ephy_session_iface_init	(EphyExtensionIface *iface);
 static void ephy_session_init		(EphySession *session);
 static void session_command_queue_next	(EphySession *session);
 
+G_DEFINE_TYPE (EphySession, ephy_session, G_TYPE_OBJECT)
+
 enum
 {
 	PROP_0,
 	PROP_ACTIVE_WINDOW
 };
 
-G_DEFINE_TYPE_WITH_CODE (EphySession, ephy_session, G_TYPE_OBJECT,
-			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
-						ephy_session_iface_init))
-
 /* Gnome session client */
 
 typedef struct
@@ -858,17 +854,12 @@ session_command_queue_clear (EphySession *session)
 	}
 }
 
-/* EphyExtensionIface implementation */
-
-static void
-impl_attach_window (EphyExtension *extension,
-		    EphyWindow *window)
+void
+ephy_session_attach_window (EphySession *session,
+			    EphyWindow *window)
 {
-	EphySession *session = EPHY_SESSION (extension);
 	GtkWidget *notebook;
 
-	LOG ("impl_attach_window");
-
 	session->priv->windows = g_list_append (session->priv->windows, window);
 	ephy_session_save (session, SESSION_CRASHED);
 
@@ -886,7 +877,6 @@ impl_attach_window (EphyExtension *extension,
 	/* Set unique identifier as role, so that on restore, the WM can
 	 * place the window on the right workspace
 	 */
-
 	if (gtk_window_get_role (GTK_WINDOW (window)) == NULL)
 	{
 		/* I guess rand() is unique enough, otherwise we could use
@@ -900,14 +890,10 @@ impl_attach_window (EphyExtension *extension,
 	}
 }
 
-static void
-impl_detach_window (EphyExtension *extension,
-		    EphyWindow *window)
+void
+ephy_session_detach_window (EphySession *session,
+			    EphyWindow *window)
 {
-	EphySession *session = EPHY_SESSION (extension);
-
-	LOG ("impl_detach_window");
-
 	session->priv->windows = g_list_remove (session->priv->windows, window);
 	ephy_session_save (session, SESSION_CRASHED);
 
@@ -982,13 +968,6 @@ ephy_session_finalize (GObject *object)
 }
 
 static void
-ephy_session_iface_init (EphyExtensionIface *iface)
-{
-	iface->attach_window = impl_attach_window;
-	iface->detach_window = impl_detach_window;
-}
-
-static void
 ephy_session_set_property (GObject *object,
 			   guint prop_id,
 			   const GValue *value,
diff --git a/src/ephy-session.h b/src/ephy-session.h
index 4dbb496..4d1935b 100644
--- a/src/ephy-session.h
+++ b/src/ephy-session.h
@@ -96,6 +96,12 @@ void		 ephy_session_queue_command	(EphySession *session,
 						 guint32 user_time,
 						 gboolean priority);
 
+void		ephy_session_attach_window      (EphySession *session,
+						 EphyWindow *window);
+
+void		ephy_session_detach_window      (EphySession *session,
+						 EphyWindow *window);
+
 G_END_DECLS
 
 #endif
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 6fddf9d..4759d32 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -545,7 +545,7 @@ ephy_shell_get_session (EphyShell *shell)
  *
  * Return value: the lockdown controller
  **/
-static GObject *
+GObject *
 ephy_shell_get_lockdown (EphyShell *shell)
 {
 	g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 895c91d..ed2ae3f 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -126,6 +126,8 @@ GObject        *ephy_shell_get_pdm_dialog		(EphyShell *shell);
 
 GObject        *ephy_shell_get_prefs_dialog		(EphyShell *shell);
 
+GObject	       *ephy_shell_get_lockdown			(EphyShell *shell);
+
 /* private API */
 void	       _ephy_shell_create_instance		(void);
 



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