aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-home-action.c
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-01-18 20:39:12 +0800
committerXan Lopez <xan@igalia.com>2012-01-18 20:39:12 +0800
commit066acbea3d32c04f15b6754310c8ba422f7c2f36 (patch)
treec51f5b8fb15e241f028dc9538e30e9e3ff3ff3e1 /src/ephy-home-action.c
parent9c52e2df5c4b414eb19fb6d5f7e0261c708a2d22 (diff)
downloadgsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar.gz
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar.bz2
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar.lz
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar.xz
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.tar.zst
gsoc2013-epiphany-066acbea3d32c04f15b6754310c8ba422f7c2f36.zip
ephy-home-action: remove a lot of unused code
Diffstat (limited to 'src/ephy-home-action.c')
-rw-r--r--src/ephy-home-action.c157
1 files changed, 9 insertions, 148 deletions
diff --git a/src/ephy-home-action.c b/src/ephy-home-action.c
index 83d33fd40..518e87e82 100644
--- a/src/ephy-home-action.c
+++ b/src/ephy-home-action.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright © 2004 Christian Persch
*
@@ -18,20 +19,13 @@
*/
#include "config.h"
-
#include "ephy-home-action.h"
-#include "ephy-link.h"
-#include "ephy-prefs.h"
-#include "ephy-settings.h"
-#include "ephy-gui.h"
-#include "ephy-dnd.h"
-#include <string.h>
+#include "ephy-gui.h"
+#include "ephy-link.h"
#include <gtk/gtk.h>
-#define INSANE_NUMBER_OF_URLS 20
-
typedef struct
{
GObject *weak_ptr;
@@ -40,12 +34,6 @@ typedef struct
G_DEFINE_TYPE (EphyHomeAction, ephy_home_action, EPHY_TYPE_LINK_ACTION)
-static const GtkTargetEntry url_drag_types [] =
-{
- { EPHY_DND_URI_LIST_TYPE, 0, 0 },
- { EPHY_DND_URL_TYPE, 0, 1 }
-};
-
static void
clipboard_text_received_cb (GtkClipboard *clipboard,
const char *text,
@@ -112,38 +100,13 @@ ephy_home_action_open (GtkAction *action,
static void
action_name_association (GtkAction *action,
char *action_name,
- char *address,
- gboolean is_drag_action)
+ char *address)
{
- if (strcmp (action_name, "FileNewTab") == 0)
+ if (g_str_equal (action_name, "FileNewTab"))
{
- if (is_drag_action)
- {
- ephy_link_open (EPHY_LINK (action),
- address, NULL,
- EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO);
- }
- else
- {
- ephy_home_action_open (action,
- address,
- EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO);
- }
- }
- else if (strcmp (action_name, "FileNewWindow") == 0)
- {
- if (is_drag_action)
- {
- ephy_link_open (EPHY_LINK (action),
- address, NULL,
- EPHY_LINK_NEW_WINDOW);
- }
- else
- {
- ephy_home_action_open (action,
- address,
- EPHY_LINK_NEW_WINDOW);
- }
+ ephy_home_action_open (action,
+ address,
+ EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO);
}
}
@@ -154,119 +117,17 @@ ephy_home_action_activate (GtkAction *action)
g_object_get (G_OBJECT (action), "name", &action_name, NULL);
- action_name_association (action, action_name, "about:blank", FALSE);
+ action_name_association (action, action_name, "about:blank");
g_free (action_name);
}
static void
-home_action_drag_data_received_cb (GtkWidget* widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EphyHomeAction *action)
-{
- GdkAtom target;
- gchar *action_name;
- const guchar *data;
- gint length;
-
- g_object_get (action, "name", &action_name, NULL);
-
- g_signal_stop_emission_by_name (widget, "drag_data_received");
-
- length = gtk_selection_data_get_length (selection_data);
- data = gtk_selection_data_get_data (selection_data);
- target = gtk_selection_data_get_target (selection_data);
-
- if (length <= 0 || data == NULL) return;
-
- if (target == gdk_atom_intern (EPHY_DND_URL_TYPE, FALSE))
- {
- char **split;
-
- split = g_strsplit ((const gchar *) data, "\n", 2);
- if (split != NULL && split[0] != NULL && split[0][0] != '\0')
- {
- action_name_association (GTK_ACTION (action),
- action_name, split[0], TRUE);
- }
- g_strfreev (split);
- }
- else if (target == gdk_atom_intern (EPHY_DND_URI_LIST_TYPE, FALSE))
- {
- char **uris;
- int i;
-
- uris = gtk_selection_data_get_uris (selection_data);
- if (uris == NULL) return;
-
- for (i = 0; uris[i] != NULL && i < INSANE_NUMBER_OF_URLS; i++)
- {
- action_name_association (GTK_ACTION (action),
- action_name, uris[i], TRUE);
- }
-
- g_strfreev (uris);
- }
- else
- {
- char *text;
-
- text = (char *) gtk_selection_data_get_text (selection_data);
- if (text != NULL)
- {
- action_name_association (GTK_ACTION (action),
- action_name, text, TRUE);
- }
- }
-}
-
-static void
-connect_proxy (GtkAction *action,
- GtkWidget *proxy)
-{
- GtkWidget *child;
- const gchar *action_name;
-
- GTK_ACTION_CLASS (ephy_home_action_parent_class)->connect_proxy (action, proxy);
-
- action_name = gtk_action_get_name (action);
-
- if (GTK_IS_TOOL_ITEM (proxy) && (strcmp (action_name, "GoHome") != 0))
- {
- child = gtk_bin_get_child (GTK_BIN (proxy));
- g_signal_connect (child, "drag-data-received",
- G_CALLBACK (home_action_drag_data_received_cb), action);
- gtk_drag_dest_set (child,
- GTK_DEST_DEFAULT_ALL,
- url_drag_types, G_N_ELEMENTS (url_drag_types),
- GDK_ACTION_MOVE | GDK_ACTION_COPY);
- gtk_drag_dest_add_text_targets (child);
- }
-}
-
-static void
-disconnect_proxy (GtkAction *action,
- GtkWidget *proxy)
-{
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (gtk_action_activate), action);
-
- GTK_ACTION_CLASS (ephy_home_action_parent_class)->disconnect_proxy (action, proxy);
-}
-
-static void
ephy_home_action_class_init (EphyHomeActionClass *class)
{
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
action_class->activate = ephy_home_action_activate;
- action_class->connect_proxy = connect_proxy;
- action_class->disconnect_proxy = disconnect_proxy;
}
static void