From 8afd8490dcb695c5e1ab7c55d2305e6af7c97212 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 10 Oct 2015 00:31:50 +0000 Subject: Fixed all remaining gtk warnings about deprecated declarations. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@590 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 14 +++++++ plugins/ropgadgets/select.c | 15 +++----- src/dialogs/bookmark.c | 15 +++----- src/dialogs/export.c | 52 +++++++++++-------------- src/dialogs/plugins.c | 36 ++++++------------ src/dialogs/shellcode.c | 92 +++++++++++++++++---------------------------- src/dialogs/storage.c | 15 +++----- src/gtkext/easygtk.c | 63 ++++++++++++++++++++----------- src/gtkext/easygtk.h | 12 ++++-- src/gui/panels/panel.c | 26 ++++++------- src/panels/registers.c | 7 +--- 11 files changed, 165 insertions(+), 182 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43f4374..566ba21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +15-10-10 Cyrille Bagard + + * plugins/ropgadgets/select.c: + * src/dialogs/bookmark.c: + * src/dialogs/export.c: + * src/dialogs/plugins.c: + * src/dialogs/shellcode.c: + * src/dialogs/storage.c: + * src/gtkext/easygtk.c: + * src/gtkext/easygtk.h: + * src/gui/panels/panel.c: + * src/panels/registers.c: + Fix all remaining gtk warnings about deprecated declarations. + 15-10-09 Cyrille Bagard * src/format/elf/elf.c: diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index 2497dd1..3ce04de 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -401,7 +401,6 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref) { GtkWidget *vbox; /* Support principal */ GtkWidget *frame; /* Support avec encadrement */ - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *sub_vbox; /* Division verticale */ GtkWidget *radio; /* Choix du type d'entrée */ GtkWidget *combobox; /* Sélection du binaire interne*/ @@ -415,12 +414,11 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref) /* Fichier de sortie */ - frame = qck_create_frame(_("Input binary"), &alignment, 0, 0, 12, 8); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); - sub_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(sub_vbox); - gtk_container_add(GTK_CONTAINER(alignment), sub_vbox); + + frame = qck_create_frame(_("Input binary"), sub_vbox, 0, 0, 12, 8); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); radio = qck_create_radio_button(ref, "loaded_as_input", _("Use a binary from the current project:"), NULL, G_CALLBACK(on_input_type_toggle), ref); @@ -452,12 +450,11 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref) /* Fichier de sortie */ - frame = qck_create_frame(_("Ouput results"), &alignment, 0, 0, 12, 8); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); - sub_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(sub_vbox); - gtk_container_add(GTK_CONTAINER(alignment), sub_vbox); + + frame = qck_create_frame(_("Ouput results"), sub_vbox, 0, 0, 12, 8); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); checkbutton = qck_create_check_button(ref, "use_output", _("Save selected ROP gadgets in a file:"), diff --git a/src/dialogs/bookmark.c b/src/dialogs/bookmark.c index abff500..b171087 100644 --- a/src/dialogs/bookmark.c +++ b/src/dialogs/bookmark.c @@ -148,7 +148,6 @@ GtkWidget *create_bookmark_dialog(GtkWindow *parent, const vmpa2t *addr) GtkWidget *result; /* Fenêtre à renvoyer */ GtkWidget *dlgvbox; /* Zone principale de la boîte */ GtkWidget *vbox; /* Support à construire #1 */ - GtkWidget *alignment; /* Support véritable interne */ GtkWidget *frame; /* Support avec encadrement */ GtkWidget *sub_vbox; /* Support à construire #2 */ GtkWidget *hbox; /* Support à construire #3 */ @@ -173,12 +172,11 @@ GtkWidget *create_bookmark_dialog(GtkWindow *parent, const vmpa2t *addr) /* Localisation dans l'espace */ - frame = qck_create_frame(_("Localisation"), &alignment, 8, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - sub_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); gtk_widget_show(sub_vbox); - gtk_container_add(GTK_CONTAINER(alignment), sub_vbox); + + frame = qck_create_frame(_("Localisation"), sub_vbox, 8, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); /* 1) Adresse */ @@ -210,11 +208,10 @@ GtkWidget *create_bookmark_dialog(GtkWindow *parent, const vmpa2t *addr) /* Commentaire éventuel */ - frame = qck_create_frame(_("Optional comment"), &alignment, 8, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - entry = qck_create_entry(G_OBJECT(result), "comment", NULL); - gtk_container_add(GTK_CONTAINER(alignment), entry); + + frame = qck_create_frame(_("Optional comment"), entry, 8, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); /* Zone de validation */ diff --git a/src/dialogs/export.c b/src/dialogs/export.c index 16622a9..726b16d 100644 --- a/src/dialogs/export.c +++ b/src/dialogs/export.c @@ -310,7 +310,6 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref) static void register_format_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal #1 */ GtkWidget *hbox; /* Support principal #2 */ GtkWidget *label; /* Etiquette d'indication */ @@ -318,11 +317,9 @@ static void register_format_panel(GtkAssistant *assistant) GtkWidget *options; /* Zone d'options */ GtkWidget *content; /* Accueil desdites options */ - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Format de sortie */ @@ -341,7 +338,10 @@ static void register_format_panel(GtkAssistant *assistant) /* Eventuelles options */ - options = qck_create_frame(_("Options"), &content, 0, 12, 12, 0); + content = gtk_event_box_new(); + gtk_widget_show(content); + + options = qck_create_frame(_("Options"), content, 0, 12, 12, 0); gtk_box_pack_start(GTK_BOX(vbox), options, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(assistant), "options", content); @@ -350,11 +350,11 @@ static void register_format_panel(GtkAssistant *assistant) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 1); - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Format")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_INTRO); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Format")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_INTRO); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); } @@ -610,27 +610,22 @@ static void forbid_html_empty_entry(GtkEntry *_entry, GtkAssistant *assistant) static void register_content_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal */ GtkWidget *frame; /* Support avec encadrement */ - GtkWidget *subalign; /* Disposition des options */ GtkWidget *sub_vbox; /* Division verticale */ GtkWidget *checkbutton; /* Coche pour une option */ - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Eléments à afficher */ - frame = qck_create_frame(_("Items to display"), &subalign, 0, 12, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - sub_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); gtk_widget_show(sub_vbox); - gtk_container_add(GTK_CONTAINER(subalign), sub_vbox); + + frame = qck_create_frame(_("Items to display"), sub_vbox, 0, 12, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); checkbutton = qck_create_check_button(G_OBJECT(assistant), "physical_off", _("Physical offset"), NULL, NULL); gtk_box_pack_start(GTK_BOX(sub_vbox), checkbutton, FALSE, FALSE, 0); @@ -646,11 +641,11 @@ static void register_content_panel(GtkAssistant *assistant) /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Exported content")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Exported content")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); } @@ -675,7 +670,6 @@ static void register_content_panel(GtkAssistant *assistant) static void register_output_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal #1 */ GtkWidget *label; /* Etiquette d'indication */ GtkWidget *hbox; /* Support principal #2 */ @@ -684,11 +678,9 @@ static void register_output_panel(GtkAssistant *assistant) GLoadedBinary *binary; /* Binaire chargé à parcourir */ const char *filename; /* Chemin d'accès par défaut */ - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Fichier de sortie */ @@ -707,11 +699,11 @@ static void register_output_panel(GtkAssistant *assistant) /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Output")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Output")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_CONFIRM); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); /* Choix par défaut */ diff --git a/src/dialogs/plugins.c b/src/dialogs/plugins.c index 93ea5ec..09a3e26 100644 --- a/src/dialogs/plugins.c +++ b/src/dialogs/plugins.c @@ -85,19 +85,16 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par GtkWidget *label9; GtkWidget *label10; GtkWidget *frame1; - GtkWidget *alignment3; GtkWidget *label12; GtkWidget *label11; GtkWidget *label3; GtkWidget *hseparator2; GtkWidget *hbuttonbox1; GtkWidget *button1; - GtkWidget *alignment1; GtkWidget *hbox1; GtkWidget *image1; GtkWidget *label1; GtkWidget *button2; - GtkWidget *alignment2; GtkWidget *hbox2; GtkWidget *image2; GtkWidget *label2; @@ -138,7 +135,7 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_widget_show(vbox2); gtk_box_pack_start(GTK_BOX(hbox3), vbox2, FALSE, FALSE, 0); - vbuttonbox1 = gtk_vbutton_box_new(); + vbuttonbox1 = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); gtk_widget_show(vbuttonbox1); gtk_box_pack_start(GTK_BOX(vbox2), vbuttonbox1, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbuttonbox1), 8); @@ -161,11 +158,11 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_widget_show(image4); gtk_container_add(GTK_CONTAINER(button8), image4); - hseparator1 = gtk_hseparator_new(); + hseparator1 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_widget_show(hseparator1); gtk_box_pack_start(GTK_BOX(vbox2), hseparator1, FALSE, FALSE, 0); - vbuttonbox2 = gtk_vbutton_box_new(); + vbuttonbox2 = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); gtk_widget_show(vbuttonbox2); gtk_box_pack_start(GTK_BOX(vbox2), vbuttonbox2, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbuttonbox2), 8); @@ -238,14 +235,11 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_box_pack_start(GTK_BOX(hbox4), frame1, TRUE, TRUE, 0); gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE); - alignment3 = gtk_alignment_new(0.5, 0.5, 1, 1); - gtk_widget_show(alignment3); - gtk_container_add(GTK_CONTAINER(frame1), alignment3); - gtk_alignment_set_padding(GTK_ALIGNMENT(alignment3), 0, 0, 12, 0); - label12 = gtk_label_new(_("label12")); + qck_set_alignment(label12, GTK_ALIGN_CENTER, GTK_ALIGN_CENTER); + qck_set_margins(label12, 0, 0, 12, 0); gtk_widget_show(label12); - gtk_container_add(GTK_CONTAINER(alignment3), label12); + gtk_container_add(GTK_CONTAINER(frame1), label12); label11 = gtk_label_new(_("Action")); gtk_widget_show(label11); @@ -257,11 +251,11 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_expander_set_label_widget(GTK_EXPANDER(expander1), label3); gtk_label_set_use_markup(GTK_LABEL(label3), TRUE); - hseparator2 = gtk_hseparator_new(); + hseparator2 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_widget_show(hseparator2); gtk_box_pack_start(GTK_BOX(vbox1), hseparator2, FALSE, FALSE, 0); - hbuttonbox1 = gtk_hbutton_box_new(); + hbuttonbox1 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_widget_show(hbuttonbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox1, FALSE, FALSE, 0); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox1), GTK_BUTTONBOX_END); @@ -271,13 +265,10 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_widget_show(button1); gtk_container_add(GTK_CONTAINER(hbuttonbox1), button1); - alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0); - gtk_widget_show(alignment1); - gtk_container_add(GTK_CONTAINER(button1), alignment1); - hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); + qck_set_alignment(hbox1, GTK_ALIGN_CENTER, GTK_ALIGN_CENTER); gtk_widget_show(hbox1); - gtk_container_add(GTK_CONTAINER(alignment1), hbox1); + gtk_container_add(GTK_CONTAINER(button1), hbox1); image1 = gtk_image_new_from_icon_name("gtk-apply", GTK_ICON_SIZE_BUTTON); gtk_widget_show(image1); @@ -291,13 +282,10 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par gtk_widget_show(button2); gtk_container_add(GTK_CONTAINER(hbuttonbox1), button2); - alignment2 = gtk_alignment_new(0.5, 0.5, 0, 0); - gtk_widget_show(alignment2); - gtk_container_add(GTK_CONTAINER(button2), alignment2); - hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); + qck_set_alignment(hbox2, GTK_ALIGN_CENTER, GTK_ALIGN_CENTER); gtk_widget_show(hbox2); - gtk_container_add(GTK_CONTAINER(alignment2), hbox2); + gtk_container_add(GTK_CONTAINER(button2), hbox2); image2 = gtk_image_new_from_icon_name("gtk-cancel", GTK_ICON_SIZE_BUTTON); gtk_widget_show(image2); diff --git a/src/dialogs/shellcode.c b/src/dialogs/shellcode.c index eb727b0..36146d1 100644 --- a/src/dialogs/shellcode.c +++ b/src/dialogs/shellcode.c @@ -245,17 +245,14 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref) static void register_bincode_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal */ GtkWidget *scrolledwindow; /* Support avec défilement */ GtkWidget *textview; /* Zone de texte */ GtkWidget *label; /* Etiquette du bilan */ - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Réception du code */ @@ -282,11 +279,11 @@ static void register_bincode_panel(GtkAssistant *assistant) /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Code")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_INTRO); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Code")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_INTRO); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); } @@ -497,21 +494,13 @@ static void on_bincode_changed(GtkTextBuffer *textbuffer, GObject *ref) static void register_archi_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal */ GtkWidget *label; /* Etiquette d'indication */ GtkWidget *combobox; /* Sélection du format */ - - - - - - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Choix de l'architecture */ @@ -540,11 +529,11 @@ static void register_archi_panel(GtkAssistant *assistant) /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Architecture")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Architecture")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_CONFIRM); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); } @@ -576,7 +565,6 @@ static void register_archi_panel(GtkAssistant *assistant) static void register_output_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal #1 */ GtkWidget *hbox; /* Support principal #2 */ GtkWidget *label; /* Etiquette d'indication */ @@ -586,11 +574,9 @@ static void register_output_panel(GtkAssistant *assistant) GLoadedBinary *binary; /* Binaire chargé à parcourir */ const char *filename; /* Chemin d'accès par défaut */ - alignment = qck_create_padded_alignment(8, 8, 8, 8); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Format de sortie */ @@ -625,11 +611,11 @@ static void register_output_panel(GtkAssistant *assistant) /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Output")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_CONTENT); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Output")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); /* Choix par défaut */ /* @@ -736,70 +722,62 @@ static void on_filename_browsing_clicked(GtkButton *button, GObject *ref) static void register_content_panel(GtkAssistant *assistant) { - GtkWidget *alignment; /* Disposition sur le support */ GtkWidget *vbox; /* Support principal */ GtkWidget *frame; /* Support avec encadrement */ - GtkWidget *subalign; /* Disposition des options */ - - GtkWidget *vbox3; + GtkWidget *subvbox; /* Support secondaire */ GtkWidget *checkbutton; /* Coche pour une option */ - GtkWidget *vbox4; - - alignment = qck_create_padded_alignment(8, 8, 8, 8); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + qck_set_margins(vbox, 8, 8, 8, 8); gtk_widget_show(vbox); - gtk_container_add(GTK_CONTAINER(alignment), vbox); /* Lignes à traiter */ - frame = qck_create_frame(_("Lines to process"), &subalign, 0, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + subvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + gtk_widget_show(subvbox); - vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); - gtk_widget_show(vbox3); - gtk_container_add(GTK_CONTAINER(subalign), vbox3); + frame = qck_create_frame(_("Lines to process"), subvbox, 0, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); checkbutton = qck_create_check_button(G_OBJECT(assistant), "prologue", _("Prologue"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox3), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); checkbutton = qck_create_check_button(G_OBJECT(assistant), "code", _("Code"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox3), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); checkbutton = qck_create_check_button(G_OBJECT(assistant), "comments", _("Comments"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox3), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); /* Eléments à afficher */ - frame = qck_create_frame(_("Items to display"), &subalign, 0, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + subvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + gtk_widget_show(subvbox); - vbox4 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); - gtk_widget_show(vbox4); - gtk_container_add(GTK_CONTAINER(subalign), vbox4); + frame = qck_create_frame(_("Items to display"), subvbox, 0, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); checkbutton = qck_create_check_button(G_OBJECT(assistant), "virtual_addr", _("Virtual address"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox4), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); checkbutton = qck_create_check_button(G_OBJECT(assistant), "binary_code", _("Binary code"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox4), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); checkbutton = qck_create_check_button(G_OBJECT(assistant), "assembly_code", _("Assembly code"), NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox4), checkbutton, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(subvbox), checkbutton, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE); /* Intégration */ - gtk_assistant_append_page(assistant, alignment); - gtk_assistant_set_page_title(assistant, alignment, _("Exported content")); - gtk_assistant_set_page_type(assistant, alignment, GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_append_page(assistant, vbox); + gtk_assistant_set_page_title(assistant, vbox, _("Exported content")); + gtk_assistant_set_page_type(assistant, vbox, GTK_ASSISTANT_PAGE_CONFIRM); - gtk_assistant_set_page_complete(assistant, alignment, TRUE); + gtk_assistant_set_page_complete(assistant, vbox, TRUE); } diff --git a/src/dialogs/storage.c b/src/dialogs/storage.c index 614a46c..2bf1e2e 100644 --- a/src/dialogs/storage.c +++ b/src/dialogs/storage.c @@ -186,7 +186,6 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent) GtkWidget *content; /* Zone principale de la boîte */ GtkWidget *vbox; /* Support à construire #1 */ GtkWidget *frame; /* Support avec encadrement */ - GtkWidget *subalign; /* Disposition des options */ GtkWidget *hbox; /* Support à construire #2 */ GtkWidget *label; /* Etiquette d'indication */ GtkWidget *entry; /* Zone de saisie de texte */ @@ -217,12 +216,11 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent) /* Définition de l'identité de l'utilisateur */ - frame = qck_create_frame(_("Identity"), &subalign, 0, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); gtk_widget_show(hbox); - gtk_container_add(GTK_CONTAINER(subalign), hbox); + + frame = qck_create_frame(_("Identity"), hbox, 0, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); label = qck_create_label(NULL, NULL, _("Username: ")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -232,12 +230,11 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent) /* Définition du serveur distant */ - frame = qck_create_frame(_("Server to contact"), &subalign, 0, 0, 12, 0); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); - subvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(subvbox); - gtk_container_add(GTK_CONTAINER(subalign), subvbox); + + frame = qck_create_frame(_("Server to contact"), subvbox, 0, 0, 12, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); checkbutton = qck_create_check_button(G_OBJECT(result), "use_remote", _("Use a remote server:"), diff --git a/src/gtkext/easygtk.c b/src/gtkext/easygtk.c index 77b29bd..27377b9 100644 --- a/src/gtkext/easygtk.c +++ b/src/gtkext/easygtk.c @@ -35,40 +35,61 @@ static void _finish_button_with_img(GtkWidget *, GObject *, const char *, GtkWid /****************************************************************************** * * -* 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. * +* Paramètres : widget = composant graphique visé par la procédure. * +* xalign = alignement horizontal à appliquer. * +* yalign = alignement vertical à appliquer. * * * -* Description : Met en place un aligement dont les bordures sont à ajuster. * +* Description : Aligne un composant GTK par rapport à son parent. * * * -* Retour : Composant 'GtkWidget' ici créé. * +* Retour : - * * * * Remarques : - * * * ******************************************************************************/ -GtkWidget *qck_create_padded_alignment(guint pt, guint pb, guint pl, guint pr) +void qck_set_alignment(GtkWidget *widget, GtkAlign xalign, GtkAlign yalign) { - GtkWidget *result; /* Instance à renvoyer */ + gtk_widget_set_halign(widget, xalign); + gtk_widget_set_valign(widget, yalign); - 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 : widget = composant graphique visé par la procédure. * +* 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 : Définit des bordures extérieures à appliquer à un composant. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void qck_set_margins(GtkWidget *widget, guint pt, guint pb, guint pl, guint pr) +{ + gtk_widget_set_margin_top(widget, pt); + gtk_widget_set_margin_bottom(widget, pb); + + gtk_widget_set_margin_start(widget, pl); + gtk_widget_set_margin_end(widget, pr); } /****************************************************************************** * * -* 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. * +* Paramètres : caption = contenu de l'étiqutte à placer. * +* content = composant en place à poser sur le conteneur. * +* 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. * * * @@ -78,7 +99,7 @@ GtkWidget *qck_create_padded_alignment(guint pt, guint pb, guint pl, guint pr) * * ******************************************************************************/ -GtkWidget *qck_create_frame(const char *caption, GtkWidget **alignment, guint pt, guint pb, guint pl, guint pr) +GtkWidget *qck_create_frame(const char *caption, GtkWidget *content, guint pt, guint pb, guint pl, guint pr) { GtkWidget *result; /* Instance à renvoyer */ GtkWidget *label; /* Etiquette à utiliser */ @@ -92,8 +113,8 @@ GtkWidget *qck_create_frame(const char *caption, GtkWidget **alignment, guint pt 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); + qck_set_margins(content, pt, pb, pl, pr); + gtk_container_add(GTK_CONTAINER(result), content); return result; diff --git a/src/gtkext/easygtk.h b/src/gtkext/easygtk.h index 13cb7fd..02f2f18 100644 --- a/src/gtkext/easygtk.h +++ b/src/gtkext/easygtk.h @@ -31,12 +31,18 @@ /* Conversion anonyme */ #define ALLOC_2_REQ(a) ((GtkRequisition []){ { .width = (a)->width, .height = (a)->height }}) +/* Transition vers GTK-3.x claire */ +#define HAS_H_ORIENTATION(wid) gtk_orientable_get_orientation(GTK_ORIENTABLE(wid)) == GTK_ORIENTATION_HORIZONTAL -/* Met en place un aligement dont les bordures sont à ajuster. */ -GtkWidget *qck_create_padded_alignment(guint, guint, guint, guint); + +/* Aligne un composant GTK par rapport à son parent. */ +void qck_set_alignment(GtkWidget *, GtkAlign, GtkAlign); + +/* Définit des bordures extérieures à appliquer à un composant. */ +void qck_set_margins(GtkWidget *, guint, guint, guint, guint); /* Met en place une frame. */ -GtkWidget *qck_create_frame(const char *, GtkWidget **, guint, guint, guint, guint); +GtkWidget *qck_create_frame(const char *, GtkWidget *, guint, guint, guint, guint); /* Met en place un support à onglets. */ GtkWidget *qck_create_notebook(GObject *, const char *); diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c index 265fcca..a9e3028 100644 --- a/src/gui/panels/panel.c +++ b/src/gui/panels/panel.c @@ -44,10 +44,6 @@ -/* Transition vers GTK-3.x claire */ -#define GTK_IS_HPANED(p) gtk_orientable_get_orientation(GTK_ORIENTABLE(p)) == GTK_ORIENTATION_HORIZONTAL - - /* Support de fond pour les composants. */ static GtkWidget *_support; static panel_node *_nodes = NULL; @@ -426,7 +422,7 @@ GtkWidget *init_panels2(GCallback handler, gpointer data) { GtkWidget *result; /* Support à retourner */ - result = qck_create_padded_alignment(0, 0, 0, 0); + result = gtk_event_box_new(); gtk_widget_show(result); g_signal_connect(result, "size-allocate", G_CALLBACK(auto_resize_panels), NULL); @@ -570,9 +566,9 @@ static void switch_panel_node_into_paned(panel_node *current, bool horiz, bool f current->station = NULL; if (horiz) - current->paned = gtk_hpaned_new(); + current->paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); else - current->paned = gtk_vpaned_new(); + current->paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); gtk_widget_show(current->paned); @@ -980,7 +976,7 @@ static void get_panel_node_size_request(const panel_node *node, GtkRequisition * { gtk_widget_style_get(node->paned, "handle-size", &handle_size, NULL); - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) { req->width = handle_size; req->height = 0; @@ -1045,7 +1041,7 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Le premier noeud est le principal... */ if (node->first == main_node) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) position = (space->width * MAIN_PART_PERCENT) / 100; else position = (space->height * MAIN_PART_PERCENT) / 100; @@ -1058,7 +1054,7 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Le second noeud est le principal... */ else if (node->second == main_node) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) position = space->width - (space->width * MAIN_PART_PERCENT) / 100; else position = space->height - (space->height * MAIN_PART_PERCENT) / 100; @@ -1071,7 +1067,7 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Les éléments sont quelconques... */ else { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) position = space->width / 2; else position = space->height / 2; @@ -1088,14 +1084,14 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Correctifs éventuels pour les petits composants */ if (node->first == main_node) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) second_req.width = MAX(second_req.width, (space->width * MIN_PART_PERCENT) / 100); else second_req.height = MAX(second_req.height, (space->height * MIN_PART_PERCENT) / 100); } else if (node->second == main_node) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) first_req.width = MAX(first_req.width, (space->width * MIN_PART_PERCENT) / 100); else first_req.height = MAX(first_req.height, (space->height * MIN_PART_PERCENT) / 100); @@ -1104,7 +1100,7 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Une partie principale arrive en premier */ if (!can_lower && can_upper) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) position = MAX(position, space->width - second_req.width - handle_size); else position = MAX(position, space->height - second_req.height - handle_size); @@ -1113,7 +1109,7 @@ static void set_panel_node_size_request(const panel_node *node, const GtkRequisi /* Une partie principale arrive en second */ else if (can_lower && !can_upper) { - if (GTK_IS_HPANED(node->paned)) + if (HAS_H_ORIENTATION(node->paned)) position = MIN(position, second_req.width + handle_size); else position = MIN(position, second_req.height + handle_size); diff --git a/src/panels/registers.c b/src/panels/registers.c index 4ad46ea..e7efd75 100644 --- a/src/panels/registers.c +++ b/src/panels/registers.c @@ -79,7 +79,6 @@ GtkWidget *build_registers_panel(void) GtkWidget *label2; GtkWidget *label; /* Etiquette textuelle */ - GtkWidget *alignment; /* Décallage de contenu */ GtkWidget *entry; /* Zone de saisie */ @@ -102,12 +101,10 @@ GtkWidget *build_registers_panel(void) gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); - alignment = qck_create_padded_alignment(0, 0, 8, 0); - gtk_box_pack_start(GTK_BOX(vbox1), alignment, FALSE, TRUE, 0); - table1 = gtk_table_new(7, 3, FALSE); + qck_set_margins(table1, 0, 0, 8, 0); gtk_widget_show(table1); - gtk_container_add(GTK_CONTAINER(alignment), table1); + gtk_box_pack_start(GTK_BOX(vbox1), table1, FALSE, TRUE, 0); label = qck_create_label(NULL, NULL, "eax: "); gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); -- cgit v0.11.2-87-g4458