[gnome-applets] Update the multiload tooltip periodically
- From: Callum McKenzie <callum src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets] Update the multiload tooltip periodically
- Date: Mon, 21 Jun 2010 19:47:38 +0000 (UTC)
commit ba9964ff1760da59a9ce6b95009493e347515592
Author: Callum McKenzie <callum spooky-possum org>
Date: Mon Jun 21 19:40:03 2010 +1200
Update the multiload tooltip periodically
Patch from Max Ulidtko to fix this (and other minor issues).
See bug 617992.
multiload/load-graph.c | 37 ++++++++++++++++++++++++++++++++-----
multiload/main.c | 40 ----------------------------------------
2 files changed, 32 insertions(+), 45 deletions(-)
---
diff --git a/multiload/load-graph.c b/multiload/load-graph.c
index 2624422..2ca1423 100644
--- a/multiload/load-graph.c
+++ b/multiload/load-graph.c
@@ -129,8 +129,8 @@ load_graph_update (LoadGraph *g)
if (g->tooltip_update)
multiload_applet_tooltip_update(g);
- else
- g->get_data (g->draw_height, g->data [0], g);
+
+ g->get_data (g->draw_height, g->data [0], g);
load_graph_draw (g);
return TRUE;
@@ -267,6 +267,29 @@ load_graph_clicked (GtkWidget *widget, GdkEventButton *event, LoadGraph *load)
return FALSE;
}
+static gboolean
+load_graph_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
+{
+ LoadGraph *graph;
+ graph = (LoadGraph *)data;
+
+ graph->tooltip_update = TRUE;
+ multiload_applet_tooltip_update(graph);
+
+ return TRUE;
+}
+
+static gboolean
+load_graph_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
+{
+ LoadGraph *graph;
+ graph = (LoadGraph *)data;
+
+ graph->tooltip_update = FALSE;
+
+ return TRUE;
+}
+
static void
load_graph_load_config (LoadGraph *g)
{
@@ -310,9 +333,9 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label,
g->show_frame = TRUE;
g->multiload = ma;
- g->main_widget = gtk_vbox_new (FALSE, FALSE);
+ g->main_widget = gtk_vbox_new (FALSE, 0);
- g->box = gtk_vbox_new (FALSE, FALSE);
+ g->box = gtk_vbox_new (FALSE, 0);
orient = panel_applet_get_orient (g->multiload->applet);
switch (orient)
@@ -369,8 +392,12 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label,
G_CALLBACK (load_graph_configure), g);
g_signal_connect (G_OBJECT(g->disp), "destroy",
G_CALLBACK (load_graph_destroy), g);
- g_signal_connect (g->disp, "button-press-event",
+ g_signal_connect (G_OBJECT(g->disp), "button-press-event",
G_CALLBACK (load_graph_clicked), g);
+ g_signal_connect (G_OBJECT(g->disp), "enter-notify-event",
+ G_CALLBACK(load_graph_enter_cb), g);
+ g_signal_connect (G_OBJECT(g->disp), "leave-notify-event",
+ G_CALLBACK(load_graph_leave_cb), g);
gtk_box_pack_start (GTK_BOX (g->box), g->disp, TRUE, TRUE, 0);
gtk_widget_show_all(g->box);
diff --git a/multiload/main.c b/multiload/main.c
index b201c09..a44ac84 100644
--- a/multiload/main.c
+++ b/multiload/main.c
@@ -201,39 +201,6 @@ multiload_destroy_cb(GtkWidget *widget, gpointer data)
return;
}
-static gboolean
-multiload_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
-{
- MultiloadApplet *ma;
- gint i;
-
- ma = (MultiloadApplet *)data;
-
- for (i = 0; i < NGRAPHS; i++)
- if (ma->graphs[i]->visible)
- {
- ma->graphs[i]->tooltip_update = TRUE;
- multiload_applet_tooltip_update(ma->graphs[i]);
- }
-
- return TRUE;
-}
-
-
-static gboolean
-multiload_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
-{
- MultiloadApplet *ma;
- gint i;
-
- ma = (MultiloadApplet *)data;
-
- for (i = 0; i < NGRAPHS; i++)
- ma->graphs[i]->tooltip_update = FALSE;
-
- return TRUE;
-}
-
static gboolean
multiload_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, MultiloadApplet *ma)
@@ -299,9 +266,6 @@ multiload_applet_tooltip_update(LoadGraph *g)
else
g_assert_not_reached();
- /* fill data[0] with the current load */
- g->get_data (g->draw_height, g->data[0], g);
-
if (!strncmp(g->name, "memload", strlen("memload"))) {
guint mem_user, mem_cache, user_percent, cache_percent;
mem_user = g->data[0][0];
@@ -534,10 +498,6 @@ multiload_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
G_CALLBACK(multiload_change_orient_cb), ma);
g_signal_connect(G_OBJECT(applet), "destroy",
G_CALLBACK(multiload_destroy_cb), ma);
- g_signal_connect(G_OBJECT(applet), "enter_notify_event",
- G_CALLBACK(multiload_enter_cb), ma);
- g_signal_connect(G_OBJECT(applet), "leave_notify_event",
- G_CALLBACK(multiload_leave_cb), ma);
g_signal_connect(G_OBJECT(applet), "button_press_event",
G_CALLBACK(multiload_button_press_event_cb), ma);
g_signal_connect(G_OBJECT(applet), "key_press_event",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]