[gimp] app: prepend "Last used: " to the names of the automatic filter presets



commit bef155ef305744bd8ac6a06f268e6cd860b17a51
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 18 00:29:45 2017 +0200

    app: prepend "Last used: " to the names of the automatic filter presets
    
    and add a tooltip about renaming them in order to save them
    permanently.

 app/core/gimpsettings.c |   48 ++++++++++++++++++++++++++++++++++++----------
 po/POTFILES.in          |    1 +
 2 files changed, 38 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpsettings.c b/app/core/gimpsettings.c
index 9e89f0b..bba7d00 100644
--- a/app/core/gimpsettings.c
+++ b/app/core/gimpsettings.c
@@ -31,6 +31,8 @@
 
 #include "gimpsettings.h"
 
+#include "gimp-intl.h"
+
 
 enum
 {
@@ -39,14 +41,17 @@ enum
 };
 
 
-static void   gimp_settings_get_property (GObject      *object,
-                                          guint         property_id,
-                                          GValue       *value,
-                                          GParamSpec   *pspec);
-static void   gimp_settings_set_property (GObject      *object,
-                                          guint         property_id,
-                                          const GValue *value,
-                                          GParamSpec   *pspec);
+static void    gimp_settings_get_property    (GObject       *object,
+                                              guint          property_id,
+                                              GValue        *value,
+                                              GParamSpec    *pspec);
+static void    gimp_settings_set_property    (GObject       *object,
+                                              guint          property_id,
+                                              const GValue  *value,
+                                              GParamSpec    *pspec);
+
+static gchar * gimp_settings_get_description (GimpViewable  *viewable,
+                                              gchar        **tooltip);
 
 
 G_DEFINE_TYPE (GimpSettings, gimp_settings, GIMP_TYPE_VIEWABLE)
@@ -60,10 +65,11 @@ gimp_settings_class_init (GimpSettingsClass *klass)
   GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
   GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->set_property    = gimp_settings_set_property;
-  object_class->get_property    = gimp_settings_get_property;
+  object_class->set_property      = gimp_settings_set_property;
+  object_class->get_property      = gimp_settings_get_property;
 
-  viewable_class->name_editable = TRUE;
+  viewable_class->get_description = gimp_settings_get_description;
+  viewable_class->name_editable   = TRUE;
 
   GIMP_CONFIG_PROP_UINT (object_class, PROP_TIME,
                          "time",
@@ -133,6 +139,26 @@ gimp_settings_set_property (GObject      *object,
     }
 }
 
+static gchar *
+gimp_settings_get_description (GimpViewable  *viewable,
+                               gchar        **tooltip)
+{
+  GimpSettings *settings = GIMP_SETTINGS (viewable);
+
+  if (settings->time > 0)
+    {
+      if (tooltip)
+        *tooltip = g_strdup ("You can rename automatic presets "
+                             "to make them permanently saved");
+
+      return g_strdup_printf (_("Last used: %s"),
+                              gimp_object_get_name (settings));
+    }
+
+  return GIMP_VIEWABLE_CLASS (parent_class)->get_description (viewable,
+                                                              tooltip);
+}
+
 
 /*  public functions  */
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3fa7b74..b00587f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -181,6 +181,7 @@ app/core/gimppatternclipboard.c
 app/core/gimppdbprogress.c
 app/core/gimpprogress.c
 app/core/gimpselection.c
+app/core/gimpsettings.c
 app/core/gimpstrokeoptions.c
 app/core/gimpsymmetry.c
 app/core/gimpsymmetry-mandala.c


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