diff --git a/panel-plugin/global.h b/panel-plugin/global.h deleted file mode 100644 index fedd617..0000000 --- a/panel-plugin/global.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005 Bernhard Walle - * ------------------------------------------------------------------------------------------------- - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 675 Mass - * Ave, Cambridge, MA 02139, USA. - * - * ------------------------------------------------------------------------------------------------- - */ -#ifndef GLOBAL_H -#define GLOBAL_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef DEBUG - -# define PRINT_DBG(fmt, ...) \ - { \ - fprintf(stderr, "DEBUG[%s:%d]: "fmt, __FILE__, __LINE__, \ - ## __VA_ARGS__); \ - } - -#else - -# define PRINT_DBG(fmt, ...) { do {} while(0); } - -#endif - -#endif /* GLOBAL_H */ diff --git a/panel-plugin/net.c b/panel-plugin/net.c index e5afd5c..c66d144 100644 --- a/panel-plugin/net.c +++ b/panel-plugin/net.c @@ -33,6 +33,8 @@ #include #endif +#include + /* From Wormulon */ #include "net.h" #include "os.h" @@ -42,8 +44,6 @@ #include #include -#include "global.h" - #ifdef __HPUX__ # include "wormulon/hpux.h" # include "wormulon/hpux.c" @@ -104,7 +104,7 @@ int init_netload(netdata* data, const char* device) data->correct_interface = TRUE; - PRINT_DBG("The netload plugin was initialized for '%s'.", device); + DBG("The netload plugin was initialized for '%s'.", device); return TRUE; } @@ -190,14 +190,14 @@ int get_interface_up(netdata* data) /* get the value from the operating system */ if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { - PRINT_DBG("Error in socket: %s", strerror(errno)); + DBG("Error in socket: %s", strerror(errno)); return FALSE; } snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", data->ifdata.if_name); if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) != 0) { - PRINT_DBG("Error in ioctl(sockfd): %s", strerror(errno)); + DBG("Error in ioctl(sockfd): %s", strerror(errno)); close(sockfd); return FALSE; } @@ -227,7 +227,7 @@ char* get_ip_address(netdata* data) /* get the value from the operating system */ if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { - PRINT_DBG("Error in socket: %s", strerror(errno)); + DBG("Error in socket: %s", strerror(errno)); return NULL; } @@ -236,7 +236,7 @@ char* get_ip_address(netdata* data) { if (errno != EADDRNOTAVAIL) { - PRINT_DBG("Error in ioctl(sockfd): %s", strerror(errno)); + DBG("Error in ioctl(sockfd): %s", strerror(errno)); } close(sockfd); return NULL; @@ -247,7 +247,7 @@ char* get_ip_address(netdata* data) if (!inet_ntop(AF_INET, &p_sa->sin_addr, data->ip_address, IP_ADDRESS_LENGTH)) { - PRINT_DBG("Error in inet_ntop: %s", strerror(errno)); + DBG("Error in inet_ntop: %s", strerror(errno)); return NULL; } diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 4d4c476..5813f6c 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -25,7 +25,6 @@ #include "net.h" #include "utils.h" -#include "global.h" #include #include @@ -217,15 +216,15 @@ static gboolean update_monitors(t_global_monitor *global) switch (i) { case IN: - PRINT_DBG("input: Max = %lu", global->monitor->net_max[i]); + DBG("input: Max = %lu", global->monitor->net_max[i]); break; case OUT: - PRINT_DBG("output: Max = %lu", global->monitor->net_max[i]); + DBG("output: Max = %lu", global->monitor->net_max[i]); break; case TOT: - PRINT_DBG("total: Max = %lu", global->monitor->net_max[i]); + DBG("total: Max = %lu", global->monitor->net_max[i]); break; } #endif /* DEBUG */ @@ -296,7 +295,7 @@ static gboolean monitor_set_size(XfcePanelPlugin *plugin, int size, t_global_mon gint i; XfcePanelPluginMode mode = xfce_panel_plugin_get_mode (plugin); - PRINT_DBG("monitor_set_size"); + DBG("monitor_set_size"); if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) { @@ -331,7 +330,7 @@ static void monitor_set_mode (XfcePanelPlugin *plugin, XfcePanelPluginMode mode, { gint i; - PRINT_DBG("monitor_set_mode"); + DBG("monitor_set_mode"); if (global->timeout_id) { @@ -666,7 +665,7 @@ static void monitor_read_config(XfcePanelPlugin *plugin, t_global_monitor *globa global->monitor->options.values_as_bits = xfce_rc_read_bool_entry (rc, "Values_As_Bits", FALSE); - PRINT_DBG("monitor_read_config"); + DBG("monitor_read_config"); setup_monitor(global, TRUE); xfce_rc_close (rc); @@ -761,7 +760,7 @@ static void monitor_apply_options(t_global_monitor *global) GTK_SPIN_BUTTON(global->monitor->update_spinner) ) * 1000 + 0.5); setup_monitor(global, FALSE); - PRINT_DBG("monitor_apply_options_cb"); + DBG("monitor_apply_options_cb"); } @@ -777,7 +776,7 @@ static void label_changed(GtkWidget *button, t_global_monitor *global) g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->opt_entry))); setup_monitor(global, FALSE); - PRINT_DBG("label_changed"); + DBG("label_changed"); } @@ -792,7 +791,7 @@ static void max_label_changed(GtkWidget *button, t_global_monitor *global) } setup_monitor(global, FALSE); - PRINT_DBG("max_label_changed"); + DBG("max_label_changed"); } @@ -808,7 +807,7 @@ static void network_changed(GtkWidget *button, t_global_monitor *global) g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->net_entry))); setup_monitor(global, FALSE); - PRINT_DBG("network_changed"); + DBG("network_changed"); } @@ -822,7 +821,7 @@ static void label_toggled(GtkWidget *check_button, t_global_monitor *global) global->monitor->options.use_label); setup_monitor(global, FALSE); - PRINT_DBG("label_toggled"); + DBG("label_toggled"); } /* ---------------------------------------------------------------------------------------------- */ @@ -832,7 +831,7 @@ static void as_bits_toggled(GtkWidget *check_button, t_global_monitor *global) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(global->monitor->opt_as_bits), global->monitor->options.values_as_bits); - PRINT_DBG("label_toggled"); + DBG("label_toggled"); } /* ---------------------------------------------------------------------------------------------- */ @@ -848,7 +847,7 @@ static void present_data_combobox_changed(GtkWidget *combobox, t_global_monitor global->monitor->options.show_values); setup_monitor(global, FALSE); - PRINT_DBG("present_data_combobox_changed"); + DBG("present_data_combobox_changed"); } /* ---------------------------------------------------------------------------------------------- */ @@ -870,7 +869,7 @@ static void max_label_toggled(GtkWidget *check_button, t_global_monitor *global) } } setup_monitor(global, FALSE); - PRINT_DBG("max_label_toggled"); + DBG("max_label_toggled"); }