Exemplo n.º 1
0
static void
attachment_bar_set_store (EAttachmentBar *bar,
                          EAttachmentStore *store)
{
	g_return_if_fail (E_IS_ATTACHMENT_STORE (store));

	bar->priv->model = g_object_ref (store);

	gtk_icon_view_set_model (
		GTK_ICON_VIEW (bar->priv->icon_view),
		bar->priv->model);
	gtk_tree_view_set_model (
		GTK_TREE_VIEW (bar->priv->tree_view),
		bar->priv->model);

	e_signal_connect_notify_object (
		bar->priv->model, "notify::num-attachments",
		G_CALLBACK (attachment_bar_update_status), bar,
		G_CONNECT_SWAPPED);

	e_signal_connect_notify_object (
		bar->priv->model, "notify::total-size",
		G_CALLBACK (attachment_bar_update_status), bar,
		G_CONNECT_SWAPPED);

	/* Initialize */
	attachment_bar_update_status (bar);
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
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");
	}
}
Exemplo n.º 4
0
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);
	}
}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
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);
	}
}
Exemplo n.º 8
0
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);
	}
}