#include <unistd.h>
#endif
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
+#include <sqlite3.h>
static GHashTable* global_keys;
static gchar* jsforms;
const gchar* key,
const gchar* value)
{
- #if HAVE_SQLITE
gchar* sqlcmd;
gchar* errmsg;
gint success;
g_free (errmsg);
return;
}
- #endif
}
static gboolean
MidoriBrowser* browser)
{
MidoriApp* app = midori_extension_get_app (extension);
- #if HAVE_SQLITE
sqlite3* db;
- #endif
g_signal_handlers_disconnect_by_func (
browser, formhistory_add_tab_cb, extension);
if (global_keys)
g_hash_table_destroy (global_keys);
- #if HAVE_SQLITE
if ((db = g_object_get_data (G_OBJECT (extension), "formhistory-db")))
sqlite3_close (db);
- #endif
}
-#if HAVE_SQLITE
static int
formhistory_add_field (gpointer data,
int argc,
}
return 0;
}
-#endif
static void
formhistory_activate_cb (MidoriExtension* extension,
MidoriApp* app)
{
- #if HAVE_SQLITE
const gchar* config_dir;
gchar* filename;
sqlite3* db;
char* errmsg = NULL, *errmsg2 = NULL;
- #endif
KatzeArray* browsers;
MidoriBrowser* browser;
guint i;
(GDestroyNotify)g_free);
if(!jsforms)
formhistory_prepare_js ();
- #if HAVE_SQLITE
config_dir = midori_extension_get_config_dir (extension);
katze_mkdir_with_parents (config_dir, 0700);
filename = g_build_filename (config_dir, "forms.db", NULL);
}
sqlite3_close (db);
}
- #endif
browsers = katze_object_get_object (app, "browsers");
i = 0;
#include <string.h>
#include <glib/gstdio.h>
#include <webkit/webkit.h>
-
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
+#include <sqlite3.h>
#if ENABLE_NLS
#include <libintl.h>
return saved;
}
-#if HAVE_SQLITE
static sqlite3*
midori_history_initialize (KatzeArray* array,
const gchar* filename,
}
midori_bookmarks_import_array_db (db, bookmarks, "");
}
-#endif
static void
midori_session_add_delay (KatzeArray* session)
gchar* uri;
KatzeItem* item;
gchar* uri_ready;
- #if HAVE_SQLITE
gchar* errmsg;
sqlite3* db;
gint max_history_age;
- #endif
gint clear_prefs = MIDORI_CLEAR_NONE;
#ifdef G_ENABLE_DEBUG
gboolean startup_timer = g_getenv ("MIDORI_STARTTIME") != NULL;
midori_startup_timer ("Search read: \t%f");
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
- #if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("bookmarks.db"));
errmsg = NULL;
if ((db = midori_bookmarks_initialize (bookmarks, config_file, &errmsg)) == NULL)
g_free (old_bookmarks);
g_object_set_data (G_OBJECT (bookmarks), "db", db);
}
- #endif
midori_startup_timer ("Bookmarks read: \t%f");
_session = katze_array_new (KATZE_TYPE_ITEM);
midori_startup_timer ("Trash read: \t%f");
history = katze_array_new (KATZE_TYPE_ARRAY);
- #if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("history.db"));
errmsg = NULL;
g_free (errmsg);
}
g_object_set_data (G_OBJECT (history), "db", db);
- #endif
midori_startup_timer ("History read: \t%f");
/* In case of errors */
G_CALLBACK (midori_trash_add_item_cb), NULL);
g_signal_connect_after (trash, "remove-item",
G_CALLBACK (midori_trash_remove_item_cb), NULL);
- #if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("history.db"));
- #endif
katze_item_set_parent (KATZE_ITEM (_session), app);
g_object_set_data (G_OBJECT (app), "extensions", extensions);
gtk_main ();
settings = katze_object_get_object (app, "settings");
- #if HAVE_SQLITE
g_object_get (settings, "maximum-history-age", &max_history_age, NULL);
midori_history_terminate (db, max_history_age);
- #endif
/* Clear data on quit, according to the Clear private data dialog */
g_object_get (settings, "clear-private-data", &clear_prefs, NULL);
if (clear_prefs & MIDORI_CLEAR_ON_QUIT)
{
- #if HAVE_SQLITE
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_HISTORY, "history.db");
- #endif
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_COOKIES, "cookies.txt");
if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES)
{
#include <X11/Xatom.h>
#endif
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
+#include <sqlite3.h>
#if HAVE_CONFIG_H
#include <config.h>
GValue* value,
GParamSpec* pspec);
-#if HAVE_SQLITE
void
midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array,
void
midori_bookmarks_remove_item_from_db (sqlite3* db,
KatzeItem* item);
-#endif
static void
midori_browser_new_history_item (MidoriBrowser* browser,
midori_browser_update_history_title (MidoriBrowser* browser,
KatzeItem* item)
{
- #if HAVE_SQLITE
sqlite3* db;
static sqlite3_stmt* stmt = NULL;
g_printerr (_("Failed to update title: %s\n"), sqlite3_errmsg (db));
sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt);
- #endif
}
static void
GtkWidget* check_toolbar;
GtkWidget* check_app;
gboolean return_status = FALSE;
- #if HAVE_SQLITE
sqlite3* db;
- #endif
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
return FALSE;
- #if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
- #endif
if (is_folder)
title = new_bookmark ? _("New folder") : _("Edit folder");
{
GtkListStore* model;
GtkCellRenderer* renderer;
- #if HAVE_SQLITE
guint i, n;
sqlite3_stmt* statement;
gint result;
const gchar* sqlcmd;
- #endif
hbox = gtk_hbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
0, _("Toplevel folder"), 1, PANGO_ELLIPSIZE_END, -1);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_folder), 0);
- #if HAVE_SQLITE
i = 0;
n = 1;
sqlcmd = "SELECT title from bookmarks where uri=''";
}
if (n < 2)
gtk_widget_set_sensitive (combo_folder, FALSE);
- #endif
gtk_box_pack_start (GTK_BOX (hbox), combo_folder, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (content_area), hbox);
selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder));
- #if HAVE_SQLITE
midori_bookmarks_remove_item_from_db (db, bookmark);
if (!strcmp (selected, _("Toplevel folder")))
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar)))
if (!gtk_widget_get_visible (browser->bookmarkbar))
_action_set_active (browser, "Bookmarkbar", TRUE);
- #endif
g_free (selected);
return_status = TRUE;
}
gchar** parts;
gchar* keywords = NULL;
const gchar* search_uri = NULL;
- #if HAVE_SQLITE
time_t now;
gint64 day;
sqlite3* db;
static sqlite3_stmt* statement = NULL;
- #endif
/* Do we have a keyword and a string? */
parts = g_strsplit (stripped_uri, " ", 2);
}
new_uri = sokoke_search_uri (search_uri, keywords);
- #if HAVE_SQLITE
now = time (NULL);
day = sokoke_time_t_to_julian (&now);
sqlite3_reset (statement);
if (sqlite3_step (statement) == SQLITE_DONE)
sqlite3_clear_bindings (statement);
- #endif
g_free (keywords);
}
g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL);
- #if HAVE_SQLITE
button = g_object_get_data (G_OBJECT (dialog), "history");
if (gtk_toggle_button_get_active (button))
{
}
clear_prefs |= MIDORI_CLEAR_HISTORY;
}
- #endif
button = g_object_get_data (G_OBJECT (dialog), "cookies");
if (gtk_toggle_button_get_active (button))
{
vbox = gtk_vbox_new (TRUE, 4);
alignment = gtk_alignment_new (0, 0, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0);
- #if HAVE_SQLITE
button = gtk_check_button_new_with_mnemonic (_("History"));
if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_object_set_data (G_OBJECT (dialog), "history", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
- #endif
button = gtk_check_button_new_with_mnemonic (_("Cookies"));
if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
{
time_t now;
gint64 day;
- #if HAVE_SQLITE
sqlite3* db;
static sqlite3_stmt* stmt = NULL;
- #endif
now = time (NULL);
katze_item_set_added (*item, now);
day = sokoke_time_t_to_julian (&now);
- #if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (browser->history), "db");
if (!stmt)
{
sqlite3_errmsg (db));
sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt);
- #endif
}
static void
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
+#include <sqlite3.h>
#define COMPLETION_DELAY 200
#define MAX_ITEMS 25
return model;
}
-#if HAVE_SQLITE
static void
midori_location_action_popup_position (GtkWidget* popup,
GtkWidget* widget)
return FALSE;
}
-#endif
static void
midori_location_action_popup_completion (MidoriLocationAction* action,
action->entry = entry;
g_signal_connect (entry, "destroy",
G_CALLBACK (gtk_widget_destroyed), &action->entry);
- #if HAVE_SQLITE
action->completion_timeout = g_timeout_add (COMPLETION_DELAY,
midori_location_action_popup_timeout_cb, action);
/* TODO: Inline completion */
- #endif
}
static void
MidoriLocationAction* location_action)
{ 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);
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);
}
midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
MidoriLocationAction* location_action)
{
- #if HAVE_SQLITE
GtkListStore* store;
gint result;
const gchar* sqlcmd;
while (result == SQLITE_ROW);
sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt);
- #endif
}
static void
"<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
"<tr><td>Glib</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
"<tr><td>libsoup</td><td>%s</td></tr>"
- "<tr><td>sqlite3</td><td>%s</td></tr>"
"<tr><td>libnotify</td><td>%s</td></tr>"
"<tr><td>libidn</td><td>%s</td></tr>"
"<tr><td>libunique</td><td>%s</td></tr>"
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
glib_major_version, glib_minor_version, glib_micro_version,
LIBSOUP_VERSION,
- HAVE_SQLITE ? "Yes" : "No",
HAVE_LIBNOTIFY ? "Yes" : "No",
HAVE_LIBIDN ? "Yes" : "No",
HAVE_UNIQUE ? "Yes" : "No",
return STOCK_BOOKMARKS;
}
-#if HAVE_SQLITE
void
midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array,
sqlite3_free (sqlcmd);
}
-#endif
static void
midori_bookmarks_row_changed_cb (GtkTreeModel* model,
{
GtkTreeModel* model;
GtkTreeIter iter;
- #if HAVE_SQLITE
sqlite3* db;
db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
- #endif
-
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview),
&model, &iter))
{
gtk_tree_model_get (model, &iter, 0, &item, -1);
- #if HAVE_SQLITE
midori_bookmarks_remove_item_from_db (db, item);
- #endif
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
g_object_unref (item);
bookmarks->array = katze_object_get_object (app, "bookmarks");
g_object_set_data (G_OBJECT (bookmarks->array), "treeview", bookmarks->treeview);
- #if HAVE_SQLITE
midori_bookmarks_read_from_db_to_model (bookmarks, GTK_TREE_STORE (model), NULL, "", NULL);
g_signal_connect_after (model, "row-changed",
G_CALLBACK (midori_bookmarks_row_changed_cb),
bookmarks);
- #endif
}
static void
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
gtk_tree_model_get (model, iter, 0, &item, -1);
- #if HAVE_SQLITE
midori_bookmarks_read_from_db_to_model (bookmarks, GTK_TREE_STORE (model),
iter, katze_item_get_name (item), NULL);
- #endif
g_object_unref (item);
}
GTK_ICON_ENTRY_SECONDARY, TRUE);
g_signal_connect (entry, "icon-release",
G_CALLBACK (midori_bookmarks_filter_entry_clear_cb), bookmarks);
- #if HAVE_SQLITE
g_signal_connect (entry, "changed",
G_CALLBACK (midori_bookmarks_filter_entry_changed_cb), bookmarks);
- #endif
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
gtk_widget_show_all (box);
#include "config.h"
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
-
+#include <sqlite3.h>
#include <gtk/gtk.h>
#include <katze/katze.h>
GtkWidget*
midori_bookmarks_new (void);
-#if HAVE_SQLITE
void
midori_bookmarks_insert_item_db (sqlite3* db,
KatzeItem* item,
midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array,
const gchar* folder);
-#endif
G_END_DECLS
gboolean is_folder);
#include "config.h"
-
-#if HAVE_SQLITE
- #include <sqlite3.h>
-#endif
+#include <sqlite3.h>
#define COMPLETION_DELAY 200
return STOCK_HISTORY;
}
-#if HAVE_SQLITE
static void
midori_history_clear_db (MidoriHistory* history)
{
midori_history_clear_db (history);
}
-#endif
static void
midori_history_bookmark_add_cb (GtkWidget* menuitem,
if (!history->toolbar)
{
GtkWidget* toolbar;
- #if HAVE_SQLITE
GtkToolItem* toolitem;
- #endif
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
history->toolbar = toolbar;
- #if HAVE_SQLITE
toolitem = gtk_tool_button_new_from_stock (STOCK_BOOKMARK_ADD);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Bookmark the selected history item"));
G_CALLBACK (gtk_widget_destroyed), &history->delete);
g_signal_connect (history->clear, "destroy",
G_CALLBACK (gtk_widget_destroyed), &history->clear);
- #endif
}
return history->toolbar;
history->array = katze_object_get_object (app, "history");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (history->treeview));
- #if HAVE_SQLITE
if (history->array)
midori_history_read_from_db (history, GTK_TREE_STORE (model), NULL, 0, NULL);
- #endif
}
static void
}
}
-#if HAVE_SQLITE
static void
midori_history_row_activated_cb (GtkTreeView* treeview,
GtkTreePath* path,
midori_history_filter_timeout_cb, history);
katze_assign (history->filter, g_strdup (gtk_entry_get_text (entry)));
}
-#endif
+
static void
midori_history_filter_entry_clear_cb (GtkEntry* entry,
gint icon_pos,
TRUE);
g_signal_connect (entry, "icon-release",
G_CALLBACK (midori_history_filter_entry_clear_cb), history);
- #if HAVE_SQLITE
g_signal_connect (entry, "changed",
G_CALLBACK (midori_history_filter_entry_changed_cb), history);
- #endif
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
gtk_widget_show_all (box);
"text", 1, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
g_object_unref (model);
- #if HAVE_SQLITE
g_object_connect (treeview,
"signal::row-activated",
midori_history_row_activated_cb, history,
"signal::popup-menu",
midori_history_popup_menu_cb, history,
NULL);
- #endif
gtk_widget_show (treeview);
gtk_box_pack_start (GTK_BOX (history), treeview, TRUE, TRUE, 0);
history->treeview = treeview;
check_pkg ('libsoup-2.4', '2.29.91', False, var='LIBSOUP_2_29_91')
check_pkg ('libxml-2.0', '2.6')
check_pkg ('sqlite3', '3.0', True, var='SQLITE')
- conf.define ('HAVE_SQLITE', 1)
if conf.env['HAVE_LIBSOUP_2_27_90']:
idn = 'yes'