Remove conditional guards for sqlite

This commit is contained in:
Christian Dywan 2010-07-17 21:31:29 +02:00
parent 57683d45b1
commit 94fbf158f6
9 changed files with 7 additions and 115 deletions

View file

@ -21,9 +21,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_SQLITE #include <sqlite3.h>
#include <sqlite3.h>
#endif
static GHashTable* global_keys; static GHashTable* global_keys;
static gchar* jsforms; static gchar* jsforms;
@ -130,7 +128,6 @@ formhistory_update_database (gpointer db,
const gchar* key, const gchar* key,
const gchar* value) const gchar* value)
{ {
#if HAVE_SQLITE
gchar* sqlcmd; gchar* sqlcmd;
gchar* errmsg; gchar* errmsg;
gint success; gint success;
@ -146,7 +143,6 @@ formhistory_update_database (gpointer db,
g_free (errmsg); g_free (errmsg);
return; return;
} }
#endif
} }
static gboolean static gboolean
@ -372,9 +368,7 @@ formhistory_deactivate_cb (MidoriExtension* extension,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
MidoriApp* app = midori_extension_get_app (extension); MidoriApp* app = midori_extension_get_app (extension);
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
#endif
g_signal_handlers_disconnect_by_func ( g_signal_handlers_disconnect_by_func (
browser, formhistory_add_tab_cb, extension); browser, formhistory_add_tab_cb, extension);
@ -389,13 +383,10 @@ formhistory_deactivate_cb (MidoriExtension* extension,
if (global_keys) if (global_keys)
g_hash_table_destroy (global_keys); g_hash_table_destroy (global_keys);
#if HAVE_SQLITE
if ((db = g_object_get_data (G_OBJECT (extension), "formhistory-db"))) if ((db = g_object_get_data (G_OBJECT (extension), "formhistory-db")))
sqlite3_close (db); sqlite3_close (db);
#endif
} }
#if HAVE_SQLITE
static int static int
formhistory_add_field (gpointer data, formhistory_add_field (gpointer data,
int argc, int argc,
@ -423,18 +414,15 @@ formhistory_add_field (gpointer data,
} }
return 0; return 0;
} }
#endif
static void static void
formhistory_activate_cb (MidoriExtension* extension, formhistory_activate_cb (MidoriExtension* extension,
MidoriApp* app) MidoriApp* app)
{ {
#if HAVE_SQLITE
const gchar* config_dir; const gchar* config_dir;
gchar* filename; gchar* filename;
sqlite3* db; sqlite3* db;
char* errmsg = NULL, *errmsg2 = NULL; char* errmsg = NULL, *errmsg2 = NULL;
#endif
KatzeArray* browsers; KatzeArray* browsers;
MidoriBrowser* browser; MidoriBrowser* browser;
guint i; guint i;
@ -444,7 +432,6 @@ formhistory_activate_cb (MidoriExtension* extension,
(GDestroyNotify)g_free); (GDestroyNotify)g_free);
if(!jsforms) if(!jsforms)
formhistory_prepare_js (); formhistory_prepare_js ();
#if HAVE_SQLITE
config_dir = midori_extension_get_config_dir (extension); config_dir = midori_extension_get_config_dir (extension);
katze_mkdir_with_parents (config_dir, 0700); katze_mkdir_with_parents (config_dir, 0700);
filename = g_build_filename (config_dir, "forms.db", NULL); filename = g_build_filename (config_dir, "forms.db", NULL);
@ -475,7 +462,6 @@ formhistory_activate_cb (MidoriExtension* extension,
} }
sqlite3_close (db); sqlite3_close (db);
} }
#endif
browsers = katze_object_get_object (app, "browsers"); browsers = katze_object_get_object (app, "browsers");
i = 0; i = 0;

View file

