[epiphany/overview] Revert "ephy-window: replace "new tab" with "new page""
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/overview] Revert "ephy-window: replace "new tab" with "new page""
- Date: Mon, 20 Aug 2012 16:11:44 +0000 (UTC)
commit d61cc7319a52f4b280af58a7c6924fac10b36c71
Author: Claudio Saavedra <csaavedra igalia com>
Date: Wed Aug 15 23:31:44 2012 +0300
Revert "ephy-window: replace "new tab" with "new page""
This reverts commit e32befacc5cbe958ad23bf982e4747307958151d.
src/Makefile.am | 2 +
src/ephy-home-action.c | 76 +++++++++++++++++++++++++++++++++++++++++
src/ephy-home-action.h | 55 +++++++++++++++++++++++++++++
src/ephy-shell.c | 1 +
src/ephy-window.c | 26 ++++++++++++--
src/resources/epiphany-ui.xml | 2 +-
src/window-commands.c | 7 ----
src/window-commands.h | 2 -
8 files changed, 157 insertions(+), 14 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 4a39664..7340878 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,7 @@ NOINST_H_FILES = \
ephy-find-toolbar.h \
ephy-frecent-store.h \
ephy-history-window.h \
+ ephy-home-action.h \
ephy-link-action.h \
ephy-lockdown.h \
ephy-location-controller.h \
@@ -64,6 +65,7 @@ libephymain_la_SOURCES = \
ephy-extensions-manager.c \
ephy-find-toolbar.c \
ephy-frecent-store.c \
+ ephy-home-action.c \
ephy-history-window.c \
ephy-link.c \
ephy-link-action.c \
diff --git a/src/ephy-home-action.c b/src/ephy-home-action.c
new file mode 100644
index 0000000..bd0b241
--- /dev/null
+++ b/src/ephy-home-action.c
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+* Copyright  2004 Christian Persch
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2, or (at your option)
+* any later version.
+*
+* This program 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 General Public License for more details.
+*
+* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#include "config.h"
+#include "ephy-home-action.h"
+
+#include "ephy-link.h"
+
+G_DEFINE_TYPE (EphyHomeAction, ephy_home_action, EPHY_TYPE_LINK_ACTION)
+
+static void
+ephy_home_action_open (GtkAction *action,
+ const char *address,
+ EphyLinkFlags flags)
+{
+ ephy_link_open (EPHY_LINK (action),
+ address != NULL && address[0] != '\0' ? address : "about:blank",
+ NULL,
+ flags);
+}
+
+static void
+action_name_association (GtkAction *action,
+ char *action_name,
+ char *address)
+{
+ if (g_str_equal (action_name, "FileNewTab"))
+ {
+ ephy_home_action_open (action,
+ address,
+ EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO | EPHY_LINK_HOME_PAGE);
+ }
+}
+
+static void
+ephy_home_action_activate (GtkAction *action)
+{
+ char *action_name;
+
+ g_object_get (G_OBJECT (action), "name", &action_name, NULL);
+
+ action_name_association (action, action_name, "about:blank");
+
+ g_free (action_name);
+}
+
+static void
+ephy_home_action_class_init (EphyHomeActionClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = ephy_home_action_activate;
+}
+
+static void
+ephy_home_action_init (EphyHomeAction *action)
+{
+ /* Empty, needed for G_DEFINE_TYPE macro */
+}
diff --git a/src/ephy-home-action.h b/src/ephy-home-action.h
new file mode 100644
index 0000000..0290c68
--- /dev/null
+++ b/src/ephy-home-action.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright  2004 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."
+#endif
+
+#ifndef EPHY_HOME_ACTION_H
+#define EPHY_HOME_ACTION_H
+
+#include "ephy-link-action.h"
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_HOME_ACTION (ephy_home_action_get_type ())
+#define EPHY_HOME_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_HOME_ACTION, EphyHomeAction))
+#define EPHY_HOME_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_HOME_ACTION, EphyHomeActionClass))
+#define EPHY_IS_HOME_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_HOME_ACTION))
+#define EPHY_IS_HOME_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_HOME_ACTION))
+#define EPHY_HOME_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_HOME_ACTION, EphyHomeActionClass))
+
+typedef struct _EphyHomeAction EphyHomeAction;
+typedef struct _EphyHomeActionClass EphyHomeActionClass;
+
+struct _EphyHomeAction
+{
+ EphyLinkAction parent_instance;
+};
+
+struct _EphyHomeActionClass
+{
+ EphyLinkActionClass parent_class;
+};
+
+GType ephy_home_action_get_type (void);
+
+G_END_DECLS
+
+#endif /* EPHY_HOME_ACTION_H */
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index a5be16f..4eacd37 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -33,6 +33,7 @@
#include "ephy-file-helpers.h"
#include "ephy-gui.h"
#include "ephy-history-window.h"
+#include "ephy-home-action.h"
#include "ephy-lockdown.h"
#include "ephy-prefs.h"
#include "ephy-private.h"
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 77b5ae3..c8aeb78 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -40,6 +40,7 @@
#include "ephy-file-helpers.h"
#include "ephy-find-toolbar.h"
#include "ephy-gui.h"
+#include "ephy-home-action.h"
#include "ephy-link.h"
#include "ephy-location-entry.h"
#include "ephy-navigation-history-action.h"
@@ -97,8 +98,6 @@ static const GtkActionEntry ephy_menu_entries [] = {
/* File actions. */
- { "FileNewPage", NULL, N_("_New Page"), "<control>T", NULL,
- G_CALLBACK (window_cmd_file_new_page) },
{ "FileOpen", NULL, N_("_Openâ"), "<control>O", NULL,
G_CALLBACK (window_cmd_file_open) },
{ "FileSaveAs", NULL, N_("Save _Asâ"), "<shift><control>S", NULL,
@@ -1395,6 +1394,13 @@ setup_ui_manager (EphyWindow *window)
gtk_action_group_add_action (action_group, action);
g_object_unref (action);
+ action = g_object_new (EPHY_TYPE_HOME_ACTION,
+ "name", "FileNewTab",
+ "label", _("New _Tab"),
+ NULL);
+ gtk_action_group_add_action_with_accel (action_group, action, "<control>T");
+ g_object_unref (action);
+
action = g_object_new (EPHY_TYPE_COMBINED_STOP_RELOAD_ACTION,
"name", "ViewCombinedStopReload",
"loading", FALSE,
@@ -1587,7 +1593,7 @@ _ephy_window_set_default_actions_sensitive (EphyWindow *window,
GtkActionGroup *action_group;
GtkAction *action;
int i;
- const char *action_group_actions[] = { "FileNewPage", "FileSaveAs", "FileSaveAsApplication", "FilePrint",
+ const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint",
"FileSendTo", "FileCloseTab", "FileBookmarkPage", "EditFind",
"EditFindPrev", "EditFindNext", "ViewEncoding",
"ViewZoomIn", "ViewZoomOut", "ViewPageSource",
@@ -3447,6 +3453,11 @@ setup_toolbar (EphyWindow *window)
G_CALLBACK (ephy_link_open), window);
action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "FileNewTab");
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
"Zoom");
g_signal_connect (action, "zoom-to-level",
G_CALLBACK (zoom_to_level_cb), window);
@@ -3496,6 +3507,7 @@ ephy_window_constructor (GType type,
EphyEmbedSingle *single;
GtkSettings *settings;
GtkAction *action;
+ GtkActionGroup *toolbar_action_group;
GError *error = NULL;
guint settings_connection;
GtkCssProvider *css_provider;
@@ -3651,7 +3663,8 @@ ephy_window_constructor (GType type,
G_CALLBACK (sync_network_status), window);
/* Disable actions not needed for popup mode. */
- action = gtk_action_group_get_action (priv->action_group, "FileNewPage");
+ toolbar_action_group = priv->toolbar_action_group;
+ action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
priv->is_popup);
@@ -3663,6 +3676,11 @@ ephy_window_constructor (GType type,
mode = ephy_embed_shell_get_mode (embed_shell);
if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION)
{
+ /* FileNewTab and FileNewWindow are sort of special. */
+ action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
+ TRUE);
+
for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++)
{
action = gtk_action_group_get_action (priv->action_group,
diff --git a/src/resources/epiphany-ui.xml b/src/resources/epiphany-ui.xml
index 9b3619c..c478903 100644
--- a/src/resources/epiphany-ui.xml
+++ b/src/resources/epiphany-ui.xml
@@ -68,7 +68,7 @@
</popup>
<popup name="PagePopup" action="PagePopupAction" accelerators="true">
- <menuitem name="FileNewPageMenu" action="FileNewPage"/>
+ <menuitem name="FileNewTabMenu" action="FileNewTab"/>
<menuitem name="FileOpenMenu" action="FileOpen"/>
<separator name="FileSep1"/>
<menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
diff --git a/src/window-commands.c b/src/window-commands.c
index 666449c..7173f37 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -65,13 +65,6 @@
#endif
void
-window_cmd_file_new_page (GtkAction *action,
- EphyWindow *window)
-{
- ephy_window_set_overview_mode (window, TRUE);
-}
-
-void
window_cmd_file_print (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index cc46be2..06b4692 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -42,8 +42,6 @@ void window_cmd_new (GtkAction *action,
EphyWindow *window);
void window_cmd_file_bookmark_page (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_new_page (GtkAction *action,
- EphyWindow *window);
void window_cmd_file_open (GtkAction *action,
EphyWindow *window);
void window_cmd_file_save_as (GtkAction *action,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]