diff options
author | Olivier Abad <oabad@noos.fr> | 2003-07-18 20:55:11 +0000 |
---|---|---|
committer | Olivier Abad <oabad@noos.fr> | 2003-07-18 20:55:11 +0000 |
commit | 5d8e9b0d146cc1a09f86da11d0af554ed74566d2 (patch) | |
tree | ee5b23c3604c3e5ce6b3ac37272116808f0ded82 /gtk | |
parent | 1cd5aad5ebae2525d8e686ea49c147e9dbc34480 (diff) |
Various fixes related to GTK2 :
- give the focus to the packet_list when a capture file is opened, and
each time we change the selection in the packet list (it seems that
the tree view has the focus if we don't do this) ;
- in set_plist_sel_browse() : it seems that packet_list->selection_mode
is always 0 in GTK2 so we can't use it to determine the current mode.
Use a static variable instead.
This should fix the second part of debian bug #199763
svn path=/trunk/; revision=8045
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/file_dlg.c | 3 | ||||
-rw-r--r-- | gtk/gui_prefs.c | 6 | ||||
-rw-r--r-- | gtk/main.c | 17 |
3 files changed, 14 insertions, 12 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c index b5bdce05a8..dd0858f83e 100644 --- a/gtk/file_dlg.c +++ b/gtk/file_dlg.c @@ -1,7 +1,7 @@ /* file_dlg.c * Dialog boxes for handling files * - * $Id: file_dlg.c,v 1.55 2003/01/15 05:20:18 guy Exp $ + * $Id: file_dlg.c,v 1.56 2003/07/18 20:55:11 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -269,6 +269,7 @@ file_open_ok_cb(GtkWidget *w, GtkFileSelection *fs) { "get_dirname()" does write over its argument. */ s = get_dirname(cf_name); set_last_open_dir(s); + gtk_widget_grab_focus(packet_list); g_free(cf_name); } diff --git a/gtk/gui_prefs.c b/gtk/gui_prefs.c index 6a181296eb..cdfb039c2e 100644 --- a/gtk/gui_prefs.c +++ b/gtk/gui_prefs.c @@ -1,7 +1,7 @@ /* gui_prefs.c * Dialog box for GUI preferences * - * $Id: gui_prefs.c,v 1.38 2002/11/11 15:39:05 oabad Exp $ + * $Id: gui_prefs.c,v 1.39 2003/07/18 20:55:11 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -178,13 +178,13 @@ gui_prefs_show(void) /* Packet list selection browseable */ plist_browse_om = create_preference_option_menu(main_tb, pos++, - "Packet list mouse behavior:", NULL, selection_mode_vals, + "Packet list selection mode:", NULL, selection_mode_vals, prefs.gui_plist_sel_browse); OBJECT_SET_DATA(main_vb, PLIST_SEL_BROWSE_KEY, plist_browse_om); /* Proto tree selection browseable */ ptree_browse_om = create_preference_option_menu(main_tb, pos++, - "Protocol tree mouse behavior:", NULL, selection_mode_vals, + "Protocol tree selection mode:", NULL, selection_mode_vals, prefs.gui_ptree_sel_browse); OBJECT_SET_DATA(main_vb, PTREE_SEL_BROWSE_KEY, ptree_browse_om); diff --git a/gtk/main.c b/gtk/main.c index 015300b034..c59e5dca25 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.299 2003/07/04 23:50:10 guy Exp $ + * $Id: main.c,v 1.300 2003/07/18 20:55:11 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -780,6 +780,7 @@ packet_list_select_cb(GtkWidget *w _U_, gint row, gint col _U_, gpointer evt _U_ gtk_notebook_remove_page( GTK_NOTEBOOK(byte_nb_ptr), 0); select_packet(&cfile, row); + gtk_widget_grab_focus(packet_list); } @@ -956,12 +957,11 @@ void resolve_name_cb(GtkWidget *widget _U_, gpointer data _U_) { void set_plist_sel_browse(gboolean val) { - gboolean old_val; + /* initialize with a mode we don't use, so that the following test will + * fail the first time */ + static GtkSelectionMode mode = GTK_SELECTION_MULTIPLE; - old_val = - (GTK_CLIST(packet_list)->selection_mode == GTK_SELECTION_SINGLE); - - if (val == old_val) { + if (val == (mode == GTK_SELECTION_SINGLE)) { /* * The mode isn't changing, so don't do anything. * In particular, don't gratuitiously unselect the @@ -985,11 +985,12 @@ set_plist_sel_browse(gboolean val) /* Yeah, GTK uses "browse" in the case where we do not, but oh well. I think * "browse" in Ethereal makes more sense than "SINGLE" in GTK+ */ if (val) { - gtk_clist_set_selection_mode(GTK_CLIST(packet_list), GTK_SELECTION_SINGLE); + mode = GTK_SELECTION_SINGLE; } else { - gtk_clist_set_selection_mode(GTK_CLIST(packet_list), GTK_SELECTION_BROWSE); + mode = GTK_SELECTION_BROWSE; } + gtk_clist_set_selection_mode(GTK_CLIST(packet_list), mode); } /* Set the font of the packet list window. */ |