aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-01-18 23:37:09 +0800
committerChris Lahey <clahey@src.gnome.org>2002-01-18 23:37:09 +0800
commita30eed771c00ccde2cd7a32c3f0a28057f247f84 (patch)
tree8349ad2f4b5f13af1cc188ee7d9771374a17d5cf
parent9380c68a1a8f6232a1faa0c169eee6b6c4ae889f (diff)
downloadgsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.tar.gz
gsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.tar.zst
gsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.zip
From addressbook/ChangeLog:
2002-01-18 Christopher James Lahey <clahey@ximian.com> * gui/component/addressbook.c (view_contact_cb): New verb to open a bunch of cards. * gui/widgets/e-addressbook-reflow-adapter.c (open_card): Call e_addressbook_show_multiple_cards instead of doing this ourselves. * gui/widgets/e-addressbook-util.c, gui/widgets/e-addressbook-util.h (e_addressbook_show_multiple_cards): Added this function to show a bunch of cards, including a dialog if lots of windows are going to appear. * gui/widgets/e-addressbook-view.c (e_addressbook_view_view, e_addressbook_view_can_view): e_addressbook_view_view calls e_addressbook_show_multiple_cards on the appropriate list of cards. From ui/ChangeLog: 2002-01-18 Christopher James Lahey <clahey@ximian.com> * evolution-addressbook.xml: Added File->Open which calls the ContactsView command. svn path=/trunk/; revision=15355
-rw-r--r--addressbook/ChangeLog19
-rw-r--r--addressbook/gui/component/addressbook.c13
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c33
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.c76
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.h23
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c21
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h2
-rw-r--r--ui/ChangeLog5
-rw-r--r--ui/evolution-addressbook.xml6
9 files changed, 163 insertions, 35 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index ed1786d858..b5b00450de 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,24 @@
2002-01-18 Christopher James Lahey <clahey@ximian.com>
+ * gui/component/addressbook.c (view_contact_cb): New verb to open
+ a bunch of cards.
+
+ * gui/widgets/e-addressbook-reflow-adapter.c (open_card): Call
+ e_addressbook_show_multiple_cards instead of doing this ourselves.
+
+ * gui/widgets/e-addressbook-util.c,
+ gui/widgets/e-addressbook-util.h
+ (e_addressbook_show_multiple_cards): Added this function to show a
+ bunch of cards, including a dialog if lots of windows are going to
+ appear.
+
+ * gui/widgets/e-addressbook-view.c (e_addressbook_view_view,
+ e_addressbook_view_can_view): e_addressbook_view_view calls
+ e_addressbook_show_multiple_cards on the appropriate list of
+ cards.
+
+2002-01-18 Christopher James Lahey <clahey@ximian.com>
+
* gui/contact-editor/e-contact-editor-address.c
(fill_in_countries), gui/contact-editor/fulladdr.glade: Sort
country list. Country list moves from fulladdr.glade to
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 38d44727ed..93c3bdf246 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -115,6 +115,14 @@ save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
+view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = (AddressbookView *) user_data;
+ if (view->view)
+ e_addressbook_view_view(view->view);
+}
+
+static void
config_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
addressbook_config (NULL /* XXX */);
@@ -243,6 +251,10 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"/commands/ContactsSaveAsVCard",
"sensitive",
e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL);
+ bonobo_ui_component_set_prop (uic,
+ "/commands/ContactsView",
+ "sensitive",
+ e_addressbook_view_can_view (view->view) ? "1" : "0", NULL);
/* Print Contact */
bonobo_ui_component_set_prop (uic,
@@ -311,6 +323,7 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsPrintPreview", print_preview_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
+ BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb),
BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb),
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 8c4507a5e3..06be8543c7 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -125,6 +125,7 @@ get_card_list (ModelAndSelection *mns)
for (iterator = list; iterator; iterator = iterator->next) {
iterator->data = e_addressbook_model_card_at (priv->model, GPOINTER_TO_INT (iterator->data));
+ gtk_object_ref (GTK_OBJECT (iterator->data));
}
list = g_list_reverse (list);
return list;
@@ -138,7 +139,7 @@ save_as (GtkWidget *widget, ModelAndSelection *mns)
list = get_card_list (mns);
if (list)
e_contact_list_save_as (_("Save as VCard"), list);
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
@@ -150,7 +151,7 @@ send_as (GtkWidget *widget, ModelAndSelection *mns)
list = get_card_list (mns);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
@@ -162,7 +163,7 @@ send_to (GtkWidget *widget, ModelAndSelection *mns)
list = get_card_list (mns);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
@@ -174,7 +175,7 @@ print (GtkWidget *widget, ModelAndSelection *mns)
list = get_card_list (mns);
if (list)
gtk_widget_show (e_contact_print_card_list_dialog_new (list));
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
@@ -187,7 +188,7 @@ print_envelope (GtkWidget *widget, ModelAndSelection *mns)
list = get_card_list (mns);
if (list)
gtk_widget_show (e_contact_print_envelope_list_dialog_new (list));
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
#endif
@@ -248,7 +249,7 @@ delete (GtkWidget *widget, ModelAndSelection *mns)
}
}
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
@@ -257,27 +258,13 @@ open_card (GtkWidget *widget, ModelAndSelection *mns)
{
EAddressbookReflowAdapterPrivate *priv = mns->adapter->priv;
GList *list;
+ EBook *book = e_addressbook_model_get_ebook(priv->model);
list = get_card_list (mns);
- if (list) {
- GList *iterator;
- EBook *book = e_addressbook_model_get_ebook(priv->model);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- ECard *card = iterator->data;
- if (e_card_evolution_list (card)) {
- e_addressbook_show_contact_list_editor (book, card,
- FALSE, e_addressbook_model_editable (priv->model));
- }
- else {
- e_addressbook_show_contact_editor (book, card,
- FALSE, e_addressbook_model_editable (priv->model));
- }
- }
- }
+ e_addressbook_show_multiple_cards (book, list, e_addressbook_model_editable (priv->model));
- g_list_free (list);
+ e_free_object_list (list);
model_and_selection_free (mns);
}
diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c
index fa29b61bba..c53e16a45c 100644
--- a/addressbook/gui/widgets/e-addressbook-util.c
+++ b/addressbook/gui/widgets/e-addressbook-util.c
@@ -146,3 +146,79 @@ e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
return ce;
}
+
+typedef struct {
+ EBook *book;
+ GList *list;
+ gboolean editable;
+} BookAndList;
+
+static void
+view_cards (EBook *book, GList *list, gboolean editable)
+{
+ for (; list; list = list->next) {
+ ECard *card = list->data;
+ if (e_card_evolution_list (card))
+ e_addressbook_show_contact_list_editor (book, card, FALSE, editable);
+ else
+ e_addressbook_show_contact_editor (book, card, FALSE, editable);
+ }
+}
+
+static void
+view_question_clicked (GtkObject *object, int button, BookAndList *bnl)
+{
+ GnomeDialog *dialog = GNOME_DIALOG (object);
+ switch (button) {
+ case 0:
+ view_cards (bnl->book, bnl->list, bnl->editable);
+ break;
+ }
+ gnome_dialog_close(dialog);
+}
+
+static void
+view_question_destroyed (GtkObject *object, GList *list)
+{
+ gtk_main_quit();
+}
+
+void
+e_addressbook_show_multiple_cards (EBook *book,
+ GList *list,
+ gboolean editable)
+{
+ if (list) {
+ int length = g_list_length (list);
+ if (length > 5) {
+ char *string;
+ GtkWidget *dialog;
+ BookAndList bnl;
+
+ bnl.book = book;
+ bnl.list = list;
+ bnl.editable = editable;
+
+ dialog = gnome_dialog_new (_("Display Cards?"),
+ _("Display Cards"),
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+
+ string = g_strdup_printf (_("You have requested that %d cards be cards. This will cause %d new windows to be\n"
+ "displayed on your screen. Do you really want to display all of these cards?"), length, length);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), gtk_label_new (string), FALSE, FALSE, 0);
+ g_free (string);
+
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (view_question_destroyed), &bnl);
+ gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
+ GTK_SIGNAL_FUNC (view_question_clicked), &bnl);
+
+ gtk_widget_show_all (dialog);
+
+ gtk_main();
+ } else {
+ view_cards (book, list, editable);
+ }
+ }
+}
diff --git a/addressbook/gui/widgets/e-addressbook-util.h b/addressbook/gui/widgets/e-addressbook-util.h
index 3eff236654..3fa28a542d 100644
--- a/addressbook/gui/widgets/e-addressbook-util.h
+++ b/addressbook/gui/widgets/e-addressbook-util.h
@@ -29,15 +29,20 @@ extern "C" {
#pragma }
#endif /* __cplusplus */
-void e_addressbook_error_dialog (const gchar *msg,
- EBookStatus status);
-gint e_addressbook_prompt_save_dialog (GtkWindow *parent);
-EContactEditor* e_addressbook_show_contact_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable);
-EContactListEditor * e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable);
+void e_addressbook_error_dialog (const gchar *msg,
+ EBookStatus status);
+gint e_addressbook_prompt_save_dialog (GtkWindow *parent);
+EContactEditor *e_addressbook_show_contact_editor (EBook *book,
+ ECard *card,
+ gboolean is_new_card,
+ gboolean editable);
+EContactListEditor *e_addressbook_show_contact_list_editor (EBook *book,
+ ECard *card,
+ gboolean is_new_card,
+ gboolean editable);
+void e_addressbook_show_multiple_cards (EBook *book,
+ GList *list,
+ gboolean editable);
#ifdef __cplusplus
}
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index a421400f3c..74e804f767 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -36,6 +36,7 @@
#include <gal/util/e-unicode-i18n.h>
#include <gal/unicode/gunicode.h>
#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-dialog.h>
@@ -1513,7 +1514,15 @@ e_addressbook_view_save_as (EAddressbookView *view)
GList *list = get_selected_cards (view);
if (list)
e_contact_list_save_as (_("Save as VCard"), list);
- g_list_free (list);
+ e_free_object_list(list);
+}
+
+void
+e_addressbook_view_view (EAddressbookView *view)
+{
+ GList *list = get_selected_cards (view);
+ e_addressbook_show_multiple_cards (view->book, list, view->editable);
+ e_free_object_list(list);
}
void
@@ -1522,7 +1531,7 @@ e_addressbook_view_send (EAddressbookView *view)
GList *list = get_selected_cards (view);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
- g_list_free (list);
+ e_free_object_list(list);
}
void
@@ -1531,7 +1540,7 @@ e_addressbook_view_send_to (EAddressbookView *view)
GList *list = get_selected_cards (view);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
- g_list_free (list);
+ e_free_object_list(list);
}
void
@@ -1612,6 +1621,12 @@ e_addressbook_view_can_save_as (EAddressbookView *view)
return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
}
+gboolean
+e_addressbook_view_can_view (EAddressbookView *view)
+{
+ return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
+}
+
gboolean
e_addressbook_view_can_send (EAddressbookView *view)
{
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index d338bd9797..9c9ccce8da 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -105,6 +105,7 @@ void e_addressbook_view_setup_menus (EAddressbookView *view,
void e_addressbook_view_discard_menus (EAddressbookView *view);
void e_addressbook_view_save_as (EAddressbookView *view);
+void e_addressbook_view_view (EAddressbookView *view);
void e_addressbook_view_send (EAddressbookView *view);
void e_addressbook_view_send_to (EAddressbookView *view);
void e_addressbook_view_print (EAddressbookView *view);
@@ -120,6 +121,7 @@ void e_addressbook_view_stop (EAddressbookView *view);
gboolean e_addressbook_view_can_create (EAddressbookView *view);
gboolean e_addressbook_view_can_print (EAddressbookView *view);
gboolean e_addressbook_view_can_save_as (EAddressbookView *view);
+gboolean e_addressbook_view_can_view (EAddressbookView *view);
gboolean e_addressbook_view_can_send (EAddressbookView *view);
gboolean e_addressbook_view_can_send_to (EAddressbookView *view);
gboolean e_addressbook_view_can_delete (EAddressbookView *view);
diff --git a/ui/ChangeLog b/ui/ChangeLog
index bcefc585d6..4bcafd2418 100644
--- a/ui/ChangeLog
+++ b/ui/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-18 Christopher James Lahey <clahey@ximian.com>
+
+ * evolution-addressbook.xml: Added File->Open which calls the
+ ContactsView command.
+
2002-01-16 Ettore Perazzoli <ettore@ximian.com>
* evolution.xml: Remove "Dump" menu item.
diff --git a/ui/evolution-addressbook.xml b/ui/evolution-addressbook.xml
index 09684df33b..1601fc8c88 100644
--- a/ui/evolution-addressbook.xml
+++ b/ui/evolution-addressbook.xml
@@ -21,6 +21,10 @@
pixtype="stock" pixname="Print"
accel="*Control*p"/>
+ <cmd name="ContactsView"
+ _tip="View the current contact"
+ accel="*Control*o"/>
+
<cmd name="ContactStop"
_tip="Stop Loading"
pixtype="stock" pixname="Stop"/>
@@ -55,6 +59,8 @@
<menu>
<submenu name="File">
<placeholder name="FileOps">
+ <menuitem name="ContactsView"
+ verb="" _label="_Open"/>
<menuitem name="ContactsSaveAsVCard"
verb="" _label="_Save as VCard"
pixtype="pixbuf"/>