@ -33,10 +33,7 @@
#include <string.h> #include <string.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <webkit/webkit.h> #include <webkit/webkit.h>
#include <sqlite3.h>
#if HAVE_SQLITE
#include <sqlite3.h>
#endif
#if ENABLE_NLS #if ENABLE_NLS
#include <libintl.h> #include <libintl.h>
@ -351,7 +348,6 @@ search_engines_save_to_file (KatzeArray* search_engines,
return saved; return saved;
} }
#if HAVE_SQLITE
static sqlite3* static sqlite3*
midori_history_initialize (KatzeArray* array, midori_history_initialize (KatzeArray* array,
const gchar* filename, const gchar* filename,
@ -471,7 +467,6 @@ midori_bookmarks_import (const gchar* filename,
} }
midori_bookmarks_import_array_db (db, bookmarks, ""); midori_bookmarks_import_array_db (db, bookmarks, "");
} }
#endif
static void static void
midori_session_add_delay (KatzeArray* session) midori_session_add_delay (KatzeArray* session)
@ -1561,11 +1556,9 @@ main (int argc,
gchar* uri; gchar* uri;
KatzeItem* item; KatzeItem* item;
gchar* uri_ready; gchar* uri_ready;
#if HAVE_SQLITE
gchar* errmsg; gchar* errmsg;
sqlite3* db; sqlite3* db;
gint max_history_age; gint max_history_age;
#endif
gint clear_prefs = MIDORI_CLEAR_NONE; gint clear_prefs = MIDORI_CLEAR_NONE;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
gboolean startup_timer = g_getenv ("MIDORI_STARTTIME") != NULL; gboolean startup_timer = g_getenv ("MIDORI_STARTTIME") != NULL;
@ -1888,7 +1881,6 @@ main (int argc,
midori_startup_timer ("Search read: \t%f"); midori_startup_timer ("Search read: \t%f");
bookmarks = katze_array_new (KATZE_TYPE_ARRAY); bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
#if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("bookmarks.db")); katze_assign (config_file, build_config_filename ("bookmarks.db"));
errmsg = NULL; errmsg = NULL;
if ((db = midori_bookmarks_initialize (bookmarks, config_file, &errmsg)) == NULL) if ((db = midori_bookmarks_initialize (bookmarks, config_file, &errmsg)) == NULL)
@ -1908,7 +1900,6 @@ main (int argc,
g_free (old_bookmarks); g_free (old_bookmarks);
g_object_set_data (G_OBJECT (bookmarks), "db", db); g_object_set_data (G_OBJECT (bookmarks), "db", db);
} }
#endif
midori_startup_timer ("Bookmarks read: \t%f"); midori_startup_timer ("Bookmarks read: \t%f");
_session = katze_array_new (KATZE_TYPE_ITEM); _session = katze_array_new (KATZE_TYPE_ITEM);
@ -1944,7 +1935,6 @@ main (int argc,
midori_startup_timer ("Trash read: \t%f"); midori_startup_timer ("Trash read: \t%f");
history = katze_array_new (KATZE_TYPE_ARRAY); history = katze_array_new (KATZE_TYPE_ARRAY);
#if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("history.db")); katze_assign (config_file, build_config_filename ("history.db"));
errmsg = NULL; errmsg = NULL;
@ -1955,7 +1945,6 @@ main (int argc,
g_free (errmsg); g_free (errmsg);
} }
g_object_set_data (G_OBJECT (history), "db", db); g_object_set_data (G_OBJECT (history), "db", db);
#endif
midori_startup_timer ("History read: \t%f"); midori_startup_timer ("History read: \t%f");
/* In case of errors */ /* In case of errors */
@ -2043,9 +2032,7 @@ main (int argc,
G_CALLBACK (midori_trash_add_item_cb), NULL); G_CALLBACK (midori_trash_add_item_cb), NULL);
g_signal_connect_after (trash, "remove-item", g_signal_connect_after (trash, "remove-item",
G_CALLBACK (midori_trash_remove_item_cb), NULL); G_CALLBACK (midori_trash_remove_item_cb), NULL);
#if HAVE_SQLITE
katze_assign (config_file, build_config_filename ("history.db")); katze_assign (config_file, build_config_filename ("history.db"));
#endif
katze_item_set_parent (KATZE_ITEM (_session), app); katze_item_set_parent (KATZE_ITEM (_session), app);
g_object_set_data (G_OBJECT (app), "extensions", extensions); g_object_set_data (G_OBJECT (app), "extensions", extensions);
@ -2107,18 +2094,14 @@ main (int argc,
gtk_main (); gtk_main ();
settings = katze_object_get_object (app, "settings"); settings = katze_object_get_object (app, "settings");
#if HAVE_SQLITE
g_object_get (settings, "maximum-history-age", &max_history_age, NULL); g_object_get (settings, "maximum-history-age", &max_history_age, NULL);
midori_history_terminate (db, max_history_age); midori_history_terminate (db, max_history_age);
#endif
/* Clear data on quit, according to the Clear private data dialog */ /* Clear data on quit, according to the Clear private data dialog */
g_object_get (settings, "clear-private-data", &clear_prefs, NULL); g_object_get (settings, "clear-private-data", &clear_prefs, NULL);
if (clear_prefs & MIDORI_CLEAR_ON_QUIT) if (clear_prefs & MIDORI_CLEAR_ON_QUIT)
{ {
#if HAVE_SQLITE
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_HISTORY, "history.db"); midori_remove_config_file (clear_prefs, MIDORI_CLEAR_HISTORY, "history.db");
#endif
midori_remove_config_file (clear_prefs, MIDORI_CLEAR_COOKIES, "cookies.txt"); midori_remove_config_file (clear_prefs, MIDORI_CLEAR_COOKIES, "cookies.txt");
if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES) if ((clear_prefs & MIDORI_CLEAR_FLASH_COOKIES) == MIDORI_CLEAR_FLASH_COOKIES)
{ {

View file

@ -48,9 +48,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#endif #endif
#if HAVE_SQLITE #include <sqlite3.h>
#include <sqlite3.h>
#endif
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include <config.h> #include <config.h>
@ -170,7 +168,6 @@ midori_browser_get_property (GObject* object,
GValue* value, GValue* value,
GParamSpec* pspec); GParamSpec* pspec);
#if HAVE_SQLITE
void void
midori_bookmarks_import_array_db (sqlite3* db, midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array, KatzeArray* array,
@ -184,7 +181,6 @@ midori_bookmarks_insert_item_db (sqlite3* db,
void void
midori_bookmarks_remove_item_from_db (sqlite3* db, midori_bookmarks_remove_item_from_db (sqlite3* db,
KatzeItem* item); KatzeItem* item);
#endif
static void static void
midori_browser_new_history_item (MidoriBrowser* browser, midori_browser_new_history_item (MidoriBrowser* browser,
@ -472,7 +468,6 @@ static void
midori_browser_update_history_title (MidoriBrowser* browser, midori_browser_update_history_title (MidoriBrowser* browser,
KatzeItem* item) KatzeItem* item)
{ {
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
static sqlite3_stmt* stmt = NULL; static sqlite3_stmt* stmt = NULL;
@ -492,7 +487,6 @@ midori_browser_update_history_title (MidoriBrowser* browser,
g_printerr (_("Failed to update title: %s\n"), sqlite3_errmsg (db)); g_printerr (_("Failed to update title: %s\n"), sqlite3_errmsg (db));
sqlite3_reset (stmt); sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt); sqlite3_clear_bindings (stmt);
#endif
} }
static void static void
@ -715,16 +709,12 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
GtkWidget* check_toolbar; GtkWidget* check_toolbar;
GtkWidget* check_app; GtkWidget* check_app;
gboolean return_status = FALSE; gboolean return_status = FALSE;
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
#endif
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser))) if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
return FALSE; return FALSE;
#if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db"); db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
#endif
if (is_folder) if (is_folder)
title = new_bookmark ? _("New folder") : _("Edit folder"); title = new_bookmark ? _("New folder") : _("Edit folder");
@ -817,12 +807,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
{ {
GtkListStore* model; GtkListStore* model;
GtkCellRenderer* renderer; GtkCellRenderer* renderer;
#if HAVE_SQLITE
guint i, n; guint i, n;
sqlite3_stmt* statement; sqlite3_stmt* statement;
gint result; gint result;
const gchar* sqlcmd; const gchar* sqlcmd;
#endif
hbox = gtk_hbox_new (FALSE, 8); hbox = gtk_hbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
@ -839,7 +827,6 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
0, _("Toplevel folder"), 1, PANGO_ELLIPSIZE_END, -1); 0, _("Toplevel folder"), 1, PANGO_ELLIPSIZE_END, -1);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_folder), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (combo_folder), 0);
#if HAVE_SQLITE
i = 0; i = 0;
n = 1; n = 1;
sqlcmd = "SELECT title from bookmarks where uri=''"; sqlcmd = "SELECT title from bookmarks where uri=''";
@ -856,7 +843,6 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
} }
if (n < 2) if (n < 2)
gtk_widget_set_sensitive (combo_folder, FALSE); gtk_widget_set_sensitive (combo_folder, FALSE);
#endif
gtk_box_pack_start (GTK_BOX (hbox), combo_folder, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), combo_folder, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_container_add (GTK_CONTAINER (content_area), hbox);
@ -927,7 +913,6 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder)); selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder));
#if HAVE_SQLITE
midori_bookmarks_remove_item_from_db (db, bookmark); midori_bookmarks_remove_item_from_db (db, bookmark);
if (!strcmp (selected, _("Toplevel folder"))) if (!strcmp (selected, _("Toplevel folder")))
{ {
@ -947,7 +932,6 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar)))
if (!gtk_widget_get_visible (browser->bookmarkbar)) if (!gtk_widget_get_visible (browser->bookmarkbar))
_action_set_active (browser, "Bookmarkbar", TRUE); _action_set_active (browser, "Bookmarkbar", TRUE);
#endif
g_free (selected); g_free (selected);
return_status = TRUE; return_status = TRUE;
} }
@ -3481,12 +3465,10 @@ _action_location_submit_uri (GtkAction* action,
gchar** parts; gchar** parts;
gchar* keywords = NULL; gchar* keywords = NULL;
const gchar* search_uri = NULL; const gchar* search_uri = NULL;
#if HAVE_SQLITE
time_t now; time_t now;
gint64 day; gint64 day;
sqlite3* db; sqlite3* db;
static sqlite3_stmt* statement = NULL; static sqlite3_stmt* statement = NULL;
#endif
/* Do we have a keyword and a string? */ /* Do we have a keyword and a string? */
parts = g_strsplit (stripped_uri, " ", 2); parts = g_strsplit (stripped_uri, " ", 2);
@ -3510,7 +3492,6 @@ _action_location_submit_uri (GtkAction* action,
} }
new_uri = sokoke_search_uri (search_uri, keywords); new_uri = sokoke_search_uri (search_uri, keywords);
#if HAVE_SQLITE
now = time (NULL); now = time (NULL);
day = sokoke_time_t_to_julian (&now); day = sokoke_time_t_to_julian (&now);
@ -3531,7 +3512,6 @@ _action_location_submit_uri (GtkAction* action,
sqlite3_reset (statement); sqlite3_reset (statement);
if (sqlite3_step (statement) == SQLITE_DONE) if (sqlite3_step (statement) == SQLITE_DONE)
sqlite3_clear_bindings (statement); sqlite3_clear_bindings (statement);
#endif
g_free (keywords); g_free (keywords);
} }
@ -4151,7 +4131,6 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL); g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL);
#if HAVE_SQLITE
button = g_object_get_data (G_OBJECT (dialog), "history"); button = g_object_get_data (G_OBJECT (dialog), "history");
if (gtk_toggle_button_get_active (button)) if (gtk_toggle_button_get_active (button))
{ {
@ -4178,7 +4157,6 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
} }
clear_prefs |= MIDORI_CLEAR_HISTORY; clear_prefs |= MIDORI_CLEAR_HISTORY;
} }
#endif
button = g_object_get_data (G_OBJECT (dialog), "cookies"); button = g_object_get_data (G_OBJECT (dialog), "cookies");
if (gtk_toggle_button_get_active (button)) if (gtk_toggle_button_get_active (button))
{ {
@ -4308,13 +4286,11 @@ _action_clear_private_data_activate (GtkAction* action,
vbox = gtk_vbox_new (TRUE, 4); vbox = gtk_vbox_new (TRUE, 4);
alignment = gtk_alignment_new (0, 0, 1, 1); alignment = gtk_alignment_new (0, 0, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0);
#if HAVE_SQLITE
button = gtk_check_button_new_with_mnemonic (_("History")); button = gtk_check_button_new_with_mnemonic (_("History"));
if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY) if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_object_set_data (G_OBJECT (dialog), "history", button); g_object_set_data (G_OBJECT (dialog), "history", button);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
#endif
button = gtk_check_button_new_with_mnemonic (_("Cookies")); button = gtk_check_button_new_with_mnemonic (_("Cookies"));
if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES) if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@ -5333,16 +5309,13 @@ midori_browser_new_history_item (MidoriBrowser* browser,
{ {
time_t now; time_t now;
gint64 day; gint64 day;
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
static sqlite3_stmt* stmt = NULL; static sqlite3_stmt* stmt = NULL;
#endif
now = time (NULL); now = time (NULL);
katze_item_set_added (*item, now); katze_item_set_added (*item, now);
day = sokoke_time_t_to_julian (&now); day = sokoke_time_t_to_julian (&now);
#if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (browser->history), "db"); db = g_object_get_data (G_OBJECT (browser->history), "db");
if (!stmt) if (!stmt)
{ {
@ -5361,7 +5334,6 @@ midori_browser_new_history_item (MidoriBrowser* browser,
sqlite3_errmsg (db)); sqlite3_errmsg (db));
sqlite3_reset (stmt); sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt); sqlite3_clear_bindings (stmt);
#endif
} }
static void static void

View file

@ -21,9 +21,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#if HAVE_SQLITE #include <sqlite3.h>
#include <sqlite3.h>
#endif
#define COMPLETION_DELAY 200 #define COMPLETION_DELAY 200
#define MAX_ITEMS 25 #define MAX_ITEMS 25
@ -274,7 +272,6 @@ midori_location_action_create_model (void)
return model; return model;
} }
#if HAVE_SQLITE
static void static void
midori_location_action_popup_position (GtkWidget* popup, midori_location_action_popup_position (GtkWidget* popup,
GtkWidget* widget) GtkWidget* widget)
@ -516,7 +513,6 @@ midori_location_action_popup_timeout_cb (gpointer data)
return FALSE; return FALSE;
} }
#endif
static void static void
midori_location_action_popup_completion (MidoriLocationAction* action, midori_location_action_popup_completion (MidoriLocationAction* action,
@ -529,11 +525,9 @@ midori_location_action_popup_completion (MidoriLocationAction* action,
action->entry = entry; action->entry = entry;
g_signal_connect (entry, "destroy", g_signal_connect (entry, "destroy",
G_CALLBACK (gtk_widget_destroyed), &action->entry); G_CALLBACK (gtk_widget_destroyed), &action->entry);
#if HAVE_SQLITE
action->completion_timeout = g_timeout_add (COMPLETION_DELAY, action->completion_timeout = g_timeout_add (COMPLETION_DELAY,
midori_location_action_popup_timeout_cb, action); midori_location_action_popup_timeout_cb, action);
/* TODO: Inline completion */ /* TODO: Inline completion */
#endif
} }
static void static void
@ -633,17 +627,14 @@ midori_location_action_toggle_arrow_cb (GtkWidget* widget,
MidoriLocationAction* location_action) MidoriLocationAction* location_action)
{ gboolean show = FALSE; { gboolean show = FALSE;
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
const gchar* sqlcmd; const gchar* sqlcmd;
sqlite3_stmt* statement; sqlite3_stmt* statement;
gint result; gint result;
#endif
if (!GTK_IS_BUTTON (widget)) if (!GTK_IS_BUTTON (widget))
return; return;
#if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (location_action->history), "db"); db = g_object_get_data (G_OBJECT (location_action->history), "db");
sqlcmd = "SELECT uri FROM history LIMIT 1"; sqlcmd = "SELECT uri FROM history LIMIT 1";
sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
@ -651,7 +642,6 @@ midori_location_action_toggle_arrow_cb (GtkWidget* widget,
if (result == SQLITE_ROW) if (result == SQLITE_ROW)
show = TRUE; show = TRUE;
sqlite3_finalize (statement); sqlite3_finalize (statement);
#endif
sokoke_widget_set_visible (widget, show); sokoke_widget_set_visible (widget, show);
gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1); gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1);
} }
@ -1171,7 +1161,6 @@ static void
midori_location_action_entry_popup_cb (GtkComboBox* combo_box, midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
MidoriLocationAction* location_action) MidoriLocationAction* location_action)
{ {
#if HAVE_SQLITE
GtkListStore* store; GtkListStore* store;
gint result; gint result;
const gchar* sqlcmd; const gchar* sqlcmd;
@ -1217,7 +1206,6 @@ midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
while (result == SQLITE_ROW); while (result == SQLITE_ROW);
sqlite3_reset (stmt); sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt); sqlite3_clear_bindings (stmt);
#endif
} }
static void static void

