diff --git a/ChangeLog b/ChangeLog index af5929a..cd7306c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * Fixed memory leak (thanks to Brian J. Tarricone) * Custom bar colors now also work with special Gtk theme engine where the previous code doesn't work (thanks to Brian J. Tarricone) + * Fixed bug that causes an invalid displayed string if no device name + was set. * Released 0.3.3. 2005-08-01 Bernhard Walle diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index acd7536..f925e81 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -500,10 +500,14 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) { gtk_widget_hide(GTK_WIDGET(global->monitor->status[i])); rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); + if (!rc) { rc = gtk_rc_style_new(); + } else { + /* to free the style safely in any case */ + gtk_rc_style_ref(rc); } - + if (rc) { rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; rc->color_flags[GTK_STATE_SELECTED] |= GTK_RC_BASE; @@ -533,27 +537,23 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) gtk_widget_show(global->monitor->label); } - if (!strcmp(global->monitor->options.network_device, - global->monitor->options.old_network_device) == 0) + if (!init_netload( &(global->monitor->data), global->monitor->options.network_device) + && !supress_warnings) { - if (!init_netload( &(global->monitor->data), global->monitor->options.network_device) - && !supress_warnings) - { - xfce_err (_("%s: Error in initalizing:\n%s"), - _(APP_NAME), - _(errormessages[ - global->monitor->data.errorcode == 0 - ? INTERFACE_NOT_FOUND - : global->monitor->data.errorcode ])); - } - - if (global->monitor->options.old_network_device) - { - g_free(global->monitor->options.old_network_device); - } - global->monitor->options.old_network_device = g_strdup(global->monitor->options.network_device); + xfce_err (_("%s: Error in initalizing:\n%s"), + _(APP_NAME), + _(errormessages[ + global->monitor->data.errorcode == 0 + ? INTERFACE_NOT_FOUND + : global->monitor->data.errorcode ])); } + if (global->monitor->options.old_network_device) + { + g_free(global->monitor->options.old_network_device); + } + global->monitor->options.old_network_device = g_strdup(global->monitor->options.network_device); + run_update( global ); }