[epiphany] ephy-web-app-utils: do not use the webview in the web app creation method
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-web-app-utils: do not use the webview in the web app creation method
- Date: Wed, 28 Mar 2012 17:59:13 +0000 (UTC)
commit 233c86a85e63f00a246badabf1879569ad5d6ea6
Author: Alexandre Mazari <alexandre mazari gmail com>
Date: Wed Mar 28 19:56:43 2012 +0200
ephy-web-app-utils: do not use the webview in the web app creation method
It's not really needed, will allow to reuse this code during profile
migration.
https://bugzilla.gnome.org/show_bug.cgi?id=658925
embed/ephy-web-app-utils.c | 20 +++++++++-----------
embed/ephy-web-app-utils.h | 2 +-
src/window-commands.c | 2 +-
3 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c
index 6c3c4d3..0789f6e 100644
--- a/embed/ephy-web-app-utils.c
+++ b/embed/ephy-web-app-utils.c
@@ -182,7 +182,7 @@ out:
#define EPHY_TOOLBARS_XML_FILE "epiphany-toolbars-3.xml"
static char *
-create_desktop_file (EphyWebView *view,
+create_desktop_file (const char *address,
const char *profile_dir,
const char *title,
GdkPixbuf *icon)
@@ -208,7 +208,7 @@ create_desktop_file (EphyWebView *view,
g_key_file_set_value (file, "Desktop Entry", "Name", title);
exec_string = g_strdup_printf ("epiphany --application-mode --profile=\"%s\" %s",
profile_dir,
- webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)));
+ address);
g_key_file_set_value (file, "Desktop Entry", "Exec", exec_string);
g_free (exec_string);
g_key_file_set_value (file, "Desktop Entry", "StartupNotification", "true");
@@ -267,7 +267,7 @@ out:
}
static void
-create_cookie_jar_for_domain (EphyWebView *view, const char *directory)
+create_cookie_jar_for_domain (const char *address, const char *directory)
{
SoupSession *session;
GSList *cookies, *p;
@@ -281,7 +281,7 @@ create_cookie_jar_for_domain (EphyWebView *view, const char *directory)
g_free (filename);
/* The app domain for the current view */
- uri = soup_uri_new (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)));
+ uri = soup_uri_new (address);
domain = uri->host;
/* The current cookies */
@@ -304,23 +304,21 @@ create_cookie_jar_for_domain (EphyWebView *view, const char *directory)
/**
* ephy_web_application_create:
- * @view: an #EphyWebView
+ * @address: the address of the new web application
* @title: the title for the new web application
* @icon: the icon for the new web application
*
- * Creates a new Web Application from the currently loaded URI in the @view.
+ * Creates a new Web Application from the provided address.
*
* Returns: (transfer-full): the path to the desktop file representing the new application
**/
char *
-ephy_web_application_create (EphyWebView *view, const char *title, GdkPixbuf *icon)
+ephy_web_application_create (const char *address, const char *title, GdkPixbuf *icon)
{
char *profile_dir = NULL;
char *toolbar_path = NULL;
char *desktop_file_path = NULL;
- g_return_val_if_fail (EPHY_IS_WEB_VIEW (view), NULL);
-
/* If there's already a WebApp profile for the contents of this
* view, do nothing. */
profile_dir = ephy_web_application_get_profile_directory (title);
@@ -342,10 +340,10 @@ ephy_web_application_create (EphyWebView *view, const char *title, GdkPixbuf *ic
if (!g_file_set_contents (toolbar_path, EPHY_WEB_APP_TOOLBAR, -1, NULL))
goto out;
- create_cookie_jar_for_domain (view, profile_dir);
+ create_cookie_jar_for_domain (address, profile_dir);
/* Create the deskop file. */
- desktop_file_path = create_desktop_file (view, profile_dir, title, icon);
+ desktop_file_path = create_desktop_file (address, profile_dir, title, icon);
out:
if (toolbar_path)
diff --git a/embed/ephy-web-app-utils.h b/embed/ephy-web-app-utils.h
index 7c8a09f..b552da3 100644
--- a/embed/ephy-web-app-utils.h
+++ b/embed/ephy-web-app-utils.h
@@ -41,7 +41,7 @@ typedef struct {
#define EPHY_WEB_APP_PREFIX "app-"
#define EPHY_WEB_APP_ICON_NAME "app-icon.png"
-char *ephy_web_application_create (EphyWebView *view, const char *title, GdkPixbuf *icon);
+char *ephy_web_application_create (const char *address, const char *title, GdkPixbuf *icon);
gboolean ephy_web_application_delete (const char *name);
diff --git a/src/window-commands.c b/src/window-commands.c
index 70fc0cf..4c7c4b7 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -523,7 +523,7 @@ dialog_save_as_application_response_cb (GtkDialog *dialog,
}
/* Create Web Application, including a new profile and .desktop file. */
- desktop_file = ephy_web_application_create (data->view,
+ desktop_file = ephy_web_application_create (webkit_web_view_get_uri (data->view),
gtk_entry_get_text (GTK_ENTRY (data->entry)),
gtk_image_get_pixbuf (GTK_IMAGE (data->image)));
if (desktop_file)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]