diff options
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 1230 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 58 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-editor.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.glade | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.glade | 190 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 41 |
12 files changed, 471 insertions, 1084 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 60678d93e1..70058bcd89 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -659,6 +659,9 @@ show_config (CalendarPrefsDialog *prefs) /* Day's second zone */ update_day_second_zone_caption (prefs); + /* Day's second zone */ + update_day_second_zone_caption (prefs); + /* Working Days. */ working_days = calendar_config_get_working_days (); mask = 1 << 0; diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 559eacced7..0ef1e4a667 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -28,7 +28,6 @@ #include <glade/glade.h> #include <gconf/gconf-client.h> #include <libedataserverui/e-source-selector.h> -#include "evolution-config-control.h" G_BEGIN_DECLS diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 7a083a37a1..9405663a9b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -39,7 +39,7 @@ #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <e-util/gconf-bridge.h> -#include <evolution-shell-component-utils.h> +#include <shell/e-shell.h> #include <camel/camel-url.h> #include <camel/camel-exception.h> @@ -63,9 +63,9 @@ #include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" +#include "widgets/misc/e-attachment-view.h" +#include "widgets/misc/e-attachment-paned.h" -#include "e-attachment-bar.h" -#include "misc/e-expander.h" #include "e-util/e-error.h" #define COMP_EDITOR_GET_PRIVATE(obj) \ @@ -95,12 +95,12 @@ struct _CompEditorPrivate { GtkNotebook *notebook; /* Attachment handling */ - GtkWidget *attachment_bar; - GtkWidget *attachment_scrolled_window; - GtkWidget *attachment_expander; - GtkWidget *attachment_expander_label; - GtkWidget *attachment_expander_icon; - GtkWidget *attachment_expander_num; + GtkWidget *attachment_view; + + /* Manages menus and toolbars */ + GtkUIManager *manager; + + gchar *summary; /* Manages menus and toolbars */ GtkUIManager *manager; @@ -151,7 +151,7 @@ static const gchar *ui = " <menu action='view-menu'/>" " <menu action='insert-menu'>" " <menuitem action='attach'/>" -" <menuitem action='attach-recent'/>" +" <placeholder name='recent-placeholder'/>" " </menu>" " <menu action='options-menu'/>" " <menu action='help-menu'>" @@ -163,8 +163,6 @@ static const gchar *ui = " <toolitem action='print'/>" " <toolitem action='close'/>" " <separator/>" -" <toolitem action='attach'/>" -" <separator/>" " </toolbar>" "</ui>"; @@ -178,9 +176,8 @@ static void close_dialog (CompEditor *editor); static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page); -static void obj_modified_cb (ECal *client, GList *objs, gpointer data); -static void obj_removed_cb (ECal *client, GList *uids, gpointer data); -static gboolean open_attachment (EAttachmentBar *bar, CompEditor *editor); +static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); +static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW) @@ -222,392 +219,87 @@ enum { LAST_SIGNAL }; -static guint comp_editor_signals[LAST_SIGNAL] = { 0 }; +static guint signals[LAST_SIGNAL]; +static GList *active_editors; static void -attach_message(CompEditor *editor, CamelMimeMessage *msg) +comp_editor_weak_notify_cb (gpointer unused, + GObject *where_the_object_was) { - CamelMimePart *mime_part; - const char *subject; - guint i; - char *filename = NULL; - - mime_part = camel_mime_part_new(); - camel_mime_part_set_disposition(mime_part, "inline"); - subject = camel_mime_message_get_subject(msg); - if (subject) { - char *desc = g_strdup_printf(_("Attached message - %s"), subject); - - camel_mime_part_set_description(mime_part, desc); - g_free(desc); - } else - camel_mime_part_set_description(mime_part, _("Attached message")); - - i = e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - i++; - filename = g_strdup_printf ("email%d",i); - camel_mime_part_set_filename (mime_part, filename); - - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)msg); - camel_mime_part_set_content_type(mime_part, "message/rfc822"); - e_attachment_bar_attach_mime_part(E_ATTACHMENT_BAR(editor->priv->attachment_bar), mime_part); - camel_object_unref(mime_part); - g_free (filename); + active_editors = g_list_remove (active_editors, where_the_object_was); } -struct _drop_data { - CompEditor *editor; - - GdkDragContext *context; - /* Only selection->data and selection->length are valid */ - GtkSelectionData *selection; - - guint32 action; - guint info; - guint time; - - unsigned int move:1; - unsigned int moved:1; - unsigned int aborted:1; -}; - static void -drop_action(CompEditor *editor, GdkDragContext *context, guint32 action, GtkSelectionData *selection, guint info, guint time) -{ - char *tmp, *str, **urls; - CamelMimePart *mime_part; - CamelStream *stream; - CamelURL *url; - CamelMimeMessage *msg; - char *content_type; - int i, success=FALSE, delete=FALSE; - - switch (info) { - case DND_TYPE_MESSAGE_RFC822: - d(printf ("dropping a message/rfc822\n")); - /* write the message(s) out to a CamelStream so we can use it */ - stream = camel_stream_mem_new (); - camel_stream_write (stream, (char *)selection->data, selection->length); - camel_stream_reset (stream); - - msg = camel_mime_message_new (); - if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) != -1) { - attach_message(editor, msg); - success = TRUE; - delete = action == GDK_ACTION_MOVE; - } - - camel_object_unref(msg); - camel_object_unref(stream); - break; - case DND_TYPE_TEXT_URI_LIST: - case DND_TYPE_NETSCAPE_URL: - d(printf ("dropping a text/uri-list\n")); - tmp = g_strndup ((char *)selection->data, selection->length); - urls = g_strsplit (tmp, "\n", 0); - g_free (tmp); - - for (i = 0; urls[i] != NULL; i++) { - str = g_strstrip (urls[i]); - if (urls[i][0] == '#') - continue; - - if (!g_ascii_strncasecmp (str, "mailto:", 7)) { - /* TODO does not handle mailto now */ - } else { - url = camel_url_new (str, NULL); - - if (url == NULL) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - url->path, - "attachment"); - else - e_attachment_bar_attach_remote_file - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - str, "attachment"); - - camel_url_free (url); - } - } - - g_strfreev (urls); - success = TRUE; - break; - case DND_TYPE_TEXT_VCARD: - case DND_TYPE_TEXT_CALENDAR: - content_type = gdk_atom_name (selection->type); - d(printf ("dropping a %s\n", content_type)); - - mime_part = camel_mime_part_new (); - camel_mime_part_set_content (mime_part, (char *)selection->data, selection->length, content_type); - camel_mime_part_set_disposition (mime_part, "inline"); - - e_attachment_bar_attach_mime_part - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - mime_part); - - camel_object_unref (mime_part); - g_free (content_type); - - success = TRUE; - break; - case DND_TYPE_X_UID_LIST: { - GPtrArray *uids; - char *inptr, *inend; - CamelFolder *folder; - CamelException ex = CAMEL_EXCEPTION_INITIALISER; - - /* NB: This all runs synchronously, could be very slow/hang/block the ui */ - - uids = g_ptr_array_new(); - - inptr = (char *)selection->data; - inend = (char *)(selection->data + selection->length); - while (inptr < inend) { - char *start = inptr; - - while (inptr < inend && *inptr) - inptr++; - - if (start > (char *)selection->data) - g_ptr_array_add(uids, g_strndup(start, inptr-start)); - - inptr++; - } - - if (uids->len > 0) { - folder = mail_tool_uri_to_folder((char *)selection->data, 0, &ex); - if (folder) { - if (uids->len == 1) { - msg = camel_folder_get_message(folder, uids->pdata[0], &ex); - if (msg == NULL) - goto fail; - attach_message(editor, msg); - } else { - CamelMultipart *mp = camel_multipart_new(); - char *desc; - char *filename = NULL; - guint num; - - camel_data_wrapper_set_mime_type((CamelDataWrapper *)mp, "multipart/digest"); - camel_multipart_set_boundary(mp, NULL); - for (i=0;i<uids->len;i++) { - - msg = camel_folder_get_message(folder, uids->pdata[i], &ex); - if (msg) { - mime_part = camel_mime_part_new(); - camel_mime_part_set_disposition(mime_part, "inline"); - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)msg); - camel_mime_part_set_content_type(mime_part, "message/rfc822"); - camel_multipart_add_part(mp, mime_part); - camel_object_unref(mime_part); - camel_object_unref(msg); - } else { - camel_object_unref(mp); - goto fail; - } - } - mime_part = camel_mime_part_new(); - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)mp); - /* translators, this count will always be >1 */ - desc = g_strdup_printf(ngettext("Attached message", "%d attached messages", uids->len), uids->len); - camel_mime_part_set_description(mime_part, desc); - g_free(desc); - - num = e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - num++; - filename = g_strdup_printf ("email%d", num); - camel_mime_part_set_filename (mime_part, filename); - - e_attachment_bar_attach_mime_part - (E_ATTACHMENT_BAR(editor->priv->attachment_bar), mime_part); - camel_object_unref(mime_part); - camel_object_unref(mp); - g_free (filename); - } - success = TRUE; - delete = action == GDK_ACTION_MOVE; - fail: - if (camel_exception_is_set(&ex)) { - char *name; - - camel_object_get(folder, NULL, CAMEL_FOLDER_NAME, &name, NULL); - e_error_run((GtkWindow *)editor, "mail-editor:attach-nomessages", - name?name:(char *)selection->data, camel_exception_get_description(&ex), NULL); - camel_object_free(folder, CAMEL_FOLDER_NAME, name); - } - camel_object_unref(folder); - } else { - e_error_run((GtkWindow *)editor, "mail-editor:attach-nomessages", - (char *)selection->data, camel_exception_get_description(&ex), NULL); - } - - camel_exception_clear(&ex); - } - - g_ptr_array_free(uids, TRUE); - - break; } - default: - d(printf ("dropping an unknown\n")); - break; - } - - printf("Drag finished, success %d delete %d\n", success, delete); - - gtk_drag_finish(context, success, delete, time); -} - -static void -drop_popup_copy (EPopup *ep, EPopupItem *item, void *data) -{ - struct _drop_data *m = data; - drop_action(m->editor, m->context, GDK_ACTION_COPY, m->selection, m->info, m->time); -} - -static void -drop_popup_move (EPopup *ep, EPopupItem *item, void *data) -{ - struct _drop_data *m = data; - drop_action(m->editor, m->context, GDK_ACTION_MOVE, m->selection, m->info, m->time); -} - -static void -drop_popup_cancel(EPopup *ep, EPopupItem *item, void *data) +drag_data_received (CompEditor *editor, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection, + guint info, + guint time) { - struct _drop_data *m = data; - gtk_drag_finish(m->context, FALSE, FALSE, m->time); -} + EAttachmentView *view; -static EPopupItem drop_popup_menu[] = { - { E_POPUP_ITEM, "00.emc.02", N_("_Copy"), drop_popup_copy, NULL, "mail-copy", 0 }, - { E_POPUP_ITEM, "00.emc.03", N_("_Move"), drop_popup_move, NULL, "mail-move", 0 }, - { E_POPUP_BAR, "10.emc" }, - { E_POPUP_ITEM, "99.emc.00", N_("Cancel _Drag"), drop_popup_cancel, NULL, NULL, 0 }, -}; + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); -static void -drop_popup_free(EPopup *ep, GSList *items, void *data) -{ - struct _drop_data *m = data; - - g_slist_free(items); - - g_object_unref(m->context); - g_object_unref(m->editor); - g_free(m->selection->data); - g_free(m->selection); - g_free(m); -} - -static void -drag_data_received (CompEditor *editor, GdkDragContext *context, - int x, int y, GtkSelectionData *selection, - guint info, guint time) -{ - if (selection->data == NULL || selection->length == -1) - return; - - if (context->action == GDK_ACTION_ASK) { - ECalPopup *ecp; - GSList *menus = NULL; - GtkMenu *menu; - int i; - struct _drop_data *m; - - m = g_malloc0(sizeof(*m)); - m->context = context; - g_object_ref(context); - m->editor = editor; - g_object_ref(editor); - m->action = context->action; - m->info = info; - m->time = time; - m->selection = g_malloc0(sizeof(*m->selection)); - m->selection->data = g_malloc(selection->length); - memcpy(m->selection->data, selection->data, selection->length); - m->selection->length = selection->length; - - ecp = e_cal_popup_new("org.gnome.evolution.calendar.editor.popup.drop"); - for (i=0;i<sizeof(drop_popup_menu)/sizeof(drop_popup_menu[0]);i++) - menus = g_slist_append(menus, &drop_popup_menu[i]); - - e_popup_add_items((EPopup *)ecp, menus, NULL, drop_popup_free, m); - menu = e_popup_create_menu_once((EPopup *)ecp, NULL, 0); - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, time); - } else { - drop_action(editor, context, context->action, selection, info, time); - } + e_attachment_view_drag_data_received ( + view, context, x, y, selection, info, time); } static gboolean -drag_motion(GObject *o, GdkDragContext *context, gint x, gint y, guint time, CompEditor *editor) +drag_motion (CompEditor *editor, + GdkDragContext *context, + gint x, + gint y, + guint time) { - GList *targets; - GdkDragAction action, actions = 0; + EAttachmentView *view; - for (targets = context->targets; targets; targets = targets->next) { - int i; + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); - for (i=0;i<sizeof(drag_info)/sizeof(drag_info[0]);i++) - if (targets->data == (void *)drag_info[i].atom) - actions |= drag_info[i].actions; - } - - actions &= context->actions; - action = context->suggested_action; - /* we default to copy */ - if (action == GDK_ACTION_ASK && (actions & (GDK_ACTION_MOVE|GDK_ACTION_COPY)) != (GDK_ACTION_MOVE|GDK_ACTION_COPY)) - action = GDK_ACTION_COPY; - - gdk_drag_status(context, action, time); - - return action != 0; -} - -static void -add_to_bar (CompEditor *editor, GPtrArray *file_list, int is_inline) -{ - CompEditorPrivate *priv = editor->priv; - int i; - - for (i = 0; i < file_list->len; i++) { - CamelURL *url; - - if (!(url = camel_url_new (file_list->pdata[i], NULL))) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) { - e_attachment_bar_attach((EAttachmentBar *)priv->attachment_bar, url->path, is_inline ? "inline" : "attachment"); - } else { - e_attachment_bar_attach_remote_file ((EAttachmentBar *)priv->attachment_bar, file_list->pdata[i], is_inline ? "inline" : "attachment"); - } - - camel_url_free (url); - } + return e_attachment_view_drag_motion (view, context, x, y, time); } static GSList * get_attachment_list (CompEditor *editor) { + EAttachmentStore *store; + EAttachmentView *view; + GtkTreeModel *model; + GtkTreeIter iter; GSList *parts = NULL, *list = NULL, *p = NULL; const char *comp_uid = NULL; const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); + gboolean valid; int ticker=0; + e_cal_component_get_uid (editor->priv->comp, &comp_uid); - parts = e_attachment_bar_get_parts((EAttachmentBar *)editor->priv->attachment_bar); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); + + model = GTK_TREE_MODEL (store); + valid = gtk_tree_model_get_iter_first (model, &iter); - for (p = parts; p!=NULL ; p = p->next) { + while (valid) { + EAttachment *attachment; CamelDataWrapper *wrapper; + CamelMimePart *mime_part; CamelStream *stream; char *attach_file_url; char *safe_fname, *utf8_safe_fname; char *filename; + gint column_id; + + column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; + gtk_tree_model_get (model, &iter, column_id, &attachment, -1); + mime_part = e_attachment_get_mime_part (attachment); + g_object_unref (attachment); + + valid = gtk_tree_model_iter_next (model, &iter); + + if (mime_part == NULL) + continue; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (p->data)); @@ -814,7 +506,7 @@ save_comp (CompEditor *editor) if (result && priv->mod == CALOBJ_MOD_THIS) { /* FIXME do we really need to do this ? */ - if ((flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone, priv->client)) + if ((flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone)) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); @@ -993,20 +685,13 @@ static void action_attach_cb (GtkAction *action, CompEditor *editor) { - GPtrArray *file_list; - gboolean is_inline = FALSE; - int i; + EAttachmentStore *store; + EAttachmentView *view; - file_list = comp_editor_select_file_attachments (editor, &is_inline); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); - if (file_list) { - add_to_bar (editor, file_list, is_inline); - - for (i = 0; i < file_list->len; i++) - g_free (file_list->pdata[i]); - - g_ptr_array_free (file_list, TRUE); - } + e_attachment_store_run_load_dialog (store, GTK_WINDOW (editor)); } static void @@ -1132,12 +817,17 @@ action_save_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + EAttachmentStore *store; + EAttachmentView *view; ECalComponentText text; gboolean delegated = FALSE; gboolean read_only, correct = FALSE; ECalComponent *comp; - if (e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (editor->priv->attachment_bar)) ){ + view = E_ATTACHMENT_VIEW (priv->attachment_view); + store = e_attachment_view_get_store (view); + + if (e_attachment_store_get_num_loading (store) > 0) { gboolean response = 1; /*FIXME: Cannot use mail functions from calendar!!!! */ #if 0 @@ -1164,15 +854,11 @@ action_save_cb (GtkAction *action, } commit_all_fields (editor); - if (e_cal_component_has_recurrences (priv->comp)) { + if (e_cal_component_is_instance (priv->comp)) if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) return; - } else if (e_cal_component_is_instance (priv->comp)) - priv->mod = CALOBJ_MOD_THIS; - comp = comp_editor_get_current_comp (editor, &correct); - e_cal_component_get_summary (comp, &text); g_object_unref (comp); @@ -1518,6 +1204,40 @@ static GtkToggleActionEntry coordinated_toggle_entries[] = { }; static void +comp_editor_setup_recent_menu (CompEditor *editor) +{ + EAttachmentView *view; + GtkUIManager *ui_manager; + GtkAction *action; + GtkActionGroup *action_group; + const gchar *action_name; + const gchar *path; + guint merge_id; + + ui_manager = editor->priv->manager; + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + action_group = comp_editor_get_action_group (editor, "individual"); + merge_id = gtk_ui_manager_new_merge_id (ui_manager); + path = "/main-menu/insert-menu/recent-placeholder"; + action_name = "recent-menu"; + + action = e_attachment_view_recent_action_new ( + view, action_name, _("Recent _Documents")); + + if (action != NULL) { + gtk_action_group_add_action (action_group, action); + g_object_unref (action); + + gtk_ui_manager_add_ui ( + ui_manager, merge_id, path, + action_name, action_name, + GTK_UI_MANAGER_AUTO, FALSE); + } + + gtk_ui_manager_ensure_update (ui_manager); +} + +static void comp_editor_set_property (GObject *object, guint property_id, const GValue *value, @@ -1693,6 +1413,44 @@ comp_editor_map (GtkWidget *widget) GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget); } +static gboolean +comp_editor_delete_event (GtkWidget *widget, + GdkEventAny *event) +{ + CompEditor *editor; + + editor = COMP_EDITOR (widget); + + commit_all_fields (editor); + + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; +} + +static gboolean +comp_editor_key_press_event (GtkWidget *widget, + GdkEventKey *event) +{ + CompEditor *editor; + + editor = COMP_EDITOR (editor); + + if (event->keyval == GDK_Escape) { + commit_all_fields (editor); + + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; + } + + /* Chain up to parent's key_press_event() method. */ + return GTK_WIDGET_CLASS (comp_editor_parent_class)-> + key_press_event (widget, event); +} + static void comp_editor_class_init (CompEditorClass *class) { @@ -1713,6 +1471,8 @@ comp_editor_class_init (CompEditorClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->map = comp_editor_map; + widget_class->delete_event = comp_editor_delete_event; + widget_class->key_press_event = comp_editor_key_press_event; class->help_section = "usage-calendar"; class->edit_comp = real_edit_comp; @@ -1764,7 +1524,7 @@ comp_editor_class_init (CompEditorClass *class) NULL, G_PARAM_READWRITE)); - comp_editor_signals[OBJECT_CREATED] = + signals[OBJECT_CREATED] = g_signal_new ("object_created", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, @@ -1775,38 +1535,40 @@ comp_editor_class_init (CompEditorClass *class) } static void -classification_changed_cb (GtkRadioAction *action, GtkRadioAction *current, CompEditor *editor) -{ - g_return_if_fail (IS_COMP_EDITOR (editor)); - - comp_editor_set_changed (editor, TRUE); -} - -static void comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; GtkActionGroup *action_group; GtkAction *action; + GtkWidget *container; + GtkWidget *widget; + EShell *shell; GError *error = NULL; editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); + g_object_weak_ref ( + G_OBJECT (editor), (GWeakNotify) + comp_editor_weak_notify_cb, NULL); + + active_editors = g_list_prepend (active_editors, editor); + priv->pages = NULL; priv->changed = FALSE; priv->needs_send = FALSE; priv->mod = CALOBJ_MOD_ALL; - priv->existing_org = FALSE; - priv->user_org = FALSE; - priv->warned = FALSE; + priv->existing_org = FALSE; + priv->user_org = FALSE; + priv->warned = FALSE; priv->is_group_item = FALSE; - priv->attachment_bar = e_attachment_bar_new (NULL); priv->manager = gtk_ui_manager_new (); - gtk_window_add_accel_group ( - GTK_WINDOW (editor), - gtk_ui_manager_get_accel_group (priv->manager)); + gtk_window_add_accel_group ( + GTK_WINDOW (editor), + gtk_ui_manager_get_accel_group (priv->manager)); + + /* Setup Action Groups */ action_group = gtk_action_group_new ("core"); gtk_action_group_set_translation_domain ( @@ -1831,11 +1593,7 @@ comp_editor_init (CompEditor *editor) action_group, classification_radio_entries, G_N_ELEMENTS (classification_radio_entries), E_CAL_COMPONENT_CLASS_PUBLIC, - G_CALLBACK (classification_changed_cb), editor); - action = e_attachment_bar_recent_action_new ( - E_ATTACHMENT_BAR (priv->attachment_bar), - "attach-recent", _("Recent _Documents")); - gtk_action_group_add_action (action_group, action); + NULL, NULL); /* no callback */ gtk_ui_manager_insert_action_group ( priv->manager, action_group, 0); g_object_unref (action_group); @@ -1865,14 +1623,51 @@ comp_editor_init (CompEditor *editor) g_error_free (error); } - setup_widgets (editor); + /* Setup Widgets */ + + container = GTK_WIDGET (editor); + + widget = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + container = widget; + + widget = comp_editor_get_managed_widget (editor, "/main-menu"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + widget = e_attachment_paned_new (); + gtk_container_set_border_width (GTK_CONTAINER (widget), 6); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + priv->attachment_view = g_object_ref (widget); + gtk_widget_show (widget); + + container = e_attachment_paned_get_content_area ( + E_ATTACHMENT_PANED (priv->attachment_view)); + + widget = gtk_notebook_new (); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + priv->notebook = GTK_NOTEBOOK (widget); + gtk_widget_show (widget); + + comp_editor_setup_recent_menu (editor); /* DND support */ gtk_drag_dest_set (GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE); g_signal_connect(editor, "drag_data_received", G_CALLBACK (drag_data_received), NULL); - g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), editor); + g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), NULL); gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); + + /* FIXME Shell should be passed in. */ + shell = e_shell_get_default (); + e_shell_watch_window (shell, GTK_WINDOW (editor)); } static gboolean @@ -1925,402 +1720,17 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) } } -static int -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - - commit_all_fields (editor); - - if (prompt_and_save_changes (editor, TRUE)) - close_dialog (editor); - - return TRUE; -} - static void -attachment_bar_changed_cb (EAttachmentBar *bar, - void *data) +attachment_store_changed_cb (CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); - - guint attachment_num = e_attachment_bar_get_num_attachments ( - E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - if (attachment_num) { - gchar *num_text = g_strdup_printf ( - ngettext ("<b>%d</b> Attachment", "<b>%d</b> Attachments", attachment_num), - attachment_num); - gtk_label_set_markup (GTK_LABEL (editor->priv->attachment_expander_num), - num_text); - g_free (num_text); - - gtk_widget_show (editor->priv->attachment_expander_icon); - e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),TRUE); - - } else { - gtk_label_set_text (GTK_LABEL (editor->priv->attachment_expander_num), ""); - gtk_widget_hide (editor->priv->attachment_expander_icon); - e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),FALSE); - } - - /* Mark the editor as changed so it prompts about unsaved changes on close */ comp_editor_set_changed (editor, TRUE); - -} - -static void -attachment_expander_activate_cb (EExpander *expander, - void *data) -{ - CompEditor *editor = COMP_EDITOR (data); - gboolean show = e_expander_get_expanded (expander); - - /* Update the expander label */ - if (show) - gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label), - _("Hide Attachment _Bar")); - else - gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label), - _("Show Attachment _Bar")); -} - -static gboolean -open_attachment (EAttachmentBar *bar, CompEditor *editor) -{ - GnomeIconList *icon_list; - GList *p; - int num; - char *attach_file_url; - - if (E_IS_ATTACHMENT_BAR (bar)) { - icon_list = GNOME_ICON_LIST (bar); - p = gnome_icon_list_get_selection (icon_list); - if (p) { - EAttachment *attachment; - GSList *list; - const char *comp_uid = NULL; - char *filename = NULL; - const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); - - e_cal_component_get_uid (editor->priv->comp, &comp_uid); - num = GPOINTER_TO_INT (p->data); - list = e_attachment_bar_get_attachment (bar, num); - attachment = list->data; - g_slist_free (list); - - filename = g_strdup_printf ("%s-%s", - comp_uid, - camel_mime_part_get_filename(attachment->body)); - - attach_file_url = g_build_path ("/", local_store, filename, NULL); - - /* launch the url now */ - e_show_uri (GTK_WINDOW (editor), attach_file_url); - - g_free (filename); - g_free (attach_file_url); } - return TRUE; - } else - return FALSE; -} - -static gboolean -attachment_bar_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, CompEditor *editor) -{ - if (E_IS_ATTACHMENT_BAR (bar) && event->type == GDK_2BUTTON_PRESS) - if (open_attachment (bar, editor)) - return TRUE; - return FALSE; -} - -/* Callbacks. */ - -static void -cab_open(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - - if (!open_attachment (bar, editor)) - g_message ("\n Open failed"); -} - -static void -cab_add(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - GPtrArray *file_list; - gboolean is_inline = FALSE; - int i; - - file_list = comp_editor_select_file_attachments (editor, &is_inline); - /*TODO add a good implementation here */ - if (!file_list) - return; - for (i = 0; i < file_list->len; i++) { - CamelURL *url; - - url = camel_url_new (file_list->pdata[i], NULL); - if (url == NULL) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach (bar, url->path, is_inline ? "inline" : "attachment"); - else - e_attachment_bar_attach_remote_file (bar, file_list->pdata[i], is_inline ? "inline" : "attachment"); - g_free (file_list->pdata[i]); - camel_url_free (url); - } - - g_ptr_array_free (file_list, TRUE); -} - -static void -cab_properties(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - - e_attachment_bar_edit_selected(bar); -} - -static void -cab_remove(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - - e_attachment_bar_remove_selected(bar); -} - -/* Popup menu handling. */ -static EPopupItem cab_popups[] = { - { E_POPUP_ITEM, "10.attach", N_("_Open"), cab_open, NULL, GTK_STOCK_OPEN, E_CAL_POPUP_ATTACHMENTS_ONE}, - { E_POPUP_ITEM, "20.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY | E_CAL_POPUP_ATTACHMENTS_MODIFY }, - { E_POPUP_ITEM, "30.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, E_CAL_POPUP_ATTACHMENTS_ONE }, - { E_POPUP_BAR, "40.attach.00", NULL, NULL, NULL, NULL, E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE }, - { E_POPUP_ITEM, "40.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, E_CAL_POPUP_ATTACHMENTS_MODIFY}, -}; - -static void -cab_popup_position(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer user_data) -{ - EAttachmentBar *bar = user_data; - GnomeIconList *icon_list = user_data; - GList *selection; - GnomeCanvasPixbuf *image; - - gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - - selection = gnome_icon_list_get_selection (icon_list); - if (selection == NULL) - return; - - image = gnome_icon_list_get_icon_pixbuf_item (icon_list, GPOINTER_TO_INT(selection->data)); - if (image == NULL) - return; - - /* Put menu to the center of icon. */ - *x += (int)(image->item.x1 + image->item.x2) / 2; - *y += (int)(image->item.y1 + image->item.y2) / 2; -} - -static void -cab_popups_free(EPopup *ep, GSList *l, void *data) -{ - g_slist_free(l); -} - -/* if id != -1, then use it as an index for target of the popup */ -static void -cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) -{ - GSList *attachments = NULL, *menus = NULL; - int i; - ECalPopup *ecp; - ECalPopupTargetAttachments *t; - GtkMenu *menu; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - - attachments = e_attachment_bar_get_attachment(bar, id); - - for (i=0;i<sizeof(cab_popups)/sizeof(cab_popups[0]);i++) - menus = g_slist_prepend(menus, &cab_popups[i]); - - /** @HookPoint-ECalPopup: Calendar Attachment Bar Context Menu - * @Id: org.gnome.evolution.calendar.attachmentbar.popup - * @Class: org.gnome.evolution.mail.popup:1.0 - * @Target: ECalPopupTargetAttachments - * - * This is the context menu on the calendar attachment bar. - */ - ecp = e_cal_popup_new("org.gnome.evolution.calendar.attachmentbar.popup"); - e_popup_add_items((EPopup *)ecp, menus, NULL, cab_popups_free, bar); - t = e_cal_popup_target_new_attachments(ecp, editor, attachments); - t->target.widget = (GtkWidget *)bar; - menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0); - - if (event == NULL) - gtk_menu_popup(menu, NULL, NULL, cab_popup_position, bar, 0, gtk_get_current_event_time()); - else - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); -} - -/* GtkWidget methods. */ - -static gboolean -popup_menu_event (EAttachmentBar *bar) -{ - cab_popup (bar, NULL, -1); - - return TRUE; -} - - -static int -button_press_event (EAttachmentBar *bar, - GdkEventButton *event) -{ - GnomeIconList *icon_list = GNOME_ICON_LIST (bar); - int icon_number = -1; - - if (event->button != 3) - return FALSE; - - if (!gnome_icon_list_get_selection (icon_list)) { - icon_number = gnome_icon_list_get_icon_at (icon_list, event->x, event->y); - if (icon_number >= 0) { - gnome_icon_list_unselect_all(icon_list); - gnome_icon_list_select_icon (icon_list, icon_number); - } - } - - cab_popup(bar, event, icon_number); - - return TRUE; -} - -static gint -key_press_event (EAttachmentBar *bar, - GdkEventKey *event) -{ - if (event->keyval == GDK_Delete) { - e_attachment_bar_remove_selected (bar); - return TRUE; - } - - return FALSE; -} - -static gint -editor_key_press_event (CompEditor *editor, - GdkEventKey *event) -{ - if (event->keyval == GDK_Escape) { - commit_all_fields (editor); - - if (prompt_and_save_changes (editor, TRUE)) - close_dialog (editor); - - return TRUE; - } - - return FALSE; } /* Menu callbacks */ static void -setup_widgets (CompEditor *editor) -{ - CompEditorPrivate *priv; - GtkWidget *expander_hbox; - GtkWidget *widget; - GtkWidget *vbox; - - priv = editor->priv; - - /* Useful vbox */ - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (editor), vbox); - gtk_widget_show (vbox); - - /* Main Menu */ - widget = comp_editor_get_managed_widget (editor, "/main-menu"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - gtk_widget_show (widget); - - /* Main Toolbar */ - widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - gtk_widget_show (widget); - - /* Notebook */ - widget = gtk_notebook_new (); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); - gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0); - gtk_widget_show (widget); - priv->notebook = GTK_NOTEBOOK (widget); - - g_signal_connect (editor, "delete_event", G_CALLBACK (delete_event_cb), editor); - g_signal_connect (editor, "key_press_event", G_CALLBACK (editor_key_press_event), editor); - - /*Attachments */ - priv->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window), - GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - g_signal_connect (priv->attachment_bar, "button_press_event", G_CALLBACK (button_press_event), NULL); - g_signal_connect (priv->attachment_bar, "key_press_event", G_CALLBACK (key_press_event), NULL); - g_signal_connect (priv->attachment_bar, "popup-menu", G_CALLBACK (popup_menu_event), NULL); - - GTK_WIDGET_SET_FLAGS (priv->attachment_bar, GTK_CAN_FOCUS); - gtk_container_add (GTK_CONTAINER (priv->attachment_scrolled_window), - priv->attachment_bar); - gtk_widget_show (priv->attachment_bar); - g_signal_connect (priv->attachment_bar, "changed", - G_CALLBACK (attachment_bar_changed_cb), editor); - g_signal_connect (GNOME_ICON_LIST (priv->attachment_bar), "event", - G_CALLBACK (attachment_bar_icon_clicked_cb), editor); - priv->attachment_expander_label = - gtk_label_new_with_mnemonic (_("Show Attachment _Bar")); - priv->attachment_expander_num = gtk_label_new (""); - gtk_label_set_use_markup (GTK_LABEL (priv->attachment_expander_num), TRUE); - gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_label), 0.0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_num), 1.0, 0.5); - expander_hbox = gtk_hbox_new (FALSE, 0); - - priv->attachment_expander_icon = gtk_image_new_from_icon_name ("mail-attachment", GTK_ICON_SIZE_MENU); - gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_icon), 1, 0.5); - gtk_widget_set_size_request (priv->attachment_expander_icon, 100, -1); - - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_label, - TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_icon, - TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_num, - TRUE, TRUE, 0); - gtk_widget_show_all (expander_hbox); - gtk_widget_hide (priv->attachment_expander_icon); - - priv->attachment_expander = e_expander_new (""); - e_expander_set_label_widget (E_EXPANDER (priv->attachment_expander), expander_hbox); - atk_object_set_name (gtk_widget_get_accessible (priv->attachment_expander), _("Show Attachments")); - atk_object_set_description (gtk_widget_get_accessible (priv->attachment_expander), _("Press space key to toggle attachment bar")); - gtk_container_add (GTK_CONTAINER (priv->attachment_expander), priv->attachment_scrolled_window); - - gtk_box_pack_start (GTK_BOX (vbox), priv->attachment_expander, FALSE, FALSE, 4); - gtk_widget_show (priv->attachment_expander); - e_expander_set_expanded (E_EXPANDER (priv->attachment_expander), FALSE); - g_signal_connect_after (priv->attachment_expander, "activate", - G_CALLBACK (attachment_expander_activate_cb), editor); -} - - -static void comp_editor_show_help (CompEditor *editor) { CompEditorClass *class; @@ -2348,7 +1758,18 @@ close_dialog (CompEditor *editor) gtk_widget_destroy (GTK_WIDGET (editor)); } - +gint +comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b) +{ + const gchar *uid_a = NULL; + const gchar *uid_b = NULL; + + e_cal_component_get_uid (editor_a->priv->comp, &uid_a); + e_cal_component_get_uid (editor_b->priv->comp, &uid_b); + + return g_strcmp0 (uid_a, uid_b); +} void comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) @@ -2538,9 +1959,9 @@ comp_editor_set_flags (CompEditor *editor, g_object_notify (G_OBJECT (editor), "flags"); } - -CompEditorFlags -comp_editor_get_flags (CompEditor *editor) +GtkActionGroup * +comp_editor_get_action_group (CompEditor *editor, + const gchar *group_name) { g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); @@ -2559,46 +1980,28 @@ GtkAction * comp_editor_get_action (CompEditor *editor, const gchar *action_name) { - GtkAction *action = NULL; - GList *iter; + GtkUIManager *ui_manager; g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); g_return_val_if_fail (action_name != NULL, NULL); - iter = gtk_ui_manager_get_action_groups (editor->priv->manager); - while (iter != NULL && action == NULL) { - GtkActionGroup *action_group = iter->data; + ui_manager = comp_editor_get_ui_manager (editor); - action = gtk_action_group_get_action ( - action_group, action_name); - iter = g_list_next (iter); - } - g_return_val_if_fail (action != NULL, NULL); - - return action; + return e_lookup_action (ui_manager, action_name); } GtkActionGroup * comp_editor_get_action_group (CompEditor *editor, const gchar *group_name) { - GList *iter; + GtkUIManager *ui_manager; g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); g_return_val_if_fail (group_name != NULL, NULL); - iter = gtk_ui_manager_get_action_groups (editor->priv->manager); - while (iter != NULL) { - GtkActionGroup *action_group = iter->data; - const gchar *name; - - name = gtk_action_group_get_name (action_group); - if (strcmp (name, group_name) == 0) - return action_group; - iter = g_list_next (iter); - } + ui_manager = comp_editor_get_ui_manager (editor); - g_return_val_if_reached (NULL); + return e_lookup_action_group (ui_manager, group_name); } GtkWidget * @@ -2618,6 +2021,20 @@ comp_editor_get_managed_widget (CompEditor *editor, return widget; } +CompEditor * +comp_editor_find_instance (const gchar *uid) +{ + GList *link; + + g_return_val_if_fail (uid != NULL, NULL); + + link = g_list_find_custom ( + active_editors, uid, + (GCompareFunc) comp_editor_compare); + + return (link != NULL) ? link->data : NULL; +} + /** * comp_editor_set_needs_send: * @editor: A component editor @@ -2859,12 +2276,14 @@ comp_editor_get_client (CompEditor *editor) static void set_attachment_list (CompEditor *editor, GSList *attach_list) { - GSList *p = NULL; - const char *comp_uid= NULL; + EAttachmentStore *store; + EAttachmentView *view; + GSList *iter = NULL; - e_cal_component_get_uid (editor->priv->comp, &comp_uid); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); - if (e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar))) { + if (e_attachment_store_get_num_attachments (store) > 0) { /* To prevent repopulating the * bar due to redraw functions in fill_widget. * Assumes it can be set only once. @@ -2872,101 +2291,44 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) return; } - for (p = attach_list; p != NULL; p = p->next) { - char *attach_filename; - CamelMimePart *part; - CamelDataWrapper *wrapper; - CamelStream *stream; - struct stat statbuf; - char *mime_type, *file_name; - char *ptr; - - attach_filename = (char *) p->data; - /* should we assert if g_str_has_prefix (attach_filename, "file://")) - * here - */ - /* get url sans protocol and add it to the bar. - * how to set the filename properly */ - file_name = g_filename_from_uri (attach_filename, NULL, NULL); - if (!file_name) - continue; + for (iter = attach_list; iter != NULL; iter = iter->next) { + EAttachment *attachment; + const gchar *uri = iter->data; - if (g_stat (file_name, &statbuf) < 0) { - g_warning ("Cannot attach file %s: %s", file_name, g_strerror (errno)); - g_free (file_name); - continue; - } - - /* return if it's not a regular file */ - if (!S_ISREG (statbuf.st_mode)) { - g_warning ("Cannot attach file %s: not a regular file", file_name); - g_free (file_name); - return; - } - - stream = camel_stream_fs_new_with_name (file_name, O_RDONLY, 0); - if (!stream) { - g_warning ("Cannot attach file %s: %s", file_name, g_strerror (errno)); - g_free (file_name); - return; - } - - mime_type = e_util_guess_mime_type (file_name, TRUE); - if (mime_type) { - if (!g_ascii_strcasecmp (mime_type, "message/rfc822")) { - wrapper = (CamelDataWrapper *) camel_mime_message_new (); - } else { - wrapper = camel_data_wrapper_new (); - } - - camel_data_wrapper_construct_from_stream (wrapper, stream); - camel_data_wrapper_set_mime_type (wrapper, mime_type); - g_free (mime_type); - } else { - wrapper = camel_data_wrapper_new (); - camel_data_wrapper_construct_from_stream (wrapper, stream); - camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream"); - } - - camel_object_unref (stream); - - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (wrapper); - - camel_mime_part_set_disposition (part, "attachment"); - - ptr = strstr (file_name, comp_uid); - if (ptr) { - ptr += strlen(comp_uid); - if (*ptr++ == '-') - camel_mime_part_set_filename (part, ptr); - } - g_free (file_name); - - e_attachment_bar_attach_mime_part ((EAttachmentBar *) editor->priv->attachment_bar, part); - e_expander_set_expanded (E_EXPANDER (editor->priv->attachment_expander), TRUE); - - camel_object_unref (part); + attachment = e_attachment_new_for_uri (uri); + e_attachment_store_add_attachment (store, attachment); + e_attachment_load_async ( + attachment, (GAsyncReadyCallback) + e_attachment_load_handle_error, editor); + g_object_unref (attachment); } } static void fill_widgets (CompEditor *editor) { + EAttachmentStore *store; + EAttachmentView *view; CompEditorPrivate *priv; GList *l; GtkAction *action; + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); + priv = editor->priv; /*Check if attachments are available here and set them*/ if (e_cal_component_has_attachments (priv->comp)) { GSList *attachment_list = NULL; e_cal_component_get_attachment_list (priv->comp, &attachment_list); - g_signal_handlers_block_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); + g_signal_handlers_block_by_func ( + store, G_CALLBACK (attachment_store_changed_cb), + editor); set_attachment_list (editor, attachment_list); - g_signal_handlers_unblock_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); + g_signal_handlers_unblock_by_func( + store, G_CALLBACK (attachment_store_changed_cb), + editor); g_slist_foreach (attachment_list, (GFunc)g_free, NULL); g_slist_free (attachment_list); } @@ -2976,8 +2338,6 @@ fill_widgets (CompEditor *editor) for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_widgets (l->data, priv->comp); - - g_signal_handlers_unblock_by_func (action, G_CALLBACK (classification_changed_cb), editor); } static void @@ -3297,20 +2657,41 @@ comp_editor_close (CompEditor *editor) GSList * comp_editor_get_mime_attach_list (CompEditor *editor) { + EAttachmentStore *store; + EAttachmentView *view; + GtkTreeModel *model; + GtkTreeIter iter; struct CalMimeAttach *cal_mime_attach; - GSList *attach_list = NULL, *l, *parts; + GSList *attach_list = NULL; + gboolean valid; + + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); - /* TODO assert sanity of bar */ - parts = e_attachment_bar_get_parts (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - for (l = parts; l ; l = l->next) { + model = GTK_TREE_MODEL (store); + valid = gtk_tree_model_get_iter_first (model, &iter); + while (valid) { + EAttachment *attachment; CamelDataWrapper *wrapper; + CamelMimePart *mime_part; CamelStreamMem *mstream; unsigned char *buffer = NULL; const char *desc, *disp; + gint column_id; + + column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; + gtk_tree_model_get (model, &iter, column_id, &attachment, -1); + mime_part = e_attachment_get_mime_part (attachment); + g_object_unref (attachment); + + valid = gtk_tree_model_iter_next (model, &iter); + + if (mime_part == NULL) + continue; cal_mime_attach = g_malloc0 (sizeof (struct CalMimeAttach)); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (l->data)); + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); mstream = (CamelStreamMem *) camel_stream_mem_new (); camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream); @@ -3318,15 +2699,14 @@ comp_editor_get_mime_attach_list (CompEditor *editor) cal_mime_attach->encoded_data = (char *)buffer; cal_mime_attach->length = mstream->buffer->len; - cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename - ((CamelMimePart *) l->data)); - desc = camel_mime_part_get_description ((CamelMimePart *) l->data); + cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part)); + desc = camel_mime_part_get_description (mime_part); if (!desc || *desc == '\0') desc = _("attachment"); cal_mime_attach->description = g_strdup (desc); cal_mime_attach->content_type = g_strdup (camel_data_wrapper_get_mime_type (wrapper)); - disp = camel_mime_part_get_disposition ((CamelMimePart *)l->data); + disp = camel_mime_part_get_disposition (mime_part); if (disp && !g_ascii_strcasecmp(disp, "inline")) cal_mime_attach->disposition = TRUE; @@ -3336,8 +2716,6 @@ comp_editor_get_mime_attach_list (CompEditor *editor) } - g_slist_free (parts); - return attach_list; } @@ -3361,9 +2739,10 @@ page_dates_changed_cb (CompEditor *editor, } static void -obj_modified_cb (ECal *client, GList *objects, gpointer data) +obj_modified_cb (ECal *client, + GList *objects, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; ECalComponent *comp = NULL; @@ -3396,12 +2775,11 @@ obj_modified_cb (ECal *client, GList *objects, gpointer data) } static void -obj_removed_cb (ECal *client, GList *uids, gpointer data) +obj_removed_cb (ECal *client, + GList *uids, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; + CompEditorPrivate *priv = editor->priv; if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) close_dialog (editor); diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index ab277febf7..7fdc17ba16 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -87,6 +87,8 @@ typedef enum { } CompEditorFlags; GType comp_editor_get_type (void); +gint comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b); void comp_editor_set_changed (CompEditor *editor, gboolean changed); gboolean comp_editor_get_changed (CompEditor *editor); @@ -150,6 +152,7 @@ GtkActionGroup * const gchar *group_name); GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); +CompEditor * comp_editor_find_instance (const gchar *uid); G_END_DECLS diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index a579d77348..812575ef4c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -36,7 +36,6 @@ #include <misc/e-dateedit.h> #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> #include "event-page.h" #include "recurrence-page.h" @@ -466,6 +465,7 @@ event_editor_init (EventEditor *ee) GtkUIManager *manager; GtkActionGroup *action_group; GtkAction *action; + const gchar *id; GError *error = NULL; ee->priv = EVENT_EDITOR_GET_PRIVATE (ee); @@ -488,7 +488,10 @@ event_editor_init (EventEditor *ee) manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error); - e_plugin_ui_register_manager ("event-editor", manager, ee); + + id = "org.gnome.evolution.event-editor"; + e_plugin_ui_register_manager (manager, id, ee); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 2644afb05b..b0fcdc4632 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1801,15 +1801,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + EventPage *page) { - EventPage *page; - EventPagePrivate *priv; - - page = EVENT_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } static void @@ -2469,14 +2464,10 @@ times_updated (EventPage *epage, gboolean adjust_end_time) * start date < end date and we set the "all day event" button as appropriate. */ static void -start_date_changed_cb (GtkWidget *dedit, gpointer data) +start_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - hour_minute_changed (epage); - times_updated (epage, TRUE); } @@ -2484,12 +2475,9 @@ start_date_changed_cb (GtkWidget *dedit, gpointer data) * start date < end date and we set the "all day event" button as appropriate. */ static void -end_date_changed_cb (GtkWidget *dedit, gpointer data) +end_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - times_updated (epage, FALSE); } @@ -2498,15 +2486,12 @@ end_date_changed_cb (GtkWidget *dedit, gpointer data) * labels on the other notebook pages. */ static void -start_timezone_changed_cb (GtkWidget *widget, gpointer data) +start_timezone_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; + EventPagePrivate *priv = epage->priv; icaltimezone *zone; - epage = EVENT_PAGE (data); - priv = epage->priv; - if (priv->sync_timezones) { zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), TRUE); @@ -2523,17 +2508,13 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data) * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - GtkWidget *entry; - - epage = EVENT_PAGE (data); - priv = epage->priv; + GtkEntry *entry; - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (epage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } void @@ -2652,13 +2633,10 @@ set_subscriber_info_string (EventPage *epage, const char *backend_address) } static void -alarm_changed_cb (GtkWidget *widget, gpointer data) +alarm_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; + EventPagePrivate *priv = epage->priv; if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 4fbf35d916..5e01327703 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -34,7 +34,6 @@ #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> #include "memo-page.h" #include "cancel-comp.h" @@ -135,6 +134,7 @@ memo_editor_init (MemoEditor *me) { CompEditor *editor = COMP_EDITOR (me); GtkUIManager *manager; + const gchar *id; GError *error = NULL; me->priv = MEMO_EDITOR_GET_PRIVATE (me); @@ -142,7 +142,10 @@ memo_editor_init (MemoEditor *me) manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error); - e_plugin_ui_register_manager ("memo-editor", manager, me); + + id = "org.gnome.evolution.memo-editor"; + e_plugin_ui_register_manager (manager, id, me); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index b1ff10f3f4..8728c9366e 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,6 +159,7 @@ <widget class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="label" translatable="yes">_Description:</property> + <property name="mnemonic_widget">memo_content</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 959c275443..82fb75564a 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -517,16 +517,15 @@ complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) } static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskDetailsPage *tdpage) { - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; + TaskDetailsPagePrivate *priv = tdpage->priv; CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; struct icaltimetype completed_tt = icaltime_null_time (); icalproperty_status status; gboolean date_set; - tdpage = TASK_DETAILS_PAGE (data); priv = tdpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage))) diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index 44fc3b2fbb..aac90876ed 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -4,7 +4,7 @@ <glade-interface> <widget class="GtkWindow" id="task-details-toplevel"> - <property name="title">window1</property> + <property name="title" translatable="no">window1</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> @@ -15,8 +15,6 @@ <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> <child> <widget class="GtkVBox" id="task-details-page"> @@ -38,10 +36,6 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -69,10 +63,6 @@ <property name="yalign">0.5</property> <property name="xpad">12</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -103,10 +93,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <property name="mnemonic_widget">status</property> </widget> <packing> <property name="left_attach">0</property> @@ -132,10 +119,6 @@ <property name="xpad">0</property> <property name="ypad">0</property> <property name="mnemonic_widget">percent-complete</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> @@ -160,10 +143,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <property name="mnemonic_widget">priority</property> </widget> <packing> <property name="left_attach">0</property> @@ -188,10 +168,6 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> @@ -204,85 +180,153 @@ </child> <child> - <widget class="GtkSpinButton" id="percent-complete"> + <widget class="GtkOptionMenu" id="priority"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">0 0 100 1 10 0</property> + <property name="history">0</property> + + <child internal-child="menu"> + <widget class="GtkMenu" id="convertwidget7"> + <property name="visible">True</property> + + <child> + <widget class="GtkMenuItem" id="convertwidget8"> + <property name="visible">True</property> + <property name="label" translatable="yes">High</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget9"> + <property name="visible">True</property> + <property name="label" translatable="yes">Normal</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget10"> + <property name="visible">True</property> + <property name="label" translatable="yes">Low</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget11"> + <property name="visible">True</property> + <property name="label" translatable="yes">Undefined</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="Custom" id="completed-date"> + <widget class="GtkOptionMenu" id="status"> <property name="visible">True</property> - <property name="creation_function">task_details_page_create_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property> - <accessibility> - <atkrelation target="date_completed_label" type="labelled-by"/> - </accessibility> + <property name="can_focus">True</property> + <property name="history">0</property> + + <child internal-child="menu"> + <widget class="GtkMenu" id="convertwidget1"> + <property name="visible">True</property> + + <child> + <widget class="GtkMenuItem" id="convertwidget2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Not Started</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget3"> + <property name="visible">True</property> + <property name="label" translatable="yes">In Progress</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Completed</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Canceled</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="priority-combobox"> + <widget class="GtkSpinButton" id="percent-complete"> <property name="visible">True</property> - <property name="items" translatable="yes">High -Normal -Low -Undefined</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">True</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">0 0 100 1 10 0</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="status-combobox"> + <widget class="Custom" id="completed-date"> <property name="visible">True</property> - <property name="items" translatable="yes">Not Started -In Progress -Completed -Canceled</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> + <property name="creation_function">task_details_page_create_date_edit</property> + <property name="int1">0</property> + <property name="int2">0</property> + <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property> + <accessibility> + <atkrelation target="date_completed_label" type="labelled-by"/> + </accessibility> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -313,10 +357,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -344,10 +384,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">12</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -379,10 +415,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 4b8f8698b9..773dea4a47 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -35,7 +35,6 @@ #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> #include "task-page.h" #include "task-details-page.h" @@ -304,6 +303,7 @@ task_editor_init (TaskEditor *te) CompEditor *editor = COMP_EDITOR (te); GtkUIManager *manager; GtkActionGroup *action_group; + const gchar *id; GError *error = NULL; te->priv = TASK_EDITOR_GET_PRIVATE (te); @@ -346,7 +346,10 @@ task_editor_init (TaskEditor *te) manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error); - e_plugin_ui_register_manager ("task-editor", manager, te); + + id = "org.gnome.evolution.task-editor"; + e_plugin_ui_register_manager (manager, id, te); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index c3a8e34ba0..486b86ea34 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1125,15 +1125,10 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + TaskPage *page) { - TaskPage *page; - TaskPagePrivate *priv; - - page = TASK_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } static void @@ -1494,17 +1489,16 @@ summary_changed_cb (GtkEditable *editable, * other pages in the task editor, so they can update any labels. */ static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; + TaskPagePrivate *priv = tpage->priv; CompEditorPageDates dates; gboolean date_set, time_set; ECalComponentDateTime start_dt, due_dt; struct icaltimetype start_tt = icaltime_null_time(); struct icaltimetype due_tt = icaltime_null_time(); - tpage = TASK_PAGE (data); priv = tpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) @@ -1563,30 +1557,21 @@ date_changed_cb (EDateEdit *dedit, gpointer data) } static void -timezone_changed_cb (EDateEdit *dedit, gpointer data) +timezone_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - date_changed_cb ((EDateEdit *) priv->start_date, tpage); - date_changed_cb ((EDateEdit *) priv->due_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->start_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->due_date, tpage); } /* Callback used when the categories button is clicked; we must bring up the * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; - GtkWidget *entry; - - tpage = TASK_PAGE (data); - priv = tpage->priv; + GtkEntry *entry; entry = priv->categories; e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); |