From 4c65f49d942e219d04afa1a8728fa60915618e9f Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 23 Jan 2006 22:08:10 +0000 Subject: Removed add-bookmark and import-bookmarks functions, and changed load-url 2006-01-23 Christian Persch * data/epiphany-service.xml: * src/ephy-activation.c: (ephy_activation_load_url), (ephy_activation_open_bookmarks_editor): * src/ephy-activation.h: Removed add-bookmark and import-bookmarks functions, and changed load-url to use an options string instead of loads of booleans. * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls), (call_dbus_proxy): Adapt to changed dbus call signatures. Fixes open-in-new-tab/window from cmd line. --- ChangeLog | 17 ++++++++++++ data/epiphany-service.xml | 10 +------ src/ephy-activation.c | 71 +++++++++++++---------------------------------- src/ephy-activation.h | 17 ++---------- src/ephy-dbus.c | 2 ++ src/ephy-main.c | 52 +++++++++++++++++++--------------- 6 files changed, 73 insertions(+), 96 deletions(-) diff --git a/ChangeLog b/ChangeLog index ced1b3ddc..3198012ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-01-23 Christian Persch + + * data/epiphany-service.xml: + * src/ephy-activation.c: (ephy_activation_load_url), + (ephy_activation_open_bookmarks_editor): + * src/ephy-activation.h: + + Removed add-bookmark and import-bookmarks functions, + and changed load-url to use an options string instead of + loads of booleans. + + * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls), + (call_dbus_proxy): + + Adapt to changed dbus call signatures. + Fixes open-in-new-tab/window from cmd line. + 2006-01-23 Christian Persch * embed/mozilla/MozDownload.cpp: diff --git a/data/epiphany-service.xml b/data/epiphany-service.xml index 2e21799a9..e5fb0b44d 100644 --- a/data/epiphany-service.xml +++ b/data/epiphany-service.xml @@ -7,19 +7,11 @@ - - - + - - - - - - diff --git a/src/ephy-activation.c b/src/ephy-activation.c index b677a09b6..f56b5018e 100644 --- a/src/ephy-activation.c +++ b/src/ephy-activation.c @@ -15,24 +15,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: + * $Id$ */ +#include "config.h" + #include "ephy-activation.h" -#include "ephy-debug.h" + #include "ephy-shell.h" #include "ephy-session.h" -#include "ephy-bookmarks-import.h" -#include "eel-gconf-extensions.h" #include "ephy-prefs.h" #include "ephy-gui.h" +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" + +#include gboolean ephy_activation_load_url (EphyDbus *ephy_dbus, char *url, - gboolean fullscreen, - gboolean open_in_existing_tab, - gboolean open_in_new_tab, + char *options, guint startup_id) { EphyNewTabFlags flags = 0; @@ -40,8 +42,10 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, EphySession *session; guint32 user_time = (guint32) startup_id; + g_return_val_if_fail (url != NULL && options != NULL, TRUE); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); - g_return_val_if_fail (session != NULL, FALSE); + g_return_val_if_fail (session != NULL, TRUE); if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) { @@ -50,6 +54,7 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, window = ephy_session_get_active_window (session); +#if 0 if (open_in_existing_tab && window != NULL) { ephy_gui_window_update_user_time (GTK_WIDGET (window), @@ -57,8 +62,9 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, ephy_window_load_url (window, url); return TRUE; } +#endif - if (*url == '\0') + if (url[0] == '\0') { flags |= EPHY_NEW_TAB_HOME_PAGE; } @@ -67,19 +73,15 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, flags |= EPHY_NEW_TAB_OPEN_PAGE; } - if (open_in_new_tab) - { - flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | - EPHY_NEW_TAB_JUMP; - } - else + if (strstr (options, "new-window") != NULL) { + window = NULL; flags |= EPHY_NEW_TAB_IN_NEW_WINDOW; } - - if (fullscreen) + else if (strstr (options, "new-tab") != NULL) { - flags |= EPHY_NEW_TAB_FULLSCREEN_MODE; + flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | + EPHY_NEW_TAB_JUMP; } ephy_shell_new_tab_full (ephy_shell, window, NULL, url, flags, @@ -88,24 +90,6 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, return TRUE; } -gboolean -ephy_activation_add_bookmark (EphyDbus *ephy_dbus, - char *url) -{ - ephy_bookmarks_add (ephy_shell_get_bookmarks (ephy_shell), - url /* title */, url); - return TRUE; -} - -gboolean -ephy_activation_import_bookmarks (EphyDbus *ephy_dbus, - char *filename) -{ - ephy_bookmarks_import (ephy_shell_get_bookmarks (ephy_shell), - filename); - return TRUE; -} - gboolean ephy_activation_load_session (EphyDbus *ephy_dbus, char *session_name, @@ -136,18 +120,3 @@ ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus, gtk_window_present (GTK_WINDOW (editor)); return TRUE; } - - -void -ephy_activation_general_purpose_reply (DBusGProxy *proxy, - GError *error, - gpointer user_data) -{ - g_object_unref (proxy); - if (error != NULL) - { - g_warning ("An error occured while calling remote method: %s", error->message); - g_error_free (error); - return; - } -} diff --git a/src/ephy-activation.h b/src/ephy-activation.h index 4e701e57a..0776a919f 100644 --- a/src/ephy-activation.h +++ b/src/ephy-activation.h @@ -14,6 +14,8 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifndef EPHY_ACTIVATION_H @@ -26,17 +28,9 @@ G_BEGIN_DECLS /* activation handlers */ gboolean ephy_activation_load_url (EphyDbus *ephy_dbus, char *url, - gboolean fullscreen, - gboolean open_in_existing_tab, - gboolean open_in_new_tab, + char *options, guint startup_id); -gboolean ephy_activation_add_bookmark (EphyDbus *ephy_dbus, - char *url); - -gboolean ephy_activation_import_bookmarks (EphyDbus *ephy_dbus, - char *filename); - gboolean ephy_activation_load_session (EphyDbus *ephy_dbus, char *session_name, guint user_time, @@ -45,11 +39,6 @@ gboolean ephy_activation_load_session (EphyDbus *ephy_dbus, gboolean ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus, guint user_time); -/* async reply handlers */ -void ephy_activation_general_purpose_reply (DBusGProxy *proxy, - GError *error, - gpointer user_data); - G_END_DECLS #endif diff --git a/src/ephy-dbus.c b/src/ephy-dbus.c index d01417837..ea33a076b 100644 --- a/src/ephy-dbus.c +++ b/src/ephy-dbus.c @@ -14,6 +14,8 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include "config.h" diff --git a/src/ephy-main.c b/src/ephy-main.c index 88444dae0..7f861f20f 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -337,23 +337,46 @@ path_from_command_line_arg (const char *arg) } #endif +static void +unref_proxy_reply_cb (DBusGProxy *proxy, + GError *error, + gpointer user_data) +{ + if (error != NULL) + { + g_warning ("An error occured while calling remote method: %s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); +} + static gboolean open_urls (DBusGProxy *proxy, guint32 user_time, GError **error) { EphyShell *shell; + const char *options = "new-window"; int i; shell = ephy_shell_get_default (); + if (open_in_new_window) + { + options = "new-window"; + } + else if (open_in_new_tab) + { + options = "new-tab"; + } + if (remaining_arguments == NULL) { /* Homepage or resume */ org_gnome_Epiphany_load_url_async - (proxy, "", FALSE, !open_in_new_tab, - open_in_new_tab, user_time, - ephy_activation_general_purpose_reply, NULL /* FIXME! */); + (proxy, "", options, user_time, + unref_proxy_reply_cb, NULL /* FIXME! */); } else { @@ -365,9 +388,8 @@ open_urls (DBusGProxy *proxy, //path = path_from_command_line_arg (args[i]); org_gnome_Epiphany_load_url_async - (proxy, path, FALSE, !open_in_new_tab, - open_in_new_tab, user_time, - ephy_activation_general_purpose_reply, NULL /* FIXME */); + (proxy, path, options, user_time, + unref_proxy_reply_cb, NULL /* FIXME */); //g_free (path); } @@ -392,28 +414,14 @@ call_dbus_proxy (DBusGProxy *proxy, { org_gnome_Epiphany_open_bookmarks_editor_async (proxy, user_time, - ephy_activation_general_purpose_reply, shell); + unref_proxy_reply_cb, shell); } else if (session_filename != NULL) { org_gnome_Epiphany_load_session_async (proxy, session_filename, user_time, - ephy_activation_general_purpose_reply, shell); + unref_proxy_reply_cb, shell); } -#if 0 - else if (flags & EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS) - { - org_gnome_Epiphany_import_bookmarks_async - (proxy, string_arg, - ephy_activation_general_purpose_reply, shell); - } - else if (flags & EPHY_SHELL_STARTUP_ADD_BOOKMARK) - { - org_gnome_Epiphany_add_bookmark_async - (proxy, string_arg, - ephy_activation_general_purpose_reply, shell); - } -#endif else { /* no need to open the homepage if autoresume returns TRUE; -- cgit v1.2.3