[ghex/gtk4-port: 69/91] ghex-notebook-tab: split into own file




commit b23ca2f16f8999144152e1b31cbcb822ee05a3d1
Author: Logan Rathbone <poprocks gmail com>
Date:   Sat Jan 30 17:54:03 2021 -0500

    ghex-notebook-tab: split into own file

 src/ghex-application-window.c | 278 +++---------------------------------------
 src/ghex-application-window.h |   1 +
 src/ghex-notebook-tab.c       | 253 ++++++++++++++++++++++++++++++++++++++
 src/ghex-notebook-tab.h       |  48 ++++++++
 src/gtkhex-layout-manager.c   |   2 -
 src/gtkhex.c                  |   8 +-
 src/meson.build               |   2 +
 7 files changed, 323 insertions(+), 269 deletions(-)
---
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 410352dc..35f127d3 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -28,42 +28,6 @@
 
 #define offset_fmt     "0x%X"
 
-/* GHexNotebookTab GOBJECT DEFINITION */
-
-/* This is just an object internal to the app window widget, so we don't
- * need to define it publicly in the header.
- */
-#define GHEX_TYPE_NOTEBOOK_TAB (ghex_notebook_tab_get_type ())
-G_DECLARE_FINAL_TYPE (GHexNotebookTab, ghex_notebook_tab, GHEX, NOTEBOOK_TAB,
-                               GtkWidget)
-
-enum notebook_signal_types {
-       CLOSED,
-       NOTEBOOK_LAST_SIGNAL
-};
-
-struct _GHexNotebookTab
-{
-       GtkWidget parent_instance;
-       
-       GtkWidget *label;
-       GtkWidget *close_btn;
-       GtkHex *gh;                             /* GtkHex widget activated when tab is clicked */
-};
-
-static guint notebook_signals[NOTEBOOK_LAST_SIGNAL];
-
-G_DEFINE_TYPE (GHexNotebookTab, ghex_notebook_tab, GTK_TYPE_WIDGET)
-
-/* GHexNotebookTab - Internal Method Decls */
-
-static GtkWidget * ghex_notebook_tab_new (void);
-static void ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh);
-static const char * ghex_notebook_tab_get_filename (GHexNotebookTab *self);
-static void ghex_notebook_tab_refresh_file_name (GHexNotebookTab *self);
-
-/* ---- */
-
 /* ----------------------- */
 /* MAIN GOBJECT DEFINITION */
 /* ----------------------- */
@@ -313,18 +277,18 @@ ghex_application_window_remove_tab (GHexApplicationWindow *self,
 {
        GtkNotebook *notebook = GTK_NOTEBOOK(self->hex_notebook);
        int page_num;
+       GtkHex *tab_gh;
 
-       g_return_if_fail (GTK_IS_HEX(tab->gh));
-
-       page_num = gtk_notebook_page_num (notebook,
-                       GTK_WIDGET(tab->gh));
+       tab_gh = ghex_notebook_tab_get_hex (tab);
+       g_return_if_fail (GTK_IS_HEX(tab_gh));
 
+       page_num = gtk_notebook_page_num (notebook, GTK_WIDGET(tab_gh));
        gtk_notebook_remove_page (notebook, page_num);
 
        /* FIXME - remove as a possible optimization - but let's keep it in
         * for now for debugging purposes. */
-       g_return_if_fail (g_list_find (self->gh_list, tab->gh));
-       self->gh_list = g_list_remove (self->gh_list, tab->gh);
+       g_return_if_fail (g_list_find (self->gh_list, tab_gh));
+       self->gh_list = g_list_remove (self->gh_list, tab_gh);
 
        g_object_unref (tab);
 }
@@ -584,7 +548,7 @@ enable_main_actions (GHexApplicationWindow *self, gboolean enable)
 }
 
 
