Ethereal-dev: [Ethereal-dev] 0.8.12: Patch to add ESC->Cancel and double-click to Filters dial
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Santeri Paavolainen <santtu@xxxxxxx>
Date: Tue, 24 Oct 2000 15:44:09 +0300 (EEST)
This patch adds two things: - Pressing Esc key will cause the filter selection dialog to "Cancel" - Double-clicking on a list item in filter selection dialog is equivalent to single-click followed by "OK" -- santtu@xxxxxx I have become death, destroyer of the worlds.
*** ./ethereal-0.8.12-orig/gtk/filter_prefs.c Wed Aug 23 09:55:41 2000 --- ./ethereal-0.8.12/gtk/filter_prefs.c Tue Oct 24 15:28:18 2000 *************** *** 59,64 **** --- 59,66 ---- #define E_FILT_LBL_KEY "filter_label" #define E_FILT_CM_KEY "in_cancel_mode" #define E_FILTER_WIDGET_KEY "filter_widget" + #define E_FILT_DBLFUNC_KEY "filter_dblfunc" + #define E_FILT_DBLARG_KEY "filter_dblarg" typedef struct _filter_def { char *name; *************** *** 83,89 **** static void filter_dlg_destroy(GtkWidget *win, gpointer data); static void filter_sel_apply_cb(GtkWidget *cancel_bt, gpointer parent_w); ! static GtkWidget *filter_prefs_show(GtkWidget *, gboolean); static void filter_sel_list_cb(GtkWidget *, gpointer); static void filter_sel_new_cb(GtkWidget *, gpointer); static void filter_sel_chg_cb(GtkWidget *, gpointer); --- 85,92 ---- static void filter_dlg_destroy(GtkWidget *win, gpointer data); static void filter_sel_apply_cb(GtkWidget *cancel_bt, gpointer parent_w); ! static GtkWidget *filter_prefs_show(GtkWidget *, gboolean, ! GtkSignalFunc, GtkObject *); static void filter_sel_list_cb(GtkWidget *, gpointer); static void filter_sel_new_cb(GtkWidget *, gpointer); static void filter_sel_chg_cb(GtkWidget *, gpointer); *************** *** 251,257 **** gtk_container_add(GTK_CONTAINER(main_w), main_vb); gtk_widget_show(main_vb); ! filter_pg = filter_prefs_show(filter_te, wants_apply_button); gtk_box_pack_start(GTK_BOX(main_vb), filter_pg, TRUE, TRUE, 0); gtk_object_set_data(GTK_OBJECT(filter_pg), E_FILT_TE_PTR_KEY, filter_te); gtk_object_set_data(GTK_OBJECT(main_w), E_FILTER_WIDGET_KEY, filter_pg); --- 254,262 ---- gtk_container_add(GTK_CONTAINER(main_w), main_vb); gtk_widget_show(main_vb); ! filter_pg = filter_prefs_show(filter_te, wants_apply_button, ! GTK_SIGNAL_FUNC(filter_dlg_ok), ! GTK_OBJECT(main_w)); gtk_box_pack_start(GTK_BOX(main_vb), filter_pg, TRUE, TRUE, 0); gtk_object_set_data(GTK_OBJECT(filter_pg), E_FILT_TE_PTR_KEY, filter_te); gtk_object_set_data(GTK_OBJECT(main_w), E_FILTER_WIDGET_KEY, filter_pg); *************** *** 284,289 **** --- 289,296 ---- gtk_box_pack_start(GTK_BOX(bbox), cancel_bt, TRUE, TRUE, 0); gtk_widget_show(cancel_bt); + dlg_set_cancel(main_w, cancel_bt); + gtk_widget_show(main_w); return main_w; *************** *** 335,343 **** gtk_widget_destroy(GTK_WIDGET(win)); } /* Create and display the filter selection widgets. */ static GtkWidget * ! filter_prefs_show(GtkWidget *w, gboolean wants_apply_button) { GtkWidget *main_vb, *top_hb, *list_bb, *new_bt, *filter_sc, *nl_item, *nl_lb, *middle_hb, *name_lb, *bottom_hb, *filter_lb; --- 342,371 ---- gtk_widget_destroy(GTK_WIDGET(win)); } + static gint + filter_sel_list_button_cb (GtkWidget *widget, GdkEventButton *event, + gpointer func_data) + { + GtkWidget *parent = func_data; + GtkSignalFunc func; + gpointer func_arg; + + if (GTK_IS_LIST_ITEM(widget) && event->type == GDK_2BUTTON_PRESS) { + func = gtk_object_get_data(GTK_OBJECT(parent), E_FILT_DBLFUNC_KEY); + func_arg = gtk_object_get_data(GTK_OBJECT(parent), E_FILT_DBLARG_KEY); + + if (func) + (*func)(NULL, func_arg); + } + + return FALSE; + } + /* Create and display the filter selection widgets. */ static GtkWidget * ! filter_prefs_show(GtkWidget *w, gboolean wants_apply_button, ! GtkSignalFunc func, GtkObject *func_arg) ! { GtkWidget *main_vb, *top_hb, *list_bb, *new_bt, *filter_sc, *nl_item, *nl_lb, *middle_hb, *name_lb, *bottom_hb, *filter_lb; *************** *** 419,429 **** --- 447,466 ---- filter_l); gtk_widget_show(filter_l); + gtk_object_set_data(GTK_OBJECT(filter_l), E_FILT_DBLFUNC_KEY, func); + gtk_object_set_data(GTK_OBJECT(filter_l), E_FILT_DBLARG_KEY, func_arg); + flp = g_list_first(fl); while (flp) { filt = (filter_def *) flp->data; nl_lb = gtk_label_new(filt->name); nl_item = gtk_list_item_new(); + + gtk_signal_connect(GTK_OBJECT(nl_item), + "button_press_event", + GTK_SIGNAL_FUNC(filter_sel_list_button_cb), + filter_l); + gtk_misc_set_alignment (GTK_MISC (nl_lb), 0.0, 0.5); gtk_container_add(GTK_CONTAINER(nl_item), nl_lb); gtk_widget_show(nl_lb);
- Follow-Ups:
- Re: [Ethereal-dev] 0.8.12: Patch to add ESC->Cancel and double-click to Filters dialog
- From: Gilbert Ramirez
- Re: [Ethereal-dev] 0.8.12: Patch to add ESC->Cancel and double-click to Filters dialog
- Prev by Date: Re: [Ethereal-users] Re: R: [Ethereal-dev] Remote online packet capture?
- Next by Date: Re: [Ethereal-users] Re: R: [Ethereal-dev] Remote online packet capture?
- Previous by thread: Re: [Ethereal-dev] cvs not compiling
- Next by thread: Re: [Ethereal-dev] 0.8.12: Patch to add ESC->Cancel and double-click to Filters dialog
- Index(es):