From 2cb278cdb32ef13e6a2fe744a26c4a09294d6b50 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 27 Jul 2008 07:39:39 +0200 Subject: [PATCH] Add Midori and news-feed icons, improve waf scripts Add small, optimized application icons and an all new news-feed icon including optimized versions. The build scripts are updated, and the data folder renamed to icons. Plus the wscript_build is improved. Of course, Midori now tests the icon theme for news-feed and uses it. --- Makefile.am | 2 +- configure.in | 4 +- data/wscript_build | 38 ---- icons/16x16/midori.png | Bin 0 -> 937 bytes icons/16x16/news-feed.png | Bin 0 -> 832 bytes icons/22x22/midori.png | Bin 0 -> 1400 bytes icons/22x22/news-feed.png | Bin 0 -> 1249 bytes {data => icons}/Makefile.am | 2 +- {data => icons/scalable}/midori.svg | 0 icons/scalable/news-feed.svg | 280 ++++++++++++++++++++++++++++ icons/wscript_build | 47 +++++ midori/main.c | 1 + midori/main.h | 2 +- midori/midori-browser.c | 22 ++- wscript | 10 +- 15 files changed, 356 insertions(+), 52 deletions(-) delete mode 100644 data/wscript_build create mode 100644 icons/16x16/midori.png create mode 100644 icons/16x16/news-feed.png create mode 100644 icons/22x22/midori.png create mode 100644 icons/22x22/news-feed.png rename {data => icons}/Makefile.am (93%) rename {data => icons/scalable}/midori.svg (100%) create mode 100644 icons/scalable/news-feed.svg create mode 100644 icons/wscript_build diff --git a/Makefile.am b/Makefile.am index 5270e0d9..9a6151c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = gnu -SUBDIRS = katze midori po data +SUBDIRS = katze midori po icons desktopdir = $(datadir)/applications desktop_in_files = midori.desktop diff --git a/configure.in b/configure.in index 097f30ba..b4f78bab 100644 --- a/configure.in +++ b/configure.in @@ -52,7 +52,7 @@ AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) # Checks for gtksourceview -PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview, have_gtksourceview=true, have_gtksourceview=false) +PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-2.0, have_gtksourceview=true, have_gtksourceview=false) AC_SUBST(GTKSOURCEVIEW_CFLAGS) AC_SUBST(GTKSOURCEVIEW_LIBS) @@ -92,6 +92,6 @@ AC_CONFIG_FILES([ katze/Makefile \ midori/Makefile \ po/Makefile.in \ - data/Makefile + icons/Makefile ]) AC_OUTPUT diff --git a/data/wscript_build b/data/wscript_build deleted file mode 100644 index 83fcaa08..00000000 --- a/data/wscript_build +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env python -# WAF build script for midori - -import os -import pproc as subprocess - -srcdir = os.getcwd () -blddir = bld.m_bdir - -install_files ('DATADIR', 'icons/hicolor/scalable/apps', 'midori.svg') - -if bld.env ()['CONVERT']: - def mkdir (path): - if not os.access (path, os.F_OK): - os.mkdir (path) - - mkdir (blddir + '/icons') - - for size in [16, 24, 32, 48]: - format = str (size) + 'x' + str (size) - if size < 32: - small = str ((size / 3)) + 'x' + str ((size / 3.5)) - else: - small = '0x0' - - mkdir (blddir + '/icons/' + format) - convert = subprocess.Popen (['convert', '-adaptive-sharpen', small, - '-background', 'transparent', - '-geometry', format, '-extent', format, - srcdir + '/data/midori.svg', - blddir + '/icons/' + format + '/midori.png'], - stderr=subprocess.PIPE) - if not convert.wait (): - install_files ('DATADIR', 'icons/hicolor/' + format + '/apps', - blddir + '/icons/' + format + '/midori.png') - else: - Params.pprint ('BLUE', "Optimized icons could not be created.") - break diff --git a/icons/16x16/midori.png b/icons/16x16/midori.png new file mode 100644 index 0000000000000000000000000000000000000000..578f6cb5a00118b1d5bc295d955977c2bb3fd4a2 GIT binary patch literal 937 zcmV;a16KTrP)wK#uy$q&+aG0vC#pC?2<+0MO~{pw@=u;06_om zuq!V2Dw6uX$V=O*X3fKF1`GCxZ8?JvG~{6px(_QGWKlUUQrA<_NR*ByZT}y zyUa$OBlJw9DKdQV^XUu!anKnja&s_pk}$q+N34fNTcQ{|KBSwql}|0xKE`acQBIg} ziAqRuDKh~60d&TR$E!4^SNWd|_rEp(x9mpz$f06YHx8tR*{Kct$g2V`e)rBBZ>v-3 z-}&XgvV8pqopC|~-r!hUOMAF?doQxa9A@s`E0oKXNoM2L#sPX!RXnke`af(~-?|Rz z^fdChV!jS&3at4=7L~SLuk_$v;Wk`?3!y+r;=p%FlIzEvTX)c&?K{=9HUiCRfMJ+e z`ZGHZ0Ce*~!g-a(k6+)jm*mTfFzh1oriK<@yD~iVEeIh}$y`RVa31q|3hO*EOs6wu zwPM@^0J^0;);G6s-_x`zjGC##D}<1$UcgxHEL=qu91);f1pt6RB=C-eg~eqa43hxB zxkR~Hl|2x65tpuA#$@Ua+|&<+`tXdr2kSju^^{a0fZ4fusET_jlVCLf;FtrRFap9+ zj8BfEb5jQv^}BdJ(1)SJC*iRob%0-5jm*p}BuPp>*l}RsR!j>#;b7<{cmZ&jgKCZg z<#|xWssq-zH(_dO8kI`rY8?>th0bKNIcMbhH3&q4Q8VGdLa|VS&)*1>82|vU5QMfw zkWBuvqG^@y>wrVM&n-T;v14HD=kZcavoV)hKv;en&8<&hc6J^r2_xF@GGf6uar*RG zL?Ww?XA*4rp!=-~C?CVGC+6cZp`VI5@d`@@w3;e`H3ZtVp|0tEpYcmOE zKe9~kef`o`zux(6AfGEpB9*Q)#;#CG-(rmYR4!|uWfJWEzx96u5FbvYYfsRx00000 LNkvXXu0mjfOOLK> literal 0 HcmV?d00001 diff --git a/icons/16x16/news-feed.png b/icons/16x16/news-feed.png new file mode 100644 index 0000000000000000000000000000000000000000..05363c5a9a8612b6cba1757decaedfb8d7c28c17 GIT binary patch literal 832 zcmV-G1Hb%_dv{xNPqk>5rYMj%?nsO|;#GuN}hOxr*g~L5vU-qCzaN z=plN-f+y|d^ww(>KJ0R)wlU2d8oKcHG5pYr$l`61g<0J7ab*7Yk|KHt9V~j{+!B?Z zUev$=<-8)KOE-y0igq{9Ejx*|eYoGg#!Y_;MP5=AD_Ca{>=ELsL8;irT|Z0q_YG{* zc0yx}xZ`Pxy)P3t)yY0T1|bKt^%6Bm0L%jnlCIhDz`+3>|F zvLD|=v_l*{jhNytega+HX!FGV1ku2-vh%~w;-5MLH@+j8`UtD`5=KwsralC}i1rNK zN8r{7tY{PV9!0nA!9s`Z%U99iV_4rX6w4%YSFu_X>#ie9w?G6lEHQ|xipUCFJB!R+ zA)UPd8jw3PkX6xvQRL5QSZ<+>LnIIOp=tz0Wa4D@&EWn=5BKk?NpWQgU7BCpjQ>@# zc`I)B|D%A8PbVssZ!)+BKEm69bbHd&2|Vnr$(0?&5OZ z4oAeyIQNnqNV4pMqKG3QYS-%NqE=4&Ke@R|b}7$`H(oh!7ybe76MU%xdKyXq0000< KMNUMnLSTXc=6s6) literal 0 HcmV?d00001 diff --git a/icons/22x22/midori.png b/icons/22x22/midori.png new file mode 100644 index 0000000000000000000000000000000000000000..85523e8fdf0d804d2d11ace7d08fc5cc1c9b034e GIT binary patch literal 1400 zcmV-;1&8{HP)U>z7+2+eavV<)&Cb~WB!H1d6WG2pN;{LhKY>Qi}6XTy{1C7pTKmRZ_n*Ldl+6hja2fpZxO8$&aCw;(3?H$FKk@095ciUrs44OC%D%sD8S8 zx`uxa%m&~UQM7Co1bzb{MhXCM92X>nd;;L}nf3n*dmFfAX=$mS3W89vXi-kQsA#c# z?b;1P)AasWOxvaF`VXp~8Xh0xn)!}-RutX_zBE1E{gtL^B^x)c=U1;@i92`h;n1Nk zqK07{h{xj}s(xw!K-p_4`@`Y!cL9{EetP|x9hdKL@3C6Ny|uN~mddK-5G_`mKi5J| zocKAcX~1Y$Jm@s$5};jSA4MdJsx5lVQmxx zw?c{I$A26*45LEz)846C#b%Sv7ZoioYHWN{Ja+6`Sgj)aM8+N;!`f`psnXKoo0^&`*XGSWftWfbCL$ynjRl^7W!ZKlH+Nyh z&bM9{AA~!h>pIeJdo11ChvN0zhyUY_*CXZQs5vWmxZpt`Wo&It(L@p-2yky{njAyWWv47D3L= z&H}+Ct~@x2zaF>4q$U{3KoV>i8w-m7`jW86$5bhbE4Qqygy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cPoSGDYsJdN1nI4+STU%v%0W#sa!n72;yBG3K^M2siF0T=N#{^3V94uRt`MIAp4@ z3pe6-?VhlaE`v + +image/svg+xml \ No newline at end of file diff --git a/icons/wscript_build b/icons/wscript_build new file mode 100644 index 00000000..bbf8ad64 --- /dev/null +++ b/icons/wscript_build @@ -0,0 +1,47 @@ +#! /usr/bin/env python +# WAF build script for midori + +def add_image (bld, install_files, category, name): + import os + import pproc as subprocess + + srcdir = os.getcwd () + blddir = bld.m_bdir + + def mkdir (path): + if not os.access (path, os.F_OK): + os.mkdir (path) + + def _install_files (folder, destination, source): + try: + install_files (folder, destination, source) + except: + pass + + if bld.env ()['CONVERT']: + mkdir (blddir + '/icons') + + for size in [16, 22, 32, 48]: + format = str (size) + 'x' + str (size) + if os.access (srcdir + '/icons/' + format + '/' + name + '.png', os.F_OK): + _install_files ('DATADIR', 'icons/hicolor/' + format + '/' + category, + srcdir + '/icons/' + format + '/' + name + '.png') + elif not bld.env ()['CONVERT']: + pass + elif os.access (srcdir + '/icons/scalable/' + name + '.svg', os.F_OK): + mkdir (blddir + '/icons/' + format) + convert = subprocess.Popen (['convert', + '-background', 'transparent', + '-geometry', format, '-extent', format, + srcdir + '/icons/scalable/' + name + '.svg', + blddir + '/icons/' + format + '/' + name + '.png'], + stderr=subprocess.PIPE) + if not convert.wait (): + _install_files ('DATADIR', 'icons/hicolor/' + format + '/' + category, + blddir + '/icons/' + format + '/' + name + '.png') + else: + Params.pprint ('BLUE', "Optimized icons could not be created.") + break + +add_image (bld, install_files, 'apps', 'midori') +add_image (bld, install_files, 'status', 'news-feed') diff --git a/midori/main.c b/midori/main.c index 32f14517..c586d8ee 100644 --- a/midori/main.c +++ b/midori/main.c @@ -35,6 +35,7 @@ stock_items_init (void) { static GtkStockItem items[] = { + { STOCK_NEWS_FEED }, { STOCK_LOCK_OPEN }, { STOCK_LOCK_SECURE }, { STOCK_LOCK_BROKEN }, diff --git a/midori/main.h b/midori/main.h index f9fcf4df..29b1bb53 100644 --- a/midori/main.h +++ b/midori/main.h @@ -31,7 +31,7 @@ KatzeXbelItem* bookmarks; #define STOCK_BOOKMARK GTK_STOCK_FILE /* "stock_bookmark" "bookmark-web" */ #define STOCK_FORM_FILL GTK_STOCK_JUSTIFY_FILL /* "insert-text" "form-fill" */ -#define STOCK_NEWSFEED GTK_STOCK_INDEX +#define STOCK_NEWS_FEED "news-feed" /* We assume that these legacy icon names are usually present */ diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 1d23ec7b..03511b79 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -71,6 +71,8 @@ struct _MidoriBrowser GtkWidget* statusbar; GtkWidget* progressbar; + const gchar* stock_news_feed; + gchar* statusbar_text; MidoriWebSettings* settings; GList* tab_titles; @@ -475,7 +477,7 @@ midori_web_view_news_feed_ready_cb (MidoriWebView* web_view, { gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY ( gtk_bin_get_child (GTK_BIN (browser->location))), - GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INDEX); + GTK_ICON_ENTRY_SECONDARY, browser->stock_news_feed); } static gboolean @@ -3035,16 +3037,24 @@ static const gchar* ui_markup = ""; static void -midori_browser_realize_cb (GtkStyle* style, MidoriBrowser* browser) +midori_browser_realize_cb (GtkStyle* style, + MidoriBrowser* browser) { - GdkScreen* screen = gtk_widget_get_screen (GTK_WIDGET (browser)); + GdkScreen* screen; + GtkIconTheme* icon_theme; + + screen = gtk_widget_get_screen (GTK_WIDGET (browser)); if (screen) { - GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen); + icon_theme = gtk_icon_theme_get_for_screen (screen); if (gtk_icon_theme_has_icon (icon_theme, "midori")) gtk_window_set_icon_name (GTK_WINDOW (browser), "midori"); else gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser"); + if (gtk_icon_theme_has_icon (icon_theme, STOCK_NEWS_FEED)) + browser->stock_news_feed = STOCK_NEWS_FEED; + else + browser->stock_news_feed = GTK_STOCK_INDEX; } } @@ -3120,6 +3130,8 @@ midori_browser_init (MidoriBrowser* browser) { GtkRcStyle* rcstyle; + browser->stock_news_feed = GTK_STOCK_INDEX; + /* Setup the window metrics */ g_signal_connect (browser, "realize", G_CALLBACK (midori_browser_realize_cb), browser); @@ -3233,7 +3245,7 @@ midori_browser_init (MidoriBrowser* browser) /* FIXME: Due to a bug in GtkIconEntry we need to set an initial icon */ gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY ( gtk_bin_get_child (GTK_BIN (browser->location))), - GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INDEX); + GTK_ICON_ENTRY_SECONDARY, browser->stock_news_feed); gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY ( gtk_bin_get_child (GTK_BIN (browser->location))), GTK_ICON_ENTRY_SECONDARY, TRUE); diff --git a/wscript b/wscript index c42e0dca..cfef9ce5 100644 --- a/wscript +++ b/wscript @@ -65,7 +65,7 @@ def set_options (opt): help='Disables native language support', dest='disable_nls') def build (bld): - bld.add_subdirs ('katze midori data') + bld.add_subdirs ('katze midori icons') if bld.env ()['INTLTOOL']: bld.add_subdirs ('po') @@ -89,9 +89,11 @@ def shutdown (): if not Params.g_options.destdir: # update the pixmap cache directory try: - subprocess.call (['gtk-update-icon-cache', '-q', '-f', '-t', dir]) - Params.pprint ('YELLOW', "Updated Gtk icon cache.") - icon_cache_updated = True + uic = subprocess.Popen (['gtk-update-icon-cache', '-q', '-f', '-t', dir], + stderr=subprocess.PIPE) + if not uic.wait (): + Params.pprint ('YELLOW', "Updated Gtk icon cache.") + icon_cache_updated = True except: Params.pprint ('RED', "Failed to update icon cache.") if not icon_cache_updated: