[Xfce4-commits] <midori:master> Show the combo arrow if the history table contains any rows
Christian Dywan
noreply at xfce.org
Thu Feb 4 03:34:02 CET 2010
Updating branch refs/heads/master
to 5887067e73da8fb63e2279d79ea55f20d9d837ea (commit)
from af94855fee73cf0cad6aeace4300c23086f83f89 (commit)
commit 5887067e73da8fb63e2279d79ea55f20d9d837ea
Author: Alexander Butenko <a.butenka at gmail.com>
Date: Thu Feb 4 03:30:09 2010 +0100
Show the combo arrow if the history table contains any rows
midori/midori-locationaction.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index 37e78c5..5df50ef 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -614,14 +614,29 @@ midori_location_action_finalize (GObject* object)
static void
midori_location_action_toggle_arrow_cb (GtkWidget* widget,
MidoriLocationAction* location_action)
-{
- if (GTK_IS_BUTTON (widget))
- {
- gboolean show = location_action->history
- && katze_array_get_nth_item (location_action->history, 0);
- sokoke_widget_set_visible (widget, show);
- gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1);
- }
+{ gboolean show = FALSE;
+
+ #if HAVE_SQLITE
+ sqlite3* db;
+ const gchar* sqlcmd;
+ sqlite3_stmt* statement;
+ gint result;
+ #endif
+
+ if (!GTK_IS_BUTTON (widget))
+ return;
+
+ #if HAVE_SQLITE
+ db = g_object_get_data (G_OBJECT (location_action->history), "db");
+ sqlcmd = "SELECT uri FROM history LIMIT 1";
+ sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
+ result = sqlite3_step (statement);
+ if (result == SQLITE_ROW)
+ show = TRUE;
+ sqlite3_finalize (statement);
+ #endif
+ sokoke_widget_set_visible (widget, show);
+ gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1);
}
static void
More information about the Xfce4-commits
mailing list