diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 96f5e6b2..2fe5d12c 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1611,6 +1611,8 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch) if (sess->type == SESS_CHANNEL) menu_addfavoritemenu (sess->server, menu, sess->channel); + else if (sess->type == SESS_SERVER) + menu_addconnectmenu (sess->server, menu); } mg_create_icon_item (_("_Detach"), GTK_STOCK_REDO, menu, 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 @@ -1057,6 +1057,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) { diff --git a/src/fe-gtk/menu.h b/src/fe-gtk/menu.h index dfc6fd07..9cc92e9e 100644 --- a/src/fe-gtk/menu.h +++ b/src/fe-gtk/menu.h @@ -24,6 +24,7 @@ GtkWidget *menu_create_main (void *accel_group, int bar, int away, int toplevel, void menu_urlmenu (GdkEventButton * event, char *url); void menu_chanmenu (session *sess, GdkEventButton * event, char *chan); void menu_addfavoritemenu (server *serv, GtkWidget *menu, char *channel); +void menu_addconnectmenu (server *serv, GtkWidget *menu); void menu_nickmenu (session *sess, GdkEventButton * event, char *nick, int num_sel); void menu_middlemenu (session *sess, GdkEventButton *event); void userlist_button_cb (GtkWidget * button, char *cmd);