summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-04-25 16:51:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-04-25 16:51:41 (GMT)
commitb9977e00ff9eb6e025e86a15c858183f3f314cf5 (patch)
treeeedacb236b90228d2b4c603fa9875ecaad05ee29 /src/gtkext
parent216a3d0121fabd678e50ea6b4fa2447ae9b921f0 (diff)
Saved the current work on plugins.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@59 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/Makefile.am11
-rw-r--r--src/gtkext/easygtk.c538
-rw-r--r--src/gtkext/easygtk.h80
-rw-r--r--src/gtkext/gtkdockpanel.c6
-rw-r--r--src/gtkext/gtksnippet.c26
-rw-r--r--src/gtkext/support.c92
-rw-r--r--src/gtkext/support.h41
7 files changed, 765 insertions, 29 deletions
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am
index aa14cf5..dbf1fbc 100644
--- a/src/gtkext/Makefile.am
+++ b/src/gtkext/Makefile.am
@@ -1,17 +1,20 @@
BUILT_SOURCES = iodamarshal.h iodamarshal.c
-lib_LIBRARIES = libgtkext.a
+lib_LTLIBRARIES = libgtkext.la
-libgtkext_a_SOURCES = \
+libgtkext_la_SOURCES = \
+ easygtk.h easygtk.c \
gtkbinview.h gtkbinview.c \
gtkdockitem.h gtkdockitem.c \
gtkdockpanel.h gtkdockpanel.c \
gtkdropwindow.h gtkdropwindow.c \
gtksnippet.h gtksnippet.c \
- iodamarshal.h iodamarshal.c
+ iodamarshal.h iodamarshal.c \
+ support.h support.c
-libgtkext_a_CFLAGS = $(AM_CFLAGS)
+libgtkext_la_LDFLAGS = $(LIBGTK_LIBS) \
+ -L../analysis/.libs -lanalysis
INCLUDES = $(LIBGTK_CFLAGS)
diff --git a/src/gtkext/easygtk.c b/src/gtkext/easygtk.c
new file mode 100644
index 0000000..f596404
--- /dev/null
+++ b/src/gtkext/easygtk.c
@@ -0,0 +1,538 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * easygtk.c - mise en place rapide de composants GTK
+ *
+ * Copyright (C) 2008 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "easygtk.h"
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : pt = espace imposé à la zone supérieure. *
+* pb = espace imposé à la zone inférieure. *
+* pl = espace imposé à la zone gauche. *
+* pr = espace imposé à la zone droite. *
+* *
+* Description : Met en place un aligement dont les bordures sont à ajuster. *
+* *
+* Retour : Composant 'GtkWidget' ici créé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_padded_alignment(guint pt, guint pb, guint pl, guint pr)
+{
+ GtkWidget *result; /* Instance à renvoyer */
+
+ result = gtk_alignment_new(0.5, 0.5, 1, 1);
+ gtk_widget_show(result);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(result), pt, pb, pl, pr);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : caption = contenu de l'étiqutte à placer. *
+* alignment = conteneur réel à utiliser pour la suite. [OUT] *
+* pt = espace imposé à la zone supérieure. *
+* pb = espace imposé à la zone inférieure. *
+* pl = espace imposé à la zone gauche. *
+* pr = espace imposé à la zone droite. *
+* *
+* Description : Met en place une frame. *
+* *
+* Retour : Composant 'GtkWidget' ici créé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_frame(const char *caption, GtkWidget **alignment, guint pt, guint pb, guint pl, guint pr)
+{
+ GtkWidget *result; /* Instance à renvoyer */
+ GtkWidget *label; /* Etiquette à utiliser */
+
+ result = gtk_frame_new(NULL);
+ gtk_widget_show(result);
+
+ gtk_frame_set_shadow_type(GTK_FRAME(result), GTK_SHADOW_NONE);
+
+ label = qck_create_label(NULL, NULL, caption);
+ gtk_frame_set_label_widget(GTK_FRAME(result), label);
+ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+
+ *alignment = qck_create_padded_alignment(pt, pb, pl, pr);
+ gtk_container_add(GTK_CONTAINER(result), *alignment);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* *
+* Description : Met en place un support à onglets. *
+* *
+* Retour : Composant 'GtkWidget' ici créé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_notebook(GObject *object, const char *name)
+{
+ GtkWidget *result; /* Instance à renvoyer */
+
+ result = gtk_notebook_new();
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* filename = chemin d'accès complet au fichier à afficher. *
+* *
+* Description : Crée un composant 'GtkImage'. *
+* *
+* Retour : Image mise en place. *
+* *
+* Remarques : Si le chemin est libérable, il est libéré de la mémoire. *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_image(GObject *object, const char *name, gchar *filename)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ if (filename == NULL)
+ result = gtk_image_new();
+
+ else
+ {
+ result = gtk_image_new_from_file(filename);
+ g_free(filename);
+ }
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* caption = intitulé apparaissant sur le composant. *
+* *
+* Description : Crée un composant 'GtkLabel'. *
+* *
+* Retour : Champ d'indication mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_label(GObject *object, const char *name, const char *caption)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_label_new(caption);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+ gtk_misc_set_alignment(GTK_MISC(result), 0, 0.5);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* text = éventuel contenu initial du champ de saisie. *
+* *
+* Description : Crée et enregistre un composant 'GtkEntry'. *
+* *
+* Retour : Champ de saisie mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_entry(GObject *object, const char *name, const char *text)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_entry_new();
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (text != NULL)
+ gtk_entry_set_text(GTK_ENTRY(result), text);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* caption = intitulé du bouton à créer. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkButton'. *
+* *
+* Retour : Simple bouton mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_button(GObject *object, const char *name, const char *caption, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_button_new_with_label(caption);
+ GTK_WIDGET_SET_FLAGS(result, GTK_CAN_DEFAULT);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "clicked", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* stock = désignation du type de bouton GTK. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkButton'. *
+* *
+* Retour : Simple bouton mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_button_from_stock(GObject *object, const char *name, const char *stock, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_button_new_from_stock(stock);
+ GTK_WIDGET_SET_FLAGS(result, GTK_CAN_DEFAULT);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "clicked", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* image = nom de l'image stockée dans GTK. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkButton'. *
+* *
+* Retour : Simple bouton mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_button_with_img(GObject *object, const char *name, const char *image, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+ GtkWidget *render; /* Image à ajouter au bouton */
+
+ result = gtk_button_new();
+ GTK_WIDGET_SET_FLAGS(result, GTK_CAN_DEFAULT);
+
+ render = gtk_image_new_from_stock(image, GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show(render);
+ gtk_container_add(GTK_CONTAINER(result), render);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "clicked", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkComboBox'. *
+* *
+* Retour : Composant mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_combobox(GObject *object, const char *name, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_combo_box_new_text();
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "changed", handler, data);
+
+ return result;
+
+}
+
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* caption = intitulé du menu à créer. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkMenuItem'. *
+* *
+* Retour : Simple élément de menu mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_menu_item(GObject *object, const char *name, const char *caption, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_menu_item_new_with_mnemonic(caption);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "activate", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* caption = intitulé du menu à créer. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkCheckMenuItem'. *
+* *
+* Retour : Simple élément de menu mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_check_menu_item(GObject *object, const char *name, const char *caption, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_check_menu_item_new_with_mnemonic(caption);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "toggled", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* rgroup = groupe d'apparatenance pour les radios. *
+* caption = intitulé du menu à créer. *
+* handler = éventuelle fonction de sélection associée. *
+* data = données à transmettre avec l'événement si besoin. *
+* *
+* Description : Crée et enregistre un composant 'GtkRadioMenuItem'. *
+* *
+* Retour : Simple élément de menu mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_radio_menu_item(GObject *object, const char *name, GSList *rgroup, const char *caption, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_radio_menu_item_new_with_mnemonic(rgroup, caption);
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)g_object_unref);
+ }
+
+ gtk_widget_show(result);
+
+ if (handler != NULL)
+ g_signal_connect(result, "toggled", handler, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée et enregistre un composant 'GtkSeparatorMenuItem'. *
+* *
+* Retour : Simple élément de menu mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_menu_separator(void)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ result = gtk_separator_menu_item_new();
+ gtk_widget_show(result);
+
+ return result;
+
+}
diff --git a/src/gtkext/easygtk.h b/src/gtkext/easygtk.h
new file mode 100644
index 0000000..41b24e0
--- /dev/null
+++ b/src/gtkext/easygtk.h
@@ -0,0 +1,80 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * easygtk.h - prototypes pour la mise en place rapide de composants GTK
+ *
+ * Copyright (C) 2008 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _EASYGTK_H
+#define _EASYGTK_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Met en place un aligement dont les bordures sont à ajuster. */
+GtkWidget *qck_create_padded_alignment(guint, guint, guint, guint);
+
+/* Met en place une frame. */
+GtkWidget *qck_create_frame(const char *, GtkWidget **, guint, guint, guint, guint);
+
+/* Met en place un support à onglets. */
+GtkWidget *qck_create_notebook(GObject *, const char *);
+
+/* Crée un composant 'GtkImage'. */
+GtkWidget *qck_create_image(GObject *, const char *, gchar *);
+
+/* Crée un composant 'GtkLabel'. */
+GtkWidget *qck_create_label(GObject *, const char *, const char *);
+
+/* Crée et enregistre un composant 'GtkEntry'. */
+GtkWidget *qck_create_entry(GObject *, const char *, const char *);
+
+/* Crée et enregistre un composant 'GtkButton'. */
+GtkWidget *qck_create_button(GObject *, const char *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkButton'. */
+GtkWidget *qck_create_button_from_stock(GObject *, const char *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkButton'. */
+GtkWidget *qck_create_button_with_img(GObject *, const char *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkComboBox'. */
+GtkWidget *qck_create_combobox(GObject *, const char *, GCallback, gpointer);
+
+
+
+
+/* Crée et enregistre un composant 'GtkMenuItem'. */
+GtkWidget *qck_create_menu_item(GObject *, const char *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkCheckMenuItem'. */
+GtkWidget *qck_create_check_menu_item(GObject *, const char *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkRadioMenuItem'. */
+GtkWidget *qck_create_radio_menu_item(GObject *, const char *, GSList *, const char *, GCallback, gpointer);
+
+/* Crée et enregistre un composant 'GtkSeparatorMenuItem'. */
+GtkWidget *qck_create_menu_separator(void);
+
+
+
+
+#endif /* _EASYGTK_H */
diff --git a/src/gtkext/gtkdockpanel.c b/src/gtkext/gtkdockpanel.c
index f48f31a..e7bd14b 100644
--- a/src/gtkext/gtkdockpanel.c
+++ b/src/gtkext/gtkdockpanel.c
@@ -624,13 +624,13 @@ static gboolean gtk_dock_panel_update_title(GtkNotebook *notebook, GtkNotebookPa
char *str; /* Valeur finale reconstituée */
- printf("[%p] list len :: %u / %u\n", data, index, g_list_length(GTK_DOCK_PANEL(data)->ditems));
+ //printf("[%p] list len :: %u / %u\n", data, index, g_list_length(GTK_DOCK_PANEL(data)->ditems));
if (index >= g_list_length(GTK_DOCK_PANEL(data)->ditems)) return FALSE;
- printf(" >> ditem = %p\n", g_list_nth_data(GTK_DOCK_PANEL(data)->ditems, index));
+ //printf(" >> ditem = %p\n", g_list_nth_data(GTK_DOCK_PANEL(data)->ditems, index));
- printf(" >> index :: %u vs %d\n", index, gtk_notebook_get_current_page(GTK_DOCK_PANEL(data)->notebook));
+ //printf(" >> index :: %u vs %d\n", index, gtk_notebook_get_current_page(GTK_DOCK_PANEL(data)->notebook));
ditem = GTK_DOCK_ITEM(g_list_nth_data(GTK_DOCK_PANEL(data)->ditems, index));
diff --git a/src/gtkext/gtksnippet.c b/src/gtkext/gtksnippet.c
index a48baf2..39d2949 100644
--- a/src/gtkext/gtksnippet.c
+++ b/src/gtkext/gtksnippet.c
@@ -156,29 +156,10 @@ static void gtk_snippet_paint(GtkSnippet *snippet);
static void gtk_snippet_destroy(GtkObject *object);
-GtkType
-gtk_snippet_get_type(void)
-{
- static GtkType gtk_snippet_type = 0;
-
-
- if (!gtk_snippet_type) {
- static const GtkTypeInfo gtk_snippet_info = {
- "GtkSnippet",
- sizeof(GtkSnippet),
- sizeof(GtkSnippetClass),
- (GtkClassInitFunc) gtk_snippet_class_init,
- (GtkObjectInitFunc) gtk_snippet_init,
- NULL,
- NULL,
- (GtkClassInitFunc) NULL
- };
- gtk_snippet_type = gtk_type_unique(GTK_TYPE_WIDGET, &gtk_snippet_info);
- }
+
+G_DEFINE_TYPE(GtkSnippet, gtk_snippet, GTK_TYPE_WIDGET)
- return gtk_snippet_type;
-}
GtkWidget * gtk_snippet_new(void)
@@ -688,6 +669,7 @@ void gtk_snippet_add_line(GtkSnippet *snippet, const code_line_info *line)
void gtk_snippet_build_content(GtkSnippet *snippet)
{
+#if 0
const uint8_t *exe_content; /* Contenu binaire global */
off_t max_bin_len; /* Taille max du code brut */
unsigned int i; /* Boucle de traitement */
@@ -854,7 +836,7 @@ void gtk_snippet_build_content(GtkSnippet *snippet)
pango_layout_iter_free(iter);
//gtk_widget_set_size_request(GTK_WIDGET(snippet), width + 2 * MARGIN_SPACE + snippet->line_height, height);
-
+#endif
}
diff --git a/src/gtkext/support.c b/src/gtkext/support.c
new file mode 100644
index 0000000..67e7605
--- /dev/null
+++ b/src/gtkext/support.c
@@ -0,0 +1,92 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * support.c - recherche des chemins d'accès aux fichiers
+ *
+ * Copyright (C) 2008-2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "support.h"
+
+
+#include <glib.h>
+#include <string.h>
+
+
+
+/* Liste des répertoires contenant des images */
+static GList *pixmaps_directories = NULL;
+
+
+
+/******************************************************************************
+* *
+* Paramètres : directory = nouveau répertoire à parcourir. *
+* *
+* Description : Ajoute un répertoire à la liste des répertoires d'images. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void add_pixmap_directory(const char *directory)
+{
+ pixmaps_directories = g_list_prepend(pixmaps_directories,
+ strdup(directory));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : filename = nom de fichier seul comme indice. *
+* *
+* Description : Trouve le chemin d'accès complet à un fichier donné. *
+* *
+* Retour : Chemin trouvé à libérer de la mémoire ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+gchar *find_pixmap_file(const char *filename)
+{
+ gchar *result; /* Trouvaille à renvoyer */
+ GList *iter; /* Boucle de parcours */
+
+ result = NULL;
+
+ for (iter = pixmaps_directories; iter != NULL && result == NULL; iter = iter->next)
+ {
+ result = g_strdup_printf("%s%s%s", (gchar *)iter->data,
+ G_DIR_SEPARATOR_S, filename);
+
+ if (!g_file_test(result, G_FILE_TEST_EXISTS))
+ {
+ g_free(result);
+ result = NULL;
+ }
+
+ }
+
+ return result;
+
+}
diff --git a/src/gtkext/support.h b/src/gtkext/support.h
new file mode 100644
index 0000000..9d3373b
--- /dev/null
+++ b/src/gtkext/support.h
@@ -0,0 +1,41 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * support.h - prototypes pour la recherche des chemins d'accès aux fichiers
+ *
+ * Copyright (C) 2008-2009 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _SUPPORT_H
+#define _SUPPORT_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Ajoute un répertoire à la liste des répertoires d'images. */
+void add_pixmap_directory(const char *);
+
+/* Trouve le chemin d'accès complet à un fichier donné. */
+gchar *find_pixmap_file(const char *);
+
+
+
+#endif /* _SUPPORT_H */