aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-component.c1
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c4
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c1
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c83
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.h21
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c93
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c16
7 files changed, 175 insertions, 44 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index beb0e594a7..512066519d 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -46,6 +46,7 @@
#include "addressbook-storage.h"
#include "addressbook-component.h"
+#include "addressbook-config.h"
#include "addressbook.h"
#include "addressbook/gui/merging/e-card-merging.h"
#include "addressbook/gui/widgets/e-addressbook-util.h"
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 1746171838..559e0eef58 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -111,7 +111,7 @@ e_select_names_class_init (ESelectNamesClass *klass)
}
#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"%d\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"%d\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\" search=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
@@ -119,7 +119,7 @@ e_select_names_class_init (ESelectNamesClass *klass)
</ETableSpecification>"
#define SPEC2 "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\" search=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 0f63c48936..320c0c4ad2 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -14,6 +14,7 @@
#include <gnome-xml/xmlmemory.h>
#include <gnome.h>
#include <gal/widgets/e-gui-utils.h>
+#include "e-addressbook-util.h"
#define PARENT_TYPE gtk_object_get_type()
GtkObjectClass *parent_class;
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index f38a42cc21..895489863a 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -14,6 +14,7 @@
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-font.h>
#include <gal/widgets/e-popup-menu.h>
+#include <gal/widgets/e-gui-utils.h>
#include <gal/unicode/gunicode.h>
#include "e-contact-save-as.h"
#include "addressbook/printing/e-contact-print.h"
@@ -102,9 +103,12 @@ typedef struct {
static void
model_and_selection_free (ModelAndSelection *mns)
{
- gtk_object_unref(GTK_OBJECT(mns->adapter));
- e_selection_model_right_click_up(mns->selection);
- gtk_object_unref(GTK_OBJECT(mns->selection));
+ if (mns->adapter)
+ gtk_object_unref(GTK_OBJECT(mns->adapter));
+ if (mns->selection) {
+ e_selection_model_right_click_up(mns->selection);
+ gtk_object_unref(GTK_OBJECT(mns->selection));
+ }
if (mns->widget)
gtk_object_unref(GTK_OBJECT(mns->widget));
g_free(mns);
@@ -144,7 +148,6 @@ save_as (GtkWidget *widget, ModelAndSelection *mns)
if (list)
e_contact_list_save_as (_("Save as VCard"), list);
e_free_object_list (list);
- model_and_selection_free (mns);
}
static void
@@ -156,7 +159,6 @@ send_as (GtkWidget *widget, ModelAndSelection *mns)
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
e_free_object_list (list);
- model_and_selection_free (mns);
}
static void
@@ -168,7 +170,6 @@ send_to (GtkWidget *widget, ModelAndSelection *mns)
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
e_free_object_list (list);
- model_and_selection_free (mns);
}
static void
@@ -180,7 +181,6 @@ print (GtkWidget *widget, ModelAndSelection *mns)
if (list)
gtk_widget_show (e_contact_print_card_list_dialog_new (list));
e_free_object_list (list);
- model_and_selection_free (mns);
}
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
@@ -193,7 +193,6 @@ print_envelope (GtkWidget *widget, ModelAndSelection *mns)
if (list)
gtk_widget_show (e_contact_print_envelope_list_dialog_new (list));
e_free_object_list (list);
- model_and_selection_free (mns);
}
#endif
@@ -254,7 +253,6 @@ delete (GtkWidget *widget, ModelAndSelection *mns)
}
e_free_object_list (list);
- model_and_selection_free (mns);
}
static void
@@ -268,8 +266,6 @@ open_card (GtkWidget *widget, ModelAndSelection *mns)
e_addressbook_show_multiple_cards (book, list, e_addressbook_model_editable (priv->model));
e_free_object_list (list);
-
- model_and_selection_free (mns);
}
static void
@@ -287,8 +283,6 @@ transfer_cards (ModelAndSelection *mns, gboolean delete_from_source)
parent_window = NULL;
e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window);
-
- model_and_selection_free (mns);
}
static void
@@ -303,12 +297,19 @@ move_to_folder (GtkWidget *widget, ModelAndSelection *mns)
transfer_cards (mns, TRUE);
}
+static void
+free_popup_info (GtkWidget *w, ModelAndSelection *mns)
+{
+ model_and_selection_free (mns);
+}
+
#define POPUP_READONLY_MASK 0x01
gint
e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, GdkEvent *event, ESelectionModel *selection)
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
ModelAndSelection *mns = g_new(ModelAndSelection, 1);
+ GtkMenu *popup;
EPopupMenu menu[] = {
{ N_("Open"), NULL, GTK_SIGNAL_FUNC(open_card), NULL, NULL, 0 },
{ N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, NULL, 0 },
@@ -338,7 +339,61 @@ e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, Gd
gtk_object_ref(GTK_OBJECT(mns->selection));
if (mns->widget)
gtk_object_ref(GTK_OBJECT(mns->widget));
- e_popup_menu_run (menu, event, e_addressbook_model_editable(priv->model) ? 0 : POPUP_READONLY_MASK, 0, mns);
+ popup = e_popup_menu_create (menu, e_addressbook_model_editable(priv->model) ? 0 : POPUP_READONLY_MASK, 0, mns);
+
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_popup_info), mns);
+ e_popup_menu (popup, event);
+
+ return TRUE;
+}
+
+static void
+new_card (GtkWidget *widget, ModelAndSelection *mns)
+{
+ EBook *book;
+
+ book = e_addressbook_model_get_ebook(mns->adapter->priv->model);
+
+ e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, TRUE);
+}
+
+static void
+new_list (GtkWidget *widget, ModelAndSelection *mns)
+{
+ EBook *book;
+
+ book = e_addressbook_model_get_ebook(mns->adapter->priv->model);
+
+ e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE);
+}
+
+gint
+e_addressbook_reflow_adapter_base_right_click (EAddressbookReflowAdapter *adapter, GdkEvent *event)
+{
+ EAddressbookReflowAdapterPrivate *priv = adapter->priv;
+ ModelAndSelection *mns = g_new(ModelAndSelection, 1);
+ GtkMenu *popup;
+ EPopupMenu menu[] = {
+ { N_("New Contact..."), NULL, GTK_SIGNAL_FUNC(new_card), NULL, NULL, POPUP_READONLY_MASK },
+ { N_("New Contact List..."), NULL, GTK_SIGNAL_FUNC(new_list), NULL, NULL, POPUP_READONLY_MASK },
+ E_POPUP_SEPARATOR,
+ { N_("Paste"), NULL, GTK_SIGNAL_FUNC (paste), NULL, NULL, POPUP_READONLY_MASK },
+ E_POPUP_TERMINATOR
+ };
+
+ mns->adapter = adapter;
+ mns->selection = NULL;
+ mns->widget = gtk_get_event_widget (event);
+ gtk_object_ref(GTK_OBJECT(mns->adapter));
+ if (mns->widget)
+ gtk_object_ref(GTK_OBJECT(mns->widget));
+ popup = e_popup_menu_create (menu, e_addressbook_model_editable(priv->model) ? 0 : POPUP_READONLY_MASK, 0, mns);
+
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_popup_info), mns);
+ e_popup_menu (popup, event);
+
return TRUE;
}
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
index 1614a65064..bdb575737b 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
@@ -36,16 +36,17 @@ struct _EAddressbookReflowAdapterClass {
};
-GtkType e_addressbook_reflow_adapter_get_type (void);
-void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EAddressbookModel *model);
-EReflowModel *e_addressbook_reflow_adapter_new (EAddressbookModel *model);
+GtkType e_addressbook_reflow_adapter_get_type (void);
+void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
+ EAddressbookModel *model);
+EReflowModel *e_addressbook_reflow_adapter_new (EAddressbookModel *model);
/* Returns object with ref count of 1. */
-ECard *e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter,
- int index);
-gint e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *emvm,
- GdkEvent *event,
- ESelectionModel *selection);
-
+ECard *e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter,
+ int index);
+gint e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *emvm,
+ GdkEvent *event,
+ ESelectionModel *selection);
+gint e_addressbook_reflow_adapter_base_right_click (EAddressbookReflowAdapter *adapter,
+ GdkEvent *event);
#endif /* _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 2055f9c4cf..119b8a4147 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -30,6 +30,7 @@
#include <gal/e-table/e-table-model.h>
#include <gal/widgets/e-scroll-frame.h>
#include <gal/widgets/e-popup-menu.h>
+#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
@@ -768,6 +769,12 @@ minicard_selection_change (EMinicardViewWidget *widget, EAddressbookView *view)
}
static void
+minicard_button_press (GtkWidget *widget, GdkEventButton *event, EAddressbookView *view)
+{
+ g_print ("Button %d pressed with event type %d\n", event->button, event->type);
+}
+
+static void
create_minicard_view (EAddressbookView *view)
{
GtkWidget *scrollframe;
@@ -790,6 +797,9 @@ create_minicard_view (EAddressbookView *view)
gtk_signal_connect(GTK_OBJECT(minicard_view), "selection_change",
GTK_SIGNAL_FUNC(minicard_selection_change), view);
+ gtk_signal_connect(GTK_OBJECT(minicard_view), "button_press_event",
+ GTK_SIGNAL_FUNC(minicard_button_press), view);
+
view->object = GTK_OBJECT(minicard_view);
view->widget = minicard_hbox;
@@ -900,14 +910,12 @@ static void
save_as (GtkWidget *widget, CardAndBook *card_and_book)
{
e_contact_save_as(_("Save as VCard"), card_and_book->card);
- card_and_book_free(card_and_book);
}
static void
send_as (GtkWidget *widget, CardAndBook *card_and_book)
{
e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_ATTACHMENT);
- card_and_book_free(card_and_book);
}
static void
@@ -915,14 +923,12 @@ send_to (GtkWidget *widget, CardAndBook *card_and_book)
{
e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_TO);
- card_and_book_free(card_and_book);
}
static void
print (GtkWidget *widget, CardAndBook *card_and_book)
{
gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card));
- card_and_book_free(card_and_book);
}
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
@@ -930,7 +936,6 @@ static void
print_envelope (GtkWidget *widget, CardAndBook *card_and_book)
{
gtk_widget_show(e_contact_print_envelope_dialog_new(card_and_book->card));
- card_and_book_free(card_and_book);
}
#endif
@@ -944,14 +949,12 @@ copy (GtkWidget *widget, CardAndBook *card_and_book)
#endif
e_addressbook_view_copy (card_and_book->view);
- card_and_book_free (card_and_book);
}
static void
paste (GtkWidget *widget, CardAndBook *card_and_book)
{
e_addressbook_view_paste (card_and_book->view);
- card_and_book_free (card_and_book);
}
static void
@@ -968,7 +971,6 @@ cut (GtkWidget *widget, CardAndBook *card_and_book)
#endif
e_addressbook_view_cut (card_and_book->view);
- card_and_book_free (card_and_book);
}
static void
@@ -987,20 +989,23 @@ delete (GtkWidget *widget, CardAndBook *card_and_book)
}
e_free_object_list(list);
}
- card_and_book_free(card_and_book);
}
static void
copy_to_folder (GtkWidget *widget, CardAndBook *card_and_book)
{
e_addressbook_view_copy_to_folder (card_and_book->view);
- card_and_book_free (card_and_book);
}
static void
move_to_folder (GtkWidget *widget, CardAndBook *card_and_book)
{
e_addressbook_view_move_to_folder (card_and_book->view);
+}
+
+static void
+free_popup_info (GtkWidget *w, CardAndBook *card_and_book)
+{
card_and_book_free (card_and_book);
}
@@ -1011,6 +1016,7 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
EAddressbookModel *model = view->model;
CardAndBook *card_and_book;
+ GtkMenu *popup;
EPopupMenu menu[] = {
{ N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, NULL, 0 },
@@ -1044,15 +1050,74 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
gtk_object_ref(GTK_OBJECT(card_and_book->book));
gtk_object_ref(GTK_OBJECT(card_and_book->view));
- e_popup_menu_run (menu, event,
- e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
- 0, card_and_book);
+ popup = e_popup_menu_create (menu,
+ e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
+ 0, card_and_book);
+
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_popup_info), card_and_book);
+ e_popup_menu (popup, event);
+
return TRUE;
} else
return FALSE;
}
static void
+new_card (GtkWidget *widget, CardAndBook *card_and_book)
+{
+ e_addressbook_show_contact_editor (card_and_book->book, e_card_new(""), TRUE, TRUE);
+}
+
+static void
+new_list (GtkWidget *widget, CardAndBook *card_and_book)
+{
+ e_addressbook_show_contact_list_editor (card_and_book->book, e_card_new(""), TRUE, TRUE);
+}
+
+static gint
+table_white_space_event(ETableScrolled *table, GdkEvent *event, EAddressbookView *view)
+{
+ if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3 &&
+ E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
+ EAddressbookModel *model = view->model;
+ CardAndBook *card_and_book;
+ GtkMenu *popup;
+
+ EPopupMenu menu[] = {
+ { N_("New Contact..."), NULL, GTK_SIGNAL_FUNC(new_card), NULL, NULL, POPUP_READONLY_MASK },
+ { N_("New Contact List..."), NULL, GTK_SIGNAL_FUNC(new_list), NULL, NULL, POPUP_READONLY_MASK },
+ E_POPUP_SEPARATOR,
+ { N_("Paste"), NULL, GTK_SIGNAL_FUNC (paste), NULL, NULL, POPUP_READONLY_MASK },
+ E_POPUP_TERMINATOR
+ };
+
+ card_and_book = g_new(CardAndBook, 1);
+ card_and_book->card = NULL;
+ card_and_book->widget = GTK_WIDGET(table);
+ card_and_book->view = view;
+ gtk_object_get(GTK_OBJECT(model),
+ "book", &(card_and_book->book),
+ NULL);
+
+ gtk_object_ref(GTK_OBJECT(card_and_book->book));
+ gtk_object_ref(GTK_OBJECT(card_and_book->view));
+
+ popup = e_popup_menu_create (menu,
+ e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
+ 0, card_and_book);
+
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_popup_info), card_and_book);
+ e_popup_menu (popup, event);
+
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+static void
table_selection_change(ETableScrolled *table, EAddressbookView *view)
{
command_state_change (view);
@@ -1159,6 +1224,8 @@ create_table_view (EAddressbookView *view)
GTK_SIGNAL_FUNC(table_double_click), view);
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "right_click",
GTK_SIGNAL_FUNC(table_right_click), view);
+ gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "white_space_event",
+ GTK_SIGNAL_FUNC(table_white_space_event), view);
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "selection_change",
GTK_SIGNAL_FUNC(table_selection_change), view);
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 92ac189bca..ed020b93be 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -327,15 +327,21 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
g_assert (E_IS_BOOK (book));
e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, editable);
+ return TRUE;
}
- return TRUE;
+ case GDK_BUTTON_PRESS:
+ if (event->button.button == 3) {
+ return e_addressbook_reflow_adapter_base_right_click (view->adapter, event);
+ }
+ break;
default:
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
- else
- return FALSE;
break;
}
+
+ if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
+ return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
+ else
+ return FALSE;
}
static gint