Пример #1
0
static void
_gth_media_viewer_page_update_caption (GthMediaViewerPage *self)
{
	if (self->priv->caption_layout == NULL)
		return;

	if (self->priv->file_data != NULL) {
		GString     *description;
		GthMetadata *metadata;

		description = g_string_new ("");
		metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "general::title");
		if (metadata != NULL) {
			g_string_append (description, gth_metadata_get_formatted (metadata));
			metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "audio-video::general::artist");
			if (metadata != NULL) {
				g_string_append (description, "\n");
				g_string_append (description, gth_metadata_get_formatted (metadata));
			}
		}
		else
			g_string_append (description, g_file_info_get_display_name (self->priv->file_data->info));

		pango_layout_set_text (self->priv->caption_layout, description->str, -1);

		g_string_free (description, TRUE);
	}
	else
		pango_layout_set_text (self->priv->caption_layout, "", -1);

	gtk_widget_queue_draw (GTK_WIDGET (self->priv->area));
}
Пример #2
0
static void
_gth_media_viewer_page_update_caption (GthMediaViewerPage *self)
{
	if (self->priv->caption_layout == NULL)
		return;

	if (self->priv->file_data != NULL) {
		const char  *text;
		GthMetadata *metadata;

		text = NULL;
		metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "general::title");
		if (metadata != NULL)
			text = gth_metadata_get_formatted (metadata);
		else
			text = g_file_info_get_display_name (self->priv->file_data->info);

		if (text != NULL)
			pango_layout_set_text (self->priv->caption_layout, text, -1);
	}
	else
		pango_layout_set_text (self->priv->caption_layout, "", -1);

	gtk_widget_queue_draw (GTK_WIDGET (self->priv->area));
}
Пример #3
0
void
gth_edit_iptc_page_real_set_file_list (GthEditCommentPage *base,
		 		        GList              *file_data_list)
{
	GthEditIptcPage *self;
	GList            *scan;
	GthMetadata      *metadata;

	self = GTH_EDIT_IPTC_PAGE (base);

	self->priv->supported = TRUE;
	for (scan = file_data_list; self->priv->supported && scan; scan = scan->next) {
		GthFileData *file_data = scan->data;
		self->priv->supported = exiv2_supports_writes (gth_file_data_get_mime_type (file_data));
	}

	if (! self->priv->supported) {
		gtk_widget_hide (GTK_WIDGET (base));
		return;
	}

	_g_object_unref (self->priv->info);
	self->priv->info = gth_file_data_list_get_common_info (file_data_list, "Iptc::Application2::Copyright,Iptc::Application2::Credit,Iptc::Application2::Byline,Iptc::Application2::BylineTitle,Iptc::Application2::CountryName,Iptc::Application2::CountryCode,Iptc::Application2::City,Iptc::Application2::Language,Iptc::Application2::ObjectName,Iptc::Application2::Source,Iptc::Envelope::Destination,Iptc::Application2::Urgency,Iptc::Application2:ProvinceState");

	set_entry_value (self, self->priv->info, "Iptc::Application2::Copyright", "copyright_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::Credit", "credit_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::Byline", "byline_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::BylineTitle", "byline_title_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::CountryName", "country_name_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::CountryCode", "country_code_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::ProvinceState", "state_name_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::City", "city_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::Language", "language_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::ObjectName", "object_name_entry");
	set_entry_value (self, self->priv->info, "Iptc::Application2::Source", "source_entry");
	set_entry_value (self, self->priv->info, "Iptc::Envelope::Destination", "destination_entry");

	metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->info, "Iptc::Application2::Urgency");
	if (metadata != NULL) {
		float v;

		if (sscanf (gth_metadata_get_formatted (metadata), "%f", &v) == 1)
			gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), (double) v);
		else
			gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), 0.0);
	}
	else
		gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), 0.0);

	gtk_widget_show (GTK_WIDGET (base));
}
Пример #4
0
static void
set_entry_value (GthEditIptcPage *self,
		 GFileInfo        *info,
		 const char       *attribute,
		 const char       *widget_id)
{
	GthMetadata *metadata;

	metadata = (GthMetadata *) g_file_info_get_attribute_object (info, attribute);
	if (metadata != NULL)
		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET (widget_id)), gth_metadata_get_formatted (metadata));
	else
		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET (widget_id)), "");
}