diff options
-rw-r--r-- | sb.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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 <gtk/gtk.h> -#include <webkit/webkit.h> +#include <signal.h> #include <gdk/gdkkeysyms.h> +#include <string.h> +#include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> #include <stdlib.h> -#include <glib.h> +#include <stdio.h> +#include <webkit/webkit.h> #include <glib/gstdio.h> 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); |