From 52d99e44c91fc1d1a0ac8d4760e8ea97c3bb009d Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Sat, 29 May 2010 19:24:53 -0400 Subject: now checks for empty strings on history_command() --- sb.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sb.c b/sb.c index 418ba1f..03f6375 100644 --- a/sb.c +++ b/sb.c @@ -2,12 +2,15 @@ //original code is from alot of places, gtkforums.com, gtkwebkit.org provided //alot of nice API examples :), and of course, surf (though i was careful not to steal any code because of the damned MIT/X license) //uzbl also helped inspire me. along with a previous surf fork named inferno. -#include -#include +#include #include +#include +#include +#include #include #include -#include +#include +#include #include typedef struct tab { GtkWidget *scroll; GtkWidget *label; gchar *main_title; gint load_progress; guint status_context_id; WebKitWebView *view; WebKitWebSettings *settings; } tab; @@ -198,13 +201,14 @@ gtk_widget_grab_focus(w.bar); static void history_command() { gchar *returned; -gchar *url; g_spawn_command_line_sync("sh -c 'sort ~/.history | dmenu -l 15 -xs -c'", &returned, NULL, NULL, NULL); -load_uri(returned); +if(strcmp(returned, "") == 0) { focus_view(); } else { load_uri(returned); } + g_free(returned); } + static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data) { struct tab *t = get_tab(NULL, page_num); const char *url = webkit_web_view_get_uri(t->view); -- cgit v1.2.3