=== modified file 'glade/favoritehubs.glade' --- glade/favoritehubs.glade 2008-11-30 02:21:44 +0000 +++ glade/favoritehubs.glade 2008-12-14 18:49:28 +0000 @@ -88,266 +88,302 @@ Favorite Hubs Properties - False True GDK_WINDOW_TYPE_HINT_DIALOG True - + True - 8 - 8 + 12 + 12 + 12 + 12 - + True - 0 - - - True - 8 - 4 - 2 - 2 - - - True - - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK - - - - - 1 - 2 - 3 - 4 - - - - - 200 - True - True - True - * - - - 1 - 2 - 2 - 3 - - - - - - 200 - True - True - True - * - - - 1 - 2 - 1 - 2 - - - - - - 200 - True - True - True - * - - - 1 - 2 - - - - - - True - 1 - Description - - - 2 - 3 - GTK_FILL - - - - - - True - 1 - Address - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - Name - - - GTK_FILL - - - - - - True - Encoding - - - 3 - 4 - - - + 10 + 3 + 12 + 6 + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + * + True + + + 2 + 3 + 9 + 10 + + + + + + True + 0 + Description: + + + 1 + 2 + 9 + 10 + GTK_FILL + + + + + True + True + False + * + True + + + 2 + 3 + 8 + 9 + + + + + + True + True + * + True + + + 2 + 3 + 7 + 8 + + + + + + True + 0 + Password: + + + 1 + 2 + 8 + 9 + GTK_FILL + + + + + True + 0 + Nick: + + + 1 + 2 + 7 + 8 + GTK_FILL + + + + + True + 0 + <b>Identification (leave blank for defaults)</b> + True + + + 3 + 6 + 7 + + + + + True + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + True + + + + + 2 + 3 + 5 + 6 + + + + + True + 0 + Encoding: + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + True + True + Override default encoding + 0 + True + + + 1 + 3 + 4 + 5 + + + + + True + True + * + True + + + 2 + 3 + 3 + 4 + + + + + + True + 0 + Description: + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + True + * + True + + + 2 + 3 + 2 + 3 + + + + + + True + 0 + Address: + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + * + True + + + 2 + 3 + 1 + 2 + + + + + + True + 0 + Name: + + + 1 + 2 + 1 + 2 + GTK_FILL + True + 0 <b>Hub</b> True - label_item - - - - - - - True - 0 - - - True - 8 - 3 - 2 - 2 - - - True - True - True - * - - - 1 - 2 - 2 - 3 - - - - - - True - True - True - False - * - - - 1 - 2 - 1 - 2 - - - - - - True - True - True - * - - - 1 - 2 - - - - - - True - 1 - Description - - - 2 - 3 - GTK_FILL - - - - - - True - 1 - Password - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - Nick - - - GTK_FILL - - - - - - - - True - <b>Identification (leave blank for defaults)</b> - True - - - label_item - - - - - 1 - + 3 + + + + False 2 === modified file 'linux/WulforUtil.cc' --- linux/WulforUtil.cc 2008-12-13 01:26:16 +0000 +++ linux/WulforUtil.cc 2008-12-14 18:55:37 +0000 @@ -31,8 +31,8 @@ using namespace std; -const string WulforUtil::ENCODING_SYSTEM_DEFAULT = _("System default"); -const string WulforUtil::ENCODING_GLOBAL_HUB_DEFAULT = _("Global hub default"); +const string WulforUtil::ENCODING_LOCALE = N_("System default"); +const string WulforUtil::ENCODING_DEFAULT = N_("Default"); std::vector WulforUtil::charsets; const std::string WulforUtil::magnetSignature = "magnet:?xt=urn:tree:tiger:"; @@ -160,23 +160,23 @@ { if (charsets.size() == 0) { - charsets.push_back(_("System default")); - charsets.push_back(_("UTF-8 (Unicode)")); - charsets.push_back(_("CP1252 (Western Europe)")); - charsets.push_back(_("CP1250 (Central Europe)")); - charsets.push_back(_("ISO-8859-2 (Central Europe)")); - charsets.push_back(_("ISO-8859-7 (Greek)")); - charsets.push_back(_("ISO-8859-8 (Hebrew)")); - charsets.push_back(_("ISO-8859-9 (Turkish)")); - charsets.push_back(_("ISO-2022-JP (Japanese)")); - charsets.push_back(_("SJIS (Japanese)")); - charsets.push_back(_("CP949 (Korean)")); - charsets.push_back(_("KOI8-R (Cyrillic)")); - charsets.push_back(_("CP1251 (Cyrillic)")); - charsets.push_back(_("CP1256 (Arabic)")); - charsets.push_back(_("CP1257 (Baltic)")); - charsets.push_back(_("GB18030 (Chinese)")); - charsets.push_back(_("TIS-620 (Thai)")); + charsets.push_back(ENCODING_LOCALE); + charsets.push_back(N_("CP949 (Korean)")); + charsets.push_back(N_("CP1250 (Central Europe)")); + charsets.push_back(N_("CP1251 (Cyrillic)")); + charsets.push_back(N_("CP1252 (Western Europe)")); + charsets.push_back(N_("CP1256 (Arabic)")); + charsets.push_back(N_("CP1257 (Baltic)")); + charsets.push_back(N_("GB18030 (Chinese)")); + charsets.push_back(N_("ISO-2022-JP (Japanese)")); + charsets.push_back(N_("ISO-8859-2 (Central Europe)")); + charsets.push_back(N_("ISO-8859-7 (Greek)")); + charsets.push_back(N_("ISO-8859-8 (Hebrew)")); + charsets.push_back(N_("ISO-8859-9 (Turkish)")); + charsets.push_back(N_("KOI8-R (Cyrillic)")); + charsets.push_back(N_("SJIS (Japanese)")); + charsets.push_back(N_("TIS-620 (Thai)")); + charsets.push_back(N_("UTF-8 (Unicode)")); } return charsets; } === modified file 'linux/WulforUtil.hh' --- linux/WulforUtil.hh 2008-12-04 05:49:15 +0000 +++ linux/WulforUtil.hh 2008-12-14 18:47:18 +0000 @@ -55,8 +55,8 @@ // Profile locking static bool profileIsLocked(); - static const std::string ENCODING_SYSTEM_DEFAULT; - static const std::string ENCODING_GLOBAL_HUB_DEFAULT; + static const std::string ENCODING_LOCALE; + static const std::string ENCODING_DEFAULT; private: static std::vector charsets; === modified file 'linux/favoritehubs.cc' --- linux/favoritehubs.cc 2008-12-04 05:49:15 +0000 +++ linux/favoritehubs.cc 2008-12-14 18:47:18 +0000 @@ -34,7 +34,6 @@ gtk_dialog_set_alternative_button_order(GTK_DIALOG(getWidget("favoriteHubsDialog")), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); // Fill the charset drop-down list in edit fav hub dialog. - gtk_combo_box_append_text(GTK_COMBO_BOX(getWidget("comboboxCharset")), WulforUtil::ENCODING_GLOBAL_HUB_DEFAULT.c_str()); vector &charsets = WulforUtil::getCharsets(); for (vector::const_iterator it = charsets.begin(); it != charsets.end(); ++it) gtk_combo_box_append_text(GTK_COMBO_BOX(getWidget("comboboxCharset")), it->c_str()); @@ -78,6 +77,7 @@ g_signal_connect(favoriteView.get(), "button-press-event", G_CALLBACK(onButtonPressed_gui), (gpointer)this); g_signal_connect(favoriteView.get(), "button-release-event", G_CALLBACK(onButtonReleased_gui), (gpointer)this); g_signal_connect(favoriteView.get(), "key-release-event", G_CALLBACK(onKeyReleased_gui), (gpointer)this); + g_signal_connect(getWidget("checkbuttonOverride"), "toggled", G_CALLBACK(onOverrideToggled_gui), (gpointer)this); } FavoriteHubs::~FavoriteHubs() @@ -103,7 +103,7 @@ void FavoriteHubs::editEntry_gui(StringMap ¶ms, GtkTreeIter *iter) { - string encoding = params["Encoding"].empty() ? WulforUtil::ENCODING_GLOBAL_HUB_DEFAULT : params["Encoding"]; + string encoding = params["Encoding"].empty() ? WulforUtil::ENCODING_DEFAULT : params["Encoding"]; gtk_list_store_set(favoriteStore, iter, favoriteView.col("Auto Connect"), Util::toInt(params["Auto Connect"]), @@ -135,6 +135,27 @@ } } +void FavoriteHubs::saveParams(StringMap ¶ms) +{ + params["Name"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryName"))); + params["Address"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryAddress"))); + params["Description"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryDescription"))); + params["Nick"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryNick"))); + params["Hidden Password"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryPassword"))); + params["User Description"] = gtk_entry_get_text(GTK_ENTRY(this->getWidget("entryUDescription"))); + + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this->getWidget("checkbuttonOverride")))) + { + params["Encoding"] = WulforUtil::ENCODING_DEFAULT; + } + else + { + gchar *encoding = gtk_combo_box_get_active_text(GTK_COMBO_BOX(this->getWidget("comboboxCharset"))); + params["Encoding"] = string(encoding); + g_free(encoding); + } +} + void FavoriteHubs::showErrorDialog_gui(const string &description) { gtk_label_set_text(GTK_LABEL(getWidget("errorLabel")), description.c_str()); @@ -243,7 +264,7 @@ gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryNick")), ""); gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryPassword")), ""); gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryUDescription")), ""); - gtk_entry_set_text(GTK_ENTRY(fh->getWidget("comboboxentryCharset")), WulforUtil::ENCODING_GLOBAL_HUB_DEFAULT.c_str()); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fh->getWidget("checkbuttonOverride")), FALSE); int response = gtk_dialog_run(GTK_DIALOG(fh->getWidget("favoriteHubsDialog"))); gtk_widget_hide(fh->getWidget("favoriteHubsDialog")); @@ -251,16 +272,8 @@ if (response == GTK_RESPONSE_OK) { StringMap params; - params["Name"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryName"))); - params["Address"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryAddress"))); - params["Description"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryDescription"))); - params["Nick"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryNick"))); - params["Hidden Password"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryPassword"))); - params["User Description"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryUDescription"))); - gchar *encoding = gtk_combo_box_get_active_text(GTK_COMBO_BOX(fh->getWidget("comboboxCharset"))); - params["Encoding"] = string(encoding); - g_free(encoding); + fh->saveParams(params); if (params["Name"].empty() || params["Address"].empty()) { @@ -298,7 +311,10 @@ gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryNick")), params["Nick"].c_str()); gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryPassword")), params["Hidden Password"].c_str()); gtk_entry_set_text(GTK_ENTRY(fh->getWidget("entryUDescription")), params["User Description"].c_str()); - gtk_entry_set_text(GTK_ENTRY(fh->getWidget("comboboxentryCharset")), params["Encoding"].c_str()); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fh->getWidget("checkbuttonOverride")), params["Encoding"] != WulforUtil::ENCODING_DEFAULT); + onOverrideToggled_gui(GTK_TOGGLE_BUTTON(fh->getWidget("checkbuttonOverride")), fh); + if (params["Encoding"] != WulforUtil::ENCODING_DEFAULT) + gtk_entry_set_text(GTK_ENTRY(fh->getWidget("comboboxentryCharset")), params["Encoding"].c_str()); int response = gtk_dialog_run(GTK_DIALOG(fh->getWidget("favoriteHubsDialog"))); gtk_widget_hide(fh->getWidget("favoriteHubsDialog")); @@ -306,16 +322,7 @@ if (response == GTK_RESPONSE_OK) { params.clear(); - params["Name"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryName"))); - params["Address"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryAddress"))); - params["Description"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryDescription"))); - params["Nick"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryNick"))); - params["Hidden Password"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryPassword"))); - params["User Description"] = gtk_entry_get_text(GTK_ENTRY(fh->getWidget("entryUDescription"))); - - gchar *encoding = gtk_combo_box_get_active_text(GTK_COMBO_BOX(fh->getWidget("comboboxCharset"))); - params["Encoding"] = string(encoding); - g_free(encoding); + fh->saveParams(params); if (params["Name"].empty() || params["Address"].empty()) { @@ -360,6 +367,17 @@ } } +void FavoriteHubs::onOverrideToggled_gui(GtkToggleButton *button, gpointer data) +{ + FavoriteHubs *fh = (FavoriteHubs *)data; + bool override = gtk_toggle_button_get_active(button); + + gtk_widget_set_sensitive(fh->getWidget("comboboxCharset"), override); + gtk_widget_set_sensitive(fh->getWidget("labelCharset"), override); + + gtk_entry_set_text(GTK_ENTRY(fh->getWidget("comboboxentryCharset")), WGETS("default-charset").c_str()); +} + void FavoriteHubs::onConnect_gui(GtkButton *widget, gpointer data) { FavoriteHubs *fh = (FavoriteHubs *)data; === modified file 'linux/favoritehubs.hh' --- linux/favoritehubs.hh 2008-07-03 03:53:56 +0000 +++ linux/favoritehubs.hh 2008-12-14 18:47:18 +0000 @@ -43,6 +43,7 @@ void addEntry_gui(StringMap params); void editEntry_gui(StringMap ¶ms, GtkTreeIter *iter); void removeEntry_gui(std::string address); + void saveParams(StringMap ¶ms); void showErrorDialog_gui(const std::string &description); void popupMenu_gui(); @@ -53,6 +54,7 @@ static void onAddEntry_gui(GtkWidget *widget, gpointer data); static void onEditEntry_gui(GtkWidget *widget, gpointer data); static void onRemoveEntry_gui(GtkWidget *widget, gpointer data); + static void onOverrideToggled_gui(GtkToggleButton *button, gpointer data); static void onConnect_gui(GtkButton *widget, gpointer data); static void onToggledClicked_gui(GtkCellRendererToggle *cell, gchar *path, gpointer data); === modified file 'linux/hub.cc' --- linux/hub.cc 2008-12-04 05:49:15 +0000 +++ linux/hub.cc 2008-12-14 18:47:18 +0000 @@ -1174,10 +1174,10 @@ if (address.substr(0, 6) == "adc://" || address.substr(0, 7) == "adcs://") encoding = "UTF-8"; - else if (encoding.empty() || encoding == WulforUtil::ENCODING_GLOBAL_HUB_DEFAULT) + else if (encoding.empty() || encoding == WulforUtil::ENCODING_DEFAULT) encoding = WGETS("default-charset"); - if (encoding == WulforUtil::ENCODING_SYSTEM_DEFAULT) + if (encoding == WulforUtil::ENCODING_LOCALE) encoding = Text::getSystemCharset(); // Only pick "UTF-8" part of "UTF-8 (Unicode)".