diff -r -u pan-0.95-orig/pan/gui/gui.cc pan-0.95/pan/gui/gui.cc --- pan-0.95-orig/pan/gui/gui.cc 2006-04-26 22:57:19.000000000 +0200 +++ pan-0.95/pan/gui/gui.cc 2006-05-01 21:45:30.000000000 +0200 @@ -753,7 +753,7 @@ g_mime_message_set_mime_part (message, GMIME_OBJECT(part)); g_object_unref (part); - PostUI * post = new PostUI (_queue, _data, _data, message, get_window(_root)); + PostUI * post = new PostUI (_queue, _data, _data, message, _prefs, get_window(_root)); gtk_widget_show (post->root()); g_object_unref (message); } @@ -762,7 +762,7 @@ { GMimeMessage * message = _body_pane->create_followup (); if (message) { - PostUI * post = new PostUI (_queue, _data, _data, message, get_window(_root)); + PostUI * post = new PostUI (_queue, _data, _data, message, _prefs, get_window(_root)); gtk_widget_show (post->root()); g_object_unref (message); } diff -r -u pan-0.95-orig/pan/gui/post-ui.cc pan-0.95/pan/gui/post-ui.cc --- pan-0.95-orig/pan/gui/post-ui.cc 2006-04-20 17:09:49.000000000 +0200 +++ pan-0.95/pan/gui/post-ui.cc 2006-05-01 22:44:29.000000000 +0200 @@ -925,7 +925,7 @@ namespace { - GtkWidget* create_body_widget (GtkTextBuffer*& buf, GtkWidget*& view) + GtkWidget* create_body_widget (GtkTextBuffer*& buf, GtkWidget*& view, const Prefs &prefs) { view = gtk_text_view_new (); @@ -942,10 +942,9 @@ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW(view)); // force a monospace font, and size it to 80 cols x 30 rows + const std::string str (prefs.get_string ("monospace-font", "Monospace 10")); + PangoFontDescription *pfd (pango_font_description_from_string (str.c_str())); PangoContext * context = gtk_widget_create_pango_context (view); - const PangoFontDescription * fd = pango_context_get_font_description (context); - PangoFontDescription * pfd = pango_font_description_copy (fd); - pango_font_description_set_family (pfd, "Monospace"); const int column_width (80); std::string line (column_width, 'A'); pango_context_set_font_description (context, pfd); @@ -1251,7 +1250,8 @@ GroupServer & gs, Profiles & profiles, GMimeMessage * message, - GtkWindow * parent): + const Prefs & prefs, + GtkWindow * parent) : _queue (queue), _gs (gs), _profiles (profiles), @@ -1328,7 +1328,7 @@ gtk_box_pack_start (GTK_BOX(vbox), t, false, false, 0); // add the body text widget - w = create_body_widget (_body_buf, _body_view); + w = create_body_widget (_body_buf, _body_view, prefs); g_signal_connect (_body_buf, "insert-text", G_CALLBACK(text_was_inserted_cb), &_tm); gtk_box_pack_start (GTK_BOX(vbox), w, true, true, 0); diff -r -u pan-0.95-orig/pan/gui/post-ui.h pan-0.95/pan/gui/post-ui.h --- pan-0.95-orig/pan/gui/post-ui.h 2006-04-03 19:17:32.000000000 +0200 +++ pan-0.95/pan/gui/post-ui.h 2006-05-01 21:44:03.000000000 +0200 @@ -21,6 +21,7 @@ #define __PostUI_h__ #include +#include #include #include #include @@ -36,7 +37,7 @@ class PostUI: private Progress::Listener { public: - PostUI (Queue&, GroupServer&, Profiles&, GMimeMessage* message, GtkWindow * parent=0); + PostUI (Queue&, GroupServer&, Profiles&, GMimeMessage* message, const Prefs& prefs, GtkWindow * parent=0); ~PostUI (); public: diff -r -u pan-0.95-orig/pan/gui/profiles-dialog.cc pan-0.95/pan/gui/profiles-dialog.cc --- pan-0.95-orig/pan/gui/profiles-dialog.cc 2006-04-20 17:09:57.000000000 +0200 +++ pan-0.95/pan/gui/profiles-dialog.cc 2006-05-01 22:40:12.000000000 +0200 @@ -270,6 +270,7 @@ const std::string name (get_selected_profile (GTK_TREE_VIEW (_view))); _profiles.delete_profile (name); rebuild_store (); + refresh_buttons (); } void @@ -289,6 +290,7 @@ _profiles.delete_profile (old_name); _profiles.add_profile (new_name, profile); rebuild_store (); + refresh_buttons (); gtk_widget_destroy (d.root()); } @@ -308,6 +310,25 @@ _profiles.add_profile (name, profile); gtk_widget_destroy (d.root()); rebuild_store (); + refresh_buttons (); +} + +void +ProfilesDialog :: refresh_buttons () +{ + const std::string name (get_selected_profile (GTK_TREE_VIEW (_view))); + bool have_sel (!name.empty()); + gtk_widget_set_sensitive (_edit_button, have_sel); + gtk_widget_set_sensitive (_remove_button, have_sel); +} + +namespace +{ + static void profiles_tree_view_selection_changed_cb (GtkTreeSelection * selection, gpointer user_data) + { + ProfilesDialog *d = (ProfilesDialog *)user_data; + d->refresh_buttons (); + } } ProfilesDialog :: ~ProfilesDialog () @@ -337,8 +358,11 @@ gtk_tree_view_append_column (GTK_TREE_VIEW(w), column); GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (w)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + g_signal_connect (G_OBJECT (selection), "changed", + G_CALLBACK (profiles_tree_view_selection_changed_cb), this); w = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(w), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(w), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER(w), _view); gtk_box_pack_start (GTK_BOX (hbox), w, true, true, 0); gtk_widget_set_size_request (w, 300, 300); @@ -360,16 +384,20 @@ #else w = gtk_button_new_from_stock (GTK_STOCK_OPEN); #endif + _edit_button = w; gtk_box_pack_start (GTK_BOX (bbox), w, false, false, 0); gtk_tooltips_set_tip (tips, w, _("Edit the selected profile"), NULL); gtk_signal_connect (GTK_OBJECT(w), "clicked", GTK_SIGNAL_FUNC(on_edit_button), this); // remove button - w = gtk_button_new_from_stock (GTK_STOCK_REMOVE); + _remove_button = w = gtk_button_new_from_stock (GTK_STOCK_REMOVE); gtk_box_pack_start (GTK_BOX (bbox), w, false, false, 0); gtk_tooltips_set_tip (tips, w, _("Remove the selected profile"), NULL); gtk_signal_connect (GTK_OBJECT(w), "clicked", GTK_SIGNAL_FUNC(on_delete_button), this); + // set sensitive buttons + refresh_buttons (); + gtk_widget_show_all (hbox); if (parent != 0) { diff -r -u pan-0.95-orig/pan/gui/profiles-dialog.h pan-0.95/pan/gui/profiles-dialog.h --- pan-0.95-orig/pan/gui/profiles-dialog.h 2006-03-26 22:38:48.000000000 +0200 +++ pan-0.95/pan/gui/profiles-dialog.h 2006-05-01 22:46:07.000000000 +0200 @@ -69,11 +69,14 @@ void delete_profile (); void create_new_profile (); void rebuild_store (); + void refresh_buttons (); private: Profiles& _profiles; GtkWidget * _root; GtkWidget * _view; + GtkWidget * _edit_button; + GtkWidget * _remove_button; GtkListStore * _store; }; }