aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile27
-rw-r--r--bat_tray/bat_tray.c10
-rw-r--r--strings.h24
-rw-r--r--tray.c6
-rwxr-xr-xtrayfreqbin141 -> 24642 bytes
-rwxr-xr-xtrayfreq-setbin149 -> 12869 bytes
-rw-r--r--trayfreq.c5
-rw-r--r--trayfreq_set/trayfreq_set.c23
8 files changed, 46 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index c41efd0..c32cf3e 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ GTK_LIBS = -lgtk-x11-2.0 \
-lgobject-2.0
-trayfreq_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall
+trayfreq_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall -D_=gettext
trayfreq_LDFLAGS = $(GTK_LIBS) $(GLIB_LIBS) -lm
trayfreq_SOURCES = freq_tray/getcore.c \
freq_tray/getfreq.c \
@@ -33,7 +33,7 @@ trayfreq_SOURCES = freq_tray/getcore.c \
bat_tray/bat_tray.c \
common.c
-trayfreq_set_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall
+trayfreq_set_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall -D_=gettext
trayfreq_set_LDFLAGS = $(GTK_LIBS) $(GLIB_LIBS) -lm
trayfreq_set_SOURCES = trayfreq_set/trayfreq_set.c \
freq_tray/getfreq.c \
@@ -42,33 +42,27 @@ trayfreq_set_SOURCES = trayfreq_set/trayfreq_set.c \
########################################################################
# Make entire suite
-all: trayfreq-en trayfreq-fr trayfreq-set-en trayfreq-set-fr
+all: trayfreq trayfreq-set
########################################################################
########################################################################
# Make trayfreq-set program for setting governors
-trayfreq-set-en:
- $(CC) -o trayfreq-set-en $(trayfreq_set_SOURCES) $(trayfreq_set_CFLAGS) $(trayfreq_set_LDFLAGS)
-
-trayfreq-set-fr:
- $(CC) -o trayfreq-set-fr $(trayfreq_set_SOURCES) $(trayfreq_set_CFLAGS) $(trayfreq_set_LDFLAGS) -DLANG_FR
+trayfreq-set:
+ $(CC) -o trayfreq-set $(trayfreq_set_SOURCES) $(trayfreq_set_CFLAGS) $(trayfreq_set_LDFLAGS)
########################################################################
########################################################################
# Make main trayfreq system tray program
-trayfreq-en:
- $(CC) -o trayfreq-en $(trayfreq_SOURCES) $(trayfreq_CFLAGS) $(trayfreq_LDFLAGS)
-
-trayfreq-fr:
- $(CC) -o trayfreq-fr $(trayfreq_SOURCES) $(trayfreq_CFLAGS) $(trayfreq_LDFLAGS) -DLANG_FR
+trayfreq:
+ $(CC) -o trayfreq $(trayfreq_SOURCES) $(trayfreq_CFLAGS) $(trayfreq_LDFLAGS)
########################################################################
########################################################################
# Remove generated files
clean:
- rm -f trayfreq-en trayfreq-set-en trayfreq-fr trayfreq-set-fr
+ rm -f trayfreq trayfreq-set
########################################################################
@@ -81,8 +75,5 @@ install:
install -D data/trayfreq.desktop $(INSTALL_PATH)/etc/xdg/autostart/trayfreq.desktop
install -Dm 755 trayfreq $(INSTALL_PATH)/usr/bin/trayfreq
install -Dm 755 trayfreq-set $(INSTALL_PATH)/usr/bin/trayfreq-set
- install -Dm 755 trayfreq-en $(INSTALL_PATH)/usr/bin/trayfreq-en
- install -Dm 755 trayfreq-set-en $(INSTALL_PATH)/usr/bin/trayfreq-set-en
- install -Dm 755 trayfreq-fr $(INSTALL_PATH)/usr/bin/trayfreq-fr
- install -Dm 755 trayfreq-set-fr $(INSTALL_PATH)/usr/bin/trayfreq-set-fr
+ ln -s /usr/share/licenses/common/GLPv3/license.txt $(INSTALL_PATH)/usr/share/trayfreq/LICENCE
########################################################################
diff --git a/bat_tray/bat_tray.c b/bat_tray/bat_tray.c
index 38c85bc..181f8d5 100644
--- a/bat_tray/bat_tray.c
+++ b/bat_tray/bat_tray.c
@@ -17,7 +17,6 @@
************************************************************************/
-#include "../strings.h"
#include "bat_tray.h"
#include "../common.h"
@@ -25,6 +24,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libintl.h>
static GtkStatusIcon* tray;
@@ -53,18 +53,18 @@ static gboolean update_tooltip(GtkStatusIcon* status_icon,gint x,gint y,gboolean
switch(get_battery_state())
{
case STATE_DISCHARGING:
- sprintf(msg, S_BAT_TRAY_C_BATTERY_DISCHARGING, get_bat_percent());
+ sprintf(msg, _("Discharging (%i%%)"), get_bat_percent());
break;
case STATE_CHARGING:
- sprintf(msg, S_BAT_TRAY_C_BATTERY_CHARGING, get_bat_percent());
+ sprintf(msg, _("Charging (%i%%)"), get_bat_percent());
break;
case STATE_CHARGED:
- sprintf(msg, S_BAT_TRAY_C_BATTERY_FULL);
+ sprintf(msg, _("Fully charged") );
break;
default:
- sprintf(msg, S_BAT_TRAY_C_BATTERY_UNKNOWN);
+ sprintf(msg, _("Unknown status") );
break;
}
diff --git a/strings.h b/strings.h
index 7567c99..b7b556b 100644
--- a/strings.h
+++ b/strings.h
@@ -1,3 +1,6 @@
+
+
+/*
#ifndef STRINGS_H
#define STRINGS_H
#ifdef LANG_FR
@@ -21,25 +24,26 @@
#define S_BAT_TRAY_C_BATTERY_UNKNOWN "?"
////////////////////////////////////////////////////////////////
- #else /* ifdef LANG_FR */
+ #else
////////////////////////////////////////////////////////////////
// ENGLISH
#define S_TRAYFREQ_SET_C_FILE_OPEN_ERROR "FAILED: Couldn't open %s for writing\n"
#define S_TRAYFREQ_SET_C_NO_ARGS "Use -g to set the governor or -f to set the frequency\n"
#define S_TRAYFREQ_SET_C_SET_FREQUENCY_ARG "Pass the frequency with -f\n"
#define S_TRAYFREQ_SET_C_SET_GOVERNOR_ARG "Pass the governor with -g\n"
- #define S_TRAYFREQ_SET_C_SET_CORE_ARG "Pass the with -c\n"
+ #define S_TRAYFREQ_SET_C_SET_CORE_ARG "Pass the core with -c\n"
- #define S_TRAY_C_GOVERNOR "Governor: %s\n"
- #define S_TRAY_C_CPU "CPU%i: %s%s"
+ #define S_TRAY_C_GOVERNOR
+ #define S_TRAY_C_CPU
- #define S_TRAYFREQ_C_GTK_ERROR "Cannot initialize gtk: gtk_init_check returned FALSE.\nBailing."
- #define S_TRAYFREQ_C_CONFIG_FILE_ERROR "Failed to open config files!\n"
+ #define S_TRAYFREQ_C_GTK_ERROR
+ #define S_TRAYFREQ_C_CONFIG_FILE_ERROR
#define S_BAT_TRAY_C_BATTERY_FULL "Fully charged"
- #define S_BAT_TRAY_C_BATTERY_CHARGING "Charging (%i%%)"
- #define S_BAT_TRAY_C_BATTERY_DISCHARGING "Discharging (%i%%)"
+ #define S_BAT_TRAY_C_BATTERY_CHARGING
+ #define S_BAT_TRAY_C_BATTERY_DISCHARGING
#define S_BAT_TRAY_C_BATTERY_UNKNOWN "Unknown status"
////////////////////////////////////////////////////////////////
- #endif /* ifdef LANG_FR */
-#endif /* ifdef STRINGS_H */ \ No newline at end of file
+ #endif
+#endif
+*/ \ No newline at end of file
diff --git a/tray.c b/tray.c
index 4616428..83ada19 100644
--- a/tray.c
+++ b/tray.c
@@ -16,7 +16,6 @@
* <http://www.gnu.org/licenses/>. *
************************************************************************/
-#include "strings.h"
#include "tray.h"
#include "widget_manager.h"
#include "freq_tray/getfreq.h"
@@ -30,6 +29,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libintl.h>
GtkStatusIcon* tray;
#define TOOLTIP_TEXT_SIZE 500
@@ -180,13 +180,13 @@ static gboolean update_tooltip(GtkStatusIcon* status_icon,gint x,gint y,gboolean
}
gg_current(0, current_governer, 20);
- sprintf(msg+strlen(msg), S_TRAY_C_GOVERNOR, current_governer);
+ sprintf(msg+strlen(msg), _("Governor: %s\n"), current_governer);
for(i = 0; i < gc_number(); ++i)
{
memset(label, 0, 20);
gf_get_frequency_label(gf_current(i), label);
- sprintf(msg+strlen(msg), S_TRAY_C_CPU, i, label, i == gc_number()-1 ? "" : "\n");
+ sprintf(msg+strlen(msg), _("CPU%i: %s%s"), i, label, i == gc_number()-1 ? "" : "\n");
}
tray_set_tooltip(msg);
diff --git a/trayfreq b/trayfreq
index ccb1774..d90b4ea 100755
--- a/trayfreq
+++ b/trayfreq
Binary files differ
diff --git a/trayfreq-set b/trayfreq-set
index af80a4b..db5c08a 100755
--- a/trayfreq-set
+++ b/trayfreq-set
Binary files differ
diff --git a/trayfreq.c b/trayfreq.c
index f7b09a9..5d28add 100644
--- a/trayfreq.c
+++ b/trayfreq.c
@@ -31,6 +31,7 @@
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
+#include <libintl.h>
static gboolean SHOW_BATTERY = TRUE;
@@ -62,7 +63,7 @@ void config_init()
if(!success)
{
- g_warning(S_TRAYFREQ_C_CONFIG_FILE_ERROR);
+ g_warning(_("Failed to open config files!\n"));
return;
}
@@ -105,7 +106,7 @@ int main(int argc, char** argv)
if(!gtk_init_check(&argc, &argv))
{
- g_error(S_TRAYFREQ_C_GTK_ERROR);
+ g_error(_("GTK Error: gtk_init_check returned FALSE.\nBailing.") );
return 1;
}
diff --git a/trayfreq_set/trayfreq_set.c b/trayfreq_set/trayfreq_set.c
index 9318403..ac22a8b 100644
--- a/trayfreq_set/trayfreq_set.c
+++ b/trayfreq_set/trayfreq_set.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libintl.h>
#include "../strings.h"
#include "../freq_tray/getfreq.h"
@@ -37,7 +38,7 @@ void prepare_path(const char* file, const char* core)
void file_open_error()
{
- printf(S_TRAYFREQ_SET_C_FILE_OPEN_ERROR, file_path);
+ printf( _("FAILED: Couldn't open %s for writing\n") , file_path);
}
void set_freq_max(const char* freq, const char* core)
@@ -109,43 +110,43 @@ int main(int argc, char *argv[])
if(!argv[1])
{
- printf(S_TRAYFREQ_SET_C_NO_ARGS);
+ printf( _("Use -g to set the governor or -f to set the frequency\n") );
} else if(strcmp(argv[1], "-g") == 0) {
if(!argv[2])
- printf(S_TRAYFREQ_SET_C_SET_GOVERNOR_ARG);
+ printf( _("Pass the governor with -g\n") );
else
{
if(!argv[3])
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
else if(strcmp(argv[3], "-c") == 0)
{
if(!argv[4])
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
else
set_gov(argv[2], argv[4]);
} else
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
}
} else if(strcmp(argv[1], "-f") == 0) {
if(!argv[2])
{
- printf(S_TRAYFREQ_SET_C_SET_FREQUENCY_ARG);
+ printf( _("Pass the frequency with -f\n") );
} else {
if(!argv[3])
{
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
} else if(strcmp(argv[3], "-c") == 0)
{
if(!argv[4])
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
else
set_freq(argv[2], argv[4]);
} else {
- printf(S_TRAYFREQ_SET_C_SET_CORE_ARG);
+ printf( _("Pass the core with -c\n") );
}
}
} else {
- printf(S_TRAYFREQ_SET_C_NO_ARGS);
+ printf( _("Use -g to set the governor or -f to set the frequency\n") );
}
return 0;
} \ No newline at end of file