diff options
author | Chris Toshok <toshok@ximian.com> | 2003-03-12 11:19:13 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-03-12 11:19:13 +0800 |
commit | e5b1a4903064d14bf421a9275ec4cdd85a7973a0 (patch) | |
tree | feda37762375aa8e8e9ff36bb733a72ecb1b8e97 /addressbook/gui | |
parent | ed138c113d6171fa4513474e300d6b9fb45a39ec (diff) | |
download | gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar.gz gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar.bz2 gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar.lz gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar.xz gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.tar.zst gsoc2013-evolution-e5b1a4903064d14bf421a9275ec4cdd85a7973a0.zip |
fix compiler warnings about deprecated functions.
2003-03-11 Chris Toshok <toshok@ximian.com>
* gui/component/select-names/e-select-names.c
(e_select_names_init): fix compiler warnings about deprecated
functions.
(e_select_names_child_free): unref the table model.
(remove_address): re-enable.
(section_right_click_cb): this is an ETable callback now.
(e_select_names_add_section): remove a gross gross awful hack, and
make the recipient tables ETables instead EEntry's. We lose the
nice underlining, but we can add that back in as another ETable
style (like strikeout and bold), and we also fix the longstanding
scrolling problems (like bug #25148) and can finally remove
addresses by double clicking on them (which is also a bug
someplace I think.. dunno the # offhand.)
* gui/component/select-names/e-select-names-table-model.c
(clear_info): always set the count to -1, regardless of what
model->data is.
* gui/component/select-names/e-select-names-model.c: remove some
unused enums.
* gui/component/select-names/Makefile.am (etspec_DATA): add
e-select-names-section.etspec
* gui/component/select-names/e-select-names-section.etspec: new
file, spec for the To:/Cc:/Bcc: etable's in the select-names
dialog.
svn path=/trunk/; revision=20259
Diffstat (limited to 'addressbook/gui')
5 files changed, 41 insertions, 77 deletions
diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am index 0ccc838d37..008980612f 100644 --- a/addressbook/gui/component/select-names/Makefile.am +++ b/addressbook/gui/component/select-names/Makefile.am @@ -94,7 +94,7 @@ e-select-names-marshal.c: e-select-names-marshal.h MARSHAL_GENERATED = e-select-names-marshal.c e-select-names-marshal.h glade_DATA = select-names.glade -etspec_DATA = e-select-names.etspec +etspec_DATA = e-select-names.etspec e-select-names-section.etspec EXTRA_DIST = \ $(glade_DATA) \ diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c index 65ae293174..4c99d68f22 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -38,17 +38,6 @@ enum { ARG_CARD, }; -enum { - NAME_DATA_BLANK, - NAME_DATA_CARD, - NAME_DATA_STRING -}; - -enum { - NAME_FORMAT_GIVEN_FIRST, - NAME_FORMAT_FAMILY_FIRST -}; - struct _ESelectNamesModelPrivate { gchar *id; gchar *title; diff --git a/addressbook/gui/component/select-names/e-select-names-section.etspec b/addressbook/gui/component/select-names/e-select-names-section.etspec new file mode 100644 index 0000000000..ba3f68f4b4 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-section.etspec @@ -0,0 +1,7 @@ +<ETableSpecification no-headers="true" cursor-mode="line"> + <ETableColumn model_col= "0" _title="Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="collate" search="string"/> + <ETableState> + <column source="0"/> + <grouping> <leaf column="0" ascending="true"/> </grouping> + </ETableState> +</ETableSpecification> diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c index 04c6a80f88..96d20b3e53 100644 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ b/addressbook/gui/component/select-names/e-select-names-table-model.c @@ -154,8 +154,9 @@ clear_info (ESelectNamesTableModel *model) } g_free(model->data); model->data = NULL; - model->count = -1; } + + model->count = -1; } /* diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index d916c2d832..ed8a3c3c45 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -42,7 +42,7 @@ #include "e-select-names.h" #include <addressbook/backend/ebook/e-card-simple.h> -#include "e-select-names-text-model.h" +#include "e-select-names-table-model.h" #include <gal/widgets/e-categories-master-list-option-menu.h> #include <gal/e-text/e-entry.h> #include <e-util/e-categories-master-list-wombat.h> @@ -63,12 +63,13 @@ enum { }; typedef struct { - char *title; - ESelectNamesModel *source; - ESelectNamesTextModel *text_model; - ESelectNames *names; - GtkWidget *label; - GtkWidget *button; + char *title; + ESelectNamesModel *source; + ESelectNamesTableModel *table_model; + ESelectNames *names; + GtkWidget *label; + GtkWidget *button; + GtkWidget *recipient_table; } ESelectNamesChild; GType @@ -492,10 +493,10 @@ e_select_names_init (ESelectNames *e_select_names) gtk_dialog_set_default_response (GTK_DIALOG (e_select_names), GTK_RESPONSE_OK); - gtk_window_set_modal (GTK_DIALOG (e_select_names), TRUE); + gtk_window_set_modal (GTK_WINDOW (e_select_names), TRUE); gtk_window_set_title(GTK_WINDOW(e_select_names), _("Select Contacts from Addressbook")); - gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE); + gtk_window_set_resizable(GTK_WINDOW(e_select_names), TRUE); e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source")); e_select_names->model = g_object_get_data(G_OBJECT(e_select_names->table), "model"); @@ -580,7 +581,7 @@ static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESele 0, 0, NULL, G_CALLBACK (sync_table_and_models), e_select_names); g_free(child->title); - g_object_unref(child->text_model); + g_object_unref(child->table_model); g_object_unref(child->source); g_free(key); g_free(child); @@ -637,70 +638,42 @@ button_clicked(GtkWidget *button, ESelectNamesChild *child) real_add_address(child->names, child); } -#if 0 static void remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child) { e_select_names_model_delete (child->source, row); } -#endif struct _RightClickData { ESelectNamesChild *child; - int index; + int row; }; typedef struct _RightClickData RightClickData; -#if 0 -static GSList *selected_rows = NULL; - -static void -etable_selection_foreach_cb (int row, void *data) -{ - /* Build a list of rows in reverse order, then remove them, - necessary because otherwise it'll start trying to delete - rows out of index in ETableModel */ - selected_rows = g_slist_prepend (selected_rows, GINT_TO_POINTER (row)); -} - -static void -selected_rows_foreach_cb (void *row, void *data) -{ - ESelectNamesChild *child = data; - - remove_address (NULL, GPOINTER_TO_INT (row), 0, NULL, child); -} -#endif - static void remove_cb (GtkWidget *widget, void *data) { RightClickData *rcdata = (RightClickData *)data; - e_select_names_model_delete (rcdata->child->source, rcdata->index); + e_select_names_model_delete (rcdata->child->source, rcdata->row); /* Free everything we've created */ g_free (rcdata); } static void -section_right_click_cb (EText *text, GdkEventButton *ev, gint pos, ESelectNamesChild *child) +section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child) { - EPopupMenu right_click_menu[] = { + static EPopupMenu right_click_menu[] = { E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0), E_POPUP_TERMINATOR }; - gint index; - - e_select_names_model_text_pos (child->source, child->text_model->seplen, pos, &index, NULL, NULL); + RightClickData *rcdata = g_new0 (RightClickData, 1); - if (index != -1) { - RightClickData *rcdata = g_new0 (RightClickData, 1); - rcdata->index = index; - rcdata->child = child; + rcdata->row = row; + rcdata->child = child; - e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata); - } + e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata); } void @@ -715,7 +688,6 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E ETable *etable; GtkWidget *sw; - GtkWidget *recipient_table; if (g_hash_table_lookup(e_select_names->children, id)) { return; @@ -728,8 +700,7 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E child->names = e_select_names; child->title = g_strdup (_(name)); - child->text_model = (ESelectNamesTextModel *) e_select_names_text_model_new (source); - e_select_names_text_model_set_separator (child->text_model, "\n"); + child->table_model = (ESelectNamesTableModel*)e_select_names_table_model_new (source); child->source = source; g_object_ref(child->source); @@ -765,27 +736,23 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E etable = e_table_scrolled_get_table (e_select_names->table); gtk_widget_set_sensitive (button, e_table_selected_count (etable) > 0); - sw = gtk_scrolled_window_new (NULL, NULL); - recipient_table = e_entry_new (); - g_object_set (recipient_table, - "model", child->text_model, - "allow_newlines", TRUE, - NULL); + sw = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (child->table_model), + NULL, + EVOLUTION_ETSPECDIR "/e-select-names-section.etspec", + NULL); + child->recipient_table = GTK_WIDGET (e_table_scrolled_get_table (E_TABLE_SCROLLED (sw))); - g_signal_connect (recipient_table, - "popup", + g_signal_connect (child->recipient_table, + "right_click", G_CALLBACK (section_right_click_cb), child); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); -#if 0 - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "right_click", - G_CALLBACK(section_right_click_cb), child); - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "double_click", + g_signal_connect(child->recipient_table, "double_click", G_CALLBACK(remove_address), child); -#endif - g_signal_connect (child->source, "changed", |