aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/contact-editor/test-editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/contact-editor/test-editor.c')
-rw-r--r--addressbook/contact-editor/test-editor.c74
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;
}