Skip to content

Commit

Permalink
More indenting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
epienbroek committed Nov 25, 2012
1 parent 01427ac commit 5dc7c76
Showing 1 changed file with 59 additions and 63 deletions.
122 changes: 59 additions & 63 deletions src/mn-mail-icon-widget.gob
Expand Up @@ -154,13 +154,12 @@ class MN:Mail:Icon:Widget from Mn:Widget
mn_expose_event (GtkWidget *widget, GdkEventExpose *event) mn_expose_event (GtkWidget *widget, GdkEventExpose *event)
{ {
#if !GTK_CHECK_VERSION(3,0,0) #if !GTK_CHECK_VERSION(3,0,0)
Self *self = SELF(widget); Self *self = SELF(widget);


if (! GTK_WIDGET_DRAWABLE(widget) || ! selfp->stock_id) if (! GTK_WIDGET_DRAWABLE(widget) || ! selfp->stock_id)
return FALSE; return FALSE;


if (selfp->is_on) if (selfp->is_on) {
{
int x; int x;
int y; int y;
GdkRectangle image_area; GdkRectangle image_area;
Expand All @@ -175,31 +174,29 @@ class MN:Mail:Icon:Widget from Mn:Widget
image_area.width = widget->requisition.width; image_area.width = widget->requisition.width;
image_area.height = widget->requisition.height; image_area.height = widget->requisition.height;


if (gdk_rectangle_intersect(&event->area, &image_area, &image_area)) if (gdk_rectangle_intersect(&event->area, &image_area, &image_area)) {
{ GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf;

pixbuf = self_render_icon(self);
pixbuf = self_render_icon(self);

gdk_draw_pixbuf(widget->window,
gdk_draw_pixbuf(widget->window, NULL,
NULL, pixbuf,
pixbuf, image_area.x - x,
image_area.x - x, image_area.y - y,
image_area.y - y, image_area.x,
image_area.x, image_area.y,
image_area.y, image_area.width,
image_area.width, image_area.height,
image_area.height, GDK_RGB_DITHER_NORMAL,
GDK_RGB_DITHER_NORMAL, 0,
0, 0);
0);

g_object_unref(pixbuf);
g_object_unref(pixbuf); }
} }
}


if (selfp->count) if (selfp->count) {
{
PangoRectangle count_rect; PangoRectangle count_rect;
int count_x; int count_x;
int count_y; int count_y;
Expand All @@ -208,22 +205,21 @@ class MN:Mail:Icon:Widget from Mn:Widget
int box_width; int box_width;
int box_height; int box_height;


if (! selfp->count_layout) if (! selfp->count_layout) {
{ const char *size;
const char *size; char *markup;
char *markup;


if (widget->allocation.height < 32) if (widget->allocation.height < 32)
size = "small"; size = "small";
else else
size = "medium"; size = "medium";


selfp->count_layout = gtk_widget_create_pango_layout(widget, NULL); selfp->count_layout = gtk_widget_create_pango_layout(widget, NULL);


markup = g_strdup_printf("<span size=\"%s\">%i</span>", size, selfp->count); markup = g_strdup_printf("<span size=\"%s\">%i</span>", size, selfp->count);
pango_layout_set_markup(selfp->count_layout, markup, -1); pango_layout_set_markup(selfp->count_layout, markup, -1);
g_free(markup); g_free(markup);
} }


pango_layout_get_pixel_extents(selfp->count_layout, &count_rect, NULL); pango_layout_get_pixel_extents(selfp->count_layout, &count_rect, NULL);


Expand All @@ -237,31 +233,31 @@ class MN:Mail:Icon:Widget from Mn:Widget
count_y = box_y - count_rect.y + COUNT_BOX_YPAD; count_y = box_y - count_rect.y + COUNT_BOX_YPAD;


gtk_paint_box(widget->style, gtk_paint_box(widget->style,
widget->window, widget->window,
GTK_WIDGET_STATE(widget), GTK_WIDGET_STATE(widget),
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
&event->area, &event->area,
widget, widget,
NULL, NULL,
box_x, box_x,
box_y, box_y,
box_width, box_width,
box_height); box_height);


gtk_paint_layout(widget->style, gtk_paint_layout(widget->style,
widget->window, widget->window,
GTK_WIDGET_STATE(widget), GTK_WIDGET_STATE(widget),
FALSE, FALSE,
&event->area, &event->area,
widget, widget,
NULL, NULL,
count_x, count_x,
count_y, count_y,
selfp->count_layout); selfp->count_layout);
} }
#endif #endif


return FALSE; return FALSE;
} }


/* GTK3 only */ /* GTK3 only */
Expand Down

0 comments on commit 5dc7c76

Please sign in to comment.