summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-12-08 23:28:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-12-08 23:28:25 (GMT)
commit4e0a2b71a5937b7382dc14881672a13b84afddac (patch)
tree4cae7e56ebcb8d381643b26e9e8c1faeae576337 /src/gui
parent70243bca0f6b77c6861a98a014f68f74d7a415fd (diff)
Used the short panel descriptions in menus.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/editor.c25
-rw-r--r--src/gui/menus/view.c25
2 files changed, 34 insertions, 16 deletions
diff --git a/src/gui/editor.c b/src/gui/editor.c
index c7c2d37..c46c137 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -58,8 +58,7 @@
#include "../gtkext/gtkdockstation.h"
#include "../gtkext/tiledgrid.h"
#include "../gtkext/support.h"
-
-
+#include "../plugins/dt.h"
@@ -786,8 +785,11 @@ static void dock_panel_into_current_station(GtkCheckMenuItem *menuitem, gpointer
static bool add_side_panel_to_menu(GPanelItemClass *class, GtkContainer *support)
{
GEditorItem *item; /* Instance de panneau en place*/
- gpointer type_ptr; /* Type de panneau traité */
- char *key; /* Désignation de l'entrée */
+ GType type; /* Type de panneau traité */
+ gpointer type_ptr; /* Autre forme d'encodage */
+ GPanelItem *panel; /* Panneau à manipuler */
+ GNamedWidget *named; /* Composant nommé associé */
+ char *label; /* Désignation de l'entrée */
GtkWidget *submenuitem; /* Sous-élément de menu */
char *bindings; /* Raccourcis clavier bruts */
GtkBuilder *builder; /* Constructeur principal */
@@ -807,14 +809,18 @@ static bool add_side_panel_to_menu(GPanelItemClass *class, GtkContainer *support
/* Elément de menu */
- type_ptr = GSIZE_TO_POINTER(G_TYPE_FROM_CLASS(class));
+ type = G_TYPE_FROM_CLASS(class);
+ type_ptr = GSIZE_TO_POINTER(type);
- key = g_editor_item_class_get_key(G_EDITOR_ITEM_CLASS(class));
+ panel = create_object_from_type(type);
+ named = gtk_panel_item_get_named_widget(panel);
- submenuitem = qck_create_menu_item(NULL, NULL, key,
+ label = g_named_widget_get_name(named, false);
+
+ submenuitem = qck_create_menu_item(NULL, NULL, label,
G_CALLBACK(dock_panel_into_current_station), type_ptr);
- free(key);
+ free(label);
bindings = gtk_panel_item_class_get_key_bindings(class);
@@ -832,7 +838,8 @@ static bool add_side_panel_to_menu(GPanelItemClass *class, GtkContainer *support
exit_ref:
- g_object_unref(G_OBJECT(item));
+ if (item != NULL)
+ g_object_unref(G_OBJECT(item));
exit:
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 37db20a..02cfa1d 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -42,6 +42,7 @@
#include "../../gtkext/easygtk.h"
#include "../../gtkext/gtkdisplaypanel.h"
#include "../../gtkext/gtkgraphdisplay.h"
+#include "../../plugins/dt.h"
@@ -173,8 +174,11 @@ static void remove_panel_menu_item(GtkWidget *widget, GtkContainer *container)
static bool add_side_panel_to_list(GPanelItemClass *class, panels_loading_filter *filter)
{
- gpointer type_ptr; /* Type de panneau traité */
- char *key; /* Désignation de l'entrée */
+ GType type; /* Type de panneau traité */
+ gpointer type_ptr; /* Autre forme d'encodage */
+ GPanelItem *panel; /* Panneau à manipuler */
+ GNamedWidget *named; /* Composant nommé associé */
+ char *label; /* Désignation de l'entrée */
GtkWidget *submenuitem; /* Sous-élément de menu */
char *bindings; /* Raccourcis clavier bruts */
GtkBuilder *builder; /* Constructeur principal */
@@ -196,14 +200,21 @@ static bool add_side_panel_to_list(GPanelItemClass *class, panels_loading_filter
/* Elément de menu */
- type_ptr = GSIZE_TO_POINTER(G_TYPE_FROM_CLASS(class));
+ type = G_TYPE_FROM_CLASS(class);
+ type_ptr = GSIZE_TO_POINTER(type);
- key = g_editor_item_class_get_key(G_EDITOR_ITEM_CLASS(class));
+ panel = create_object_from_type(type);
+ named = gtk_panel_item_get_named_widget(panel);
- submenuitem = qck_create_check_menu_item(NULL, NULL, key,
+ label = g_named_widget_get_name(named, false);
+
+ submenuitem = qck_create_check_menu_item(NULL, NULL, label,
G_CALLBACK(mcb_view_change_panel_docking), type_ptr);
- free(key);
+ free(label);
+
+ g_object_unref(G_OBJECT(named));
+ g_object_unref(G_OBJECT(panel));
bindings = gtk_panel_item_class_get_key_bindings(class);
@@ -221,7 +232,7 @@ static bool add_side_panel_to_list(GPanelItemClass *class, panels_loading_filter
/* Statut de la coche */
- item = find_editor_item_by_type(G_TYPE_FROM_CLASS(class));
+ item = find_editor_item_by_type(type);
if (item != NULL)
{