Revert menu.c @ ae04663aa9
This caused a few bugs such as improperly setting away/back and redrawing the channel tree when the menu is opened.
This commit is contained in:
parent
9c4112cda7
commit
2e6001f1ed
|
@ -297,9 +297,9 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
|||
{
|
||||
item = gtk_menu_item_new_with_label ("");
|
||||
if (flags & XCMENU_MNEMONIC)
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label);
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (GTK_BIN (item)->child), label);
|
||||
else
|
||||
gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label);
|
||||
gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), label);
|
||||
} else
|
||||
{
|
||||
if (flags & XCMENU_MNEMONIC)
|
||||
|
@ -348,7 +348,7 @@ menu_quick_sub (char *name, GtkWidget *menu, GtkWidget **sub_item_ret, int flags
|
|||
if (flags & XCMENU_MARKUP)
|
||||
{
|
||||
sub_item = gtk_menu_item_new_with_label ("");
|
||||
gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (sub_item))), name);
|
||||
gtk_label_set_markup (GTK_LABEL (GTK_BIN (sub_item)->child), name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ toggle_cb (GtkWidget *item, char *pref_name)
|
|||
{
|
||||
char buf[256];
|
||||
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
snprintf (buf, sizeof (buf), "set %s 1", pref_name);
|
||||
else
|
||||
snprintf (buf, sizeof (buf), "set %s 0", pref_name);
|
||||
|
@ -700,7 +700,7 @@ fe_userlist_update (session *sess, struct User *user)
|
|||
g_signal_handlers_disconnect_by_func (nick_submenu, menu_nickinfo_cb, sess);
|
||||
|
||||
/* destroy all the old items */
|
||||
items = gtk_container_get_children (GTK_CONTAINER (nick_submenu));
|
||||
items = ((GtkMenuShell *) nick_submenu)->children;
|
||||
while (items)
|
||||
{
|
||||
next = items->next;
|
||||
|
@ -832,7 +832,7 @@ menu_setting_foreach (void (*callback) (session *), int id, guint state)
|
|||
if (sess->gui->is_tab)
|
||||
maindone = TRUE;
|
||||
if (id != -1)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (sess->gui->menu_item[id]), state);
|
||||
GTK_CHECK_MENU_ITEM (sess->gui->menu_item[id])->active = state;
|
||||
if (callback)
|
||||
callback (sess);
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ usermenu_create (GtkWidget *menu)
|
|||
static void
|
||||
usermenu_destroy (GtkWidget * menu)
|
||||
{
|
||||
GList *items = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
GList *items = ((GtkMenuShell *) menu)->children;
|
||||
GList *next;
|
||||
|
||||
while (items)
|
||||
|
@ -1332,7 +1332,7 @@ menu_join_cb (GtkWidget *dialog, gint response, GtkEntry *entry)
|
|||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
menu_chan_join (NULL, (char *)gtk_entry_get_text (entry));
|
||||
menu_chan_join (NULL, entry->text);
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_HELP:
|
||||
|
@ -1360,12 +1360,12 @@ menu_join (GtkWidget * wid, gpointer none)
|
|||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE);
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
hbox = gtk_hbox_new (TRUE, 0);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); /* avoid auto-selection */
|
||||
GTK_ENTRY (entry)->editable = 0; /* avoid auto-selection */
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "#");
|
||||
g_signal_connect (G_OBJECT (entry), "activate",
|
||||
G_CALLBACK (menu_join_entry_cb), dialog);
|
||||
|
@ -1377,7 +1377,7 @@ menu_join (GtkWidget * wid, gpointer none)
|
|||
g_signal_connect (G_OBJECT (dialog), "response",
|
||||
G_CALLBACK (menu_join_cb), entry);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
||||
|
||||
gtk_widget_show_all (dialog);
|
||||
|
||||
|
@ -1388,7 +1388,7 @@ menu_join (GtkWidget * wid, gpointer none)
|
|||
static void
|
||||
menu_away (GtkCheckMenuItem *item, gpointer none)
|
||||
{
|
||||
handle_command (current_sess, gtk_check_menu_item_get_active (item) ? "away" : "back", FALSE);
|
||||
handle_command (current_sess, item->active ? "away" : "back", FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1583,7 +1583,7 @@ static void
|
|||
menu_layout_cb (GtkWidget *item, gpointer none)
|
||||
{
|
||||
prefs.hex_gui_tab_layout = 2;
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
prefs.hex_gui_tab_layout = 0;
|
||||
|
||||
menu_change_layout ();
|
||||
|
@ -1598,7 +1598,7 @@ menu_apply_metres_cb (session *sess)
|
|||
static void
|
||||
menu_metres_off (GtkWidget *item, gpointer none)
|
||||
{
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
{
|
||||
prefs.hex_gui_lagometer = 0;
|
||||
prefs.hex_gui_throttlemeter = 0;
|
||||
|
@ -1609,7 +1609,7 @@ menu_metres_off (GtkWidget *item, gpointer none)
|
|||
static void
|
||||
menu_metres_text (GtkWidget *item, gpointer none)
|
||||
{
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
{
|
||||
prefs.hex_gui_lagometer = 2;
|
||||
prefs.hex_gui_throttlemeter = 2;
|
||||
|
@ -1620,7 +1620,7 @@ menu_metres_text (GtkWidget *item, gpointer none)
|
|||
static void
|
||||
menu_metres_graph (GtkWidget *item, gpointer none)
|
||||
{
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
{
|
||||
prefs.hex_gui_lagometer = 1;
|
||||
prefs.hex_gui_throttlemeter = 1;
|
||||
|
@ -1631,7 +1631,7 @@ menu_metres_graph (GtkWidget *item, gpointer none)
|
|||
static void
|
||||
menu_metres_both (GtkWidget *item, gpointer none)
|
||||
{
|
||||
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active)
|
||||
{
|
||||
prefs.hex_gui_lagometer = 3;
|
||||
prefs.hex_gui_throttlemeter = 3;
|
||||
|
@ -1827,7 +1827,7 @@ menu_canacaccel (GtkWidget *widget, guint signal_id, gpointer user_data)
|
|||
static GtkMenuItem *
|
||||
menu_find_item (GtkWidget *menu, char *name)
|
||||
{
|
||||
GList *items = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
GList *items = ((GtkMenuShell *) menu)->children;
|
||||
GtkMenuItem *item;
|
||||
GtkWidget *child;
|
||||
const char *labeltext;
|
||||
|
@ -1835,7 +1835,7 @@ menu_find_item (GtkWidget *menu, char *name)
|
|||
while (items)
|
||||
{
|
||||
item = items->data;
|
||||
child = gtk_bin_get_child (GTK_BIN (item));
|
||||
child = GTK_BIN (item)->child;
|
||||
if (child) /* separators arn't labels, skip them */
|
||||
{
|
||||
labeltext = g_object_get_data (G_OBJECT (item), "name");
|
||||
|
@ -1932,7 +1932,7 @@ menu_update_cb (GtkWidget *menu, menu_entry *me, char *target)
|
|||
gtk_widget_set_sensitive (item, me->enable);
|
||||
/* must do it without triggering the callback */
|
||||
if (GTK_IS_CHECK_MENU_ITEM (item))
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), me->state);
|
||||
GTK_CHECK_MENU_ITEM (item)->active = me->state;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1941,7 +1941,7 @@ static void
|
|||
menu_radio_cb (GtkCheckMenuItem *item, menu_entry *me)
|
||||
{
|
||||
me->state = 0;
|
||||
if (gtk_check_menu_item_get_active (item))
|
||||
if (item->active)
|
||||
me->state = 1;
|
||||
|
||||
/* update the state, incase this was changed via right-click. */
|
||||
|
@ -1957,7 +1957,7 @@ static void
|
|||
menu_toggle_cb (GtkCheckMenuItem *item, menu_entry *me)
|
||||
{
|
||||
me->state = 0;
|
||||
if (gtk_check_menu_item_get_active (item))
|
||||
if (item->active)
|
||||
me->state = 1;
|
||||
|
||||
/* update the state, incase this was changed via right-click. */
|
||||
|
@ -1999,7 +1999,7 @@ menu_reorder (GtkMenu *menu, GtkWidget *item, int pos)
|
|||
return;
|
||||
|
||||
if (pos < 0) /* position offset from end/bottom */
|
||||
gtk_menu_reorder_child (menu, item, (g_list_length (gtk_container_get_children (GTK_CONTAINER (menu))) + pos) - 1);
|
||||
gtk_menu_reorder_child (menu, item, (g_list_length (GTK_MENU_SHELL (menu)->children) + pos) - 1);
|
||||
else
|
||||
gtk_menu_reorder_child (menu, item, pos);
|
||||
}
|
||||
|
@ -2065,7 +2065,7 @@ menu_add_sub (GtkWidget *menu, menu_entry *me)
|
|||
{
|
||||
pos = me->pos;
|
||||
if (pos < 0) /* position offset from end/bottom */
|
||||
pos = g_list_length (gtk_container_get_children (GTK_CONTAINER (menu))) + pos;
|
||||
pos = g_list_length (GTK_MENU_SHELL (menu)->children) + pos;
|
||||
menu_quick_sub (me->label, menu, &item, me->markup ? XCMENU_MARKUP|XCMENU_MNEMONIC : XCMENU_MNEMONIC, pos);
|
||||
}
|
||||
return item;
|
||||
|
@ -2333,7 +2333,7 @@ normalitem:
|
|||
item = gtk_check_menu_item_new_with_mnemonic (_(mymenu[i].text));
|
||||
togitem:
|
||||
/* must avoid callback for Radio buttons */
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), mymenu[i].state);
|
||||
GTK_CHECK_MENU_ITEM (item)->active = mymenu[i].state;
|
||||
/*gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
|
||||
mymenu[i].state);*/
|
||||
if (mymenu[i].key != 0)
|
||||
|
|
Loading…
Reference in New Issue