gimp r24963 - trunk/plug-ins/print



Author: neo
Date: Mon Feb 25 21:21:15 2008
New Revision: 24963
URL: http://svn.gnome.org/viewvc/gimp?rev=24963&view=rev

Log:
some cleanups and a bug-fix for my last commit here


Modified:
   trunk/plug-ins/print/print-page-setup.c
   trunk/plug-ins/print/print-settings.c
   trunk/plug-ins/print/print-utils.c

Modified: trunk/plug-ins/print/print-page-setup.c
==============================================================================
--- trunk/plug-ins/print/print-page-setup.c	(original)
+++ trunk/plug-ins/print/print-page-setup.c	Mon Feb 25 21:21:15 2008
@@ -24,6 +24,8 @@
 #include "print-page-setup.h"
 #include "print-utils.h"
 
+#define PRINT_PAGE_SETUP_NAME  "print-page-setup"
+
 
 void
 print_page_setup_dialog (GtkPrintOperation *operation)
@@ -51,29 +53,23 @@
   g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
 
   key_file = print_utils_key_file_load_from_parasite (image_ID,
-                                                      "print-page-setup");
+                                                      PRINT_PAGE_SETUP_NAME);
 
   if (! key_file)
-    key_file = print_utils_key_file_load_from_rcfile ("print-page-setup");
+    key_file = print_utils_key_file_load_from_rcfile (PRINT_PAGE_SETUP_NAME);
 
   if (key_file)
     {
       GtkPageSetup *setup;
-      GError       *error = NULL;
 
-      setup = gtk_page_setup_new_from_key_file (key_file, NULL, &error);
+      setup = gtk_page_setup_new_from_key_file (key_file,
+                                                PRINT_PAGE_SETUP_NAME, NULL);
 
       if (setup)
         {
           gtk_print_operation_set_default_page_setup (operation, setup);
           g_object_unref (setup);
         }
-      else
-        {
-          g_warning ("unable to read page setup from key file: %s",
-                     error->message);
-          g_error_free (error);
-        }
 
       g_key_file_free (key_file);
     }
@@ -92,12 +88,12 @@
 
   setup = gtk_print_operation_get_default_page_setup (operation);
 
-  gtk_page_setup_to_key_file (setup, key_file, NULL);
+  gtk_page_setup_to_key_file (setup, key_file, PRINT_PAGE_SETUP_NAME);
 
   print_utils_key_file_save_as_parasite (key_file,
-                                         image_ID, "print-page-setup");
+                                         image_ID, PRINT_PAGE_SETUP_NAME);
   print_utils_key_file_save_as_rcfile (key_file,
-                                       "print-page-setup");
+                                       PRINT_PAGE_SETUP_NAME);
 
   g_key_file_free (key_file);
 }

Modified: trunk/plug-ins/print/print-settings.c
==============================================================================
--- trunk/plug-ins/print/print-settings.c	(original)
+++ trunk/plug-ins/print/print-settings.c	Mon Feb 25 21:21:15 2008
@@ -29,6 +29,8 @@
 #define PRINT_SETTINGS_MAJOR_VERSION 0
 #define PRINT_SETTINGS_MINOR_VERSION 4
 
+#define PRINT_SETTINGS_NAME          "print-settings"
+
 
 static GKeyFile * print_settings_key_file_from_settings      (PrintData         *data);
 
@@ -77,7 +79,7 @@
 {
   GKeyFile *key_file = print_settings_key_file_from_settings (data);
 
-  print_utils_key_file_save_as_rcfile (key_file, "print-settings");
+  print_utils_key_file_save_as_rcfile (key_file, PRINT_SETTINGS_NAME);
 
   /* image setup */
   if (gimp_image_is_valid (data->image_id))
@@ -98,7 +100,8 @@
                               "use-full-page", data->use_full_page);
 
       print_utils_key_file_save_as_parasite (key_file,
-                                             data->image_id, "print-settings");
+                                             data->image_id,
+                                             PRINT_SETTINGS_NAME);
     }
 
   g_key_file_free (key_file);
@@ -140,7 +143,7 @@
 {
   GKeyFile *key_file = data;
 
-  g_key_file_set_value (key_file, "print-settings", key, value);
+  g_key_file_set_value (key_file, PRINT_SETTINGS_NAME, key, value);
 }
 
 /*
@@ -149,7 +152,9 @@
 static GKeyFile *
 print_settings_key_file_from_resource_file (void)
 {
-  GKeyFile *key_file = print_utils_key_file_load_from_rcfile ("print-settings");
+  GKeyFile *key_file;
+
+  key_file = print_utils_key_file_load_from_rcfile (PRINT_SETTINGS_NAME);
 
   if (key_file && ! print_settings_check_version (key_file))
     {
@@ -170,7 +175,7 @@
   GKeyFile *key_file;
 
   key_file = print_utils_key_file_load_from_parasite (image_ID,
-                                                      "print-settings");
+                                                      PRINT_SETTINGS_NAME);
 
   if (key_file && ! print_settings_check_version (key_file))
     {
@@ -195,7 +200,7 @@
   if (! settings)
     settings = gtk_print_settings_new ();
 
-  keys = g_key_file_get_keys (key_file, "print-settings", &n_keys, NULL);
+  keys = g_key_file_get_keys (key_file, PRINT_SETTINGS_NAME, &n_keys, NULL);
 
   if (! keys)
     return FALSE;
@@ -204,7 +209,8 @@
     {
       gchar *value;
 
-      value = g_key_file_get_value (key_file, "print-settings", keys[i], NULL);
+      value = g_key_file_get_value (key_file,
+                                    PRINT_SETTINGS_NAME, keys[i], NULL);
 
       if (value)
         {

Modified: trunk/plug-ins/print/print-utils.c
==============================================================================
--- trunk/plug-ins/print/print-utils.c	(original)
+++ trunk/plug-ins/print/print-utils.c	Mon Feb 25 21:21:15 2008
@@ -31,7 +31,7 @@
 
   g_return_val_if_fail (basename != NULL, NULL);
 
-  filename = g_build_filename (gimp_directory (), "print-settings", NULL);
+  filename = g_build_filename (gimp_directory (), basename, NULL);
 
   key_file = g_key_file_new ();
 



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