[pan2] Sorry for the sdfs, i tend to forget to rebase before a push. I'll try to avoid this mess..... -gtk



commit d6d0a5b144592fde69f157ec6bce2057c42ad10b
Author: Heinrich MÃller <henmull src gnome org>
Date:   Mon Jan 9 14:09:20 2012 +0100

    Sorry for the sdfs, i tend to forget to rebase before a push. I'll try
    to avoid this mess.....
    -gtk fix for gtk <= 2.18.x
    -gpg fix (changed from gpg to gpg2 executable)

 pan/gui/body-pane.cc       |   18 ++++++++++--
 pan/gui/post-ui.cc         |   28 +++++++++++++-----
 pan/gui/post.ui.h          |    3 --
 pan/gui/post.ui.pgp.h      |   67 ++++++++++++++++++++++++++++++++++++++++++++
 pan/gui/profiles-dialog.cc |   27 +++++++++++++----
 pan/gui/profiles-dialog.h  |    7 ----
 pan/usenet-utils/gpg.cc    |    4 +-
 7 files changed, 124 insertions(+), 30 deletions(-)
---
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 5756bbe..59d4e7e 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -1333,8 +1333,9 @@ BodyPane :: clear ()
   _message = 0;
 
   refresh ();
-
+#ifdef HAVE_GMIME_CRYPTO
   update_sig_valid(-1);
+#endif
 }
 
 void
@@ -1409,7 +1410,7 @@ BodyPane :: refresh_scroll_visible_state ()
   _vscroll_visible = gtk_adjustment_get_page_size(adj) < gtk_adjustment_get_upper(adj);
 }
 
-// show*_cb exist to ensure that _hscroll_visible and _vscroll_visible
+// show*_cb exists to ensure that _hscroll_visible and _vscroll_visible
 // are initialized properly when the body pane becomes shown onscreen.
 
 gboolean
@@ -1619,8 +1620,19 @@ BodyPane :: clear_attachments()
 
 }
 
+#if !GTK_CHECK_VERSION(2,22,0)
+//define private struct for gtktable for older gtk versions
+namespace
+{
+  typedef struct _GtkTablePrivate GtkTablePrivate;
+}
+#endif
+
 /// FIXME : shows only half the icon on gtk2+, gtk3+ works fine. hm....
