1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 10_fix_crash_on_font_select.dpatch by Goedson Teixeira Paixao <goedson@debian.org>
4
## DP: Makes the font selection button active only when the text tool
5
## DP: is selected avoid a crash that would occur when the user selects
6
## DP: a font without selecting the text tool.
9
diff --git a/gpaint.glade b/gpaint.glade
10
index 1437dbb..d2c789e 100644
15
<widget class="GtkFontButton" id="fontpicker">
16
<property name="visible">True</property>
17
+ <property name="sensitive">False</property>
18
<property name="can_focus">True</property>
19
<property name="show_style">True</property>
20
<property name="show_size">True</property>
21
diff --git a/src/main.c b/src/main.c
22
index c382735..273e2ff 100644
25
@@ -73,6 +73,10 @@ static void main_window_ui_initial_adjustment(GtkWidget *main_window)
26
tool_palette_set_active_button(main_window, "pen_button");
27
/* make the pen tool the default initial tool so the user can draw right away */
29
+ gpaint_tool *text_tool = tool_palette_get_tool(main_window, "text");
30
+ widget = lookup_widget(main_window, "fontpicker");
31
+ text_set_fontpicker(text_tool, widget);
33
#if (!defined(HAVE_GTK_PRINT) && !defined(HAVE_GNOME_PRINT))
34
/* disable print menus and buttons if no print support available*/
35
widget = lookup_widget(main_window, "print_button");
36
diff --git a/src/text.c b/src/text.c
37
index 810bc94..af9dc58 100644
40
@@ -54,6 +54,7 @@ typedef struct _gpaint_text
44
+ GtkFontButton *fontpicker;
48
@@ -94,6 +95,7 @@ gpaint_tool *text_create(const char *name)
49
GPAINT_TOOL(text)->commit_change = text_commit_change;
51
text->textbuf = g_string_new(0);
52
+ text->fontpicker = NULL;
53
return GPAINT_TOOL(text);
56
@@ -118,6 +120,7 @@ text_select(gpaint_tool *tool)
57
g_string_printf(text->textbuf, "");
58
text->timer = g_timeout_add(TEXT_CURSOR_BLINK_RATE,
59
(GtkFunction)(text_handle_timeout), text);
60
+ gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), TRUE);
64
@@ -145,7 +148,7 @@ text_deselect(gpaint_tool *tool)
65
text_draw_string(text);
69
+ gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), FALSE);
73
@@ -474,6 +477,8 @@ static void set_layout_foreground_color(PangoLayout *layout, GdkColor *foregroun
80
+void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker)
82
+ gpaint_text *text = GPAINT_TEXT(tool);
83
+ text->fontpicker = fontpicker;
85
diff --git a/src/text.h b/src/text.h
86
index aa64291..9b8c7ac 100644
92
gpaint_tool* text_create(const char *name);
94
+void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker);