Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-05-21 12:48:33 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-05-21 12:48:33 (GMT)
commitd12924c8d523bccd11954b5a524da50998b4826b (patch)
treee84d1cb3ee6955f1a56649d75368af46fd25901e /src
parente4a8e189e7cf25236ffebc72ac8d7bed6893b70d (diff)
Split functions out of WebView
Diffstat (limited to 'src')
-rw-r--r--src/hulahop-web-view.cpp48
-rw-r--r--src/hulahop-web-view.h5
-rw-r--r--src/hulahop.cpp69
-rw-r--r--src/hulahop.h34
4 files changed, 103 insertions, 53 deletions
diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp
index c3f40af..1ee6da4 100644
--- a/src/hulahop-web-view.cpp
+++ b/src/hulahop-web-view.cpp
@@ -24,16 +24,13 @@
#include <nsIWebBrowserFocus.h>
#include <nsIDOMWindow2.h>
#include <nsIDOMEventTarget.h>
-#include <nsILocalFile.h>
#include <nsIBaseWindow.h>
-#include <nsXULAppAPI.h>
#include <PyXPCOM.h>
#include <gtk/gtkfixed.h>
#include <gtk/gtkwindow.h>
#include "hulahop-web-view.h"
-#include "HulahopDirectoryProvider.h"
struct _HulahopWebView {
GtkBin base_instance;
@@ -53,51 +50,6 @@ G_DEFINE_TYPE(HulahopWebView, hulahop_web_view, GTK_TYPE_BIN)
static GObjectClass *parent_class = NULL;
-static HulahopDirectoryProvider kDirectoryProvider;
-
-gboolean
-hulahop_startup()
-{
- nsresult rv;
-
- nsCOMPtr<nsILocalFile> greDir;
- rv = NS_NewNativeLocalFile(nsCString(MOZILLA_HOME), PR_TRUE,
- getter_AddRefs(greDir));
- NS_ENSURE_SUCCESS(rv, FALSE);
-
- nsCOMPtr<nsILocalFile> binDir;
- rv = NS_NewNativeLocalFile(nsCString(MOZILLA_HOME"/components"), PR_TRUE,
- getter_AddRefs(binDir));
- NS_ENSURE_SUCCESS(rv, FALSE);
-
- rv = XRE_InitEmbedding(greDir, binDir,
- NS_CONST_CAST(HulahopDirectoryProvider *,
- &kDirectoryProvider), nsnull, 0);
- NS_ENSURE_SUCCESS(rv, FALSE);
-
- XRE_NotifyProfile();
-
- return TRUE;
-}
-
-void
-hulahop_shutdown()
-{
- XRE_TermEmbedding();
-}
-
-void
-hulahop_set_profile_path(const char *path)
-{
- kDirectoryProvider.SetProfilePath(path);
-}
-
-void
-hulahop_add_components_path(const char *path)
-{
- kDirectoryProvider.AddComponentsPath(path);
-}
-
static gboolean
child_focus_in_cb(GtkWidget *widget,
GdkEventFocus *event,
diff --git a/src/hulahop-web-view.h b/src/hulahop-web-view.h
index 28b44a3..e47431b 100644
--- a/src/hulahop-web-view.h
+++ b/src/hulahop-web-view.h
@@ -35,11 +35,6 @@ typedef struct _HulahopWebViewClass HulahopWebViewClass;
#define HULAHOP_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), HULAHOP_TYPE_WEB_VIEW))
#define HULAHOP_WEB_VIEW_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), HULAHOP_TYPE_WEB_VIEW, HulahopWebViewClass))
-gboolean hulahop_startup (void);
-void hulahop_shutdown (void);
-void hulahop_set_profile_path (const char *path);
-void hulahop_add_components_path (const char *path);
-
GType hulahop_web_view_get_type (void);
PyObject *hulahop_web_view_get_browser (HulahopWebView *web_view);
PyObject *hulahop_web_view_get_window_root (HulahopWebView *web_view);
diff --git a/src/hulahop.cpp b/src/hulahop.cpp
new file mode 100644
index 0000000..8bdb572
--- /dev/null
+++ b/src/hulahop.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2007, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <nsCOMPtr.h>
+#include <nsILocalFile.h>
+#include <nsXULAppAPI.h>
+
+#include "HulahopDirectoryProvider.h"
+
+static HulahopDirectoryProvider kDirectoryProvider;
+
+gboolean
+hulahop_startup()
+{
+ nsresult rv;
+
+ nsCOMPtr<nsILocalFile> greDir;
+ rv = NS_NewNativeLocalFile(nsCString(MOZILLA_HOME), PR_TRUE,
+ getter_AddRefs(greDir));
+ NS_ENSURE_SUCCESS(rv, FALSE);
+
+ nsCOMPtr<nsILocalFile> binDir;
+ rv = NS_NewNativeLocalFile(nsCString(MOZILLA_HOME"/components"), PR_TRUE,
+ getter_AddRefs(binDir));
+ NS_ENSURE_SUCCESS(rv, FALSE);
+
+ rv = XRE_InitEmbedding(greDir, binDir,
+ NS_CONST_CAST(HulahopDirectoryProvider *,
+ &kDirectoryProvider), nsnull, 0);
+ NS_ENSURE_SUCCESS(rv, FALSE);
+
+ XRE_NotifyProfile();
+
+ return TRUE;
+}
+
+void
+hulahop_shutdown()
+{
+ XRE_TermEmbedding();
+}
+
+void
+hulahop_set_profile_path(const char *path)
+{
+ kDirectoryProvider.SetProfilePath(path);
+}
+
+void
+hulahop_add_components_path(const char *path)
+{
+ kDirectoryProvider.AddComponentsPath(path);
+}
diff --git a/src/hulahop.h b/src/hulahop.h
new file mode 100644
index 0000000..b678d7e
--- /dev/null
+++ b/src/hulahop.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __HULAHOP_H__
+#define __HULAHOP_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean hulahop_startup (void);
+void hulahop_shutdown (void);
+void hulahop_set_profile_path (const char *path);
+void hulahop_add_components_path (const char *path);
+
+G_END_DECLS
+
+#endif