-/// NOTE :
+/// NOTE : I use gtk_table for versions up to 3,0,0, and then gtk_grid for versions
+/// higher than that because gtk_table_get_size is deprecated since 3,4,0. Additionally,
+/// gtk_table_get_size is only defined since 2,22,0 , so I use the private struct as defined in
+/// gtk_table.c (prototype in gtk_table.h)
 void
 BodyPane :: add_attachment_to_toolbar (const char* fn)
 {
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 0e1e9b9..3dcc13e 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -49,7 +49,11 @@ extern "C" {
 #include "pad.h"
 #include "hig.h"
 #include "post-ui.h"
-#include "post.ui.h"
+#ifdef HAVE_GMIME_CRYPTO
+  #include "post.ui.pgp.h"
+#else
+  #include "post.ui.h"
+#endif
 #include "profiles-dialog.h"
 #include "url.h"
 #include "gtk-compat.h"
@@ -1061,6 +1065,7 @@ PostUI :: maybe_post_message (GMimeMessage * message)
   gtk_widget_hide (_root);
 
   GMimeMessage* msg = new_message_from_ui(POSTING);
+  Profile p(get_current_profile());
 
   if(_file_queue_empty)
   {
@@ -1068,7 +1073,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
 #ifdef HAVE_GMIME_CRYPTO
     /* adding yourself to the list of recipients */
     GPtrArray * rcp;
-    Profile p(get_current_profile());
 
     if (user_has_gpg)
     {
@@ -1076,12 +1080,15 @@ PostUI :: maybe_post_message (GMimeMessage * message)
       g_ptr_array_add(rcp, (gpointer)p.gpg_sig_uid.c_str());
     }
 
-    if (user_has_gpg && gpg_sign && !gpg_enc)
-      go_on = go_on && message_add_signed_part(p.gpg_sig_uid, get_body(), msg);
-    else if (user_has_gpg && gpg_enc && !gpg_sign)
-      go_on = go_on && gpg_encrypt(p.gpg_sig_uid, get_body(), msg, rcp, false);
-    else if (user_has_gpg && gpg_enc && gpg_sign)
-      go_on = go_on && gpg_encrypt(p.gpg_sig_uid, get_body(), msg, rcp, true);
+    if (user_has_gpg)
+    {
+      if (gpg_sign && !gpg_enc)
+        go_on = go_on && message_add_signed_part(p.gpg_sig_uid, get_body(), msg);
+      else if (user_has_gpg && gpg_enc && !gpg_sign)
+        go_on = go_on && gpg_encrypt(p.gpg_sig_uid, get_body(), msg, rcp, false);
+      else if (user_has_gpg && gpg_enc && gpg_sign)
+        go_on = go_on && gpg_encrypt(p.gpg_sig_uid, get_body(), msg, rcp, true);
+    }
 #endif
     if (go_on)
     {
@@ -1089,6 +1096,11 @@ PostUI :: maybe_post_message (GMimeMessage * message)
       _post_task->add_listener (this);
       _queue.add_task (_post_task, Queue::TOP);
     }
+    else
+    {
+      if (user_has_gpg)
+         Log::add_err_va(_("Error signing/encrypting your message. Perhaps you misspelled your email-address (%s) ?"),p.gpg_sig_uid.c_str());
+    }
 
   } else {
 
diff --git a/pan/gui/post.ui.h b/pan/gui/post.ui.h
index aee9347..7e8f1a0 100644
--- a/pan/gui/post.ui.h
+++ b/pan/gui/post.ui.h
@@ -23,9 +23,6 @@ const char * fallback_post_ui =
 "      <separator />\n"
 "      <menuitem action='master-reply' />\n"
 "      <separator />\n"
-"      <menuitem action='gpg-encrypt' />\n"
-"      <menuitem action='gpg-sign' />\n"
-"      <separator />\n"
 "      <menuitem action='run-editor' />\n"
 "      <menuitem action='always-run-editor' />\n"
 "      <separator />\n"
diff --git a/pan/gui/post.ui.pgp.h b/pan/gui/post.ui.pgp.h
new file mode 100644
index 0000000..aee9347
--- /dev/null
+++ b/pan/gui/post.ui.pgp.h
@@ -0,0 +1,67 @@
+// "      <menuitem action='wrapselected' />\n"  doesnt exist yet, so deactivated for now....
+const char * fallback_post_ui =
+"<ui>\n"
+"  <menubar name='post'>\n"
+"    <menu action='file-menu'>\n"
+"      <menuitem action='post-article' />\n"
+"      <menuitem action ='post-and-save-articles'  />\n"
+"      <separator />\n"
+"      <menuitem action='save-draft' />\n"
+"      <menuitem action='open-draft' />\n"
+"      <separator />\n"
+"      <menuitem action='close' />\n"
+"    </menu>\n"
+"    <menu action='edit-menu'>\n"
+"      <menuitem action='cut' />\n"
+"      <menuitem action='copy' />\n"
+"      <menuitem action='paste' />\n"
+"      <menuitem action='rot13' />\n"
+"      <separator />\n"
+"      <menuitem action='set-encoding' />\n"
+"      <menuitem action='set-charset' />\n"
+"      <menuitem action='remember-charset' />\n"
+"      <separator />\n"
+"      <menuitem action='master-reply' />\n"
+"      <separator />\n"
+"      <menuitem action='gpg-encrypt' />\n"
+"      <menuitem action='gpg-sign' />\n"
+"      <separator />\n"
+"      <menuitem action='run-editor' />\n"
+"      <menuitem action='always-run-editor' />\n"
+"      <separator />\n"
+"      <menuitem action='wrap' />\n"
+"      <menuitem action='spellcheck' />\n"
+"      <separator />\n"
+"      <menuitem action='manage-profiles' />\n"
+"    </menu>\n"
+"  </menubar>\n"
+"\n"
+"  <toolbar name='post-toolbar'>\n"
+"    <toolitem action='post-article' />\n"
+"    <toolitem action='post-and-save-articles' />\n"
+"    <separator />\n"
+"    <toolitem action='save-draft' />\n"
+"    <toolitem action='open-draft' />\n"
+"    <separator />\n"
+"    <toolitem action='wrap' />\n"
+"    <separator />\n"
+"    <toolitem action='rot13' />\n"
+"    <toolitem action='run-editor' />\n"
+"    <separator />\n"
+"    <toolitem action='add-files' />\n"
+"  </toolbar>\n"
+"\n"
+"  <popup name='filequeue-popup'>\n"
+"    <menuitem action='remove-files' />\n"
+"    <menuitem action='clear-list' />\n"
+"    <separator />\n"
+"    <menuitem action='select-parts' />\n"
+"    <separator />\n"
+"    <menuitem action='move-up' />\n"
+"    <menuitem action='move-down' />\n"
+"    <separator />\n"
+"    <menuitem action='move-top' />\n"
+"    <menuitem action='move-bottom' />\n"
+"  </popup>\n"
+"\n"
+"</ui>\n";
diff --git a/pan/gui/profiles-dialog.cc b/pan/gui/profiles-dialog.cc
index f034801..b5df7c2 100644
--- a/pan/gui/profiles-dialog.cc
+++ b/pan/gui/profiles-dialog.cc
@@ -45,6 +45,14 @@ using namespace pan;
 
 namespace
 {
+  enum
+  {
+    ROW_FILE,
+    ROW_TEXT,
+    ROW_COMMAND,
+    ROW_GPGSIG
+  };
+
   void set_entry (GtkWidget * w, const std::string& str)
   {
     const char * s = str.empty() ? "" : str.c_str();
@@ -69,7 +77,7 @@ namespace
     g_return_if_fail(d);
     gint row = gtk_combo_box_get_active (w);
 
-    if (row == 2) // GPG
+    if (row == ROW_GPGSIG)
     {
       gtk_widget_set_tooltip_text(d->_signature_file_combo_box,
                                   _("Please choose your Email Address according to your PGP key's user id."));
@@ -173,9 +181,11 @@ ProfileDialog :: ProfileDialog (const Data         & data,
     gtk_list_store_append (store, &iter);
     gtk_list_store_set (store, &iter, 0, _("Text"),         1, Profile::TEXT, -1);
     gtk_list_store_append (store, &iter);
-    gtk_list_store_set (store, &iter, 0, _("PGP Signature"),1, Profile::GPGSIG, -1);
-    gtk_list_store_append (store, &iter);
     gtk_list_store_set (store, &iter, 0, _("Command"),      1, Profile::COMMAND, -1);
+#ifdef HAVE_GMIME_CRYPTO
+    gtk_list_store_append (store, &iter);
+    gtk_list_store_set (store, &iter, 0, _("PGP Signature"),1, Profile::GPGSIG, -1);
+#endif
     w = gtk_combo_box_new_with_model (GTK_TREE_MODEL(store));
 
     hbox = gtk_hbox_new(FALSE, 3);
@@ -185,17 +195,19 @@ ProfileDialog :: ProfileDialog (const Data         & data,
     gtk_box_pack_start(GTK_BOX(hbox), w, true, true, 0);
     _signature_file_combo = hbox;
     _signature_file_combo_box = w;
-
+#ifdef HAVE_GMIME_CRYPTO
     g_signal_connect (w, "changed", G_CALLBACK(on_signature_type_changed), this);
-
+#endif
     renderer = gtk_cell_renderer_text_new ();
     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, true);
     gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), renderer, "text", 0, NULL);
 
     int active = ROW_FILE;
     if (profile.sig_type == profile.TEXT) active = ROW_TEXT;
-    if (profile.sig_type == profile.GPGSIG) active = ROW_GPGSIG;
     if (profile.sig_type == profile.COMMAND) active = ROW_COMMAND;
+#ifdef HAVE_GMIME_CRYPTO
+    if (profile.sig_type == profile.GPGSIG) active = ROW_GPGSIG;
+#endif
 
     gtk_combo_box_set_active (GTK_COMBO_BOX(w), active);
     GtkWidget* vbox = gtk_vbox_new(TRUE, 3);
@@ -270,8 +282,9 @@ ProfileDialog :: ProfileDialog (const Data         & data,
     gtk_window_set_transient_for (GTK_WINDOW(_root), parent);
     gtk_window_set_position (GTK_WINDOW(_root), GTK_WIN_POS_CENTER_ON_PARENT);
   }
-
+#ifdef HAVE_GMIME_CRYPTO
   on_signature_type_changed(GTK_COMBO_BOX(_signature_file_combo_box), this);
+#endif
 }
 
 ProfileDialog :: ~ProfileDialog ()
diff --git a/pan/gui/profiles-dialog.h b/pan/gui/profiles-dialog.h
index 7e9bd05..ce940c1 100644
--- a/pan/gui/profiles-dialog.h
+++ b/pan/gui/profiles-dialog.h
@@ -36,13 +36,6 @@ namespace pan
       ~ProfileDialog ();
       GtkWidget* root() { return _root; }
       void get_profile (std::string& setme_name, Profile& setme_profile);
-      enum
-      {
-        ROW_FILE=0,
-        ROW_TEXT=1,
-        ROW_GPGSIG=2,
-        ROW_COMMAND=3
-      };
 
     private:
       GtkWidget * _root;
diff --git a/pan/usenet-utils/gpg.cc b/pan/usenet-utils/gpg.cc
index 566e928..a67388c 100644
--- a/pan/usenet-utils/gpg.cc
+++ b/pan/usenet-utils/gpg.cc
@@ -127,11 +127,11 @@ namespace pan
 
   void init_gpg()
   {
-    gpg_ctx = g_mime_gpg_context_new (request_passwd, "gpg");
+    gpg_ctx = g_mime_gpg_context_new (request_passwd, "gpg2");
     if (!gpg_ctx) gpg_inited = false; else gpg_inited = true;
     g_mime_gpg_context_set_auto_key_retrieve(GMIME_GPG_CONTEXT(gpg_ctx),true);
     g_mime_gpg_context_set_always_trust(GMIME_GPG_CONTEXT(gpg_ctx),false);
-    g_mime_gpg_context_set_use_agent(GMIME_GPG_CONTEXT(gpg_ctx), true);
+    g_mime_gpg_context_set_use_agent(GMIME_GPG_CONTEXT(gpg_ctx), false);
   }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]