[gnome-nettool] Avoid flickering in fast operations
- From: GermÃn Poà CaamaÃo <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nettool] Avoid flickering in fast operations
- Date: Sun, 1 Jan 2012 05:59:24 +0000 (UTC)
commit ba2614a5a06a29f37cfdd8a07f5bc730162b872d
Author: GermÃn Poo-CaamaÃo <gpoo gnome org>
Date: Sat Dec 31 21:59:14 2011 -0800
Avoid flickering in fast operations
Do not toggle the action button when the operation is known to
be fast (e.g. show the routing table or active network services).
Fixed Bug #521977
Signed-off-by: GermÃn Poo-CaamaÃo <gpoo gnome org>
src/main.c | 8 ++++++++
src/netstat.c | 13 ++++++++++++-
src/nettool.c | 5 +++++
src/nettool.h | 1 +
4 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 8898e57..21c9b59 100644
--- a/src/main.c
+++ b/src/main.c
@@ -279,6 +279,7 @@ load_ping_widgets_from_builder (GtkBuilder * builder)
pinger->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
pinger->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "ping"));
pinger->running = FALSE;
+ pinger->toggle = TRUE;
pinger->child_pid = 0;
pinger->host = GTK_WIDGET (gtk_builder_get_object (builder, "ping_host"));
pinger->count = GTK_WIDGET (gtk_builder_get_object (builder, "ping_count"));
@@ -365,6 +366,7 @@ load_traceroute_widgets_from_builder (GtkBuilder * builder)
tracer->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
tracer->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "traceroute"));
tracer->running = FALSE;
+ tracer->toggle = TRUE;
tracer->child_pid = 0;
tracer->host = GTK_WIDGET (gtk_builder_get_object (builder, "traceroute_host"));
tracer->output = GTK_WIDGET (gtk_builder_get_object (builder, "traceroute_output"));
@@ -433,6 +435,7 @@ load_netstat_widgets_from_builder (GtkBuilder * builder)
netstat->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
netstat->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "netstat"));
netstat->running = FALSE;
+ netstat->toggle = TRUE;
netstat->child_pid = 0;
netstat->host = NULL;
netstat->count = NULL;
@@ -530,6 +533,7 @@ load_info_widgets_from_builder (GtkBuilder * builder)
info->main_window = GTK_WIDGET (gtk_builder_get_object (builder, "main_window"));
info->running = FALSE;
+ info->toggle = TRUE;
info->combo = GTK_WIDGET (gtk_builder_get_object (builder, "info_combo"));
info->ipv6_frame = GTK_WIDGET (gtk_builder_get_object (builder, "info_ipv6_frame"));
info->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
@@ -604,6 +608,7 @@ load_scan_widgets_from_builder (GtkBuilder * builder)
scan->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
scan->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "scan"));
scan->running = FALSE;
+ scan->toggle = TRUE;
scan->child_pid = 0;
scan->host = GTK_WIDGET (gtk_builder_get_object (builder, "scan_host"));
scan->count = NULL;
@@ -724,6 +729,7 @@ load_lookup_widgets_from_builder (GtkBuilder * builder)
lookup->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
lookup->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "lookup"));
lookup->running = FALSE;
+ lookup->toggle = TRUE;
lookup->child_pid = 0;
lookup->host = GTK_WIDGET (gtk_builder_get_object (builder, "lookup_host"));
lookup->output = GTK_WIDGET (gtk_builder_get_object (builder, "lookup_output"));
@@ -803,6 +809,7 @@ load_finger_widgets_from_builder (GtkBuilder * builder)
finger->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
finger->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "finger"));
finger->running = FALSE;
+ finger->toggle = TRUE;
finger->child_pid = 0;
finger->user = GTK_WIDGET (gtk_builder_get_object (builder, "finger_user"));
finger->host = GTK_WIDGET (gtk_builder_get_object (builder, "finger_host"));
@@ -911,6 +918,7 @@ load_whois_widgets_from_builder (GtkBuilder * builder)
whois->progress_bar = GTK_WIDGET (gtk_builder_get_object (builder, "progress_bar"));
whois->page_label = GTK_WIDGET (gtk_builder_get_object (builder, "whois"));
whois->running = FALSE;
+ whois->toggle = TRUE;
whois->child_pid = 0;
whois->host = GTK_WIDGET (gtk_builder_get_object (builder, "whois_host"));
whois->output = GTK_WIDGET (gtk_builder_get_object (builder, "whois_output"));
diff --git a/src/netstat.c b/src/netstat.c
index 636f011..b6c8a42 100644
--- a/src/netstat.c
+++ b/src/netstat.c
@@ -171,15 +171,23 @@ netstat_stop (Netinfo * netinfo)
void
netstat_do (Netinfo * netinfo)
{
+ gboolean toggle;
gchar *command = NULL;
gchar *option = NULL;
gchar *program = NULL;
GtkTreeModel *model;
GtkWidget *parent;
+ NetstatOption noption;
g_return_if_fail (netinfo != NULL);
+ toggle = netinfo->toggle;
option = netstat_get_active_option (netinfo);
+ noption = netstat_get_active_option2 (netinfo);
+
+ if (noption == ROUTE || noption == PROTOCOL) {
+ netinfo->toggle = FALSE;
+ }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (netinfo->output));
if (GTK_IS_LIST_STORE (model)) {
@@ -200,7 +208,10 @@ netstat_do (Netinfo * netinfo)
g_strfreev (netinfo->command_line);
}
-
+
+ /* Restore previous state */
+ netinfo->toggle = toggle;
+
g_free (command);
g_free (option);
g_free (program);
diff --git a/src/nettool.c b/src/nettool.c
index 90b9bd2..f81dc9d 100644
--- a/src/nettool.c
+++ b/src/nettool.c
@@ -468,6 +468,11 @@ netinfo_toggle_state (Netinfo * netinfo, gboolean state,
g_assert (netinfo != NULL);
g_return_if_fail (netinfo != NULL);
+ if (! netinfo->toggle) {
+ netinfo->running = !state;
+ return;
+ }
+
if (GTK_IS_WIDGET (netinfo->sensitive)) {
gtk_widget_set_sensitive (GTK_WIDGET (netinfo->sensitive),
state);
diff --git a/src/nettool.h b/src/nettool.h
index f2d00e1..1b8ecf6 100644
--- a/src/nettool.h
+++ b/src/nettool.h
@@ -53,6 +53,7 @@ struct _Netinfo {
GtkWidget *multicast;
GtkWidget *graph;
gboolean running;
+ gboolean toggle;
gint child_pid;
gint pipe_out;
gint pipe_err;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]