aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjasper@unix.geek.nz <jasper@unix.geek.nz@767c508d-d83b-0410-8cff-fd39cd899a2f>2008-03-27 10:37:23 +0000
committerjasper@unix.geek.nz <jasper@unix.geek.nz@767c508d-d83b-0410-8cff-fd39cd899a2f>2008-03-27 10:37:23 +0000
commit9fff790939c2e456f1c176a8a8b97e4f991672b1 (patch)
tree05a4cbe839cc1ba9e74c3083056b035dbfca81c0
parent9acda71d32c275b5460aa5469f8d246658db57a4 (diff)
downloadjuniper-browser-9fff790939c2e456f1c176a8a8b97e4f991672b1.tar.gz
juniper-browser-9fff790939c2e456f1c176a8a8b97e4f991672b1.tar.bz2
juniper-browser-9fff790939c2e456f1c176a8a8b97e4f991672b1.zip
* Only open bookmark in new window if current tab is not blank
* Removed crazy ldflags
-rwxr-xr-xbuild.sh2
-rw-r--r--src/juniper-bookmarks.c9
-rw-r--r--src/juniper-events.c10
-rw-r--r--src/juniper-tabs.c16
-rw-r--r--src/juniper-tabs.h4
5 files changed, 36 insertions, 5 deletions
diff --git a/build.sh b/build.sh
index ed5b715..00522c6 100755
--- a/build.sh
+++ b/build.sh
@@ -6,7 +6,7 @@ COMMON="-pipe -Wall -pedantic -Werror $@"
DEPENDENCIES="libglade-2.0 gtk+-2.0 gtksourceview-1.0 webkit-1.0 sqlite3"
CFLAGS="$COMMON $(pkg-config --cflags $DEPENDENCIES)"
-LDFLAGS="$COMMON -Wl,-E -Wl,--sort-common -Wl,--as-needed -Wl,--no-add-needed -Wl,--enable-new-dtags -Wl,--fatal-warnings"
+LDFLAGS="$COMMON -Wl,-E"
LIBS="$(pkg-config --libs $DEPENDENCIES)"
echo "CFLAGS: $CFLAGS"
diff --git a/src/juniper-bookmarks.c b/src/juniper-bookmarks.c
index 121571c..f78134c 100644
--- a/src/juniper-bookmarks.c
+++ b/src/juniper-bookmarks.c
@@ -114,7 +114,14 @@ void juniper_bookmarks_add_bookmark_menu_item_activate(GtkMenuItem * menu_item)
void juniper_bookmarks_menu_item_activate(GtkMenuItem * menu_item, const gchar * url)
{
- juniper_tabs_add_with_location(url);
+ GtkVBox * tab;
+
+ tab = juniper_tabs_current();
+
+ if (juniper_tabs_is_blank(tab))
+ juniper_tabs_navigate_to(tab, url);
+ else
+ juniper_tabs_add_with_location(url);
}
void juniper_bookmarks_add(const gchar * uri, const gchar * name)
diff --git a/src/juniper-events.c b/src/juniper-events.c
index f14d4ae..d1912e1 100644
--- a/src/juniper-events.c
+++ b/src/juniper-events.c
@@ -35,15 +35,19 @@ void juniper_events_address_bar_activate(GtkEntry * address_bar)
void juniper_events_address_bar_changed(GtkEntry * address_bar)
{
GSList * match;
- const char * text;
+ const gchar * text;
+ gint entered_length;
text = gtk_entry_get_text(address_bar);
+ entered_length = strlen(text);
- if (text == NULL || strlen(text) == 0)
+ if (text == NULL || entered_length == 0)
return;
match = juniper_history_matches(text);
- /* got data, now wtf do we do with it? */
+
+ if (match == NULL)
+ return;
}
/**
diff --git a/src/juniper-tabs.c b/src/juniper-tabs.c
index 8e541e3..f1f92f8 100644
--- a/src/juniper-tabs.c
+++ b/src/juniper-tabs.c
@@ -3,6 +3,7 @@
#include "assert.h"
#include "stdio.h"
#include "stdlib.h"
+#include "string.h"
#include "juniper-events.h"
#include "juniper-prefs.h"
@@ -52,6 +53,16 @@ GtkVBox * juniper_tabs_nth(guint index)
return GTK_VBOX(gtk_notebook_get_nth_page(tabs, index));
}
+gboolean juniper_tabs_is_blank(GtkVBox * tab)
+{
+ const gchar * title, * uri;
+
+ title = juniper_tabs_get_title(tab);
+ uri = juniper_tabs_get_uri(tab);
+
+ return NULL == title || NULL == uri || (strcmp(title, "blank") == 0 && strlen(uri) == 0);
+}
+
const gchar * juniper_tabs_get_title(GtkVBox * tab)
{
return webkit_web_frame_get_title(webkit_web_view_get_main_frame(juniper_tabs_page_for_tab(tab)));
@@ -70,6 +81,11 @@ void juniper_tabs_set_title(GtkVBox * tab, const gchar * title)
}
}
+const gchar * juniper_tabs_get_uri(GtkVBox * tab)
+{
+ return gtk_entry_get_text(juniper_tabs_address_bar_for_tab(tab));
+}
+
GtkWidget * juniper_tabs_nth_widget_for_tab(GtkVBox * tab, guint index)
{
GtkBox * box;
diff --git a/src/juniper-tabs.h b/src/juniper-tabs.h
index 82d2862..83c7fca 100644
--- a/src/juniper-tabs.h
+++ b/src/juniper-tabs.h
@@ -12,11 +12,15 @@ GtkNotebook * juniper_tabs();
GtkVBox * juniper_tabs_current();
GtkVBox * juniper_tabs_nth(guint index);
+gboolean juniper_tabs_is_blank(GtkVBox * tab);
+
void juniper_tabs_navigate_to(GtkVBox * tab, const gchar * location);
const gchar * juniper_tabs_get_title(GtkVBox * tab);
void juniper_tabs_set_title(GtkVBox * tab, const gchar * title);
+const gchar * juniper_tabs_get_uri(GtkVBox * tab);
+
GtkEntry * juniper_tabs_address_bar_for_tab(GtkVBox *);
WebKitWebView * juniper_tabs_page_for_tab(GtkVBox *);