692 |
692 |
693 CxMempool *mp = cxBasicMempoolCreate(256); |
693 CxMempool *mp = cxBasicMempoolCreate(256); |
694 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
694 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
695 obj->ctx = uic_context(obj, mp); |
695 obj->ctx = uic_context(obj, mp); |
696 obj->widget = dialog; |
696 obj->widget = dialog; |
|
697 obj->ref = 0; |
|
698 obj->destroy = ui_window_widget_destroy; |
697 nwindows++; |
699 nwindows++; |
698 |
700 |
699 if(args.title != NULL) { |
701 if(args.title != NULL) { |
700 gtk_window_set_title(GTK_WINDOW(dialog), args.title); |
702 gtk_window_set_title(GTK_WINDOW(dialog), args.title); |
701 } |
703 } |
719 g_signal_connect( |
721 g_signal_connect( |
720 dialog, |
722 dialog, |
721 "destroy", |
723 "destroy", |
722 G_CALLBACK(ui_exit_event), |
724 G_CALLBACK(ui_exit_event), |
723 obj); |
725 obj); |
|
726 #if GTK_MAJOR_VERSION >= 4 |
|
727 g_signal_connect( |
|
728 obj->widget, |
|
729 "close-request", |
|
730 G_CALLBACK(close_request), |
|
731 obj); |
|
732 #else |
|
733 g_signal_connect( |
|
734 obj->widget, |
|
735 "delete-event", |
|
736 G_CALLBACK(close_request), |
|
737 obj); |
|
738 #endif |
724 |
739 |
725 #if GTK_MAJOR_VERSION < 4 |
740 #if GTK_MAJOR_VERSION < 4 |
726 GtkWidget *c = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
741 GtkWidget *c = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
727 gtk_container_remove(GTK_CONTAINER(dialog), c); |
742 gtk_container_remove(GTK_CONTAINER(dialog), c); |
728 #endif |
743 #endif |