Re: GTK frontend updated in SVN
Christian Perrier wrote:
Christian, what do you say as our professional user-interface guy?
Hmmm, overflated respect, I'm afraid..:-)
Anyway, my first reaction is similar to yours.
Actually, the very quickly changing messages are not the best thing in
D-I, even with the dialog interface....so unless we completely
redesign things, we should do our best to minimize the visual impact
they have....
hi
https://debian.polito.it/downloads/mini.iso
here is a preview of what the frontend would look like if the text
inside the progressbar and the text below it are swapped.
It seems to me that this way rapidly changing text lines are more
readable (they are bold, italic now; tell me if different text
formatting is desired).
this snapshot includes also coloured icons and hack to make partman main
screen look like a tree (those modifications are not yet in SVN).
ciao
attilio
attilio@attilaptop:~/svn_gtk/cdebconf/src/modules/frontend/gtk$ diff -u
gtk.c ~attilio/cdebconf/cdebconf/src/modules/frontend/gtk/gtk.c
--- gtk.c 2005-10-28 09:56:32.000000000 +0200
+++ /home/attilio/cdebconf/cdebconf/src/modules/frontend/gtk/gtk.c
2005-11-02 12:34:33.565761608 +0100
@@ -7,7 +7,7 @@
*
* Description: gtk UI for cdebconf
*
- * $Id: gtk.c 31733 2005-10-28 07:50:07Z fiandro-guest $
+ * $Id: gtk.c 31569 2005-10-21 06:12:27Z fiandro-guest $
*
* cdebconf is (c) 2000-2001 Randolph Chung and others under the following
* license.
@@ -559,7 +559,7 @@
GtkWidget* display_descriptions(struct question *q)
{
GtkWidget *description_view, *ext_description_view;
- GtkWidget *returned_box;
+ GtkWidget *returned_box, *description_box, *icon_box, *icon_button;
GtkTextBuffer *description_buffer, *ext_description_buffer;
GdkColor color;
GtkTextIter start, end;
@@ -568,7 +568,9 @@
color.green = BACKGROUND_GREEN;
color.blue = BACKGROUND_BLUE;
- returned_box = gtk_vbox_new (FALSE, 0);
+ description_box = gtk_vbox_new (FALSE, 0);
+ icon_box = gtk_vbox_new (FALSE, 0);
+ returned_box = gtk_hbox_new (FALSE, 0);
/* here is created the question's extended description, but only
* if the question's extended description actually exists
@@ -593,7 +595,7 @@
*/
gtk_widget_modify_base(GTK_WIDGET(ext_description_view),
GTK_STATE_NORMAL, &color);
- gtk_box_pack_start(GTK_BOX (returned_box),
ext_description_view, FALSE, FALSE, 2);
+ gtk_box_pack_start(GTK_BOX (description_box),
ext_description_view, FALSE, FALSE, 2);
}
/* here is created the question's description */
@@ -610,8 +612,22 @@
gtk_text_buffer_apply_tag_by_name (description_buffer,
"italic", &start, &end);
gtk_widget_modify_base(GTK_WIDGET(description_view),
GTK_STATE_NORMAL, &color);
- gtk_box_pack_start(GTK_BOX (returned_box), description_view,
FALSE, FALSE, 3);
+ gtk_box_pack_start(GTK_BOX (description_box), description_view,
FALSE, FALSE, 3);
+ if( strcmp(q->template->type,"note") == 0 )
+ {
+ icon_button =
gtk_image_new_from_file("/usr/share/graphics/note_icon.png");
+ gtk_box_pack_start(GTK_BOX (icon_box), icon_button,
FALSE, FALSE, 3);
+ gtk_box_pack_start(GTK_BOX (returned_box), icon_box,
FALSE, FALSE, 3);
+ }
+ else if( strcmp(q->template->type,"error") == 0 )
+ {
+ icon_button =
gtk_image_new_from_file("/usr/share/graphics/warning_icon.png");
+ gtk_box_pack_start(GTK_BOX (icon_box), icon_button,
FALSE, FALSE, 3);
+ gtk_box_pack_start(GTK_BOX (returned_box), icon_box,
FALSE, FALSE, 3);
+ }
+
+ gtk_box_pack_start(GTK_BOX (returned_box), description_box,
TRUE, TRUE, 3);
return returned_box;
}
@@ -1003,24 +1019,52 @@
for (i = 0; i < count; i++)
{
- if( ((choices_translated[i][0]=='-') &&
(choices_translated[i][1]=='-')) )
- { /* father */
- gtk_tree_store_append (store, &iter,NULL);
- gtk_tree_store_set (store, &iter, COL_NAME,
choices_translated[i], -1);
- }
- else
- { /* child */
- gtk_tree_store_append (store, &child, &iter);
- gtk_tree_store_set (store, &child, COL_NAME,
choices_translated[i], -1);
-
- if (defval && strcmp(choices[tindex[i]], defval) == 0)
- {
- gtk_tree_view_scroll_to_cell
(GTK_TREE_VIEW(view), gtk_tree_model_get_path(model,&child), NULL,
FALSE, 0.5, 0);
- gtk_tree_view_expand_row (GTK_TREE_VIEW(view),
gtk_tree_model_get_path(model,&iter), TRUE);
- gtk_tree_selection_select_iter
(selection, &child );
- }
+
+ if(strcmp(q->tag, "countrychooser/country-name") == 0 )
+ {
+ if( ((choices_translated[i][0]=='-') &&
(choices_translated[i][1]=='-')) )
+ { /* father */
+ gtk_tree_store_append (store, &iter,NULL);
+ gtk_tree_store_set (store, &iter,
COL_NAME, choices_translated[i], -1);
+ }
+ else
+ { /* child */
+ gtk_tree_store_append (store, &child,
&iter);
+ gtk_tree_store_set (store, &child,
COL_NAME, choices_translated[i], -1);
+
+ if (defval && strcmp(choices[tindex[i]], defval)
== 0)
+ {
+ gtk_tree_view_scroll_to_cell
(GTK_TREE_VIEW(view), gtk_tree_model_get_path(model,&child), NULL,
FALSE, 0.5, 0);
+ gtk_tree_view_expand_row
(GTK_TREE_VIEW(view), gtk_tree_model_get_path(model,&iter), TRUE);
+ gtk_tree_selection_select_iter
(selection, &child );
+ }
+ }
}
-
+ else if(strcmp(q->tag, "partman/choose_partition") == 0 )
+ {
+ if( strstr(choices_translated[i]," ")!=NULL )
+ { /* child */
+ gtk_tree_store_append (store, &child,
&iter);
+ gtk_tree_store_set (store, &child,
COL_NAME, choices_translated[i], -1);
+
+ if (defval && strcmp(choices[tindex[i]], defval)
== 0)
+ {
+ gtk_tree_view_scroll_to_cell
(GTK_TREE_VIEW(view), gtk_tree_model_get_path(model,&child), NULL,
FALSE, 0.5, 0);
+ gtk_tree_selection_select_iter
(selection, &child );
+ }
+ gtk_tree_view_expand_row (GTK_TREE_VIEW(view),
gtk_tree_model_get_path(model,&iter), TRUE);
+ }
+ else
+ { /* father */
+ gtk_tree_store_append (store, &iter,NULL);
+ gtk_tree_store_set (store, &iter,
COL_NAME, choices_translated[i], -1);
+ if (defval && strcmp(choices[tindex[i]],
defval) == 0)
+ {
+ gtk_tree_view_scroll_to_cell
(GTK_TREE_VIEW(view), gtk_tree_model_get_path(model,&iter), NULL, FALSE,
0.5, 0);
+ gtk_tree_selection_select_iter
(selection, &iter );
+ }
+ }
+ }
free(choices[tindex[i]]);
}
@@ -1121,7 +1165,7 @@
if (q->prev == NULL && q->next == NULL)
{
- if (strcmp(q->tag, "countrychooser/country-name") == 0)
+ if ( (strcmp(q->tag, "countrychooser/country-name") ==
0) || (strcmp(q->tag, "partman/choose_partition") == 0) )
return gtkhandler_select_treeview_store(obj, q,
qbox);
else
return gtkhandler_select_treeview_list(obj, q, qbox);
@@ -1323,8 +1367,8 @@
/* Final packaging */
gtk_box_pack_start(GTK_BOX (mainbox), v_title_box, FALSE,
FALSE, 0);
gtk_box_pack_start(GTK_BOX (mainbox), targetbox, TRUE, TRUE, 5);
- gtk_box_pack_end(GTK_BOX (mainbox), progress_bar_box, FALSE, FALSE, 5);
gtk_box_pack_end (GTK_BOX(mainbox), actionbox, FALSE, FALSE, 5);
+ gtk_box_pack_end(GTK_BOX (mainbox), progress_bar_box, FALSE, FALSE, 5);
globalbox = gtk_hbox_new (TRUE, 10);
if ( ((struct frontend_data*)obj->data)->main_menu_enabled == TRUE)
gtk_box_pack_start(GTK_BOX (globalbox), menubox_vpad, TRUE,
TRUE, 5);
@@ -1687,21 +1731,16 @@
static void gtk_progress_start(struct frontend *obj, int min, int max,
const char *title)
{
- GtkWidget *progress_bar, *progress_bar_label;
- char *progress_bar_label_string;
+ GtkWidget *progress_bar;
if ( ((struct frontend_data*)obj->data)->main_menu_enabled == TRUE)
display_main_menu_while_progressbar_runs(obj);
-
- progress_bar = ((struct frontend_data*)obj->data)->progress_bar;
- gtk_widget_set_sensitive( GTK_WIDGET(progress_bar), TRUE);
- progress_bar_label = ((struct
frontend_data*)obj->data)->progress_bar_label;
+
DELETE(obj->progress_title);
obj->progress_title=strdup(title);
- progress_bar_label_string = malloc(strlen(obj->progress_title) + 18 );
-
sprintf(progress_bar_label_string,"<b><i>%s...</i></b>",obj->progress_title);
- gtk_label_set_markup(GTK_LABEL(progress_bar_label),
progress_bar_label_string);
- free(progress_bar_label_string);
+ progress_bar = ((struct frontend_data*)obj->data)->progress_bar;
+ gtk_widget_set_sensitive( GTK_WIDGET(progress_bar), TRUE);
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar),
obj->progress_title);
obj->progress_min = min;
obj->progress_max = max;
@@ -1740,17 +1779,22 @@
static void gtk_progress_info(struct frontend *obj, const char *info)
{
- GtkWidget *progress_bar;
+ GtkWidget *progress_bar, *progress_bar_label;
+ char *progress_bar_label_string;
if ( ((struct frontend_data*)obj->data)->main_menu_enabled == TRUE)
display_main_menu_while_progressbar_runs(obj);
INFO(INFO_DEBUG, "GTK_DI - gtk_progress_info(%s) called", info);
-
+
progress_bar = ((struct frontend_data*)obj->data)->progress_bar;
gtk_widget_set_sensitive( GTK_WIDGET(progress_bar), TRUE);
-
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), info);
+ progress_bar_label = ((struct
frontend_data*)obj->data)->progress_bar_label;
+ progress_bar_label_string = malloc(strlen(info) + 18 );
+ sprintf(progress_bar_label_string,"<b><i>%s...</i></b>",info);
+ gtk_label_set_markup(GTK_LABEL(progress_bar_label),
progress_bar_label_string);
+ free(progress_bar_label_string);
+
while (gtk_events_pending ())
gtk_main_iteration ();
Reply to: