diff options
Diffstat (limited to 'src/gtkext/gtkdisplaypanel.c')
-rw-r--r-- | src/gtkext/gtkdisplaypanel.c | 95 |
1 files changed, 73 insertions, 22 deletions
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); } |