1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-29 12:42:16 -05:00

Remember selected tab

This commit is contained in:
Berke Viktor 2013-05-12 16:59:21 +02:00
parent c044bdfe32
commit 2c15270be1

View File

@ -48,6 +48,8 @@ static int netlist_win_height = 0;
static int netedit_win_width = 0; static int netedit_win_width = 0;
static int netedit_win_height = 0; static int netedit_win_height = 0;
static int netedit_active_tab = 0;
/* global user info */ /* global user info */
static GtkWidget *entry_nick1; static GtkWidget *entry_nick1;
static GtkWidget *entry_nick2; static GtkWidget *entry_nick2;
@ -1386,6 +1388,15 @@ servlist_editkey_cb (GtkCellRendererText *cell, gchar *name, gchar *newval, gpoi
} }
} }
static gboolean
servlist_edit_tabswitch_cb (GtkNotebook *nb, gpointer *newtab, guint newindex, gpointer user_data)
{
/* remember the active tab */
netedit_active_tab = newindex;
return FALSE;
}
static void static void
servlist_combo_cb (GtkEntry *entry, gpointer userdata) servlist_combo_cb (GtkEntry *entry, gpointer userdata)
{ {
@ -1740,6 +1751,12 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
gtk_widget_show_all (editwindow); gtk_widget_show_all (editwindow);
/* We can't set the active tab without child elements being shown, so this must be *after* gtk_widget_show()s! */
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), netedit_active_tab);
/* We need to connect this *after* setting the active tab so that the value doesn't get overriden. */
g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK (servlist_edit_tabswitch_cb), notebook);
return editwindow; return editwindow;
} }