summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialogs/goto.c2
-rw-r--r--src/gtkext/easygtk.c37
-rw-r--r--src/gtkext/easygtk.h2
-rw-r--r--src/gui/tb/source.c26
4 files changed, 55 insertions, 12 deletions
diff --git a/src/dialogs/goto.c b/src/dialogs/goto.c
index d280809..18c364d 100644
--- a/src/dialogs/goto.c
+++ b/src/dialogs/goto.c
@@ -168,7 +168,7 @@ GtkWidget *create_goto_dialog(GtkWindow *parent)
label = qck_create_label(NULL, NULL, _("Enter the value of the target address:"));
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- combobox = qck_create_combobox2(G_OBJECT(result), "combobox", NULL, NULL);
+ combobox = qck_create_combobox_with_entry(G_OBJECT(result), "combobox", NULL, NULL);
gtk_box_pack_start(GTK_BOX(vbox), combobox, TRUE, TRUE, 0);
entry = gtk_bin_get_child(GTK_BIN(combobox));
diff --git a/src/gtkext/easygtk.c b/src/gtkext/easygtk.c
index 29fdec6..2d000e7 100644
--- a/src/gtkext/easygtk.c
+++ b/src/gtkext/easygtk.c
@@ -529,6 +529,43 @@ GtkWidget *qck_create_combobox2(GObject *object, const char *name, GCallback han
{
GtkWidget *result; /* Résultat à renvoyer */
+ result = gtk_combo_box_text_new();
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ g_object_ref(G_OBJECT(result));
+ g_object_set_data_full(object, name, result, (GDestroyNotify)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. *
+* 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_with_entry(GObject *object, const char *name, GCallback handler, gpointer data)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
result = gtk_combo_box_text_new_with_entry();
if (G_IS_OBJECT(object) && name != NULL)
diff --git a/src/gtkext/easygtk.h b/src/gtkext/easygtk.h
index e811274..815e5c2 100644
--- a/src/gtkext/easygtk.h
+++ b/src/gtkext/easygtk.h
@@ -74,6 +74,8 @@ GtkWidget *qck_create_combobox(GObject *, const char *, GCallback, gpointer);
/* Crée et enregistre un composant 'GtkComboBox'. */
GtkWidget *qck_create_combobox2(GObject *, const char *, GCallback, gpointer);
+/* Crée et enregistre un composant 'GtkComboBox'. */
+GtkWidget *qck_create_combobox_with_entry(GObject *, const char *, GCallback, gpointer);
/* Crée et enregistre un composant 'GtkMenuItem'. */
GtkWidget *qck_create_menu_item(GObject *, const char *, const char *, GCallback, gpointer);
diff --git a/src/gui/tb/source.c b/src/gui/tb/source.c
index 109cbfa..1c67cc6 100644
--- a/src/gui/tb/source.c
+++ b/src/gui/tb/source.c
@@ -85,7 +85,7 @@ static GtkWidget *build_source_tb_widget(GObject *ref)
label = qck_create_label(G_OBJECT(result), "label", _(" Source: "));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- comboboxentry = qck_create_combobox(G_OBJECT(result), "combo",
+ comboboxentry = qck_create_combobox2(G_OBJECT(result), "combo",
G_CALLBACK(change_selected_source), ref);
gtk_box_pack_start(GTK_BOX(hbox), comboboxentry, TRUE, TRUE, 0);
@@ -138,7 +138,7 @@ GEditorItem *create_source_tb_item(GObject *ref)
static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
{
- GtkComboBox *combo; /* Liste de sélection */
+ GtkComboBoxText *combo; /* Liste de sélection */
GtkTreeModel *model; /* Gestionnaire d'éléments */
GtkTreeIter iter; /* Boucle de parcours #2 */
GExeFormat *format; /* Format d'exécutable associé */
@@ -146,17 +146,20 @@ static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
size_t defsrc; /* Fichier source principal */
const char * const *files; /* Liste de fichiers source */
size_t i; /* Boucle de parcours #2 */
- return; /* FIXME */
+
+ combo = GTK_COMBO_BOX_TEXT(g_object_get_data(G_OBJECT(item->widget), "combo"));
+
/* Réinitialisation */
- combo = GTK_COMBO_BOX(g_object_get_data(G_OBJECT(item->widget), "combo"));
+ g_signal_handlers_block_by_func(combo, G_CALLBACK(change_selected_source), item->ref);
- /* TODO : signal */
+ /* FIXME : 3.0 */
+ //gtk_combo_box_text_remove_all(combo);
- model = gtk_combo_box_get_model(combo);
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
while (gtk_tree_model_get_iter_first(model, &iter))
- gtk_combo_box_remove_text(combo, 0);
+ gtk_combo_box_text_remove(combo, 0);
/* Inscriptions */
@@ -164,13 +167,13 @@ static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
files = g_binary_format_get_source_files(G_BIN_FORMAT(format), &count, &defsrc);
for (i = 0; i < count; i++)
- gtk_combo_box_append_text(combo, files[i]);
+ gtk_combo_box_text_append_text(combo, files[i]);
/* Réactivation */
- /* TODO : signal */
+ g_signal_handlers_unblock_by_func(combo, G_CALLBACK(change_selected_source), item->ref);
- gtk_combo_box_set_active(combo, defsrc);
+ //gtk_combo_box_set_active(combo, defsrc);
}
@@ -210,6 +213,7 @@ static void update_source_item_view(GEditorItem *item, GtkViewPanel *view)
static void change_selected_source(GtkComboBox *widget, GObject *ref)
{
+#if 0
gint index; /* Nouvelle source ciblée */
GLoadedBinary *binary; /* Binaire chargé courant */
GCodeBuffer *buffer; /* Nouveau tampon à présenter */
@@ -224,5 +228,5 @@ static void change_selected_source(GtkComboBox *widget, GObject *ref)
if (GTK_IS_BUFFER_VIEW(view))
gtk_buffer_view_attach_buffer(view, buffer,
g_loaded_binary_display_decomp_lines(binary), NULL);
-
+#endif
}