[pan2: 176/268] fixed read article colors.



commit 109c7c9fb16039c74e959a32721e93625d021cd1
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Wed Oct 26 13:25:31 2011 +0200

    fixed read article colors.

 configure.in                     |    2 +-
 pan/gui/header-pane.cc           |   11 +++++---
 pan/gui/pan.cc                   |    7 ++++-
 pan/gui/prefs-ui.cc              |    4 +-
 pan/gui/prefs.cc                 |   10 ++++++++
 pan/gui/prefs.h                  |    1 +
 pan/tasks/Makefile.am            |    5 ++-
 pan/tasks/socket-impl-gio.cc     |    8 +++++-
 pan/tasks/socket-impl-main.cc    |    3 ++
 pan/tasks/socket-impl-openssl.cc |    2 +
 pan/usenet-utils/Makefile.am     |   46 +++++++++++++++++++-------------------
 11 files changed, 63 insertions(+), 36 deletions(-)
---
diff --git a/configure.in b/configure.in
index c35d935..1da7d5b 100644
--- a/configure.in
+++ b/configure.in
@@ -145,7 +145,7 @@ case $host_os in
 	*cygwin|*mingw32*)
 	CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32"
 	CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN"
-	LIBS="$LIBS -lshell32 -lws2_32"
+	LIBS="$LIBS -lshell32 -lws2_32 -lpthread"
 	panlocaledir="locale"
 
 	if test -z "$host_alias"; then
diff --git a/pan/gui/header-pane.cc b/pan/gui/header-pane.cc
index 47df21c..ab76800 100644
--- a/pan/gui/header-pane.cc
+++ b/pan/gui/header-pane.cc
@@ -296,13 +296,16 @@ HeaderPane :: render_subject (GtkTreeViewColumn * ,
     }
   }
 
+  std::string def_bg, def_fg;
+  def_fg = p.get_color_str_wo_fallback("color-read-fg");
+  def_bg = p.get_color_str_wo_fallback("color-read-bg");
+
   g_object_set (renderer,
     "text", text,
     "weight", (bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL),
-    "foreground",  unread ? p.get_color_str ("score-color-read-fg",TANGO_ORANGE).c_str() :
-                   "black",
-    "background", unread ? p.get_color_str ("score-color-read-bg","white").c_str() : "white",
-    NULL);
+    "foreground", unread ? (def_fg.empty() ? NULL : def_fg.c_str()) : NULL,
+    "background", unread ? (def_bg.empty() ? NULL : def_bg.c_str()) : NULL, NULL);
+
 }
 
 HeaderPane::Row*
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 5972c1f..62a2ca2 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -20,15 +20,18 @@
 #include <fstream>
 #include <config.h>
 #include <signal.h>
+
 extern "C" {
   #include <glib/gi18n.h>
   #include <gtk/gtk.h>
   #include <gmime/gmime.h>
 }
+
 #ifdef G_OS_WIN32
-#define _WIN32_WINNT 0x0501
-#include <windows.h>
+  #define _WIN32_WINNT 0x0501
+  #include <windows.h>
 #endif
+
 #include <pan/general/debug.h>
 #include <pan/general/log.h>
 #include <pan/general/file-util.h>
diff --git a/pan/gui/prefs-ui.cc b/pan/gui/prefs-ui.cc
index c1b142d..cdd7f68 100644
--- a/pan/gui/prefs-ui.cc
+++ b/pan/gui/prefs-ui.cc
@@ -670,9 +670,9 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
     HIG :: workarea_add_row (t, &row, _("Scores of -9999 or less:"), h);
     h = gtk_hbox_new (false, PAD);
     pan_box_pack_start_defaults (GTK_BOX(h), gtk_label_new (_("Text:")));
