[gimp/gimp-attributes-wip] plug-ins: metainfo, show number in expander label
- From: Hartmut Kuhse <hartmutkuhse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-attributes-wip] plug-ins: metainfo, show number in expander label
- Date: Thu, 9 Oct 2014 12:31:44 +0000 (UTC)
commit 3bb19203a582a609cd5c6473512665d1d058fa3d
Author: Hartmut Kuhse <hk_priv gmx de>
Date: Thu Oct 9 14:30:41 2014 +0200
plug-ins: metainfo, show number in expander label
plug-ins/metainfo/datapage.c | 45 +++++++++++++++++++++++++++++++
plug-ins/metainfo/datapage.h | 3 +-
plug-ins/metainfo/page-administration.c | 2 +
plug-ins/metainfo/page-artwork.c | 1 +
plug-ins/metainfo/page-description.c | 2 +
plug-ins/metainfo/page-rights.c | 3 ++
6 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/metainfo/datapage.c b/plug-ins/metainfo/datapage.c
index 663c5de..765e01d 100644
--- a/plug-ins/metainfo/datapage.c
+++ b/plug-ins/metainfo/datapage.c
@@ -46,6 +46,7 @@ struct _DatapagePrivate {
GQueue *current_shown_structure;
GQueue *highest_structure;
GQueue *combo_signal_handlers;
+ GQueue *expander_texts;
};
enum {
@@ -100,6 +101,8 @@ static void datapage_init_combobox (Datap
static void datapage_set_entry_sensitive (Datapage *datapage,
const gchar *struct_name,
gboolean sensitive);
+static void datapage_set_label_text (Datapage *datapage,
+ gint struct_nr);
static gpointer datapage_parent_class = NULL;
@@ -140,6 +143,8 @@ datapage_instance_init (Datapage *datapage)
private->current_shown_structure = g_queue_new ();
private->highest_structure = g_queue_new ();
private->combo_signal_handlers = g_queue_new ();
+ private->expander_texts = g_queue_new ();
+
}
@@ -299,6 +304,7 @@ datapage_init_ui (Datapage *datapage,
GObject *obj;
gint i;
+ DatapagePrivate *private = DATAPAGE_GET_PRIVATE(datapage);
for (i = 0; i < datapage->metadata_entry_count; i++)
{
@@ -364,6 +370,12 @@ datapage_init_ui (Datapage *datapage,
for (i = 0; i < datapage->structure_element_count; i++) /*get info about structure */
{
+ const gchar *label_text;
+
+ obj = G_OBJECT (get_widget_from_label (builder, datapage->struct_element[i].expand_label_widget));
+ label_text = gtk_label_get_text (GTK_LABEL (obj));
+ g_queue_push_nth (private->expander_texts, g_strdup (label_text),
datapage->struct_element[i].number_of_element);
+
obj = G_OBJECT (get_widget_from_label (builder, datapage->struct_element[i].add_widget));
gtk_widget_set_name (GTK_WIDGET (obj), datapage->struct_element[i].add_widget);
g_signal_connect (obj, "clicked",
@@ -583,6 +595,9 @@ datapage_structure_add (GtkButton *button,
g_signal_handlers_unblock_by_func(G_OBJECT (combo), G_CALLBACK
(datapage_combobox_changed_callback), datapage);
g_free (line);
+
+ datapage_set_label_text (datapage, sct);
+
break;
}
}
@@ -644,6 +659,9 @@ datapage_structure_remove (GtkButton *button,
datapage_set_highest_structure (datapage, sct, --new_highest);
repaint = datapage->struct_element[sct].number_of_element;
+
+ datapage_set_label_text (datapage, sct);
+
break;
}
}
@@ -748,6 +766,7 @@ datapage_structure_remove (GtkButton *button,
set_save_attributes_button_sensitive (TRUE);
datapage_set_to_ui (datapage, datapage->builder, repaint);
+
}
static void
@@ -976,6 +995,7 @@ datapage_init_combobox (Datapage *datapage,
g_signal_handlers_unblock_by_func(G_OBJECT (combo), G_CALLBACK (datapage_combobox_changed_callback),
datapage);
+ datapage_set_label_text (datapage, sct);
}
}
@@ -1001,6 +1021,31 @@ datapage_set_entry_sensitive (Datapage *datapage,
}
+static void
+datapage_set_label_text (Datapage *datapage,
+ gint struct_nr)
+{
+ DatapagePrivate *private;
+ GtkLabel label;
+ GObject *obj;
+ gchar *label_text;
+ gint high;
+
+ private = DATAPAGE_GET_PRIVATE (datapage);
+
+ obj = get_widget_from_label (datapage->builder, datapage->struct_element[struct_nr].expand_label_widget);
+
+ high = datapage_get_highest_structure (datapage, datapage->struct_element[struct_nr].number_of_element);
+
+ label_text = g_strdup_printf ("%s (%d)", (gchar *) g_queue_peek_nth (private->expander_texts,
+
datapage->struct_element[struct_nr].number_of_element),
+ high);
+
+ gtk_label_set_text (GTK_LABEL (obj), label_text);
+
+ g_free (label_text);
+}
+
void
datapage_read_from_attributes (Datapage *datapage,
GimpAttributes **attributes)
diff --git a/plug-ins/metainfo/datapage.h b/plug-ins/metainfo/datapage.h
index d27f569..6d4babb 100644
--- a/plug-ins/metainfo/datapage.h
+++ b/plug-ins/metainfo/datapage.h
@@ -75,7 +75,8 @@ struct _StructureElement
gint number_of_element; /* simply the number, corresponding to
STRUCTURES_ON_PAGE */
const gchar *identifier; /* translateble - identifier for combobox entries */
const gchar *struct_tag; /* structure tag without array number */
- GimpAttributeStructureType struct_type; /* type of structure, gexiv2 cannot get the right
list type from tag*/
+ GimpAttributeStructureType struct_type; /* type of structure, gexiv2 cannot get the right
list type from tag*/
+ const gchar *expand_label_widget; /* name of the expander label widget */
const gchar *struct_combo_widget; /* name of the combobox widget for this structure */
const gchar *struct_liststore_widget; /* name of the liststore of the combobox for this
structure */
const gchar *add_widget; /* name of the add structure button for this
structure */
diff --git a/plug-ins/metainfo/page-administration.c b/plug-ins/metainfo/page-administration.c
index 4c66518..642fb00 100644
--- a/plug-ins/metainfo/page-administration.c
+++ b/plug-ins/metainfo/page-administration.c
@@ -38,6 +38,7 @@ static StructureElement struct_element [] =
N_("Image supplier"),
"Xmp.plus.ImageSupplier",
STRUCTURE_TYPE_SEQ,
+ "imagesupplier-label",
"imagesupplier-combo",
"imagesupplier-liststore",
"imagesupplier-button-plus",
@@ -47,6 +48,7 @@ static StructureElement struct_element [] =
N_("Registry ID"),
"Xmp.iptcExt.RegistryId",
STRUCTURE_TYPE_BAG,
+ "registryid-label",
"registryid-combo",
"registryid-liststore",
"registryid-button-plus",
diff --git a/plug-ins/metainfo/page-artwork.c b/plug-ins/metainfo/page-artwork.c
index ff66412..8be3b9d 100644
--- a/plug-ins/metainfo/page-artwork.c
+++ b/plug-ins/metainfo/page-artwork.c
@@ -38,6 +38,7 @@ static StructureElement struct_element [] =
N_("Artwork or Object"),
"Xmp.iptcExt.ArtworkOrObject",
STRUCTURE_TYPE_BAG,
+ "artworkorobject-label",
"artworkorobject-combo",
"artworkorobject-liststore",
"artworkorobject-button-plus",
diff --git a/plug-ins/metainfo/page-description.c b/plug-ins/metainfo/page-description.c
index b682f89..ffd6e5f 100644
--- a/plug-ins/metainfo/page-description.c
+++ b/plug-ins/metainfo/page-description.c
@@ -34,6 +34,7 @@ static StructureElement struct_element [] =
N_("Location created"),
"Xmp.iptcExt.LocationCreated",
STRUCTURE_TYPE_BAG,
+ "location-created-label",
"location-created-combo",
"location-created-liststore",
"location-created-button-plus",
@@ -43,6 +44,7 @@ static StructureElement struct_element [] =
N_("Location shown"),
"Xmp.iptcExt.LocationShown",
STRUCTURE_TYPE_SEQ,
+ "location-shown-label",
"location-shown-combo",
"location-shown-liststore",
"location-shown-button-plus",
diff --git a/plug-ins/metainfo/page-rights.c b/plug-ins/metainfo/page-rights.c
index 6d2521c..e96852e 100644
--- a/plug-ins/metainfo/page-rights.c
+++ b/plug-ins/metainfo/page-rights.c
@@ -37,6 +37,7 @@ static StructureElement struct_element [] =
N_("Image creator"),
"Xmp.plus.ImageCreator",
STRUCTURE_TYPE_SEQ,
+ "imagecreator-label",
"imagecreator-combo",
"imagecreator-liststore",
"imagecreator-button-plus",
@@ -46,6 +47,7 @@ static StructureElement struct_element [] =
N_("Copyright Owner"),
"Xmp.plus.CopyrightOwner",
STRUCTURE_TYPE_SEQ,
+ "copyrightowner-label",
"copyrightowner-combo",
"copyrightowner-liststore",
"copyrightowner-button-plus",
@@ -55,6 +57,7 @@ static StructureElement struct_element [] =
N_("Licensor"),
"Xmp.plus.Licensor",
STRUCTURE_TYPE_BAG,
+ "licensor-label",
"licensor-combo",
"licensor-liststore",
"licensor-button-plus",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]