From 021c050dce22b14b1d183d81cb0fb3b95ba94599 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Sun, 1 May 2011 10:00:49 -0400 Subject: updated readme, added refactoring to goals on TODO, and modified some more functions to folllow new scheme --- README | 16 +--------------- TODO | 2 ++ sb.c | 28 +++++++++++++++------------- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/README b/README index 5f9c589..9bde93e 100644 --- a/README +++ b/README @@ -1,21 +1,9 @@ -Todo: - -[pretty much done, not sure though] keybinding (more support) -configuration settings via a rc file -cookie handling/saving -history is pretty much complete. timestamp maybe? - sb Simple Browser based on webkit. -I mostly wrote this as an, alternative to more complex browsers like surf, uzbl, and inferno, xxxterm stuff like that. - -I think minimalism is just as important as maintaining a large feature set. features doesn't mean it sucks, what matters is how the features are implemented. +this is pretty much my favorite web browser on the planet. why? because I am writing it to fit my needs exactly, no more no less. That way it is bloat-free, fast and suited towards my needs. -If they are well written, well implemented, well thought out, bloat will never be present. - -(Aside the Ideological BS... i am just making this to work how i want it to.) Keyboard Shortcuts (simple to change in source if you desire) @@ -36,13 +24,11 @@ CTRL + o = open history with dmenu CTRL + g = opens history and launches url in new tab 'tab and go' ALT + enter + find bar = reverse searchs - Escape, will return focus to the page, instead of the entry bars Code: Written Poorly -(some stuff barrowed from sakura and surf.) License : GPLv3 except stuff under MIT/X from surf diff --git a/TODO b/TODO index 3b11e17..c352ce6 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,4 @@ add cookie support +switch to multiple source files, one for UI ops, one for tab ops, etc. +switch function names to follow scheme GROUP_SPECIFIC need to force scrollbars to hide, must do research with it D: maybe i will use gtk style diff --git a/sb.c b/sb.c index ed7ba40..14dc162 100644 --- a/sb.c +++ b/sb.c @@ -12,6 +12,7 @@ #include #include #include +#include typedef struct tab { GtkWidget *scroll; @@ -20,15 +21,16 @@ typedef struct tab { gchar *url_entry; gint load_progress; guint status_context_id; - WebKitWebView *view; + WebKitWebView *view; } tab; static struct { WebKitWebSettings *webkitsettings; WebKitWebWindowFeatures *webkitwindowfeatures; + SoupCookieJar *session; gboolean hide; GtkWidget *win; - GtkWidget *bar; + GtkWidget *bar; GtkWidget *search; GtkWidget *vbox; GtkWidget *notebook; @@ -46,27 +48,27 @@ static struct { static GQuark term_data_id = 0; static void cb_entry(GtkWidget* entry, gpointer data); +static void cb_go(gboolean b); +static void cb_download(WebKitWebView *web_view, GObject *download, gpointer user_data); static void link_hover(WebKitWebView* page, const gchar* title, const gchar* link, gpointer data); static void title_change_cb(WebKitWebView *v, WebKitWebFrame *f, const char *title, tab *t); static void load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, tab *t); static void load_uri(gchar *uri); -static void cb_go(gboolean b); static void tab_new(gboolean b); static void tab_zoom(gboolean b); static void tab_close(); static void tab_and_go(); static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data); -static void cb_download(WebKitWebView *web_view, GObject *download, gpointer user_data); -static void window_setup(); +static void tab_view_source(); static void tab_reload(); +static void window_setup(); static void search(GtkEntry *entry, gboolean b); static void toggle(); static void show_search(gboolean b); -static void tab_view_source(); static void focus_view(); WebKitWebView * tab_new_requested(WebKitWebView *v, WebKitWebFrame *f); static void tab_switch(gboolean b); -gboolean key_press_cb(GtkWidget *widget, GdkEventKey *event); +gboolean cb_keypress(GtkWidget *widget, GdkEventKey *event); static void search(GtkEntry *entry, gboolean b) { @@ -102,12 +104,11 @@ w.hide = FALSE; /* Basic reload function */ static void tab_reload() { - - struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); - webkit_web_view_reload(t->view); - +struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); +webkit_web_view_reload(t->view); } + /* close tab, and quit if there are no tabs */ static void tab_close() { struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); @@ -379,13 +380,14 @@ gtk_window_set_default_size(GTK_WINDOW(w.win), 800, 800); w.webkitsettings = webkit_web_settings_new(); w.webkitwindowfeatures = webkit_web_window_features_new(); +w.session = soup_cookie_jar_text_new(g_strconcat(g_get_home_dir(), ".sb_cookies", NULL ) , FALSE); tab_new(FALSE); g_signal_connect (G_OBJECT (w.search), "activate", G_CALLBACK (search), GINT_TO_POINTER(1)); g_signal_connect (G_OBJECT (w.bar), "activate", G_CALLBACK (cb_entry), NULL); g_signal_connect (G_OBJECT(w.notebook), "switch-page", G_CALLBACK(tab_focus), NULL); g_signal_connect (G_OBJECT (w.win), "destroy", G_CALLBACK (gtk_main_quit), NULL); -g_signal_connect(w.win, "key-press-event", G_CALLBACK(key_press_cb), NULL); +g_signal_connect(w.win, "key-press-event", G_CALLBACK(cb_keypress), NULL); gtk_container_add (GTK_CONTAINER (w.win), w.vbox); gtk_widget_show_all (w.win); @@ -396,7 +398,7 @@ gtk_widget_grab_focus(w.bar); /* key press callback function. NEEDED: a config.h where keys are defined */ -gboolean key_press_cb (GtkWidget *widget, GdkEventKey *event) { +gboolean cb_keypress (GtkWidget *widget, GdkEventKey *event) { guint(g) = event->keyval; if ( (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK ) { -- cgit v1.2.3