[gimp/gimp-attributes-wip] plug-ins: attributes - enhance ui



commit 562e97d7b830bdf459c71ea022ace9f68ee9e559
Author: Hartmut Kuhse <hk_priv gmx de>
Date:   Thu Oct 9 09:25:15 2014 +0200

    plug-ins: attributes - enhance ui

 plug-ins/common/attributes.c      |   23 +++++++++++++++--------
 plug-ins/ui/plug-in-attributes.ui |   33 +++++++++++++++++++++------------
 2 files changed, 36 insertions(+), 20 deletions(-)
---
diff --git a/plug-ins/common/attributes.c b/plug-ins/common/attributes.c
index 3ca87f6..b9a8144 100644
--- a/plug-ins/common/attributes.c
+++ b/plug-ins/common/attributes.c
@@ -127,6 +127,8 @@ const GimpPlugInInfo PLUG_IN_INFO =
 static GHashTable *ifd_table = NULL;
 static GHashTable *tab_table = NULL;
 
+static gchar      *item_name = NULL;
+
 /*  functions  */
 
 MAIN ()
@@ -315,7 +317,6 @@ attributes_dialog (gint32           item_id,
   gchar      *header;
   gchar      *ui_file;
   gchar      *title;
-  gchar      *fname;
   gchar      *role;
   GError     *error = NULL;
 
@@ -324,7 +325,7 @@ attributes_dialog (gint32           item_id,
   switch (source)
   {
     case ATT_IMAGE:
-      fname = g_filename_display_basename (gimp_image_get_uri (item_id));
+      item_name = g_filename_display_basename (gimp_image_get_uri (item_id));
       header  = g_strdup_printf ("Image");
       role  = g_strdup_printf ("gimp-image-attributes-dialog");
       pixbuf = gimp_image_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
@@ -332,28 +333,28 @@ attributes_dialog (gint32           item_id,
 
       break;
     case ATT_LAYER:
-      fname = gimp_item_get_name (item_id);
+      item_name = gimp_item_get_name (item_id);
       header  = g_strdup_printf ("Layer");
       role  = g_strdup_printf ("gimp-layer-attributes-dialog");
       pixbuf = gimp_drawable_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
                                             GIMP_PIXBUF_SMALL_CHECKS);
       break;
     case ATT_CHANNEL:
-      fname = gimp_item_get_name (item_id);
+      item_name = gimp_item_get_name (item_id);
       header  = g_strdup_printf ("Channel");
       role  = g_strdup_printf ("gimp-channel-attributes-dialog");
       pixbuf = gimp_drawable_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
                                             GIMP_PIXBUF_SMALL_CHECKS);
       break;
     default:
-      fname = g_strdup_printf ("unknown");
+      item_name = g_strdup_printf ("unknown");
       header  = g_strdup_printf ("Unknown");
       role  = g_strdup_printf ("gimp-attributes-dialog");
       pixbuf = NULL;
       break;
   }
 
-  title = g_strdup_printf ("Attributes: %s", fname);
+  title = g_strdup_printf ("Attributes: %s", item_name);
 
   builder = gtk_builder_new ();
 
@@ -418,10 +419,9 @@ attributes_dialog (gint32           item_id,
   gimp_label_set_attributes (GTK_LABEL (label_info),
                              PANGO_ATTR_SCALE,  PANGO_SCALE_SMALL,
                              -1);
-  gtk_label_set_text (GTK_LABEL (label_info), fname);
+  gtk_label_set_text (GTK_LABEL (label_info), item_name);
 
   g_free (header);
-  g_free (fname);
 
   if (pixbuf)
     {
@@ -761,8 +761,11 @@ attributes_file_export_dialog (GtkWidget      *parent,
                                GimpAttributes *attributes)
 {
   static GtkWidget *dlg = NULL;
+  gchar            *suggest_file;
 //                                          GTK_WINDOW (parent),
 
+  suggest_file = g_strdup_printf ("%s.xmp", item_name);
+
   if (! dlg)
     {
       dlg = gtk_file_chooser_dialog_new (_("Export XMP to File"),
@@ -783,12 +786,16 @@ attributes_file_export_dialog (GtkWidget      *parent,
       gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dlg),
                                                       TRUE);
 
+      gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), suggest_file);
+
       g_signal_connect (dlg, "destroy",
                         G_CALLBACK (gtk_widget_destroyed),
                         &dlg);
       g_signal_connect (dlg, "response",
                         G_CALLBACK (attributes_export_dialog_response),
                         attributes);
+
+      g_free (suggest_file);
     }
   gtk_window_present (GTK_WINDOW (dlg));
 //  gtk_dialog_run (GTK_DIALOG (dlg));
diff --git a/plug-ins/ui/plug-in-attributes.ui b/plug-ins/ui/plug-in-attributes.ui
index cac94dc..6a005ed 100644
--- a/plug-ins/ui/plug-in-attributes.ui
+++ b/plug-ins/ui/plug-in-attributes.ui
@@ -2,6 +2,18 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkTreeStore" id="exif-treestore">
+    <columns>
+      <!-- column-name c-exif-ifd -->
+      <column type="gchararray"/>
+      <!-- column-name c-exif-tag -->
+      <column type="gchararray"/>
+      <!-- column-name c-exif-value -->
+      <column type="gchararray"/>
+      <!-- column-name sortable -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkVBox" id="attributes-vbox">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -147,8 +159,15 @@
                     <property name="sizing">fixed</property>
                     <property name="min_width">1</property>
                     <property name="max_width">1</property>
+                    <property name="visible">FALSE</property>
                     <property name="title" translatable="yes">Sort</property>
                     <property name="sort_column_id">3</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="exif_sort_cell_renderer"/>
+                      <attributes>
+                        <attribute name="text">3</attribute>
+                      </attributes>
+                    </child>
                   </object>
                 </child>
               </object>
@@ -226,6 +245,7 @@
                     <property name="sizing">fixed</property>
                     <property name="min_width">1</property>
                     <property name="max_width">1</property>
+                    <property name="visible">FALSE</property>
                     <property name="title" translatable="yes">Sort</property>
                     <property name="sort_column_id">3</property>
                     <child>
@@ -314,6 +334,7 @@
                     <property name="sizing">fixed</property>
                     <property name="min_width">1</property>
                     <property name="max_width">1</property>
+                    <property name="visible">FALSE</property>
                     <property name="title" translatable="yes">Sort</property>
                     <property name="sort_column_id">3</property>
                     <child>
@@ -352,18 +373,6 @@
       </packing>
     </child>
   </object>
-  <object class="GtkTreeStore" id="exif-treestore">
-    <columns>
-      <!-- column-name c-exif-ifd -->
-      <column type="gchararray"/>
-      <!-- column-name c-exif-tag -->
-      <column type="gchararray"/>
-      <!-- column-name c-exif-value -->
-      <column type="gchararray"/>
-      <!-- column-name sortable -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkTreeStore" id="iptc-treestore">
     <columns>
       <!-- column-name c-iptc-ifd -->


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]