aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormutantturkey <crazycal00@gmail.com>2011-05-07 18:44:37 -0400
committermutantturkey <crazycal00@gmail.com>2011-05-07 18:44:37 -0400
commitf408157127f3177fe0aeeb4a553882ca2c3521b6 (patch)
tree9e05e1e45b0fb439d89784d839247b2863941e0d
parent4650541d1fe727f8ade49202cdb1b3474e75646d (diff)
using defaults.h to control default settings for now
-rw-r--r--defaults.h9
-rw-r--r--sb.c23
2 files changed, 21 insertions, 11 deletions
diff --git a/defaults.h b/defaults.h
new file mode 100644
index 0000000..758a500
--- /dev/null
+++ b/defaults.h
@@ -0,0 +1,9 @@
+#define DEFAULT_DOWNLOAD "xterm -bg black -fg white -e wget -P "
+#define DEFAULT_SEARCH "http://www.google.com/search?q="
+#define DEFAULT_FONT "san-serif"
+#define DEFAULT_TAB_LENGTH 25
+#define DEFAULT_HISTORY_FILE ".sb_history"
+#define DEFAULT_COOKIE_FILE ".sb_cookies"
+#define DEFAULT_ZOOM_SIZE .05
+#define DEFAULT_HEIGHT 900
+#define DEFAULT_WIDTH 800
diff --git a/sb.c b/sb.c
index f0155a7..701271c 100644
--- a/sb.c
+++ b/sb.c
@@ -2,7 +2,7 @@
//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 <signal.h>
+
#include <gdk/gdkkeysyms.h>
#include <string.h>
#include <unistd.h>
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <webkit/webkit.h>
#include <glib/gstdio.h>
+#include <defaults.h>
typedef struct tab {
GtkWidget *scroll;
@@ -35,15 +36,6 @@ static struct {
GtkWidget *status; } w;
#define get_tab(x, page_idx ) (struct tab*)g_object_get_qdata(G_OBJECT( gtk_notebook_get_nth_page( (GtkNotebook*)w.notebook, page_idx ) ), term_data_id);
-#define DEFAULT_DOWNLOAD "xterm -bg black -fg white -e wget -P "
-#define DEFAULT_SEARCH "http://www.google.com/search?q="
-#define DEFAULT_FONT "san-serif"
-#define DEFAULT_TAB_LENGTH 25
-#define DEFAULT_HISTORY_FILE ".sb_history"
-#define DEFAULT_COOKIE_FILE ".sb_cookies"
-#define DEFAULT_ZOOM_SIZE .05
-#define DEFAULT_HEIGHT 900
-#define DEFAULT_WIDTH 800
static GQuark term_data_id = 0;
static void cb_entry(GtkWidget* entry, gpointer data);
@@ -69,6 +61,13 @@ WebKitWebView * tab_new_requested(WebKitWebView *v, WebKitWebFrame *f);
static void tab_switch(gboolean b);
gboolean cb_keypress(GtkWidget *widget, GdkEventKey *event);
+gchar* tab_get_tab_postition() {
+ gchar *page_info = NULL;
+ sprintf(page_info, "[ %d / %d ]", gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook)), gtk_notebook_get_n_pages(GTK_NOTEBOOK(w.notebook)));
+ puts(page_info);
+ return(page_info);
+}
+
static void search(GtkEntry *entry, gboolean b) {
struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook)));
@@ -143,11 +142,12 @@ static void title_change_cb(WebKitWebView *v, WebKitWebFrame *f, const char *tit
gchar *tabtitle;
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook)) == gtk_notebook_page_num(GTK_NOTEBOOK(w.notebook), t->scroll)) {
-gtk_window_set_title(GTK_WINDOW(w.win), title);
+gtk_window_set_title(GTK_WINDOW(w.win), g_strconcat(title,tab_get_tab_postition(), NULL));
}
if(strlen(title) < DEFAULT_TAB_LENGTH ) { tabtitle = g_strdup(title); }
else { tabtitle = g_strndup(title, DEFAULT_TAB_LENGTH); strcat(tabtitle, "..."); }
+
gtk_label_set_label(GTK_LABEL(t->label), tabtitle);
}
@@ -168,6 +168,7 @@ fclose(history);
/* an alternative to the regular tab command, combines tabbing and history command into one */
+
static void tab_and_go() {
gchar *returned;
g_spawn_command_line_sync(g_strconcat("sh -c 'sort ", g_build_filename(g_get_home_dir(), ".sb_history", NULL), " | dmenu -l 15 -xs -c'", NULL), &returned, NULL, NULL, NULL);