gimp r25719 - in trunk: . app/tools



Author: mitch
Date: Tue May 20 15:03:03 2008
New Revision: 25719
URL: http://svn.gnome.org/viewvc/gimp?rev=25719&view=rev

Log:
2008-05-20  Michael Natterer  <mitch gimp org>

	* app/tools/gimpimagemaptool.c (gimp_image_map_tool_add_recent):
	unref the new settings object after adding it to the recent
	container.

	* app/tools/gimpimagemaptool-settings.c: add a "Save to Favorites"
	button which pops a string entry dialog and saves the current
	settings to the recent container.



Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpimagemaptool-settings.c
   trunk/app/tools/gimpimagemaptool.c

Modified: trunk/app/tools/gimpimagemaptool-settings.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool-settings.c	(original)
+++ trunk/app/tools/gimpimagemaptool-settings.c	Tue May 20 15:03:03 2008
@@ -49,24 +49,29 @@
 
 /*  local function prototypes  */
 
-static void   gimp_image_map_tool_recent_selected (GimpContainerView *view,
-                                                   GimpViewable      *object,
-                                                   gpointer           insert_data,
-                                                   GimpImageMapTool  *tool);
-
-static void   gimp_image_map_tool_load_clicked    (GtkWidget         *widget,
-                                                   GimpImageMapTool  *tool);
-static void   gimp_image_map_tool_save_clicked    (GtkWidget         *widget,
-                                                   GimpImageMapTool  *tool);
-
-static void   gimp_image_map_tool_settings_dialog (GimpImageMapTool  *im_tool,
-                                                   const gchar       *title,
-                                                   gboolean           save);
-
-static gboolean gimp_image_map_tool_settings_load (GimpImageMapTool  *tool,
-                                                   const gchar       *filename);
-static gboolean gimp_image_map_tool_settings_save (GimpImageMapTool  *tool,
-                                                   const gchar       *filename);
+static void   gimp_image_map_tool_recent_selected  (GimpContainerView *view,
+                                                    GimpViewable      *object,
+                                                    gpointer           insert_data,
+                                                    GimpImageMapTool  *tool);
+
+static void   gimp_image_map_tool_favorite_clicked (GtkWidget         *widget,
+                                                    GimpImageMapTool  *tool);
+static void   gimp_image_map_tool_load_clicked     (GtkWidget         *widget,
+                                                    GimpImageMapTool  *tool);
+static void   gimp_image_map_tool_save_clicked     (GtkWidget         *widget,
+                                                    GimpImageMapTool  *tool);
+
+static void   gimp_image_map_tool_settings_dialog  (GimpImageMapTool  *im_tool,
+                                                    const gchar       *title,
+                                                    gboolean           save);
+
+static void  gimp_image_map_tool_favorite_callback (GtkWidget         *query_box,
+                                                    const gchar       *string,
+                                                    gpointer           data);
+static gboolean gimp_image_map_tool_settings_load  (GimpImageMapTool  *tool,
+                                                    const gchar       *filename);
+static gboolean gimp_image_map_tool_settings_save  (GimpImageMapTool  *tool,
+                                                    const gchar       *filename);
 
 
 /*  public functions  */
@@ -79,6 +84,7 @@
   GtkWidget             *hbox;
   GtkWidget             *label;
   GtkWidget             *combo;
+  GtkWidget             *button;
 
   klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
 
@@ -140,6 +146,15 @@
                       FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
+  button = gtk_button_new_with_mnemonic (_("Save to _Favorites"));
+  gtk_box_pack_start (GTK_BOX (hbox), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (gimp_image_map_tool_favorite_clicked),
+                    image_map_tool);
+
   image_map_tool->load_button = g_object_new (GIMP_TYPE_BUTTON,
                                               "label",         GTK_STOCK_OPEN,
                                               "use-stock",     TRUE,
@@ -240,6 +255,23 @@
 }
 
 static void
+gimp_image_map_tool_favorite_clicked (GtkWidget        *widget,
+                                      GimpImageMapTool *tool)
+{
+  GtkWidget *dialog;
+
+  dialog = gimp_query_string_box (_("Save Settings to Favorites"),
+                                  tool->shell,
+                                  gimp_standard_help_func,
+                                  NULL, /*GIMP_HELP_TOOL_OPTIONS_DIALOG, */
+                                  _("Enter a name for the saved settings"),
+                                  _("Saved Settings"),
+                                  G_OBJECT (tool->shell), "hide",
+                                  gimp_image_map_tool_favorite_callback, tool);
+  gtk_widget_show (dialog);
+}
+
+static void
 gimp_image_map_tool_load_clicked (GtkWidget        *widget,
                                   GimpImageMapTool *tool)
 {
@@ -374,6 +406,21 @@
   gtk_widget_show (tool->settings_dialog);
 }
 
+static void
+gimp_image_map_tool_favorite_callback (GtkWidget   *query_box,
+                                       const gchar *string,
+                                       gpointer     data)
+{
+  GimpImageMapTool *tool = GIMP_IMAGE_MAP_TOOL (data);
+  GimpConfig       *config;
+
+  config = gimp_config_duplicate (GIMP_CONFIG (tool->config));
+  gimp_object_set_name (GIMP_OBJECT (config), string);
+  gimp_container_insert (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->recent_settings,
+                         GIMP_OBJECT (config), 0);
+  g_object_unref (config);
+}
+
 static gboolean
 gimp_image_map_tool_settings_load (GimpImageMapTool *tool,
                                    const gchar      *filename)

Modified: trunk/app/tools/gimpimagemaptool.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool.c	(original)
+++ trunk/app/tools/gimpimagemaptool.c	Tue May 20 15:03:03 2008
@@ -544,6 +544,7 @@
     {
       config = gimp_config_duplicate (current);
       gimp_container_insert (recent, GIMP_OBJECT (config), 0);
+      g_object_unref (config);
     }
 
   now = time (NULL);



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