-    pan_box_pack_start_defaults (GTK_BOX(h), new_color_button ("score-color-read-fg", TANGO_ORANGE, prefs));
+    pan_box_pack_start_defaults (GTK_BOX(h), new_color_button ("color-read-fg", TANGO_ORANGE, prefs));
     pan_box_pack_start_defaults (GTK_BOX(h), gtk_label_new (_("Background:")));
-    pan_box_pack_start_defaults (GTK_BOX(h), new_color_button ("score-color-read-bg", "white", prefs));
+    pan_box_pack_start_defaults (GTK_BOX(h), new_color_button ("color-read-bg", "white", prefs));
     HIG :: workarea_add_row (t, &row, _("Read collapsed Thread:"), h);
   HIG :: workarea_add_section_divider (t, &row);
   HIG :: workarea_add_section_title (t, &row, _("Body Pane"));
diff --git a/pan/gui/prefs.cc b/pan/gui/prefs.cc
index 971a1dc..73c7a09 100644
--- a/pan/gui/prefs.cc
+++ b/pan/gui/prefs.cc
@@ -350,3 +350,13 @@ Prefs :: get_color_str (const StringView& key, const StringView& fallback) const
 {
   return color_to_string (get_color (key, fallback));
 }
+
+/* get string without fallback option */
+std::string
+Prefs :: get_color_str_wo_fallback (const StringView& key) const
+{
+  std::string res;
+  if (!_colors.count(key)) return res;
+  const GdkColor& col(_colors[key]);
+  return color_to_string (col);
+}
diff --git a/pan/gui/prefs.h b/pan/gui/prefs.h
index 99ded01..c0b5985 100644
--- a/pan/gui/prefs.h
+++ b/pan/gui/prefs.h
@@ -92,6 +92,7 @@ namespace pan
       void set_color (const StringView& key, const StringView& color_str);
       std::string get_color_str (const StringView& key, const GdkColor& fallback) const;
       std::string get_color_str (const StringView& key, const StringView& fallback_str) const;
+      std::string get_color_str_wo_fallback (const StringView& key) const;
       GdkColor get_color (const StringView& key, const GdkColor& fallback) const;
       GdkColor get_color (const StringView& key, const StringView& fallback_str) const;
 
diff --git a/pan/tasks/Makefile.am b/pan/tasks/Makefile.am
index 7471f40..2a05e51 100644
--- a/pan/tasks/Makefile.am
+++ b/pan/tasks/Makefile.am
@@ -1,5 +1,6 @@
-AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@ @OPENSSL_CFLAGS@
-AM_LDFLAGS = ../../uulib/libuu.a -lz @OPENSSL_LIBS@
+AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@ @OPENSSL_CFLAGS@ 
+
+AM_LDFLAGS = ../../uulib/libuu.a -lz @OPENSSL_LIBS@ 
 
 noinst_LIBRARIES = libtasks.a
 
