diff options
Diffstat (limited to 'src/gui/panels/panel.c')
-rw-r--r-- | src/gui/panels/panel.c | 102 |
1 files changed, 98 insertions, 4 deletions
diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c index 424e779..78f70f3 100644 --- a/src/gui/panels/panel.c +++ b/src/gui/panels/panel.c @@ -54,6 +54,12 @@ 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 *); + +/* Détermine si un panneau peut être fermé. */ +static bool gtk_panel_item_can_be_closed(const GPanelItem *); + /* Fournit le nom court du composant encapsulable. */ static const char *gtk_panel_item_get_name(const GPanelItem *); @@ -63,6 +69,9 @@ static const char *gtk_panel_item_get_desc(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 *); + /* Construit la chaîne d'accès à un élément de configuration. */ static char *gtk_panel_item_build_configuration_key(const GPanelItem *, const char *); @@ -123,6 +132,9 @@ static void g_panel_item_class_init(GPanelItemClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + klass->can_search = false; + klass->can_be_closed = false; + } @@ -144,6 +156,8 @@ static void g_panel_item_init(GPanelItem *item) item->personality = PIP_INVALID; + item->filter = NULL; + g_atomic_int_set(&item->switched, 0); } @@ -163,13 +177,12 @@ static void g_panel_item_init(GPanelItem *item) static void g_panel_item_dockable_interface_init(GtkDockableInterface *iface) { - iface->can_search = false; - iface->can_be_closed = true; - + iface->can_search = (can_dockable_search_fc)gtk_panel_item_can_search; + iface->can_be_closed = (can_dockable_search_fc)gtk_panel_item_can_be_closed; 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->get_widget = (get_dockable_widget_fc)gtk_panel_item_get_widget; - iface->update_filtered = (update_filtered_data_fc)NULL; + iface->update_filtered = (update_filtered_data_fc)gtk_panel_item_update_filtered; } @@ -212,6 +225,9 @@ static void g_panel_item_finalize(GPanelItem *item) { free(item->path); + if (item->filter != NULL) + free(item->filter); + if (item->surface != NULL) cairo_surface_destroy(item->surface); @@ -306,6 +322,58 @@ GtkBuilder *g_panel_item_build(GPanelItem *item, const char *name) * * * Paramètres : item = instance GTK dont l'interface est à consulter. * * * +* Description : Détermine si un panneau peut être filtré. * +* * +* Retour : Bilan de la consultation. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool gtk_panel_item_can_search(const GPanelItem *item) +{ + 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; + +} + + +/****************************************************************************** +* * +* Paramètres : item = instance GTK dont l'interface est à consulter. * +* * +* Description : Détermine si un panneau peut être fermé. * +* * +* Retour : Bilan de la consultation. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool gtk_panel_item_can_be_closed(const GPanelItem *item) +{ + bool result; /* Indication à retourner */ + GPanelItemClass *class; /* Classe de l'élément visé */ + + class = G_PANEL_ITEM_GET_CLASS(item); + + result = class->can_be_closed; + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : item = instance GTK dont l'interface est à consulter. * +* * * Description : Fournit le nom court du composant encapsulable. * * * * Retour : Désignation humaine pour titre d'onglet ou de fenêtre. * @@ -361,6 +429,32 @@ static GtkWidget *gtk_panel_item_get_widget(GPanelItem *item) /****************************************************************************** * * +* Paramètres : item = instance GTK dont l'interface est à sollicitée. * +* * +* Description : Démarre l'actualisation du filtrage du contenu. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_panel_item_update_filtered(GPanelItem *item, char *filter) +{ + assert(gtk_panel_item_can_search(item)); + + if (item->filter != NULL) + free(item->filter); + + item->filter = filter; + + G_PANEL_ITEM_GET_CLASS(item)->update_filtered(item); + +} + + +/****************************************************************************** +* * * Paramètres : item = instance GTK à consulter. * * attrib = élément de configuration à inclure dans le résultat.* * * |