summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-01-27 22:44:06 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-01-27 22:44:06 (GMT)
commit24013fb80fc02d8918aea51ee169d6521c74ee42 (patch)
treea3b645be6a97abcd6c327c79b07bfde4a7db5dd2
parent5c7ea8e2137e4e5bb2887de0d1ffd8a0b277636e (diff)
Updated code and removed some GCC warnings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@333 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog12
-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
5 files changed, 67 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ae76a19..57a2fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
13-01-27 Cyrille Bagard <nocbos@gmail.com>
+ * src/dialogs/goto.c:
+ Update code.
+
+ * src/gtkext/easygtk.c:
+ * src/gtkext/easygtk.h:
+ Create combo boxes without entry.
+
+ * src/gui/tb/source.c:
+ Update code and remove some GCC warnings.
+
+13-01-27 Cyrille Bagard <nocbos@gmail.com>
+
* src/analysis/decomp/decompiler.c:
* src/analysis/decomp/reduce.c:
* src/analysis/decomp/reduce.h:
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
}