summaryrefslogtreecommitdiff
path: root/graphics/gpaint/patches/10_fix_crash_on_font_select.patch
blob: 868c05a5696924029661497823552ef35e7526ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Author: Goedson Teixeira Paixao <goedson@debian.org>
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 @@
 		  <child>
 		    <widget class="GtkFontButton" id="fontpicker">
 		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
 		      <property name="can_focus">True</property>
 		      <property name="show_style">True</property>
 		      <property name="show_size">True</property>
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