]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gtk+/gtk+-2.6.4-1.osso7/gtkprogressbar.c.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gtk+ / gtk+-2.6.4-1.osso7 / gtkprogressbar.c.diff
1 --- gtk+-2.6.4/gtk/gtkprogressbar.c     2005-01-09 19:32:25.000000000 +0200
2 +++ gtk+-2.6.4/gtk/gtkprogressbar.c     2005-04-06 16:19:37.112896344 +0300
3 @@ -40,11 +40,18 @@
4  
5  
6  #define MIN_HORIZONTAL_BAR_WIDTH   150
7 -#define MIN_HORIZONTAL_BAR_HEIGHT  20
8 +#define MIN_HORIZONTAL_BAR_HEIGHT  30 /* OSSO mod. was 20 */
9  #define MIN_VERTICAL_BAR_WIDTH     22
10  #define MIN_VERTICAL_BAR_HEIGHT    80
11  #define MAX_TEXT_LENGTH            80
12 -#define TEXT_SPACING               2
13 +#define DEFAULT_TEXT_SPACING       2 /* OSSO mod. Changed from
14 +                                     * TEXT_SPACING. Now controlled
15 +                                     * by "text-spacing" style
16 +                                     * property */
17 +#define DEFAULT_WIDTH_INCREMENT    3
18 +#define DEFAULT_HEIGHT_INCREMENT   3
19 +#define DEFAULT_TEXT_XNUDGE        1
20 +#define DEFAULT_TEXT_YNUDGE        1
21  
22  enum {
23    PROP_0,
24 @@ -245,6 +252,51 @@
25                                                       PANGO_ELLIPSIZE_NONE,
26                                                        G_PARAM_READWRITE));
27  
28 +  /* OSSO addition. */
29 +  gtk_widget_class_install_style_property (widget_class,
30 +                                          g_param_spec_int ("text-spacing",
31 +                                                            "Text Spacing",
32 +                                                            "The amount of pixels between the trough and text.",
33 +                                                            G_MININT,
34 +                                                            G_MAXINT,
35 +                                                            DEFAULT_TEXT_SPACING,
36 +                                                            G_PARAM_READWRITE));
37 +
38 +  gtk_widget_class_install_style_property (widget_class,
39 +                                          g_param_spec_int ("width-increment",
40 +                                                            "width Increment",
41 +                                                            "The amount of pixels to add to the width size request.",
42 +                                                            G_MININT,
43 +                                                            G_MAXINT,
44 +                                                            DEFAULT_WIDTH_INCREMENT,
45 +                                                            G_PARAM_READWRITE));
46 +
47 +  gtk_widget_class_install_style_property (widget_class,
48 +                                          g_param_spec_int ("height-increment",
49 +                                                            "Height Increment",
50 +                                                            "The amount of pixels to add to the height size request.",
51 +                                                            G_MININT,
52 +                                                            G_MAXINT,
53 +                                                            DEFAULT_WIDTH_INCREMENT,
54 +                                                            G_PARAM_READWRITE));
55 +
56 +  gtk_widget_class_install_style_property (widget_class,
57 +                                          g_param_spec_int ("text-xnudge",
58 +                                                            "Text XNudge",
59 +                                                            "Amount of pixels to move the text x position.",
60 +                                                            G_MININT,
61 +                                                            G_MAXINT,
62 +                                                            DEFAULT_TEXT_XNUDGE,
63 +                                                            G_PARAM_READWRITE));
64 +
65 +  gtk_widget_class_install_style_property (widget_class,
66 +                                          g_param_spec_int ("text-ynudge",
67 +                                                            "Text YNudge",
68 +                                                            "Amount of pixels to move the text y position.",
69 +                                                            G_MININT,
70 +                                                            G_MAXINT,
71 +                                                            DEFAULT_TEXT_YNUDGE,
72 +                                                            G_PARAM_READWRITE));
73  }
74  
75  static void
76 @@ -364,7 +416,9 @@
77  {
78    GtkWidget *pbar;
79  
80 -  pbar = gtk_widget_new (GTK_TYPE_PROGRESS_BAR, NULL);
81 +  pbar = gtk_widget_new (GTK_TYPE_PROGRESS_BAR, 
82 +                        "text-xalign", 0.0, /* OSSO addition. */
83 +                        NULL);
84  
85    return pbar;
86  }
87 @@ -494,15 +548,23 @@
88    PangoRectangle logical_rect;
89    PangoLayout *layout;
90    gint width, height;
91 +  gint text_spacing;
92 +  gint width_increment, height_increment;
93  
94    g_return_if_fail (GTK_IS_PROGRESS_BAR (widget));
95    g_return_if_fail (requisition != NULL);
96 +  
97 +  gtk_widget_style_get (widget,
98 +                       "text-spacing", &text_spacing,
99 +                       "width-increment", &width_increment,
100 +                       "height-increment", &height_increment,
101 +                       NULL);
102  
103    progress = GTK_PROGRESS (widget);
104    pbar = GTK_PROGRESS_BAR (widget);
105  
106 -  width = 2 * widget->style->xthickness + 3 + 2 * TEXT_SPACING;
107 -  height = 2 * widget->style->ythickness + 3 + 2 * TEXT_SPACING;
108 +  width = 2 * widget->style->xthickness + width_increment + 2 * text_spacing;
109 +  height = 2 * widget->style->ythickness + height_increment + 2 * text_spacing;
110  
111    if (progress->show_text && pbar->bar_style != GTK_PROGRESS_DISCRETE)
112      {
113 @@ -780,6 +842,13 @@
114    PangoRectangle logical_rect;
115    GdkRectangle prelight_clip, normal_clip;
116    
117 +  gint text_xnudge, text_ynudge;
118 +  
119 +  gtk_widget_style_get (widget,
120 +                       "text-xnudge", &text_xnudge,
121 +                       "text-ynudge", &text_ynudge,
122 +                       NULL);
123 +  
124    buf = gtk_progress_get_current_text (progress);
125    
126    layout = gtk_widget_create_pango_layout (widget, buf);
127 @@ -789,12 +858,12 @@
128  
129    pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
130    
131 -  x = widget->style->xthickness + 1 +
132 +  x = widget->style->xthickness + text_xnudge +
133      (widget->allocation.width - 2 * widget->style->xthickness -
134       2 - logical_rect.width)
135      * progress->x_align; 
136  
137 -  y = widget->style->ythickness + 1 +
138 +  y = widget->style->ythickness + text_ynudge +
139      (widget->allocation.height - 2 * widget->style->ythickness -
140       2 - logical_rect.height)
141      * progress->y_align;