aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-05-12 05:03:42 +0800
committerChris Toshok <toshok@src.gnome.org>2001-05-12 05:03:42 +0800
commit95651fe8285b961687f8ade655e0c2b1b08aad78 (patch)
treea1d32c0e71523e80a63b8729150959557bf052c1
parent714cf99b72b368750d167e8b4861dc8394878458 (diff)
downloadgsoc2013-evolution-95651fe8285b961687f8ade655e0c2b1b08aad78.tar.gz
gsoc2013-evolution-95651fe8285b961687f8ade655e0c2b1b08aad78.tar.zst
gsoc2013-evolution-95651fe8285b961687f8ade655e0c2b1b08aad78.zip
use e_card_list_get_vcard to build up the data to send.
2001-05-11 Chris Toshok <toshok@ximian.com> * gui/widgets/e-minicard-view.c (e_minicard_view_drag_data_get): use e_card_list_get_vcard to build up the data to send. (e_minicard_view_init): connect to the model's drag_begin signal. (e_minicard_view_drag_begin): gather the list of cards being dragged and call gtk_drag_begin. (add_to_list): new function. (get_card_list): same. (disconnect_signals): disconnect the drag_data_get signal. (e_minicard_view_init): connect to the drag_begin signal on our model. * gui/widgets/e-minicard-view.h (struct _EMinicardView): change drag_card to drag_list. * gui/widgets/e-minicard-view-model.c (minicard_drag_begin): new function, emit our drag_begin signal. (addressbook_incarnate): connect to the item's drag_begin signal. (e_minicard_view_model_class_init): init our drag_begin signal. * gui/widgets/e-minicard-view-model.h: add drag_begin signal. * gui/component/addressbook-config.c (addressbook_source_dialog): always loop through all source types here, making LDAP first so it's forces as the first notebook item. (addressbook_config_auth_label): remove SASL case. (addressbook_source_edit_changed): same. (addressbook_source_item_new): flag the area of code that needs to go into the advanced dialog (if we add one before someone graciously redesigns the entire addressbook gui :) * gui/component/addressbook-storage.c (ldap_unparse_auth): remove SASL case. (ldap_parse_auth): same. * gui/component/addressbook-storage.h: make LDAP come first in our source type enumeration, and remove the SASL auth type. svn path=/trunk/; revision=9774
-rw-r--r--addressbook/ChangeLog40
-rw-r--r--addressbook/gui/component/addressbook-component.c4
-rw-r--r--addressbook/gui/component/addressbook-config.c66
-rw-r--r--addressbook/gui/component/addressbook-storage.c4
-rw-r--r--addressbook/gui/component/addressbook-storage.h3
-rw-r--r--addressbook/gui/widgets/e-minicard-view-model.c26
-rw-r--r--addressbook/gui/widgets/e-minicard-view-model.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c74
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h2
9 files changed, 169 insertions, 52 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 09103948ad..bf0b5e3d33 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,43 @@
+2001-05-11 Chris Toshok <toshok@ximian.com>
+
+ * gui/widgets/e-minicard-view.c (e_minicard_view_drag_data_get):
+ use e_card_list_get_vcard to build up the data to send.
+ (e_minicard_view_init): connect to the model's drag_begin signal.
+ (e_minicard_view_drag_begin): gather the list of cards being
+ dragged and call gtk_drag_begin.
+ (add_to_list): new function.
+ (get_card_list): same.
+ (disconnect_signals): disconnect the drag_data_get signal.
+ (e_minicard_view_init): connect to the drag_begin signal on our
+ model.
+
+ * gui/widgets/e-minicard-view.h (struct _EMinicardView): change
+ drag_card to drag_list.
+
+ * gui/widgets/e-minicard-view-model.c (minicard_drag_begin): new
+ function, emit our drag_begin signal.
+ (addressbook_incarnate): connect to the item's drag_begin signal.
+ (e_minicard_view_model_class_init): init our drag_begin signal.
+
+ * gui/widgets/e-minicard-view-model.h: add drag_begin signal.
+
+ * gui/component/addressbook-config.c (addressbook_source_dialog):
+ always loop through all source types here, making LDAP first so
+ it's forces as the first notebook item.
+ (addressbook_config_auth_label): remove SASL case.
+ (addressbook_source_edit_changed): same.
+ (addressbook_source_item_new): flag the area of code that needs to
+ go into the advanced dialog (if we add one before someone
+ graciously redesigns the entire addressbook gui :)
+
+
+ * gui/component/addressbook-storage.c (ldap_unparse_auth): remove
+ SASL case.
+ (ldap_parse_auth): same.
+
+ * gui/component/addressbook-storage.h: make LDAP come first in our
+ source type enumeration, and remove the SASL auth type.
+
2001-05-11 Christopher James Lahey <clahey@ximian.com>
* backend/ebook/e-card.c (e_card_set_arg): If the name is set and
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index e9edb329e9..091e91f57a 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -228,7 +228,11 @@ populate_context_menu (EvolutionShellComponent *shell_component,
const char *type,
void *closure)
{
+ static char popup_xml[] =
+ "<menuitem name=\"BorkBork\" verb=\"ActivateView\" _label=\"_Foooo\" _tip=\"FooFooFoo\"/>\n";
g_print ("should populate context menu for %s (%s)\n", physical_uri, type);
+ bonobo_ui_component_set_translate (uic, "/popups/folderPopup/Folder/componentPlaceholder",
+ popup_xml, NULL);
}
static char*
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index e56c1fa799..9af3b2fa61 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -163,8 +163,6 @@ addressbook_config_auth_label (AddressbookLDAPAuthType type)
return _("None (anonymous mode)");
case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
return _("Password");
- case ADDRESSBOOK_LDAP_AUTH_SASL:
- return _("SASL");
default:
g_assert(0);
return _("Unknown auth type");
@@ -238,8 +236,6 @@ addressbook_source_edit_changed (GtkWidget *item, AddressbookSourceDialog *dialo
complete = FALSE;
g_free (data);
}
- else if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SASL) {
- }
data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->port), 0, -1);
if (!data || !*data)
complete = FALSE;
@@ -287,7 +283,7 @@ static GtkWidget *
table_add_elem (AddressbookSourceDialog *dialog, GtkWidget *table,
int row,
const char *label_text,
- const char *help_text)
+ char *help_text)
{
GtkWidget *label, *entry;
FocusHelpClosure *focus_closure;
@@ -361,8 +357,6 @@ addressbook_ldap_auth_item_new (AddressbookSourceDialog *dialog,
gtk_box_pack_start (GTK_BOX (item->vbox), table,
TRUE, TRUE, 0);
break;
- case ADDRESSBOOK_LDAP_AUTH_SASL:
- break;
default:
g_assert (0);
return item;
@@ -384,6 +378,7 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
{
AddressbookSourcePageItem *item = g_new0 (AddressbookSourcePageItem, 1);
GtkWidget *table = NULL;
+ GtkWidget *advanced_button;
int row = 0;
item->pnum = type;
@@ -400,20 +395,21 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
LDAPAuthPageItem *first_item = NULL;
int position;
- table = gtk_table_new (5, 2, FALSE);
+ table = gtk_table_new (6, 2, FALSE);
item->host = table_add_elem (dialog, table, row++,
_("Host:"),
_("FIXME Host help text here."));
+ item->rootdn = table_add_elem (dialog, table, row++,
+ _("Root DN:"),
+ _("FIXME Root DN help text here."));
+
+ /* XXX BEGIN PUT IN ADVANCED DIALOG */
item->port = table_add_elem (dialog, table, row++,
_("Port:"),
_("FIXME Port help text here."));
gtk_editable_insert_text (GTK_EDITABLE (item->port), "389", 3, &position);
- item->rootdn = table_add_elem (dialog, table, row++,
- _("Root DN:"),
- _("FIXME Root DN help text here."));
-
item->scope_optionmenu = gtk_option_menu_new ();
menu = gtk_menu_new ();
@@ -431,7 +427,6 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
gtk_option_menu_set_menu (GTK_OPTION_MENU (item->scope_optionmenu), menu);
// ldap_auth_type_menuitem_activate (first_item->item, first_item);
gtk_option_menu_set_history (GTK_OPTION_MENU(item->scope_optionmenu), 0);
-
label = gtk_label_new (_("Search Scope:"));
gtk_table_attach (GTK_TABLE (table), label, 0, 1,
row, row + 1, GTK_FILL, 0, 0, 0);
@@ -444,9 +439,7 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
0, 0);
row++;
-
- gtk_box_pack_start (GTK_BOX (item->vbox), table,
- TRUE, FALSE, 0);
+ /* XXX END PUT IN ADVANCED DIALOG */
item->auth_optionmenu = gtk_option_menu_new ();
menu = gtk_menu_new ();
@@ -457,11 +450,6 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
for (i = 0; i < ADDRESSBOOK_LDAP_AUTH_LAST; i++) {
LDAPAuthPageItem *auth_item;
-#ifndef LDAP_SASL
- /* skip the sasl stuff if we're not configured for it. */
- if (i == ADDRESSBOOK_LDAP_AUTH_SASL)
- continue;
-#endif
auth_item = addressbook_ldap_auth_item_new (dialog, item, i);
item->auths = g_list_append (item->auths, auth_item);
@@ -497,8 +485,33 @@ addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceT
GTK_EXPAND | GTK_FILL, 0,
0, 0);
+ row++;
+
+ gtk_box_pack_start (GTK_BOX (item->vbox), table,
+ TRUE, FALSE, 0);
+
gtk_box_pack_start (GTK_BOX (item->vbox), item->auth_notebook,
TRUE, TRUE, 0);
+
+#if 0
+ table = gtk_table_new (1, 4, FALSE);
+
+ advanced_button = gtk_button_new_with_label (_("Advanced LDAP Options"));
+
+ gtk_table_attach (GTK_TABLE (table),
+ advanced_button,
+ 3, 4, 0, 1,
+ 0, 0,
+ 0, 0);
+
+
+ gtk_box_pack_start (GTK_BOX (item->vbox), table,
+ FALSE, FALSE, 0);
+
+ gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
+ GTK_SIGNAL_FUNC (), dialog);
+#endif
+
break;
}
case ADDRESSBOOK_SOURCE_FILE: {
@@ -651,7 +664,9 @@ addressbook_source_dialog (AddressbookSource *source, GtkWidget *parent)
gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
gtk_window_set_policy (GTK_WINDOW (dialog->dialog),
FALSE, TRUE, FALSE);
- gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 350);
+#if 0
+ gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 300);
+#endif
gnome_dialog_set_parent (GNOME_DIALOG (dialog->dialog),
GTK_WINDOW (parent));
@@ -686,12 +701,7 @@ addressbook_source_dialog (AddressbookSource *source, GtkWidget *parent)
menu = gtk_menu_new ();
#endif
- for (i =
-#ifndef INCLUDE_FILE_SOURCE
- ADDRESSBOOK_SOURCE_LDAP;
-#else
- ADDRESSBOOK_SOURCE_FILE;
-#endif
+ for (i = ADDRESSBOOK_SOURCE_LDAP;
i < ADDRESSBOOK_SOURCE_LAST;
i ++) {
AddressbookSourcePageItem *item;
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index c1fc13b6d0..cb2e8c22cf 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -143,8 +143,6 @@ ldap_unparse_auth (AddressbookLDAPAuthType auth_type)
return "none";
case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
return "simple";
- case ADDRESSBOOK_LDAP_AUTH_SASL:
- return "sasl";
default:
g_assert(0);
return "none";
@@ -159,8 +157,6 @@ ldap_parse_auth (const char *auth)
if (!strcmp (auth, "simple"))
return ADDRESSBOOK_LDAP_AUTH_SIMPLE;
- else if (!strcmp (auth, "sasl"))
- return ADDRESSBOOK_LDAP_AUTH_SASL;
else
return ADDRESSBOOK_LDAP_AUTH_NONE;
}
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index 518977598e..56a1e0d658 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -27,15 +27,14 @@
#include "evolution-shell-component.h"
typedef enum {
- ADDRESSBOOK_SOURCE_FILE,
ADDRESSBOOK_SOURCE_LDAP,
+ ADDRESSBOOK_SOURCE_FILE,
ADDRESSBOOK_SOURCE_LAST
} AddressbookSourceType;
typedef enum {
ADDRESSBOOK_LDAP_AUTH_NONE,
ADDRESSBOOK_LDAP_AUTH_SIMPLE,
- ADDRESSBOOK_LDAP_AUTH_SASL, /* XXX currently unsupported */
ADDRESSBOOK_LDAP_AUTH_LAST
} AddressbookLDAPAuthType;
diff --git a/addressbook/gui/widgets/e-minicard-view-model.c b/addressbook/gui/widgets/e-minicard-view-model.c
index ab0999518b..c58452a3ac 100644
--- a/addressbook/gui/widgets/e-minicard-view-model.c
+++ b/addressbook/gui/widgets/e-minicard-view-model.c
@@ -12,8 +12,8 @@
#include "e-minicard-view-model.h"
#include <gal/util/e-i18n.h>
+#include <gal/util/e-util.h>
-#include "e-minicard.h"
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-font.h>
#include <gal/widgets/e-popup-menu.h>
@@ -43,6 +43,7 @@ enum {
enum {
STATUS_MESSAGE,
+ DRAG_BEGIN,
LAST_SIGNAL
};
@@ -366,6 +367,18 @@ addressbook_compare (EReflowModel *erm, int n1, int n2)
return 0;
}
+static int
+minicard_drag_begin (EMinicard *card, GdkEvent *event, EMinicardViewModel *model)
+{
+ gint ret_val = 0;
+
+ gtk_signal_emit (GTK_OBJECT(model),
+ e_minicard_view_model_signals[DRAG_BEGIN],
+ event, &ret_val);
+
+ return ret_val;
+}
+
static GnomeCanvasItem *
addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
{
@@ -382,6 +395,8 @@ addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
gtk_signal_connect (GTK_OBJECT (item), "selected",
GTK_SIGNAL_FUNC(card_selected), emvm);
#endif
+ gtk_signal_connect (GTK_OBJECT (item), "drag_begin",
+ GTK_SIGNAL_FUNC(minicard_drag_begin), emvm);
return item;
}
@@ -493,6 +508,15 @@ e_minicard_view_model_class_init (GtkObjectClass *object_class)
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ e_minicard_view_model_signals [DRAG_BEGIN] =
+ gtk_signal_new ("drag_begin",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMinicardViewModelClass, drag_begin),
+ gtk_marshal_INT__POINTER,
+ GTK_TYPE_INT, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
+
+
gtk_object_class_add_signals (object_class, e_minicard_view_model_signals, LAST_SIGNAL);
model_class->set_width = addressbook_set_width;
diff --git a/addressbook/gui/widgets/e-minicard-view-model.h b/addressbook/gui/widgets/e-minicard-view-model.h
index c0e1029522..c958a81690 100644
--- a/addressbook/gui/widgets/e-minicard-view-model.h
+++ b/addressbook/gui/widgets/e-minicard-view-model.h
@@ -4,6 +4,7 @@
#include <gal/widgets/e-reflow-model.h>
#include <gal/widgets/e-selection-model.h>
+#include "e-minicard.h"
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/backend/ebook/e-book-view.h"
#include "addressbook/backend/ebook/e-card.h"
@@ -52,6 +53,7 @@ struct _EMinicardViewModelClass {
* Signals
*/
void (*status_message) (EMinicardViewModel *model, const gchar *message);
+ gint (* drag_begin) (EMinicardViewModel *model, GdkEvent *event);
};
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 85a456cde1..3a89978756 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -32,7 +32,6 @@
#include <gal/widgets/e-unicode.h>
#include <libgnome/gnome-i18n.h>
-#if 0
static void canvas_destroy (GtkObject *object, EMinicardView *view);
static void e_minicard_view_drag_data_get(GtkWidget *widget,
GdkDragContext *context,
@@ -40,7 +39,6 @@ static void e_minicard_view_drag_data_get(GtkWidget *widget,
guint info,
guint time,
EMinicardView *view);
-#endif
static EReflowClass *parent_class = NULL;
#define PARENT_TYPE (E_REFLOW_TYPE)
@@ -58,20 +56,17 @@ enum {
LAST_SIGNAL
};
-#if 0
enum DndTargetType {
- DND_TARGET_TYPE_VCARD,
+ DND_TARGET_TYPE_VCARD_LIST,
};
-#define VCARD_TYPE "text/x-vcard"
+#define VCARD_LIST_TYPE "text/x-vcard"
static GtkTargetEntry drag_types[] = {
- { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD }
+ { VCARD_LIST_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
};
static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-#endif
static guint e_minicard_view_signals [LAST_SIGNAL] = {0, };
-#if 0
static void
e_minicard_view_drag_data_get(GtkWidget *widget,
GdkDragContext *context,
@@ -80,16 +75,14 @@ e_minicard_view_drag_data_get(GtkWidget *widget,
guint time,
EMinicardView *view)
{
- printf ("e_minicard_view_drag_data_get (e_minicard = %p)\n", view->drag_card);
-
if (!E_IS_MINICARD_VIEW(view))
return;
switch (info) {
- case DND_TARGET_TYPE_VCARD: {
+ case DND_TARGET_TYPE_VCARD_LIST: {
char *value;
-
- value = e_card_simple_get_vcard(view->drag_card->simple);
+
+ value = e_card_list_get_vcard(view->drag_list);
gtk_selection_data_set (selection_data,
selection_data->target,
@@ -98,27 +91,64 @@ e_minicard_view_drag_data_get(GtkWidget *widget,
break;
}
}
+
+ g_list_foreach (view->drag_list, (GFunc)gtk_object_unref, NULL);
+ g_list_free (view->drag_list);
+ view->drag_list = NULL;
+}
+
+typedef struct {
+ GList *list;
+ EMinicardViewModel *model;
+} ModelAndList;
+
+static void
+add_to_list (int index, gpointer closure)
+{
+ ModelAndList *mal = closure;
+ mal->list = g_list_prepend (mal->list, e_minicard_view_model_get_card (mal->model, index));
+}
+
+static GList *
+get_card_list (EMinicardViewModel *model, ESelectionModel *selection)
+{
+ ModelAndList mal;
+
+ mal.model = model;
+ mal.list = NULL;
+
+ e_selection_model_foreach (selection, add_to_list, &mal);
+
+ mal.list = g_list_reverse (mal.list);
+ return mal.list;
}
static int
-e_minicard_view_drag_begin (EMinicard *card, GdkEvent *event, EMinicardView *view)
+e_minicard_view_drag_begin (EMinicardViewModel *model, GdkEvent *event, EMinicardView *view)
{
GdkDragContext *context;
GtkTargetList *target_list;
GdkDragAction actions = GDK_ACTION_MOVE;
- view->drag_card = card;
+ view->drag_list = get_card_list (model, E_REFLOW (view)->selection);
+
+ g_print ("dragging %d card(s)\n", g_list_length (view->drag_list));
target_list = gtk_target_list_new (drag_types, num_drag_types);
context = gtk_drag_begin (GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas),
target_list, actions, 1/*XXX*/, event);
+ if (!view->canvas_drag_data_get_id)
+ view->canvas_drag_data_get_id = gtk_signal_connect (GTK_OBJECT (GNOME_CANVAS_ITEM (view)->canvas),
+ "drag_data_get",
+ GTK_SIGNAL_FUNC (e_minicard_view_drag_data_get),
+ view);
+
gtk_drag_set_icon_default (context);
return TRUE;
}
-#endif
#if 0
static void
@@ -327,7 +357,12 @@ disconnect_signals(EMinicardView *view)
gtk_signal_disconnect(GTK_OBJECT (view->model),
view->status_message_id);
+ if (view->canvas_drag_data_get_id)
+ gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM (view)->canvas),
+ view->status_message_id);
+
view->status_message_id = 0;
+ view->canvas_drag_data_get_id = 0;
}
#if 0
@@ -466,12 +501,19 @@ e_minicard_view_init (EMinicardView *view)
view->model = E_MINICARD_VIEW_MODEL(e_minicard_view_model_new());
+ view->canvas_drag_data_get_id = 0;
+ view->status_message_id = 0;
+
empty_message = e_utf8_from_locale_string(_("\n\nThere are no items to show in this view\n\n"
"Double-click here to create a new Contact."));
gtk_object_set (GTK_OBJECT(view),
"empty_message", empty_message,
"model", view->model,
NULL);
+
+ gtk_signal_connect (GTK_OBJECT (view->model), "drag_begin",
+ GTK_SIGNAL_FUNC (e_minicard_view_drag_begin), view);
+
g_free (empty_message);
}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index 253eedd3ac..318989958b 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -72,7 +72,7 @@ struct _EMinicardView
ESelectionModelSimple *selection;
- EMinicard *drag_card;
+ GList *drag_list;
int canvas_destroy_id;
int canvas_drag_data_get_id;