comparison gtk3/dw.c @ 1354:1f22addc2722

Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates... Instead of creating a text widget with an error message. This error message is now sent to the console. This allows programs to be able to gracefully handle the failure to create the HTML widget. Also updated the dwtest program to create a text widget in a similar fashion on failure. Also updated the dw_calendar_* comments to no longer be unsupported on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 18 Nov 2011 13:34:36 +0000
parents f4ad4ba39b61
children dd252596227b
comparison
equal deleted inserted replaced
1353:f4ad4ba39b61 1354:1f22addc2722
10127 * text: The default text to be in the entryfield widget. 10127 * text: The default text to be in the entryfield widget.
10128 * id: An ID to be used with dw_window_from_id() or 0L. 10128 * id: An ID to be used with dw_window_from_id() or 0L.
10129 */ 10129 */
10130 HWND dw_html_new(unsigned long id) 10130 HWND dw_html_new(unsigned long id)
10131 { 10131 {
10132 GtkWidget *widget,*stext; 10132 GtkWidget *widget = NULL,*stext;
10133 int _locked_by_me = FALSE; 10133 int _locked_by_me = FALSE;
10134 10134
10135 DW_MUTEX_LOCK; 10135 DW_MUTEX_LOCK;
10136 #ifdef USE_WEBKIT 10136 #ifdef USE_WEBKIT
10137 if (!_webkit_web_view_open) 10137 if (!_webkit_web_view_open)
10138 { 10138 {
10139 widget = dw_box_new(DW_HORZ, 0); 10139 dw_debug( "HTML widget not available; you do not have access to webkit." );
10140 stext = dw_text_new( "HTML widget not available; you do not have access to webkit.", 0);
10141 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10);
10142 } 10140 }
10143 else 10141 else
10144 { 10142 {
10145 WebKitWebView *web_view; 10143 WebKitWebView *web_view;
10146 widget = gtk_scrolled_window_new (NULL, NULL); 10144 widget = gtk_scrolled_window_new (NULL, NULL);
10150 gtk_container_add( GTK_CONTAINER (widget), GTK_WIDGET(web_view) ); 10148 gtk_container_add( GTK_CONTAINER (widget), GTK_WIDGET(web_view) );
10151 gtk_widget_show( GTK_WIDGET(web_view) ); 10149 gtk_widget_show( GTK_WIDGET(web_view) );
10152 g_object_set_data(G_OBJECT(widget), "_dw_web_view", (gpointer)web_view); 10150 g_object_set_data(G_OBJECT(widget), "_dw_web_view", (gpointer)web_view);
10153 g_signal_connect( web_view, "populate-popup", G_CALLBACK(_dw_html_populate_popup_cb), NULL ); 10151 g_signal_connect( web_view, "populate-popup", G_CALLBACK(_dw_html_populate_popup_cb), NULL );
10154 } 10152 }
10153 gtk_widget_show(widget);
10155 #else 10154 #else
10156 widget = dw_box_new(DW_HORZ, 0); 10155 dw_debug( "HTML widget not available; you do not have access to webkit." );
10157 stext = dw_text_new( "HTML widget not available; you do not have access to webkit.", 0);
10158 dw_box_pack_start(widget, stext, 0, 0, TRUE, TRUE, 10);
10159 #endif 10156 #endif
10160 gtk_widget_show(widget);
10161 DW_MUTEX_UNLOCK; 10157 DW_MUTEX_UNLOCK;
10162 return widget; 10158 return widget;
10163 } 10159 }
10164 10160
10165 /* 10161 /*