blob: bf23496136cd312a3b5476939856e09b11edb0f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#define _POSIX_C_SOURCE 200809L
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <gtk-3.0/gtk/gtk.h>
#include "auth.h"
#include "http.h"
#include "timeline.h"
#include "login_window.h"
#include "config.h"
#include "timeline_window.h"
#include "log.h"
static void activate(GtkApplication *app, gpointer user_data)
{
if (read_local_credentials()) {
create_login_window(app, user_data);
return;
}
create_timeline_window(app, NULL);
}
int main(int argc, char **argv)
{
if (http_init()) {
log_msg(LOG_ERROR, "main", "failed to load http library");
return EXIT_FAILURE;
}
config_load();
GtkApplication *app;
int status;
app = gtk_application_new("org.gtk.ap_client", G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);
http_cleanup();
config_cleanup();
return status;
}
|