[tracker/wip/carlosg/domain-ontologies: 9/76] libtracker-data: Remove TrackerDBInterface busy functions



commit 308a710c887baaa136d71bd9f8786d402f189fe3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jun 10 12:21:28 2017 +0200

    libtracker-data: Remove TrackerDBInterface busy functions
    
    We can't report progress from updates anyway, it doesn't make sense
    to spam the same state over and over. Just call the busy handler
    directly in the only place it's being used, at the beginning of the
    integrity check.

 src/libtracker-data/tracker-db-interface-sqlite.c |   31 ---------------------
 src/libtracker-data/tracker-db-interface.h        |    4 ---
 src/libtracker-data/tracker-db-manager.c          |    9 ++----
 3 files changed, 3 insertions(+), 41 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c 
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 44283ee..eb7d70e 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -55,8 +55,6 @@
 #include "tracker-db-manager.h"
 #include "tracker-data-enum-types.h"
 
-#define UNKNOWN_STATUS 0.5
-
 typedef struct {
        TrackerDBStatement *head;
        TrackerDBStatement *tail;
@@ -90,10 +88,6 @@ struct TrackerDBInterface {
        TrackerDBStatementLru select_stmt_lru;
        TrackerDBStatementLru update_stmt_lru;
 
-       TrackerBusyCallback busy_callback;
-       gpointer busy_user_data;
-       gchar *busy_status;
-
        gchar *fts_properties;
 
        /* Used if TRACKER_DB_INTERFACE_USE_MUTEX is set */
@@ -1362,12 +1356,6 @@ check_interrupt (void *user_data)
 {
        TrackerDBInterface *db_interface = user_data;
 
-       if (db_interface->busy_callback) {
-               db_interface->busy_callback (db_interface->busy_status,
-                                            UNKNOWN_STATUS, /* No idea to get the status from SQLite */
-                                            db_interface->busy_user_data);
-       }
-
        return g_cancellable_is_cancelled (db_interface->cancellable) ? 1 : 0;
 }
 
@@ -1913,7 +1901,6 @@ tracker_db_interface_sqlite_finalize (GObject *object)
        g_info ("Closed sqlite3 database:'%s'", db_interface->filename);
 
        g_free (db_interface->filename);
-       g_free (db_interface->busy_status);
 
        if (db_interface->user_data && db_interface->user_data_destroy_notify)
                db_interface->user_data_destroy_notify (db_interface->user_data);
@@ -1978,24 +1965,6 @@ tracker_db_interface_set_max_stmt_cache_size (TrackerDBInterface         *db_int
        }
 }
 
-void
-tracker_db_interface_set_busy_handler (TrackerDBInterface  *db_interface,
-                                       TrackerBusyCallback  busy_callback,
-                                       const gchar         *busy_status,
-                                       gpointer             busy_user_data)
-{
-       g_return_if_fail (TRACKER_IS_DB_INTERFACE (db_interface));
-       db_interface->busy_callback = busy_callback;
-       db_interface->busy_user_data = busy_user_data;
-       g_free (db_interface->busy_status);
-
-       if (busy_status) {
-               db_interface->busy_status = g_strdup (busy_status);
-       } else {
-               db_interface->busy_status = NULL;
-       }
-}
-
 static sqlite3_stmt *
 tracker_db_interface_prepare_stmt (TrackerDBInterface  *db_interface,
                                    const gchar         *full_query,
diff --git a/src/libtracker-data/tracker-db-interface.h b/src/libtracker-data/tracker-db-interface.h
index 16041cc..d5011a0 100644
--- a/src/libtracker-data/tracker-db-interface.h
+++ b/src/libtracker-data/tracker-db-interface.h
@@ -136,10 +136,6 @@ TrackerDBCursor *       tracker_db_statement_start_sparql_cursor     (TrackerDBS
                                                                       const gchar * const        
*variable_names,
                                                                       gint                        
n_variable_names,
                                                                       GError                    **error);
-void                    tracker_db_interface_set_busy_handler        (TrackerDBInterface         
*db_interface,
-                                                                      TrackerBusyCallback         
busy_callback,
-                                                                      const gchar                
*busy_status,
-                                                                      gpointer                    
busy_user_data);
 
 /* Functions to deal with a cursor */
 void                    tracker_db_cursor_rewind                     (TrackerDBCursor            *cursor);
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index eb915d0..18b0f73 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -46,6 +46,8 @@
 #include "tracker-db-interface.h"
 #include "tracker-data-manager.h"
 
+#define UNKNOWN_STATUS 0.5
+
 /* ZLib buffer settings */
 #define ZLIB_BUF_SIZE                 8192
 
@@ -772,10 +774,7 @@ tracker_db_manager_new (TrackerDBManagerFlags   flags,
                                busy_status = g_strdup_printf ("%s - %s",
                                                               busy_operation,
                                                               "Integrity checking");
-                               tracker_db_interface_set_busy_handler (db_manager->db.iface,
-                                                                      busy_callback,
-                                                                      busy_status,
-                                                                      busy_user_data);
+                               busy_callback (busy_status, 0, busy_user_data);
                                g_free (busy_status);
 
                                stmt = tracker_db_interface_create_statement (db_manager->db.iface, 
TRACKER_DB_STATEMENT_CACHE_TYPE_NONE,
@@ -828,8 +827,6 @@ tracker_db_manager_new (TrackerDBManagerFlags   flags,
                                } else {
                                        g_object_unref (stmt);
                                }
-
-                               tracker_db_interface_set_busy_handler (db_manager->db.iface, NULL, NULL, 
NULL);
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]