X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkprintsettings.c;h=a990172795ca386a02902e67077a7bf0e2dc3f52;hb=9d0febc9a64a5bfb0fcfc3a88de4757f6c1ff090;hp=ee7d6c69d2a9df4e3e243fbbca0517599acc23d4;hpb=c659d1a505dbf141aefa266fb0e97c6dac218cee;p=~andy%2Fgtk
diff --git a/gtk/gtkprintsettings.c b/gtk/gtkprintsettings.c
index ee7d6c69d..a99017279 100644
--- a/gtk/gtkprintsettings.c
+++ b/gtk/gtkprintsettings.c
@@ -13,19 +13,42 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see .
*/
#include "config.h"
+
#include
#include
+
#include
-#include
+
#include "gtkprintsettings.h"
#include "gtkprintutils.h"
-#include "gtkalias.h"
+#include "gtktypebuiltins.h"
+#include "gtkwidget.h"
+
+
+/**
+ * SECTION:gtkprintsettings
+ * @Short_description: Stores print settings
+ * @Title: GtkPrintSettings
+ *
+ * A GtkPrintSettings object represents the settings of a print dialog in
+ * a system-independent way. The main use for this object is that once
+ * you've printed you can get a settings object that represents the settings
+ * the user chose, and the next time you print you can pass that object in so
+ * that the user doesn't have to re-set all his settings.
+ *
+ * Its also possible to enumerate the settings so that you can easily save
+ * the settings for the next time your app runs, or even store them in a
+ * document. The predefined keys try to use shared values as much as possible
+ * so that moving such a document between systems still works.
+ *
+ *
+ *
+ * Printing support was added in GTK+ 2.10.
+ */
typedef struct _GtkPrintSettingsClass GtkPrintSettingsClass;
@@ -37,7 +60,7 @@ typedef struct _GtkPrintSettingsClass GtkPrintSettingsClass;
struct _GtkPrintSettings
{
GObject parent_instance;
-
+
GHashTable *hash;
};
@@ -107,10 +130,10 @@ copy_hash_entry (gpointer key,
/**
* gtk_print_settings_copy:
* @other: a #GtkPrintSettings
- *
+ *
* Copies a #GtkPrintSettings object.
- *
- * Return value: a newly allocated copy of @other
+ *
+ * Return value: (transfer full): a newly allocated copy of @other
*
* Since: 2.10
*/
@@ -144,7 +167,7 @@ gtk_print_settings_copy (GtkPrintSettings *other)
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get (GtkPrintSettings *settings,
const gchar *key)
{
@@ -155,11 +178,11 @@ gtk_print_settings_get (GtkPrintSettings *settings,
* gtk_print_settings_set:
* @settings: a #GtkPrintSettings
* @key: a key
- * @value: a string value, or %NULL
- *
+ * @value: (allow-none): a string value, or %NULL
+ *
* Associates @value with @key.
*
- * Since: 2.10
+ * Since: 2.10
*/
void
gtk_print_settings_set (GtkPrintSettings *settings,
@@ -232,7 +255,7 @@ gtk_print_settings_get_bool (GtkPrintSettings *settings,
const gchar *val;
val = gtk_print_settings_get (settings, key);
- if (val != NULL && strcmp (val, "true") == 0)
+ if (g_strcmp0 (val, "true") == 0)
return TRUE;
return FALSE;
@@ -263,10 +286,10 @@ gtk_print_settings_get_bool_with_default (GtkPrintSettings *settings,
const gchar *val;
val = gtk_print_settings_get (settings, key);
- if (val != NULL && strcmp (val, "true") == 0)
+ if (g_strcmp0 (val, "true") == 0)
return TRUE;
- if (val != NULL && strcmp (val, "false") == 0)
+ if (g_strcmp0 (val, "false") == 0)
return FALSE;
return default_val;
@@ -473,9 +496,9 @@ gtk_print_settings_set_int (GtkPrintSettings *settings,
/**
* gtk_print_settings_foreach:
* @settings: a #GtkPrintSettings
- * @func: the function to call
+ * @func: (scope call): the function to call
* @user_data: user data for @func
- *
+ *
* Calls @func for each key-value pair of @settings.
*
* Since: 2.10
@@ -499,7 +522,7 @@ gtk_print_settings_foreach (GtkPrintSettings *settings,
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get_printer (GtkPrintSettings *settings)
{
return gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_PRINTER);
@@ -1402,16 +1425,17 @@ gtk_print_settings_set_print_pages (GtkPrintSettings *settings,
gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_PRINT_PAGES, str);
}
-
+
/**
* gtk_print_settings_get_page_ranges:
* @settings: a #GtkPrintSettings
- * @num_ranges: return location for the length of the returned array
- *
+ * @num_ranges: (out): return location for the length of the returned array
+ *
* Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
- *
- * Return value: an array of #GtkPageRanges. Use g_free()
- * to free the array when it is no longer needed.
+ *
+ * Return value: (array length=num_ranges) (transfer full): an array
+ * of #GtkPageRanges. Use g_free() to free the array when
+ * it is no longer needed.
*
* Since: 2.10
*/
@@ -1468,7 +1492,7 @@ gtk_print_settings_get_page_ranges (GtkPrintSettings *settings,
/**
* gtk_print_settings_set_page_ranges:
* @settings: a #GtkPrintSettings
- * @page_ranges: an array of #GtkPageRanges
+ * @page_ranges: (array length=num_ranges): an array of #GtkPageRanges
* @num_ranges: the length of @page_ranges
*
* Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
@@ -1514,7 +1538,7 @@ gtk_print_settings_set_page_ranges (GtkPrintSettings *settings,
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get_default_source (GtkPrintSettings *settings)
{
return gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_DEFAULT_SOURCE);
@@ -1549,7 +1573,7 @@ gtk_print_settings_set_default_source (GtkPrintSettings *settings,
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get_media_type (GtkPrintSettings *settings)
{
return gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_MEDIA_TYPE);
@@ -1584,7 +1608,7 @@ gtk_print_settings_set_media_type (GtkPrintSettings *settings,
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get_dither (GtkPrintSettings *settings)
{
return gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_DITHER);
@@ -1648,7 +1672,7 @@ gtk_print_settings_set_finishings (GtkPrintSettings *settings,
*
* Since: 2.10
*/
-G_CONST_RETURN gchar *
+const gchar *
gtk_print_settings_get_output_bin (GtkPrintSettings *settings)
{
return gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_BIN);
@@ -1673,8 +1697,8 @@ gtk_print_settings_set_output_bin (GtkPrintSettings *settings,
/**
* gtk_print_settings_load_file:
* @settings: a #GtkPrintSettings
- * @file_name: the filename to read the settings from
- * @error: return location for errors, or %NULL
+ * @file_name: (type filename): the filename to read the settings from
+ * @error: (allow-none): return location for errors, or %NULL
*
* Reads the print settings from @file_name. If the file could not be loaded
* then error is set to either a #GFileError or #GKeyFileError.
@@ -1708,8 +1732,8 @@ gtk_print_settings_load_file (GtkPrintSettings *settings,
/**
* gtk_print_settings_new_from_file:
- * @file_name: the filename to read the settings from
- * @error: return location for errors, or %NULL
+ * @file_name: (type filename): the filename to read the settings from
+ * @error: (allow-none): return location for errors, or %NULL
*
* Reads the print settings from @file_name. Returns a new #GtkPrintSettings
* object with the restored settings, or %NULL if an error occurred. If the
@@ -1739,9 +1763,9 @@ gtk_print_settings_new_from_file (const gchar *file_name,
* gtk_print_settings_load_key_file:
* @settings: a #GtkPrintSettings
* @key_file: the #GKeyFile to retrieve the settings from
- * @group_name: the name of the group to use, or %NULL to use the default
+ * @group_name: (allow-none): the name of the group to use, or %NULL to use the default
* "Print Settings"
- * @error: return location for errors, or %NULL
+ * @error: (allow-none): return location for errors, or %NULL
*
* Reads the print settings from the group @group_name in @key_file. If the
* file could not be loaded then error is set to either a #GFileError or
@@ -1782,7 +1806,7 @@ gtk_print_settings_load_key_file (GtkPrintSettings *settings,
gchar *value;
value = g_key_file_get_string (key_file,
- KEYFILE_GROUP_NAME,
+ group_name,
keys[i],
NULL);
if (!value)
@@ -1800,9 +1824,9 @@ gtk_print_settings_load_key_file (GtkPrintSettings *settings,
/**
* gtk_print_settings_new_from_key_file:
* @key_file: the #GKeyFile to retrieve the settings from
- * @group_name: the name of the group to use, or %NULL to use
+ * @group_name: (allow-none): the name of the group to use, or %NULL to use
* the default "Print Settings"
- * @error: return location for errors, or %NULL
+ * @error: (allow-none): return location for errors, or %NULL
*
* Reads the print settings from the group @group_name in @key_file. Returns a
* new #GtkPrintSettings object with the restored settings, or %NULL if an
@@ -1833,8 +1857,8 @@ gtk_print_settings_new_from_key_file (GKeyFile *key_file,
/**
* gtk_print_settings_to_file:
* @settings: a #GtkPrintSettings
- * @file_name: the file to save to
- * @error: return location for errors, or %NULL
+ * @file_name: (type filename): the file to save to
+ * @error: (allow-none): return location for errors, or %NULL
*
* This function saves the print settings from @settings to @file_name. If the
* file could not be loaded then error is set to either a #GFileError or
@@ -1921,7 +1945,3 @@ gtk_print_settings_to_key_file (GtkPrintSettings *settings,
(GtkPrintSettingsFunc) add_value_to_key_file,
&data);
}
-
-
-#define __GTK_PRINT_SETTINGS_C__
-#include "gtkaliasdef.c"