mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-26 03:02:17 -05:00
Properly set away and fullscreen menu items
This commit is contained in:
parent
30a47cf62e
commit
e8d4f3f848
@ -179,7 +179,7 @@ typedef struct session_gui
|
||||
GtkWidget *shbox, *shentry; /* search bar hbox */
|
||||
gulong search_changed_signal; /* hook for search change event so blanking the box doesn't suck */
|
||||
|
||||
#define MENU_ID_NUM 12
|
||||
#define MENU_ID_NUM 13
|
||||
GtkWidget *menu_item[MENU_ID_NUM+1]; /* some items we may change state of */
|
||||
|
||||
void *chanview; /* chanview.h */
|
||||
|
@ -453,6 +453,8 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
||||
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
prefs.hex_gui_win_fullscreen = 1;
|
||||
|
||||
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -951,7 +953,7 @@ mg_populate (session *sess)
|
||||
}
|
||||
|
||||
/* menu items */
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY]), sess->server->is_away);
|
||||
menu_set_away (gui, sess->server->is_away);
|
||||
gtk_widget_set_sensitive (gui->menu_item[MENU_ID_AWAY], sess->server->connected);
|
||||
gtk_widget_set_sensitive (gui->menu_item[MENU_ID_JOIN], sess->server->end_of_motd);
|
||||
gtk_widget_set_sensitive (gui->menu_item[MENU_ID_DISCONNECT],
|
||||
@ -3482,7 +3484,7 @@ fe_set_away (server *serv)
|
||||
{
|
||||
if (!sess->gui->is_tab || sess == current_tab)
|
||||
{
|
||||
GTK_CHECK_MENU_ITEM (sess->gui->menu_item[MENU_ID_AWAY])->active = serv->is_away;
|
||||
menu_set_away (sess->gui, serv->is_away);
|
||||
/* gray out my nickname */
|
||||
mg_set_myself_away (sess->gui, serv->is_away);
|
||||
}
|
||||
|
@ -1390,7 +1390,7 @@ menu_join (GtkWidget * wid, gpointer none)
|
||||
static void
|
||||
menu_away (GtkCheckMenuItem *item, gpointer none)
|
||||
{
|
||||
handle_command (current_sess, item->active ? "away" : "back", FALSE);
|
||||
handle_command (current_sess, gtk_check_menu_item_get_active (item) ? "away" : "back", FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1746,7 +1746,7 @@ static struct mymenu mymenu[] = {
|
||||
{N_("Both"), menu_metres_both, 0, M_MENURADIO, 0, 0, 1},
|
||||
{0, 0, 0, M_END, 0, 0, 0}, /* 32 */
|
||||
{ 0, 0, 0, M_SEP, 0, 0, 0 },
|
||||
{N_ ("Toggle _Fullscreen"), menu_fullscreen_toggle, 0, M_MENUITEM, 0, 0, 1, GDK_KEY_F11},
|
||||
{N_ ("_Fullscreen"), menu_fullscreen_toggle, 0, M_MENUTOG, MENU_ID_FULLSCREEN, 0, 1, GDK_KEY_F11},
|
||||
|
||||
{N_("_Server"), 0, 0, M_NEWMENU, 0, 0, 1},
|
||||
{N_("_Disconnect"), menu_disconnect, GTK_STOCK_DISCONNECT, M_MENUSTOCK, MENU_ID_DISCONNECT, 0, 1},
|
||||
@ -1801,6 +1801,26 @@ static struct mymenu mymenu[] = {
|
||||
{0, 0, 0, M_END, 0, 0, 0},
|
||||
};
|
||||
|
||||
void
|
||||
menu_set_away (session_gui *gui, int away)
|
||||
{
|
||||
GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY]);
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (item), menu_away, NULL);
|
||||
gtk_check_menu_item_set_active (item, away);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (item), menu_away, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
menu_set_fullscreen (session_gui *gui, int full)
|
||||
{
|
||||
GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_FULLSCREEN]);
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (item), menu_fullscreen_toggle, NULL);
|
||||
gtk_check_menu_item_set_active (item, full);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (item), menu_fullscreen_toggle, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
{
|
||||
@ -2317,7 +2337,6 @@ normalitem:
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
mymenu[i].key,
|
||||
mymenu[i].key == GDK_KEY_F1 ? 0 :
|
||||
mymenu[i].key == GDK_KEY_F11 ? 0 :
|
||||
mymenu[i].key == GDK_KEY_w ? close_mask :
|
||||
(g_ascii_isupper (mymenu[i].key)) ?
|
||||
STATE_SHIFT | STATE_CTRL :
|
||||
@ -2342,11 +2361,14 @@ togitem:
|
||||
mymenu[i].state);*/
|
||||
if (mymenu[i].key != 0)
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
mymenu[i].key, mymenu[i].id == MENU_ID_AWAY ?
|
||||
away_mask : STATE_CTRL, GTK_ACCEL_VISIBLE);
|
||||
mymenu[i].key,
|
||||
mymenu[i].id == MENU_ID_FULLSCREEN ? 0 :
|
||||
mymenu[i].id == MENU_ID_AWAY ? away_mask :
|
||||
STATE_CTRL, GTK_ACCEL_VISIBLE);
|
||||
if (mymenu[i].callback)
|
||||
g_signal_connect (G_OBJECT (item), "toggled",
|
||||
G_CALLBACK (mymenu[i].callback), 0);
|
||||
G_CALLBACK (mymenu[i].callback), NULL);
|
||||
|
||||
if (submenu)
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item);
|
||||
else
|
||||
|
@ -39,6 +39,9 @@ void menu_bar_toggle (void);
|
||||
void menu_add_plugin_items (GtkWidget *menu, char *root, char *target);
|
||||
void menu_change_layout (void);
|
||||
|
||||
void menu_set_away (session_gui *gui, int away);
|
||||
void menu_set_fullscreen (session_gui *gui, int fullscreen);
|
||||
|
||||
/* for menu_quick functions */
|
||||
#define XCMENU_DOLIST 1
|
||||
#define XCMENU_SHADED 1
|
||||
@ -58,8 +61,9 @@ void menu_change_layout (void);
|
||||
#define MENU_ID_RECONNECT 10
|
||||
#define MENU_ID_JOIN 11
|
||||
#define MENU_ID_USERMENU 12
|
||||
#define MENU_ID_FULLSCREEN 13
|
||||
|
||||
#if (MENU_ID_NUM < MENU_ID_USERMENU)
|
||||
#if (MENU_ID_NUM < MENU_ID_FULLSCREEN)
|
||||
#error MENU_ID_NUM is set wrong
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user