~ubuntu-branches/ubuntu/hardy/gpaint/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/10_fix_crash_on_font_select.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2008-10-03 13:07:39 UTC
  • Revision ID: james.westby@ubuntu.com-20081003130739-pqk6i5rvp8otzuar
Tags: 0.3.3-1ubuntu0.1
* debian/patches: backport fixes from Debian.
 - 10_fix_crash_on_font_select.dpatch (LP: #262889)
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497201
 - 11_fix_image_rotation.dpatch (LP: #262942)
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497487
 - 20_fix_line_width_combo.dpatch (LP: #209173)
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497484

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 10_fix_crash_on_font_select.dpatch by Goedson Teixeira Paixao <goedson@debian.org>
 
3
##
 
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.
 
7
 
 
8
@DPATCH@
 
9
diff --git a/gpaint.glade b/gpaint.glade
 
10
index 1437dbb..d2c789e 100644
 
11
--- a/gpaint.glade
 
12
+++ b/gpaint.glade
 
13
@@ -1137,6 +1137,7 @@
 
14
                  <child>
 
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
 
23
--- a/src/main.c
 
24
+++ b/src/main.c
 
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 */
 
28
 
 
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);
 
32
+
 
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
 
38
--- a/src/text.c
 
39
+++ b/src/text.c
 
40
@@ -54,6 +54,7 @@ typedef struct _gpaint_text
 
41
     GString *textbuf;
 
42
     int max_width;
 
43
     int max_height;
 
44
+    GtkFontButton *fontpicker;
 
45
 } gpaint_text;
 
46
 
 
47
 
 
48
@@ -94,6 +95,7 @@ gpaint_tool *text_create(const char *name)
 
49
     GPAINT_TOOL(text)->commit_change  = text_commit_change;
 
50
     
 
51
     text->textbuf =   g_string_new(0);
 
52
+    text->fontpicker = NULL;
 
53
     return GPAINT_TOOL(text);
 
54
 }
 
55
 
 
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);
 
61
 }
 
62
 
 
63
 static void
 
64
@@ -145,7 +148,7 @@ text_deselect(gpaint_tool *tool)
 
65
         text_draw_string(text);
 
66
     }
 
67
     text_clear(text);
 
68
-   
 
69
+    gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), FALSE);
 
70
 }
 
71
 
 
72
 static gboolean
 
73
@@ -474,6 +477,8 @@ static void set_layout_foreground_color(PangoLayout *layout, GdkColor *foregroun
 
74
   
 
75
 }
 
76
 
 
77
-   
 
78
-
 
79
-
 
80
+void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker)
 
81
+{
 
82
+    gpaint_text *text = GPAINT_TEXT(tool);
 
83
+    text->fontpicker = fontpicker;
 
84
+}
 
85
diff --git a/src/text.h b/src/text.h
 
86
index aa64291..9b8c7ac 100644
 
87
--- a/src/text.h
 
88
+++ b/src/text.h
 
89
@@ -30,6 +30,6 @@
 
90
 
 
91
 
 
92
 gpaint_tool* text_create(const char *name);
 
93
-
 
94
+void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker);
 
95
 
 
96
 #endif