View file

@ -3658,7 +3658,6 @@ midori_view_set_uri (MidoriView* view,
"<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>" "<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>Glib</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
"<tr><td>libsoup</td><td>%s</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>libnotify</td><td>%s</td></tr>"
"<tr><td>libidn</td><td>%s</td></tr>" "<tr><td>libidn</td><td>%s</td></tr>"
"<tr><td>libunique</td><td>%s</td></tr>" "<tr><td>libunique</td><td>%s</td></tr>"
@ -3680,7 +3679,6 @@ midori_view_set_uri (MidoriView* view,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION, GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
glib_major_version, glib_minor_version, glib_micro_version, glib_major_version, glib_minor_version, glib_micro_version,
LIBSOUP_VERSION, LIBSOUP_VERSION,
HAVE_SQLITE ? "Yes" : "No",
HAVE_LIBNOTIFY ? "Yes" : "No", HAVE_LIBNOTIFY ? "Yes" : "No",
HAVE_LIBIDN ? "Yes" : "No", HAVE_LIBIDN ? "Yes" : "No",
HAVE_UNIQUE ? "Yes" : "No", HAVE_UNIQUE ? "Yes" : "No",

View file

@ -122,7 +122,6 @@ midori_bookmarks_get_stock_id (MidoriViewable* viewable)
return STOCK_BOOKMARKS; return STOCK_BOOKMARKS;
} }
#if HAVE_SQLITE
void void
midori_bookmarks_import_array_db (sqlite3* db, midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array, KatzeArray* array,
@ -281,7 +280,6 @@ midori_bookmarks_remove_item_from_db (sqlite3* db,
sqlite3_free (sqlcmd); sqlite3_free (sqlcmd);
} }
#endif
static void static void
midori_bookmarks_row_changed_cb (GtkTreeModel* model, midori_bookmarks_row_changed_cb (GtkTreeModel* model,
@ -362,12 +360,9 @@ midori_bookmarks_delete_clicked_cb (GtkWidget* toolitem,
{ {
GtkTreeModel* model; GtkTreeModel* model;
GtkTreeIter iter; GtkTreeIter iter;
#if HAVE_SQLITE
sqlite3* db; sqlite3* db;
db = g_object_get_data (G_OBJECT (bookmarks->array), "db"); db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
#endif
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview), if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview),
&model, &iter)) &model, &iter))
{ {
@ -375,9 +370,7 @@ midori_bookmarks_delete_clicked_cb (GtkWidget* toolitem,
gtk_tree_model_get (model, &iter, 0, &item, -1); gtk_tree_model_get (model, &iter, 0, &item, -1);
#if HAVE_SQLITE
midori_bookmarks_remove_item_from_db (db, item); midori_bookmarks_remove_item_from_db (db, item);
#endif
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter); gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
g_object_unref (item); g_object_unref (item);
@ -473,12 +466,10 @@ midori_bookmarks_set_app (MidoriBookmarks* bookmarks,
bookmarks->array = katze_object_get_object (app, "bookmarks"); bookmarks->array = katze_object_get_object (app, "bookmarks");
g_object_set_data (G_OBJECT (bookmarks->array), "treeview", bookmarks->treeview); 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); midori_bookmarks_read_from_db_to_model (bookmarks, GTK_TREE_STORE (model), NULL, "", NULL);
g_signal_connect_after (model, "row-changed", g_signal_connect_after (model, "row-changed",
G_CALLBACK (midori_bookmarks_row_changed_cb), G_CALLBACK (midori_bookmarks_row_changed_cb),
bookmarks); bookmarks);
#endif
} }
static void static void
@ -830,10 +821,8 @@ midori_bookmarks_row_expanded_cb (GtkTreeView* treeview,
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
gtk_tree_model_get (model, iter, 0, &item, -1); gtk_tree_model_get (model, iter, 0, &item, -1);
#if HAVE_SQLITE
midori_bookmarks_read_from_db_to_model (bookmarks, GTK_TREE_STORE (model), midori_bookmarks_read_from_db_to_model (bookmarks, GTK_TREE_STORE (model),
iter, katze_item_get_name (item), NULL); iter, katze_item_get_name (item), NULL);
#endif
g_object_unref (item); g_object_unref (item);
} }
@ -917,10 +906,8 @@ midori_bookmarks_init (MidoriBookmarks* bookmarks)
GTK_ICON_ENTRY_SECONDARY, TRUE); GTK_ICON_ENTRY_SECONDARY, TRUE);
g_signal_connect (entry, "icon-release", g_signal_connect (entry, "icon-release",
G_CALLBACK (midori_bookmarks_filter_entry_clear_cb), bookmarks); G_CALLBACK (midori_bookmarks_filter_entry_clear_cb), bookmarks);
#if HAVE_SQLITE
g_signal_connect (entry, "changed", g_signal_connect (entry, "changed",
G_CALLBACK (midori_bookmarks_filter_entry_changed_cb), bookmarks); G_CALLBACK (midori_bookmarks_filter_entry_changed_cb), bookmarks);
#endif
box = gtk_hbox_new (FALSE, 0); box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3); gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
gtk_widget_show_all (box); gtk_widget_show_all (box);

