| 1 |
/* font-manager-database.h |
| 2 |
* |
| 3 |
* Copyright (C) 2009-2025 Jerry Casiano |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. |
| 17 |
* |
| 18 |
* If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <locale.h> |
| 24 |
#include <glib.h> |
| 25 |
#include <glib/gprintf.h> |
| 26 |
#include <glib/gstdio.h> |
| 27 |
#include <gmodule.h> |
| 28 |
#include <glib-object.h> |
| 29 |
#include <json-glib/json-glib.h> |
| 30 |
#include <sqlite3.h> |
| 31 |
|
| 32 |
#include "font-manager-orthographies.h" |
| 33 |
#include "font-manager-fontconfig.h" |
| 34 |
#include "font-manager-freetype.h" |
| 35 |
#include "font-manager-json.h" |
| 36 |
#include "font-manager-font.h" |
| 37 |
#include "font-manager-family.h" |
| 38 |
#include "font-manager-font-info.h" |
| 39 |
#include "font-manager-progress-data.h" |
| 40 |
#include "font-manager-string-set.h" |
| 41 |
#include "font-manager-utils.h" |
| 42 |
|
| 43 |
#define FONT_MANAGER_CURRENT_DATABASE_VERSION 3 |
| 44 |
|
| 45 |
#define FONT_MANAGER_TYPE_DATABASE font_manager_database_get_type() |
| 46 |
G_DECLARE_FINAL_TYPE(FontManagerDatabase, font_manager_database, FONT_MANAGER, DATABASE, GObject) |
| 47 |
|
| 48 |
FontManagerDatabase * font_manager_database_new (void); |
| 49 |
void font_manager_database_open (FontManagerDatabase *self, GError **error); |
| 50 |
void font_manager_database_close (FontManagerDatabase *self, GError **error); |
| 51 |
void font_manager_database_begin_transaction (FontManagerDatabase *self, GError **error); |
| 52 |
void font_manager_database_commit_transaction (FontManagerDatabase *self, GError **error); |
| 53 |
void font_manager_database_execute_query (FontManagerDatabase *self, const gchar *sql, GError **error); |
| 54 |
void font_manager_database_end_query (FontManagerDatabase *self); |
| 55 |
sqlite3_stmt * font_manager_database_get_cursor (FontManagerDatabase *self); |
| 56 |
void font_manager_database_vacuum (FontManagerDatabase *self, GError **error); |
| 57 |
void font_manager_database_initialize (FontManagerDatabase *self, GError **error); |
| 58 |
JsonObject * font_manager_database_get_object (FontManagerDatabase *self, const gchar *sql, GError **error); |
| 59 |
|
| 60 |
/* Related functions */ |
| 61 |
|
| 62 |
void font_manager_update_database (FontManagerDatabase *db, |
| 63 |
JsonArray *available_fonts, |
| 64 |
FontManagerProgressCallback progress, |
| 65 |
GCancellable *cancellable, |
| 66 |
GAsyncReadyCallback callback, |
| 67 |
gpointer user_data); |
| 68 |
|
| 69 |
gboolean font_manager_update_database_finish (GAsyncResult *result, GError **error); |
| 70 |
|
| 71 |
void font_manager_get_matching_families_and_fonts (FontManagerDatabase *db, |
| 72 |
FontManagerStringSet *families, |
| 73 |
FontManagerStringSet *fonts, |
| 74 |
const gchar *sql, |
| 75 |
GError **error); |
| 76 |
|
| 77 |
|