From 6a47756c2b3e88fe271ca94ea6014e08c0f35b8c Mon Sep 17 00:00:00 2001 From: ketmar Date: Sat, 14 Sep 2013 07:45:54 +0300 Subject: [PATCH] icons.*: cosmetix --- src/icons.c | 52 +++++++++++++++++++--------------------------------- src/icons.h | 41 ++++++++++++++++++++--------------------- 2 files changed, 39 insertions(+), 54 deletions(-) rewrite src/icons.h (61%) diff --git a/src/icons.c b/src/icons.c index 4509b35..a5ff3df 100644 --- a/src/icons.c +++ b/src/icons.c @@ -1,7 +1,5 @@ /* logjam - a GTK client for LiveJournal. * Copyright (C) 2000-2003 Evan Martin - * - * vim: tabstop=4 shiftwidth=4 noexpandtab : */ #include @@ -12,13 +10,14 @@ #include "icons.h" #include "pixbufs.h" -static GtkStockItem logjam_stock_items[] = { + +static const GtkStockItem logjam_stock_items[] = { /* XXX we shouldn't need those spaces in there for this to look good. :( */ - { "logjam-submit", N_(" Submit "), 0, 0, "logjam" } + {"logjam-submit", N_(" Submit "), 0, 0, "logjam"} }; -static GdkPixbuf* -inline_to_listpixbuf(const guint8 *data) { + +static GdkPixbuf *inline_to_listpixbuf (const guint8 *data) { GdkPixbuf *pb, *spb; gint width, height, sourcewidth, sourceheight; @@ -29,30 +28,21 @@ inline_to_listpixbuf(const guint8 *data) { /* now adjust width to be proportionate to the height for this icon. */ sourceheight = gdk_pixbuf_get_height(pb); sourcewidth = gdk_pixbuf_get_width(pb); - width = sourcewidth * height / sourceheight; + width = sourcewidth*height/sourceheight; spb = gdk_pixbuf_scale_simple(pb, width, height, GDK_INTERP_BILINEAR); g_object_unref(pb); return spb; } -GdkPixbuf* -icons_rarrow_pixbuf(void) { - return inline_to_listpixbuf(logjam_rarrow); -} -GdkPixbuf* -icons_larrow_pixbuf(void) { - return inline_to_listpixbuf(logjam_larrow); -} -GdkPixbuf* -icons_lrarrow_pixbuf(void) { - return inline_to_listpixbuf(logjam_lrarrow); -} -static GdkPixbuf* -add(GtkIconFactory *factory, - const guchar *inline_data, - const gchar *stock_id) { + +GdkPixbuf *icons_rarrow_pixbuf (void) { return inline_to_listpixbuf(logjam_rarrow); } +GdkPixbuf *icons_larrow_pixbuf (void) { return inline_to_listpixbuf(logjam_larrow); } +GdkPixbuf *icons_lrarrow_pixbuf (void) { return inline_to_listpixbuf(logjam_lrarrow); } + + +static GdkPixbuf *add (GtkIconFactory *factory, const guchar *inline_data, const gchar *stock_id) { GtkIconSet *set; GdkPixbuf *pixbuf; @@ -66,8 +56,8 @@ add(GtkIconFactory *factory, return pixbuf; } -void -icons_initialize(void) { + +void icons_initialize (void) { GtkIconFactory *factory; GdkPixbuf *goat; GList *l; @@ -88,17 +78,15 @@ icons_initialize(void) { gtk_stock_add_static(logjam_stock_items, G_N_ELEMENTS(logjam_stock_items)); } + #ifndef HAVE_LIBRSVG -void -icons_load_throbber(GdkPixbuf *pbs[]) { +void icons_load_throbber (GdkPixbuf *pbs[]) { const guint8 *data; int i; GdkPixbuf *pb; gint w, h; - gtk_icon_size_lookup(GTK_ICON_SIZE_DIALOG, &w, &h); - - for (i = 0; i < THROBBER_COUNT; i++) { + for (i = 0; i < THROBBER_COUNT; ++i) { switch (i) { case 0: data = logjam_throbber_1; break; case 1: data = logjam_throbber_2; break; @@ -108,9 +96,7 @@ icons_load_throbber(GdkPixbuf *pbs[]) { case 5: data = logjam_throbber_6; break; case 6: data = logjam_throbber_7; break; case 7: data = logjam_throbber_8; break; - default: - g_warning("tried to load unknown throbber %d.", i); - return; + default: g_warning("tried to load unknown throbber %d.", i); return; } pb = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL); pbs[i] = gdk_pixbuf_scale_simple(pb, w, h, GDK_INTERP_BILINEAR); diff --git a/src/icons.h b/src/icons.h dissimilarity index 61% index 4ab5b33..bce0187 100644 --- a/src/icons.h +++ b/src/icons.h @@ -1,21 +1,20 @@ -/* logjam - a GTK client for LiveJournal. - * Copyright (C) 2000-2003 Evan Martin - * - * vim: tabstop=4 shiftwidth=4 noexpandtab : - */ - -#ifndef icons_h -#define icons_h - -void icons_initialize(void); -GdkPixbuf* icons_rarrow_pixbuf(void); -GdkPixbuf* icons_larrow_pixbuf(void); -GdkPixbuf* icons_lrarrow_pixbuf(void); - -#ifndef HAVE_LIBRSVG -/* how many throbber images we have... */ -#define THROBBER_COUNT 8 -void icons_load_throbber(GdkPixbuf *pbs[]); -#endif /* HAVE_LIBRSVG */ - -#endif /* icons_h */ +/* logjam - a GTK client for LiveJournal. + * Copyright (C) 2000-2003 Evan Martin + */ +#ifndef __LOGJAM_ICONS_H_ +#define __LOGJAM_ICONS_H_ + + +extern void icons_initialize (void); +extern GdkPixbuf *icons_rarrow_pixbuf (void); +extern GdkPixbuf *icons_larrow_pixbuf (void); +extern GdkPixbuf *icons_lrarrow_pixbuf (void); + +#ifndef HAVE_LIBRSVG +/* how many throbber images we have... */ +#define THROBBER_COUNT (8) +extern void icons_load_throbber (GdkPixbuf *pbs[]); +#endif /* HAVE_LIBRSVG */ + + +#endif -- 2.11.4.GIT