annotate console/libgnt/gntentry.c @ 14828:91a89d5ef714

[gaim-migrate @ 17595] Two new actions for the entry box: "delete-prev-word" and "cursor-prev-word". I haven't set any default binding for either. But I think ctrl-w is a common binding for the first action. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 28 Oct 2006 06:01:30 +0000
parents 02b70dc43044
children bfcdd361357e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13882
diff changeset
1 #include <ctype.h>
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2 #include <string.h>
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13882
diff changeset
3
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
4 #include "gntbox.h"
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
5 #include "gntentry.h"
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
6 #include "gnttree.h"
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
7 #include "gntutils.h"
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 enum
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 SIGS = 1,
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 };
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 static GntWidgetClass *parent_class = NULL;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
16 static void
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
17 destroy_suggest(GntEntry *entry)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
18 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
19 if (entry->ddown)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
20 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
21 gnt_widget_destroy(entry->ddown->parent);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
22 entry->ddown = NULL;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
23 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
24 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
25
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
26 static char *
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
27 get_beginning_of_word(GntEntry *entry)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
28 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
29 char *s = entry->cursor;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
30 while (s > entry->start)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
31 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
32 char *t = g_utf8_find_prev_char(entry->start, s);
14578
60845d332ea6 [gaim-migrate @ 17302]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14477
diff changeset
33 if (isspace(*t))
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
34 break;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
35 s = t;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
36 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
37 return s;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
38 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
39
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
40 static gboolean
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
41 show_suggest_dropdown(GntEntry *entry)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
42 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
43 char *suggest = NULL;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
44 int len;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
45 int offset = 0, x, y;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
46 int count = 0;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
47 GList *iter;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
48
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
49 if (entry->word)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
50 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
51 char *s = get_beginning_of_word(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
52 suggest = g_strndup(s, entry->cursor - s);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
53 if (entry->scroll < s)
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
54 offset = gnt_util_onscreen_width(entry->scroll, s);
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
55 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
56 else
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
57 suggest = g_strdup(entry->start);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
58 len = strlen(suggest); /* Don't need to use the utf8-function here */
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
59
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
60 if (entry->ddown == NULL)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
61 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
62 GntWidget *box = gnt_vbox_new(FALSE);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
63 entry->ddown = gnt_tree_new();
14105
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14094
diff changeset
64 gnt_tree_set_compare_func(GNT_TREE(entry->ddown), (GCompareFunc)g_utf8_collate);
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
65 gnt_box_add_widget(GNT_BOX(box), entry->ddown);
14477
ca36763497d9 [gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
66 /* XXX: Connect to the "activate" signal for the dropdown tree */
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
67
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
68 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
69
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
70 gnt_widget_get_position(GNT_WIDGET(entry), &x, &y);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
71 x += offset;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
72 y++;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
73 if (y + 10 >= getmaxy(stdscr))
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
74 y -= 11;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
75 gnt_widget_set_position(box, x, y);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
76
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
77 gnt_widget_draw(box);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
78 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
79 else
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
80 gnt_tree_remove_all(GNT_TREE(entry->ddown));
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
81
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
82 for (count = 0, iter = entry->suggests; iter; iter = iter->next)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
83 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
84 const char *text = iter->data;
14094
d0f3eba2717c [gaim-migrate @ 16723]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
85 if (g_ascii_strncasecmp(suggest, text, len) == 0 && strlen(text) >= len)
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
86 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
87 gnt_tree_add_row_after(GNT_TREE(entry->ddown), (gpointer)text,
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
88 gnt_tree_create_row(GNT_TREE(entry->ddown), text),
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
89 NULL, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
90 count++;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
91 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
92 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
93 g_free(suggest);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
94
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
95 if (count == 0)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
96 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
97 destroy_suggest(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
98 return FALSE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
99 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
100
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
101 return TRUE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
102 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
103
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
104 static void
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 gnt_entry_draw(GntWidget *widget)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 GntEntry *entry = GNT_ENTRY(widget);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108 int stop;
14041
27182f83b79b [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14031
diff changeset
109 gboolean focus;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110
14041
27182f83b79b [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14031
diff changeset
111 if ((focus = gnt_widget_has_focus(widget)))
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13888
diff changeset
112 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TEXT_NORMAL));
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13888
diff changeset
113 else
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13888
diff changeset
114 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D));
13979
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
115
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
116 if (entry->masked)
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
117 {
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
118 mvwhline(widget->window, 0, 0, gnt_ascii_only() ? '*' : ACS_BULLET,
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
119 g_utf8_pointer_to_offset(entry->scroll, entry->end));
13979
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
120 }
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
121 else
14307
7c91ba42b9ba [gaim-migrate @ 16997]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14256
diff changeset
122 mvwprintw(widget->window, 0, 0, "%s", entry->scroll);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
123
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
124 stop = gnt_util_onscreen_width(entry->scroll, entry->end);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125 if (stop < widget->priv.width)
14307
7c91ba42b9ba [gaim-migrate @ 16997]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14256
diff changeset
126 whline(widget->window, ENTRY_CHAR, widget->priv.width - stop);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
127
14041
27182f83b79b [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14031
diff changeset
128 if (focus)
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
129 mvwchgat(widget->window, 0, gnt_util_onscreen_width(entry->scroll, entry->cursor),
14625
3e193cf68660 [gaim-migrate @ 17357]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14578
diff changeset
130 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
131
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14351
diff changeset
132 GNTDEBUG;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
133 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
134
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
135 static void
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
136 gnt_entry_size_request(GntWidget *widget)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
137 {
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
138 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
139 {
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
140 widget->priv.height = 1;
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
141 widget->priv.width = 20;
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
142 }
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
143 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
144
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
145 static void
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
146 gnt_entry_map(GntWidget *widget)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
147 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
148 if (widget->priv.width == 0 || widget->priv.height == 0)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
149 gnt_widget_size_request(widget);
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14351
diff changeset
150 GNTDEBUG;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
151 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
152
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
153 static void
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
154 entry_redraw(GntWidget *widget)
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
155 {
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
156 gnt_entry_draw(widget);
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
157 gnt_widget_queue_update(widget);
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
158 }
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
159
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
160 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
161 move_back(GntWidget *widget, GList *null)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
162 {
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
163 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
164 if (entry->cursor <= entry->start)
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
165 return FALSE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
166 entry->cursor = g_utf8_find_prev_char(entry->start, entry->cursor);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
167 if (entry->cursor < entry->scroll)
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
168 entry->scroll = entry->cursor;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
169 entry_redraw(GNT_WIDGET(entry));
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
170 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
171 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
172
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
173 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
174 move_forward(GntWidget *widget, GList *list)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
175 {
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
176 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
177 if (entry->cursor >= entry->end)
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
178 return FALSE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
179 entry->cursor = g_utf8_find_next_char(entry->cursor, NULL);
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
180 while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= GNT_WIDGET(entry)->priv.width)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
181 entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
182 entry_redraw(GNT_WIDGET(entry));
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
183 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
184 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
185
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
186 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
187 backspace(GntWidget *widget, GList *null)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
188 {
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
189 int len;
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
190 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
191
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
192 if (entry->cursor <= entry->start)
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
193 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
194
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
195 len = entry->cursor - g_utf8_find_prev_char(entry->start, entry->cursor);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
196 entry->cursor -= len;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
197 memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
198 entry->end -= len;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
199
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
200 if (entry->scroll > entry->start)
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
201 entry->scroll = g_utf8_find_prev_char(entry->start, entry->scroll);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
202
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
203 entry_redraw(GNT_WIDGET(entry));
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
204 if (entry->ddown)
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
205 show_suggest_dropdown(entry);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
206 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
207 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
208
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
209 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
210 delkey(GntWidget *widget, GList *null)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
211 {
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
212 int len;
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
213 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
214
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
215 if (entry->cursor >= entry->end)
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
216 return FALSE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
217
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
218 len = g_utf8_find_next_char(entry->cursor, NULL) - entry->cursor;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
219 memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor - len + 1);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
220 entry->end -= len;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
221 entry_redraw(GNT_WIDGET(entry));
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
222
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
223 if (entry->ddown)
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
224 show_suggest_dropdown(entry);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
225 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
226 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
227
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
228 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
229 move_start(GntWidget *widget, GList *null)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
230 {
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
231 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
232 entry->scroll = entry->cursor = entry->start;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
233 entry_redraw(GNT_WIDGET(entry));
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
234 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
235 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
236
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
237 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
238 move_end(GntWidget *widget, GList *null)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
239 {
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
240 GntEntry *entry = GNT_ENTRY(widget);
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
241 entry->cursor = entry->end;
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
242 /* This should be better than this */
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
243 while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= GNT_WIDGET(entry)->priv.width)
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
244 entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
245 entry_redraw(GNT_WIDGET(entry));
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
246 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
247 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
248
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
249 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
250 history_prev(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
251 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
252 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
253 if (entry->histlength && entry->history->prev)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
254 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
255 entry->history = entry->history->prev;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
256 gnt_entry_set_text(entry, entry->history->data);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
257 destroy_suggest(entry);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
258
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
259 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
260 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
261 return FALSE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
262 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
263
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
264 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
265 history_next(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
266 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
267 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
268 if (entry->histlength && entry->history->next)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
269 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
270 if (entry->history->prev == NULL)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
271 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
272 /* Save the current contents */
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
273 char *text = g_strdup(gnt_entry_get_text(entry));
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
274 g_free(entry->history->data);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
275 entry->history->data = text;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
276 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
277
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
278 entry->history = entry->history->next;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
279 gnt_entry_set_text(entry, entry->history->data);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
280 destroy_suggest(entry);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
281
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
282 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
283 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
284 return FALSE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
285 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
286
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
287 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
288 suggest_show(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
289 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
290 return show_suggest_dropdown(GNT_ENTRY(widget));
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
291 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
292
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
293 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
294 suggest_next(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
295 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
296 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
297 if (entry->ddown) {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
298 gnt_widget_perform_action_named(entry->ddown, "move-down", NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
299 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
300 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
301 return FALSE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
302 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
303
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
304 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
305 suggest_prev(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
306 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
307 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
308 if (entry->ddown) {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
309 gnt_widget_perform_action_named(entry->ddown, "move-up", NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
310 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
311 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
312 return FALSE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
313 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
314
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
315 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
316 del_to_home(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
317 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
318 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
319 memmove(entry->start, entry->cursor, entry->end - entry->cursor);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
320 entry->end -= (entry->cursor - entry->start);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
321 entry->cursor = entry->scroll = entry->start;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
322 memset(entry->end, '\0', entry->buffer - (entry->end - entry->start));
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
323 entry_redraw(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
324 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
325 }
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
326
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
327 static gboolean
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
328 del_to_end(GntWidget *widget, GList *null)
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
329 {
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
330 GntEntry *entry = GNT_ENTRY(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
331 entry->end = entry->cursor;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
332 memset(entry->end, '\0', entry->buffer - (entry->end - entry->start));
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
333 entry_redraw(widget);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
334 return TRUE;
14213
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
335 }
28269422838f [gaim-migrate @ 16894]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
336
14828
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
337 static const char *
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
338 begin_word(const char *text, const char *begin)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
339 {
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
340 char ch;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
341 ch = *text;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
342 #define SAME(a,b) ((isalpha(a) && isalpha(b)) || (isdigit(a) && isdigit(b)) || (isblank(a) && isblank(b)))
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
343 while (--text >= begin) {
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
344 if (!SAME(ch, *text))
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
345 break;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
346 }
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
347 #undef SAME
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
348
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
349 return ++text;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
350 }
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
351
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
352 static gboolean
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
353 move_back_word(GntWidget *widget, GList *null)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
354 {
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
355 GntEntry *entry = GNT_ENTRY(widget);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
356 const char *iter = entry->cursor - 1;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
357 int count;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
358
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
359 if (iter < entry->start)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
360 return TRUE;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
361 iter = begin_word(iter, entry->start);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
362 entry->cursor = (char*)iter;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
363 if (entry->cursor < entry->scroll)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
364 entry->scroll = entry->cursor;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
365 entry_redraw(widget);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
366 return TRUE;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
367 }
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
368
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
369 static gboolean
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
370 del_prev_word(GntWidget *widget, GList *null)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
371 {
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
372 GntEntry *entry = GNT_ENTRY(widget);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
373 char *iter = entry->cursor - 1;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
374 int count;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
375
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
376 if (iter < entry->start)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
377 return TRUE;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
378 iter = (char*)begin_word(iter, entry->start);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
379 count = entry->cursor - iter;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
380 memmove(iter, entry->cursor, entry->end - entry->cursor);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
381 entry->end -= count;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
382 entry->cursor = iter;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
383 if (entry->cursor <= entry->scroll) {
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
384 entry->scroll = entry->cursor - widget->priv.width + 2;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
385 if (entry->scroll < entry->start)
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
386 entry->scroll = entry->start;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
387 }
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
388 memset(entry->end, '\0', entry->buffer - (entry->end - entry->start));
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
389 entry_redraw(widget);
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
390
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
391 return TRUE;
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
392 }
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
393
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
394 static gboolean
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
395 gnt_entry_key_pressed(GntWidget *widget, const char *text)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
396 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
397 GntEntry *entry = GNT_ENTRY(widget);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
398
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
399 if (text[0] == 27)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
400 {
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
401 if (text[1] == 0)
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
402 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
403 destroy_suggest(entry);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
404 return TRUE;
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
405 }
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
406
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
407 return FALSE;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
408 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
409 else
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
410 {
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
411 if (text[0] == '\t')
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
412 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
413 if (entry->ddown)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
414 destroy_suggest(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
415 else if (entry->suggests)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
416 return show_suggest_dropdown(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
417
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
418 return FALSE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
419 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
420 else if (text[0] == '\r' && entry->ddown)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
421 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
422 char *text = g_strdup(gnt_tree_get_selection_data(GNT_TREE(entry->ddown)));
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
423 destroy_suggest(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
424 if (entry->word)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
425 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
426 char *s = get_beginning_of_word(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
427 char *iter = text;
14309
578a2c9af05e [gaim-migrate @ 16999]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14307
diff changeset
428 while (*iter && toupper(*s) == toupper(*iter))
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
429 {
14094
d0f3eba2717c [gaim-migrate @ 16723]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
430 *s++ = *iter++;
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
431 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
432 gnt_entry_key_pressed(widget, iter);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
433 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
434 else
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
435 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
436 gnt_entry_set_text(entry, text);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
437 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
438 g_free(text);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
439 return TRUE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
440 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
441
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
442 if (!iscntrl(text[0]))
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
443 {
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
444 const char *str, *next;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
445
14351
1bd09d355f9e [gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14311
diff changeset
446 for (str = text; *str; str = next)
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
447 {
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
448 int len;
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
449 next = g_utf8_find_next_char(str, NULL);
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
450 len = next - str;
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
451
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
452 /* Valid input? */
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
453 /* XXX: Is it necessary to use _unichar_ variants here? */
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
454 if (ispunct(*str) && (entry->flag & GNT_ENTRY_FLAG_NO_PUNCT))
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
455 continue;
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
456 if (isspace(*str) && (entry->flag & GNT_ENTRY_FLAG_NO_SPACE))
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
457 continue;
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
458 if (isalpha(*str) && !(entry->flag & GNT_ENTRY_FLAG_ALPHA))
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
459 continue;
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
460 if (isdigit(*str) && !(entry->flag & GNT_ENTRY_FLAG_INT))
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
461 continue;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
462
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
463 /* Reached the max? */
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
464 if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max)
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
465 continue;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
466
14745
61416f315d1c [gaim-migrate @ 17502]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14729
diff changeset
467 if (entry->end + len - entry->start >= entry->buffer)
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
468 {
14745
61416f315d1c [gaim-migrate @ 17502]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14729
diff changeset
469 /* This will cause the buffer to grow */
61416f315d1c [gaim-migrate @ 17502]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14729
diff changeset
470 char *tmp = g_strdup_printf("%s%*s", entry->start, len, "");
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
471 gnt_entry_set_text(entry, tmp);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
472 g_free(tmp);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
473 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
474
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
475 memmove(entry->cursor + len, entry->cursor, entry->end - entry->cursor + 1);
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
476 entry->end += len;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
477
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
478 while (str < next)
14216
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
479 {
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
480 if (*str == '\r' || *str == '\n')
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
481 *entry->cursor = ' ';
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
482 else
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
483 *entry->cursor = *str;
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
484 entry->cursor++;
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
485 str++;
e9dd2f76e61b [gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14213
diff changeset
486 }
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
487
14311
fda9dc44807d [gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14309
diff changeset
488 while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= widget->priv.width)
14028
4c939ea15004 [gaim-migrate @ 16630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
489 entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
490
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
491 if (entry->ddown)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
492 show_suggest_dropdown(entry);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
493 }
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
494 entry_redraw(widget);
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
495 return TRUE;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
496 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
497 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
498
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
499 return FALSE;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
500 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
501
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
502 static void
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
503 gnt_entry_destroy(GntWidget *widget)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
504 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
505 GntEntry *entry = GNT_ENTRY(widget);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
506 g_free(entry->start);
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
507
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
508 if (entry->history)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
509 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
510 entry->history = g_list_first(entry->history);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
511 g_list_foreach(entry->history, (GFunc)g_free, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
512 g_list_free(entry->history);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
513 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
514
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
515 if (entry->suggests)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
516 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
517 g_list_foreach(entry->suggests, (GFunc)g_free, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
518 g_list_free(entry->suggests);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
519 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
520
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
521 if (entry->ddown)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
522 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
523 gnt_widget_destroy(entry->ddown->parent);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
524 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
525 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
526
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
527 static void
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
528 gnt_entry_lost_focus(GntWidget *widget)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
529 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
530 GntEntry *entry = GNT_ENTRY(widget);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
531 destroy_suggest(entry);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
532 entry_redraw(widget);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
533 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
534
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
535 static void
13860
c1e3f7c75c3f [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13855
diff changeset
536 gnt_entry_class_init(GntEntryClass *klass)
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
537 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
538 parent_class = GNT_WIDGET_CLASS(klass);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
539 parent_class->destroy = gnt_entry_destroy;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
540 parent_class->draw = gnt_entry_draw;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
541 parent_class->map = gnt_entry_map;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
542 parent_class->size_request = gnt_entry_size_request;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
543 parent_class->key_pressed = gnt_entry_key_pressed;
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
544 parent_class->lost_focus = gnt_entry_lost_focus;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
545
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
546 parent_class->actions = g_hash_table_duplicate(parent_class->actions, g_str_hash,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
547 g_str_equal, g_free, (GDestroyNotify)gnt_widget_action_free);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
548 parent_class->bindings = g_hash_table_duplicate(parent_class->bindings, g_str_hash,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
549 g_str_equal, g_free, (GDestroyNotify)gnt_widget_action_param_free);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
550
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
551 gnt_widget_class_register_action(parent_class, "cursor-home", move_start,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
552 GNT_KEY_CTRL_A, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
553 gnt_widget_register_binding(parent_class, "cursor-home", "\033" GNT_KEY_HOME, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
554 gnt_widget_class_register_action(parent_class, "cursor-end", move_end,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
555 GNT_KEY_CTRL_E, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
556 gnt_widget_register_binding(parent_class, "cursor-end", "\033" GNT_KEY_END, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
557 gnt_widget_class_register_action(parent_class, "delete-prev", backspace,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
558 GNT_KEY_BACKSPACE, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
559 gnt_widget_class_register_action(parent_class, "delete-next", delkey,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
560 "\033" GNT_KEY_DEL, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
561 gnt_widget_register_binding(parent_class, "delete-next", GNT_KEY_CTRL_D, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
562 gnt_widget_class_register_action(parent_class, "delete-start", del_to_home,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
563 GNT_KEY_CTRL_U, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
564 gnt_widget_class_register_action(parent_class, "delete-end", del_to_end,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
565 GNT_KEY_CTRL_K, NULL);
14828
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
566 gnt_widget_class_register_action(parent_class, "delete-prev-word", del_prev_word,
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
567 NULL, NULL);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
568 #if 0
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
569 gnt_widget_class_register_action(parent_class, "delete-next-word", del_next_word,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
570 NULL, 1, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
571 #endif
14828
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
572 gnt_widget_class_register_action(parent_class, "cursor-prev-word", move_back_word,
91a89d5ef714 [gaim-migrate @ 17595]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14827
diff changeset
573 NULL, NULL);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
574 gnt_widget_class_register_action(parent_class, "cursor-prev", move_back,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
575 "\033" GNT_KEY_LEFT, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
576 gnt_widget_class_register_action(parent_class, "cursor-next", move_forward,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
577 "\033" GNT_KEY_RIGHT, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
578 gnt_widget_class_register_action(parent_class, "suggest-show", suggest_show,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
579 "\t", NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
580 gnt_widget_class_register_action(parent_class, "suggest-next", suggest_next,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
581 "\033" GNT_KEY_DOWN, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
582 gnt_widget_class_register_action(parent_class, "suggest-prev", suggest_prev,
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
583 "\033" GNT_KEY_UP, NULL);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
584 gnt_widget_class_register_action(parent_class, "history-prev", history_prev,
14827
02b70dc43044 [gaim-migrate @ 17594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14793
diff changeset
585 "\033" GNT_KEY_CTRL_DOWN, NULL);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
586 gnt_widget_class_register_action(parent_class, "history-next", history_next,
14827
02b70dc43044 [gaim-migrate @ 17594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14793
diff changeset
587 "\033" GNT_KEY_CTRL_UP, NULL);
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
588
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
589 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), klass);
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14745
diff changeset
590
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14351
diff changeset
591 GNTDEBUG;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
592 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
593
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
594 static void
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
595 gnt_entry_init(GTypeInstance *instance, gpointer class)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
596 {
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
597 GntWidget *widget = GNT_WIDGET(instance);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
598 GntEntry *entry = GNT_ENTRY(instance);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
599
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
600 entry->flag = GNT_ENTRY_FLAG_ALL;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
601 entry->max = 0;
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
602
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
603 entry->histlength = 0;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
604 entry->history = NULL;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
605
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
606 entry->word = TRUE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
607 entry->always = FALSE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
608 entry->suggests = NULL;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
609
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
610 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry),
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
611 GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_CAN_TAKE_FOCUS);
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
612 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), GNT_WIDGET_GROW_X);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
613
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
614 widget->priv.minw = 3;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
615 widget->priv.minh = 1;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
616
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14351
diff changeset
617 GNTDEBUG;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
618 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
619
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
620 /******************************************************************************
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
621 * GntEntry API
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
622 *****************************************************************************/
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
623 GType
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
624 gnt_entry_get_gtype(void)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
625 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
626 static GType type = 0;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
627
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
628 if(type == 0)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
629 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
630 static const GTypeInfo info = {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
631 sizeof(GntEntryClass),
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
632 NULL, /* base_init */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
633 NULL, /* base_finalize */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
634 (GClassInitFunc)gnt_entry_class_init,
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
635 NULL, /* class_finalize */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
636 NULL, /* class_data */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
637 sizeof(GntEntry),
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
638 0, /* n_preallocs */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
639 gnt_entry_init, /* instance_init */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
640 };
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
641
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
642 type = g_type_register_static(GNT_TYPE_WIDGET,
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
643 "GntEntry",
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
644 &info, 0);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
645 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
646
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
647 return type;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
648 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
649
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
650 GntWidget *gnt_entry_new(const char *text)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
651 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
652 GntWidget *widget = g_object_new(GNT_TYPE_ENTRY, NULL);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
653 GntEntry *entry = GNT_ENTRY(widget);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
654
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
655 gnt_entry_set_text(entry, text);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
656
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
657 return widget;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
658 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
659
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
660 void gnt_entry_set_text(GntEntry *entry, const char *text)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
661 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
662 int len;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
663 int scroll, cursor;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
664
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
665 g_free(entry->start);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
666
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
667 if (text && text[0])
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
668 {
14031
942170284c55 [gaim-migrate @ 16633]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14028
diff changeset
669 len = strlen(text);
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
670 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
671 else
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
672 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
673 len = 0;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
674 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
675
14031
942170284c55 [gaim-migrate @ 16633]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14028
diff changeset
676 entry->buffer = len + 128;
942170284c55 [gaim-migrate @ 16633]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14028
diff changeset
677
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
678 scroll = entry->scroll - entry->start;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
679 cursor = entry->end - entry->cursor;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
680
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
681 entry->start = g_new0(char, entry->buffer);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
682 if (text)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
683 snprintf(entry->start, len + 1, "%s", text);
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
684 entry->end = entry->start + len;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
685
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
686 entry->scroll = entry->start + scroll;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
687 entry->cursor = entry->end - cursor;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
688
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
689 if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(entry), GNT_WIDGET_MAPPED))
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
690 entry_redraw(GNT_WIDGET(entry));
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
691 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
692
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
693 void gnt_entry_set_max(GntEntry *entry, int max)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
694 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
695 entry->max = max;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
696 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
697
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
698 void gnt_entry_set_flag(GntEntry *entry, GntEntryFlag flag)
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
699 {
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
700 entry->flag = flag;
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
701 /* XXX: Check the existing string to make sure the flags are respected? */
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
702 }
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
703
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
704 const char *gnt_entry_get_text(GntEntry *entry)
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
705 {
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
706 return entry->start;
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
707 }
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
708
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
709 void gnt_entry_clear(GntEntry *entry)
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
710 {
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
711 gnt_entry_set_text(entry, NULL);
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
712 entry->scroll = entry->cursor = entry->end = entry->start;
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
713 entry_redraw(GNT_WIDGET(entry));
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
714 destroy_suggest(entry);
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
715 }
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
716
13979
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
717 void gnt_entry_set_masked(GntEntry *entry, gboolean set)
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
718 {
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
719 entry->masked = set;
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
720 }
13882
5c750626eaa5 [gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
721
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
722 void gnt_entry_add_to_history(GntEntry *entry, const char *text)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
723 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
724 g_return_if_fail(entry->history != NULL); /* Need to set_history_length first */
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
725
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
726 if (g_list_length(entry->history) >= entry->histlength)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
727 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
728
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
729 entry->history = g_list_first(entry->history);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
730 g_free(entry->history->data);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
731 entry->history->data = g_strdup(text);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
732 entry->history = g_list_prepend(entry->history, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
733 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
734
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
735 void gnt_entry_set_history_length(GntEntry *entry, int num)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
736 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
737 if (num == 0)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
738 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
739 entry->histlength = num;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
740 if (entry->history)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
741 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
742 entry->history = g_list_first(entry->history);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
743 g_list_foreach(entry->history, (GFunc)g_free, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
744 g_list_free(entry->history);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
745 entry->history = NULL;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
746 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
747 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
748 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
749
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
750 if (entry->histlength == 0)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
751 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
752 entry->histlength = num;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
753 entry->history = g_list_append(NULL, NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
754 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
755 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
756
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
757 if (num > 0 && num < entry->histlength)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
758 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
759 GList *first, *iter;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
760 int index = 0;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
761 for (first = entry->history, index = 0; first->prev; first = first->prev, index++);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
762 while ((iter = g_list_nth(first, num)) != NULL)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
763 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
764 g_free(iter->data);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
765 first = g_list_delete_link(first, iter);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
766 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
767 entry->histlength = num;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
768 if (index >= num)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
769 entry->history = g_list_last(first);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
770 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
771 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
772
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
773 entry->histlength = num;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
774 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
775
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
776 void gnt_entry_set_word_suggest(GntEntry *entry, gboolean word)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
777 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
778 entry->word = word;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
779 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
780
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
781 void gnt_entry_set_always_suggest(GntEntry *entry, gboolean always)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
782 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
783 entry->always = always;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
784 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
785
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
786 void gnt_entry_add_suggest(GntEntry *entry, const char *text)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
787 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
788 GList *find;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
789
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
790 if (!text || !*text)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
791 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
792
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
793 find = g_list_find_custom(entry->suggests, text, (GCompareFunc)g_utf8_collate);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
794 if (find)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
795 return;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
796 entry->suggests = g_list_append(entry->suggests, g_strdup(text));
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
797 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
798
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
799 void gnt_entry_remove_suggest(GntEntry *entry, const char *text)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
800 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
801 GList *find = g_list_find_custom(entry->suggests, text, (GCompareFunc)g_utf8_collate);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
802 if (find)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
803 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
804 g_free(find->data);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
805 entry->suggests = g_list_delete_link(entry->suggests, find);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
806 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
807 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14041
diff changeset
808