0.8.6claws107
authorChristoph Hohmann <reboot@gmx.ch>
Fri, 13 Dec 2002 17:43:59 +0000 (17:43 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Fri, 13 Dec 2002 17:43:59 +0000 (17:43 +0000)
* src/Makefile.am
* src/compose.c
* src/gtkstext.[ch]             ** REMOVE **
* src/gtkutils.[ch]
* src/textview.c
* src/gtk/gtkstext.[ch]         ** NEW **
* src/gtk/Makefile.am
        o move stext functions to gtkstext.c to remove
          dependency of gtkutils
        o move gtkstext files to common

* src/gtk/Makefile.am
* src/gtk/sslcertwindow.[ch]
        UI stuff can always depend on common code so
        it's ok to add ../common to include path

12 files changed:
ChangeLog.claws
configure.in
src/Makefile.am
src/compose.c
src/gtk/Makefile.am
src/gtk/gtkstext.c [moved from src/gtkstext.c with 98% similarity]
src/gtk/gtkstext.h [moved from src/gtkstext.h with 93% similarity]
src/gtk/sslcertwindow.c
src/gtk/sslcertwindow.h
src/gtkutils.c
src/gtkutils.h
src/textview.c

index a93ac303c07103dbf1d2ccf447668cd64488f6c2..0fe5ebee1dd108424be461e5f8e7732a29bb10e6 100644 (file)
@@ -1,3 +1,21 @@
+2002-12-13 [christoph] 0.8.6claws107
+
+       * src/Makefile.am
+        * src/compose.c
+       * src/gtkstext.[ch]             ** REMOVE **
+       * src/gtkutils.[ch]
+       * src/textview.c
+       * src/gtk/gtkstext.[ch]         ** NEW **
+       * src/gtk/Makefile.am
+               o move stext functions to gtkstext.c to remove
+                 dependency of gtkutils
+               o move gtkstext files to common         
+
+       * src/gtk/Makefile.am
+       * src/gtk/sslcertwindow.[ch]
+               UI stuff can always depend on common code so
+               it's ok to add ../common to include path
+
 2002-12-13 [colin]     0.8.6claws106
 
        * src/summaryview.c
index 00ef297e17ebc82572078ca053ab60fe13059790..d91ee8bed7d33f55d7846e6c912c53255fe165a4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws106
+EXTRA_VERSION=claws107
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index c9f8e4a97d01ac2b5c7ef872c6f363b5b554eb7b..ac296f78c88d512b3ad108cff3c868909ee7b938 100644 (file)
@@ -23,7 +23,6 @@ sylpheed_SOURCES = \
        procheader.c procheader.h \
        compose.c compose.h \
        gtkshruler.c gtkshruler.h \
-       gtkstext.c gtkstext.h \
        menu.c menu.h \
        stock_pixmap.c stock_pixmap.h \
        prefs.c prefs.h \
index 9a51d6c64467248c3b9817168a2bc3d346ee3f79..fb3f50cae9d96c1d1492c24f53d4fb42726ad6d9 100644 (file)
@@ -2431,7 +2431,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 
                        /* skip delete if it is continuous URL */
                        if (do_delete && (line_pos - p_pos <= i_len) &&
-                           gtkut_stext_is_uri_string(text, line_pos, tlen))
+                           gtk_stext_is_uri_string(text, line_pos, tlen))
                                do_delete = FALSE;
 
 #ifdef WRAP_DEBUG