-/* GHexApplicationWindow -- CALLBACKS */
+/* CALLBACKS */
 
 static gboolean
 close_tab_shortcut_cb (GtkWidget *widget,
@@ -669,17 +633,17 @@ notebook_switch_page_cb (GtkNotebook *notebook,
                gpointer     user_data)
 {
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(user_data);
-       GHexNotebookTab *tab =
-               GHEX_NOTEBOOK_TAB(gtk_notebook_get_tab_label (notebook, page));
+       GHexNotebookTab *tab;
+       GtkHex *tab_gh;
        HexDocument *doc;
 
-       g_return_if_fail (GHEX_IS_NOTEBOOK_TAB(tab));
-
-       g_debug ("%s: start - tab: %p - tab->gh: %p - self->gh: %p",
-                       __func__, (void *)tab, (void *)tab->gh, (void *)self->gh);
+       tab = GHEX_NOTEBOOK_TAB(gtk_notebook_get_tab_label (notebook, page));
+       g_return_if_fail (GHEX_IS_NOTEBOOK_TAB (tab));
+       tab_gh = ghex_notebook_tab_get_hex (tab);
+       g_return_if_fail (GTK_IS_HEX (tab_gh));
 
-       if (tab->gh != self->gh) {
-               ghex_application_window_set_hex (self, tab->gh);
+       if (tab_gh != self->gh) {
+               ghex_application_window_set_hex (self, tab_gh);
                ghex_application_window_activate_tab (self, self->gh);
        }
 
@@ -1471,218 +1435,6 @@ ghex_application_window_get_property (GObject *object,
        }
 }
 
-/* GHexNotebookTab -- CALLBACKS */
-
-/* _document_changed_cb helper fcn. */
-static void
-tab_bold_label (GHexNotebookTab *self, gboolean bold)
-{
-       GtkLabel *label = GTK_LABEL(self->label);
-       const char *text;
-       char *new = NULL;
-
-       text = gtk_label_get_text (label);
-
-       if (bold) {
-               new = g_strdup_printf("<b>%s</b>", text);
-       }
-       else {
-               new = g_strdup (text);
-       }
-       gtk_label_set_markup (label, new);
-       g_free (new);
-}
-
-static void
-ghex_notebook_tab_document_changed_cb (HexDocument *doc,
-               gpointer change_data,
-               gboolean push_undo,
-               gpointer user_data)
-{
-       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(user_data);
-
-       g_debug ("%s: DETECTED DOC CHANGED.", __func__);
-
-       (void)change_data, (void)push_undo;     /* unused */
-
-       tab_bold_label (self, hex_document_has_changed (doc));
-}
-
-static void
-ghex_notebook_tab_close_click_cb (GtkButton *button,
-               gpointer   user_data)
-{
-       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(user_data);
-
-       g_signal_emit(self,
-                       notebook_signals[CLOSED],
-                       0);             /* GQuark detail (just set to 0 if unknown) */
-}
-
-
-/* GHexNotebookTab -- CONSTRUCTORS AND DESTRUCTORS */
-
-static void
-ghex_notebook_tab_init (GHexNotebookTab *self)
-{
-       GtkWidget *widget = GTK_WIDGET (self);
-       GtkLayoutManager *layout_manager;
-
-       /* Set spacing between label and close button. */
-
-       layout_manager = gtk_widget_get_layout_manager (widget);
-       gtk_box_layout_set_spacing (GTK_BOX_LAYOUT(layout_manager), 12);
-       
-       /* Set up our label to hold the document name and the close button. */
-
-       self->label = gtk_label_new (_("Untitled document"));
-       self->close_btn = gtk_button_new ();
-
-       gtk_widget_set_halign (self->close_btn, GTK_ALIGN_END);
-       gtk_button_set_icon_name (GTK_BUTTON(self->close_btn),
-                       "window-close-symbolic");
-       gtk_button_set_has_frame (GTK_BUTTON(self->close_btn), FALSE);
-
-       gtk_widget_set_parent (self->label, widget);
-       gtk_widget_set_parent (self->close_btn, widget);
-
-       /* SIGNALS */
-       /* Cross-reference: notebook_switch_page_cb which we can't set here,
-        * because this only pertains to the label of the tab and not the
-        * tab as a whole.
-        */
-    g_signal_connect (self->close_btn, "clicked",
-                     G_CALLBACK(ghex_notebook_tab_close_click_cb), self);
-}
-
-static void
-ghex_notebook_tab_dispose (GObject *object)
-{
-       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(object);
-       GtkWidget *widget = GTK_WIDGET(self);
-       GtkWidget *child;
-
-       /* Unparent children
-        */
-       g_clear_pointer (&self->label, gtk_widget_unparent);
-       g_clear_pointer (&self->close_btn, gtk_widget_unparent);
-
-       /* Unref GtkHex widget associated with tab */
-       g_object_unref (self->gh);
-
-       /* Boilerplate: chain up
-        */
-       G_OBJECT_CLASS(ghex_notebook_tab_parent_class)->dispose(object);
-}
-
-static void
-ghex_notebook_tab_finalize (GObject *gobject)
-{
-       /* here, you would free stuff. I've got nuthin' for ya. */
-
-       /* --- */
-
-       /* Boilerplate: chain up
-        */
-       G_OBJECT_CLASS(ghex_notebook_tab_parent_class)->finalize(gobject);
-}
-
-static void
-ghex_notebook_tab_class_init (GHexNotebookTabClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-       object_class->dispose = ghex_notebook_tab_dispose;
-       object_class->finalize = ghex_notebook_tab_finalize;
-
-       /* Layout manager: box-style layout. */
-       gtk_widget_class_set_layout_manager_type (widget_class,
-                       GTK_TYPE_BOX_LAYOUT);
-
-       /* SIGNALS */
-
-       notebook_signals[CLOSED] = g_signal_new_class_handler("closed",
-                       G_OBJECT_CLASS_TYPE(object_class),
-                       G_SIGNAL_RUN_FIRST,
-               /* GCallback class_handler: */
-                       NULL,
-               /* no accumulator or accu_data */
-                       NULL, NULL,
-               /* GSignalCMarshaller c_marshaller: */
-                       NULL,           /* use generic marshaller */
-               /* GType return_type: */
-                       G_TYPE_NONE,
-               /* guint n_params: */
-                       0);
-}
-
-/* GHexNotebookTab - Internal Methods */ 
-
-static void
-ghex_notebook_tab_refresh_file_name (GHexNotebookTab *self)
-{
-       HexDocument *doc;
-
-       doc = gtk_hex_get_document (self->gh);
-
-       gtk_label_set_markup (GTK_LABEL(self->label), doc->path_end);
-       tab_bold_label (self, hex_document_has_changed (doc));
-}
-
-static GtkWidget *
-ghex_notebook_tab_new (void)
-{
-       return g_object_new (GHEX_TYPE_NOTEBOOK_TAB,
-                       /* no properties to set */
-                       NULL);
-}
-
-static void
-ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh)
-{
-       HexDocument *doc;
-
-       /* Do some sanity checks, as this method requires that some ducks be in
-        * a row -- we need a valid GtkHex that is pre-loaded with a valid
-        * HexDocument.
-        */
-       g_return_if_fail (GHEX_IS_NOTEBOOK_TAB (self));
-       g_return_if_fail (GTK_IS_HEX (gh));
-
-       doc = gtk_hex_get_document (gh);
-       g_return_if_fail (HEX_IS_DOCUMENT (doc));
-
-       /* Associate this notebook tab with a GtkHex widget. */
-       g_object_ref (gh);
-       self->gh = gh;
-
-       /* Set name of tab. */
-       ghex_notebook_tab_refresh_file_name (self);
-
-       /* HexDocument - Setup signals */
-       g_signal_connect (doc, "document-changed",
-                       G_CALLBACK(ghex_notebook_tab_document_changed_cb), self);
-
-       g_signal_connect_swapped (doc, "file-name-changed",
-                       G_CALLBACK(ghex_notebook_tab_refresh_file_name), self);
-
-       g_signal_connect_swapped (doc, "file-saved",
-                       G_CALLBACK(ghex_notebook_tab_refresh_file_name), self);
-}
-
-static const char *
-ghex_notebook_tab_get_filename (GHexNotebookTab *self)
-{
-       g_return_val_if_fail (GTK_IS_LABEL (GTK_LABEL(self->label)),
-                       NULL);
-
-       return gtk_label_get_text (GTK_LABEL(self->label));
-}
-
-
-/* ---- */
-
 
 /* GHexApplicationWindow -- CONSTRUCTORS AND DESTRUCTORS */
 
diff --git a/src/ghex-application-window.h b/src/ghex-application-window.h
index e89cbe32..de3d75ca 100644
--- a/src/ghex-application-window.h
+++ b/src/ghex-application-window.h
@@ -30,6 +30,7 @@
 
 #include "gtkhex.h"
 #include "configuration.h"
+#include "ghex-notebook-tab.h"
 #include "hex-dialog.h"
 #include "findreplace.h"
 #include "chartable.h"
diff --git a/src/ghex-notebook-tab.c b/src/ghex-notebook-tab.c
new file mode 100644
index 00000000..d6f93e4b
--- /dev/null
+++ b/src/ghex-notebook-tab.c
@@ -0,0 +1,253 @@
+/* vim: ts=4 sw=4 colorcolumn=80
+ * -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* ghex-notebook-tab.c - GHex notebook tab
+
+   Copyright © 2021 Logan Rathbone <poprocks gmail com>
+
+   GHex is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   GHex is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GHex; see the file COPYING.
+   If not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+   Original GHex Author: Jaka Mocnik <jaka gnu org>
+*/
+
+#include "ghex-notebook-tab.h"
+
+enum signal_types {
+       CLOSED,
+       LAST_SIGNAL
+};
+
+struct _GHexNotebookTab
+{
+       GtkWidget parent_instance;
+       
+       GtkWidget *label;
+       GtkWidget *close_btn;
+       GtkHex *gh;                             /* GtkHex widget activated when tab is clicked */
+};
+
+static guint signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE (GHexNotebookTab, ghex_notebook_tab, GTK_TYPE_WIDGET)
+
+
+/* Callbacks */
+
+/* _document_changed_cb helper fcn. */
+static void
+tab_bold_label (GHexNotebookTab *self, gboolean bold)
+{
+       GtkLabel *label = GTK_LABEL(self->label);
+       const char *text;
+       char *new = NULL;
+
+       text = gtk_label_get_text (label);
+
+       if (bold) {
+               new = g_strdup_printf("<b>%s</b>", text);
+       }
+       else {
+               new = g_strdup (text);
+       }
+       gtk_label_set_markup (label, new);
+       g_free (new);
+}
+
+static void
+ghex_notebook_tab_document_changed_cb (HexDocument *doc,
+               gpointer change_data,
+               gboolean push_undo,
+               gpointer user_data)
+{
+       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(user_data);
+
+       (void)change_data, (void)push_undo;     /* unused */
+
+       tab_bold_label (self, hex_document_has_changed (doc));
+}
+
+static void
+ghex_notebook_tab_close_click_cb (GtkButton *button,
+               gpointer   user_data)
+{
+       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(user_data);
+
+       g_signal_emit(self,
+                       signals[CLOSED],
+                       0);             /* GQuark detail (just set to 0 if unknown) */
+}
+
+
+/* CONSTRUCTORS AND DESTRUCTORS */
+
+static void
+ghex_notebook_tab_init (GHexNotebookTab *self)
+{
+       GtkWidget *widget = GTK_WIDGET (self);
+       GtkLayoutManager *layout_manager;
+
+       /* Set spacing between label and close button. */
+
+       layout_manager = gtk_widget_get_layout_manager (widget);
+       gtk_box_layout_set_spacing (GTK_BOX_LAYOUT(layout_manager), 12);
+       
+       /* Set up our label to hold the document name and the close button. */
+
+       self->label = gtk_label_new (_("Untitled document"));
+       self->close_btn = gtk_button_new ();
+
+       gtk_widget_set_halign (self->close_btn, GTK_ALIGN_END);
+       gtk_button_set_icon_name (GTK_BUTTON(self->close_btn),
+                       "window-close-symbolic");
+       gtk_button_set_has_frame (GTK_BUTTON(self->close_btn), FALSE);
+
+       gtk_widget_set_parent (self->label, widget);
+       gtk_widget_set_parent (self->close_btn, widget);
+
+       /* SIGNALS */
+
+    g_signal_connect (self->close_btn, "clicked",
+                     G_CALLBACK(ghex_notebook_tab_close_click_cb), self);
+}
+
+static void
+ghex_notebook_tab_dispose (GObject *object)
+{
+       GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(object);
+       GtkWidget *widget = GTK_WIDGET(self);
+       GtkWidget *child;
+
+       /* Unparent children */
+       g_clear_pointer (&self->label, gtk_widget_unparent);
+       g_clear_pointer (&self->close_btn, gtk_widget_unparent);
+
+       /* Unref GtkHex widget associated with tab */
+       g_object_unref (self->gh);
+
+       /* Boilerplate: chain up */
+       G_OBJECT_CLASS(ghex_notebook_tab_parent_class)->dispose(object);
+}
+
+static void
+ghex_notebook_tab_finalize (GObject *gobject)
+{
+       /* here, you would free stuff. I've got nuthin' for ya. */
+
+       /* Boilerplate: chain up */
+       G_OBJECT_CLASS(ghex_notebook_tab_parent_class)->finalize(gobject);
+}
+
+static void
+ghex_notebook_tab_class_init (GHexNotebookTabClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->dispose = ghex_notebook_tab_dispose;
+       object_class->finalize = ghex_notebook_tab_finalize;
+
+       /* Layout manager: box-style layout. */
+       gtk_widget_class_set_layout_manager_type (widget_class,
+                       GTK_TYPE_BOX_LAYOUT);
+
+       /* SIGNALS */
+
+       signals[CLOSED] = g_signal_new_class_handler("closed",
+                       G_OBJECT_CLASS_TYPE(object_class),
+                       G_SIGNAL_RUN_FIRST,
+               /* GCallback class_handler: */
+                       NULL,
+               /* no accumulator or accu_data */
+                       NULL, NULL,
+               /* GSignalCMarshaller c_marshaller: */
+                       NULL,           /* use generic marshaller */
+               /* GType return_type: */
+                       G_TYPE_NONE,
+               /* guint n_params: */
+                       0);
+}
+
+/* Internal Methods */ 
+
+static void
+refresh_file_name (GHexNotebookTab *self)
+{
+       HexDocument *doc;
+
+       doc = gtk_hex_get_document (self->gh);
+
+       gtk_label_set_markup (GTK_LABEL(self->label), doc->path_end);
+       tab_bold_label (self, hex_document_has_changed (doc));
+}
+
+/* Public Methods */
+ 
+GtkWidget *
+ghex_notebook_tab_new (void)
+{
+       return g_object_new (GHEX_TYPE_NOTEBOOK_TAB,
+                       /* no properties to set */
+                       NULL);
+}
+
+void
+ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh)
+{
+       HexDocument *doc;
+
+       /* Do some sanity checks, as this method requires that some ducks be in
+        * a row -- we need a valid GtkHex that is pre-loaded with a valid
+        * HexDocument.
+        */
+       g_return_if_fail (GHEX_IS_NOTEBOOK_TAB (self));
+       g_return_if_fail (GTK_IS_HEX (gh));
+
+       doc = gtk_hex_get_document (gh);
+       g_return_if_fail (HEX_IS_DOCUMENT (doc));
+
+       /* Associate this notebook tab with a GtkHex widget. */
+       g_object_ref (gh);
+       self->gh = gh;
+
+       /* Set name of tab. */
+       refresh_file_name (self);
+
+       /* HexDocument - Setup signals */
+       g_signal_connect (doc, "document-changed",
+                       G_CALLBACK(ghex_notebook_tab_document_changed_cb), self);
+
+       g_signal_connect_swapped (doc, "file-name-changed",
+                       G_CALLBACK(refresh_file_name), self);
+
+       g_signal_connect_swapped (doc, "file-saved",
+                       G_CALLBACK(refresh_file_name), self);
+}
+
+const char *
+ghex_notebook_tab_get_filename (GHexNotebookTab *self)
+{
+       g_return_val_if_fail (GTK_IS_LABEL (GTK_LABEL(self->label)),
+                       NULL);
+
+       return gtk_label_get_text (GTK_LABEL(self->label));
+}
+
+GtkHex *
+ghex_notebook_tab_get_hex (GHexNotebookTab *self)
+{
+       g_return_val_if_fail (GTK_IS_HEX (self->gh), NULL);
+
+       return self->gh;
+}
diff --git a/src/ghex-notebook-tab.h b/src/ghex-notebook-tab.h
new file mode 100644
index 00000000..e4c8647f
--- /dev/null
+++ b/src/ghex-notebook-tab.h
@@ -0,0 +1,48 @@
+/* vim: ts=4 sw=4 colorcolumn=80
+ * -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* ghex-application-window.c - GHex main application window
+
+   Copyright © 2021 Logan Rathbone <poprocks gmail com>
+
+   GHex is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   GHex is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GHex; see the file COPYING.
+   If not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+   Original GHex Author: Jaka Mocnik <jaka gnu org>
+*/
+
+#ifndef GHEX_NOTEBOOK_TAB_H
+#define GHEX_NOTEBOOK_TAB_H
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "gtkhex.h"
+
+G_BEGIN_DECLS
+
+#define GHEX_TYPE_NOTEBOOK_TAB (ghex_notebook_tab_get_type ())
+G_DECLARE_FINAL_TYPE (GHexNotebookTab, ghex_notebook_tab, GHEX, NOTEBOOK_TAB,
+                               GtkWidget)
+
+/* Method Declarations */
+
+GtkWidget *    ghex_notebook_tab_new (void);
+void                   ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh);
+const char *   ghex_notebook_tab_get_filename (GHexNotebookTab *self);
+GtkHex *               ghex_notebook_tab_get_hex (GHexNotebookTab *self);
+
+G_END_DECLS
+
+#endif
diff --git a/src/gtkhex-layout-manager.c b/src/gtkhex-layout-manager.c
index f48bb2b7..705c855d 100644
--- a/src/gtkhex-layout-manager.c
+++ b/src/gtkhex-layout-manager.c
@@ -217,8 +217,6 @@ get_cpl_from_ascii_width (GtkHexLayout *self, int width)
 {
        int hex_cpl, ascii_cpl;
 
-       g_debug ("%s: GROUP_TYPE: %u", __func__, self->group_type);
-
        /* Hex characters per line is a simple calculation: */
 
        ascii_cpl = width / self->char_width;
diff --git a/src/gtkhex.c b/src/gtkhex.c
index b85750e5..7cb0b4af 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -737,7 +737,7 @@ render_xc (GtkHex *gh,
        state = gtk_widget_get_state_flags (gh->xdisp);
 
        if (get_xcoords (gh, gh->cursor_pos, &cx, &cy)) {
-               format_xbyte(gh, gh->cursor_pos, c);
+               format_xbyte (gh, gh->cursor_pos, c);
                if (gh->lower_nibble) {
                        cx += gh->char_width;
                        i = 1;
@@ -859,7 +859,7 @@ render_hex_highlights (GtkHex *gh,
 
                        if (cursor_line == sl)
                        {
-                               cursor_off = 2*(start%gh->cpl) + (start%gh->cpl)/gh->group_type;
+                               cursor_off = 2 * (start % gh->cpl) + (start % gh->cpl) / gh->group_type;
                                if (cursor_line == el)
                                        len = 2*(end%gh->cpl + 1) + (end%gh->cpl)/gh->group_type;
                                else
@@ -2953,7 +2953,7 @@ gtk_hex_get_selection (GtkHex *gh, gint *start, gint *end)
 {
        gint ss, se;
 
-       if(gh->selection.start > gh->selection.end) {
+       if (gh->selection.start > gh->selection.end) {
                se = gh->selection.start;
                ss = gh->selection.end;
        }
@@ -3061,7 +3061,7 @@ gtk_hex_set_cursor(GtkHex *gh, gint index) {
 
                if(index == gh->document->file_size)
                        gh->lower_nibble = FALSE;
-               
+
                if(gh->selecting) {
                        gtk_hex_set_selection(gh, gh->selection.start, gh->cursor_pos);
                        bytes_changed (gh,
diff --git a/src/meson.build b/src/meson.build
index 9e3ef1f3..b54f165b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -59,6 +59,8 @@ ghex_sources = [
   'findreplace.h',
   'ghex-application-window.c',
   'ghex-application-window.h',
+  'ghex-notebook-tab.c',
+  'ghex-notebook-tab.h',
   'hex-dialog.c',
   'hex-dialog.h',
   'main.c',


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