char** errmsg)
{
sqlite3* db;
- gboolean has_day;
+ gboolean has_day = FALSE;
sqlite3_stmt* stmt;
gint result;
gchar* sql;
- has_day = FALSE;
-
if (sqlite3_open (filename, &db) != SQLITE_OK)
{
if (errmsg)
{
g_string_append_printf (error_messages,
_("Bookmarks couldn't be loaded: %s\n"), errmsg);
- g_free (errmsg);
+ errmsg = NULL;
}
else if (!bookmarks_exist)
{
{
g_string_append_printf (error_messages,
_("The history couldn't be loaded: %s\n"), errmsg);
- g_free (errmsg);
+ errmsg = NULL;
}
g_free (bookmarks_file);
midori_startup_timer ("History read: \t%f");
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
+ if (!db)
+ return FALSE;
+
if (is_folder)
title = new_bookmark ? _("New folder") : _("Edit folder");
else
{
sqlite3* db;
db = g_object_get_data (G_OBJECT (action->history), "db");
+
+ if (!db)
+ return FALSE;
+
sqlcmd = "SELECT type, uri, title FROM ("
" SELECT 1 AS type, uri, title, count() AS ct FROM history "
" WHERE uri LIKE ?1 OR title LIKE ?1 GROUP BY uri "
KatzeItem* item;
GList* list;
+ if (!db)
+ return;
+
sqlcmd = g_strdup_printf ("SELECT * FROM bookmarks where folder='%s'", folder);
root_array = katze_array_from_sqlite (db, sqlcmd);
g_free (sqlcmd);
GList* list;
KatzeItem* item;
+ if (!db)
+ return;
+
KATZE_ARRAY_FOREACH_ITEM_L (item, array, list)
{
if (KATZE_IS_ARRAY (item))
db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
+ if (!db)
+ return katze_array_new (KATZE_TYPE_ITEM);
+
if (keyword && *keyword)
{
gchar* filterstr;
}
if (result != SQLITE_OK)
- return NULL;
+ return katze_array_new (KATZE_TYPE_ITEM);
return katze_array_from_statement (statement);
}
/* Bookmarks must have a name, import may produce invalid items */
g_return_if_fail (katze_item_get_name (item));
+ if (!db)
+ return;
+
if (KATZE_ITEM_IS_BOOKMARK (item))
uri = g_strdup (katze_item_get_uri (item));
else
db = g_object_get_data (G_OBJECT (history->array), "db");
+ if (!db)
+ return;
+
if (KATZE_ITEM_IS_BOOKMARK (item))
sqlcmd = sqlite3_mprintf (
"DELETE FROM history WHERE uri = '%q' AND"
db = g_object_get_data (G_OBJECT (history->array), "db");
+ if (!db)
+ return katze_array_new (KATZE_TYPE_ITEM);
+
if (filter && *filter)
{
gchar* filterstr;
}
if (result != SQLITE_OK)
- return NULL;
+ return katze_array_new (KATZE_TYPE_ITEM);
return katze_array_from_statement (statement);
}
{
GtkTreeModel* model;
GtkTreeIter iter;
- KatzeItem* item;
+ KatzeItem* item = NULL;
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (history));
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (history->treeview),
gtk_tree_model_get (model, &iter, 0, &item, -1);
if (KATZE_IS_ITEM (item) && katze_item_get_uri (item))
+ {
midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE);
+ g_object_unref (item);
+ }
else
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
-
- g_object_unref (item);
}
static GtkWidget*
KatzeArray* array;
db = g_object_get_data (G_OBJECT (history->array), "db");
+
+ if (!db)
+ return;
+
sqlcmd = g_strdup_printf ("SELECT uri, title, date, day "
"FROM history WHERE day = %d "
"GROUP BY uri ORDER BY date ASC",