ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src chat_room.c,1.13,1.14 chat_window.c,1.14


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src chat_room.c,1.13,1.14 chat_window.c,1.14,1.15 gtkspell.c,1.1.1.1,1.2 prefs.c,1.9,1.10
Date: Fri, 10 Jan 2003 11:38:22 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv14702/src

Modified Files:
        chat_room.c chat_window.c gtkspell.c prefs.c 
Log Message:
allow special ispell dictionnary


Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- chat_room.c 10 Jan 2003 12:37:13 -0000      1.13
+++ chat_room.c 10 Jan 2003 16:38:20 -0000      1.14
@@ -11,7 +11,7 @@
 #include "sound.h"
 #include "dialog.h"
 #include "smileys.h"
-
+#include "prefs.h"
 #include "pixmaps/tb_mail_send.xpm"
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/ok.xpm"
@@ -682,8 +682,16 @@
                {
                  if(!gtkspell_running())
                    {
-                     gchar *ispell_cmd[] = { "ispell", "-a", NULL };
-                     gtkspell_start(NULL, ispell_cmd);
+                      if (cGetLocalPref("spell_dictionnary") && 
strlen(cGetLocalPref("spell_dictionnary"))) { 
+                        gchar *ispell_cmd[] = { "ispell", "-a", "-d", 
"francais", NULL };
+                        ispell_cmd[3]=cGetLocalPref("spell_dictionnary");
+                        eb_debug(DBG_CORE, "Starting ispell with dict %s\n", 
ispell_cmd[3]);
+                        gtkspell_start(NULL, ispell_cmd);
+                      } else {
+                        gchar *ispell_cmd[] = { "ispell", "-a", NULL };
+                        eb_debug(DBG_CORE, "Starting ispell with default 
dict\n");
+                        gtkspell_start(NULL, ispell_cmd);
+                      }
                    }
                  gtkspell_attach(GTK_TEXT(chat_room->entry));
                }

Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- chat_window.c       10 Jan 2003 12:37:13 -0000      1.14
+++ chat_window.c       10 Jan 2003 16:38:20 -0000      1.15
@@ -1374,8 +1374,16 @@
        {
          if(!gtkspell_running())
            {
-             gchar *ispell_cmd[] = { "ispell", "-a", NULL };
-             gtkspell_start(NULL, ispell_cmd);
+             if (cGetLocalPref("spell_dictionnary") && 
strlen(cGetLocalPref("spell_dictionnary"))) { 
+               gchar *ispell_cmd[] = { "ispell", "-a", "-d", "francais", NULL 
};
+               ispell_cmd[3]=cGetLocalPref("spell_dictionnary");
+               eb_debug(DBG_CORE, "Starting ispell with dict %s\n", 
ispell_cmd[3]);
+               gtkspell_start(NULL, ispell_cmd);
+              } else {
+               gchar *ispell_cmd[] = { "ispell", "-a", NULL };
+               eb_debug(DBG_CORE, "Starting ispell with default dict\n");
+               gtkspell_start(NULL, ispell_cmd);
+             }
            }
          gtkspell_attach(GTK_TEXT(cw->entry));
        }

Index: gtkspell.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/gtkspell.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- gtkspell.c  23 Dec 2002 22:05:35 -0000      1.1.1.1
+++ gtkspell.c  10 Jan 2003 16:38:20 -0000      1.2
@@ -396,13 +396,13 @@
        if (!gtkspell_running()) return;
 
        gtk_signal_handler_block_by_func(GTK_OBJECT(gtktext),
-                                                                        
GTK_SIGNAL_FUNC(entry_insert_cb),
-                                                                        NULL);
+                                        GTK_SIGNAL_FUNC(entry_insert_cb),
+                                        NULL);
        gtk_text_insert(GTK_TEXT(gtktext), NULL,
                        &(GTK_WIDGET(gtktext)->style->fg[0]), NULL, newtext, 
len);
        gtk_signal_handler_unblock_by_func(GTK_OBJECT(gtktext),
-                                                                        
GTK_SIGNAL_FUNC(entry_insert_cb),
-                                                                        NULL);
+                                          GTK_SIGNAL_FUNC(entry_insert_cb),
+                                          NULL);
        gtk_signal_emit_stop_by_name(GTK_OBJECT(gtktext), "insert-text");
        *ppos += len;
 
