Re: Usability issues for the GTK graphical frontend, categorized and updated list
Hi
https://debian.polito.it/downloads/gtk_latest.png
here is a PNG of how the frontend would look if extended question
decriptions are displayed above question descriptions: this way the GTK
frontend is much more NEWT-like and also multiple questions are nicely
displayed the same way.
As you can see the white help area in the bottom part of the screen has
been removed since is no longer necessary.
This has allowed for a much more simple event handling and to many
sourcecode simplification (a lot of no longer needed functions have been
removed and gtk.c is now 3 Kb smaller).
Question extended descriptions are displayed in bold, talic and
descriptions in bold: this can be easily changed if you feel it's not
optimal.
Still the progressbar has to be moved to a more appropriate place (popup
window?).
Since the main screen, after removing the helpbox and static
progressbar, will have to display a smaller number of elements at the
same time then the GTK FE could operate using a 640x480 resolution
rather than the current 800x600.
Could this be useful to achive better compatibility on non-standard
video hardware (strange video cards, hardware different from i386)?
Here is also provided a miniiso image to allow you for usability testing
https://debian.polito.it/downloads/mini.iso
Above the diffs from SVN of experimental sourcecode: this should give
you an idea of how much gtk.c has been simplified (also a couple of
variables have been removed from cdebconf_gtk.h).
ciao
Attilio
attilio@attilaptop:~/cdebconf/cdebconf/src/modules/frontend/gtk$ diff
~attilio/svn_gtk/cdebconf/src/modules/frontend/gtk/gtk.c gtk.c
157,208d156
<
< gboolean show_description (GtkWidget *widget, struct
frontend_question_data* data)
< {
< struct question *q;
< struct frontend *frontend_ptr;
< struct frontend_data *frontend_data_ptr;
< GtkWidget *view;
< GtkTextBuffer *buffer;
<
< frontend_ptr = data->obj;
< frontend_data_ptr = frontend_ptr->data;
< view = (GtkWidget*)frontend_data_ptr->info_box;
< q = data->q;
< buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view) );
<
< /* Workaround for questions missing extended description */
< if (strlen(q_get_extended_description(q)) > 0)
< gtk_text_buffer_set_text (buffer, q_get_extended_description(q), -1);
< else if (strlen(q_get_description(q)) > 0)
< gtk_text_buffer_set_text (buffer, q_get_description(q), -1);
<
< /* INFO(INFO_DEBUG, "GTK_DI - show_description(%s) called",
q_get_extended_description(q)); */
<
< return DC_OK;
< }
<
<
< /* used to clear the help area */
< void clear_description ( struct frontend_data* data)
< {
< GtkWidget *view;
< GtkTextBuffer *buffer;
<
< view = (GtkWidget*)data->info_box;
< buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view) );
< gtk_text_buffer_set_text (buffer, "", -1);
<
< }
<
<
< GtkWidget*
< create_help_button (struct frontend_question_data *data)
< {
< GtkWidget *button;
<
< button = gtk_button_new_from_stock (GTK_STOCK_HELP);
< g_signal_connect (G_OBJECT(button), "clicked",
< G_CALLBACK(show_description), data);
<
< return button;
< }
<
604a553,610
> GtkWidget* display_descriptions(struct question *q)
> {
> GtkWidget *description_view, *ext_description_view;
> GtkWidget *returned_box;
> GtkTextBuffer *description_buffer, *ext_description_buffer;
> GdkColor color;
> GtkTextIter start, end;
>
> /* standard gtkdfb 2.0.9 background color is d6d7d6 */
> color.red = 0xd600;
> color.blue = 0xd700;
> color.green = 0xd600;
>
> returned_box = gtk_vbox_new (FALSE, 6);
>
> /* here is created the question's extended description, but only
> * if the question's extended description actually exists
> */
> if (strlen (q_get_extended_description(q)) > 0)
> {
> ext_description_view = gtk_text_view_new ();
> ext_description_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW
(ext_description_view));
> gtk_text_buffer_set_text (ext_description_buffer,
q_get_extended_description(q), -1);
> gtk_text_view_set_editable (GTK_TEXT_VIEW(ext_description_view),
FALSE);
> gtk_text_view_set_cursor_visible
(GTK_TEXT_VIEW(ext_description_view), FALSE);
> gtk_text_view_set_wrap_mode
(GTK_TEXT_VIEW(ext_description_view), GTK_WRAP_WORD);
> gtk_text_buffer_create_tag (ext_description_buffer, "bold",
"weight", PANGO_WEIGHT_BOLD, NULL);
> gtk_text_buffer_create_tag (ext_description_buffer, "italic",
"style", PANGO_STYLE_ITALIC, NULL);
> g_object_set_data (G_OBJECT (ext_description_view), "tag", "bold");
> g_object_set_data (G_OBJECT (ext_description_view), "tag", "italic");
> gtk_text_buffer_get_start_iter (ext_description_buffer, &start);
> gtk_text_buffer_get_end_iter (ext_description_buffer, &end);
> gtk_text_buffer_apply_tag_by_name (ext_description_buffer, "bold",
&start, &end);
> gtk_text_buffer_apply_tag_by_name (ext_description_buffer,
"italic", &start, &end);
> gtk_widget_modify_base(GTK_WIDGET(ext_description_view),
GTK_STATE_NORMAL, &color);
>
> gtk_box_pack_start(GTK_BOX (returned_box), ext_description_view,
TRUE, TRUE, 5);
> }
>
> /* here is created the question's description */
> description_view = gtk_text_view_new ();
> description_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW
(description_view));
> gtk_text_buffer_set_text (description_buffer,
q_get_description(q), -1);
> gtk_text_view_set_editable (GTK_TEXT_VIEW(description_view), FALSE);
> gtk_text_view_set_cursor_visible
(GTK_TEXT_VIEW(description_view), FALSE);
> gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(description_view),
GTK_WRAP_WORD);
> gtk_text_buffer_create_tag (description_buffer, "bold", "weight",
PANGO_WEIGHT_BOLD, NULL);
> g_object_set_data (G_OBJECT (description_view), "tag", "bold");
> gtk_text_buffer_get_start_iter (description_buffer, &start);
> gtk_text_buffer_get_end_iter (description_buffer, &end);
> gtk_text_buffer_apply_tag_by_name (description_buffer, "bold",
&start, &end);
> gtk_widget_modify_base(GTK_WIDGET(description_view),
GTK_STATE_NORMAL, &color);
>
> gtk_box_pack_start(GTK_BOX (returned_box), description_view, TRUE,
TRUE, 5);
>
> return returned_box;
> }
>
607c613
< GtkWidget *label, *check, *hpadbox, *vpadbox;
---
> GtkWidget *description_box, *check, *hpadbox, *vpadbox;
610d615
< char *label_string;
629,631d633
< g_signal_connect (G_OBJECT(check), "enter", G_CALLBACK
(show_description), data);
< g_signal_connect (G_OBJECT(check), "grab-focus", G_CALLBACK
(show_description), data);
< g_signal_connect (G_OBJECT(check), "toggled", G_CALLBACK
(enable_jump_confirmation_callback), data);
634,638c636,637
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
640c639
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
649,653d647
< if ( (q->next != NULL) || (q->prev != NULL))
<
<
< free(label_string);
<
659c653
< GtkWidget *label, *check_container, *check, *hpadbox, *vpadbox;
---
> GtkWidget *description_box, *check_container, *check, *hpadbox,
*vpadbox;
665d658
< char *label_string;
710,711d702
< g_signal_connect (G_OBJECT(check), "toggled", G_CALLBACK
(enable_jump_confirmation_callback), data);
< g_signal_connect (G_OBJECT(check), "enter", G_CALLBACK
(show_description), data);
727,731c718,719
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
733c721
< gtk_box_pack_start (GTK_BOX(vpadbox), label, TRUE, TRUE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, TRUE, TRUE, 0);
740d727
< free(label_string);
747,748c734
< GtkWidget *label, *label_note, *hpadbox, *vpadbox;;
< char *label_string;
---
> GtkWidget *hpadbox, *vpadbox, *description_box;
752,760c738,739
< label_note = gtk_label_new (q_get_extended_description(q));
< gtk_misc_set_alignment(GTK_MISC (label_note), 0.0, 0.0);
< gtk_label_set_line_wrap(GTK_LABEL (label_note), TRUE);
<
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
762,763c741
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
< gtk_box_pack_start (GTK_BOX(vpadbox), label_note, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
767d744
< free(label_string);
780c757
< GtkWidget *label, *entry, *hpadbox, *vpadbox;
---
> GtkWidget *description_box, *entry, *hpadbox, *vpadbox;
782c759
< char *label_string;
---
>
799,807d775
< g_signal_connect (G_OBJECT(entry), "backspace", G_CALLBACK
(enable_jump_confirmation_callback), data);
< /*
< * TODO: also when inserting or deleting text the need to ask user
if he wants to
< * save changes before jumping should be communicated with an
appropriate callback.
< * at the moment the two following lines do not work properly.
< * g_signal_connect (G_OBJECT(entry), "delete-from-cursor",
G_CALLBACK (enable_jump_confirmation_callback), data);
< * g_signal_connect (G_OBJECT(entry), "insert-at-cursor",
G_CALLBACK (enable_jump_confirmation_callback), data);
< */
< g_signal_connect (G_OBJECT(entry), "grab-focus", G_CALLBACK
(show_description), data);
809,813c777,778
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
815c780
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
820d784
< free(label_string);
897d860
<
900c863
< char **choices, **choices_translated, *label_string;
---
> char **choices, **choices_translated;
906c869
< GtkWidget *hpadbox, *vpadbox, *label;
---
> GtkWidget *hpadbox, *vpadbox, *description_box;
968,972c931
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
975c934
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
982d940
< free(label_string);
993c951
< char **choices, **choices_translated, *label_string;
---
> char **choices, **choices_translated;
999c957
< GtkWidget *hpadbox, *vpadbox, *label;
---
> GtkWidget *hpadbox, *vpadbox, *description_box;
1068,1072c1026
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
1075c1029
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
1082d1035
< free(label_string);
1089c1042
< GtkWidget *label, *combo, *hpadbox, *vpadbox;
---
> GtkWidget *description_box, *combo, *hpadbox, *vpadbox;
1091c1044
< char **choices, **choices_translated, *label_string;;
---
> char **choices, **choices_translated;
1140,1143d1092
< g_signal_connect (G_OBJECT(GTK_COMBO(combo)->entry), "grab-focus",
< G_CALLBACK (enable_jump_confirmation_callback),
data);
< g_signal_connect (G_OBJECT(GTK_COMBO(combo)->entry), "grab-focus",
< G_CALLBACK (show_description), data);
1145,1149c1094,1095
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
1151c1097
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
1157d1102
< free(label_string);
1178c1123
< GtkWidget *label, *entry, *hpadbox, *vpadbox;
---
> GtkWidget *description_box, *entry, *hpadbox, *vpadbox;
1181d1125
< char *label_string;
1201,1209d1144
< /*
< * TODO: also when inserting or deleting text the need to ask user
if he wants to
< * save changes before jumping should be communicated with an
appropriate callback.
< * at the moment the two following lines do not work properly.
< * g_signal_connect (G_OBJECT(entry), "backspace", G_CALLBACK
(enable_jump_confirmation_callback), data);
< * g_signal_connect (G_OBJECT(entry), "delete-from-cursor",
G_CALLBACK (enable_jump_confirmation_callback), data);
< * g_signal_connect (G_OBJECT(entry), "insert-at-cursor",
G_CALLBACK (enable_jump_confirmation_callback), data);
< */
< g_signal_connect (G_OBJECT(entry), "grab-focus", G_CALLBACK
(show_description), data);
1211,1215c1146,1147
< label = gtk_label_new("");
< gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
< label_string = malloc(strlen(q_get_description(q)) + 8 );
< sprintf(label_string,"<b>%s</b>",q_get_description(q));
< gtk_label_set_markup(GTK_LABEL(label), label_string);
---
> description_box = display_descriptions(q);
>
1217c1149
< gtk_box_pack_start (GTK_BOX(vpadbox), label, FALSE, FALSE, 0);
---
> gtk_box_pack_start (GTK_BOX(vpadbox), description_box, FALSE, FALSE, 0);
1223d1154
< free(label_string);
1264d1194
< 7) infobox
1276,1277c1206,1207
< | ||| ||| | ___________ |
< | |||_||| | |7__________| |
---
> | ||| ||| | |
> | |||_||| | |
1286c1216
< GtkWidget *actionbox, *infobox;
---
> GtkWidget *actionbox;
1288,1290d1217
< GtkWidget *info_frame;
< GtkWidget *view;
< GtkTextBuffer *buffer;
1328,1349d1254
<
< /* Here a frame is created to display extended descriptions about the
< * questions
< */
< view = gtk_text_view_new ();
< buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
< gtk_text_buffer_set_text (buffer, "", -1);
< gtk_text_view_set_editable (GTK_TEXT_VIEW(view), FALSE);
< gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW(view), FALSE);
< gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(view), GTK_WRAP_WORD);
<
< gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW(view), 5);
< gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW(view), 5);
<
< gtk_text_view_set_left_margin (GTK_TEXT_VIEW(view), 5);
< gtk_text_view_set_right_margin (GTK_TEXT_VIEW(view), 5);
< ((struct frontend_data*) obj->data)->info_box = view;
< info_frame = gtk_frame_new(NULL);
< gtk_container_add(GTK_CONTAINER (info_frame), view);
< infobox = gtk_vbox_new (FALSE, 10);
< gtk_box_pack_start(GTK_BOX (infobox), info_frame, TRUE, TRUE, 5);
<
1393d1297
< gtk_box_pack_start(GTK_BOX (mainbox), infobox, FALSE, FALSE, 5);
1427d1330
< fe_data->info_box = NULL;
1474c1377
< GtkWidget *image_button_forward, *image_button_back;
---
> /* GtkWidget *image_button_forward, *image_button_back; */
1477,1479c1380
< int ret;
< GtkWidget *helpbox_view;
< GtkTextBuffer *helpbox_buffer;
---
> int ret;;
1485,1487d1385
< helpbox_view = (GtkWidget*)data->info_box;
< helpbox_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW
(helpbox_view) );
<
1565d1462
< gtk_text_buffer_set_text (helpbox_buffer,
q_get_extended_description(q), -1);
1640,1650d1536
< else
< {
< /* The (extended) description of the last handled question is
< * automatically displayed inside helpbox to give
< * the user better help
< */
< if (strlen(q_get_extended_description(q)) > 0)
< gtk_text_buffer_set_text (helpbox_buffer,
q_get_extended_description(q), -1);
< else if (strlen(q_get_description(q)) > 0)
< gtk_text_buffer_set_text (helpbox_buffer,
q_get_description(q), -1);
< }
1670,1671d1555
< image_button_back = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
GTK_ICON_SIZE_SMALL_TOOLBAR );
< image_button_forward = gtk_image_new_from_stock
(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_SMALL_TOOLBAR );
1678c1562,1564
<
---
>
> /* image_button_back = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
GTK_ICON_SIZE_SMALL_TOOLBAR ); */
> /* image_button_forward = gtk_image_new_from_stock
(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_SMALL_TOOLBAR ); */
1712d1597
< clear_description (data);
Reply to: