diff --git a/ChangeLog b/ChangeLog index 8e72952..f426313 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2005-04-06 mallum,,, + + * applets/mb-applet-battery.c: (button_callback): + Show Hours + Min rather than just mins + * applets/mb-applet-clock.c: (paint_callback): + Provent potential overflow + * applets/mb-applet-menu-launcher.c: (build_menu): + Use MAXPATHLEN + * po/cs.po: + * po/de.po: + * po/en_GB.po: + * po/es_ES.po: + * po/fi_FI.po: + * po/fr_FR.po: + * po/zh_TW.po: + Update for battery time output + * src/panel.c: (panel_set_bg): + * src/panel_menu.c: (panel_menu_init): + Overflow fixes. + + Via patches from Philippe De Swert + and Andreas Gunnarsson. + 2005-04-05 mallum,,, * applets/mb-applet-wireless.c: (update_wireless), diff --git a/applets/mb-applet-battery.c b/applets/mb-applet-battery.c index bcfd370..58ef959 100644 --- a/applets/mb-applet-battery.c +++ b/applets/mb-applet-battery.c @@ -394,7 +394,7 @@ button_callback (MBTrayApp *app, int x, int y, Bool is_released ) if (apm_vals[TIME_LEFT] > 0 ) { sprintf(tray_msg, - _("Battery Power\nJuice %.2i %%\nTime left: %.2i mins\n"), apm_vals[PERCENTAGE], apm_vals[TIME_LEFT]); + _("Battery Power\nJuice %.2i %%\nTime left: %.2i h. %.2i min.\n"), apm_vals[PERCENTAGE], (apm_vals[TIME_LEFT]/60), (apm_vals[TIME_LEFT]%60)); } else { diff --git a/applets/mb-applet-clock.c b/applets/mb-applet-clock.c index 5204247..5ee83fa 100644 --- a/applets/mb-applet-clock.c +++ b/applets/mb-applet-clock.c @@ -134,7 +134,7 @@ paint_callback ( MBTrayApp *app, Drawable pxm ) struct timezone tz; struct tm *localTime = NULL; time_t actualTime; - char timestr[5] = { 0 }; + char timestr[6] = { 0 }; MBPixbufImage *img_bg = NULL; MBDrawable *drw; @@ -143,7 +143,8 @@ paint_callback ( MBTrayApp *app, Drawable pxm ) actualTime = tv.tv_sec; localTime = localtime(&actualTime); - sprintf(timestr, _("%.2d:%.2d"), localTime->tm_hour, localTime->tm_min); + snprintf(timestr, sizeof(timestr), _("%.2d:%.2d"), + localTime->tm_hour, localTime->tm_min); img_bg = mb_tray_app_get_background (app, Pixbuf); diff --git a/applets/mb-applet-menu-launcher.c b/applets/mb-applet-menu-launcher.c index e01d9d2..45dd483 100644 --- a/applets/mb-applet-menu-launcher.c +++ b/applets/mb-applet-menu-launcher.c @@ -381,7 +381,12 @@ build_menu(void) DIR *dp; struct dirent *dir_entry; struct stat stat_info; - char orig_wd[256]; + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + + char orig_wd[MAXPATHLEN]; char dirs[2][256] = { MENUDIR }; FILE *fp; @@ -464,7 +469,7 @@ build_menu(void) if (tmp_path) free(tmp_path); if (tmp_path2) free(tmp_path2); - if (getcwd(orig_wd, 255) == (char *)NULL) + if (getcwd(orig_wd, MAXPATHLEN) == (char *)NULL) { fprintf(stderr, "mb-applet-menu-launcher: cant get current directory\n"); exit(0); diff --git a/po/cs.po b/po/cs.po index 021b03b..7fea377 100644 --- a/po/cs.po +++ b/po/cs.po @@ -104,11 +104,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "Napájeno z baterie\n" "NapÄ›tí %.2i %%\n" -"Zbývá: %.2i minut\n" +"Zbývá: %.2i h. %.2i minut\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/de.po b/po/de.po index 01398c2..701f89f 100644 --- a/po/de.po +++ b/po/de.po @@ -105,11 +105,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "Batteriestand\n" "Füllung %.2i %%\n" -"Verbleibend: %.2i min\n" +"Verbleibend: %2i u.%.2i min\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/en_GB.po b/po/en_GB.po index 0f57b0f..a3923ee 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -106,11 +106,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/es_ES.po b/po/es_ES.po index 2bf6c4b..ddeefe0 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -106,11 +106,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "Batería\n" "Jugo %.2i %%\n" -"Tiempo restante: %.2i mins\n" +"Tiempo restante: %.2i h. %.2i min.\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/fi_FI.po b/po/fi_FI.po index 568ebe8..0e8f393 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -106,11 +106,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "Akkuteho\n" "Virtaa %.2i %%\n" -"Käyttöaikaa jäljellä: %.2i min.\n" +"Käyttöaikaa jäljellä: %.2i h. %.2i min.\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/fr_FR.po b/po/fr_FR.po index d950026..5c1c6f8 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -105,10 +105,10 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "BatterieJauge %.2i %%\n" -"Temps restant: %.2i mn\n" +"Temps restant: %.2i h. %.2i mn\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/po/zh_TW.po b/po/zh_TW.po index de16b41..2790a29 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -105,11 +105,11 @@ msgstr "" msgid "" "Battery Power\n" "Juice %.2i %%\n" -"Time left: %.2i mins\n" +"Time left: %.2i h. %.2i min.\n" msgstr "" "¹q¦À¨Ñ¹q\n" "¯à¶q %.2i %%\n" -"³Ñ¾l®É¶¡: %.2i ¤À\n" +"³Ñ¾l®É¶¡: %.2i h.%.2i ¤À\n" #: ../applets/mb-applet-battery.c:392 #, c-format diff --git a/src/panel.c b/src/panel.c index a01c547..0116b88 100644 --- a/src/panel.c +++ b/src/panel.c @@ -274,7 +274,7 @@ panel_set_bg(MBPanel *panel, int bg_type, char *bg_spec) case BG_PIXMAP: if (bg_spec[0] != '/' && panel->theme_path != NULL) { - tmp_path = alloca( sizeof(char) * (strlen(panel->theme_path) + strlen(bg_spec))); + tmp_path = alloca( sizeof(char) * (strlen(panel->theme_path) + strlen(bg_spec) + 2)); sprintf(tmp_path, "%s/%s", panel->theme_path, bg_spec); } else tmp_path = bg_spec; diff --git a/src/panel_menu.c b/src/panel_menu.c index 51641d6..a302c3f 100644 --- a/src/panel_menu.c +++ b/src/panel_menu.c @@ -144,8 +144,12 @@ panel_menu_update_remove_items(MBPanel *panel) void panel_menu_init(MBPanel *panel) { +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + MBMenuMenu *m, *menu_launchers; - char orig_wd[256] = { 0 }; + char orig_wd[MAXPATHLEN] = { 0 }; struct dirent *dir_entry; char *icon_path = NULL; DIR *dp; @@ -173,7 +177,7 @@ panel_menu_init(MBPanel *panel) if (icon_path) free(icon_path); - if (getcwd(orig_wd, 255) == (char *)NULL) + if (getcwd(orig_wd, MAXPATHLEN) == (char *)NULL) { printf("Cant get current directory\n"); exit(0);