diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | bat_tray.c | 8 | ||||
| -rw-r--r-- | common.h | 8 | ||||
| -rw-r--r-- | defaults.c | 28 | ||||
| -rw-r--r-- | defaults.h | 14 | ||||
| -rw-r--r-- | paramano.c | 25 | ||||
| -rw-r--r-- | reload.c | 2 | ||||
| -rw-r--r-- | tray.c | 20 | ||||
| -rw-r--r-- | tray.h | 16 | 
9 files changed, 61 insertions, 62 deletions
| @@ -7,6 +7,8 @@ I forked the project and got it working again.  If you're using ArchLinux, just jump over to the [AUR page for this software](https://aur.archlinux.org/packages/trayfreq-archlinux) and install it that way. +For other distros, you'll likely want to install Paramano using your package manager, creating a package if one doesn't exist in your repositories. +  Runtime Dependencies  -------------------- @@ -94,15 +94,15 @@ gboolean update_icon(gpointer user_data)  	switch ( get_battery_state() )  	{  		case STATE_DISCHARGING: -			asprintf(&icon_file,"%s/bat-%d.png",_DEFAULT_THEME,rounded); +			asprintf(&icon_file,"%s/bat-%d.png",DEFAULT_THEME,rounded);  			break;  		case STATE_CHARGING: -			asprintf(&icon_file,"%s/bat-%d-charging.png",_DEFAULT_THEME,rounded); +			asprintf(&icon_file,"%s/bat-%d-charging.png",DEFAULT_THEME,rounded);  			break;  		default: -			asprintf(&icon_file,"%s/bat-charged.png",_DEFAULT_THEME); +			asprintf(&icon_file,"%s/bat-charged.png",DEFAULT_THEME);  			break;  	} @@ -131,7 +131,7 @@ void bat_tray_init()  	debug("Spawning new status icon\n");  	tray = gtk_status_icon_new(); -	asprintf(&icon_file,"%s/bat-charged.png",_DEFAULT_THEME); +	asprintf(&icon_file,"%s/bat-charged.png",DEFAULT_THEME);  	gtk_status_icon_set_from_file(tray, icon_file);  	free(icon_file);  	gtk_status_icon_set_has_tooltip (tray, TRUE); @@ -22,11 +22,11 @@  #include <stdbool.h>  #include <stdio.h> -int  get_int_value_from_file(const char* filename); -int  get_int(const char* string); -bool file_has_line(const char *filename, const char *line); +int   get_int_value_from_file(const char* filename); +int   get_int(const char* string); +bool  file_has_line(const char *filename, const char *line);  FILE* check_for_file(char* path); -void chomp(char* string); +void  chomp(char* string);  // <ew> Stringification of line number  #define STRING2(x) #x @@ -20,21 +20,21 @@  #include <stdio.h> -char* _DEFAULT_GOV; -char* _DEFAULT_FREQ; -char* _DEFAULT_PROG; -char* _DEFAULT_BAT_GOV; -char* _DEFAULT_AC_GOV; -bool  _DEFAULT_SHOW_BATTERY = true; -char* _DEFAULT_THEME; +char* DEFAULT_GOV; +char* DEFAULT_FREQ; +char* DEFAULT_PROG; +char* DEFAULT_BAT_GOV; +char* DEFAULT_AC_GOV; +bool  DEFAULT_SHOW_BATTERY = true; +char* DEFAULT_THEME;  void defaults_init()  { -	_DEFAULT_GOV			= NULL; -	_DEFAULT_FREQ			= NULL; -	_DEFAULT_PROG			= NULL; -	_DEFAULT_BAT_GOV		= NULL; -	_DEFAULT_AC_GOV			= NULL; -	_DEFAULT_SHOW_BATTERY	= true; -	asprintf(&_DEFAULT_THEME, SHAREDIR"/paramano/themes/default"); +	DEFAULT_GOV				= NULL; +	DEFAULT_FREQ			= NULL; +	DEFAULT_PROG			= NULL; +	DEFAULT_BAT_GOV			= NULL; +	DEFAULT_AC_GOV			= NULL; +	DEFAULT_SHOW_BATTERY	= true; +	asprintf(&DEFAULT_THEME, SHAREDIR"/paramano/themes/default");  } @@ -22,13 +22,13 @@  #include <stdbool.h> /* boolean types */  #include <stdlib.h> /* NULL */ -char* _DEFAULT_GOV; -char* _DEFAULT_FREQ; -char* _DEFAULT_PROG; -char* _DEFAULT_BAT_GOV; -char* _DEFAULT_AC_GOV; -bool  _DEFAULT_SHOW_BATTERY; -char* _DEFAULT_THEME; +char* DEFAULT_GOV; +char* DEFAULT_FREQ; +char* DEFAULT_PROG; +char* DEFAULT_BAT_GOV; +char* DEFAULT_AC_GOV; +bool  DEFAULT_SHOW_BATTERY; +char* DEFAULT_THEME;  void defaults_init(); @@ -71,7 +71,7 @@ int main(int argc, char** argv)  	tray_show();  	// Show battery tray only if we're supposed to -	if(_DEFAULT_SHOW_BATTERY) +	if(DEFAULT_SHOW_BATTERY)  	{  		debug("Showing battery info this time around\n");  		bat_tray_init(); @@ -127,24 +127,21 @@ void config_init()  	// Reset defaults to default values  	defaults_init(); -	_DEFAULT_GOV		= config_get_key(&config, "governor", "default"); -	_DEFAULT_FREQ		= config_get_key(&config, "frequency", "default"); -	_DEFAULT_BAT_GOV	= config_get_key(&config, "battery", "governor"); -	_DEFAULT_AC_GOV		= config_get_key(&config, "ac", "governor"); +	DEFAULT_GOV			= config_get_key(&config, "governor", "default"); +	DEFAULT_FREQ		= config_get_key(&config, "frequency", "default"); +	DEFAULT_BAT_GOV		= config_get_key(&config, "battery", "governor"); +	DEFAULT_AC_GOV		= config_get_key(&config, "ac", "governor"); -	char* temp = config_get_key(&config, "battery", "show"); -	if (temp) -		_DEFAULT_SHOW_BATTERY = ( temp[0] == '1' ); +	char* temp; +	if ((temp = config_get_key(&config, "battery", "show"))) +		DEFAULT_SHOW_BATTERY = ( temp[0] == '1' );  	info("UID: %d   GID: %d\n", getuid(), getgid()); -	temp = config_get_key(&config, "extra", "theme"); -	if (temp && strlen(temp) < sizeof(_DEFAULT_THEME) ) -	{ -		sprintf(_DEFAULT_THEME, "%s", temp); -	} +	if ((temp = config_get_key(&config, "extra", "theme"))) +		asprintf(&DEFAULT_THEME, "%s", temp); -	debug("Using theme %s\n",_DEFAULT_THEME); +	debug("Using theme %s\n",DEFAULT_THEME);  	g_free(config.file_name);  	config_close(&config); @@ -37,7 +37,7 @@ void reload_config()  	config_init();  	// Hide battery icon if told to -	_DEFAULT_SHOW_BATTERY? bat_tray_show() : bat_tray_hide(); +	DEFAULT_SHOW_BATTERY? bat_tray_show() : bat_tray_hide();  	// Update governor and frequency defaults  	debug("Re-init freq tray\n"); @@ -248,20 +248,20 @@ static gboolean update_icon(gpointer user_data)  	{  		case STATE_DISCHARGING:  			debug("Discharging\n"); -			if(_DEFAULT_BAT_GOV) +			if(DEFAULT_BAT_GOV)  			{  				for(i = 0; i < gc_number(); ++i) -					si_gov(_DEFAULT_BAT_GOV, i); +					si_gov(DEFAULT_BAT_GOV, i);  			}  			break;  		case STATE_CHARGING:  		case STATE_FULL:  			debug("Charging/Full\n"); -			if(_DEFAULT_AC_GOV) +			if(DEFAULT_AC_GOV)  			{  				for(i = 0; i < gc_number(); ++i) -					si_gov(_DEFAULT_AC_GOV, i); +					si_gov(DEFAULT_AC_GOV, i);  			}  			break; @@ -280,20 +280,20 @@ void tray_set_defaults()  {  	// Set defaults  	int i = 0; -	if(_DEFAULT_GOV) +	if(DEFAULT_GOV)  	{  		for(i = 0; i < gc_number(); ++i) -			si_gov(_DEFAULT_GOV, i); +			si_gov(DEFAULT_GOV, i);  	} else {  		for(i = 0; i < gc_number(); ++i)  			si_gov("ondemand", i);  	} -	if(_DEFAULT_FREQ) +	if(DEFAULT_FREQ)  	{  		for(i = 0; i < gc_number(); ++i) -			si_freq(atoi(_DEFAULT_FREQ), i); +			si_freq(atoi(DEFAULT_FREQ), i);  	}  } @@ -306,7 +306,7 @@ void tray_init()  {  	tray_set_defaults();  	tray = gtk_status_icon_new(); -	char* icon_file = g_strconcat(_DEFAULT_THEME, "/cpu-0.png", NULL); +	char* icon_file = g_strconcat(DEFAULT_THEME, "/cpu-0.png", NULL);  	debug("Setting icon to '%s'\n",icon_file);  	gtk_status_icon_set_from_file(tray, icon_file); @@ -364,7 +364,7 @@ void tray_update_icon_percent()  	}  	debug("Rounded/adjusted CPU percentage: %d\n",adjusted_percent); -	asprintf(&file, "%s/cpu-%d.png", _DEFAULT_THEME,adjusted_percent); +	asprintf(&file, "%s/cpu-%d.png", DEFAULT_THEME,adjusted_percent);  	debug("Setting tray icon to '%s'\n",file);  	gtk_status_icon_set_from_file(tray, file); @@ -21,13 +21,13 @@  #include <stdbool.h> -void	tray_set_defaults(); -void	tray_init(); -void	tray_set_tooltip(const char* msg); -void	tray_update_icon_percent(); -void	tray_show(); -void	tray_hide(); -bool	tray_visible(); -bool	tray_embedded(); +void tray_set_defaults(); +void tray_init(); +void tray_set_tooltip(const char* msg); +void tray_update_icon_percent(); +void tray_show(); +void tray_hide(); +bool tray_visible(); +bool tray_embedded();  #endif | 
