forked from osmocom/wireshark
Fix some simple cases of GTK2 deprecated API usage by using a renamed or equivalent API
gtk_timeout_add() ==> g_timeout_add gtk_timeout_remove() ==> g_source_remove() Also: timer callback should return gboolean (not void or gint) svn path=/trunk/; revision=25672
This commit is contained in:
parent
e1a5e58ac1
commit
44efa0ed2e
|
@ -2181,7 +2181,7 @@ host_name_lookup_init(void) {
|
|||
/* XXX - The ADNS "documentation" isn't very clear:
|
||||
* - Do we need to keep our query structures around?
|
||||
*/
|
||||
gint
|
||||
gboolean
|
||||
host_name_lookup_process(gpointer data _U_) {
|
||||
adns_queue_msg_t *almsg;
|
||||
GList *cur;
|
||||
|
@ -2230,7 +2230,7 @@ host_name_lookup_process(gpointer data _U_) {
|
|||
}
|
||||
|
||||
/* Keep the timeout in place */
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2250,10 +2250,10 @@ host_name_lookup_cleanup(void) {
|
|||
|
||||
#else
|
||||
|
||||
gint
|
||||
gboolean
|
||||
host_name_lookup_process(gpointer data _U_) {
|
||||
/* Kill the timeout, as there's nothing for it to do */
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -123,9 +123,9 @@ void get_addr_name_buf(address *addr, gchar *buf, guint size);
|
|||
/* host_name_lookup_init fires up an ADNS socket if we're using ADNS */
|
||||
extern void host_name_lookup_init(void);
|
||||
|
||||
/* host_name_lookup_process does ADNS processing in GTK+ timeouts in Wireshark,
|
||||
/* host_name_lookup_process does ADNS processing in GLIB timeouts in Wireshark,
|
||||
and before processing each packet in TShark, if we're using ADNS */
|
||||
extern gint host_name_lookup_process(gpointer data);
|
||||
extern gboolean host_name_lookup_process(gpointer data);
|
||||
|
||||
/* host_name_lookup_cleanup cleans up an ADNS socket if we're using ADNS */
|
||||
extern void host_name_lookup_cleanup(void);
|
||||
|
|
|
@ -453,7 +453,7 @@ combo_if_activate_cb(GtkWidget *entry _U_, gpointer data)
|
|||
/*
|
||||
* Thread function used to blink the led
|
||||
*/
|
||||
void update_blink(gpointer data _U_)
|
||||
gboolean update_blink(gpointer data _U_)
|
||||
{
|
||||
airpcap_if_info_t* sel;
|
||||
PAirpcapHandle ad;
|
||||
|
@ -476,6 +476,7 @@ void update_blink(gpointer data _U_)
|
|||
}
|
||||
airpcap_if_close(ad);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -491,19 +492,19 @@ on_blink_bt_clicked( GtkWidget *blink_bt _U_, gpointer if_data )
|
|||
if (!(airpcap_if_selected->blinking))
|
||||
{
|
||||
gtk_button_set_label(GTK_BUTTON(blink_bt),"Stop Blinking");
|
||||
airpcap_if_selected->tag = gtk_timeout_add(500, (GtkFunction)update_blink,airpcap_if_selected);
|
||||
airpcap_if_selected->tag = g_timeout_add(500,update_blink,airpcap_if_selected);
|
||||
airpcap_if_selected->blinking = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_button_set_label(GTK_BUTTON(blink_bt)," Blink Led ");
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
airpcap_if_selected->blinking = FALSE;
|
||||
/* Switch on the led! */
|
||||
ad = airpcap_if_open(airpcap_if_selected->name, ebuf);
|
||||
if (ad)
|
||||
{
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
airpcap_if_turn_led_on(ad, 0);
|
||||
airpcap_if_selected->blinking = FALSE;
|
||||
airpcap_if_selected->led = TRUE;
|
||||
|
@ -697,13 +698,14 @@ on_advanced_apply_bt_clicked(GtkWidget *button, gpointer data _U_)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0 /* XXX: not used ?? */
|
||||
/*
|
||||
* Callback for the 'OK' button.
|
||||
*/
|
||||
static void
|
||||
airpcap_advanced_ok_cb(GtkWidget *w, gpointer data _U_)
|
||||
{
|
||||
/* advenced window */
|
||||
/* advanced window */
|
||||
GtkWidget *main_w;
|
||||
|
||||
/* widgets in the toolbar */
|
||||
|
@ -731,8 +733,8 @@ airpcap_advanced_ok_cb(GtkWidget *w, gpointer data _U_)
|
|||
/* Save the configuration */
|
||||
airpcap_add_keys_from_list(key_ls,airpcap_if_selected);
|
||||
airpcap_save_selected_if_configuration(airpcap_if_selected);
|
||||
/* Remove gtk timeout */
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
/* Remove GLIB timeout */
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
|
||||
/* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/
|
||||
if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0)
|
||||
|
@ -749,6 +751,7 @@ airpcap_advanced_ok_cb(GtkWidget *w, gpointer data _U_)
|
|||
g_signal_handlers_unblock_by_func (toolbar_decryption_ck,airpcap_toolbar_encryption_cb, toolbar);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Callback for the 'Reset Configuration' button.
|
||||
|
@ -2362,7 +2365,7 @@ on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data _U_)
|
|||
ad = airpcap_if_open(airpcap_if_selected->name, ebuf);
|
||||
if (ad)
|
||||
{
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
airpcap_if_turn_led_on(ad, 0);
|
||||
airpcap_if_selected->blinking = FALSE;
|
||||
airpcap_if_selected->led = TRUE;
|
||||
|
@ -2374,8 +2377,8 @@ on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data _U_)
|
|||
|
||||
/* Save the configuration */
|
||||
airpcap_save_selected_if_configuration(airpcap_if_selected);
|
||||
/* Remove gtk timeout */
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
/* Remove GLIB timeout */
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
|
||||
/* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/
|
||||
if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0)
|
||||
|
@ -2451,7 +2454,7 @@ on_advanced_cancel_bt_clicked(GtkWidget *button, gpointer data _U_)
|
|||
ad = airpcap_if_open(airpcap_if_selected->name, ebuf);
|
||||
if (ad)
|
||||
{
|
||||
gtk_timeout_remove(airpcap_if_selected->tag);
|
||||
g_source_remove(airpcap_if_selected->tag);
|
||||
airpcap_if_turn_led_on(ad, 0);
|
||||
airpcap_if_selected->blinking = FALSE;
|
||||
airpcap_if_selected->led = TRUE;
|
||||
|
|
|
@ -241,7 +241,7 @@ combo_if_activate_cb(GtkWidget *w _U_, gpointer data);
|
|||
/*
|
||||
* Thread function used to blink the led
|
||||
*/
|
||||
void update_blink(gpointer data _U_);
|
||||
gboolean update_blink(gpointer data _U_);
|
||||
|
||||
/*
|
||||
* Blink button callback
|
||||
|
|
|
@ -277,7 +277,7 @@ capture_if_destroy_cb(GtkWidget *win _U_, gpointer user_data)
|
|||
int ifs;
|
||||
if_stat_cache_t *sc = user_data;
|
||||
|
||||
gtk_timeout_remove(timer_id);
|
||||
g_source_remove(timer_id);
|
||||
|
||||
for(ifs = 0; (curr = g_list_nth(if_data, ifs)); ifs++) {
|
||||
g_free(curr->data);
|
||||
|
@ -658,7 +658,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
set_capture_if_dialog_for_capture_in_progress(g_capture_in_progress);
|
||||
|
||||
/* update the interface list every 1000ms */
|
||||
timer_id = gtk_timeout_add(1000, update_all, sc);
|
||||
timer_id = g_timeout_add(1000, update_all, sc);
|
||||
}
|
||||
|
||||
#else /* HAVE_LIBPCAP */
|
||||
|
|
|
@ -100,18 +100,18 @@ capture_info_delete_cb(GtkWidget *w _U_, GdkEvent *event _U_, gpointer data) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
static gboolean
|
||||
capture_info_ui_update_cb(gpointer data)
|
||||
{
|
||||
capture_info *cinfo = data;
|
||||
capture_info_ui_t *info = cinfo->ui;
|
||||
|
||||
if (!info) /* ...which might happen on slow displays? */
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
cinfo->running_time = time(NULL) - info->start_time;
|
||||
capture_info_ui_update(cinfo);
|
||||
return 1; /* call the timer again */
|
||||
return TRUE; /* call the timer again */
|
||||
}
|
||||
|
||||
|
||||
|
@ -279,7 +279,7 @@ capture_options *capture_opts)
|
|||
cinfo->ui = info;
|
||||
|
||||
/* update the dialog once a second, even if no packets rushing in */
|
||||
info->timer_id = gtk_timeout_add(1000, (GtkFunction)capture_info_ui_update_cb,(gpointer)cinfo);
|
||||
info->timer_id = g_timeout_add(1000, capture_info_ui_update_cb,cinfo);
|
||||
}
|
||||
|
||||
|
||||
|
@ -335,7 +335,7 @@ capture_info *cinfo)
|
|||
if (!info) /* ...which probably shouldn't happen */
|
||||
return;
|
||||
|
||||
gtk_timeout_remove(info->timer_id);
|
||||
g_source_remove(info->timer_id);
|
||||
|
||||
/* called from capture engine, so it's ok to destroy the dialog here */
|
||||
gtk_grab_remove(GTK_WIDGET(info->cap_w));
|
||||
|
|
|
@ -141,7 +141,7 @@ static void gtk_vumeter_destroy (GtkObject *object)
|
|||
GtkVUMeter *vumeter = GTK_VUMETER (object);
|
||||
|
||||
if(vumeter->peak_timeout) {
|
||||
gtk_timeout_remove(vumeter->peak_timeout);
|
||||
g_source_remove(vumeter->peak_timeout);
|
||||
}
|
||||
|
||||
gtk_vumeter_free_colors (vumeter);
|
||||
|
@ -1065,11 +1065,11 @@ void gtk_vumeter_set_peak (GtkVUMeter *vumeter, gboolean peak, guint redraw_rate
|
|||
vumeter->peak_redraw_rate = redraw_rate;
|
||||
|
||||
if(vumeter->peak_timeout) {
|
||||
gtk_timeout_remove(vumeter->peak_timeout);
|
||||
g_source_remove(vumeter->peak_timeout);
|
||||
}
|
||||
|
||||
if(redraw_rate != 0 && vumeter->peak) {
|
||||
vumeter->peak_timeout = gtk_timeout_add (redraw_rate, (GtkFunction)gtk_vumeter_redraw_timeout, vumeter);
|
||||
vumeter->peak_timeout = g_timeout_add (redraw_rate, gtk_vumeter_redraw_timeout, vumeter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -599,7 +599,7 @@ typedef struct pipe_input_tag {
|
|||
#ifdef _WIN32
|
||||
/* The timer has expired, see if there's stuff to read from the pipe,
|
||||
if so, do the callback */
|
||||
static gint
|
||||
static gboolean
|
||||
pipe_timer_cb(gpointer data)
|
||||
{
|
||||
HANDLE handle;
|
||||
|
@ -633,7 +633,7 @@ pipe_timer_cb(gpointer data)
|
|||
if(pipe_input->pipe_input_id != 0) {
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: stop timer");*/
|
||||
/* avoid reentrancy problems and stack overflow */
|
||||
gtk_timeout_remove(pipe_input->pipe_input_id);
|
||||
g_source_remove(pipe_input->pipe_input_id);
|
||||
pipe_input->pipe_input_id = 0;
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ pipe_timer_cb(gpointer data)
|
|||
|
||||
if(pipe_input->pipe_input_id == 0) {
|
||||
/* restore pipe handler */
|
||||
pipe_input->pipe_input_id = gtk_timeout_add(200, pipe_timer_cb, data);
|
||||
pipe_input->pipe_input_id = g_timeout_add(200, pipe_timer_cb, data);
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, new timer", iterations);*/
|
||||
|
||||
/* Return false so that the old timer is not run again */
|
||||
|
@ -711,7 +711,7 @@ void pipe_input_set_handler(gint source, gpointer user_data, int *child_process,
|
|||
something similar here, start a timer and check for data on every
|
||||
timeout. */
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_input_set_handler: new");*/
|
||||
pipe_input.pipe_input_id = gtk_timeout_add(200, pipe_timer_cb, &pipe_input);
|
||||
pipe_input.pipe_input_id = g_timeout_add(200, pipe_timer_cb, &pipe_input);
|
||||
#else
|
||||
pipe_input.pipe_input_id = gtk_input_add_full(source,
|
||||
GDK_INPUT_READ|GDK_INPUT_EXCEPTION,
|
||||
|
|
14
gtk/main.c
14
gtk/main.c
|
@ -1075,20 +1075,18 @@ cmdarg_err_cont(const char *fmt, ...)
|
|||
the tap extensions. Since Gtk1 is single threaded we dont have to
|
||||
worry about any locking or critical regions.
|
||||
*/
|
||||
static gint
|
||||
static gboolean
|
||||
update_cb(gpointer data _U_)
|
||||
{
|
||||
draw_tap_listeners(FALSE);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Restart the tap update display timer with new configured interval */
|
||||
void reset_tap_update_timer(void)
|
||||
{
|
||||
#if defined(_WIN32) || ! defined USE_THREADS
|
||||
gtk_timeout_remove(tap_update_timer_id);
|
||||
tap_update_timer_id = gtk_timeout_add(prefs.tap_update_interval, (GtkFunction)update_cb,(gpointer)NULL);
|
||||
#endif
|
||||
g_source_remove(tap_update_timer_id);
|
||||
tap_update_timer_id = g_timeout_add(prefs.tap_update_interval, update_cb, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -2050,11 +2048,11 @@ main(int argc, char *argv[])
|
|||
}
|
||||
#else /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */
|
||||
/* this is to keep tap extensions updating once every 3 seconds */
|
||||
tap_update_timer_id = gtk_timeout_add(prefs->tap_update_interval, (GtkFunction)update_cb,(gpointer)NULL);
|
||||
tap_update_timer_id = g_timeout_add(prefs->tap_update_interval, update_cb, NULL);
|
||||
#endif /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */
|
||||
|
||||
#if HAVE_GNU_ADNS
|
||||
gtk_timeout_add(750, (GtkFunction) host_name_lookup_process, NULL);
|
||||
g_timeout_add(750, host_name_lookup_process, NULL);
|
||||
#endif
|
||||
|
||||
splash_update(RA_CONFIGURATION, NULL, (gpointer)splash_win);
|
||||
|
|
Loading…
Reference in New Issue