Show the combo arrow if the history table contains any rows

This commit is contained in:
Alexander Butenko 2010-02-04 03:30:09 +01:00 committed by Christian Dywan
parent af94855fee
commit 5887067e73

View file

@ -614,14 +614,29 @@ midori_location_action_finalize (GObject* object)
static void static void
midori_location_action_toggle_arrow_cb (GtkWidget* widget, midori_location_action_toggle_arrow_cb (GtkWidget* widget,
MidoriLocationAction* location_action) MidoriLocationAction* location_action)
{ { gboolean show = FALSE;
if (GTK_IS_BUTTON (widget))
{ #if HAVE_SQLITE
gboolean show = location_action->history sqlite3* db;
&& katze_array_get_nth_item (location_action->history, 0); const gchar* sqlcmd;
sokoke_widget_set_visible (widget, show); sqlite3_stmt* statement;
gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1); 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 static void