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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#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"
static void activate(GtkApplication *app, gpointer user_data)
{
create_login_window(app, user_data);
}
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");
return EXIT_FAILURE;
}
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();
auth_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); */
}
|