diff options
author | TingPing <tingping@tingping.se> | 2013-06-06 16:49:57 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-06-06 16:49:57 -0400 |
commit | fd762303b0c655f77ddff3004bfaaf11cc6c4e0d (patch) | |
tree | e7f9e651eed38e74b801abf0854f5bdc46bae137 /src/fe-gtk/menu.c | |
parent | a6f05db34b538a03c05f6e29fbf41314bbd93f34 (diff) |
Add autoconnect option to menu of networks
Diffstat (limited to 'src/fe-gtk/menu.c')
-rw-r--r-- | src/fe-gtk/menu.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 02bd3f1e..906a0fc6 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -1058,6 +1058,36 @@ menu_addfavoritemenu (server *serv, GtkWidget *menu, char *channel) } static void +menu_delautoconn_cb (GtkWidget *item, server *serv) +{ + ((ircnet*)serv->network)->flags &= ~FLAG_AUTO_CONNECT; + servlist_save (); +} + +static void +menu_addautoconn_cb (GtkWidget *item, server *serv) +{ + ((ircnet*)serv->network)->flags |= FLAG_AUTO_CONNECT; + servlist_save (); +} + +void +menu_addconnectmenu (server *serv, GtkWidget *menu) +{ + if (!serv->network) + return; + + if (((ircnet*)serv->network)->flags & FLAG_AUTO_CONNECT) + { + menu_toggle_item (_("_Auto-Connect"), menu, menu_delautoconn_cb, serv, TRUE); + } + else + { + menu_toggle_item (_("_Auto-Connect"), menu, menu_addautoconn_cb, serv, FALSE); + } +} + +static void menu_open_server_list (GtkWidget *wid, gpointer none) { fe_serverlist_open (current_sess); |