# HG changeset patch # User Herman Bloggs # Date 1052841104 0 # Node ID fa63b4c784b930cf64b9e23568401a5ec5865872 # Parent 379beab3d157c62f1b4c57402c1155b21bfebe6d [gaim-migrate @ 5741] Localization fixed for systray menu items committer: Tailor Script diff -r 379beab3d157 -r fa63b4c784b9 src/win32/systray.c --- a/src/win32/systray.c Tue May 13 08:36:36 2003 +0000 +++ b/src/win32/systray.c Tue May 13 15:51:44 2003 +0000 @@ -57,6 +57,10 @@ static SYSTRAY_STATE st_state=SYSTRAY_STATE_OFFLINE; static HMENU systray_menu=0; static HMENU systray_away_menu=0; +/* UTF-8 to locale conversion */ +gchar *locenc=NULL; +static gsize bread=0; +static gsize bwrite=0; /* * GLOBALS @@ -96,12 +100,16 @@ systray_away_menu = CreatePopupMenu(); while (awy && (item_count <= SYSTRAY_CMND_SET_AWY+MAX_AWY_MESSAGES)) { a = (struct away_message *)awy->data; - AppendMenu(systray_away_menu, MF_STRING, item_count, a->name); + locenc = g_locale_from_utf8(a->name, -1, &bread, &bwrite, NULL); + AppendMenu(systray_away_menu, MF_STRING, item_count, locenc); + g_free(locenc); awy = g_slist_next(awy); item_count+=1; } AppendMenu(systray_away_menu, MF_SEPARATOR, 0, 0); - AppendMenu(systray_away_menu, MF_STRING, SYSTRAY_CMND_SET_AWY_NEW, _("New")); + locenc = g_locale_from_utf8(_("New"), -1, &bread, &bwrite, NULL); + AppendMenu(systray_away_menu, MF_STRING, SYSTRAY_CMND_SET_AWY_NEW, locenc); + g_free(locenc); return systray_away_menu; } @@ -115,24 +123,30 @@ /* If signoff item dosn't exist.. create it */ if(!IsMenuItem(systray_menu, SYSTRAY_CMND_SIGNOFF)) { DeleteMenu(systray_menu, SYSTRAY_CMND_SIGNON, MF_BYCOMMAND); + locenc = g_locale_from_utf8(_("Signoff"), -1, &bread, &bwrite, NULL); InsertMenu(systray_menu, SYSTRAY_CMND_MENU_EXIT, - MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNOFF, _("Signoff")); + MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNOFF, locenc); + g_free(locenc); } /* if away menu exists, remove and rebuild it */ if(systray_away_menu) { if(!DeleteMenu(systray_menu, (UINT)systray_away_menu, MF_BYCOMMAND)) debug_printf("Error using DeleteMenu\n"); } + locenc = g_locale_from_utf8(_("Set Away Message"), -1, &bread, &bwrite, NULL); InsertMenu(systray_menu, SYSTRAY_CMND_PREFS, MF_BYCOMMAND | MF_POPUP | MF_STRING, (UINT)systray_create_awy_menu(), - _("Set Away Message")); + locenc); + g_free(locenc); EnableMenuItem(systray_menu, SYSTRAY_CMND_AUTOLOGIN, MF_GRAYED); /* If away, put "I'm Back" option in menu */ if(st_state == SYSTRAY_STATE_AWAY) { if(!IsMenuItem(systray_menu, SYSTRAY_CMND_BACK)) { + locenc = g_locale_from_utf8(_("I'm Back"), -1, &bread, &bwrite, NULL); InsertMenu(systray_menu, (UINT)systray_away_menu, MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_BACK, - _("I'm Back")); + locenc); + g_free(locenc); } } else { /* Delete I'm Back item if it exists */ @@ -142,8 +156,10 @@ /* If signon item dosn't exist.. create it */ if(!IsMenuItem(systray_menu, SYSTRAY_CMND_SIGNON)) { DeleteMenu(systray_menu, SYSTRAY_CMND_SIGNOFF, MF_BYCOMMAND); + locenc = g_locale_from_utf8(_("Sign On"), -1, &bread, &bwrite, NULL); InsertMenu(systray_menu, SYSTRAY_CMND_MENU_EXIT, - MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNON, _("Sign On")); + MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNON, locenc); + g_free(locenc); } EnableMenuItem(systray_menu, SYSTRAY_CMND_AUTOLOGIN, MF_ENABLED); EnableMenuItem(systray_menu, (UINT)systray_away_menu, MF_GRAYED); @@ -291,14 +307,21 @@ static void systray_create_menu(void) { /* create popup menu */ if((systray_menu = CreatePopupMenu())) { - if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_PREFS, _("Preferences"))) + if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_PREFS, + (locenc=g_locale_from_utf8(_("Preferences"), -1, &bread, &bwrite, NULL)))) debug_printf("AppendMenu error: %ld\n", GetLastError()); - if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_AUTOLOGIN, _("Auto-login"))) + g_free(locenc); + if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_AUTOLOGIN, + (locenc=g_locale_from_utf8(_("Auto-login"), -1, &bread, &bwrite, NULL)))) debug_printf("AppendMenu error: %ld\n", GetLastError()); + g_free(locenc); if(!AppendMenu(systray_menu, MF_SEPARATOR, 0, 0)) debug_printf("AppendMenu error: %ld\n", GetLastError()); - if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_MENU_EXIT, _("Exit"))) + g_free(locenc); + if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_MENU_EXIT, + (locenc=g_locale_from_utf8(_("Exit"), -1, &bread, &bwrite, NULL)))) debug_printf("AppendMenu error: %ld\n", GetLastError()); + g_free(locenc); } else debug_printf("CreatePopupMenu error: %ld\n", GetLastError()); } @@ -311,14 +334,17 @@ wgaim_nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP; wgaim_nid.uCallbackMessage=WM_TRAYMESSAGE; wgaim_nid.hIcon=icon; - strcpy(wgaim_nid.szTip,GAIM_SYSTRAY_DISCONN_HINT); - + locenc=g_locale_from_utf8(GAIM_SYSTRAY_DISCONN_HINT, -1, &bread, &bwrite, NULL); + strcpy(wgaim_nid.szTip, locenc); + g_free(locenc); Shell_NotifyIcon(NIM_ADD,&wgaim_nid); } static void systray_change_icon(HICON icon, char* text) { wgaim_nid.hIcon = icon; - lstrcpy(wgaim_nid.szTip, text); + locenc = g_locale_from_utf8(text, -1, &bread, &bwrite, NULL); + lstrcpy(wgaim_nid.szTip, locenc); + g_free(locenc); Shell_NotifyIcon(NIM_MODIFY,&wgaim_nid); }