[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: Re: Wishes, bugs and misunderstandings (6-10)
Hi all,
On Wednesday 22 November 2006 18:18, Werner Hoch wrote:
> On Monday 20 November 2006 21:39, Kai-Martin Knaak wrote:
> I'm using KDE which means the kdm v3.5.1, and gtk2 v2.8.10.
>
> Some of the dialogs do not set the modal flag. Neither modal nor
> non-modal.
> I'm wondering what's the default values for those dialogs?
Ok. I think the Window Manager sets the default.
> I'm not sure whether it would help to set the modal/non-modal flag of
> the dialog.
>
> And there is a "transient-for" property for GTK-Windows, but I got
> strange results when playing with it:
> I've used gtk_window_set_transient_for in the image-export dialog and
> the component dialog started flickering at 100% CPU-Load.
>
It seems the flickering happens when at least two dialogs are opened.
One with the set_transient_for hint for the window manager and one
without.
I've attached a patch that sets the transient flag for the component
select dialog and that replaces the x_create_dialog with the gtk_dialog
functions. The gtk_dialog uses the transient flag too.
Anyone likes to play with?
Regards
Werner
? GPATH
? GRTAGS
? GSYMS
? GTAGS
? HTML
? dialog_test.diff
? gschem.log
? xxx.diff
Index: x_compselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
retrieving revision 1.9
diff -u -r1.9 x_compselect.c
--- x_compselect.c 13 Nov 2006 21:48:36 -0000 1.9
+++ x_compselect.c 4 Dec 2006 19:15:46 -0000
@@ -180,6 +180,9 @@
G_CALLBACK (x_compselect_callback_response),
toplevel);
+ gtk_window_set_transient_for(GTK_WINDOW(w_current->cswindow),
+ GTK_WINDOW(w_current->main_window));
+
gtk_widget_show (toplevel->cswindow);
} else {
@@ -436,7 +439,7 @@
if (model != NULL) {
gtk_tree_model_filter_refilter ((GtkTreeModelFilter*)model);
}
-
+
/* return FALSE to remove the source */
return FALSE;
}
Index: x_image.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_image.c,v
retrieving revision 1.26
diff -u -r1.26 x_image.c
--- x_image.c 30 Sep 2006 20:03:32 -0000 1.26
+++ x_image.c 4 Dec 2006 19:15:47 -0000
@@ -379,6 +379,23 @@
return FALSE;
}
+
+void x_image_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
+{
+ switch(response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ x_image_cancel(widget, w_current);
+ break;
+ case GTK_RESPONSE_ACCEPT:
+ x_image_write(widget, w_current);
+ break;
+ default:
+ printf("x_image_response: strange signal %d\n", response);
+ }
+}
+
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
@@ -387,102 +404,32 @@
void x_image_setup (TOPLEVEL *w_current, char *filename)
{
GtkWidget *label;
- GtkWidget *separator;
GtkWidget *box;
- GtkWidget *buttonwrite;
- GtkWidget *buttoncancel;
GtkWidget *optionmenu;
- GtkWidget *vbox, *action_area;
- /* freeze the window_current pointer so that it doesn't change */
+ /* freeze the window_current pointer so that it doesn't change */
if (!w_current->iwindow) {
- w_current->iwindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->iwindow = gtk_dialog_new_with_buttons(_("Write Image..."),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->iwindow),
+ GTK_RESPONSE_OK);
gtk_window_position (GTK_WINDOW (w_current->iwindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect (GTK_OBJECT (w_current->iwindow), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->iwindow);
-
-#if 0 /* this was causing the dialog box to not die */
- gtk_signal_connect (GTK_OBJECT (w_current->iwindow), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->iwindow);
-#endif
-
- gtk_window_set_title (GTK_WINDOW (w_current->iwindow), _("Write Image..."));
-
- buttonwrite = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonwrite, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area),
- buttonwrite, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (buttonwrite), "clicked",
- GTK_SIGNAL_FUNC(x_image_write), w_current);
- gtk_widget_show (buttonwrite);
- gtk_widget_grab_default (buttonwrite);
-
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect ( GTK_OBJECT(buttoncancel),
- "clicked", GTK_SIGNAL_FUNC(x_image_cancel),
- w_current);
- gtk_widget_show (buttoncancel);
-
-#if 0
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-#endif
-
- box = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box), 5);
- gtk_container_add(GTK_CONTAINER(vbox), box);
- gtk_widget_show(box);
-
-#if 0
- label = gtk_label_new (_("Width"));
- gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (box),
- label, FALSE, FALSE, 0);
- gtk_widget_show (label);
+ gtk_signal_connect(GTK_OBJECT(w_current->iwindow), "response",
+ GTK_SIGNAL_FUNC(x_image_response), w_current);
- w_current->iwidth_entry = gtk_entry_new_with_max_length (5);
- gtk_editable_select_region (GTK_EDITABLE (w_current->iwidth_entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box),
- w_current->iwidth_entry, TRUE, TRUE, 10);
- /*
- gtk_signal_connect(GTK_OBJECT(w_current->width_entry),
- "activate",
- GTK_SIGNAL_FUNC(x_image_write),
- w_current);
- */
- gtk_widget_show (w_current->iwidth_entry);
+ box = GTK_DIALOG(w_current->iwindow)->vbox;
- label = gtk_label_new (_("Height"));
- gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (box),
- label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- w_current->iheight_entry = gtk_entry_new_with_max_length (5);
- gtk_editable_select_region (GTK_EDITABLE (w_current->iheight_entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box),
- w_current->iheight_entry, TRUE, TRUE, 10);
- /*
- gtk_signal_connect(GTK_OBJECT(w_current->height_entry),
- "activate",
- GTK_SIGNAL_FUNC(x_image_write),
- w_current);
- */
- gtk_widget_show (w_current->iheight_entry);
-#endif
label = gtk_label_new (_("Width x Height"));
gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
gtk_misc_set_padding (GTK_MISC (label), 0, 0);
@@ -513,20 +460,12 @@
w_current);
gtk_widget_show (w_current->ifilename_entry);
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
gtk_signal_connect(GTK_OBJECT(w_current->iwindow), "key_press_event",
(GtkSignalFunc) x_image_keypress, w_current);
}
if (!GTK_WIDGET_VISIBLE (w_current->iwindow)) {
gtk_entry_set_text(GTK_ENTRY(w_current->ifilename_entry), filename);
- /* gtk_entry_set_text(GTK_ENTRY(w_current->iwidth_entry), "800");
- gtk_entry_set_text(GTK_ENTRY(w_current->iheight_entry), "600");*/
-
- /*gtk_entry_select_region(GTK_ENTRY(w_current->ifilename_entry), 0, strlen(filename)); */
w_current->image_width = 800;
w_current->image_height = 600;
gtk_widget_show (w_current->iwindow);
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user