[ghex] Use unsigned values for max-undo-depth and print-shaded-rows GSettings keys
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] Use unsigned values for max-undo-depth and print-shaded-rows GSettings keys
- Date: Mon, 8 Aug 2011 18:32:18 +0000 (UTC)
commit bd3d4c9716d48e03861312024de7c070718a5065
Author: Kalev Lember <kalevlember gmail com>
Date: Mon Aug 8 20:42:28 2011 +0300
Use unsigned values for max-undo-depth and print-shaded-rows GSettings keys
Needs gsettings-data-convert with the patch from [1] to successfully do
integer type conversions from int->uint.
[1] https://bugzilla.gnome.org/show_bug.cgi?id=656170
data/org.gnome.GHex.gschema.xml | 4 ++--
src/config.c | 10 +++++-----
src/configuration.h | 2 +-
src/preferences.c | 14 ++++++++------
src/print.c | 6 +++---
5 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/data/org.gnome.GHex.gschema.xml b/data/org.gnome.GHex.gschema.xml
index 54d24c8..e338df8 100644
--- a/data/org.gnome.GHex.gschema.xml
+++ b/data/org.gnome.GHex.gschema.xml
@@ -6,7 +6,7 @@
<key name="group-data-by" type="i">
<default>1</default>
</key>
- <key name="max-undo-depth" type="i">
+ <key name="max-undo-depth" type="u">
<default>100</default>
</key>
<key name="offset-format" type="s">
@@ -18,7 +18,7 @@
<key name="print-font-header" type="s">
<default>'Helvetica 12'</default>
</key>
- <key name="print-shaded-rows" type="i">
+ <key name="print-shaded-rows" type="u">
<default>0</default>
</key>
<key name="show-offsets" type="b">
diff --git a/src/config.c b/src/config.c
index 4adcfa7..608a056 100644
--- a/src/config.c
+++ b/src/config.c
@@ -82,7 +82,7 @@ void ghex_load_configuration () {
def_group_type = GROUP_BYTE;
/* Get the max undo depth -- SnM */
- max_undo_depth = g_settings_get_int (settings, GHEX_PREF_MAX_UNDO_DEPTH);
+ g_settings_get (settings, GHEX_PREF_MAX_UNDO_DEPTH, "u", &max_undo_depth);
/* Get the offset format -- SnM */
@@ -104,7 +104,7 @@ void ghex_load_configuration () {
show_offsets_column = g_settings_get_boolean (settings, GHEX_PREF_OFFSETS_COLUMN);
/* Get the shaded box size -- SnM */
- shaded_box_size = g_settings_get_int (settings, GHEX_PREF_BOX_SIZE);
+ g_settings_get (settings, GHEX_PREF_BOX_SIZE, "u", &shaded_box_size);
/* Get the data font name -- SnM */
data_font_name = g_settings_get_string (settings, GHEX_PREF_DATA_FONT);
@@ -159,9 +159,9 @@ max_undo_depth_changed_cb (GSettings *settings,
gpointer user_data)
{
const GList *docn;
- gint new_undo_max = g_settings_get_int (settings, key);
- max_undo_depth = new_undo_max;
+ g_settings_get (settings, key, "u", &max_undo_depth);
+
docn = hex_document_get_list ();
while (docn) {
hex_document_set_max_undo (HEX_DOCUMENT (docn->data), max_undo_depth);
@@ -174,7 +174,7 @@ box_size_changed_cb (GSettings *settings,
const gchar *key,
gpointer user_data)
{
- shaded_box_size = g_settings_get_int (settings, key);
+ g_settings_get (settings, key, "u", &shaded_box_size);
}
static void
diff --git a/src/configuration.h b/src/configuration.h
index ebcffe6..0da0faf 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -53,7 +53,7 @@ extern guint max_undo_depth;
extern gchar *offset_fmt;
extern gboolean show_offsets_column;
-extern gint shaded_box_size;
+extern guint shaded_box_size;
extern gint def_group_type;
extern GSettings *settings;
diff --git a/src/preferences.c b/src/preferences.c
index da5d861..87118fb 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -391,9 +391,10 @@ max_undo_changed_cb(GtkAdjustment *adj, PropertyUI *pui)
if((guint)gtk_adjustment_get_value(adj) != max_undo_depth) {
max_undo_depth = gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(pui->undo_spin));
- g_settings_set_int (settings,
- GHEX_PREF_MAX_UNDO_DEPTH,
- max_undo_depth);
+ g_settings_set (settings,
+ GHEX_PREF_MAX_UNDO_DEPTH,
+ "u",
+ max_undo_depth);
}
}
@@ -403,9 +404,10 @@ box_size_changed_cb(GtkAdjustment *adj, PropertyUI *pui)
if((guint)gtk_adjustment_get_value(adj) != shaded_box_size) {
shaded_box_size = gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(pui->box_size_spin));
- g_settings_set_int (settings,
- GHEX_PREF_BOX_SIZE,
- shaded_box_size);
+ g_settings_set (settings,
+ GHEX_PREF_BOX_SIZE,
+ "u",
+ shaded_box_size);
}
}
diff --git a/src/print.c b/src/print.c
index d0fa9a8..282b340 100644
--- a/src/print.c
+++ b/src/print.c
@@ -36,7 +36,7 @@
#define is_printable(c) (((((guchar)c)>=0x20) && (((guchar)c)<0x7F))?1:0)
gchar *data_font_name, *header_font_name;
-gint shaded_box_size;
+guint shaded_box_size;
static void print_header(GHexPrintJobInfo *pji, unsigned int page);
static void print_row(GHexPrintJobInfo *pji, unsigned int offset,
@@ -181,8 +181,8 @@ static void format_ascii(HexDocument *doc, gchar *out, guint start, guint end)
static void print_shaded_boxes(GHexPrintJobInfo *pji, guint page,
guint max_row)
{
- gint i;
- gint box_size = shaded_box_size;
+ guint i;
+ guint box_size = shaded_box_size;
if(box_size == 0)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]