@@ -469,7 +469,7 @@
        GtkWidget *menu, *item;
        char *caption;
        menu = gtk_menu_new(); {
-               caption = g_strdup_printf("Not in dictionary: %s", 
(char*)l->data);
+               caption = g_strdup_printf(_("Not in dictionary: %s"), 
(char*)l->data);
                item = gtk_menu_item_new_with_label(caption);
                /* I'd like to make it so this item is never selectable, like
                 * the menu titles in the GNOME panel... unfortunately, the 
GNOME
@@ -483,7 +483,7 @@
 
                l = l->next;
                if (l == NULL) {
-                       item = gtk_menu_item_new_with_label("(no suggestions)");
+                       item = gtk_menu_item_new_with_label(_("(no 
suggestions)"));
                        gtk_widget_show(item);
                        gtk_menu_append(GTK_MENU(menu), item);
                } else {
@@ -493,7 +493,7 @@
                                if (l->data == NULL && l->next != NULL) {
                                        count = 0;
                                        curmenu = gtk_menu_new();
-                                       item = 
gtk_menu_item_new_with_label("Other Possibilities...");
+                                       item = 
gtk_menu_item_new_with_label(_("Other Possibilities..."));
                                        gtk_widget_show(item);
                                        
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), curmenu);
                                        gtk_menu_append(GTK_MENU(curmenu), 
item);

Index: prefs.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- prefs.c     10 Jan 2003 12:37:13 -0000      1.9
+++ prefs.c     10 Jan 2003 16:38:20 -0000      1.10
@@ -47,7 +47,9 @@
 
 #include "pixmaps/ok.xpm"
 #include "pixmaps/cancel.xpm"
-
+#ifdef HAVE_ISPELL
+#include "gtkspell.h"
+#endif
 #ifdef __MINGW32__
 #define rindex(a,b) strrchr(a,b)
 #endif
@@ -221,6 +223,7 @@
 static GtkWidget * length_contact_window_entry = NULL;
 static GtkWidget * font_size_entry = NULL;
 static GtkWidget * alternate_browser_entry = NULL;
+static GtkWidget * dictionnary_entry = NULL;
 static const gint length_contact_window_def = 256;
 static const gint width_contact_window_def = 150;
 #ifdef HAVE_LIBXFT
@@ -248,6 +251,7 @@
 #ifdef HAVE_ISPELL
 gint do_spell_checking = 0;
 gint do_spell_checking_old = 0;
+char *spell_dictionary = "";
 #endif
 
 gint do_noautoresize = 0;
@@ -257,6 +261,9 @@
 gint use_alternate_browser_old = 0;
 
 void set_use_alternate_browser(GtkWidget * w, int * data);
+#ifdef HAVE_ISPELL
+void set_use_spell(GtkWidget * w, int * data);
+#endif
 
 static void build_general_prefs(GtkWidget *prefs_note) {
     GtkWidget *vbox;
@@ -294,8 +301,26 @@
 
     do_applet_show_on_startup_old = do_applet_show_on_startup ;
 #ifdef HAVE_ISPELL
+    hbox = gtk_hbox_new(FALSE, 0);
+    dictionnary_entry = gtk_entry_new();
+
+    if (cGetLocalPref("spell_dictionnary")) {
+       gtk_entry_set_text(GTK_ENTRY(dictionnary_entry), 
cGetLocalPref("spell_dictionnary"));
+    } else {
+       gtk_entry_set_text(GTK_ENTRY(dictionnary_entry), "");
+    }
     do_spell_checking_old = do_spell_checking;
-    eb_button(_("Use spell checking"), &do_spell_checking, vbox);
+    brbutton = eb_button(_("Use spell checking - Dictionnary:"), 
&do_spell_checking, hbox);
+    gtk_box_pack_start(GTK_BOX(hbox), dictionnary_entry, TRUE, TRUE, 10);
+    gtk_widget_show(dictionnary_entry);
+    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+    gtk_widget_show(hbox);
+    if(do_spell_checking == 0)
+    {
+       gtk_widget_set_sensitive(dictionnary_entry, FALSE);
+    }
+    gtk_signal_connect(GTK_OBJECT(brbutton), "clicked",
+           GTK_SIGNAL_FUNC(set_use_spell), (gpointer)brbutton);
 #endif
 
     do_yattm_debug_old = do_yattm_debug;
@@ -354,6 +379,10 @@
     do_applet_show_on_startup = do_applet_show_on_startup_old;
 #ifdef HAVE_ISPELL
     do_spell_checking = do_spell_checking_old ;
+    if(cGetLocalPref("spell_dictionnary"))
+           gtk_entry_set_text(GTK_ENTRY(dictionnary_entry), 
cGetLocalPref("spell_dictionnary"));
+    else
+           gtk_entry_set_text(GTK_ENTRY(dictionnary_entry), "");
 #endif
 
     do_noautoresize = do_noautoresize ;
@@ -377,6 +406,21 @@
     fprintf(fp,"width_contact_window=%d\n", 
iGetLocalPref("width_contact_window"));
 #ifdef HAVE_ISPELL
     fprintf(fp,"do_spell_checking=%d\n", do_spell_checking) ;
+    if (do_spell_checking) {
+           char *oldspell, *newspell;
+           newspell = (dictionnary_entry != NULL && 
strlen(gtk_entry_get_text(GTK_ENTRY(dictionnary_entry))))
+                           
?gtk_entry_get_text(GTK_ENTRY(dictionnary_entry)):"";
+           oldspell = (cGetLocalPref("spell_dictionnary") && 
strlen(cGetLocalPref("spell_dictionnary")))
+                           ?cGetLocalPref("spell_dictionnary"):"";
+           if(strcmp(newspell, oldspell)) {
+               gtkspell_stop();
+           }
+    }
+    if (dictionnary_entry!=NULL)
+        cSetLocalPref("spell_dictionnary", 
gtk_entry_get_text(GTK_ENTRY(dictionnary_entry)));
+    if (strlen(cGetLocalPref("spell_dictionnary")) > 0) {
+       fprintf(fp,"spell_dictionnary=%s\n", 
cGetLocalPref("spell_dictionnary"));
+    }
 #endif
     fprintf(fp,"do_noautoresize=%d\n", do_noautoresize) ;
     fprintf(fp,"use_alternate_browser=%d\n", use_alternate_browser);
@@ -399,10 +443,29 @@
      }
 }
 
+#ifdef HAVE_ISPELL
+void set_use_spell(GtkWidget * w, int * data)
+{
+     if(do_spell_checking == 0)
+     {
+         gtk_widget_set_sensitive(dictionnary_entry, FALSE);
+     }
+     else
+     {
+         gtk_widget_set_sensitive(dictionnary_entry, TRUE);
+     }
+}
+#endif
+
 void destroy_general_prefs()
 {
        if(alternate_browser_entry==NULL) return;
        cSetLocalPref("alternate_browser", 
gtk_entry_get_text(GTK_ENTRY(alternate_browser_entry)));
+#ifdef HAVE_ISPELL
+       cSetLocalPref("spell_dictionnary", 
gtk_entry_get_text(GTK_ENTRY(dictionnary_entry)));
+       gtk_widget_destroy(dictionnary_entry);
+       dictionnary_entry = NULL;
+#endif
        gtk_widget_destroy(length_contact_window_entry);
        gtk_widget_destroy(alternate_browser_entry);
        length_contact_window_entry = NULL;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]