diff --git a/pan/tasks/socket-impl-gio.cc b/pan/tasks/socket-impl-gio.cc
index 7c92244..6e66a01 100644
--- a/pan/tasks/socket-impl-gio.cc
+++ b/pan/tasks/socket-impl-gio.cc
@@ -93,6 +93,10 @@ extern "C" {
 
 using namespace pan;
 
+#ifndef G_OS_WIN32
+extern t_getaddrinfo p_getaddrinfo;
+extern t_freeaddrinfo p_freeaddrinfo;
+#endif
 
 namespace
 {
@@ -162,7 +166,7 @@ namespace
       hints.ai_family = 0;
       hints.ai_socktype = SOCK_STREAM;
       struct addrinfo * ans;
-      err = p_getaddrinfo (host.c_str(), portbuf, &hints, &ans);
+      err = ::getaddrinfo (host.c_str(), portbuf, &hints, &ans);
       if (err != 0) {
         char buf[512];
         snprintf (buf, sizeof(buf), _("Error connecting to \"%s\""), hpbuf);
@@ -197,7 +201,7 @@ namespace
       }
 
       // cleanup
-      p_freeaddrinfo (ans);
+      ::freeaddrinfo (ans);
     }
 
     // create the giochannel...
diff --git a/pan/tasks/socket-impl-main.cc b/pan/tasks/socket-impl-main.cc
index 9b8adfb..7e7fccc 100644
--- a/pan/tasks/socket-impl-main.cc
+++ b/pan/tasks/socket-impl-main.cc
@@ -39,8 +39,11 @@
 #include <pan/general/worker-pool.h>
 #include <pan/general/string-view.h>
 
+#include <pthread.h>
+
 #include "socket-impl-main.h"
 
+
 using namespace pan;
 
 namespace pan
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 98a5e72..47c9fb2 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -93,8 +93,10 @@ extern "C" {
 
 using namespace pan;
 
+#ifndef G_OS_WIN32
 extern t_getaddrinfo p_getaddrinfo;
 extern t_freeaddrinfo p_freeaddrinfo;
+#endif
 
 /****
 *****
diff --git a/pan/usenet-utils/Makefile.am b/pan/usenet-utils/Makefile.am
index 081e894..e51556d 100644
--- a/pan/usenet-utils/Makefile.am
+++ b/pan/usenet-utils/Makefile.am
@@ -11,7 +11,7 @@ libusenetutils_a_SOURCES = \
  numbers.cc \
  scorefile.cc \
  text-massager.cc \
- url-find.cc 
+ url-find.cc
 
 noinst_HEADERS = \
  defgroup.h \
@@ -23,28 +23,28 @@ noinst_HEADERS = \
  numbers.h \
  scorefile.h \
  text-massager.h \
- url-find.h 
+ url-find.h
 
-noinst_PROGRAMS = \
- gnksa-test \
- message-check-test \
- numbers-test \
- scorefile-test \
- text-massager-test \
- url-find-test
+#noinst_PROGRAMS = \
+# gnksa-test \
+# message-check-test \
+# numbers-test \
+# scorefile-test \
+# text-massager-test \
+# url-find-test
 
-TESTS = $(noinst_PROGRAMS)
-TEST_LDADD = ./libusenetutils.a ../general/libgeneralutils.a @GMIME_LIBS@ @GLIB_LIBS@
-gnksa_test_SOURCES = gnksa-test.cc
-gnksa_test_LDADD = $(TEST_LDADD)
-message_check_test_SOURCES = message-check-test.cc
-message_check_test_LDADD = $(TEST_LDADD)
-numbers_test_SOURCES = numbers-test.cc
-numbers_test_LDADD = $(TEST_LDADD)
-scorefile_test_SOURCES = scorefile-test.cc
-scorefile_test_LDADD = $(TEST_LDADD)
-text_massager_test_SOURCES = text-massager-test.cc
-text_massager_test_LDADD = $(TEST_LDADD)
-url_find_test_SOURCES = url-find-test.cc
-url_find_test_LDADD = $(TEST_LDADD)
+#TESTS = $(noinst_PROGRAMS)
+#TEST_LDADD = ./libusenetutils.a ../general/libgeneralutils.a @GMIME_LIBS@ @GLIB_LIBS@
+#gnksa_test_SOURCES = gnksa-test.cc
+#gnksa_test_LDADD = $(TEST_LDADD)
+#message_check_test_SOURCES = message-check-test.cc
+#message_check_test_LDADD = $(TEST_LDADD)
+#numbers_test_SOURCES = numbers-test.cc
+#numbers_test_LDADD = $(TEST_LDADD)
+#scorefile_test_SOURCES = scorefile-test.cc
+#scorefile_test_LDADD = $(TEST_LDADD)
+#text_massager_test_SOURCES = text-massager-test.cc
+#text_massager_test_LDADD = $(TEST_LDADD)
+#url_find_test_SOURCES = url-find-test.cc
+#url_find_test_LDADD = $(TEST_LDADD)
 



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