Back to index

indicator-appmenu  12.10.0
Functions
test-load-app-info.c File Reference
#include <unistd.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <glib-object.h>
#include "load-app-info.h"

Go to the source code of this file.

Functions

static void build_db (sqlite3 *db)
int main (int argv, char *argc[])

Function Documentation

static void build_db ( sqlite3 *  db) [static]

Definition at line 29 of file test-load-app-info.c.

{
       /* Create the table */
       int exec_status = SQLITE_OK;
       gchar * failstring = NULL;
       exec_status = sqlite3_exec(db,
                                  "create table usage (application text, entry text, timestamp datetime);",
                                  NULL, NULL, &failstring);
       if (exec_status != SQLITE_OK) {
              g_warning("Unable to create table: %s", failstring);
       }

       /* Import data from the system */

       return;
}

Here is the caller graph for this function:

int main ( int  argv,
char *  argc[] 
)

Definition at line 47 of file test-load-app-info.c.

{
       gboolean passed = TRUE;

       if (argv != 3) {
              g_printerr("Usage: %s <db path> <app-info file path>\n", argc[0]);
              return 1;
       }

       g_type_init();

       gchar * filename = argc[1];

       sqlite3 * db = NULL;
       int open_status = sqlite3_open(filename, &db); 

       if (open_status != SQLITE_OK) {
              g_warning("Error opening usage DB: %s", filename);
              passed = FALSE;
              goto cleanup;
       }

       /* Create the table in the DB */
       build_db(db);

       passed = load_app_info(argc[2], db);

cleanup:
       if (db != NULL) {
              sqlite3_close(db);
       }

       if (passed) {
              return 0;
       } else {
              return 1;
       }
}

Here is the call graph for this function: