30
30
#include "userlist.h"
31
31
#include "../common/outbound.h"
33
static void text_entry_class_init (TextEntryClass *klass);
34
static void text_entry_init (TextEntry *entry);
35
static void text_entry_finalize (GObject *object);
36
static gboolean text_entry_key_press (GtkWidget *widget,
33
static void text_entry_class_init (TextEntryClass *klass);
34
static void text_entry_init (TextEntry *entry);
35
static void text_entry_finalize (GObject *object);
36
static gboolean text_entry_key_press (GtkWidget *widget,
39
39
#ifdef HAVE_LIBSEXY
40
static gboolean text_entry_spell_check (TextEntry *entry,
43
static void enable_spellcheck_changed (GConfClient *client,
45
GConfEntry *gconf_entry,
48
static void languages_changed (GConfClient *client,
50
GConfEntry *gconf_entry,
40
static gboolean text_entry_spell_check (TextEntry *entry,
43
static void enable_spellcheck_changed (GConfClient *client,
45
GConfEntry *gconf_entry,
54
static void text_entry_activate (GtkWidget *widget,
56
static void text_entry_history_up (GtkEntry *entry);
57
static void text_entry_history_down (GtkEntry *entry);
58
static gboolean text_entry_tab_complete (GtkEntry *entry);
59
static void text_entry_populate_popup (GtkEntry *entry,
48
static void text_entry_activate (GtkWidget *widget,
50
static void text_entry_history_up (GtkEntry *entry);
51
static void text_entry_history_down (GtkEntry *entry);
52
static gboolean text_entry_tab_complete (GtkEntry *entry);
53
static void text_entry_populate_popup (GtkEntry *entry,
56
static void text_entry_selection_changed (GObject *obj,
63
static gboolean tab_complete_command (GtkEntry *entry);
64
static gboolean tab_complete_nickname (GtkEntry *entry,
66
static GtkWidget *get_color_icon (int c,
68
static void color_code_activate (GtkMenuItem *item,
60
static gboolean tab_complete_command (GtkEntry *entry);
61
static gboolean tab_complete_nickname (GtkEntry *entry,
63
static GtkWidget *get_color_icon (int c,
65
static void color_code_activate (GtkMenuItem *item,
71
68
#ifdef HAVE_LIBSEXY
72
69
static SexySpellEntryClass *parent_class = NULL;
108
107
GError *err = NULL;
111
g_signal_connect_after (G_OBJECT (entry), "key_press_event", G_CALLBACK (text_entry_key_press), NULL);
112
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (text_entry_activate), NULL);
113
g_signal_connect (G_OBJECT (entry), "populate-popup", G_CALLBACK (text_entry_populate_popup), NULL);
110
g_signal_connect_after (G_OBJECT (entry), "key_press_event", G_CALLBACK (text_entry_key_press), NULL);
111
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (text_entry_activate), NULL);
112
g_signal_connect (G_OBJECT (entry), "populate-popup", G_CALLBACK (text_entry_populate_popup), NULL);
113
g_signal_connect (G_OBJECT (entry), "notify::cursor-position", G_CALLBACK (text_entry_selection_changed), NULL);
114
g_signal_connect (G_OBJECT (entry), "notify::selection-bound", G_CALLBACK (text_entry_selection_changed), NULL);
114
115
#ifdef HAVE_LIBSEXY
115
g_signal_connect_after (G_OBJECT (entry), "word-check", G_CALLBACK (text_entry_spell_check), NULL);
116
g_signal_connect_after (G_OBJECT (entry), "word-check", G_CALLBACK (text_entry_spell_check), NULL);
118
119
entry->priv = g_new0 (TextEntryPriv, 1);
166
167
gconf_client_notify_add (client, "/apps/xchat/spellcheck/enabled",
167
168
(GConfClientNotifyFunc) enable_spellcheck_changed, entry, NULL, NULL);
169
gconf_client_notify_add (client, "/apps/xchat/spellcheck/languages",
170
(GConfClientNotifyFunc) languages_changed, entry, NULL, NULL);
173
170
g_object_unref (client);
470
468
conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel), text_entry->priv->current, (guchar *) printtext, TRUE);
471
469
g_free (printtext);
474
471
if (new_prefix && strcasecmp (prefix, new_prefix) != 0) {
475
472
/* insert the new prefix into the entry */
476
473
npt = g_strdup_printf ("/%s%s", new_prefix, &text[cursor]);
477
474
gtk_entry_set_text (entry, npt);
479
gtk_editable_set_position (GTK_EDITABLE (entry), strlen (new_prefix));
476
gtk_editable_set_position (GTK_EDITABLE (entry), strlen (new_prefix) + 1);
652
649
gtk_editable_set_position (GTK_EDITABLE (entry), -1);
654
651
entry->priv->current = sess;
654
gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
655
selected_text, strlen (selected_text));
686
688
g_slist_free (langs);
691
* FIXME : This is done in preferences-page-spellcheck because if we have 2
692
* notifications change on the same gonf key, the one from
693
* preferences-page-spellcheck is called before this one and so it doesn't
694
* work. That's suck because we can only change languages using gconf if the
695
* preference window is opened.
699
languages_changed (GConfClient *client, guint cnxn_id, GConfEntry *gconf_entry, TextEntry *entry)
694
text_entry_selection_changed (GObject *obj, GParamSpec *pspec, gpointer data)
702
GSList *new_languages, *old_languages;
704
new_languages = gconf_client_get_list (client, "/apps/xchat/spellcheck/languages", GCONF_VALUE_STRING, NULL);
706
if (new_languages != NULL)
707
sexy_spell_entry_set_active_languages (SEXY_SPELL_ENTRY (entry), new_languages, &err);
710
g_printerr (_("Error in spellchecking configuration: %s\n"), err->message);
713
old_languages = sexy_spell_entry_get_active_languages (SEXY_SPELL_ENTRY (entry));
714
if (old_languages != NULL) {
715
gconf_client_set_list (client, "/apps/xchat/spellcheck/languages",
716
GCONF_VALUE_STRING, old_languages, NULL);
717
g_slist_foreach (old_languages, (GFunc) g_free, NULL);
718
g_slist_free (old_languages);
696
GtkEditable *editable;
699
editable = GTK_EDITABLE (obj);
700
if (gtk_editable_get_selection_bounds (editable, &start, &end)) {
703
g_free (selected_text);
704
selected_text = gtk_editable_get_chars (editable, start, end);
722
g_slist_foreach (new_languages, (GFunc) g_free, NULL);
723
g_slist_free (new_languages);