diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-06-09 01:12:12 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-06-09 01:12:12 +0800 |
commit | 227fab86efce103776af0364cbfd3f1959f9d269 (patch) | |
tree | 195524b2ea72d5b012ca9345a3f164000b09b61c /addressbook/contact-editor/test-editor.c | |
parent | 1396db5dc3fd395059d4bbe6cd0d8422110d0b81 (diff) | |
download | gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar.gz gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar.bz2 gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar.lz gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar.xz gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.tar.zst gsoc2013-evolution-227fab86efce103776af0364cbfd3f1959f9d269.zip |
Now this derives from GtkObject. It follows the same strategy as the
2000-06-08 Federico Mena Quintero <federico@helixcode.com>
* contact-editor/e-contact-editor.h (EContactEditor): Now this
derives from GtkObject. It follows the same strategy as the
EventEditor in the calendar.
(EContactEditor): Added an is_new_card field so that we can know
whether to add() or commit() the card.
* contact-editor/e-contact-editor.c (e_contact_editor_get_type):
Derive from GtkObject.
(e_contact_editor_class_init): Likewise.
(e_contact_editor_class_init): Added an "is_new_card" argument.
(e_contact_editor_set_arg): Handle ARG_IS_NEW_CARD.
(e_contact_editor_get_arg): Likewise.
(e_contact_editor_new): Take in an is_new_arg argument and set it
on the object.
(e_contact_editor_init): Load the app widget into the app field of
the EContactEditor structure. Create its UIHandler as well.
(e_contact_editor_class_init): New "add_card", "commit_card", and
"editor_closed" signals.
* contact-editor/test-editor.c (main): Modified for the new API.
(editor_closed_cb): Tweaked for the new API.
Since this test program does not use Bonobo, it doesn't work,
though.
* gui/component/addressbook.c (new_contact_cb): Use the new
contact editor API.
(table_double_click): Ditto.
* gui/minicard/e-minicard-view.c (e_minicard_view_event): Use the
new contact editor API.
* gui/minicard/e-minicard.c (e_minicard_event): Use the new
contact editor API.
svn path=/trunk/; revision=3479
Diffstat (limited to 'addressbook/contact-editor/test-editor.c')
-rw-r--r-- | addressbook/contact-editor/test-editor.c | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/addressbook/contact-editor/test-editor.c b/addressbook/contact-editor/test-editor.c index 5b48c1a92f..80db2fe848 100644 --- a/addressbook/contact-editor/test-editor.c +++ b/addressbook/contact-editor/test-editor.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-editor.c * Copyright (C) 2000 Helix Code, Inc. * Author: Chris Lahey <clahey@helixcode.com> @@ -75,21 +75,23 @@ read_file (char *name) return g_strdup (buff); } -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) +/* Callback used when a contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) { static int count = 2; - count --; - if ( count <= 0 ) - exit(0); + + count--; + gtk_object_unref (GTK_OBJECT (ce)); + + if (count == 0) + exit (0); } #if 0 static void about_callback( GtkWidget *widget, gpointer data ) { - + const gchar *authors[] = { "Christopher James Lahey <clahey@umich.edu>", @@ -102,57 +104,39 @@ static void about_callback( GtkWidget *widget, gpointer data ) authors, _( "This should test the contact editor canvas item" ), NULL); - gtk_widget_show (about); + gtk_widget_show (about); } #endif int main( int argc, char *argv[] ) { char *cardstr; - GtkWidget *app; - + EContactEditor *ce; + /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE);*/ - + gnome_init( "Contact Editor Test", VERSION, argc, argv); - + glade_gnome_init (); - - app = gnome_app_new("Contact Editor Test", NULL); - + cardstr = NULL; if (argc == 2) cardstr = read_file (argv [1]); - + if (cardstr == NULL) cardstr = TEST_VCARD; - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + gtk_main(); + /* Not reached. */ return 0; } |