summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2025-02-20 21:37:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2025-02-20 21:37:10 (GMT)
commit0bec2b96a14da29a680aafe54895fd9cfb3bcf09 (patch)
treeba2dd91ed51cd0fb0eb801439271028fbf1c6f81 /src/gui
parentf58a0e1138a3a3b8a4cfa237f1fe75a24ea8e2ba (diff)
Create a GTK widget to launch panels.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/panel-int.h11
-rw-r--r--src/gui/panel.c4
-rw-r--r--src/gui/panel.h9
-rw-r--r--src/gui/panels/Makefile.am1
-rw-r--r--src/gui/panels/binary-launch.ui65
-rw-r--r--src/gui/panels/binary.c23
-rw-r--r--src/gui/panels/gresource.xml1
7 files changed, 25 insertions, 89 deletions
diff --git a/src/gui/panel-int.h b/src/gui/panel-int.h
index 7e6f7e3..6a9fcc5 100644
--- a/src/gui/panel-int.h
+++ b/src/gui/panel-int.h
@@ -34,7 +34,10 @@
typedef PanelItemPersonality (* get_panel_item_personality_cb) (const GPanelItem *);
/* Fournit un composant pour lancer l'activité d'un panneau. */
-typedef GtkWidget * (* get_panel_item_widget_cb) (GPanelItem *);
+typedef GtkPanelLauncher * (* get_panel_item_launcher_cb) (GPanelItem *);
+
+/* Fournit un composant pour paramétrer l'activité d'un panneau. */
+typedef GtkWidget * (* get_panel_item_props_cb) (GPanelItem *);
/* Fournit un composant représentant un panneau graphique. */
typedef GtkTiledPanel * (* get_panel_item_panel_cb) (GPanelItem *, GtkWidget *);
@@ -45,7 +48,7 @@ struct _GPanelItem
{
GObject parent; /* A laisser en premier */
- GtkWidget *launcher; /* Eventuel lanceur associé */
+ GtkPanelLauncher *launcher; /* Eventuel lanceur associé */
GtkWidget *properties; /* Propriétés de lancement */
GtkTiledPanel **panels; /* Instances complètes ouvertes*/
@@ -60,8 +63,8 @@ struct _GPanelItemClass
get_panel_item_personality_cb get_personality; /* Fourniture de nature */
- get_panel_item_widget_cb get_launcher; /* Lancement d'une activité */
- get_panel_item_widget_cb get_properties;/* Préparation au lancement */
+ get_panel_item_launcher_cb get_launcher;/* Lancement d'une activité */
+ get_panel_item_props_cb get_properties; /* Préparation au lancement */
get_panel_item_panel_cb get_panel; /* Panneau principal */
};
diff --git a/src/gui/panel.c b/src/gui/panel.c
index b361153..a704e63 100644
--- a/src/gui/panel.c
+++ b/src/gui/panel.c
@@ -184,9 +184,9 @@ PanelItemPersonality g_panel_item_get_personality(const GPanelItem *item)
* *
******************************************************************************/
-GtkWidget *g_panel_item_get_launcher(GPanelItem *item)
+GtkPanelLauncher *g_panel_item_get_launcher(GPanelItem *item)
{
- GtkWidget *result; /* Composant à retourner */
+ GtkPanelLauncher *result; /* Composant à retourner */
GPanelItemClass *class; /* Classe à actionner */
if (item->launcher == NULL)
diff --git a/src/gui/panel.h b/src/gui/panel.h
index 03b67d4..b14daa8 100644
--- a/src/gui/panel.h
+++ b/src/gui/panel.h
@@ -26,11 +26,12 @@
#define _GUI_PANEL_H
-#include "../glibext/helpers.h"
-#include "../gtkext/panel.h"
+#include <gtk/gtk.h>
-#include <gtk/gtk.h>
+#include "../glibext/helpers.h"
+#include "../gtkext/panel.h"
+#include "../gtkext/launcher.h"
@@ -56,7 +57,7 @@ typedef enum _PanelItemPersonality
PanelItemPersonality g_panel_item_get_personality(const GPanelItem *);
/* Fournit un composant pour lancer l'activité d'un panneau. */
-GtkWidget *g_panel_item_get_launcher(GPanelItem *);
+GtkPanelLauncher *g_panel_item_get_launcher(GPanelItem *);
/* Fournit un composant pour paramétrer l'activité d'un panneau. */
GtkWidget *g_panel_item_get_properties(GPanelItem *);
diff --git a/src/gui/panels/Makefile.am b/src/gui/panels/Makefile.am
index 476a436..525b1f6 100644
--- a/src/gui/panels/Makefile.am
+++ b/src/gui/panels/Makefile.am
@@ -38,7 +38,6 @@ IMG_PATH = ../../../data/images
RES_FILES = \
binary.ui \
- binary-launch.ui \
binary-props.ui \
$(IMG_PATH)/binfile-symbolic.svg \
welcome.ui \
diff --git a/src/gui/panels/binary-launch.ui b/src/gui/panels/binary-launch.ui
deleted file mode 100644
index 553f758..0000000
--- a/src/gui/panels/binary-launch.ui
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-
- <object class="GtkGrid" id="launcher">
- <property name="margin-bottom">12</property>
- <property name="margin-end">12</property>
- <property name="margin-start">12</property>
- <property name="margin-top">12</property>
- <property name="column-spacing">12</property>
- <child>
- <object class="GtkImage">
- <property name="icon-name">binfile-symbolic</property>
- <property name="pixel-size">48</property>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="row-span">2</property>
- </layout>
- <style>
- <class name="icon-dropshadow"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label">&lt;b&gt;Binary analysis&lt;/b&gt;</property>
- <property name="use-markup">TRUE</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label">Load a binary content and parse its format if recognized</property>
- <property name="hexpand">true</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="icon-name">go-next-symbolic</property>
- <property name="margin-start">12</property>
- <layout>
- <property name="column">2</property>
- <property name="row">0</property>
- <property name="row-span">2</property>
- </layout>
- <style>
- <class name="icon-dropshadow"/>
- </style>
- </object>
- </child>
- </object>
-
-</interface>
diff --git a/src/gui/panels/binary.c b/src/gui/panels/binary.c
index de0a4d0..23426e3 100644
--- a/src/gui/panels/binary.c
+++ b/src/gui/panels/binary.c
@@ -25,6 +25,9 @@
#include "binary.h"
+#include <i18n.h>
+
+
#include "binary-int.h"
#include "../window.h"
#include "../../analysis/contents/file.h"
@@ -81,7 +84,7 @@ static void g_binary_panel_finalize(GBinaryPanel *);
static PanelItemPersonality g_binary_panel_get_personality(const GBinaryPanel *);
/* Fournit un composant pour lancer l'activité d'un panneau. */
-static GtkWidget *g_binary_panel_get_launcher(GBinaryPanel *);
+static GtkPanelLauncher *g_binary_panel_get_launcher(GPanelItem *);
/* Fournit un composant pour paramétrer l'activité d'un panneau. */
static GtkWidget *g_binary_panel_get_properties(GBinaryPanel *);
@@ -267,8 +270,8 @@ static void g_binary_panel_class_init(GBinaryPanelClass *class)
panel = G_PANEL_ITEM_CLASS(class);
panel->get_personality = (get_panel_item_personality_cb)g_binary_panel_get_personality;
- panel->get_launcher = (get_panel_item_widget_cb)g_binary_panel_get_launcher;
- panel->get_properties = (get_panel_item_widget_cb)g_binary_panel_get_properties;
+ panel->get_launcher = g_binary_panel_get_launcher;
+ panel->get_properties = (get_panel_item_props_cb)g_binary_panel_get_properties;
panel->get_panel = (get_panel_item_panel_cb)g_binary_panel_get_panel;
}
@@ -394,17 +397,13 @@ static PanelItemPersonality g_binary_panel_get_personality(const GBinaryPanel *p
* *
******************************************************************************/
-static GtkWidget *g_binary_panel_get_launcher(GBinaryPanel *panel)
+static GtkPanelLauncher *g_binary_panel_get_launcher(GPanelItem *panel)
{
- GtkWidget *result; /* Composant à retourner */
- GtkBuilder *builder; /* Constructeur d'UI */
+ GtkPanelLauncher *result; /* Composant à retourner */
- builder = gtk_builder_new_from_resource("/re/chrysalide/framework/gui/panels/binary-launch.ui");
-
- result = GTK_WIDGET(gtk_builder_get_object(builder, "launcher"));
- ref_object(result);
-
- unref_object(builder);
+ result = gtk_panel_launcher_new("binfile-symbolic",
+ _("Binary analysis"),
+ _("Load a binary content and parse its format if recognized"));
return result;
diff --git a/src/gui/panels/gresource.xml b/src/gui/panels/gresource.xml
index d00953d..2fecc8c 100644
--- a/src/gui/panels/gresource.xml
+++ b/src/gui/panels/gresource.xml
@@ -2,7 +2,6 @@
<gresources>
<gresource prefix="/re/chrysalide/framework/gui/panels">
<file compressed="true">binary.ui</file>
- <file compressed="true">binary-launch.ui</file>
<file compressed="true">binary-props.ui</file>
<file compressed="true">welcome.ui</file>
<file compressed="true">welcome-hints.txt</file>