Comment on a FIXME (in src/folder-conf.c)



	Hi all,
I saw this FIXME :

      /* FIXME: I don't like this loop.
       * but gnome_dialog_set_close(fcw.dialog, FALSE) appears to be broken
       */
      gnome_dialog_close_hides(fcw.dialog, TRUE);
      while( (button=gnome_dialog_run(fcw.dialog)) == 2)
          gnome_help_display(NULL, &help_entry);
and I agree with it :) To avoid this ugly loop we should connect ourselves 
to the "clicked" message where we display help when user has pressed help 
button and close the dialog in other cases. The code would be :

void fcw_dialog_button_cb(GtkWidget * dialog,gint button,gpointer data)
{
	switch (button) {
	case 0: /* Create/Update button*/
		/* do here what is needed, ie move here the whole code in 
the if (button==0) test */
	case 1: /*cancel button */
		gnome_dialog_close(GNOME_DIALOG(dialog));
		break;
	case 2:
		gnome_help_display(NULL, &help_entry);
	}
	return;
}

and the above code would become :

gtk_window_set_modal(GTK_WINDOW(fcw.dialog));
gtk_widget_show_all(GTK_WIDGET(fcw.dialog));

and no more. The only thing you have to solve is to pass all needed data 
to the "clicked" callback, using the gpointer data.
I use this method in filter and it works (moreover it works also if you 
ever want to make the dialog modal, in this case you just don't call 
gtk_window_set_modal, but I don't know if the code will support a 
non-modal dialog in that case).
Hope it helps (I could perhaps make a patch if the method makes everyone 
happy).
Bye
Manu



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