예제 #1
0
static void
attachment_button_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
                                GParamSpec *pspec)
{
	switch (property_id) {
		case PROP_ATTACHMENT:
			e_attachment_button_set_attachment (
				E_ATTACHMENT_BUTTON (object),
				g_value_get_object (value));
			return;

		case PROP_EXPANDABLE:
			e_attachment_button_set_expandable (
				E_ATTACHMENT_BUTTON (object),
				g_value_get_boolean (value));
			return;

		case PROP_EXPANDED:
			e_attachment_button_set_expanded (
				E_ATTACHMENT_BUTTON (object),
				g_value_get_boolean (value));
			return;

		case PROP_VIEW:
			e_attachment_button_set_view (
				E_ATTACHMENT_BUTTON (object),
				g_value_get_object (value));
			return;
	}

	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
예제 #2
0
static void
attachment_button_get_property (GObject *object,
                                guint property_id,
                                GValue *value,
                                GParamSpec *pspec)
{
	switch (property_id) {
		case PROP_ATTACHMENT:
			g_value_set_object (
				value,
				e_attachment_button_get_attachment (
				E_ATTACHMENT_BUTTON (object)));
			return;

		case PROP_EXPANDABLE:
			g_value_set_boolean (
				value,
				e_attachment_button_get_expandable (
				E_ATTACHMENT_BUTTON (object)));
			return;

		case PROP_EXPANDED:
			g_value_set_boolean (
				value,
				e_attachment_button_get_expanded (
				E_ATTACHMENT_BUTTON (object)));
			return;

		case PROP_VIEW:
			g_value_set_object (
				value,
				e_attachment_button_get_view (
				E_ATTACHMENT_BUTTON (object)));
			return;

		case PROP_ZOOM_TO_WINDOW:
			g_value_set_boolean (
				value,
				e_attachment_button_get_zoom_to_window (
				E_ATTACHMENT_BUTTON (object)));
			return;
	}

	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
예제 #3
0
static void
attachment_button_style_updated (GtkWidget *widget)
{
	EAttachmentButton *button;

	/* Chain up to parent's method. */
	GTK_WIDGET_CLASS (e_attachment_button_parent_class)->style_updated (widget);

	button = E_ATTACHMENT_BUTTON (widget);
	attachment_button_update_pixbufs (button);
}
static GtkWidget *
emfe_attachment_get_widget (EMailFormatterExtension *extension,
                            EMailPartList *context,
                            EMailPart *part,
                            GHashTable *params)
{
	EAttachment *attachment;
	EAttachmentStore *store;
	EAttachmentView *view;
	GtkWidget *widget;
	const gchar *part_id;

	g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT (part), NULL);

	attachment = e_mail_part_attachment_ref_attachment (
		E_MAIL_PART_ATTACHMENT (part));

	part_id = e_mail_part_get_id (part);

	store = find_attachment_store (context, part);
	widget = e_attachment_button_new ();
	g_object_set_data_full (
		G_OBJECT (widget),
		"uri", g_strdup (part_id),
		(GDestroyNotify) g_free);
	e_attachment_button_set_attachment (
		E_ATTACHMENT_BUTTON (widget), attachment);

	view = g_object_get_data (G_OBJECT (store), "attachment-bar");
	if (view != NULL)
		e_attachment_button_set_view (
			E_ATTACHMENT_BUTTON (widget), view);

	gtk_widget_set_can_focus (widget, TRUE);
	gtk_widget_show (widget);

	g_object_unref (attachment);

	return widget;
}
예제 #5
0
static void
attachment_button_style_set (GtkWidget *widget,
                             GtkStyle *previous_style)
{
	EAttachmentButton *button;

	/* Chain up to parent's style_set() method. */
	GTK_WIDGET_CLASS (e_attachment_button_parent_class)->
		style_set (widget, previous_style);

	button = E_ATTACHMENT_BUTTON (widget);
	attachment_button_update_pixbufs (button);
}
예제 #6
0
static void
attachment_button_dispose (GObject *object)
{
	EAttachmentButtonPrivate *priv;

	priv = E_ATTACHMENT_BUTTON (object)->priv;

	if (priv->view != NULL) {
		g_object_unref (priv->view);
		priv->view = NULL;
	}

	if (priv->attachment != NULL) {
		g_signal_handler_disconnect (
			priv->attachment,
			priv->reference_handler_id);
		g_object_unref (priv->attachment);
		priv->attachment = NULL;
	}

	if (priv->expand_button != NULL) {
		g_object_unref (priv->expand_button);
		priv->expand_button = NULL;
	}

	if (priv->toggle_button != NULL) {
		g_object_unref (priv->toggle_button);
		priv->toggle_button = NULL;
	}

	if (priv->cell_view != NULL) {
		g_object_unref (priv->cell_view);
		priv->cell_view = NULL;
	}

	if (priv->popup_menu != NULL) {
		g_signal_handlers_disconnect_matched (
			priv->popup_menu, G_SIGNAL_MATCH_DATA,
			0, 0, NULL, NULL, object);
		g_object_unref (priv->popup_menu);
		priv->popup_menu = NULL;
	}

	/* Chain up to parent's dispose() method. */
	G_OBJECT_CLASS (e_attachment_button_parent_class)->dispose (object);
}