Add autoconnect option to menu of networks
This commit is contained in:
parent
a6f05db34b
commit
fd762303b0
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user