projects
/
cascardo
/
f2fchat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add quit command
[cascardo/f2fchat.git]
/
f2fchat.c
diff --git
a/f2fchat.c
b/f2fchat.c
index
eb9423c
..
05e6a5b
100644
(file)
--- a/
f2fchat.c
+++ b/
f2fchat.c
@@
-19,12
+19,21
@@
#include "friend.h"
#include <glib.h>
#include <stdio.h>
#include "friend.h"
#include <glib.h>
#include <stdio.h>
+#include "menu.h"
-static gboolean quit(gpointer data)
+static GMainLoop *uloop;
+
+static void quit(gchar **args, GSocketAddress *address)
+{
+ g_main_loop_quit(uloop);
+}
+
+static struct menu_item quit_menu = { "quit", quit };
+
+static void add_quit_cmd(GMainLoop *loop)
{
{
- GMainLoop *loop = data;
- g_main_loop_quit(loop);
- return G_SOURCE_CONTINUE;
+ uloop = loop;
+ menu_add(&quit_menu);
}
int main(int argc, char **argv)
}
int main(int argc, char **argv)
@@
-40,6
+49,7
@@
int main(int argc, char **argv)
create_cache(&cache);
load_cache(cache, "friends.cache");
loop = g_main_loop_new(g_main_context_default(), TRUE);
create_cache(&cache);
load_cache(cache, "friends.cache");
loop = g_main_loop_new(g_main_context_default(), TRUE);
+ add_quit_cmd(loop);
g_main_loop_run(loop);
store_cache(cache, "friends.cache");
destroy_cache(cache);
g_main_loop_run(loop);
store_cache(cache, "friends.cache");
destroy_cache(cache);