Author: rpmcruz Date: Wed Jun 25 20:30:35 2008 New Revision: 48537 URL: http://svn.opensuse.org/viewcvs/yast?rev=48537&view=rev Log: * src/ygtkhtmlwrap.h/c: got rid of set_background and fixed a crash if libgtkthml is used when an image can't be open. * src/ygtkrichtext.c: added a background for <pre>. Modified: trunk/gtk/ChangeLog trunk/gtk/src/Makefile.am trunk/gtk/src/ygtkhtmlwrap.c trunk/gtk/src/ygtkhtmlwrap.h trunk/gtk/src/ygtkrichtext.c trunk/gtk/src/ygtkwizard.c Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=48537&r1=48536&... ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Wed Jun 25 20:30:35 2008 @@ -1,3 +1,8 @@ +2008-06-25 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> + + * src/ygtkhtmlwrap.h/c: got rid of set_background and fixed a crash + if libgtkthml is used when an image can't be open. + 2008-06-24 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * src/YGPackageSelector.cc: forgot to make some strings on the changes Modified: trunk/gtk/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Makefile.am?rev=48537&r1=... ============================================================================== --- trunk/gtk/src/Makefile.am (original) +++ trunk/gtk/src/Makefile.am Wed Jun 25 20:30:35 2008 @@ -53,11 +53,11 @@ ygtkscrolledwindow.c \ ygtktogglebutton.c \ ygtkhtmlwrap.c \ - ygtkrichtext.c \ ygtktimezonepicker.c \ yzyppwrapper.cc \ yzypptags.cc \ - ygtkzyppwrapper.cc + ygtkzyppwrapper.cc \ + ygtkrichtext.c # should only append ygtkrichtext.c if USE_GTKHTML is set dummy_SOURCES = dummy.cc Modified: trunk/gtk/src/ygtkhtmlwrap.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.c?rev=48537&... ============================================================================== --- trunk/gtk/src/ygtkhtmlwrap.c (original) +++ trunk/gtk/src/ygtkhtmlwrap.c Wed Jun 25 20:30:35 2008 @@ -20,29 +20,6 @@ return g_object_new (ygtk_html_wrap_get_type(), NULL); } -// Utilities -static void gdkwindow_set_background (GdkWindow *window, const char *image) -{ - if (image) { - GError *error = 0; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (image, &error); - if (!pixbuf) { - g_warning ("ygtkrichtext: could not open background image: '%s'" - " - %s", image, error->message); - return; - } - - GdkPixmap *pixmap; - gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf, - gdk_drawable_get_colormap (GDK_DRAWABLE (window)), &pixmap, NULL, 0); - g_object_unref (G_OBJECT (pixbuf)); - - gdk_window_set_back_pixmap (window, pixmap, FALSE); - } - else - gdk_window_clear (window); -} - // GtkHTML #ifdef USE_GTKHTML #include <libgtkhtml-3.14/gtkhtml/gtkhtml.h> @@ -57,6 +34,10 @@ static void gtkhtml_url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *stream) { // to load images (and possibly other external embed files) FILE *file = fopen (url, "rb"); + if (!file) { + g_warning ("Error: couldn't open file '%s'\n", url); + return; + } fseek (file, 0, SEEK_END); size_t file_size = ftell (file); @@ -109,11 +90,6 @@ g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data); } -void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image) -{ - // TODO -} - // YGtkRichText #else #include "ygtkrichtext.h" @@ -154,13 +130,5 @@ g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data); } -void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image) -{ - g_return_if_fail (GTK_WIDGET_REALIZED (widget)); - GdkWindow *window = gtk_text_view_get_window - (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT); - gdkwindow_set_background (window, image); -} - #endif Modified: trunk/gtk/src/ygtkhtmlwrap.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.h?rev=48537&... ============================================================================== --- trunk/gtk/src/ygtkhtmlwrap.h (original) +++ trunk/gtk/src/ygtkhtmlwrap.h Wed Jun 25 20:30:35 2008 @@ -29,9 +29,6 @@ gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text); gboolean ygtk_html_wrap_search_next (GtkWidget *widget, const gchar *text); // F3 -// set a background image -- to be done on (or after) realize -void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image); - G_END_DECLS #endif /* YGTK_HTML_WRAP_H */ Modified: trunk/gtk/src/ygtkrichtext.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=48537&... ============================================================================== --- trunk/gtk/src/ygtkrichtext.c (original) +++ trunk/gtk/src/ygtkrichtext.c Wed Jun 25 20:30:35 2008 @@ -128,7 +128,8 @@ size /= PANGO_SCALE; gtk_text_buffer_create_tag (buffer, "h1", "weight", PANGO_WEIGHT_HEAVY, - "size", (int)(size * PANGO_SCALE_XX_LARGE), "pixels-below-lines", 16, NULL); + "size", (int)(size * PANGO_SCALE_XX_LARGE), "pixels-below-lines", 16, + "foreground", "#5c5c5c", NULL); gtk_text_buffer_create_tag (buffer, "h2", "weight", PANGO_WEIGHT_ULTRABOLD, "size", (int)(size * PANGO_SCALE_X_LARGE), "pixels-below-lines", 15, NULL); gtk_text_buffer_create_tag (buffer, "h3", "weight", PANGO_WEIGHT_BOLD, @@ -143,7 +144,8 @@ gtk_text_buffer_create_tag (buffer, "small", "size", (int)(size * PANGO_SCALE_SMALL), NULL); gtk_text_buffer_create_tag (buffer, "tt", "family", "monospace", NULL); - gtk_text_buffer_create_tag (buffer, "pre", "family", "monospace", NULL); + gtk_text_buffer_create_tag (buffer, "pre", "family", "monospace", + "paragraph-background", "#f0f0f0", NULL); gtk_text_buffer_create_tag (buffer, "b", "weight", PANGO_WEIGHT_BOLD, NULL); gtk_text_buffer_create_tag (buffer, "i", "style", PANGO_STYLE_ITALIC, NULL); gtk_text_buffer_create_tag (buffer, "u", "underline", PANGO_UNDERLINE_SINGLE, NULL); Modified: trunk/gtk/src/ygtkwizard.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=48537&r1... ============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Wed Jun 25 20:30:35 2008 @@ -142,12 +142,6 @@ GTK_WIDGET_CLASS (ygtk_help_dialog_parent_class)->realize (widget); YGtkHelpDialog *dialog = YGTK_HELP_DIALOG (widget); -#if 0 - // set help text background - gtk_widget_realize (dialog->help_text); - ygtk_html_wrap_set_background (dialog->help_text, THEMEDIR "/wizard/help-background.png"); -#endif - // set close as default widget gtk_widget_grab_default (dialog->close_button); gtk_widget_grab_focus (dialog->close_button); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org