static void attachment_store_load_failed_cb (EAttachment *attachment, gpointer user_data) { EAttachmentStore *store = user_data; g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); e_attachment_store_remove_attachment (store, attachment); }
static void call_attachment_load_handle_error (GObject *source_object, GAsyncResult *result, gpointer user_data) { GtkWindow *window = user_data; g_return_if_fail (E_IS_ATTACHMENT (source_object)); g_return_if_fail (!window || GTK_IS_WINDOW (window)); e_attachment_load_handle_error (E_ATTACHMENT (source_object), result, window); g_clear_object (&window); }
static void attachment_store_attachment_notify_cb (GObject *attachment, GParamSpec *param, gpointer user_data) { EAttachmentStore *store = user_data; g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_return_if_fail (param != NULL); g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); if (g_str_equal (param->name, "loading")) { g_object_notify (G_OBJECT (store), "num-loading"); } else if (g_str_equal (param->name, "file-info")) { g_object_notify (G_OBJECT (store), "total-size"); } }
static void attachment_store_update_icon_cb (EAttachment *attachment, GIcon *icon, gpointer user_data) { EAttachmentStore *store = user_data; GtkTreeIter iter; g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); if (e_attachment_store_find_attachment_iter (store, attachment, &iter)) { gtk_list_store_set ( GTK_LIST_STORE (store), &iter, E_ATTACHMENT_STORE_COLUMN_ICON, icon, -1); } }
static void attachment_store_attachment_removed (EAttachmentStore *store, EAttachment *attachment) { g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_signal_handlers_disconnect_by_func (attachment, G_CALLBACK (attachment_store_update_file_info_cb), store); g_signal_handlers_disconnect_by_func (attachment, G_CALLBACK (attachment_store_update_icon_cb), store); g_signal_handlers_disconnect_by_func (attachment, G_CALLBACK (attachment_store_update_progress_cb), store); g_signal_handlers_disconnect_by_func (attachment, G_CALLBACK (attachment_store_load_failed_cb), store); g_signal_handlers_disconnect_by_func (attachment, G_CALLBACK (attachment_store_attachment_notify_cb), store); }
static void attachment_store_attachment_added (EAttachmentStore *store, EAttachment *attachment) { g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_signal_connect (attachment, "update-file-info", G_CALLBACK (attachment_store_update_file_info_cb), store); g_signal_connect (attachment, "update-icon", G_CALLBACK (attachment_store_update_icon_cb), store); g_signal_connect (attachment, "update-progress", G_CALLBACK (attachment_store_update_progress_cb), store); g_signal_connect (attachment, "load-failed", G_CALLBACK (attachment_store_load_failed_cb), store); g_signal_connect (attachment, "notify", G_CALLBACK (attachment_store_attachment_notify_cb), store); e_attachment_update_store_columns (attachment); }
static void attachment_store_update_progress_cb (EAttachment *attachment, gboolean loading, gboolean saving, gint percent, gpointer user_data) { EAttachmentStore *store = user_data; GtkTreeIter iter; g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); if (e_attachment_store_find_attachment_iter (store, attachment, &iter)) { gtk_list_store_set ( GTK_LIST_STORE (store), &iter, E_ATTACHMENT_STORE_COLUMN_LOADING, loading, E_ATTACHMENT_STORE_COLUMN_SAVING, saving, E_ATTACHMENT_STORE_COLUMN_PERCENT, percent, -1); } }
static void attachment_button_select_path (EAttachmentButton *button) { EAttachmentView *view; EAttachment *attachment; GtkTreeRowReference *reference; GtkTreePath *path; attachment = e_attachment_button_get_attachment (button); g_return_if_fail (E_IS_ATTACHMENT (attachment)); reference = e_attachment_get_reference (attachment); g_return_if_fail (gtk_tree_row_reference_valid (reference)); view = e_attachment_button_get_view (button); path = gtk_tree_row_reference_get_path (reference); e_attachment_view_unselect_all (view); e_attachment_view_select_path (view, path); gtk_tree_path_free (path); }
static void attachment_store_update_file_info_cb (EAttachment *attachment, const gchar *caption, const gchar *content_type, const gchar *description, gint64 size, gpointer user_data) { EAttachmentStore *store = user_data; GtkTreeIter iter; g_return_if_fail (E_IS_ATTACHMENT (attachment)); g_return_if_fail (E_IS_ATTACHMENT_STORE (store)); if (e_attachment_store_find_attachment_iter (store, attachment, &iter)) { gtk_list_store_set ( GTK_LIST_STORE (store), &iter, E_ATTACHMENT_STORE_COLUMN_CAPTION, caption, E_ATTACHMENT_STORE_COLUMN_CONTENT_TYPE, content_type, E_ATTACHMENT_STORE_COLUMN_DESCRIPTION, description, E_ATTACHMENT_STORE_COLUMN_SIZE, size, -1); } }