summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkblockdisplay.c8
-rw-r--r--src/gtkext/gtkbufferdisplay.c12
-rw-r--r--src/gtkext/gtkdisplaypanel-int.h2
-rw-r--r--src/gtkext/gtkdisplaypanel.c95
4 files changed, 84 insertions, 33 deletions
diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c
index 1e677ca..bc189a2 100644
--- a/src/gtkext/gtkblockdisplay.c
+++ b/src/gtkext/gtkblockdisplay.c
@@ -260,7 +260,7 @@ static gboolean gtk_block_display_button_press(GtkWidget *widget, GdkEventButton
view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display));
- changed = g_buffer_view_highlight_segments(view, real_x, real_y, GTK_DISPLAY_PANEL(display)->display_options);
+ changed = g_buffer_view_highlight_segments(view, real_x, real_y, GTK_DISPLAY_PANEL(display)->options);
g_object_unref(G_OBJECT(view));
@@ -311,7 +311,7 @@ static gboolean gtk_block_display_query_tooltip(GtkWidget *widget, gint x, gint
real_y = y;
gtk_display_panel_compute_real_coord(panel, &real_x, &real_y);
- creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, panel->display_options);
+ creator = g_buffer_view_find_creator(GTK_BUFFER_DISPLAY(display)->view, real_x, real_y, panel->options);
if (creator != NULL)
{
@@ -458,7 +458,7 @@ static bool gtk_block_display_notify_caret_relocation(GtkBlockDisplay *display,
view = gtk_buffer_display_get_view(GTK_BUFFER_DISPLAY(display));
- result = g_buffer_view_highlight_segments(view, area->x, area->y, GTK_DISPLAY_PANEL(display)->display_options);
+ result = g_buffer_view_highlight_segments(view, area->x, area->y, GTK_DISPLAY_PANEL(display)->options);
g_object_unref(G_OBJECT(view));
@@ -490,6 +490,6 @@ void gtk_block_display_override_view_index(GtkBlockDisplay *display, unsigned in
panel = GTK_DISPLAY_PANEL(display);
panel->view_index = index;
- panel->display_options = g_loaded_content_get_all_display_options(G_LOADED_CONTENT(panel->binary), index);
+ panel->options = g_loaded_content_get_display_options(G_LOADED_CONTENT(panel->binary), index);
}
diff --git a/src/gtkext/gtkbufferdisplay.c b/src/gtkext/gtkbufferdisplay.c
index 4a2c814..ea391bb 100644
--- a/src/gtkext/gtkbufferdisplay.c
+++ b/src/gtkext/gtkbufferdisplay.c
@@ -438,7 +438,7 @@ static gboolean gtk_buffer_display_draw(GtkWidget *widget, cairo_t *cr)
area.x -= virt_x;
virt_y += area.y;
- g_buffer_view_draw(display->view, cr, virt_y, &area, parent->display_options, selected);
+ g_buffer_view_draw(display->view, cr, virt_y, &area, parent->options, selected);
}
@@ -516,7 +516,7 @@ static gboolean gtk_buffer_display_key_press(GtkWidget *widget, GdkEventKey *eve
ctrl = (event->state & GDK_CONTROL_MASK);
area = display->caret;
- status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->display_options, &area, &cursor);
+ status = g_buffer_view_move_caret(display->view, ctrl, dir, panel->options, &area, &cursor);
if (status)
{
@@ -552,7 +552,7 @@ static void gtk_buffer_display_compute_requested_size(GtkBufferDisplay *display,
if (width != NULL)
{
if (display->view != NULL)
- *width = g_buffer_view_get_width(display->view, GTK_DISPLAY_PANEL(display)->display_options);
+ *width = g_buffer_view_get_width(display->view, GTK_DISPLAY_PANEL(display)->options);
else
*width = 0;
}
@@ -682,7 +682,7 @@ static bool gtk_buffer_display_get_cursor_coordinates(const GtkBufferDisplay *di
if (result)
{
- *x += g_buffer_view_get_margin(display->view, GTK_DISPLAY_PANEL(display)->display_options);
+ *x += g_buffer_view_get_margin(display->view, GTK_DISPLAY_PANEL(display)->options);
height = gtk_widget_get_allocated_height(GTK_WIDGET(display));
@@ -737,7 +737,7 @@ GObject *gtk_buffer_display_get_active_object(const GtkBufferDisplay *display)
else
result = g_buffer_view_find_creator(display->view,
display->caret.x, display->caret.y,
- GTK_DISPLAY_PANEL(display)->display_options);
+ GTK_DISPLAY_PANEL(display)->options);
return result;
@@ -849,7 +849,7 @@ static bool _gtk_buffer_display_move_caret_to(GtkBufferDisplay *display, gint x,
panel = GTK_DISPLAY_PANEL(display);
- result = g_buffer_view_compute_caret_full(display->view, x, y, panel->display_options, &new, &cursor);
+ result = g_buffer_view_compute_caret_full(display->view, x, y, panel->options, &new, &cursor);
if (result)
gtk_buffer_display_relocate_caret(display, &new, cursor);
diff --git a/src/gtkext/gtkdisplaypanel-int.h b/src/gtkext/gtkdisplaypanel-int.h
index ffed3b1..9fdb702 100644
--- a/src/gtkext/gtkdisplaypanel-int.h
+++ b/src/gtkext/gtkdisplaypanel-int.h
@@ -90,7 +90,7 @@ struct _GtkDisplayPanel
bool show_border; /* Affichage d'une bordure ? */
unsigned int view_index; /* Indice du type de contenu */
- bool *display_options; /* Affichage des colonnes ? */
+ GDisplayOptions *options; /* Affichage des colonnes ? */
GLoadedBinary *binary; /* Binaire à visualiser */
diff --git a/src/gtkext/gtkdisplaypanel.c b/src/gtkext/gtkdisplaypanel.c
index 24436ca..706e8f7 100644
--- a/src/gtkext/gtkdisplaypanel.c
+++ b/src/gtkext/gtkdisplaypanel.c
@@ -46,6 +46,12 @@ static void gtk_display_panel_init(GtkDisplayPanel *);
/* Procède à l'initialisation de l'interface d'affichage. */
static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *);
+/* Supprime toutes les références externes. */
+static void gtk_display_panel_dispose(GtkDisplayPanel *);
+
+/* Procède à la libération totale de la mémoire. */
+static void gtk_display_panel_finalize(GtkDisplayPanel *);
+
/* Définit une propriété du composant d'affichage. */
static void gtk_display_panel_set_property(GObject *, guint, const GValue *, GParamSpec *);
@@ -86,7 +92,7 @@ static void gtk_display_panel_update_adjustment(GtkDisplayPanel *, GtkOrientatio
static void gtk_display_panel_adjustment_value_changed(GtkAdjustment *, GtkDisplayPanel *);
/* Réagit à un changement des règles d'affichage. */
-static void on_view_panel_binary_display_change(GLoadedBinary *, BinaryView, BufferLineColumn, GtkDisplayPanel *);
+static void on_view_panel_binary_option_change(GLoadedBinary *, BinaryView, BufferLineColumn, GtkDisplayPanel *);
@@ -133,30 +139,34 @@ G_DEFINE_TYPE_WITH_CODE(GtkDisplayPanel, gtk_display_panel, GTK_TYPE_FIXED,
static void gtk_display_panel_class_init(GtkDisplayPanelClass *class)
{
- GObjectClass *gobject_class; /* Plus haut niveau équivalent */
- GtkWidgetClass *widget_class; /* Classe de haut niveau */
- GtkDisplayPanelClass *panel_class; /* Classe de lus bas niveau */
+ GObjectClass *object; /* Plus haut niveau équivalent */
+ GtkWidgetClass *widget; /* Classe de haut niveau */
+ GtkDisplayPanelClass *panel; /* Classe de lus bas niveau */
- gobject_class = G_OBJECT_CLASS(class);
- widget_class = GTK_WIDGET_CLASS(class);
- panel_class = GTK_DISPLAY_PANEL_CLASS(class);
+ object = G_OBJECT_CLASS(class);
- gobject_class->set_property = gtk_display_panel_set_property;
- gobject_class->get_property = gtk_display_panel_get_property;
+ object->dispose = (GObjectFinalizeFunc/* ! */)gtk_display_panel_dispose;
+ object->finalize = (GObjectFinalizeFunc)gtk_display_panel_finalize;
+ object->set_property = gtk_display_panel_set_property;
+ object->get_property = gtk_display_panel_get_property;
/* Implémentation de l'interface "GtkScrollable" */
- g_object_class_override_property(gobject_class, VPP_HADJUSTMENT, "hadjustment");
- g_object_class_override_property(gobject_class, VPP_VADJUSTMENT, "vadjustment");
- g_object_class_override_property(gobject_class, VPP_HSCROLL_POLICY, "hscroll-policy");
- g_object_class_override_property(gobject_class, VPP_VSCROLL_POLICY, "vscroll-policy");
+ g_object_class_override_property(object, VPP_HADJUSTMENT, "hadjustment");
+ g_object_class_override_property(object, VPP_VADJUSTMENT, "vadjustment");
+ g_object_class_override_property(object, VPP_HSCROLL_POLICY, "hscroll-policy");
+ g_object_class_override_property(object, VPP_VSCROLL_POLICY, "vscroll-policy");
+
+ widget = GTK_WIDGET_CLASS(class);
- widget_class->destroy = gtk_display_panel_destroy;
- widget_class->realize = gtk_display_panel_realize;
- widget_class->size_allocate = gtk_display_panel_size_allocate;
- widget_class->get_preferred_height = gtk_display_panel_get_preferred_height;
- widget_class->get_preferred_width = gtk_display_panel_get_preferred_width;
+ widget->destroy = gtk_display_panel_destroy;
+ widget->realize = gtk_display_panel_realize;
+ widget->size_allocate = gtk_display_panel_size_allocate;
+ widget->get_preferred_height = gtk_display_panel_get_preferred_height;
+ widget->get_preferred_width = gtk_display_panel_get_preferred_width;
- panel_class->compute_inc = gtk_display_panel_compute_scroll_inc;
+ panel = GTK_DISPLAY_PANEL_CLASS(class);
+
+ panel->compute_inc = gtk_display_panel_compute_scroll_inc;
}
@@ -209,6 +219,47 @@ static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface
/******************************************************************************
* *
+* Paramètres : panel = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_display_panel_dispose(GtkDisplayPanel *panel)
+{
+ if (panel->options != NULL)
+ g_object_unref(G_OBJECT(panel->options));
+
+ G_OBJECT_CLASS(gtk_display_panel_parent_class)->dispose(G_OBJECT(panel));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_display_panel_finalize(GtkDisplayPanel *panel)
+{
+ G_OBJECT_CLASS(gtk_display_panel_parent_class)->finalize(G_OBJECT(panel));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : object = instance de composant GTK à manipuler. *
* prop_id = identifiant de la propriété concernée. *
* value = valeur attribuée. *
@@ -822,7 +873,7 @@ void gtk_display_panel_draw_border(GtkDisplayPanel *panel, cairo_t *cr)
* *
******************************************************************************/
-static void on_view_panel_binary_display_change(GLoadedBinary *binary, BinaryView view, BufferLineColumn col, GtkDisplayPanel *panel)
+static void on_view_panel_binary_option_change(GLoadedBinary *binary, BinaryView view, BufferLineColumn col, GtkDisplayPanel *panel)
{
if (panel->view_index == view)
{
@@ -1011,14 +1062,14 @@ static void gtk_display_panel_set_content(GtkDisplayPanel *panel, GLoadedContent
{
panel->view_index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
- panel->display_options = g_loaded_content_get_all_display_options(content, panel->view_index);
+ panel->options = g_loaded_content_get_display_options(content, panel->view_index);
panel->binary = G_LOADED_BINARY(content);
if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach != NULL) /* REMME */
GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach(panel, panel->binary);
- g_signal_connect(content, "display-changed", G_CALLBACK(on_view_panel_binary_display_change), panel);
+ g_signal_connect(content, "value-changed", G_CALLBACK(on_view_panel_binary_option_change), panel);
}