Include e-select-names-factory.h.

2000-07-08  Christopher James Lahey  <clahey@helixcode.com>

	* gui/component/addressbook-factory.c: Include
	e-select-names-factory.h.

	* gui/component/select-names/e-select-names-model.c: Handle a NULL
	iterator properly in the replace function.

	* gui/component/select-names/e-select-names-table-model.c: Fill in
	info properly in the value_at function.

	* gui/component/select-names/e-select-names-text-model.c: Don't
	strlen a NULL text object.

	* gui/component/select-names/e-select-names.c: Close if the person
	hits ok or cancel (doesn't yet actually undo changes if Cancel is
	hit.)  Handle removing addresses when they're double clicked on.

	* gui/component/select-names/select-names.glade,
	gui/component/select-names/select-names.glade.h: Hid some unused
	fields and changed the text at the top of the dialog.

svn path=/trunk/; revision=3989
This commit is contained in:
Christopher James Lahey
2000-07-09 01:24:53 +00:00
committed by Chris Lahey
parent 1150b8d1b3
commit a451a634c2
8 changed files with 86 additions and 8 deletions

View File

@ -1,3 +1,25 @@
2000-07-08 Christopher James Lahey <clahey@helixcode.com>
* gui/component/addressbook-factory.c: Include
e-select-names-factory.h.
* gui/component/select-names/e-select-names-model.c: Handle a NULL
iterator properly in the replace function.
* gui/component/select-names/e-select-names-table-model.c: Fill in
info properly in the value_at function.
* gui/component/select-names/e-select-names-text-model.c: Don't
strlen a NULL text object.
* gui/component/select-names/e-select-names.c: Close if the person
hits ok or cancel (doesn't yet actually undo changes if Cancel is
hit.) Handle removing addresses when they're double clicked on.
* gui/component/select-names/select-names.glade,
gui/component/select-names/select-names.glade.h: Hid some unused
fields and changed the text at the top of the dialog.
2000-07-08 Jeffrey Stedfast <fejj@helixcode.com>
* gui/component/select-names/.cvsignore: Ignore dynamically

View File

@ -16,6 +16,7 @@
#include "addressbook.h"
#include "addressbook-component.h"
#include "select-names/e-select-names-factory.h"
#ifdef USING_OAF

View File

