mirror of https://github.com/GNOME/gimp.git
plug-ins: Remove dependency on GtkBuilder from metadata-editor
Instead of loading the GtkBuilder .ui file we now create all widgets in code. Added several support functions to reduce code copy/pasting and making additional widgets and supporting more metadata easier. The overall layout should still look the same, with a few exceptions: - Each notebook page only uses one grid. This makes it possible to align all data entry widgets. - Featured Organization and it's code were two treeviews next to each other. These are now organized below each other to make automatic code generation easier. - Since we needed to touch this code anyway, I also fixed Xmp.dc.creator and Xmp.iptcExt.ModelAge to be multiline. This closes #7286. - The old icons used for the date button, add, and remove row buttons were replaced by gimp-grid, list-add and list-remove. Since this was the last .ui file used in GIMP plug-ins, we remove all files from the .ui subdirectory and references to that. Note that there are several more places where GtkBuilder is used, but those cases uses strings defined in code instead of .ui files.
This commit is contained in:
parent
415b32e763
commit
8969bbcee8
|
@ -59,5 +59,4 @@ SUBDIRS = \
|
||||||
screenshot \
|
screenshot \
|
||||||
selection-to-path \
|
selection-to-path \
|
||||||
$(twain) \
|
$(twain) \
|
||||||
ui \
|
|
||||||
common
|
common
|
||||||
|
|
|
@ -32,4 +32,3 @@ subdir('screenshot')
|
||||||
subdir('script-fu')
|
subdir('script-fu')
|
||||||
subdir('selection-to-path')
|
subdir('selection-to-path')
|
||||||
subdir('twain')
|
subdir('twain')
|
||||||
subdir('ui')
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,8 +20,11 @@
|
||||||
#ifndef __METADATA_EDITOR_H__
|
#ifndef __METADATA_EDITOR_H__
|
||||||
#define __METADATA_EDITOR_H__
|
#define __METADATA_EDITOR_H__
|
||||||
|
|
||||||
extern void metadata_editor_write_callback (GtkWidget *dialog,
|
void metadata_editor_write_callback (GtkWidget *dialog,
|
||||||
GtkBuilder *builder,
|
metadata_editor *meta_info,
|
||||||
GimpImage *image);
|
GimpImage *image);
|
||||||
|
|
||||||
|
GtkWidget * metadata_editor_get_widget (metadata_editor *meta_info,
|
||||||
|
const gchar *name);
|
||||||
|
|
||||||
#endif /* __METADATA_EDITOR_H__ */
|
#endif /* __METADATA_EDITOR_H__ */
|
||||||
|
|
|
@ -101,7 +101,7 @@ export_file_metadata (metadata_editor *args)
|
||||||
if (force_write == TRUE)
|
if (force_write == TRUE)
|
||||||
{
|
{
|
||||||
/* Save fields in case of updates */
|
/* Save fields in case of updates */
|
||||||
metadata_editor_write_callback (args->dialog, args->builder, args->image);
|
metadata_editor_write_callback (args->dialog, args, args->image);
|
||||||
/* Fetch a fresh copy of the metadata */
|
/* Fetch a fresh copy of the metadata */
|
||||||
args->metadata = GEXIV2_METADATA (gimp_image_get_metadata (args->image));
|
args->metadata = GEXIV2_METADATA (gimp_image_get_metadata (args->image));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkBuilder *builder;
|
GHashTable *widgets;
|
||||||
GExiv2Metadata *metadata;
|
GExiv2Metadata *metadata;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
|
|
@ -38,7 +38,7 @@ const metadata_tag default_metadata_tags[] =
|
||||||
{
|
{
|
||||||
/* Description */
|
/* Description */
|
||||||
{ "Xmp.dc.title", "single", 16, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 0
|
{ "Xmp.dc.title", "single", 16, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 0
|
||||||
{ "Xmp.dc.creator", "single", 13, TAG_TYPE_XMP, GIMP_XMP_SEQ }, // 1
|
{ "Xmp.dc.creator", "multi", 13, TAG_TYPE_XMP, GIMP_XMP_SEQ }, // 1
|
||||||
{ "Xmp.dc.description", "multi", 14, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 2
|
{ "Xmp.dc.description", "multi", 14, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 2
|
||||||
{ "Xmp.dc.subject", "multi", 15, TAG_TYPE_XMP, GIMP_XMP_BAG }, // 3
|
{ "Xmp.dc.subject", "multi", 15, TAG_TYPE_XMP, GIMP_XMP_BAG }, // 3
|
||||||
{ "Xmp.dc.rights", "single", 17, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 4
|
{ "Xmp.dc.rights", "single", 17, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 4
|
||||||
|
@ -84,7 +84,7 @@ const metadata_tag default_metadata_tags[] =
|
||||||
{ "Xmp.iptcExt.RegistryId", "list", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 38
|
{ "Xmp.iptcExt.RegistryId", "list", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 38
|
||||||
{ "Xmp.iptcExt.ArtworkOrObject", "list", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 39
|
{ "Xmp.iptcExt.ArtworkOrObject", "list", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 39
|
||||||
{ "Xmp.iptcExt.AddlModelInfo", "multi", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 40
|
{ "Xmp.iptcExt.AddlModelInfo", "multi", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 40
|
||||||
{ "Xmp.iptcExt.ModelAge", "single", -1, TAG_TYPE_XMP, GIMP_XMP_BAG }, // 41
|
{ "Xmp.iptcExt.ModelAge", "multi", -1, TAG_TYPE_XMP, GIMP_XMP_BAG }, // 41
|
||||||
{ "Xmp.iptcExt.MaxAvailWidth", "single", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 42
|
{ "Xmp.iptcExt.MaxAvailWidth", "single", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 42
|
||||||
{ "Xmp.iptcExt.MaxAvailHeight", "single", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 43
|
{ "Xmp.iptcExt.MaxAvailHeight", "single", -1, TAG_TYPE_XMP, GIMP_XMP_TEXT }, // 43
|
||||||
{ "Xmp.iptcExt.DigitalSourceType", "combo", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 44
|
{ "Xmp.iptcExt.DigitalSourceType", "combo", -1, TAG_TYPE_XMP, GIMP_XMP_NONE }, // 44
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "metadata-misc.h"
|
#include "metadata-misc.h"
|
||||||
#include "metadata-xml.h"
|
#include "metadata-xml.h"
|
||||||
#include "metadata-tags.h"
|
#include "metadata-tags.h"
|
||||||
|
#include "metadata-editor.h"
|
||||||
|
|
||||||
extern gboolean gimpmetadata;
|
extern gboolean gimpmetadata;
|
||||||
extern gboolean force_write;
|
extern gboolean force_write;
|
||||||
|
@ -164,9 +165,9 @@ set_tag_ui (metadata_editor *args,
|
||||||
gchar *value,
|
gchar *value,
|
||||||
gchar* mode)
|
gchar* mode)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget = NULL;
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (args->builder, str_tag_name));
|
widget = GTK_WIDGET (metadata_editor_get_widget (args, str_tag_name));
|
||||||
|
|
||||||
if (!strcmp ("single", mode))
|
if (!strcmp ("single", mode))
|
||||||
{
|
{
|
||||||
|
@ -552,18 +553,18 @@ get_tag_ui_text (metadata_editor *args,
|
||||||
gchar *name,
|
gchar *name,
|
||||||
gchar *mode)
|
gchar *mode)
|
||||||
{
|
{
|
||||||
GObject *object;
|
GtkWidget *widget = NULL;
|
||||||
|
|
||||||
object = gtk_builder_get_object (args->builder, name);
|
widget = metadata_editor_get_widget (args, name);
|
||||||
|
|
||||||
if (! strcmp ("single", mode))
|
if (! strcmp ("single", mode))
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (object);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
return gtk_entry_get_text (entry);
|
return gtk_entry_get_text (entry);
|
||||||
}
|
}
|
||||||
else if (!strcmp ("multi", mode))
|
else if (!strcmp ("multi", mode))
|
||||||
{
|
{
|
||||||
GtkTextView *text_view = GTK_TEXT_VIEW (object);
|
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
GtkTextIter start;
|
GtkTextIter start;
|
||||||
GtkTextIter end;
|
GtkTextIter end;
|
||||||
|
@ -602,8 +603,7 @@ get_list_elements (GString *xmldata, int element_count, gchar **rowtagdata)
|
||||||
gchar *
|
gchar *
|
||||||
get_tag_ui_list (metadata_editor *args, gchar *name, gchar *mode)
|
get_tag_ui_list (metadata_editor *args, gchar *name, gchar *mode)
|
||||||
{
|
{
|
||||||
GObject *object;
|
GtkWidget *widget = NULL;
|
||||||
GtkWidget *widget;
|
|
||||||
GtkTreeModel *treemodel;
|
GtkTreeModel *treemodel;
|
||||||
GtkListStore *liststore;
|
GtkListStore *liststore;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
@ -616,8 +616,7 @@ get_tag_ui_list (metadata_editor *args, gchar *name, gchar *mode)
|
||||||
has_data = FALSE;
|
has_data = FALSE;
|
||||||
xmldata = g_string_new ("");
|
xmldata = g_string_new ("");
|
||||||
|
|
||||||
object = gtk_builder_get_object (args->builder, name);
|
widget = metadata_editor_get_widget (args, name);
|
||||||
widget = GTK_WIDGET(object);
|
|
||||||
|
|
||||||
liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget));
|
liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget));
|
||||||
treemodel = GTK_TREE_MODEL (liststore);
|
treemodel = GTK_TREE_MODEL (liststore);
|
||||||
|
@ -826,16 +825,7 @@ get_tag_ui_list (metadata_editor *args, gchar *name, gchar *mode)
|
||||||
gint
|
gint
|
||||||
get_tag_ui_combo (metadata_editor *args, gchar *name, gchar *mode)
|
get_tag_ui_combo (metadata_editor *args, gchar *name, gchar *mode)
|
||||||
{
|
{
|
||||||
GObject *object;
|
return gtk_combo_box_get_active (GTK_COMBO_BOX(metadata_editor_get_widget (args, name)));
|
||||||
GtkComboBoxText *combo;
|
|
||||||
gint value;
|
|
||||||
|
|
||||||
object = gtk_builder_get_object (args->builder, name);
|
|
||||||
|
|
||||||
combo = GTK_COMBO_BOX_TEXT (object);
|
|
||||||
value = gtk_combo_box_get_active (GTK_COMBO_BOX(combo));
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
|
@ -1,6 +0,0 @@
|
||||||
uidatadir = $(gimpdatadir)/ui/plug-ins
|
|
||||||
|
|
||||||
uidata_DATA = \
|
|
||||||
plug-in-metadata-editor.ui
|
|
||||||
|
|
||||||
EXTRA_DIST = $(uidata_DATA)
|
|
|
@ -1,7 +0,0 @@
|
||||||
plugin_ui = [
|
|
||||||
'plug-in-metadata-editor.ui',
|
|
||||||
]
|
|
||||||
|
|
||||||
install_data(plugin_ui,
|
|
||||||
install_dir: gimpdatadir / 'ui' / 'plug-ins',
|
|
||||||
)
|
|
File diff suppressed because it is too large
Load Diff
|
@ -154,7 +154,6 @@ plug-ins/gimpressionist/repaint.c
|
||||||
plug-ins/gimpressionist/size.c
|
plug-ins/gimpressionist/size.c
|
||||||
plug-ins/gimpressionist/sizemap.c
|
plug-ins/gimpressionist/sizemap.c
|
||||||
plug-ins/gimpressionist/utils.c
|
plug-ins/gimpressionist/utils.c
|
||||||
plug-ins/ui/plug-in-metadata-editor.ui
|
|
||||||
plug-ins/gradient-flare/gradient-flare.c
|
plug-ins/gradient-flare/gradient-flare.c
|
||||||
plug-ins/help-browser/dialog.c
|
plug-ins/help-browser/dialog.c
|
||||||
plug-ins/help-browser/help-browser.c
|
plug-ins/help-browser/help-browser.c
|
||||||
|
|
Loading…
Reference in New Issue