diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-08-08 21:37:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-08-08 21:37:21 (GMT) |
commit | 4370d2d77d623f560c7df94a3bc15b1395e4878b (patch) | |
tree | 57cc6268f504c19aaac3b1adda4295ed3b1ddc7f /src/gui/panels | |
parent | 34d28c7418342d3c67be4747b13cdcb124edda32 (diff) |
Updated all the code relative to GUI items.
Diffstat (limited to 'src/gui/panels')
-rw-r--r-- | src/gui/panels/bintree.c | 83 | ||||
-rw-r--r-- | src/gui/panels/bintree.h | 2 | ||||
-rw-r--r-- | src/gui/panels/bookmarks.c | 69 | ||||
-rw-r--r-- | src/gui/panels/bookmarks.h | 2 | ||||
-rw-r--r-- | src/gui/panels/errors.c | 74 | ||||
-rw-r--r-- | src/gui/panels/errors.h | 2 | ||||
-rw-r--r-- | src/gui/panels/glance.c | 73 | ||||
-rw-r--r-- | src/gui/panels/glance.h | 3 | ||||
-rw-r--r-- | src/gui/panels/history.c | 85 | ||||
-rw-r--r-- | src/gui/panels/history.h | 2 | ||||
-rw-r--r-- | src/gui/panels/log.c | 51 | ||||
-rw-r--r-- | src/gui/panels/log.h | 2 | ||||
-rw-r--r-- | src/gui/panels/regedit.c | 111 | ||||
-rw-r--r-- | src/gui/panels/regedit.h | 2 | ||||
-rw-r--r-- | src/gui/panels/strings.c | 82 | ||||
-rw-r--r-- | src/gui/panels/strings.h | 2 | ||||
-rw-r--r-- | src/gui/panels/symbols.c | 96 | ||||
-rw-r--r-- | src/gui/panels/symbols.h | 2 | ||||
-rw-r--r-- | src/gui/panels/welcome.c | 59 | ||||
-rw-r--r-- | src/gui/panels/welcome.h | 2 |
20 files changed, 619 insertions, 185 deletions
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c index a949b0d..c05c4d4 100644 --- a/src/gui/panels/bintree.c +++ b/src/gui/panels/bintree.c @@ -39,12 +39,14 @@ #include "../core/global.h" #include "../../core/queue.h" #include "../../gtkext/gtkdisplaypanel.h" +#include "../../gtkext/named.h" #include "../../gtkext/tmgt.h" /* -------------------------- PARTIE PRINCIPALE DU PANNEAU -------------------------- */ + /* Origine de la dernière ouverture/fermeture reproductible */ typedef enum _UserActionType { @@ -113,6 +115,9 @@ static void g_bintree_panel_dispose(GBintreePanel *); /* Procède à la libération totale de la mémoire. */ static void g_bintree_panel_finalize(GBintreePanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_bintree_panel_get_key(const GBintreePanel *); + /* Modifie la profondeur affichée des portions présentes. */ static void on_depth_spin_value_changed(GtkSpinButton *, const GBintreePanel *); @@ -222,7 +227,7 @@ G_DEFINE_TYPE_WITH_CODE(GBintreePanel, g_bintree_panel, G_TYPE_PANEL_ITEM, static void g_bintree_panel_class_init(GBintreePanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); @@ -230,9 +235,11 @@ static void g_bintree_panel_class_init(GBintreePanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_bintree_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_bintree_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_bintree_panel_get_key; - editem->change_content = (change_item_content_fc)change_bintree_panel_current_content; + item->change_content = (change_item_content_fc)change_bintree_panel_current_content; panel = G_PANEL_ITEM_CLASS(klass); @@ -255,7 +262,6 @@ static void g_bintree_panel_class_init(GBintreePanelClass *klass) static void g_bintree_panel_init(GBintreePanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeView *treeview; /* Affichage de la liste */ @@ -264,14 +270,14 @@ static void g_bintree_panel_init(GBintreePanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_BINTREE_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Binary tree"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Binary tree"), + _("Tree of the binary layout"), + PANEL_BINTREE_ID)); + pitem->dock_at_startup = true; pitem->path = strdup("MEN"); @@ -283,7 +289,7 @@ static void g_bintree_panel_init(GBintreePanel *panel) /* Représentation graphique */ - builder = g_panel_item_build(pitem, "bintree"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); /* Liste des portions binaires */ @@ -336,6 +342,8 @@ static void g_bintree_panel_init(GBintreePanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -429,6 +437,29 @@ GPanelItem *g_bintree_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_bintree_panel_get_key(const GBintreePanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_BINTREE_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : button = bouton de réglage de l'affichage. * * treeview = arborescence dont l'affichage est à moduler. * * * @@ -462,7 +493,7 @@ static void on_depth_spin_value_changed(GtkSpinButton *button, const GBintreePan } - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -472,6 +503,8 @@ static void on_depth_spin_value_changed(GtkSpinButton *button, const GBintreePan gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc)apply_max_depth, NULL); + g_object_unref(G_OBJECT(builder)); + } @@ -557,12 +590,14 @@ static void change_bintree_panel_current_content(GBintreePanel *panel, GLoadedCo /* Réinitialisation */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); gtk_tree_store_clear(store); + g_object_unref(G_OBJECT(builder)); + /* Si le panneau actif représente un binaire, actualisation de l'affichage */ if (binary != NULL) @@ -612,7 +647,7 @@ static bool populate_tree_with_portion(GBinPortion *portion, GBinPortion *parent { icon = NULL; - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -634,6 +669,8 @@ static bool populate_tree_with_portion(GBinPortion *portion, GBinPortion *parent update_bintree_node(data, store, &iter, portion); + g_object_unref(G_OBJECT(builder)); + gtk_status_stack_update_activity_value(data->status, data->id, 1); } @@ -693,7 +730,7 @@ static void reload_portions_for_new_tree_view(const GBintreePanel *panel, GtkSta GtkSpinButton *depth_spin; /* Bouton de variation */ GtkTreeView *treeview; /* Arborescence constituée */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -772,6 +809,8 @@ static void reload_portions_for_new_tree_view(const GBintreePanel *panel, GtkSta } + g_object_unref(G_OBJECT(builder)); + } @@ -984,12 +1023,14 @@ static void do_filtering_on_portions(const GBintreePanel *panel, GtkStatusStack } - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc)filter_portion_panel_iter, NULL); + g_object_unref(G_OBJECT(builder)); + } @@ -1132,7 +1173,7 @@ static const char *g_bintree_panel_setup(const GBintreePanel *panel, unsigned in /* Mémorisation de tous les noeuds ouverts */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1156,6 +1197,8 @@ static const char *g_bintree_panel_setup(const GBintreePanel *panel, unsigned in gtk_tree_view_map_expanded_rows(treeview, (GtkTreeViewMappingFunc)keep_track_of_expanded, *data); + g_object_unref(G_OBJECT(builder)); + return result; } @@ -1185,7 +1228,7 @@ static void g_bintree_panel_introduce(const GBintreePanel *panel, unsigned int u g_panel_item_switch_to_updating_mask(G_PANEL_ITEM(panel)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1197,6 +1240,8 @@ static void g_bintree_panel_introduce(const GBintreePanel *panel, unsigned int u gtk_tree_view_set_model(treeview, NULL); } + g_object_unref(G_OBJECT(builder)); + } @@ -1264,7 +1309,7 @@ static void g_bintree_panel_conclude(GBintreePanel *panel, unsigned int uid, bin /* Basculement de l'affichage en ligne */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1283,6 +1328,8 @@ static void g_bintree_panel_conclude(GBintreePanel *panel, unsigned int uid, bin } + g_object_unref(G_OBJECT(builder)); + skip_this_step: g_panel_item_switch_to_updated_content(G_PANEL_ITEM(panel)); diff --git a/src/gui/panels/bintree.h b/src/gui/panels/bintree.h index 2f0c27d..e36b0c0 100644 --- a/src/gui/panels/bintree.h +++ b/src/gui/panels/bintree.h @@ -33,7 +33,7 @@ -#define PANEL_BINTREE_ID _("Bintree") +#define PANEL_BINTREE_ID "bintree" #define G_TYPE_BINTREE_PANEL g_bintree_panel_get_type() diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c index 8b029d0..fe69f35 100644 --- a/src/gui/panels/bookmarks.c +++ b/src/gui/panels/bookmarks.c @@ -48,6 +48,7 @@ #include "../../gtkext/easygtk.h" #include "../../gtkext/gtkdisplaypanel.h" #include "../../gtkext/gtkdockable-int.h" +#include "../../gtkext/named.h" @@ -106,6 +107,9 @@ static void g_bookmarks_panel_dispose(GBookmarksPanel *); /* Procède à la libération totale de la mémoire. */ static void g_bookmarks_panel_finalize(GBookmarksPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_bookmarks_panel_get_key(const GBookmarksPanel *); + /* Réagit à un changement d'affichage principal de contenu. */ static void change_bookmarks_panel_current_content(GBookmarksPanel *, GLoadedContent *, GLoadedContent *); @@ -199,7 +203,7 @@ G_DEFINE_TYPE(GBookmarksPanel, g_bookmarks_panel, G_TYPE_PANEL_ITEM); static void g_bookmarks_panel_class_init(GBookmarksPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ gchar *filename; /* Chemin d'accès à utiliser */ @@ -208,9 +212,11 @@ static void g_bookmarks_panel_class_init(GBookmarksPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_bookmarks_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_bookmarks_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_bookmarks_panel_get_key; - editem->change_content = (change_item_content_fc)change_bookmarks_panel_current_content; + item->change_content = (change_item_content_fc)change_bookmarks_panel_current_content; panel = G_PANEL_ITEM_CLASS(klass); @@ -244,27 +250,26 @@ static void g_bookmarks_panel_class_init(GBookmarksPanelClass *klass) static void g_bookmarks_panel_init(GBookmarksPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeSortable *sortable; /* Autre vision de la liste */ /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_BOOKMARKS_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Bookmarks"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Bookmarks"), + _("Bookmarks for the current binary"), + PANEL_BOOKMARKS_ID)); + pitem->dock_at_startup = false; pitem->path = strdup("Ms"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "bookmarks"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); /* Tri de la liste */ @@ -295,6 +300,8 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -371,6 +378,29 @@ GPanelItem *g_bookmarks_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_bookmarks_panel_get_key(const GBookmarksPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_BOOKMARKS_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = panneau à mettre à jour. * * old = ancien contenu chargé analysé. * * new = nouveau contenu chargé à analyser. * @@ -455,7 +485,7 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary } - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -505,6 +535,8 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary g_db_collection_runlock(collec); + g_object_unref(G_OBJECT(builder)); + } @@ -541,7 +573,7 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action GDbBookmark *displayed; /* Elément de collection */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -596,6 +628,7 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action } + g_object_unref(G_OBJECT(builder)); } @@ -662,7 +695,7 @@ static void on_config_param_modified(GCfgParam *param, GBookmarksPanel *panel) gboolean looping; /* Autorisation de bouclage */ GCfgParam *item; /* Elément de la liste */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); model = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store")); @@ -680,6 +713,8 @@ static void on_config_param_modified(GCfgParam *param, GBookmarksPanel *panel) } + g_object_unref(G_OBJECT(builder)); + } @@ -1139,7 +1174,7 @@ static void mcb_bookmarks_panel_edit(GtkMenuItem *menuitem, GBookmarksPanel *pan GtkTreeModel *model; /* Gestionnaire de données */ GtkTreePath *path; /* Chemin d'accès à ce point */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1157,6 +1192,8 @@ static void mcb_bookmarks_panel_edit(GtkMenuItem *menuitem, GBookmarksPanel *pan g_object_unref(G_OBJECT(mark)); + g_object_unref(G_OBJECT(builder)); + } @@ -1179,7 +1216,7 @@ static void mcb_bookmarks_panel_delete(GtkMenuItem *menuitem, GBookmarksPanel *p GtkTreeView *treeview; /* Affichage de la liste */ GDbBookmark *mark; /* Signet sélectionné */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1190,6 +1227,8 @@ static void mcb_bookmarks_panel_delete(GtkMenuItem *menuitem, GBookmarksPanel *p g_object_unref(G_OBJECT(mark)); + g_object_unref(G_OBJECT(builder)); + } diff --git a/src/gui/panels/bookmarks.h b/src/gui/panels/bookmarks.h index f5730d8..fa3e073 100644 --- a/src/gui/panels/bookmarks.h +++ b/src/gui/panels/bookmarks.h @@ -33,7 +33,7 @@ -#define PANEL_BOOKMARKS_ID _("Bookmarks") +#define PANEL_BOOKMARKS_ID "bookmarks" #define G_TYPE_BOOKMARKS_PANEL g_bookmarks_panel_get_type() diff --git a/src/gui/panels/errors.c b/src/gui/panels/errors.c index b2300eb..17eabef 100644 --- a/src/gui/panels/errors.c +++ b/src/gui/panels/errors.c @@ -42,6 +42,7 @@ #include "../../format/format.h" #include "../../glibext/signal.h" #include "../../gtkext/gtkdisplaypanel.h" +#include "../../gtkext/named.h" @@ -134,6 +135,9 @@ static void g_error_panel_dispose(GErrorPanel *); /* Procède à la libération totale de la mémoire. */ static void g_error_panel_finalize(GErrorPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_error_panel_get_key(const GErrorPanel *); + /* Organise le tri des erreurs présentées. */ static gint sort_errors_in_panel(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gpointer); @@ -208,7 +212,7 @@ G_DEFINE_TYPE_WITH_CODE(GErrorPanel, g_error_panel, G_TYPE_PANEL_ITEM, static void g_error_panel_class_init(GErrorPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ gchar *filename; /* Chemin d'accès à utiliser */ GPanelItemClass *panel; /* Version parente de la classe*/ @@ -217,9 +221,11 @@ static void g_error_panel_class_init(GErrorPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_error_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_error_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_error_panel_get_key; - editem->change_content = (change_item_content_fc)change_error_panel_current_content; + item->change_content = (change_item_content_fc)change_error_panel_current_content; filename = find_pixmap_file("error_file.png"); assert(filename != NULL); @@ -261,7 +267,6 @@ static void g_error_panel_class_init(GErrorPanelClass *klass) static void g_error_panel_init(GErrorPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeSortable *store; /* Gestionnaire des données */ @@ -272,14 +277,14 @@ static void g_error_panel_init(GErrorPanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_ERRORS_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Disassembling errors"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Errors"), + _("Disassembling errors"), + PANEL_ERRORS_ID)); + pitem->dock_at_startup = true; pitem->path = strdup("Ms"); @@ -289,7 +294,7 @@ static void g_error_panel_init(GErrorPanel *panel) /* Représentation graphique */ - builder = g_panel_item_build(pitem, "errors"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); store = GTK_TREE_SORTABLE(gtk_builder_get_object(builder, "store")); gtk_tree_sortable_set_sort_func(store, ETC_ADDR, sort_errors_in_panel, NULL, NULL); @@ -340,6 +345,8 @@ static void g_error_panel_init(GErrorPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -432,6 +439,29 @@ GPanelItem *g_error_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_error_panel_get_key(const GErrorPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_ERRORS_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : model = gestionnaire de données. * * a = premier élément à traiter. * * b = second élément à traiter. * @@ -499,12 +529,14 @@ static void change_error_panel_current_content(GErrorPanel *panel, GLoadedConten if (panel->binary != NULL) g_object_ref(G_OBJECT(panel->binary)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); gtk_list_store_clear(store); + g_object_unref(G_OBJECT(builder)); + /* Actualisation de l'affichage */ panel->count = 0; @@ -550,7 +582,7 @@ static void update_error_panel(const GErrorPanel *panel, GtkStatusStack *status, bool ret; /* Bilan d'une récupération */ #endif - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -772,6 +804,8 @@ static void update_error_panel(const GErrorPanel *panel, GtkStatusStack *status, } + g_object_unref(G_OBJECT(builder)); + } @@ -824,7 +858,7 @@ static void filter_error_panel(const GErrorPanel *panel, GtkStatusStack *status, guint errno; /* Code d'erreur associé */ gboolean state; /* Bilan d'un filtrage */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store")); @@ -890,6 +924,8 @@ static void filter_error_panel(const GErrorPanel *panel, GtkStatusStack *status, } + g_object_unref(G_OBJECT(builder)); + } @@ -911,7 +947,7 @@ static void update_error_panel_summary(const GErrorPanel *panel) GtkLabel *summary; /* Etiquette à mettre à jour */ char *msg; /* Bilan à faire afficher */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); summary = GTK_LABEL(gtk_builder_get_object(builder, "summary")); @@ -929,6 +965,8 @@ static void update_error_panel_summary(const GErrorPanel *panel) } + g_object_unref(G_OBJECT(builder)); + } @@ -1081,7 +1119,7 @@ static void g_error_panel_introduce(const GErrorPanel *panel, unsigned int uid, g_panel_item_switch_to_updating_mask(G_PANEL_ITEM(panel)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1093,6 +1131,8 @@ static void g_error_panel_introduce(const GErrorPanel *panel, unsigned int uid, gtk_tree_view_set_model(treeview, NULL); } + g_object_unref(G_OBJECT(builder)); + } @@ -1163,7 +1203,7 @@ static void g_error_panel_conclude(GErrorPanel *panel, unsigned int uid, error_u /* Basculement de l'affichage en ligne */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1184,6 +1224,8 @@ static void g_error_panel_conclude(GErrorPanel *panel, unsigned int uid, error_u g_object_ref(G_OBJECT(model)); gtk_tree_view_set_model(treeview, model); + g_object_unref(G_OBJECT(builder)); + skip_this_step: g_panel_item_switch_to_updated_content(G_PANEL_ITEM(panel)); diff --git a/src/gui/panels/errors.h b/src/gui/panels/errors.h index d5b19b5..1aabd08 100644 --- a/src/gui/panels/errors.h +++ b/src/gui/panels/errors.h @@ -33,7 +33,7 @@ -#define PANEL_ERRORS_ID _("Errors") +#define PANEL_ERRORS_ID "errors" #define G_TYPE_ERROR_PANEL g_error_panel_get_type() diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c index fa99ceb..c7478b5 100644 --- a/src/gui/panels/glance.c +++ b/src/gui/panels/glance.c @@ -30,6 +30,7 @@ #include "../panel-int.h" +#include "../../gtkext/named.h" @@ -86,6 +87,9 @@ static void g_glance_panel_dispose(GGlancePanel *); /* Procède à la libération totale de la mémoire. */ static void g_glance_panel_finalize(GGlancePanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_glance_panel_get_key(const GGlancePanel *); + /* Lance une actualisation du fait d'un changement de support. */ static void change_glance_panel_current_view(GGlancePanel *, GLoadedPanel *, GLoadedPanel *); @@ -137,7 +141,7 @@ G_DEFINE_TYPE(GGlancePanel, g_glance_panel, G_TYPE_PANEL_ITEM); static void g_glance_panel_class_init(GGlancePanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ GtkIconTheme *theme; /* Thème GTK offrant des icones*/ object = G_OBJECT_CLASS(klass); @@ -145,10 +149,12 @@ static void g_glance_panel_class_init(GGlancePanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_glance_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_glance_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_glance_panel_get_key; - editem->change_view = (change_item_view_fc)change_glance_panel_current_view; - editem->update_view = (update_item_view_fc)update_glance_panel_view; + item->change_view = (change_item_view_fc)change_glance_panel_current_view; + item->update_view = (update_item_view_fc)update_glance_panel_view; theme = gtk_icon_theme_get_default(); @@ -173,26 +179,25 @@ static void g_glance_panel_class_init(GGlancePanelClass *klass) static void g_glance_panel_init(GGlancePanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_GLANCE_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Glance"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Glance"), + _("Glimpse of the display content"), + PANEL_GLANCE_ID)); + pitem->dock_at_startup = true; pitem->path = strdup("MEs"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "glance"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); /* Connexion des signaux */ @@ -206,6 +211,8 @@ static void g_glance_panel_init(GGlancePanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -275,6 +282,29 @@ GPanelItem *g_glance_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_glance_panel_get_key(const GGlancePanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_GLANCE_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = panneau à actualiser. * * old = ancienne vue du contenu chargé analysé. * * new = nouvelle vue du contenu chargé analysé. * @@ -411,6 +441,7 @@ static void on_view_scrolled(GtkAdjustment *adj, GGlancePanel *panel) { GtkAdjustment *hadj; /* Gestionnaire du défilement */ GtkAdjustment *vadj; /* Gestionnaire du défilement */ + GtkWidget *widget; /* Surface de dessin pour GTK */ hadj = gtk_scrolled_window_get_hadjustment(panel->support); vadj = gtk_scrolled_window_get_vadjustment(panel->support); @@ -423,7 +454,11 @@ static void on_view_scrolled(GtkAdjustment *adj, GGlancePanel *panel) panel->visible.width = gtk_adjustment_get_page_size(hadj) * panel->scale; panel->visible.height = gtk_adjustment_get_page_size(vadj) * panel->scale; - gtk_widget_queue_draw(G_EDITOR_ITEM(panel)->widget); + widget = g_named_widget_get_widget(G_PANEL_ITEM(panel)->widget); + + gtk_widget_queue_draw(widget); + + g_object_unref(G_OBJECT(widget)); } @@ -467,6 +502,7 @@ static void on_glance_resize(GtkWidget *widget, GdkRectangle *allocation, GGlanc static void compute_glance_scale(GGlancePanel *panel) { + GtkWidget *widget; /* Surface de dessin pour GTK */ GtkAllocation available; /* Surface disponible totale */ GtkAllocation granted; /* Surface totale accordée */ double sx; /* Echelle sur l'axe X */ @@ -474,7 +510,11 @@ static void compute_glance_scale(GGlancePanel *panel) /* Superficies niveau GTK... */ - gtk_widget_get_allocation(G_EDITOR_ITEM(panel)->widget, &available); + widget = g_named_widget_get_widget(G_PANEL_ITEM(panel)->widget); + + gtk_widget_get_allocation(widget, &available); + + g_object_unref(G_OBJECT(widget)); /* Calcul des ratios et emplacements */ @@ -544,6 +584,7 @@ static void update_glance_panel_view(GGlancePanel *panel, GLoadedPanel *view) { cairo_t *cairo; /* Assistant pour le dessin */ GtkAllocation area; /* Dimension de la surface */ + GtkWidget *widget; /* Surface de dessin pour GTK */ /* Mise en place d'un cache adapté */ @@ -567,7 +608,11 @@ static void update_glance_panel_view(GGlancePanel *panel, GLoadedPanel *view) cairo_destroy(cairo); - gtk_widget_queue_draw(G_EDITOR_ITEM(panel)->widget); + widget = g_named_widget_get_widget(G_PANEL_ITEM(panel)->widget); + + gtk_widget_queue_draw(widget); + + g_object_unref(G_OBJECT(widget)); } diff --git a/src/gui/panels/glance.h b/src/gui/panels/glance.h index 683b745..052d190 100644 --- a/src/gui/panels/glance.h +++ b/src/gui/panels/glance.h @@ -33,8 +33,7 @@ -#define PANEL_GLANCE_ID _("Glance") - +#define PANEL_GLANCE_ID "glance" #define G_TYPE_GLANCE_PANEL g_glance_panel_get_type() diff --git a/src/gui/panels/history.c b/src/gui/panels/history.c index e0744c6..e1ac123 100644 --- a/src/gui/panels/history.c +++ b/src/gui/panels/history.c @@ -36,6 +36,7 @@ #include "../../analysis/binary.h" #include "../../glibext/chrysamarshal.h" #include "../../glibext/signal.h" +#include "../../gtkext/named.h" @@ -82,6 +83,9 @@ static void g_history_panel_dispose(GHistoryPanel *); /* Procède à la libération totale de la mémoire. */ static void g_history_panel_finalize(GHistoryPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_history_panel_get_key(const GHistoryPanel *); + /* Réagit à un changement d'affichage principal de contenu. */ static void change_history_panel_current_content(GHistoryPanel *, GLoadedContent *, GLoadedContent *); @@ -124,16 +128,18 @@ G_DEFINE_TYPE(GHistoryPanel, g_history_panel, G_TYPE_PANEL_ITEM); static void g_history_panel_class_init(GHistoryPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_history_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_history_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_history_panel_get_key; - editem->change_content = (change_item_content_fc)change_history_panel_current_content; + item->change_content = (change_item_content_fc)change_history_panel_current_content; } @@ -152,27 +158,26 @@ static void g_history_panel_class_init(GHistoryPanelClass *klass) static void g_history_panel_init(GHistoryPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkListStore *store; /* Modèle de gestion */ /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_HISTORY_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Change history"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("History"), + _("Change history"), + PANEL_HISTORY_ID)); + pitem->dock_at_startup = true; pitem->path = strdup("MEN"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "history"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -189,6 +194,8 @@ static void g_history_panel_init(GHistoryPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -257,6 +264,29 @@ GPanelItem *g_history_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_history_panel_get_key(const GHistoryPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_HISTORY_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = panneau à mettre à jour. * * old = ancien contenu chargé analysé. * * new = nouveau contenu chargé à analyser. * @@ -312,12 +342,14 @@ static void change_history_panel_current_content(GHistoryPanel *panel, GLoadedCo if (panel->binary != NULL) g_object_ref(G_OBJECT(binary)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); gtk_list_store_clear(store); + g_object_unref(G_OBJECT(builder)); + /* Si le panneau actif ne représente pas un binaire... */ if (binary == NULL) return; @@ -393,7 +425,7 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * char *label; /* Etiquette de représentation */ GtkTreeIter iter; /* Boucle de parcours */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -503,6 +535,8 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * on_history_selection_change(selection, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -561,7 +595,7 @@ static void on_history_selection_change(GtkTreeSelection *selection, GHistoryPan GDbItem *item; /* Elément de collection */ GtkWidget *button; /* Bouton de barre de contrôle */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -587,6 +621,8 @@ static void on_history_selection_change(GtkTreeSelection *selection, GHistoryPan } + g_object_unref(G_OBJECT(builder)); + } @@ -613,7 +649,7 @@ static void do_history_undo(GtkButton *button, GHistoryPanel *panel) GDbItem *item; /* Elément de collection */ GHubClient *client; /* Connexion vers la base */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -621,19 +657,22 @@ static void do_history_undo(GtkButton *button, GHistoryPanel *panel) if (gtk_tree_selection_get_selected(selection, &model, &iter)) { - if (!gtk_tree_model_iter_previous(model, &iter)) - return; + if (gtk_tree_model_iter_previous(model, &iter)) + { + gtk_tree_model_get(model, &iter, HTC_ITEM, &item, -1); - gtk_tree_model_get(model, &iter, HTC_ITEM, &item, -1); + client = g_loaded_binary_get_client(panel->binary, true); + g_hub_client_set_last_active(client, g_db_item_get_timestamp(item)); + g_object_unref(G_OBJECT(client)); - client = g_loaded_binary_get_client(panel->binary, true); - g_hub_client_set_last_active(client, g_db_item_get_timestamp(item)); - g_object_unref(G_OBJECT(client)); + g_object_unref(G_OBJECT(item)); - g_object_unref(G_OBJECT(item)); + } } + g_object_unref(G_OBJECT(builder)); + } @@ -660,7 +699,7 @@ static void do_history_redo(GtkButton *button, GHistoryPanel *panel) GDbItem *item; /* Elément de collection */ GHubClient *client; /* Connexion vers la base */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -678,6 +717,8 @@ static void do_history_redo(GtkButton *button, GHistoryPanel *panel) } + g_object_unref(G_OBJECT(builder)); + } diff --git a/src/gui/panels/history.h b/src/gui/panels/history.h index 87268eb..430d47d 100644 --- a/src/gui/panels/history.h +++ b/src/gui/panels/history.h @@ -33,7 +33,7 @@ -#define PANEL_HISTORY_ID _("History") +#define PANEL_HISTORY_ID "history" #define G_TYPE_HISTORY_PANEL g_history_panel_get_type() diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c index cf79f70..43021cf 100644 --- a/src/gui/panels/log.c +++ b/src/gui/panels/log.c @@ -35,6 +35,7 @@ #include "../panel-int.h" #include "../core/panels.h" #include "../../gtkext/easygtk.h" +#include "../../gtkext/named.h" @@ -87,6 +88,9 @@ static void g_log_panel_dispose(GLogPanel *); /* Procède à la libération totale de la mémoire. */ static void g_log_panel_finalize(GLogPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_log_panel_get_key(const GLogPanel *); + /* Affiche un message dans le journal des messages système. */ static gboolean log_message(log_data *); @@ -111,6 +115,7 @@ G_DEFINE_TYPE(GLogPanel, g_log_panel, G_TYPE_PANEL_ITEM); static void g_log_panel_class_init(GLogPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); @@ -118,6 +123,10 @@ static void g_log_panel_class_init(GLogPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_log_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_log_panel_finalize; + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_log_panel_get_key; + panel = G_PANEL_ITEM_CLASS(klass); panel->unique = true; @@ -140,25 +149,20 @@ static void g_log_panel_class_init(GLogPanelClass *klass) static void g_log_panel_init(GLogPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_LOG_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Misc information"); - pitem->dock_at_startup = true; - pitem->path = strdup("Ms"); - /* Représentation graphique */ + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Messages"), + _("Misc information"), + PANEL_LOG_ID)); - g_panel_item_build(pitem, "log"); + pitem->dock_at_startup = true; + pitem->path = strdup("Ms"); } @@ -226,6 +230,29 @@ GPanelItem *g_log_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_log_panel_get_key(const GLogPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_LOG_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = instance d'objet GLib à traiter. * * type = espèce du message à ajouter. * * msg = message à faire apparaître à l'écran. * @@ -275,7 +302,7 @@ static gboolean log_message(log_data *data) GtkTreeIter iter; /* Point d'insertion */ GtkTreeView *treeview; /* Affichage de la liste */ - builder = G_PANEL_ITEM(data->item)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(data->item)->widget)); /* Mise en place du message */ @@ -335,6 +362,8 @@ static gboolean log_message(log_data *data) scroll_to_treeview_iter(treeview, GTK_TREE_MODEL(store), &iter); + g_object_unref(G_OBJECT(builder)); + /* Nettoyage de la mémoire */ g_object_unref(G_OBJECT(data->item)); diff --git a/src/gui/panels/log.h b/src/gui/panels/log.h index 1106aae..4d155a2 100644 --- a/src/gui/panels/log.h +++ b/src/gui/panels/log.h @@ -34,7 +34,7 @@ -#define PANEL_LOG_ID _("Messages") +#define PANEL_LOG_ID "log" #define G_TYPE_LOG_PANEL g_log_panel_get_type() diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c index 23543b5..ea324cb 100644 --- a/src/gui/panels/regedit.c +++ b/src/gui/panels/regedit.c @@ -41,6 +41,7 @@ #include "../../common/cpp.h" #include "../../common/extstr.h" #include "../../gtkext/easygtk.h" +#include "../../gtkext/named.h" @@ -96,6 +97,9 @@ static void g_regedit_panel_dispose(GRegeditPanel *); /* Procède à la libération totale de la mémoire. */ static void g_regedit_panel_finalize(GRegeditPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_regedit_panel_get_key(const GRegeditPanel *); + /* ------------------------- AFFICHAGE A L'AIDE D'UNE LISTE ------------------------- */ @@ -179,12 +183,16 @@ G_DEFINE_TYPE(GRegeditPanel, g_regedit_panel, G_TYPE_PANEL_ITEM); static void g_regedit_panel_class_init(GRegeditPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GEditorItemClass *item; /* Encore une autre vision... */ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_regedit_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_regedit_panel_finalize; + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_regedit_panel_get_key; } @@ -203,7 +211,6 @@ static void g_regedit_panel_class_init(GRegeditPanelClass *klass) static void g_regedit_panel_init(GRegeditPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GObject *vrenderer; /* Moteur de rendu de colonne */ @@ -211,20 +218,20 @@ static void g_regedit_panel_init(GRegeditPanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_REGEDIT_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Configuration parameters"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Configuration"), + _("Configuration parameters"), + PANEL_REGEDIT_ID)); + pitem->dock_at_startup = false; pitem->path = strdup("M"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "regedit"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); vrenderer = G_OBJECT(gtk_builder_get_object(builder, "vrenderer")); @@ -264,6 +271,8 @@ static void g_regedit_panel_init(GRegeditPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -336,6 +345,29 @@ GPanelItem *g_regedit_panel_new(void) } +/****************************************************************************** +* * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_regedit_panel_get_key(const GRegeditPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_REGEDIT_ID); + + return result; + +} + + /* ---------------------------------------------------------------------------------- */ /* AFFICHAGE A L'AIDE D'UNE LISTE */ @@ -365,7 +397,7 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config char *type_desc; /* Type de paramètre */ GtkTreeIter iter; /* Point d'insertion */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -425,6 +457,8 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config g_generic_config_runlock(config); + g_object_unref(G_OBJECT(builder)); + } @@ -450,7 +484,7 @@ static void on_config_param_modified(GCfgParam *param, GRegeditPanel *panel) gboolean looping; /* Autorisation de bouclage */ GCfgParam *item; /* Elément de la liste */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -470,6 +504,8 @@ static void on_config_param_modified(GCfgParam *param, GRegeditPanel *panel) } + g_object_unref(G_OBJECT(builder)); + } @@ -685,12 +721,12 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc int ulong; /* Valeur entière positive */ char *end; /* Pointeur vers '\0' final ? */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); tree_path = gtk_tree_path_new_from_string(path); - if (tree_path == NULL) return; + if (tree_path == NULL) goto bad_path; if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, tree_path)) goto opve_bad_iter; @@ -749,6 +785,10 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc gtk_tree_path_free(tree_path); + bad_path: + + g_object_unref(G_OBJECT(builder)); + } @@ -965,23 +1005,28 @@ static void mcb_param_panel_copy(GtkMenuItem *menuitem, GRegeditPanel *panel) gint clen; /* Taille de ce contenu */ GtkClipboard *clipboard; /* Presse-papiers à remplir */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); param = get_selected_panel_param(treeview, NULL); - if (param == NULL) return; - content = g_config_param_get_path(param); - clen = g_utf8_strlen(content, -1); + if (param == NULL) + { + content = g_config_param_get_path(param); + clen = g_utf8_strlen(content, -1); - clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_text(clipboard, content, clen); + clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + gtk_clipboard_set_text(clipboard, content, clen); - clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); - gtk_clipboard_set_text(clipboard, content, clen); + clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, content, clen); - g_object_unref(G_OBJECT(param)); + g_object_unref(G_OBJECT(param)); + + } + + g_object_unref(G_OBJECT(builder)); } @@ -1005,16 +1050,21 @@ static void mcb_param_panel_empty(GtkMenuItem *menuitem, GRegeditPanel *panel) GtkTreeView *treeview; /* Affichage de la liste */ GCfgParam *param; /* Paramètre sélectionné */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); param = get_selected_panel_param(treeview, NULL); - if (param == NULL) return; - g_config_param_make_empty(param); + if (param == NULL) + { + g_config_param_make_empty(param); - g_object_unref(G_OBJECT(param)); + g_object_unref(G_OBJECT(param)); + + } + + g_object_unref(G_OBJECT(builder)); } @@ -1038,15 +1088,20 @@ static void mcb_param_panel_reset(GtkMenuItem *menuitem, GRegeditPanel *panel) GtkTreeView *treeview; /* Affichage de la liste */ GCfgParam *param; /* Paramètre sélectionné */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); param = get_selected_panel_param(treeview, NULL); - if (param == NULL) return; - g_config_param_reset(param); + if (param == NULL) + { + g_config_param_reset(param); - g_object_unref(G_OBJECT(param)); + g_object_unref(G_OBJECT(param)); + + } + + g_object_unref(G_OBJECT(builder)); } diff --git a/src/gui/panels/regedit.h b/src/gui/panels/regedit.h index 7a87c7c..b562cc7 100644 --- a/src/gui/panels/regedit.h +++ b/src/gui/panels/regedit.h @@ -33,7 +33,7 @@ -#define PANEL_REGEDIT_ID _("Configuration") +#define PANEL_REGEDIT_ID "regedit" #define G_TYPE_REGEDIT_PANEL g_regedit_panel_get_type() diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index 2eee482..aee5231 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -45,6 +45,7 @@ #include "../../gtkext/easygtk.h" #include "../../gtkext/gtkdisplaypanel.h" #include "../../gtkext/gtkdockable-int.h" +#include "../../gtkext/named.h" #include "../../gtkext/tmgt.h" @@ -111,6 +112,9 @@ static void g_strings_panel_dispose(GStringsPanel *); /* Procède à la libération totale de la mémoire. */ static void g_strings_panel_finalize(GStringsPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_strings_panel_get_key(const GStringsPanel *); + /* Réagit au changement de sélection des chaînes textuelles. */ static void on_strings_selection_change(GtkTreeSelection *, gpointer); @@ -242,7 +246,7 @@ G_DEFINE_TYPE_WITH_CODE(GStringsPanel, g_strings_panel, G_TYPE_PANEL_ITEM, static void g_strings_panel_class_init(GStringsPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); @@ -250,9 +254,11 @@ static void g_strings_panel_class_init(GStringsPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_strings_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_strings_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_strings_panel_get_key; - editem->change_content = (change_item_content_fc)change_strings_panel_current_content; + item->change_content = (change_item_content_fc)change_strings_panel_current_content; panel = G_PANEL_ITEM_CLASS(klass); @@ -282,7 +288,6 @@ static void g_strings_panel_class_init(GStringsPanelClass *klass) static void g_strings_panel_init(GStringsPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeModelFilter *filter; /* Filtre pour l'arborescence */ @@ -294,20 +299,20 @@ static void g_strings_panel_init(GStringsPanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_STRINGS_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Strings"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Strings"), + _("Strings contained in the binary"), + PANEL_STRINGS_ID)); + pitem->dock_at_startup = false; pitem->path = strdup("Ms"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "strings"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); filter = GTK_TREE_MODEL_FILTER(gtk_builder_get_object(builder, "filter")); gtk_tree_model_filter_set_visible_column(filter, STC_MATCHED); @@ -387,6 +392,8 @@ static void g_strings_panel_init(GStringsPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + /* Préparation du menu contextuel */ panel->menu = build_strings_panel_menu(panel); @@ -484,6 +491,29 @@ GPanelItem *g_strings_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_strings_panel_get_key(const GStringsPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_STRINGS_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : selection = sélection modifiée. * * unused = adresse non utilisée ici. * * * @@ -681,12 +711,14 @@ static void change_strings_panel_current_content(GStringsPanel *panel, GLoadedCo /* Réinitialisation */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); gtk_list_store_clear(store); + g_object_unref(G_OBJECT(builder)); + /* Si le panneau actif représente un binaire, actualisation de l'affichage */ if (binary != NULL) @@ -750,7 +782,7 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat char *real_text; /* Texte avec octet nul final */ GtkTreeIter iter; /* Point d'insertion */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -821,6 +853,8 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); + g_object_unref(G_OBJECT(builder)); + } @@ -1002,12 +1036,14 @@ static void do_filtering_on_strings(const GStringsPanel *panel, GtkStatusStack * } - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc)filter_string_panel_iter, NULL); + g_object_unref(G_OBJECT(builder)); + } @@ -1146,7 +1182,7 @@ static GBinSymbol *get_selected_panel_symbol(GStringsPanel *panel, GtkTreeIter * result = NULL; - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1158,6 +1194,8 @@ static GBinSymbol *get_selected_panel_symbol(GStringsPanel *panel, GtkTreeIter * if (save != NULL) *save = iter; + g_object_unref(G_OBJECT(builder)); + return result; } @@ -1188,7 +1226,7 @@ static void mcb_strings_panel_edit(GtkMenuItem *menuitem, GStringsPanel *panel) symbol = get_selected_panel_symbol(panel, &iter); if (symbol == NULL) return; - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1201,6 +1239,8 @@ static void mcb_strings_panel_edit(GtkMenuItem *menuitem, GStringsPanel *panel) gtk_tree_path_free(path); + g_object_unref(G_OBJECT(builder)); + g_object_unref(G_OBJECT(symbol)); } @@ -1229,7 +1269,7 @@ static void mcb_strings_panel_copy(GtkMenuItem *menuitem, GStringsPanel *panel) gchar *string; /* Chaîne sélectionnée */ GtkClipboard *clipboard; /* Presse-papiers d'arrivée */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1251,6 +1291,8 @@ static void mcb_strings_panel_copy(GtkMenuItem *menuitem, GStringsPanel *panel) } + g_object_unref(G_OBJECT(builder)); + } @@ -1535,7 +1577,7 @@ static void g_strings_panel_introduce(const GStringsPanel *panel, unsigned int u g_panel_item_switch_to_updating_mask(G_PANEL_ITEM(panel)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1547,6 +1589,8 @@ static void g_strings_panel_introduce(const GStringsPanel *panel, unsigned int u gtk_tree_view_set_model(treeview, NULL); } + g_object_unref(G_OBJECT(builder)); + } @@ -1612,7 +1656,7 @@ static void g_strings_panel_conclude(GStringsPanel *panel, unsigned int uid, str /* Basculement de l'affichage en ligne */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1621,6 +1665,8 @@ static void g_strings_panel_conclude(GStringsPanel *panel, unsigned int uid, str g_object_ref(G_OBJECT(model)); gtk_tree_view_set_model(treeview, model); + g_object_unref(G_OBJECT(builder)); + skip_this_step: g_panel_item_switch_to_updated_content(G_PANEL_ITEM(panel)); diff --git a/src/gui/panels/strings.h b/src/gui/panels/strings.h index b856dc2..3dec55e 100644 --- a/src/gui/panels/strings.h +++ b/src/gui/panels/strings.h @@ -33,7 +33,7 @@ -#define PANEL_STRINGS_ID _("Strings") +#define PANEL_STRINGS_ID "strings" #define G_TYPE_STRINGS_PANEL g_strings_panel_get_type() diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c index 2cb2b34..ec85479 100644 --- a/src/gui/panels/symbols.c +++ b/src/gui/panels/symbols.c @@ -47,6 +47,7 @@ #include "../../format/symiter.h" #include "../../gtkext/easygtk.h" #include "../../gtkext/gtkdisplaypanel.h" +#include "../../gtkext/named.h" #include "../../gtkext/tmgt.h" #include "../../mangling/demangler.h" @@ -119,6 +120,9 @@ static void g_symbols_panel_dispose(GSymbolsPanel *); /* Procède à la libération totale de la mémoire. */ static void g_symbols_panel_finalize(GSymbolsPanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_symbols_panel_get_key(const GSymbolsPanel *); + /* Bascule d'affichage des symboles en liste. */ static void on_symbols_list_display_toggle(GtkToggleToolButton *, GSymbolsPanel *); @@ -249,7 +253,7 @@ G_DEFINE_TYPE_WITH_CODE(GSymbolsPanel, g_symbols_panel, G_TYPE_PANEL_ITEM, static void g_symbols_panel_class_init(GSymbolsPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ gchar *filename; /* Chemin d'accès à utiliser */ @@ -258,9 +262,11 @@ static void g_symbols_panel_class_init(GSymbolsPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_symbols_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_symbols_panel_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_symbols_panel_get_key; - editem->change_content = (change_item_content_fc)change_symbols_panel_current_content; + item->change_content = (change_item_content_fc)change_symbols_panel_current_content; panel = G_PANEL_ITEM_CLASS(klass); @@ -314,7 +320,6 @@ static void g_symbols_panel_class_init(GSymbolsPanelClass *klass) static void g_symbols_panel_init(GSymbolsPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeModelFilter *filter; /* Filtre pour l'arborescence */ @@ -324,20 +329,20 @@ static void g_symbols_panel_init(GSymbolsPanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_SYMBOLS_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Binary symbols"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Symbols"), + _("Binary symbols"), + PANEL_SYMBOLS_ID)); + pitem->dock_at_startup = true; pitem->path = strdup("MEN"); /* Représentation graphique */ - builder = g_panel_item_build(pitem, "symbols"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); filter = GTK_TREE_MODEL_FILTER(gtk_builder_get_object(builder, "filter")); gtk_tree_model_filter_set_visible_column(filter, SBC_MATCHED); @@ -387,6 +392,8 @@ static void g_symbols_panel_init(GSymbolsPanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -480,6 +487,29 @@ GPanelItem *g_symbols_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_symbols_panel_get_key(const GSymbolsPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_SYMBOLS_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : button = bouton de la barre activé. * * panel = structure contenant les informations maîtresses. * * * @@ -501,7 +531,7 @@ static void on_symbols_list_display_toggle(GtkToggleToolButton *button, GSymbols { /* Accès aux boutons complémentaires */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); other = GTK_WIDGET(gtk_builder_get_object(builder, "collapse")); gtk_widget_set_sensitive(other, FALSE); @@ -512,6 +542,8 @@ static void on_symbols_list_display_toggle(GtkToggleToolButton *button, GSymbols other = GTK_WIDGET(gtk_builder_get_object(builder, "classes")); gtk_widget_set_sensitive(other, FALSE); + g_object_unref(G_OBJECT(builder)); + /* Actualisation de l'affichage */ if (panel->binary != NULL) @@ -552,7 +584,7 @@ static void on_symbols_tree_display_toggle(GtkToggleToolButton *button, GSymbols { /* Accès aux boutons complémentaires */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); other = GTK_WIDGET(gtk_builder_get_object(builder, "collapse")); gtk_widget_set_sensitive(other, TRUE); @@ -563,6 +595,8 @@ static void on_symbols_tree_display_toggle(GtkToggleToolButton *button, GSymbols other = GTK_WIDGET(gtk_builder_get_object(builder, "classes")); gtk_widget_set_sensitive(other, TRUE); + g_object_unref(G_OBJECT(builder)); + /* Actualisation de l'affichage */ if (panel->binary != NULL) @@ -671,7 +705,7 @@ static void change_symbols_panel_current_content(GSymbolsPanel *panel, GLoadedCo /* Réinitialisation */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -721,6 +755,8 @@ static void change_symbols_panel_current_content(GSymbolsPanel *panel, GLoadedCo } + g_object_unref(G_OBJECT(builder)); + } @@ -744,7 +780,7 @@ static void reload_symbols_panel_content(const GSymbolsPanel *panel, GtkStatusSt GtkBuilder *builder; /* Constructeur utilisé */ GtkToggleToolButton *button; /* Mode de représentation */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); button = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "list_display")); @@ -754,6 +790,8 @@ static void reload_symbols_panel_content(const GSymbolsPanel *panel, GtkStatusSt else reload_symbols_for_new_tree_view(panel, status, id, data); + g_object_unref(G_OBJECT(builder)); + } @@ -796,7 +834,7 @@ static void reload_symbols_for_new_list_view(const GSymbolsPanel *panel, GtkStat VMPA_BUFFER(virt); /* Version humainement lisible */ GtkTreeIter iter; /* Point d'insertion */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -878,6 +916,8 @@ static void reload_symbols_for_new_list_view(const GSymbolsPanel *panel, GtkStat g_object_unref(G_OBJECT(format)); + g_object_unref(G_OBJECT(builder)); + } @@ -947,7 +987,7 @@ static GtkTreeIter ensure_symbol_node_exist(const GSymbolsPanel *panel, GtkTreeI gchar *string; /* Chaîne sélectionnée */ char *name; /* Etiquette mise en relief */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -984,6 +1024,8 @@ static GtkTreeIter ensure_symbol_node_exist(const GSymbolsPanel *panel, GtkTreeI } + g_object_unref(G_OBJECT(builder)); + return iter; } @@ -1077,7 +1119,7 @@ static void reload_symbols_for_new_tree_view(const GSymbolsPanel *panel, GtkStat char virt[VMPA_MAX_LEN]; /* Version humainement lisible */ GtkTreeIter iter; /* Point d'insertion */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); @@ -1195,7 +1237,7 @@ static void reorganize_symbols_tree_view(GtkToolButton *button, const GSymbolsPa GtkToolButton *ref_expand; /* Bouton de référence #2 */ GtkTreeStore *store; /* Modèle de gestion */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1218,6 +1260,8 @@ static void reorganize_symbols_tree_view(GtkToolButton *button, const GSymbolsPa } + g_object_unref(G_OBJECT(builder)); + } @@ -1451,7 +1495,7 @@ static void do_filtering_on_symbols(const GSymbolsPanel *panel, GtkStatusStack * } - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store")); button = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "list_display")); @@ -1460,6 +1504,8 @@ static void do_filtering_on_symbols(const GSymbolsPanel *panel, GtkStatusStack * gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc)filter_symbol_panel_iter, &as_list); + g_object_unref(G_OBJECT(builder)); + } @@ -1594,7 +1640,7 @@ static const char *g_symbols_panel_setup(const GSymbolsPanel *panel, unsigned in /* Mémorisation de tous les noeuds ouverts */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1618,6 +1664,8 @@ static const char *g_symbols_panel_setup(const GSymbolsPanel *panel, unsigned in gtk_tree_view_map_expanded_rows(treeview, (GtkTreeViewMappingFunc)keep_track_of_expanded, *data); + g_object_unref(G_OBJECT(builder)); + return result; } @@ -1647,7 +1695,7 @@ static void g_symbols_panel_introduce(const GSymbolsPanel *panel, unsigned int u g_panel_item_switch_to_updating_mask(G_PANEL_ITEM(panel)); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1659,6 +1707,8 @@ static void g_symbols_panel_introduce(const GSymbolsPanel *panel, unsigned int u gtk_tree_view_set_model(treeview, NULL); } + g_object_unref(G_OBJECT(builder)); + } @@ -1727,7 +1777,7 @@ static void g_symbols_panel_conclude(GSymbolsPanel *panel, unsigned int uid, sym /* Basculement de l'affichage en ligne */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); @@ -1753,6 +1803,8 @@ static void g_symbols_panel_conclude(GSymbolsPanel *panel, unsigned int uid, sym if (!gtk_toggle_tool_button_get_active(button)) reorganize_symbols_tree_view(NULL, panel); + g_object_unref(G_OBJECT(builder)); + skip_this_step: g_panel_item_switch_to_updated_content(G_PANEL_ITEM(panel)); diff --git a/src/gui/panels/symbols.h b/src/gui/panels/symbols.h index 6b782dc..f589d7f 100644 --- a/src/gui/panels/symbols.h +++ b/src/gui/panels/symbols.h @@ -33,7 +33,7 @@ -#define PANEL_SYMBOLS_ID _("Symbols") +#define PANEL_SYMBOLS_ID "symbols" #define G_TYPE_SYMBOLS_PANEL g_symbols_panel_get_type() diff --git a/src/gui/panels/welcome.c b/src/gui/panels/welcome.c index 2693b9a..02649e1 100644 --- a/src/gui/panels/welcome.c +++ b/src/gui/panels/welcome.c @@ -45,6 +45,7 @@ #include "../../core/global.h" #include "../../core/params.h" #include "../../core/paths.h" +#include "../../gtkext/named.h" @@ -94,6 +95,9 @@ static void g_welcome_panel_dispose(GWelcomePanel *); /* Procède à la libération totale de la mémoire. */ static void g_welcome_panel_finalize(GWelcomePanel *); +/* Fournit le nom interne attribué à l'élément réactif. */ +static char *g_welcome_panel_get_key(const GWelcomePanel *); + /* Place un panneau dans l'ensemble affiché. */ static void g_welcome_panel_dock(GWelcomePanel *); @@ -150,6 +154,7 @@ G_DEFINE_TYPE(GWelcomePanel, g_welcome_panel, G_TYPE_PANEL_ITEM); static void g_welcome_panel_class_init(GWelcomePanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *parent; /* Version parente de classe */ object = G_OBJECT_CLASS(klass); @@ -157,6 +162,10 @@ static void g_welcome_panel_class_init(GWelcomePanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_welcome_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_welcome_panel_finalize; + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_welcome_panel_get_key; + parent = G_PANEL_ITEM_CLASS(klass); parent->ack_dock = (ack_undock_process_fc)g_welcome_panel_dock; @@ -178,7 +187,6 @@ static void g_welcome_panel_class_init(GWelcomePanelClass *klass) static void g_welcome_panel_init(GWelcomePanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ GtkBuilder *builder; /* Constructeur utilisé */ GtkTreeView *treeview; /* Affichage de la liste */ @@ -190,14 +198,14 @@ static void g_welcome_panel_init(GWelcomePanel *panel) /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_WELCOME_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Welcome"); + + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Welcome"), + _("Welcome panel"), + PANEL_WELCOME_ID)); + pitem->dock_at_startup = false; pitem->path = strdup("M"); @@ -205,7 +213,7 @@ static void g_welcome_panel_init(GWelcomePanel *panel) /* Représentation graphique */ - builder = g_panel_item_build(pitem, "welcome"); + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); /* Liste des projets récents */ @@ -248,6 +256,8 @@ static void g_welcome_panel_init(GWelcomePanel *panel) gtk_builder_connect_signals(builder, panel); + g_object_unref(G_OBJECT(builder)); + } @@ -329,6 +339,29 @@ GPanelItem *g_welcome_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_welcome_panel_get_key(const GWelcomePanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_WELCOME_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = composant à présenter à l'affichage. * * * * Description : Place un panneau dans l'ensemble affiché. * @@ -519,7 +552,7 @@ static void g_welcome_panel_reload_project_list(GWelcomePanel *panel, GtkRecentM /* Réinitialisation */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); @@ -570,6 +603,8 @@ static void g_welcome_panel_reload_project_list(GWelcomePanel *panel, GtkRecentM } + g_object_unref(G_OBJECT(builder)); + } @@ -711,7 +746,7 @@ static void g_welcome_panel_check_version(GWelcomePanel *panel) /* Affichage */ - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); label = GTK_LABEL(gtk_builder_get_object(builder, "version")); @@ -753,6 +788,8 @@ static void g_welcome_panel_check_version(GWelcomePanel *panel) free(msg); + g_object_unref(G_OBJECT(builder)); + } @@ -825,12 +862,14 @@ static void g_welcome_panel_refresh_tip(GWelcomePanel *panel) assert(panel->current < panel->count); - builder = G_PANEL_ITEM(panel)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); label = GTK_LABEL(gtk_builder_get_object(builder, "tip")); gtk_label_set_markup(label, panel->tips[panel->current]); + g_object_unref(G_OBJECT(builder)); + } diff --git a/src/gui/panels/welcome.h b/src/gui/panels/welcome.h index 1a227ca..5cdd6a1 100644 --- a/src/gui/panels/welcome.h +++ b/src/gui/panels/welcome.h @@ -33,7 +33,7 @@ -#define PANEL_WELCOME_ID _("Welcome") +#define PANEL_WELCOME_ID "welcome" #define G_TYPE_WELCOME_PANEL g_welcome_panel_get_type() |