[pan2/testing: 196/279] fixed multiple selection for GroupPrefsDialog (now the changes take effect on the whole selection)
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 196/279] fixed multiple selection for GroupPrefsDialog (now the changes take effect on the whole selection)
- Date: Sat, 3 Dec 2011 22:38:13 +0000 (UTC)
commit ddf1a1e51582c32aeca3ebcdb49ec7ac6b5d53ac
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Thu Sep 1 06:59:32 2011 +0200
fixed multiple selection for GroupPrefsDialog
(now the changes take effect on the whole selection)
pan/gui/group-prefs-dialog.cc | 44 +++++++++++++++++++++++++++--------------
pan/gui/group-prefs-dialog.h | 12 +++++-----
pan/gui/gui.cc | 7 +++--
3 files changed, 39 insertions(+), 24 deletions(-)
---
diff --git a/pan/gui/group-prefs-dialog.cc b/pan/gui/group-prefs-dialog.cc
index be50369..10869e6 100644
--- a/pan/gui/group-prefs-dialog.cc
+++ b/pan/gui/group-prefs-dialog.cc
@@ -41,25 +41,28 @@ namespace
delete static_cast<GroupPrefsDialog*>(castme);
}
}
-
+
void
GroupPrefsDialog :: save_from_gui ()
{
// charset...
const char * tmp = e_charset_combo_box_get_charset (E_CHARSET_COMBO_BOX(_charset));
- _group_prefs.set_string (_group, "character-encoding", tmp);
+ foreach_const (quarks_v, _groups, it)
+ _group_prefs.set_string (*it, "character-encoding", tmp);
// posting profile...
std::string profile;
if (gtk_widget_get_sensitive (_profile)) {
char * pch (gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(_profile)));
- _group_prefs.set_string (_group, "posting-profile", pch);
+ foreach_const (quarks_v, _groups, it)
+ _group_prefs.set_string (*it, "posting-profile", pch);
g_free (pch);
}
// save path...
const char * pch (file_entry_get (_save_path));
- _group_prefs.set_string (_group, "default-group-save-path", pch);
+ foreach_const (quarks_v, _groups, it)
+ _group_prefs.set_string (*it, "default-group-save-path", pch);
}
void
@@ -75,7 +78,7 @@ namespace
{
GtkWidget*
create_profiles_combo_box (const Data & data,
- const Quark & group,
+ const quarks_v & groups,
const GroupPrefs & group_prefs)
{
GtkWidget * w = gtk_combo_box_text_new ();
@@ -92,7 +95,7 @@ namespace
}
else
{
- const std::string s (group_prefs.get_string (group, "posting-profile", ""));
+ const std::string s (group_prefs.get_string (groups[0], "posting-profile", ""));
int i(0), sel_index (0);
foreach_const (unique_strings_t, profiles, it) {
if (*it == s)
@@ -107,13 +110,14 @@ namespace
}
}
-GroupPrefsDialog :: GroupPrefsDialog (Data & data,
- const Quark & group,
- GroupPrefs & group_prefs,
- GtkWindow * parent_window):
- _group (group),
+GroupPrefsDialog :: GroupPrefsDialog (Data & data,
+ const quarks_v & groups,
+ GroupPrefs & group_prefs,
+ GtkWindow * parent_window):
+ _groups (groups),
_group_prefs (group_prefs)
{
+
GtkWidget * dialog = gtk_dialog_new_with_buttons (_("Pan: Group Preferences"),
parent_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -127,21 +131,31 @@ GroupPrefsDialog :: GroupPrefsDialog (Data & data,
int row (0);
GtkWidget *t, *w, *l;
t = HIG :: workarea_create ();
+
char buf[512];
- g_snprintf (buf, sizeof(buf), _("Properties for %s"), group.c_str());
+ if (groups.size() > 1)
+ g_snprintf (buf, sizeof(buf), _("Properties for Groups"));
+ else
+ g_snprintf (buf, sizeof(buf), _("Properties for %s"), groups[0].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());
+ e_charset_combo_box_set_charset( E_CHARSET_COMBO_BOX(_charset), _group_prefs.get_string (groups[0], "character-encoding", "UTF-8").c_str());
HIG :: workarea_add_row (t, &row, _("Character _encoding:"), w);
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));
+ std::string dir;
+ if (groups.size() > 1)
+ dir = pch;
+ else
+ dir = _group_prefs.get_string (groups[0], "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);
- w = _profile = create_profiles_combo_box (data, group, group_prefs);
+ w = _profile = create_profiles_combo_box (data, groups, group_prefs);
l = HIG :: workarea_add_row (t, &row, _("Posting _profile:"), w);
+
gtk_widget_set_sensitive (l, gtk_widget_get_sensitive(w));
gtk_widget_show_all (t);
diff --git a/pan/gui/group-prefs-dialog.h b/pan/gui/group-prefs-dialog.h
index 3f5f9de..a685666 100644
--- a/pan/gui/group-prefs-dialog.h
+++ b/pan/gui/group-prefs-dialog.h
@@ -30,16 +30,16 @@ namespace pan
class GroupPrefsDialog
{
public:
- GroupPrefsDialog (Data & data,
- const Quark & group,
- GroupPrefs & group_prefs,
- GtkWindow * parent_window);
+ GroupPrefsDialog (Data & data,
+ const quarks_v & groups,
+ GroupPrefs & group_prefs,
+ GtkWindow * parent_window);
~GroupPrefsDialog () {}
GtkWidget * root() { return _root; }
private:
- const Quark _group;
+ const quarks_v _groups;
GroupPrefs & _group_prefs;
GtkWidget * _root;
GtkWidget * _charset;
@@ -50,5 +50,5 @@ namespace pan
static void response_cb (GtkDialog*, int, gpointer);
void save_from_gui ();
};
-}
+}
#endif
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 461beeb..40f2099 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -906,9 +906,10 @@ void GUI :: do_show_preferences_dialog ()
}
void GUI :: do_show_group_preferences_dialog ()
{
- const Quark group (_group_pane->get_first_selection ());
- if (!group.empty()) {
- GroupPrefsDialog * dialog = new GroupPrefsDialog (_data, group, _group_prefs, get_window(_root));
+// const Quark group (_group_pane->get_first_selection ());
+ quarks_v groups(_group_pane->get_full_selection());
+ if (!groups.empty()) {
+ GroupPrefsDialog * dialog = new GroupPrefsDialog (_data, groups, _group_prefs, get_window(_root));
gtk_widget_show (dialog->root());
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]