diff options
-rw-r--r-- | src/gtkext/tiledgrid.c | 32 | ||||
-rw-r--r-- | src/gtkext/tiledgrid.h | 4 | ||||
-rw-r--r-- | src/gui/editor.c | 14 |
3 files changed, 47 insertions, 3 deletions
diff --git a/src/gtkext/tiledgrid.c b/src/gtkext/tiledgrid.c index a7b8d96..577550d 100644 --- a/src/gtkext/tiledgrid.c +++ b/src/gtkext/tiledgrid.c @@ -30,7 +30,6 @@ #include <string.h> -#include "gtkdockstation.h" #include "../core/logs.h" @@ -915,6 +914,37 @@ void gtk_tiled_grid_remove(GtkTiledGrid *tgrid, GPanelItem *panel) /****************************************************************************** * * +* Paramètres : tgrid = conteneur d'affichage en tuiles à consulter. * +* station = station d'accueil à retrouver. * +* * +* Description : Indique le chemin correspondant à une station intégrée. * +* * +* Retour : Copie de chemin trouvé, à libérer ensuite, ou NULL si échec. * +* * +* Remarques : - * +* * +******************************************************************************/ + +char *gtk_tiled_grid_get_path_for_station(const GtkTiledGrid *tgrid, GtkDockStation *station) +{ + char *result; /* Chemin d'accès à renvoyer */ + grid_tile_t *tile; /* Tuile d'accueil */ + + tile = find_tile_for_widget(tgrid->tiles, GTK_WIDGET(station)); + + if (tile == NULL) + result = NULL; + + else + result = strdup(tile->path); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : tgrid = conteneur d'affichage en tuiles à mettre à jour. * * config = configuration à consulter. * * * diff --git a/src/gtkext/tiledgrid.h b/src/gtkext/tiledgrid.h index 5045a83..70429e5 100644 --- a/src/gtkext/tiledgrid.h +++ b/src/gtkext/tiledgrid.h @@ -28,6 +28,7 @@ #include <gtk/gtk.h> +#include "gtkdockstation.h" #include "../glibext/configuration.h" #include "../gui/panels/panel.h" @@ -70,6 +71,9 @@ void gtk_tiled_grid_add(GtkTiledGrid *, GPanelItem *); /* Retire un panneau dans le conteneur en tuiles. */ void gtk_tiled_grid_remove(GtkTiledGrid *, GPanelItem *); +/* Indique le chemin correspondant à une station intégrée. */ +char *gtk_tiled_grid_get_path_for_station(const GtkTiledGrid *, GtkDockStation *); + /* Replace les positions des séparateurs de tuiles. */ void gtk_tiled_grid_restore_positions(const GtkTiledGrid *, GGenConfig *); diff --git a/src/gui/editor.c b/src/gui/editor.c index 05afa64..39fd13b 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -684,6 +684,7 @@ static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, gpoi { GLoadedPanel *panel; /* Vue du contenu chargé */ GLoadedContent *content; /* Contenu en cours d'édition */ + char *path; /* Chemin d'accueil concerné */ if (!G_IS_LOADED_PANEL(widget) && GTK_IS_SCROLLED_WINDOW(widget)) widget = gtk_bin_get_child(GTK_BIN(widget)); @@ -707,8 +708,17 @@ static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, gpoi else { - change_editor_items_current_content(NULL); - change_editor_items_current_view(NULL); + path = gtk_tiled_grid_get_path_for_station(get_tiled_grid(), station); + assert(path != NULL); + + if (strcmp(path, "M") == 0) + { + change_editor_items_current_content(NULL); + change_editor_items_current_view(NULL); + } + + free(path); + } } |