Author: Goedson Teixeira Paixao Description: Avoids crash on font selection Makes the font selection button active only when the text tool is selected, avoiding a crash that would occur if it is clicked without selectiong the text tool. Bug-Debian: http://bugs.debian.org/497201 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gpaint/+bug/262889 Forwarded: https://savannah.gnu.org/patch/?6645 Index: b/gpaint.glade =================================================================== --- a/gpaint.glade 2009-12-19 17:11:48.000000000 -0200 +++ b/gpaint.glade 2009-12-19 17:12:10.000000000 -0200 @@ -1137,6 +1137,7 @@ True + False True True True Index: b/src/main.c =================================================================== --- a/src/main.c 2009-12-19 17:11:48.000000000 -0200 +++ b/src/main.c 2009-12-19 17:12:10.000000000 -0200 @@ -73,6 +73,10 @@ tool_palette_set_active_button(main_window, "pen_button"); /* make the pen tool the default initial tool so the user can draw right away */ + gpaint_tool *text_tool = tool_palette_get_tool(main_window, "text"); + widget = lookup_widget(main_window, "fontpicker"); + text_set_fontpicker(text_tool, widget); + #if (!defined(HAVE_GTK_PRINT) && !defined(HAVE_GNOME_PRINT)) /* disable print menus and buttons if no print support available*/ widget = lookup_widget(main_window, "print_button"); Index: b/src/text.c =================================================================== --- a/src/text.c 2009-12-19 17:11:48.000000000 -0200 +++ b/src/text.c 2009-12-19 17:12:10.000000000 -0200 @@ -54,6 +54,7 @@ GString *textbuf; int max_width; int max_height; + GtkFontButton *fontpicker; } gpaint_text; @@ -94,6 +95,7 @@ GPAINT_TOOL(text)->commit_change = text_commit_change; text->textbuf = g_string_new(0); + text->fontpicker = NULL; return GPAINT_TOOL(text); } @@ -118,6 +120,7 @@ g_string_printf(text->textbuf, ""); text->timer = g_timeout_add(TEXT_CURSOR_BLINK_RATE, (GtkFunction)(text_handle_timeout), text); + gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), TRUE); } static void @@ -145,7 +148,7 @@ text_draw_string(text); } text_clear(text); - + gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), FALSE); } static gboolean @@ -474,6 +477,8 @@ } - - - +void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker) +{ + gpaint_text *text = GPAINT_TEXT(tool); + text->fontpicker = fontpicker; +} Index: b/src/text.h =================================================================== --- a/src/text.h 2009-12-19 17:11:48.000000000 -0200 +++ b/src/text.h 2009-12-19 17:12:10.000000000 -0200 @@ -30,6 +30,6 @@ gpaint_tool* text_create(const char *name); - +void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker); #endif