[epiphany] ephy-home-action: remove a lot of unused code



commit 066acbea3d32c04f15b6754310c8ba422f7c2f36
Author: Xan Lopez <xan igalia com>
Date:   Wed Jan 18 13:39:12 2012 +0100

    ephy-home-action: remove a lot of unused code

 src/ephy-home-action.c |  157 +++---------------------------------------------
 1 files changed, 9 insertions(+), 148 deletions(-)
---
diff --git a/src/ephy-home-action.c b/src/ephy-home-action.c
index 83d33fd..518e87e 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]