View file

@ -14,10 +14,7 @@
#include "config.h" #include "config.h"
#if HAVE_SQLITE #include <sqlite3.h>
#include <sqlite3.h>
#endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <katze/katze.h> #include <katze/katze.h>
@ -45,7 +42,6 @@ midori_bookmarks_get_type (void);
GtkWidget* GtkWidget*
midori_bookmarks_new (void); midori_bookmarks_new (void);
#if HAVE_SQLITE
void void
midori_bookmarks_insert_item_db (sqlite3* db, midori_bookmarks_insert_item_db (sqlite3* db,
KatzeItem* item, KatzeItem* item,
@ -59,7 +55,6 @@ void
midori_bookmarks_import_array_db (sqlite3* db, midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array, KatzeArray* array,
const gchar* folder); const gchar* folder);
#endif
G_END_DECLS G_END_DECLS

View file

@ -34,10 +34,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
gboolean is_folder); gboolean is_folder);
#include "config.h" #include "config.h"
#include <sqlite3.h>
#if HAVE_SQLITE
#include <sqlite3.h>
#endif
#define COMPLETION_DELAY 200 #define COMPLETION_DELAY 200
@ -126,7 +123,6 @@ midori_history_get_stock_id (MidoriViewable* viewable)
return STOCK_HISTORY; return STOCK_HISTORY;
} }
#if HAVE_SQLITE
static void static void
midori_history_clear_db (MidoriHistory* history) midori_history_clear_db (MidoriHistory* history)
{ {
@ -376,7 +372,6 @@ midori_history_clear_clicked_cb (GtkWidget* toolitem,
midori_history_clear_db (history); midori_history_clear_db (history);
} }
#endif
static void static void
midori_history_bookmark_add_cb (GtkWidget* menuitem, midori_history_bookmark_add_cb (GtkWidget* menuitem,
@ -401,14 +396,11 @@ midori_history_get_toolbar (MidoriViewable* viewable)
if (!history->toolbar) if (!history->toolbar)
{ {
GtkWidget* toolbar; GtkWidget* toolbar;
#if HAVE_SQLITE
GtkToolItem* toolitem; GtkToolItem* toolitem;
#endif
toolbar = gtk_toolbar_new (); toolbar = gtk_toolbar_new ();
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
history->toolbar = toolbar; history->toolbar = toolbar;
#if HAVE_SQLITE
toolitem = gtk_tool_button_new_from_stock (STOCK_BOOKMARK_ADD); toolitem = gtk_tool_button_new_from_stock (STOCK_BOOKMARK_ADD);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Bookmark the selected history item")); _("Bookmark the selected history item"));
@ -440,7 +432,6 @@ midori_history_get_toolbar (MidoriViewable* viewable)
G_CALLBACK (gtk_widget_destroyed), &history->delete); G_CALLBACK (gtk_widget_destroyed), &history->delete);
g_signal_connect (history->clear, "destroy", g_signal_connect (history->clear, "destroy",
G_CALLBACK (gtk_widget_destroyed), &history->clear); G_CALLBACK (gtk_widget_destroyed), &history->clear);
#endif
} }
return history->toolbar; return history->toolbar;
@ -474,10 +465,8 @@ midori_history_set_app (MidoriHistory* history,
history->array = katze_object_get_object (app, "history"); history->array = katze_object_get_object (app, "history");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (history->treeview)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (history->treeview));
#if HAVE_SQLITE
if (history->array) if (history->array)
midori_history_read_from_db (history, GTK_TREE_STORE (model), NULL, 0, NULL); midori_history_read_from_db (history, GTK_TREE_STORE (model), NULL, 0, NULL);
#endif
} }
static void static void
@ -547,7 +536,6 @@ midori_history_treeview_render_icon_cb (GtkTreeViewColumn* column,
} }
} }
#if HAVE_SQLITE
static void static void
midori_history_row_activated_cb (GtkTreeView* treeview, midori_history_row_activated_cb (GtkTreeView* treeview,
GtkTreePath* path, GtkTreePath* path,
@ -873,7 +861,7 @@ midori_history_filter_entry_changed_cb (GtkEntry* entry,
midori_history_filter_timeout_cb, history); midori_history_filter_timeout_cb, history);
katze_assign (history->filter, g_strdup (gtk_entry_get_text (entry))); katze_assign (history->filter, g_strdup (gtk_entry_get_text (entry)));
} }
#endif
static void static void
midori_history_filter_entry_clear_cb (GtkEntry* entry, midori_history_filter_entry_clear_cb (GtkEntry* entry,
gint icon_pos, gint icon_pos,
@ -909,10 +897,8 @@ midori_history_init (MidoriHistory* history)
TRUE); TRUE);
g_signal_connect (entry, "icon-release", g_signal_connect (entry, "icon-release",
G_CALLBACK (midori_history_filter_entry_clear_cb), history); G_CALLBACK (midori_history_filter_entry_clear_cb), history);
#if HAVE_SQLITE
g_signal_connect (entry, "changed", g_signal_connect (entry, "changed",
G_CALLBACK (midori_history_filter_entry_changed_cb), history); G_CALLBACK (midori_history_filter_entry_changed_cb), history);
#endif
box = gtk_hbox_new (FALSE, 0); box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3); gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
gtk_widget_show_all (box); gtk_widget_show_all (box);
@ -934,7 +920,6 @@ midori_history_init (MidoriHistory* history)
"text", 1, NULL); "text", 1, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
g_object_unref (model); g_object_unref (model);
#if HAVE_SQLITE
g_object_connect (treeview, g_object_connect (treeview,
"signal::row-activated", "signal::row-activated",
midori_history_row_activated_cb, history, midori_history_row_activated_cb, history,
@ -949,7 +934,6 @@ midori_history_init (MidoriHistory* history)
"signal::popup-menu", "signal::popup-menu",
midori_history_popup_menu_cb, history, midori_history_popup_menu_cb, history,
NULL); NULL);
#endif
gtk_widget_show (treeview); gtk_widget_show (treeview);
gtk_box_pack_start (GTK_BOX (history), treeview, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (history), treeview, TRUE, TRUE, 0);
history->treeview = treeview; history->treeview = treeview;

View file

@ -220,7 +220,6 @@ def configure (conf):
check_pkg ('libsoup-2.4', '2.29.91', False, var='LIBSOUP_2_29_91') check_pkg ('libsoup-2.4', '2.29.91', False, var='LIBSOUP_2_29_91')
check_pkg ('libxml-2.0', '2.6') check_pkg ('libxml-2.0', '2.6')
check_pkg ('sqlite3', '3.0', True, var='SQLITE') check_pkg ('sqlite3', '3.0', True, var='SQLITE')
conf.define ('HAVE_SQLITE', 1)
if conf.env['HAVE_LIBSOUP_2_27_90']: if conf.env['HAVE_LIBSOUP_2_27_90']:
idn = 'yes' idn = 'yes'