[pan2] switched charset preferences from global/local to local/global override
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] switched charset preferences from global/local to local/global override
- Date: Sat, 17 Dec 2011 15:30:24 +0000 (UTC)
commit 6c94923637795e38a28b956e76c9762779c1fc49
Author: Heinrich MÃller <henmull src gnome org>
Date: Sat Dec 17 14:37:50 2011 +0100
switched charset preferences from global/local to local/global override
pan/gui/group-prefs-dialog.cc | 45 ++++++++++++++++++++++++----------------
pan/gui/gui.cc | 8 +++---
pan/gui/post-ui.cc | 3 ++
3 files changed, 34 insertions(+), 22 deletions(-)
---
diff --git a/pan/gui/group-prefs-dialog.cc b/pan/gui/group-prefs-dialog.cc
index 926082c..ee47e02 100644
--- a/pan/gui/group-prefs-dialog.cc
+++ b/pan/gui/group-prefs-dialog.cc
@@ -59,26 +59,28 @@ namespace
langs->langs = g_list_insert_sorted(langs->langs, g_strdup(lang_tag), (GCompareFunc) strcmp);
}
+#ifdef HAVE_GTKSPELL
static EnchantBroker *broker = NULL;
static GList *langs = NULL;
- static GtkSpell * spell = NULL;
static GtkTextView* view = NULL;
Langs l;
-
+#endif
void init_spell()
{
+#ifdef HAVE_GTKSPELL
view = GTK_TEXT_VIEW(gtk_text_view_new());
- spell = gtkspell_get_from_text_view (view);
broker = enchant_broker_init();
l.langs = langs;
enchant_broker_list_dicts(broker, dict_describe_cb, &l);
+#endif
}
void deinit_spell()
{
+#ifdef HAVE_GTKSPELL
if (view) g_object_ref_sink(view);
- if (spell) gtkspell_detach (spell);
if (broker) enchant_broker_free(broker);
+#endif
}
void delete_dialog (gpointer castme)
@@ -107,6 +109,7 @@ GroupPrefsDialog :: save_from_gui ()
_group_prefs.set_string (_group, "default-group-save-path", pch);
// spellchecker language
+#ifdef HAVE_GTKSPELL
GtkTreeIter iter;
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX(_spellchecker_language), &iter))
return;
@@ -117,6 +120,8 @@ GroupPrefsDialog :: save_from_gui ()
if (name) _group_prefs.set_string (_group, "spellcheck-language", name);
g_free(name);
+#endif
+
}
void
@@ -167,11 +172,12 @@ namespace
create_spellcheck_combo_box ( const Quark & group,
const GroupPrefs & group_prefs)
{
+ GtkWidget * w;
+#ifdef HAVE_GTKSPELL
init_spell();
deinit_spell();
- GtkWidget * w;
GtkTreeModel *model;
GtkListStore * store = gtk_list_store_new (1, G_TYPE_STRING);
GtkTreeIter iter, storeit;
@@ -193,6 +199,7 @@ namespace
}
model = GTK_TREE_MODEL(store);
w = gtk_combo_box_new_with_model (model);
+ g_object_unref(store);
GtkCellRenderer * renderer (gtk_cell_renderer_text_new ());
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, TRUE);
@@ -201,7 +208,7 @@ namespace
if (valid) gtk_combo_box_set_active_iter (GTK_COMBO_BOX(w), &storeit);
if (l.langs) g_list_free(l.langs);
-
+#endif
return w;
}
@@ -231,31 +238,33 @@ GroupPrefsDialog :: GroupPrefsDialog (Data & data,
char buf[512];
g_snprintf (buf, sizeof(buf), _("Properties for %s"), group.c_str());
HIG::workarea_add_section_title (t, &row, buf);
- HIG :: workarea_add_section_spacer (t, row, 3);
- _charset = w = e_charset_combo_box_new( );
- e_charset_combo_box_set_charset( E_CHARSET_COMBO_BOX(_charset),
- _group_prefs.get_string (group, "character-encoding", "UTF-8").c_str());
+ HIG :: workarea_add_section_spacer (t, row, 4);
+ GtkWidget* box = _charset = e_charset_combo_box_new( );
+ e_charset_combo_box_set_charset(
+ E_CHARSET_COMBO_BOX(box),
+ _group_prefs.get_string (group, "character-encoding", "UTF-8").c_str());
- HIG :: workarea_add_row (t, &row, _("Character _encoding:"), w);
- gtk_widget_set_sensitive (w, gtk_widget_get_sensitive(w));
+ HIG :: workarea_add_row (t, &row, _("Character _encoding:"), _charset);
w = _save_path = file_entry_new (_("Directory for Saving Attachments"));
char * pch = g_build_filename (g_get_home_dir(), "News", NULL);
const std::string dir (_group_prefs.get_string (_group, "default-group-save-path", pch));
g_free (pch);
file_entry_set (w, dir.c_str());
+
HIG :: workarea_add_row (t, &row, _("Directory for _saving attachments:"), w);
- gtk_widget_set_sensitive (w, gtk_widget_get_sensitive(w));
w = _profile = create_profiles_combo_box (data, group, group_prefs);
l = HIG :: workarea_add_row (t, &row, _("Posting _profile:"), w);
- gtk_widget_set_sensitive (w, gtk_widget_get_sensitive(w));
-
+ gtk_widget_set_sensitive (l, gtk_widget_get_sensitive(w));
+#ifdef HAVE_GTKSPELL
w = _spellchecker_language = create_spellcheck_combo_box ( group, group_prefs);
- l = HIG :: workarea_add_row (t, &row, _("Spellchecker _language:"), w);
- gtk_widget_set_sensitive (w, gtk_widget_get_sensitive(w));
- gtk_box_pack_start ( GTK_BOX( gtk_dialog_get_content_area( GTK_DIALOG( dialog))), t, true, true, 0);
+ HIG :: workarea_add_row (t, &row, _("Spellchecker _language:"), w);
+#endif
+
gtk_widget_show_all (t);
+ gtk_box_pack_start ( GTK_BOX( gtk_dialog_get_content_area( GTK_DIALOG( dialog))), t, true, true, 0);
_root = dialog;
+
}
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 5789aa5..c02ed0b 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1620,11 +1620,11 @@ void GUI :: do_read_selected_group ()
// set the charset encoding based upon that group's / global default
if (!group.empty())
{
- std::string global_locale(_prefs.get_string("default-charset", ""));
- if (global_locale.empty())
- set_charset (_group_prefs.get_string (group, "character-encoding", "UTF-8"));
+ std::string local (_group_prefs.get_string (group, "character-encoding", ""));
+ if (local.empty())
+ set_charset (_prefs.get_string("default-charset", "UTF-8"));
else
- set_charset (global_locale);
+ set_charset (local);
}
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 6810e6e..366e927 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -1572,6 +1572,9 @@ namespace {
void
PostUI :: set_message (GMimeMessage * message)
{
+
+ if (!message) return;
+
// update our message header
if (message)
g_object_ref (G_OBJECT(message));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]