[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

GTK FE, hack to partman's main screen



Hi

One thing in the wishlist for the GTK frontend was make it able to display partitions as childs to disk drives in partman's main screen ("partman/choose_partition") using a GtkTreeView.
This should be done whitout having to touch partman or translated templates.
Since options describing partitions always contain four SPACE chars inside the corresponding option of the question i've used this as a flag to detect them as childs to drives. This seems to be working with all sorts of non latin languages and looks like this

https://debian.polito.it/downloads/partman.png

and here is the mini.iso (should)

https://debian.polito.it/downloads/mini.iso


What do you think, shall this be kept and later committed to SVN later? I know this is hacky, but this way no partman changes are required (is partman used also for archs different fron i386?).

below diffs from SVN (also code to display icons is included) are reported.

ciao

attilio

ps

i can no longer see the "skull" and "lightning" symbols in partman after last font packages reworking, any idea why?

attilio@attilaptop:~/svn_gtk/cdebconf/src/modules/frontend/gtk$ diff gtk.c ~/cdebconf/cdebconf/src/modules/frontend/gtk/gtk.c10c10
<  * $Id: gtk.c 31733 2005-10-28 07:50:07Z fiandro-guest $
---
>  * $Id: gtk.c 31569 2005-10-21 06:12:27Z fiandro-guest $
562c562
<     GtkWidget *returned_box;
---
>     GtkWidget *returned_box, *description_box, *icon_box, *icon_button;
571c571,573
<     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);
596c598
< 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);
613c615
< 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);
614a617,630
>       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);
1006,1021c1022,1041
< 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 );
>                       }
>                       }
1023c1043,1067
<
---
>               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 );
>                       }
>                       }
>       }
1124c1168
<               if (strcmp(q->tag, "countrychooser/country-name") == 0)
---
> if ( (strcmp(q->tag, "countrychooser/country-name") == 0) || (strcmp(q->tag, "partman/choose_partition") == 0) )



Reply to: