about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorader <drader@adercon.com>2014-05-01 20:46:27 -0400
committerJosh Rickmar <jrick@FGD135.dhcp.aldl.mi.charter.com>2014-05-02 10:31:12 -0500
commitbf6ffda86a0ae6813f32e2b9e1084dd1c4761828 (patch)
tree4df5d3e1428626c0deb6e859e7745e0a090a49ee
parentb10321a1983376a2d6a8ddba98daeac9d890f943 (diff)
downloadxombrero-bf6ffda86a0ae6813f32e2b9e1084dd1c4761828.tar.gz
added "open search in new tab" (using C-Enter on search) per
https://github.com/conformal/xombrero/issues/61
-rw-r--r--settings.c1
-rw-r--r--xombrero.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/settings.c b/settings.c
index 8b1fbc9..9267d69 100644
--- a/settings.c
+++ b/settings.c
@@ -1486,6 +1486,7 @@ struct key_binding	keys[] = {
 	{ "editelement",	CTRL,	1,	GDK_i		},
 	{ "passthrough",	CTRL,	1,	GDK_z		},
 	{ "modurl",		CTRL,	1,	GDK_Return	},
+	{ "modsearchentry",	CTRL,	1,	GDK_Return	},
 	{ "urlmod plus",	MOD1,	1,	GDK_a		},
 	{ "urlmod min",		MOD1,	1,	GDK_A		},
 
diff --git a/xombrero.c b/xombrero.c
index ca5a471..9904abc 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -251,6 +251,7 @@ int			next_download_id = 1;
 void			xxx_dir(char *);
 int			icon_size_map(int);
 void			activate_uri_entry_cb(GtkWidget*, struct tab *);
+void			activate_search_entry_cb(GtkWidget*, struct tab *);
 
 void
 history_delete(struct command_list *l, int *counter)
@@ -1165,6 +1166,25 @@ modurl(struct tab *t, struct karg *args)
 }
 
 int
+modsearchentry(struct tab *t, struct karg *args)
+{
+	const gchar		*s = NULL;
+	struct tab		*tt;
+
+	/* XXX kind of a bad hack (in honor of the modurl hack) */
+	if (gtk_widget_has_focus(t->search_entry)) {
+		if ((s = gtk_entry_get_text(GTK_ENTRY(t->search_entry))) &&
+		    (strlen(s))) {
+			tt = create_new_tab(NULL, NULL, 1, -1);
+			gtk_entry_set_text(GTK_ENTRY(tt->search_entry), s);
+			activate_search_entry_cb(t->search_entry,tt);
+			gtk_entry_set_text(GTK_ENTRY(t->search_entry), "");
+		}
+	}
+	return (0);
+}
+
+int
 hint(struct tab *t, struct karg *args)
 {
 
@@ -3248,6 +3268,7 @@ struct cmd {
 	{ "editelement",	0,	edit_element,		0,			0 },
 	{ "passthrough",	0,	passthrough,		0,			0 },
 	{ "modurl",		0,	modurl,			0,			0 },
+	{ "modsearchentry",	0,	modsearchentry,		0,			0 },
 
 	/* yanking and pasting */
 	{ "yankuri",		0,	yank_uri,		0,			0 },