@ -260,6 +260,8 @@ e_select_names_model_insert (ESelectNamesModel *model,
iterator = e_list_get_iterator(model->data);
index = 0;
} else {
gtk_object_ref(GTK_OBJECT(iterator));
}
if (strings[0]) {
ESelectNamesModelData *node = (void *) e_iterator_get(iterator);
@ -288,6 +290,7 @@ e_select_names_model_insert (ESelectNamesModel *model,
g_free(node);
}
e_select_names_model_changed(model);
gtk_object_unref(GTK_OBJECT(iterator));
}
void
@ -347,6 +350,16 @@ e_select_names_model_replace (ESelectNamesModel *model,
int length,
char *data)
{
if (iterator == NULL) {
ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""};
e_list_append(model->data, &new);
iterator = e_list_get_iterator(model->data);
index = 0;
} else {
gtk_object_ref(GTK_OBJECT(iterator));
}
while (length > 0 && e_iterator_is_valid(iterator)) {
ESelectNamesModelData *node = (void *) e_iterator_get(iterator);
int this_length = strlen(node->string);
@ -377,10 +390,14 @@ e_select_names_model_replace (ESelectNamesModel *model,
if (!e_iterator_is_valid(iterator)) {
ESelectNamesModelData *node;
e_iterator_last(iterator);
node = (void *) e_iterator_get(iterator);
index = strlen(node->string);
if (e_iterator_is_valid(iterator)) {
node = (void *) e_iterator_get(iterator);
index = strlen(node->string);
} else
index = 0;
}
e_select_names_model_insert (model, iterator, index, data);
gtk_object_unref(GTK_OBJECT(iterator));
}

View File

@ -195,6 +195,7 @@ e_select_names_table_model_value_at (ETableModel *etc, int col, int row)
{
ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc);
if (e_select_names_table_model->data == NULL) {
fill_in_info(e_select_names_table_model);
}
switch (col) {
case 0:

View File

@ -123,6 +123,10 @@ e_select_names_text_model_set_text (ETextModel *model, gchar *text)
{
ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source;
EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source));
int length = 0;
if (model->text) {
length = strlen(model->text);
}
e_iterator_reset(iterator);
if (!e_iterator_is_valid(iterator)) {
@ -132,7 +136,7 @@ e_select_names_text_model_set_text (ETextModel *model, gchar *text)
e_select_names_model_replace(source,
iterator,
0,
strlen(model->text),
length,
text);
if (iterator)
gtk_object_unref(GTK_OBJECT(iterator));
@ -230,7 +234,8 @@ e_select_names_text_model_model_changed (ESelectNamesModel *source,
length ++;
length_count++;
}
length --;
if (length > 0)
length --;
g_free(model->lengths);
model->lengths = g_new(int, length_count + 1);
@ -249,8 +254,10 @@ e_select_names_text_model_model_changed (ESelectNamesModel *source,
*(stringp++) = ',';
*(lengthsp++) = this_length;
}
stringp --;
*stringp = 0;
if (stringp != string) {
stringp --;
*stringp = 0;
}
*lengthsp = -1;
g_free(E_TEXT_MODEL(model)->text);
E_TEXT_MODEL(model)->text = string;

View File

@ -168,6 +168,17 @@ set_current_selection(ETable *table, int row, ESelectNames *names)
names->currently_selected = row;
}
static void
e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNames *data)
{
switch(button) {
case 0:
break;
case 1:
break;
}
}
static void
e_select_names_init (ESelectNames *e_select_names)
{
@ -194,6 +205,9 @@ e_select_names_init (ESelectNames *e_select_names)
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gtk_signal_connect(GTK_OBJECT(e_select_names), "clicked",
GTK_SIGNAL_FUNC(e_select_names_clicked), e_select_names);
e_select_names->table = E_TABLE(glade_xml_get_widget(gui, "table-source"));
e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model");
@ -292,6 +306,17 @@ button_clicked(GtkWidget *button, ESelectNamesChild *child)
}
}
static void
remove_address(ETable *table, int row, ESelectNamesChild *child)
{
EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(child->source));
e_iterator_reset(iterator);
for (; row > 0; row--) {
e_iterator_next(iterator);
}
e_select_names_model_remove_item(child->source, iterator);
}
void
e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source)
{
@ -340,6 +365,9 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
g_str_compare, TRUE), 0);
etable = e_table_new (header, model, SPEC2);
gtk_signal_connect(GTK_OBJECT(etable), "double_click",
GTK_SIGNAL_FUNC(remove_address), child);
gtk_object_set(GTK_OBJECT(etable),
"cursor_mode", E_TABLE_CURSOR_LINE,
NULL);

View File

@ -114,6 +114,7 @@
<widget>
<class>GtkEntry</class>
<name>entry-find</name>
<visible>False</visible>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
@ -130,6 +131,7 @@
<widget>
<class>GtkButton</class>
<name>button-find</name>
<visible>False</visible>
<can_focus>True</can_focus>
<label>Find...</label>
<child>
@ -143,7 +145,7 @@
<widget>
<class>GtkAccelLabel</class>
<name>accellabel1</name>
<label>T_ype name or select from List:</label>
<label>Select name from List:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0</xalign>

View File

@ -6,5 +6,5 @@
gchar *s = N_("Select Names");
gchar *s = N_("Find...");
gchar *s = N_("T_ype name or select from List:");
gchar *s = N_("Select name from List:");
gchar *s = N_("Message Recipients");