[Xfce4-commits] [panel-plugins/xfce4-netload-plugin] 01/01: Pack progress bars inside event box and hide/show (bug #10258)

noreply at xfce.org noreply at xfce.org
Sun Nov 2 15:07:27 CET 2014


This is an automated email from the git hooks/post-receive script.

mmassonnet pushed a commit to branch master
in repository panel-plugins/xfce4-netload-plugin.

commit 23ec87473efc5dd9da19c1b1968915521d56b2eb
Author: Mike Massonnet <m8t at gandi.net>
Date:   Sun Nov 2 15:07:28 2014 +0100

    Pack progress bars inside event box and hide/show (bug #10258)
    
    After switching the option to show/hide the progress bars, the right click loses its
    signal to display the panel context menu. Fixed by packing the progress bars inside
    an event box.
---
 panel-plugin/netload.c |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c
index 7acb676..4fcde53 100644
--- a/panel-plugin/netload.c
+++ b/panel-plugin/netload.c
@@ -134,6 +134,8 @@ typedef struct
 
     GtkWidget         *ebox;
     GtkWidget         *box;
+    GtkWidget         *ebox_bars;
+    GtkWidget         *box_bars;
     GtkWidget         *tooltip_text;
     guint             timeout_id;
     t_monitor         *monitor;
@@ -471,12 +473,21 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin)
                        TRUE, FALSE, 2);
 
     /* Create the progress bars */
+    global->ebox_bars = gtk_event_box_new();
+    gtk_event_box_set_visible_window(GTK_EVENT_BOX(global->ebox_bars), FALSE);
+    gtk_event_box_set_above_child(GTK_EVENT_BOX(global->ebox_bars), TRUE);
+    gtk_widget_show(global->ebox_bars);
+    global->box_bars = xfce_hvbox_new(GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
+    gtk_widget_show(global->box_bars);
     for (i = 0; i < SUM; i++)
     {
         global->monitor->status[i] = GTK_WIDGET(gtk_progress_bar_new());
-        gtk_box_pack_start(GTK_BOX(global->box),
+        gtk_box_pack_start(GTK_BOX(global->box_bars),
                            GTK_WIDGET(global->monitor->status[i]), FALSE, FALSE, 0);
+        gtk_widget_show(global->monitor->status[i]);
     }
+    gtk_container_add(GTK_CONTAINER(global->ebox_bars), GTK_WIDGET(global->box_bars));
+    gtk_container_add(GTK_CONTAINER(global->box), GTK_WIDGET(global->ebox_bars));
 
     /* Append sent label after the progress bars */
     gtk_box_pack_start(GTK_BOX(global->box),
@@ -532,16 +543,16 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings)
     }
 
     /* Setup the progress bars */
-    for (i = 0; i < SUM; i++)
+    if (global->monitor->options.show_bars)
     {
-        if (global->monitor->options.show_bars)
+        gtk_widget_show(global->ebox_bars);
+        for (i = 0; i < SUM; i++)
         {
             /* Automatic or fixed maximum */
             if (global->monitor->options.auto_max)
                 global->monitor->net_max[i] = INIT_MAX;
             else
                 global->monitor->net_max[i] = global->monitor->options.max[i];
-            gtk_widget_show(global->monitor->status[i]);
 
             /* Set bar colors */
             gtk_widget_modify_bg(GTK_WIDGET(global->monitor->status[i]),
@@ -554,10 +565,10 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings)
                                    GTK_STATE_SELECTED,
                                    &global->monitor->options.color[i]);
         }
-        else
-        {
-            gtk_widget_hide(global->monitor->status[i]);
-        }
+    }
+    else
+    {
+        gtk_widget_hide(global->ebox_bars);
     }
 
     if (!init_netload( &(global->monitor->data), global->monitor->options.network_device)
@@ -1182,8 +1193,8 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl
                 FALSE, FALSE, 0);
 
         gtk_size_group_add_widget(sg, color_label[i]);
-
     }
+
     global->monitor->opt_colorize_values =
         gtk_check_button_new_with_mnemonic(_("_Colorize values"));
     gtk_widget_show(global->monitor->opt_colorize_values);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list