[ghex] gtkhex: remove GROUP_* for GtkHexGroupType enum



commit b35fc6031121ed53fa52cd9afec0fe61693b77b4
Author: Logan Rathbone <poprocks gmail com>
Date:   Thu Dec 16 19:47:55 2021 -0500

    gtkhex: remove GROUP_* for GtkHexGroupType enum

 src/gtkhex-layout-manager.c |  2 +-
 src/gtkhex-layout-manager.h |  3 ++-
 src/gtkhex.c                |  5 +----
 src/gtkhex.h                | 15 +++++++++------
 src/preferences.c           | 12 ++++++------
 src/print.c                 |  4 ++--
 6 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/src/gtkhex-layout-manager.c b/src/gtkhex-layout-manager.c
index 666b95a..ff81cb9 100644
--- a/src/gtkhex-layout-manager.c
+++ b/src/gtkhex-layout-manager.c
@@ -469,7 +469,7 @@ gtk_hex_layout_init (GtkHexLayout *self)
 {
        /* FIXME - dumb test initial default */
        self->char_width = 20;
-       self->group_type = GROUP_BYTE;
+       self->group_type = GTK_HEX_GROUP_BYTE;
 }
 
 /* GtkHexLayout - Public Methods */
diff --git a/src/gtkhex-layout-manager.h b/src/gtkhex-layout-manager.h
index e4512ad..d2ec998 100644
--- a/src/gtkhex-layout-manager.h
+++ b/src/gtkhex-layout-manager.h
@@ -27,7 +27,8 @@
 
 #include <gtk/gtk.h>
 
-/* Not a circular dep; this is just for the GROUP_* enums defined there. */
+/* Not a circular dep; this is just for the GTK_HEX_GROUP_* enums defined
+ * there. */
 #include "gtkhex.h"
 
 G_BEGIN_DECLS
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 08d045b..b856994 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -2484,7 +2484,7 @@ gtk_hex_init (GtkHex *gh)
 
        gh->extra_width = 0;
        gh->active_view = VIEW_HEX;
-       gh->group_type = GROUP_BYTE;
+       gh->group_type = GTK_HEX_GROUP_BYTE;
        gh->lines = gh->vis_lines = gh->top_line = gh->cpl = 0;
        gh->cursor_pos = 0;
        gh->lower_nibble = FALSE;
@@ -3052,9 +3052,6 @@ gtk_hex_get_byte (GtkHex *gh, int offset)
        return 0;
 }
 
-/*
- * sets data group type (see GROUP_* defines at top of file)
- */
 void
 gtk_hex_set_group_type (GtkHex *gh, guint gt)
 {
diff --git a/src/gtkhex.h b/src/gtkhex.h
index 2d555b3..8aabab0 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -39,12 +39,15 @@
 
 G_BEGIN_DECLS
 
-/* CONSTANTS */
-
-/* how to group bytes? */
-#define GROUP_BYTE 1
-#define GROUP_WORD 2
-#define GROUP_LONG 4
+/* ENUMS */
+
+typedef enum
+{
+       GTK_HEX_GROUP_BYTE              1,
+       GTK_HEX_GROUP_WORD              2,
+       GTK_HEX_GROUP_LONG              4,
+       GTK_HEX_GROUP_QUAD              8
+} GtkHexGroupType;
 
 /* GOBJECT DECLARATION */
 
diff --git a/src/preferences.c b/src/preferences.c
index a4e68ac..00980c5 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -353,13 +353,13 @@ setup_signals (void)
        /* group type checkbuttons */
 
        g_signal_connect (bytes_chkbtn, "toggled",
-                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GROUP_BYTE));
+                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_BYTE));
 
        g_signal_connect (words_chkbtn, "toggled",
-                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GROUP_WORD));
+                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_WORD));
 
        g_signal_connect (long_chkbtn, "toggled",
-                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GROUP_LONG));
+                       G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_LONG));
 
        /* show offsets checkbutton */
 
@@ -426,17 +426,17 @@ grab_widget_values_from_settings (void)
        /* group_type radio buttons
         */
        switch (def_group_type) {
-               case GROUP_BYTE:
+               case GTK_HEX_GROUP_BYTE:
                        gtk_check_button_set_active (GTK_CHECK_BUTTON(bytes_chkbtn),
                                        TRUE);
                        break;
 
-               case GROUP_WORD:
+               case GTK_HEX_GROUP_WORD:
                        gtk_check_button_set_active (GTK_CHECK_BUTTON(words_chkbtn),
                                        TRUE);
                        break;
 
-               case GROUP_LONG:
+               case GTK_HEX_GROUP_LONG:
                        gtk_check_button_set_active (GTK_CHECK_BUTTON(long_chkbtn),
                                        TRUE);
                        break;
diff --git a/src/print.c b/src/print.c
index 945365c..5befd82 100644
--- a/src/print.c
+++ b/src/print.c
@@ -211,7 +211,7 @@ static void print_shaded_box (GHexPrintJobInfo *pji, guint row, guint rows)
 /**
  * ghex_print_job_info_new:
  * @doc: Pointer to the HexDocument to be printed.
- * @group_type: How to group bytes. GROUP_BYTE, GROUP_WORD, or GROUP_LONG.
+ * @group_type: How to group bytes, as GtkHexGroupType.
  *
  * Return value: A pointer to a newly-created GHexPrintJobInfo object.
  * NULL if unable to create.
@@ -219,7 +219,7 @@ static void print_shaded_box (GHexPrintJobInfo *pji, guint row, guint rows)
  * Creates a new GHexPrintJobInfo object.
  **/
 GHexPrintJobInfo *
-ghex_print_job_info_new (HexDocument *doc, guint group_type)
+ghex_print_job_info_new (HexDocument *doc, GtkHexGroupType group_type)
 {
        GHexPrintJobInfo *pji;
        PangoFontDescription *d_font;


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