diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-activation.c | 71 | ||||
-rw-r--r-- | src/ephy-activation.h | 17 | ||||
-rw-r--r-- | src/ephy-dbus.c | 2 | ||||
-rw-r--r-- | src/ephy-main.c | 52 |
4 files changed, 55 insertions, 87 deletions
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 <string.h> 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, @@ -89,24 +91,6 @@ ephy_activation_load_url (EphyDbus *ephy_dbus, } 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, guint startup_id, @@ -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; |