@@ -2450,7 +2450,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
                                   indent string, delete them */
                                if (i_len) {
                                        guint ilen;
-                                       ilen =  gtkut_stext_str_compare_n
+                                       ilen =  gtk_stext_str_compare_n
                                                (text, cur_pos, p_pos, i_len,
                                                 tlen);
                                        if (ilen) {
@@ -2513,7 +2513,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 #endif
                        /* force wrapping if it is one long word but not URL */
                        if (line_pos - p_pos <= i_len)
-                               if (!gtkut_stext_is_uri_string
+                               if (!gtk_stext_is_uri_string
                                    (text, line_pos, tlen))
                                        line_pos = cur_pos - 1;
 #ifdef WRAP_DEBUG
@@ -2525,7 +2525,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
                        /* if next character is space delete it */
                        if (clen == 1 && isspace(*cbuf)) {
                                if (p_pos + i_len != line_pos ||
-                                   !gtkut_stext_is_uri_string
+                                   !gtk_stext_is_uri_string
                                        (text, line_pos, tlen)) {
                                        STEXT_FREEZE();
                                        /* workaround for correct cursor
@@ -2547,7 +2547,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 
                        /* if it is URL at beginning of line don't wrap */
                        if (p_pos + i_len == line_pos &&
-                           gtkut_stext_is_uri_string(text, line_pos, tlen)) {
+                           gtk_stext_is_uri_string(text, line_pos, tlen)) {
 #ifdef WRAP_DEBUG
                                g_print("found URL at ");
                                dump_text(text, line_pos, tlen, 1);
@@ -2580,7 +2580,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
                        /* should we insert quotation ? */
                        if (linewrap_quote && i_len) {
                                /* only if line is not already quoted  */
-                               if (!gtkut_stext_str_compare
+                               if (!gtk_stext_str_compare
                                        (text, line_pos, tlen, qfmt)) {
                                        guint ins_len;
 
index 0a2c85c5c05fc42f031a3b4598362d32950fb447..950a6e5b6c655aac804d9aeef91a4a778c7c6fee 100644 (file)
@@ -2,9 +2,11 @@ noinst_LTLIBRARIES = libsylpheedgtk.la
 
 libsylpheedgtk_la_SOURCES = \
        gtksctree.c gtksctree.h \
+       gtkstext.c gtkstext.h \
        sslcertwindow.c sslcertwindow.h
 
 INCLUDES = \
+       -I../common \
        $(GTK_CFLAGS)
 
 libsylpheedgtk_la_LIBADD = \
similarity index 98%
rename from src/gtkstext.c
rename to src/gtk/gtkstext.c
index d05a61f27d4446550ae53420ab9f3e74012bd908..1e08a30932bf9dddeec69eaf272e920ae904ac52 100644 (file)
 
 #include <ctype.h>
 #include <string.h>
+
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdki18n.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkselection.h>
 #include <gtk/gtksignal.h>
 
-/* #include "compose.h" */
 #include "gtkstext.h"
-#include "gtkutils.h"
+#include "utils.h"
 
 /* line_arrow.xbm */
 #define line_arrow_width 6
@@ -5246,7 +5246,7 @@ find_line_params (GtkSText* text,
                      if (lp.end.index == lp.start.index)
                        {
                          /* SYLPHEED: don't wrap URLs */
-                          if (gtkut_stext_is_uri_string(text, lp.end.index,
+                          if (gtk_stext_is_uri_string(text, lp.end.index,
                                         gtk_stext_get_length(text)))
                             {
                              lp.end = saved_mark;
@@ -6169,6 +6169,88 @@ void  gtk_stext_set_wrap_rmargin (GtkSText *text, gint rmargin)
        text->wrap_rmargin = rmargin >= 0 ? rmargin : 0; 
 }
 
+gboolean gtk_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs,
+                                 gint len, gboolean case_sens)
+{
+       gint match_count = 0;
+
+       for (; match_count < len; pos++, match_count++) {
+               if (case_sens) {
+                       if (GTK_STEXT_INDEX(text, pos) != wcs[match_count])
+                               break;
+               } else {
+                       if (towlower(GTK_STEXT_INDEX(text, pos)) !=
+                           towlower(wcs[match_count]))
+                               break;
+               }
+       }
+
+       if (match_count == len)
+               return TRUE;
+       else
+               return FALSE;
+}
+
+guint gtk_stext_str_compare_n(GtkSText *text, guint pos1, guint pos2,
+                               guint len, guint text_len)
+{
+       guint i;
+       GdkWChar ch1, ch2;
+
+       for (i = 0; i < len && pos1 + i < text_len && pos2 + i < text_len; i++) {
+               ch1 = GTK_STEXT_INDEX(text, pos1 + i);
+               ch2 = GTK_STEXT_INDEX(text, pos2 + i);
+               if (ch1 != ch2)
+                       break;
+       }
+
+       return i;
+}
+
+guint gtk_stext_str_compare(GtkSText *text, guint start_pos, guint text_len,
+                             const gchar *str)
+{
+       wchar_t *wcs;
+       guint len;
+       gboolean result;
+
+       if (!str) return 0;
+
+       wcs = strdup_mbstowcs(str);
+       if (!wcs) return 0;
+       len = wcslen(wcs);
+
+       if (len > text_len - start_pos)
+               result = FALSE;
+       else
+               result = gtk_stext_match_string(text, start_pos, wcs, len,
+                                                 TRUE);
+
+       g_free(wcs);
+
+       return result ? len : 0;
+}
+
+gboolean gtk_stext_is_uri_string(GtkSText *text,
+                                  guint start_pos, guint text_len)
+{
+       if (gtk_stext_str_compare(text, start_pos, text_len, "http://")  ||
+           gtk_stext_str_compare(text, start_pos, text_len, "ftp://")   ||
+           gtk_stext_str_compare(text, start_pos, text_len, "https://") ||
+           gtk_stext_str_compare(text, start_pos, text_len, "www."))
+               return TRUE;
+
+       return FALSE;
+}
+
+void gtk_stext_clear(GtkSText *text)
+{
+       gtk_stext_freeze(text);
+       gtk_stext_set_point(text, 0);
+       gtk_stext_forward_delete(text, gtk_stext_get_length(text));
+       gtk_stext_thaw(text);
+}
+
 /**********************************************************************/
 /*                              Debug                                 */
 /**********************************************************************/
similarity index 93%
rename from src/gtkstext.h
rename to src/gtk/gtkstext.h
index c5c8f15cfaed2b98e2994f2c55c036f1235ed928..4dcdf1d6e6c909aa4f598e12d367da6ce093ae07 100644 (file)
 #ifndef __GTK_STEXT_H__
 #define __GTK_STEXT_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
+#  include <wchar.h>
+#  include <wctype.h>
+#endif
 
 #include <gdk/gdk.h>
 #include <gtk/gtkadjustment.h>
@@ -266,6 +274,27 @@ void gtk_stext_delete_to_line_end        (GtkSText          *text);
  * behaviour */
 void      gtk_stext_set_wrap_rmargin (GtkSText *text, gint rmargin);
 
+/* gtk stext functions */
+gboolean gtk_stext_match_string                (GtkSText       *text,
+                                        gint            pos,
+                                        wchar_t        *wcs,
+                                        gint            len,
+                                        gboolean        case_sens);
+guint gtk_stext_str_compare_n          (GtkSText       *text,
+                                        guint           pos1,
+                                        guint           pos2,
+                                        guint           len,
+                                        guint           text_len);
+guint gtk_stext_str_compare            (GtkSText       *text,
+                                        guint           start_pos,
+                                        guint           text_len,
+                                        const gchar    *str);
+gboolean gtk_stext_is_uri_string       (GtkSText       *text,
+                                        guint           start_pos,
+                                        guint           text_len);
+void gtk_stext_clear                   (GtkSText       *text);
+
+
 
 #define GTK_STEXT_INDEX(t, index)      (((t)->use_wchar) \
        ? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
index b9f7c309774d38ea3e7c16af70ee09531cb35b70..ec6c5823fbc222b5481d58dd7ebac1346e8c03ad 100644 (file)
 #include <openssl/ssl.h>
 #include <glib.h>
 #include <gtk/gtk.h>
-#include "../common/intl.h"
-#include "../common/ssl_certificate.h"
-#include "../common/utils.h"
+#include "intl.h"
+#include "ssl_certificate.h"
+#include "utils.h"
 #include "../alertpanel.h"
-#include "../common/hooks.h"
+#include "hooks.h"
 
 static void toggle_cert_cb(GtkWidget   *widget,
                         gpointer        data);
index d7965eb7c0a70b92578d1fe9818b6422525588fa..2bef86323d2ef68d883c195af0d2433c75f7e37e 100644 (file)
@@ -30,7 +30,7 @@
 #include <openssl/objects.h>
 #include <glib.h>
 #include <gtk/gtk.h>
-#include "../common/ssl_certificate.h"
+#include "ssl_certificate.h"
 
 GtkWidget *cert_presenter(SSLCertificate *cert);
 void sslcertwindow_show_cert(SSLCertificate *cert);
index 35ef205e245d7ece41c7600f73917a7b863976bf..c6bbd8828ba0636b64dba18c88130d12f6fe2ac7 100644 (file)
@@ -367,88 +367,6 @@ void gtkut_container_remove(GtkContainer *container, GtkWidget *widget)
        gtk_container_remove(container, widget);
 }
 
-gboolean gtkut_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs,
-                                 gint len, gboolean case_sens)
-{
-       gint match_count = 0;
-
-       for (; match_count < len; pos++, match_count++) {
-               if (case_sens) {
-                       if (GTK_STEXT_INDEX(text, pos) != wcs[match_count])
-                               break;
-               } else {
-                       if (towlower(GTK_STEXT_INDEX(text, pos)) !=
-                           towlower(wcs[match_count]))
-                               break;
-               }
-       }
-
-       if (match_count == len)
-               return TRUE;
-       else
-               return FALSE;
-}
-
-guint gtkut_stext_str_compare_n(GtkSText *text, guint pos1, guint pos2,
-                               guint len, guint text_len)
-{
-       guint i;
-       GdkWChar ch1, ch2;
-
-       for (i = 0; i < len && pos1 + i < text_len && pos2 + i < text_len; i++) {
-               ch1 = GTK_STEXT_INDEX(text, pos1 + i);
-               ch2 = GTK_STEXT_INDEX(text, pos2 + i);
-               if (ch1 != ch2)
-                       break;
-       }
-
-       return i;
-}
-
-guint gtkut_stext_str_compare(GtkSText *text, guint start_pos, guint text_len,
-                             const gchar *str)
-{
-       wchar_t *wcs;
-       guint len;
-       gboolean result;
-
-       if (!str) return 0;
-
-       wcs = strdup_mbstowcs(str);
-       if (!wcs) return 0;
-       len = wcslen(wcs);
-
-       if (len > text_len - start_pos)
-               result = FALSE;
-       else
-               result = gtkut_stext_match_string(text, start_pos, wcs, len,
-                                                 TRUE);
-
-       g_free(wcs);
-
-       return result ? len : 0;
-}
-
-gboolean gtkut_stext_is_uri_string(GtkSText *text,
-                                  guint start_pos, guint text_len)
-{
-       if (gtkut_stext_str_compare(text, start_pos, text_len, "http://")  ||
-           gtkut_stext_str_compare(text, start_pos, text_len, "ftp://")   ||
-           gtkut_stext_str_compare(text, start_pos, text_len, "https://") ||
-           gtkut_stext_str_compare(text, start_pos, text_len, "www."))
-               return TRUE;
-
-       return FALSE;
-}
-
-void gtk_stext_clear(GtkSText *text)
-{
-       gtk_stext_freeze(text);
-       gtk_stext_set_point(text, 0);
-       gtk_stext_forward_delete(text, gtk_stext_get_length(text));
-       gtk_stext_thaw(text);
-}
-
 void gtkut_widget_disable_theme_engine(GtkWidget *widget)
 {
        GtkStyle *style, *new_style;
index 1b046a8ef7ff53402f0a78369d5e7c710cf67c2d..969ab819dd0ec0ae2e6c3e2abe016b6491c7e095 100644 (file)
@@ -122,25 +122,6 @@ gchar *gtkut_editable_get_selection        (GtkEditable    *editable);
 void gtkut_container_remove            (GtkContainer   *container,
                                         GtkWidget      *widget);
 
-gboolean gtkut_stext_match_string      (GtkSText       *text,
-                                        gint            pos,
-                                        wchar_t        *wcs,
-                                        gint            len,
-                                        gboolean        case_sens);
-guint gtkut_stext_str_compare_n                (GtkSText       *text,
-                                        guint           pos1,
-                                        guint           pos2,
-                                        guint           len,
-                                        guint           text_len);
-guint gtkut_stext_str_compare          (GtkSText       *text,
-                                        guint           start_pos,
-                                        guint           text_len,
-                                        const gchar    *str);
-gboolean gtkut_stext_is_uri_string     (GtkSText       *text,
-                                        guint           start_pos,
-                                        guint           text_len);
-void gtk_stext_clear                   (GtkSText       *text);
-
 void gtkut_widget_disable_theme_engine (GtkWidget      *widget);
 void gtkut_widget_wait_for_draw                (GtkWidget      *widget);
 void gtkut_widget_get_uposition                (GtkWidget      *widget,
index 5f1827d299fee01a0376d1d41556e7c5b04032a0..12aa2b17b3f7847cc2a2dce9f40f670e10f8b45c 100644 (file)
@@ -1441,7 +1441,7 @@ gboolean textview_search_string(TextView *textview, const gchar *str,
 
        for (; pos < text_len; pos++) {
                if (text_len - pos < len) break;
-               if (gtkut_stext_match_string(text, pos, wcs, len, case_sens)
+               if (gtk_stext_match_string(text, pos, wcs, len, case_sens)
                    == TRUE) {
                        gtk_widget_hide(GTK_WIDGET(textview->scrolledwin));
                        gtk_editable_set_position(GTK_EDITABLE(text),
@@ -1484,7 +1484,7 @@ gboolean textview_search_string_backward(TextView *textview, const gchar *str,
                pos = text_len - len;
 
        for (; pos >= textview->body_pos; pos--) {
-               if (gtkut_stext_match_string(text, pos, wcs, len, case_sens)
+               if (gtk_stext_match_string(text, pos, wcs, len, case_sens)
                    == TRUE) {
                        gtk_editable_set_position(GTK_EDITABLE(text), pos);
                        gtk_editable_select_region(GTK_EDITABLE(text),