diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogs/loading.c | 12 | ||||
-rw-r--r-- | src/gui/editor.c | 8 | ||||
-rw-r--r-- | src/gui/menus/project.c | 4 | ||||
-rw-r--r-- | src/gui/menus/view.c | 6 | ||||
-rw-r--r-- | src/gui/panel.c | 4 |
5 files changed, 24 insertions, 10 deletions
diff --git a/src/gui/dialogs/loading.c b/src/gui/dialogs/loading.c index 3e71df4..97cd892 100644 --- a/src/gui/dialogs/loading.c +++ b/src/gui/dialogs/loading.c @@ -457,6 +457,8 @@ static void update_loading_dialog_counter(GtkBuilder *builder) void add_content_to_loading_dialog(GtkBuilder *builder, GLoadedContent *content, GStudyProject *project) { GtkListStore *store; /* Modèle de gestion */ + char *desc; /* Description d'un contenu */ + char *format; /* Format associé à un contenu */ char *name; /* Désignation complète */ gboolean recognized; /* Nature du contenu */ GtkTreeIter iter; /* Point d'insertion */ @@ -472,9 +474,13 @@ void add_content_to_loading_dialog(GtkBuilder *builder, GLoadedContent *content, /* Inscription */ - asprintf(&name, "%s (%s)", - g_loaded_content_describe(content, false), - g_loaded_content_get_format_name(content)); + desc = g_loaded_content_describe(content, false); + format = g_loaded_content_get_format_name(content); + + asprintf(&name, "%s (%s)", desc, format); + + free(format); + free(desc); recognized = TRUE; diff --git a/src/gui/editor.c b/src/gui/editor.c index bdd9a78..8e20cc1 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -926,8 +926,8 @@ static void on_editor_content_available(GStudyProject *project, GLoadedContent * static void on_editor_loaded_content_added(GStudyProject *project, GLoadedContent *content, void *unused) { GtkWidget *selected; /* Interface de prédilection */ - const char *name; /* Titre associé au binaire */ - const char *lname; /* Description du binaire */ + char *name; /* Titre associé au binaire */ + char *lname; /* Description du binaire */ GPanelItem *panel; /* Nouveau panneau à integrer */ selected = g_loaded_content_build_default_view(content); @@ -936,6 +936,10 @@ static void on_editor_loaded_content_added(GStudyProject *project, GLoadedConten lname = g_loaded_content_describe(content, true); panel = g_panel_item_new(PIP_BINARY_VIEW, name, lname, selected, true, "M"); + + free(lname); + free(name); + register_panel_item(panel, get_main_configuration()); g_signal_connect(selected, "size-allocate", G_CALLBACK(scroll_for_the_first_time), content); diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index f0b9c17..a5992bf 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -117,7 +117,7 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project, size_t count; /* Nombre de contenus attachés */ GLoadedContent **contents; /* Liste de ces contenus */ size_t i; /* Boucle de parcours #2 */ - const char *desc; /* Description à afficher */ + char *desc; /* Description à afficher */ GtkWidget *submenuitem; /* Sous-menu à ajouter */ menuitem = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "menu_prj_remove_bin")); @@ -145,6 +145,8 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project, g_object_set_data_full(G_OBJECT(submenuitem), "content", contents[i], g_object_unref); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + free(desc); + /** * Note : l'appel à g_object_unref() est réalisé lorsque la référence * est retirée du menu. diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index bc833a3..b9451e0 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -198,6 +198,7 @@ void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedConte GList *iter; /* Boucle de parcours */ unsigned int count; /* Nombre d'itérations à mener */ GSList *rgroup; /* Groupe des boutons radio */ + char *caption; /* Etiquette pour un menu */ /* Retrait d'éventuels anciens menus */ @@ -246,12 +247,13 @@ void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedConte for (i = 0; i < count; i++) { asprintf(&key, "mnu_view_panel_%u", i); + caption = g_loaded_content_get_view_name(new, i); - submenuitem = qck_create_radio_menu_item(ref, key, rgroup, - g_loaded_content_get_view_name(new, i), + submenuitem = qck_create_radio_menu_item(ref, key, rgroup, caption, G_CALLBACK(mcb_view_change_support), NULL); g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(i)); + free(caption); free(key); asprintf(&key, "F%u", 3 + i); diff --git a/src/gui/panel.c b/src/gui/panel.c index a98119f..2ebcdad 100644 --- a/src/gui/panel.c +++ b/src/gui/panel.c @@ -258,13 +258,13 @@ GPanelItem *g_panel_item_new(PanelItemPersonality personality, const char *name, parent = G_EDITOR_ITEM(result); - parent->name = name; + parent->name = strdup(name); parent->widget = widget; assert(personality > PIP_INVALID && personality < PIP_COUNT); result->personality = personality; - result->lname = lname; + result->lname = strdup(lname); result->dock_at_startup = startup; result->path = strdup(path); |