@@ -28,6 +28,15 @@ public class NetloadIconExporter : ItemExporter
2828 private ServerItem down_item;
2929 private ServerItem all_item;
3030 private int period = 1 ;
31+ private void set_invalid_icon ()
32+ {
33+ this . icon_name = " dialog-error" ;
34+ var tooltip = ToolTip ();
35+ tooltip. icon_name = " dialog-error" ;
36+ tooltip. title = _(" No network connection" );
37+ tooltip. description = _(" or no location." );
38+ this . tool_tip = tooltip;
39+ }
3140 void update_display ()
3241 {
3342 // get sum of up and down net traffic and separate values
@@ -63,7 +72,8 @@ public class NetloadIconExporter : ItemExporter
6372 {
6473 var dlg = Configurator . generic_config_dlg(_(" Vala Panel Netload Applet" ),
6574 this . settings,
66- _(" Select network interface" ), IFACE , GenericConfigType . STR );
75+ _(" Select network interface" ), IFACE , GenericConfigType . STR ,
76+ _(" Reload network interfaces" ), " reload" , GenericConfigType . BOOL );
6777 dlg. icon_name = " network-wired" ;
6878 return dlg;
6979 }
@@ -201,23 +211,25 @@ public class NetloadIconExporter : ItemExporter
201211 this . id = " vala-panel-extras-gtop" ;
202212 this . title = _(" Netload Applet" );
203213 this . category = Category . HARDWARE ;
214+ set_invalid_icon();
204215 var sep = new ServerItem ();
205216 sep. set_variant_property(" type" ,new Variant .string(" separator" ));
206217 dbusmenu. prepend_item(sep);
207218 ifaces_parent = new ServerItem ();
208219 ifaces_parent. set_variant_property(" label" ,new Variant .string(_(" Interfaces" )));
220+ ifaces_parent. set_variant_property(" children-display" ,new Variant .string(" submenu" ));
209221 dbusmenu. prepend_item(ifaces_parent);
210222 sep = new ServerItem ();
211223 sep. set_variant_property(" type" ,new Variant .string(" separator" ));
212224 dbusmenu. prepend_item(sep);
213225 down_item = new ServerItem ();
214226 down_item. set_variant_property(" label" ,new Variant .string(_(" Down" )));
215227 down_item. set_variant_property(" icon-name" ,new Variant .string(" network-receive-symbolic" ));
216- dbusmenu. append_item (down_item);
228+ dbusmenu. prepend_item (down_item);
217229 up_item = new ServerItem ();
218230 up_item. set_variant_property(" label" ,new Variant .string(_(" Up" )));
219231 up_item. set_variant_property(" icon-name" ,new Variant .string(" network-transmit-symbolic" ));
220- dbusmenu. append_item (up_item);
232+ dbusmenu. prepend_item (up_item);
221233 this . notify[" app" ]. connect(()= > {
222234 app. about. logo_icon_name = " network-wired" ;
223235 app. about. icon_name = " network-wired" ;
@@ -227,6 +239,7 @@ public class NetloadIconExporter : ItemExporter
227239 this . settings. bind(IFACE , this , IFACE , SettingsBindFlags . GET );
228240 app. preferences = create_preferences_dialog;
229241 add_netifs();
242+ update_display();
230243 this . notify[IFACE ]. connect(()= > {
231244 for (var i = 0 ; i< ifaces. length; i++ )
232245 ifaces[i]. set_variant_property(" toggle-state" ,new Variant .int32((int )(network_interface == interfaces[i])));
@@ -240,6 +253,10 @@ public class NetloadIconExporter : ItemExporter
240253 add_netifs();
241254 settings. set_boolean(" reload" ,false );
242255 });
256+ Timeout . add_seconds(period,()= > {
257+ update_display();
258+ return Source . CONTINUE ;
259+ });
243260 });
244261 }
245262}
0 commit comments