summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2019-03-10 23:45:19 +0530
committerDandelion <nirav@teisuu.com>2019-03-11 23:05:22 +0530
commit63e8c7f9d095fe0b1e0b44f950230c0e238f166d (patch)
tree01e0211f4fdede1eccda010fc944b3a0180a9632 /src/main.c
parent7e8ea36eb8106b4847af13a27a3e8f3177d25809 (diff)
downloadap_client-63e8c7f9d095fe0b1e0b44f950230c0e238f166d.tar.gz
ap_client-63e8c7f9d095fe0b1e0b44f950230c0e238f166d.zip
Add config and log
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/src/main.c b/src/main.c
index 45ea3cd..bf23496 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,23 +8,28 @@
#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)
{
- create_login_window(app, user_data);
+ if (read_local_credentials()) {
+ create_login_window(app, user_data);
+ return;
+ }
+ create_timeline_window(app, NULL);
}
int main(int argc, char **argv)
{
- /* gtk_init(&argc, &argv); */
- /* create_main_window(); */
- /* gtk_main(); */
if (http_init()) {
- fprintf(stderr, "main(): failed to load http library\n");
+ log_msg(LOG_ERROR, "main", "failed to load http library");
return EXIT_FAILURE;
}
+ config_load();
+
GtkApplication *app;
int status;
@@ -34,37 +39,7 @@ int main(int argc, char **argv)
g_object_unref(app);
http_cleanup();
- auth_cleanup();
+ config_cleanup();
return status;
-
- /* char *text; */
- /* struct timeline *t; */
- /* char *url = "https://mstdn.io/api/v1/timelines/home"; */
- /* char *token = */
- /* "580acfb412e927c2030fb5519f417b03ced1482c862d44376922cd81ee8a3655";
- */
-
- /* text = request(url, token); */
- /* if (!text) { */
- /* fprintf(stderr, "main(): failed to get http response\n"); */
- /* return EXIT_FAILURE; */
- /* } */
-
- /* t = timeline_from_json(text); */
- /* if (t == NULL) { */
- /* fprintf(stderr, "main(): failed to parse timeline\n"); */
- /* return EXIT_FAILURE; */
- /* } */
-
- /* for (size_t i = 0; i < t->size; i++) { */
- /* printf("status id: %s\n", t->statuses[i]->id); */
- /* printf("content: %s\n", t->statuses[i]->content); */
- /* printf("reblog count: %d\n", t->statuses[i]->reblogs_count); */
- /* printf("fav count: %d\n", t->statuses[i]->favourites_count); */
- /* printf("\n"); */
- /* } */
-
- /* free(text); */
- /* timeline_free(t); */
}