summaryrefslogtreecommitdiff
path: root/src/gui/panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/panel.c')
-rw-r--r--src/gui/panel.c70
1 files changed, 43 insertions, 27 deletions
diff --git a/src/gui/panel.c b/src/gui/panel.c
index b6ef26f..a98119f 100644
--- a/src/gui/panel.c
+++ b/src/gui/panel.c
@@ -27,6 +27,7 @@
#include <assert.h>
#include <stdio.h>
+#include <string.h>
#include "panel-int.h"
@@ -45,7 +46,7 @@ static void g_panel_item_class_init(GPanelItemClass *);
/* Initialise une instance d'élément réactif pour l'éditeur. */
static void g_panel_item_init(GPanelItem *);
-/* Procède à l'initialisation de l'interface de rassemblement. */
+/* Procède à l'initialisation de l'interface d'incrustation. */
static void g_panel_item_dockable_interface_init(GtkDockableInterface *);
/* Supprime toutes les références externes. */
@@ -54,20 +55,20 @@ static void g_panel_item_dispose(GPanelItem *);
/* Procède à la libération totale de la mémoire. */
static void g_panel_item_finalize(GPanelItem *);
-/* Détermine si un panneau peut être filtré. */
-static bool gtk_panel_item_can_search(const GPanelItem *);
-
/* Fournit le nom court du composant encapsulable. */
-static const char *gtk_panel_item_get_name(const GPanelItem *);
+static char *gtk_panel_item_get_name(const GPanelItem *);
/* Fournit le nom long du composant encapsulable. */
-static const char *gtk_panel_item_get_desc(const GPanelItem *);
+static char *gtk_panel_item_get_desc(const GPanelItem *);
+
+/* Détermine si un panneau peut être filtré. */
+static bool gtk_panel_item_can_search(const GPanelItem *);
/* Fournit le composant graphique intégrable dans un ensemble. */
static GtkWidget *gtk_panel_item_get_widget(GPanelItem *);
/* Démarre l'actualisation du filtrage du contenu. */
-static void gtk_panel_item_update_filtered(GPanelItem *, char *);
+static void gtk_panel_item_update_filtered(GPanelItem *, const char *);
/* Construit la chaîne d'accès à un élément de configuration. */
static char *gtk_panel_item_build_configuration_key(const GPanelItem *, const char *);
@@ -163,7 +164,7 @@ static void g_panel_item_init(GPanelItem *item)
* *
* Paramètres : iface = interface GTK à initialiser. *
* *
-* Description : Procède à l'initialisation de l'interface de rassemblement. *
+* Description : Procède à l'initialisation de l'interface d'incrustation. *
* *
* Retour : - *
* *
@@ -173,9 +174,10 @@ static void g_panel_item_init(GPanelItem *item)
static void g_panel_item_dockable_interface_init(GtkDockableInterface *iface)
{
- iface->can_search = (can_dockable_search_fc)gtk_panel_item_can_search;
iface->get_name = (get_dockable_name_fc)gtk_panel_item_get_name;
iface->get_desc = (get_dockable_desc_fc)gtk_panel_item_get_desc;
+ iface->can_search = (can_dockable_search_fc)gtk_panel_item_can_search;
+
iface->get_widget = (get_dockable_widget_fc)gtk_panel_item_get_widget;
iface->update_filtered = (update_filtered_data_fc)gtk_panel_item_update_filtered;
@@ -340,22 +342,19 @@ GtkBuilder *g_panel_item_build_full(GPanelItem *item, const char *path)
* *
* Paramètres : item = instance GTK dont l'interface est à consulter. *
* *
-* Description : Détermine si un panneau peut être filtré. *
+* Description : Fournit le nom court du composant encapsulable. *
* *
-* Retour : Bilan de la consultation. *
+* Retour : Désignation humaine pour titre d'onglet ou de fenêtre. *
* *
* Remarques : - *
* *
******************************************************************************/
-static bool gtk_panel_item_can_search(const GPanelItem *item)
+static char *gtk_panel_item_get_name(const GPanelItem *item)
{
- bool result; /* Indication à retourner */
- GPanelItemClass *class; /* Classe de l'élément visé */
+ char *result; /* Désignation à retourner */
- class = G_PANEL_ITEM_GET_CLASS(item);
-
- result = class->can_search;
+ result = strdup(G_EDITOR_ITEM(item)->name);
return result;
@@ -366,7 +365,7 @@ static bool gtk_panel_item_can_search(const GPanelItem *item)
* *
* Paramètres : item = instance GTK dont l'interface est à consulter. *
* *
-* Description : Fournit le nom court du composant encapsulable. *
+* Description : Fournit le nom long du composant encapsulable. *
* *
* Retour : Désignation humaine pour titre d'onglet ou de fenêtre. *
* *
@@ -374,9 +373,13 @@ static bool gtk_panel_item_can_search(const GPanelItem *item)
* *
******************************************************************************/
-static const char *gtk_panel_item_get_name(const GPanelItem *item)
+static char *gtk_panel_item_get_desc(const GPanelItem *item)
{
- return G_EDITOR_ITEM(item)->name;
+ char *result; /* Description à retourner */
+
+ result = strdup(item->lname);
+
+ return result;
}
@@ -385,17 +388,24 @@ static const char *gtk_panel_item_get_name(const GPanelItem *item)
* *
* Paramètres : item = instance GTK dont l'interface est à consulter. *
* *
-* Description : Fournit le nom long du composant encapsulable. *
+* Description : Détermine si un panneau peut être filtré. *
* *
-* Retour : Désignation humaine pour titre d'onglet ou de fenêtre. *
+* Retour : Bilan de la consultation. *
* *
* Remarques : - *
* *
******************************************************************************/
-static const char *gtk_panel_item_get_desc(const GPanelItem *item)
+static bool gtk_panel_item_can_search(const GPanelItem *item)
{
- return item->lname;
+ bool result; /* Indication à retourner */
+ GPanelItemClass *class; /* Classe de l'élément visé */
+
+ class = G_PANEL_ITEM_GET_CLASS(item);
+
+ result = class->can_search;
+
+ return result;
}
@@ -414,7 +424,13 @@ static const char *gtk_panel_item_get_desc(const GPanelItem *item)
static GtkWidget *gtk_panel_item_get_widget(GPanelItem *item)
{
- return G_EDITOR_ITEM(item)->widget;
+ GtkWidget *result; /* Composant à retourner */
+
+ result = G_EDITOR_ITEM(item)->widget;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
}
@@ -431,14 +447,14 @@ static GtkWidget *gtk_panel_item_get_widget(GPanelItem *item)
* *
******************************************************************************/
-static void gtk_panel_item_update_filtered(GPanelItem *item, char *filter)
+static void gtk_panel_item_update_filtered(GPanelItem *item, const char *filter)
{
assert(gtk_panel_item_can_search(item));
if (item->filter != NULL)
free(item->filter);
- item->filter = filter;
+ item->filter = strdup(filter);
G_PANEL_ITEM_GET_CLASS(item)->update_filtered(item);