lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
List overview
Commits
April 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
commits@lists.geany.org
1 participants
154 discussions
Start a n
N
ew thread
[geany/geany] 64bc67: Distribute `geany.gtkrc` and `geany.css` files
by Matthew Brush
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Apr 2014 12:59:07 UTC Commit: 64bc67916d9d27c7e4ddb0d0a399cbf157a135cc
https://github.com/geany/geany/commit/64bc67916d9d27c7e4ddb0d0a399cbf157a13…
Log Message: ----------- Distribute `geany.gtkrc` and `geany.css` files Maybe they aren't dist'ed if they are in Automake conditional? This probably makes both GTK2 and GTK3 files installed unconditionally. Modified Paths: -------------- Makefile.am Modified: Makefile.am 10 lines changed, 3 insertions(+), 7 deletions(-) =================================================================== @@ -25,13 +25,9 @@ SYS_DATA_FILES = \ $(srcdir)/data/templates/* \ $(srcdir)/data/templates/files/* \ $(srcdir)/data/colorschemes/* \ - $(top_srcdir)/data/geany.glade - -if GTK3 - $(top_srcdir)/data/geany.css -else - $(top_srcdir)/data/geany.gtkrc -endif + $(top_srcdir)/data/geany.glade \ + data/geany.css \ + data/geany.gtkrc EXTRA_DIST = \ autogen.sh \ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] a851f8: Update NEWS
by Colomban Wendling
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Apr 2014 12:59:07 UTC Commit: a851f87a62a970c380469ba7daf707df249d017b
https://github.com/geany/geany/commit/a851f87a62a970c380469ba7daf707df249d0…
Log Message: ----------- Update NEWS Modified Paths: -------------- NEWS Modified: NEWS 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -1,5 +1,8 @@ Geany 1.24.1 (unreleased) + General + * Fix distribution of custom GTK style files (#1037). + Geany 1.24 (April 13, 2014) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] a96a2b: Cleanup documentation files installation
by Colomban Wendling
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Apr 2014 12:43:34 UTC Commit: a96a2b08ce5c70bcb2955ce5b7ee70b60f431117
https://github.com/geany/geany/commit/a96a2b08ce5c70bcb2955ce5b7ee70b60f431…
Log Message: ----------- Cleanup documentation files installation Don't use wildcards to select files to install, nor manually perform the installation when Automake could do it for us. Modified Paths: -------------- doc/Makefile.am Modified: doc/Makefile.am 54 files changed, 37 insertions(+), 17 deletions(-) =================================================================== @@ -1,11 +1,43 @@ man_MANS=geany.1 + +htmldocimagesdir = $(docdir)/html/images +dist_htmldocimages_DATA = \ + images/build_menu_commands_dialog.png \ + images/find_dialog.png \ + images/find_in_files_dialog.png \ + images/main_window.png \ + images/pref_dialog_edit_completions.png \ + images/pref_dialog_edit_display.png \ + images/pref_dialog_edit_features.png \ + images/pref_dialog_edit_indentation.png \ + images/pref_dialog_files.png \ + images/pref_dialog_gen_misc.png \ + images/pref_dialog_gen_startup.png \ + images/pref_dialog_interface_interface.png \ + images/pref_dialog_interface_notebook.png \ + images/pref_dialog_interface_toolbar.png \ + images/pref_dialog_keys.png \ + images/pref_dialog_printing.png \ + images/pref_dialog_templ.png \ + images/pref_dialog_tools.png \ + images/pref_dialog_various.png \ + images/pref_dialog_vte.png \ + images/replace_dialog.png + +doc_DATA = \ + $(top_srcdir)/AUTHORS \ + $(top_srcdir)/ChangeLog \ + $(top_srcdir)/COPYING \ + $(top_srcdir)/NEWS \ + $(top_srcdir)/README \ + $(top_srcdir)/THANKS \ + $(top_srcdir)/TODO + DOCDIR = $(DESTDIR)$(docdir) -IMAGE_FILES = images/*.png EXTRA_DIST = geany.html geany.css geany.txt geany.1 \ plugins.dox pluginsymbols.c pluginsignals.c \ stash-example.c stash-gui-example.c \ - makefile.win32 \ - $(srcdir)/$(IMAGE_FILES) + makefile.win32 geany-$(VERSION).pdf: geany.txt rst2latex -stg --documentoptions="10pt,a4paper" --output-encoding=utf8 $(srcdir)/geany.txt geany.tex @@ -40,22 +72,10 @@ doc-clean: uninstall-local: rm -rf $(DOCDIR); +# manually install some files under another name install-data-local: - $(mkinstalldirs) $(DOCDIR)/html/images - for file in `ls $(srcdir)/$(IMAGE_FILES)`; do \ - if [ -f $$file ]; then \ - basefile=`echo $$file | sed -e 's,^.*/,,'`; \ - $(INSTALL_DATA) $$file $(DOCDIR)/html/images/$$basefile; \ - fi \ - done + $(mkinstalldirs) $(DOCDIR)/html $(INSTALL_DATA) $(srcdir)/geany.html $(DOCDIR)/html/index.html $(INSTALL_DATA) $(srcdir)/geany.txt $(DOCDIR)/manual.txt - $(INSTALL_DATA) $(top_srcdir)/README $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/ChangeLog $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/NEWS $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/COPYING $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/AUTHORS $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/TODO $(DOCDIR) - $(INSTALL_DATA) $(top_srcdir)/THANKS $(DOCDIR) $(INSTALL_DATA) $(top_srcdir)/scintilla/License.txt $(DOCDIR)/ScintillaLicense.txt -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 451d58: Cleanup data files installation
by Colomban Wendling
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Apr 2014 12:43:25 UTC Commit: 451d58a2dd8eb0c068b5b24bbf663b4a8ef4b48e
https://github.com/geany/geany/commit/451d58a2dd8eb0c068b5b24bbf663b4a8ef4b…
Log Message: ----------- Cleanup data files installation Don't use wildcards to select files to install, nor manually perform the installation when Automake could do it for us. Using wildcards makes it hard to know what will really be installed, and may results in installing files not part of the distribution. Modified Paths: -------------- HACKING Makefile.am configure.ac data/Makefile.am Modified: HACKING 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -452,6 +452,8 @@ For languages with a Scintilla lexer, there should be a [styling] section, to correspond to the styles used in highlighting_styles_FOO[] in highlightingmappings.h - see below. +Don't forget to add the newly created filetype file to data/Makefile.am. + Syntax highlighting ^^^^^^^^^^^^^^^^^^^ It may be possible to use an existing Scintilla lexer in the scintilla/ Modified: Makefile.am 55 files changed, 5 insertions(+), 50 deletions(-) =================================================================== @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = tagmanager scintilla src plugins icons po doc tests +SUBDIRS = tagmanager scintilla src plugins icons po doc data tests AUTOMAKE_OPTIONS = 1.7 @@ -12,23 +12,6 @@ WIN32_BUILD_FILES = \ win32-config.h \ makefile.win32 -SYS_DATA_FILES = \ - data/c99.tags \ - data/php.tags \ - data/python.tags \ - data/pascal.tags \ - data/html_entities.tags \ - $(srcdir)/data/filetypes.* \ - data/filetype_extensions.conf \ - data/snippets.conf \ - data/ui_toolbar.xml \ - $(srcdir)/data/templates/* \ - $(srcdir)/data/templates/files/* \ - $(srcdir)/data/colorschemes/* \ - $(top_srcdir)/data/geany.glade \ - data/geany.css \ - data/geany.gtkrc - EXTRA_DIST = \ autogen.sh \ wscript \ @@ -45,7 +28,6 @@ EXTRA_DIST = \ intltool-extract.in \ intltool-merge.in \ intltool-update.in \ - $(SYS_DATA_FILES) \ $(WIN32_BUILD_FILES) DISTCLEANFILES = \ @@ -57,37 +39,10 @@ DISTCLEANFILES = \ uninstall-local: rm -rf $(DESTDIR)$(pkgdatadir); -install-data-local: install-data-only - @$(NORMAL_INSTALL) - -install-data-only: - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir); \ - $(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(pkgdatadir)/GPL-2; \ - for file in $(srcdir)/data/*; do \ - if test -f $$file; then \ - $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/; \ - fi \ - done - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates; - for file in $(srcdir)/data/templates/*; do \ - if test -f $$file; then \ - $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/templates/; \ - fi \ - done - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates/files; - for file in $(srcdir)/data/templates/files/*; do \ - if test -f $$file; then \ - $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/templates/files/; \ - fi \ - done - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/colorschemes; - for file in $(srcdir)/data/colorschemes/*; do \ - if test -f $$file; then \ - $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/colorschemes/; \ - fi \ - done - +# manually install some files under another name +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) + $(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(pkgdatadir)/GPL-2 dist-hook: @if test -d "$(top_srcdir)/.git"; then \ Modified: configure.ac 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -137,6 +137,7 @@ AC_CONFIG_FILES([ src/Makefile plugins/Makefile po/Makefile.in + data/Makefile doc/Makefile doc/geany.1 geany.spec Modified: data/Makefile.am 116 files changed, 116 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,116 @@ + +colorschemes = \ + colorschemes/alt.conf + +filetypes = \ + filetypes.abaqus \ + filetypes.abc \ + filetypes.actionscript \ + filetypes.ada \ + filetypes.asciidoc \ + filetypes.asm \ + filetypes.batch \ + filetypes.c \ + filetypes.caml \ + filetypes.Clojure.conf \ + filetypes.cmake \ + filetypes.cobol \ + filetypes.common \ + filetypes.conf \ + filetypes.cpp \ + filetypes.cs \ + filetypes.css \ + filetypes.CUDA.conf \ + filetypes.Cython.conf \ + filetypes.d \ + filetypes.diff \ + filetypes.docbook \ + filetypes.erlang \ + filetypes.f77 \ + filetypes.ferite \ + filetypes.forth \ + filetypes.fortran \ + filetypes.freebasic \ + filetypes.Genie.conf \ + filetypes.glsl \ + filetypes.Go.conf \ + filetypes.Graphviz.conf \ + filetypes.haskell \ + filetypes.haxe \ + filetypes.html \ + filetypes.java \ + filetypes.javascript \ + filetypes.latex \ + filetypes.lisp \ + filetypes.lua \ + filetypes.makefile \ + filetypes.markdown \ + filetypes.matlab \ + filetypes.nsis \ + filetypes.objectivec \ + filetypes.pascal \ + filetypes.perl \ + filetypes.php \ + filetypes.po \ + filetypes.powershell \ + filetypes.python \ + filetypes.r \ + filetypes.restructuredtext \ + filetypes.ruby \ + filetypes.rust \ + filetypes.Scala.conf \ + filetypes.sh \ + filetypes.sql \ + filetypes.tcl \ + filetypes.txt2tags \ + filetypes.vala \ + filetypes.verilog \ + filetypes.vhdl \ + filetypes.xml \ + filetypes.yaml + +tagfiles = \ + c99.tags \ + php.tags \ + python.tags \ + pascal.tags \ + html_entities.tags + +template_files = \ + templates/files/file.html \ + templates/files/file.php \ + templates/files/file.rb \ + templates/files/file.tex \ + templates/files/main.c \ + templates/files/main.cxx \ + templates/files/main.d \ + templates/files/main.java \ + templates/files/main.py \ + templates/files/main.vala \ + templates/files/module.erl \ + templates/files/program.pas + +templates = \ + templates/bsd \ + templates/changelog \ + templates/fileheader \ + templates/function \ + templates/gpl + +nobase_dist_pkgdata_DATA = \ + $(colorschemes) \ + $(filetypes) \ + $(tagfiles) \ + $(template_files) \ + $(templates) \ + filetype_extensions.conf \ + snippets.conf \ + ui_toolbar.xml \ + geany.glade + +if GTK3 +nobase_dist_pkgdata_DATA += geany.css +else +nobase_dist_pkgdata_DATA += geany.gtkrc +endif + -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/infrastructure] 82210b: Update github_commit_mail.py
by elextr
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: elextr <elextr(a)gmail.com> Committer: elextr <elextr(a)gmail.com> Date: Tue, 15 Apr 2014 03:33:18 UTC Commit: 82210b79811b4066b3351c576653c8eb6cac1ca5
https://github.com/geany/infrastructure/commit/82210b79811b4066b3351c576653…
Log Message: ----------- Update github_commit_mail.py Appears to be lines changed not files. Modified Paths: -------------- scripts/git_hooks/github_commit_mail.py Modified: scripts/git_hooks/github_commit_mail.py 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -51,7 +51,7 @@ This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
). ''' EMAIL_DIFF_TEMPLATE = u'''Modified: %(filename)s -%(changes)s files changed, %(additions)s insertions(+), %(deletions)s deletions(-) +%(changes)s lines changed, %(additions)s insertions(+), %(deletions)s deletions(-) =================================================================== %(patch)s -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] d11066: Merge pull request #242 from codebrainz/dist-gtkrc
by Matthew Brush
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Matthew Brush <mbrush(a)codebrainz.ca> Committer: Matthew Brush <mbrush(a)codebrainz.ca> Date: Tue, 15 Apr 2014 02:50:50 UTC Commit: d11066561e79d3a907b714ae68c37022f8488ccd
https://github.com/geany/geany/commit/d11066561e79d3a907b714ae68c37022f8488…
Log Message: ----------- Merge pull request #242 from codebrainz/dist-gtkrc Distribute `geany.gtkrc` and `geany.css` files Modified Paths: -------------- Makefile.am Modified: Makefile.am 10 files changed, 3 insertions(+), 7 deletions(-) =================================================================== @@ -25,13 +25,9 @@ SYS_DATA_FILES = \ $(srcdir)/data/templates/* \ $(srcdir)/data/templates/files/* \ $(srcdir)/data/colorschemes/* \ - $(top_srcdir)/data/geany.glade - -if GTK3 - $(top_srcdir)/data/geany.css -else - $(top_srcdir)/data/geany.gtkrc -endif + $(top_srcdir)/data/geany.glade \ + data/geany.css \ + data/geany.gtkrc EXTRA_DIST = \ autogen.sh \ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 157b44: Distribute `geany.gtkrc` and `geany.css` files
by Matthew Brush
15 Apr '14
15 Apr '14
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Matthew Brush <matt(a)geany.org> Date: Tue, 15 Apr 2014 02:42:22 UTC Commit: 157b44f443557f05543a9f4d05322ef1f4f24903
https://github.com/geany/geany/commit/157b44f443557f05543a9f4d05322ef1f4f24…
Log Message: ----------- Distribute `geany.gtkrc` and `geany.css` files Maybe they aren't dist'ed if they are in Automake conditional? This probably makes both GTK2 and GTK3 files installed unconditionally. Modified Paths: -------------- Makefile.am Modified: Makefile.am 10 files changed, 3 insertions(+), 7 deletions(-) =================================================================== @@ -25,13 +25,9 @@ SYS_DATA_FILES = \ $(srcdir)/data/templates/* \ $(srcdir)/data/templates/files/* \ $(srcdir)/data/colorschemes/* \ - $(top_srcdir)/data/geany.glade - -if GTK3 - $(top_srcdir)/data/geany.css -else - $(top_srcdir)/data/geany.gtkrc -endif + $(top_srcdir)/data/geany.glade \ + data/geany.css \ + data/geany.gtkrc EXTRA_DIST = \ autogen.sh \ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 01e7fe: Use GIcon for the filetype icon rather than rendered pixbuf
by Colomban Wendling
14 Apr '14
14 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Oct 2013 13:56:44 UTC Commit: 01e7fe4b79d0697ac2d03ab5ba18bd92a664ffc2
https://github.com/geany/geany/commit/01e7fe4b79d0697ac2d03ab5ba18bd92a664f…
Log Message: ----------- Use GIcon for the filetype icon rather than rendered pixbuf This allows to re-use the icon more easily since it's not rendered at a particular size but simply an icon description. It also allows for implicit icon updating when the theme changes if the display code implements it (and GTK widgets does). Modified Paths: -------------- src/dialogs.c src/filetypes.c src/filetypes.h src/main.c src/sidebar.c src/ui_utils.c src/ui_utils.h Modified: src/dialogs.c 6 files changed, 2 insertions(+), 4 deletions(-) =================================================================== @@ -1146,7 +1146,6 @@ void dialogs_show_file_properties(GeanyDocument *doc) GtkWidget *dialog, *label, *image, *check; gchar *file_size, *title, *base_name, *time_changed, *time_modified, *time_accessed, *enctext; gchar *short_name; - GdkPixbuf *pixbuf; #ifdef HAVE_SYS_TYPES_H struct stat st; off_t filesize; @@ -1220,9 +1219,8 @@ void dialogs_show_file_properties(GeanyDocument *doc) gtk_label_set_text(GTK_LABEL(label), base_name); image = ui_lookup_widget(dialog, "file_type_image"); - pixbuf = ui_get_mime_icon(doc->file_type->mime_type, GTK_ICON_SIZE_BUTTON); - gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); - g_object_unref(pixbuf); + gtk_image_set_from_gicon(GTK_IMAGE(image), doc->file_type->icon, + GTK_ICON_SIZE_BUTTON); label = ui_lookup_widget(dialog, "file_type_label"); gtk_label_set_text(GTK_LABEL(label), doc->file_type->title); Modified: src/filetypes.c 23 files changed, 2 insertions(+), 21 deletions(-) =================================================================== @@ -1384,11 +1384,9 @@ void filetypes_load_config(guint ft_id, gboolean reload) load_settings(ft_id, config, config_home); highlighting_init_styles(ft_id, config, config_home); - if (reload && ft->icon) - { + if (ft->icon) g_object_unref(ft->icon); - ft->icon = NULL; - } + ft->icon = ui_get_mime_icon(ft->mime_type); g_key_file_free(config); g_key_file_free(config_home); @@ -1798,20 +1796,3 @@ gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean singl return !EMPTY(*co); } - - -/* gets the filetype icon, possibly rendering it if not yet done - * Returns the filetype's icon, should not be freed - * - * This requires the mime_type setting so has to be done after the filetype - * is loaded, but we don't necessarily have GTK in filetypes_load_config(), - * so use a helper function that renders the icon if needed */ -GdkPixbuf *filetype_get_icon(GeanyFiletype *ft) -{ - g_return_val_if_fail(ft != NULL, NULL); - - if (! ft->icon) - ft->icon = ui_get_mime_icon(ft->mime_type, GTK_ICON_SIZE_MENU); - - return ft->icon; -} Modified: src/filetypes.h 4 files changed, 1 insertions(+), 3 deletions(-) =================================================================== @@ -139,7 +139,7 @@ struct GeanyFiletype gchar *error_regex_string; GeanyFiletype *lexer_filetype; gchar *mime_type; - GdkPixbuf *icon; + GIcon *icon; gchar *comment_single; /* single-line comment */ /* filetype indent settings, -1 if not set */ gint indent_type; @@ -218,8 +218,6 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message, gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean single_first, const gchar **co, const gchar **cc); -GdkPixbuf *filetype_get_icon(GeanyFiletype *ft); - G_END_DECLS #endif Modified: src/main.c 4 files changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1027,6 +1027,10 @@ gint main(gint argc, gchar **argv) gint config_dir_result; const gchar *locale; +#if ! GLIB_CHECK_VERSION(2, 36, 0) + g_type_init(); +#endif + log_handlers_init(); app = g_new0(GeanyApp, 1); Modified: src/sidebar.c 18 files changed, 9 insertions(+), 9 deletions(-) =================================================================== @@ -274,7 +274,7 @@ static void prepare_openfiles(void) /* store the icon and the short filename to show, and the index as reference, * the colour (black/red/green) and the full name for the tooltip */ - store_openfiles = gtk_tree_store_new(5, GDK_TYPE_PIXBUF, G_TYPE_STRING, + store_openfiles = gtk_tree_store_new(5, G_TYPE_ICON, G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(tv.tree_openfiles), GTK_TREE_MODEL(store_openfiles)); @@ -285,11 +285,12 @@ static void prepare_openfiles(void) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); icon_renderer = gtk_cell_renderer_pixbuf_new(); + g_object_set(icon_renderer, "stock-size", GTK_ICON_SIZE_MENU, NULL); text_renderer = gtk_cell_renderer_text_new(); g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL); column = gtk_tree_view_column_new(); gtk_tree_view_column_pack_start(column, icon_renderer, FALSE); - gtk_tree_view_column_set_attributes(column, icon_renderer, "pixbuf", DOCUMENTS_ICON, NULL); + gtk_tree_view_column_set_attributes(column, icon_renderer, "gicon", DOCUMENTS_ICON, NULL); gtk_tree_view_column_pack_start(column, text_renderer, TRUE); gtk_tree_view_column_set_attributes(column, text_renderer, "text", DOCUMENTS_SHORTNAME, "foreground-gdk", DOCUMENTS_COLOR, NULL); @@ -411,7 +412,7 @@ static GtkTreeIter *get_doc_parent(GeanyDocument *doc) gchar *dirname = NULL; static GtkTreeIter parent; GtkTreeModel *model = GTK_TREE_MODEL(store_openfiles); - static GdkPixbuf *dir_icon = NULL; + static GIcon *dir_icon = NULL; if (!documents_show_paths) return NULL; @@ -434,7 +435,7 @@ static GtkTreeIter *get_doc_parent(GeanyDocument *doc) } /* no match, add dir parent */ if (!dir_icon) - dir_icon = ui_get_mime_icon("inode/directory", GTK_ICON_SIZE_MENU); + dir_icon = ui_get_mime_icon("inode/directory"); gtk_tree_store_append(store_openfiles, &parent, NULL); gtk_tree_store_set(store_openfiles, &parent, DOCUMENTS_ICON, dir_icon, @@ -455,8 +456,7 @@ void sidebar_openfiles_add(GeanyDocument *doc) GtkTreeIter *parent = get_doc_parent(doc); gchar *basename; const GdkColor *color = document_get_status_color(doc); - static GdkPixbuf *file_icon = NULL; - GdkPixbuf *ft_icon = doc->file_type ? filetype_get_icon(doc->file_type) : NULL; + static GIcon *file_icon = NULL; gtk_tree_store_append(store_openfiles, iter, parent); @@ -471,11 +471,11 @@ void sidebar_openfiles_add(GeanyDocument *doc) gtk_tree_path_free(path); } if (!file_icon) - file_icon = ui_get_mime_icon("text/plain", GTK_ICON_SIZE_MENU); + file_icon = ui_get_mime_icon("text/plain"); basename = g_path_get_basename(DOC_FILENAME(doc)); gtk_tree_store_set(store_openfiles, iter, - DOCUMENTS_ICON, ft_icon ? ft_icon : file_icon, + DOCUMENTS_ICON, (doc->file_type && doc->file_type->icon) ? doc->file_type->icon : file_icon, DOCUMENTS_SHORTNAME, basename, DOCUMENTS_DOCUMENT, doc, DOCUMENTS_COLOR, color, DOCUMENTS_FILENAME, DOC_FILENAME(doc), -1); g_free(basename); @@ -506,7 +506,7 @@ void sidebar_openfiles_update(GeanyDocument *doc) { /* just update color and the icon */ const GdkColor *color = document_get_status_color(doc); - GdkPixbuf *icon = filetype_get_icon(doc->file_type); + GIcon *icon = doc->file_type->icon; gtk_tree_store_set(store_openfiles, iter, DOCUMENTS_COLOR, color, -1); if (icon) Modified: src/ui_utils.c 49 files changed, 8 insertions(+), 41 deletions(-) =================================================================== @@ -2587,7 +2587,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, base_name = g_path_get_basename(DOC_FILENAME(doc)); menu_item = gtk_image_menu_item_new_with_label(base_name); - image = gtk_image_new_from_pixbuf(filetype_get_icon(doc->file_type)); + image = gtk_image_new_from_gicon(doc->file_type->icon, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), image); gtk_widget_show(menu_item); @@ -2665,57 +2665,24 @@ void ui_editable_insert_text_callback(GtkEditable *editable, gchar *new_text, /* gets the icon that applies to a particular MIME type */ -GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size) +GIcon *ui_get_mime_icon(const gchar *mime_type) { - GdkPixbuf *icon = NULL; + GIcon *icon = NULL; gchar *ctype; - GIcon *gicon; - GtkIconInfo *info; - GtkIconTheme *theme; - gint real_size; - if (!gtk_icon_size_lookup(size, &real_size, NULL)) - { - g_return_val_if_reached(NULL); - } ctype = g_content_type_from_mime_type(mime_type); - if (ctype != NULL) - { - gicon = g_content_type_get_icon(ctype); - theme = gtk_icon_theme_get_default(); - info = gtk_icon_theme_lookup_by_gicon(theme, gicon, real_size, 0); - g_object_unref(gicon); - g_free(ctype); - - if (info != NULL) - { - icon = gtk_icon_info_load_icon(info, NULL); - gtk_icon_info_free(info); - } - } + if (ctype) + icon = g_content_type_get_icon(ctype); - /* fallback for builds with GIO < 2.18 or if icon lookup failed, like it might happen on Windows */ - if (icon == NULL) + /* fallback if icon lookup failed, like it might happen on Windows (?) */ + if (! icon) { const gchar *stock_id = GTK_STOCK_FILE; - GtkIconSet *icon_set; if (strstr(mime_type, "directory")) stock_id = GTK_STOCK_DIRECTORY; - icon_set = gtk_icon_factory_lookup_default(stock_id); - if (icon_set) - { -#if GTK_CHECK_VERSION(3, 0, 0) - GtkStyleContext *ctx = gtk_style_context_new(); - icon = gtk_icon_set_render_icon_pixbuf(icon_set, ctx, size); - g_object_unref(ctx); -#else - icon = gtk_icon_set_render_icon(icon_set, gtk_widget_get_default_style(), - gtk_widget_get_default_direction(), - GTK_STATE_NORMAL, size, NULL, NULL); -#endif - } + icon = g_themed_icon_new(stock_id); } return icon; } Modified: src/ui_utils.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -334,7 +334,7 @@ gboolean ui_is_keyval_enter_or_return(guint keyval); gint ui_get_gtk_settings_integer(const gchar *property_name, gint default_value); -GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size); +GIcon *ui_get_mime_icon(const gchar *mime_type); void ui_focus_current_document(void); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] d29b59: Read filetype's mime type from the configuration files
by Colomban Wendling
14 Apr '14
14 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Tue, 15 Oct 2013 01:06:01 UTC Commit: d29b5912fff974b79ef767e7afc75d7ffbc64192
https://github.com/geany/geany/commit/d29b5912fff974b79ef767e7afc75d7ffbc64…
Log Message: ----------- Read filetype's mime type from the configuration files This allows custom filetypes to define a mime type, hence the icon displayed for this filetype; as well as moving ones for built-in filetypes out of the code to the configuration files. Modified Paths: -------------- data/filetypes.Go.conf data/filetypes.Graphviz.conf data/filetypes.Scala.conf data/filetypes.abc data/filetypes.actionscript data/filetypes.ada data/filetypes.c data/filetypes.caml data/filetypes.cmake data/filetypes.cobol data/filetypes.cpp data/filetypes.cs data/filetypes.css data/filetypes.d data/filetypes.diff data/filetypes.docbook data/filetypes.erlang data/filetypes.f77 data/filetypes.fortran data/filetypes.haskell data/filetypes.html data/filetypes.java data/filetypes.javascript data/filetypes.latex data/filetypes.lua data/filetypes.makefile data/filetypes.markdown data/filetypes.matlab data/filetypes.objectivec data/filetypes.pascal data/filetypes.perl data/filetypes.php data/filetypes.po data/filetypes.python data/filetypes.restructuredtext data/filetypes.ruby data/filetypes.sh data/filetypes.sql data/filetypes.tcl data/filetypes.txt2tags data/filetypes.vala data/filetypes.verilog data/filetypes.vhdl data/filetypes.xml data/filetypes.yaml doc/geany.txt src/filetypes.c src/filetypes.h src/sidebar.c src/ui_utils.c Modified: data/filetypes.Go.conf 6 files changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -13,9 +13,13 @@ docComment=a addindex addtogroup anchor arg attention author authors b brief bug [lexer_properties=C] [settings] +lexer_filetype=C + # default extension used when saving files extension=go -lexer_filetype=C + +# MIME type +mime_type=text/x-go # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.Graphviz.conf 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -18,6 +18,9 @@ lexer_filetype=C # default extension used when saving files extension=gv +# MIME type +mime_type=text/vnd.graphviz + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.Scala.conf 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -18,6 +18,9 @@ lexer_filetype=C # default extension used when saving files extension=scala +# MIME type +mime_type=text/x-scala + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.abc 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -6,4 +6,6 @@ # default extension used when saving files extension=abc +# MIME type +mime_type=text/vnd.abc Modified: data/filetypes.actionscript 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -11,6 +11,9 @@ classes=ArgumentError Array Boolean Class Date DefinitionError Error EvalError F # default extension used when saving files extension=as +# MIME type +mime_type=application/ecmascript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.ada 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ primary=abort abs abstract accept access aliased all and array at begin body cas # default extension used when saving files extension=adb +# MIME type +mime_type=text/x-adasrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.c 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -47,6 +47,9 @@ preprocessor.end.$(file.patterns.cpp)=endif # default extension used when saving files extension=c +# MIME type +mime_type=text/x-csrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.caml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ keywords_optional=option Some None ignore ref # default extension used when saving files extension=ml +# MIME type +mime_type=text/x-ocaml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cmake 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ userdefined= # default extension used when saving files extension=cmake +# MIME type +mime_type=text/x-cmake + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cobol 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ keywords=accept access add address advancing after alphabet alphabetic alphabeti # default extension used when saving files extension=cob +# MIME type +mime_type=text/x-cobol + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cpp 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ lexer_filetype=C # default extension used when saving files extension=cpp +# MIME type +mime_type=text/x-c++src + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cs 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ # default extension used when saving files extension=cs +# MIME type +mime_type=text/x-csharp + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.css 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,6 +43,9 @@ browser_pseudo_elements=^-ms- ^-apple- ^-epub- ^-moz- ^-o- ^-wap- ^-webkit- ^-xv # default extension used when saving files extension=css +# MIME type +mime_type=text/css + # the following characters are these which a "word" can contains, see documentation #wordchars=_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.d 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -35,6 +35,9 @@ fold.d.comment.explicit=0 # default extension used when saving files extension=d +# MIME type +mime_type=text/x-dsrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.diff 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -15,6 +15,9 @@ changed=line_changed # default extension used when saving files extension=diff +# MIME type +mime_type=text/x-patch + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.docbook 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ fold.html.preprocessor=1 # default extension used when saving files extension=docbook +# MIME type +mime_type=application/docbook+xml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.erlang 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ doc_macro=@date @docRoot @link @module @package @section @time @type @version # default extension used when saving files extension=erl +# MIME type +mime_type=text/x-erlang + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.f77 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ primary=access action advance allocatable allocate apostrophe assign assignment # default extension used when saving files extension=f +# MIME type +mime_type=text/x-fortran + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.fortran 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -12,6 +12,9 @@ user_functions=cdabs cdcos cdexp cdlog cdsin cdsqrt cotan cotand dcmplx dconjg d # default extension used when saving files extension=f90 +# MIME type +mime_type=text/x-fortran + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.haskell 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -44,6 +44,9 @@ fold.haskell.imports=0 # default extension used when saving files extension=hs +# MIME type +mime_type=text/x-haskell + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.html 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -96,6 +96,9 @@ # default extension used when saving files extension=html +# MIME type +mime_type=text/html + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.java 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -13,6 +13,9 @@ # default extension used when saving files extension=java +# MIME type +mime_type=text/x-java + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.javascript 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -10,6 +10,9 @@ secondary=Array Boolean Date Function Math Number Object String RegExp EvalError # default extension used when saving files extension=js +# MIME type +mime_type=application/javascript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.latex 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -25,6 +25,9 @@ primary=above abovedisplayshortskip abovedisplayskip abovewithdelims accent adjd # default extension used when saving files extension=tex +# MIME type +mime_type=text/x-tex + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.lua 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -42,6 +42,9 @@ user4= # default extension used when saving files extension=lua +# MIME type +mime_type=text/x-lua + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.makefile 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -13,6 +13,9 @@ ideol=type # default extension used when saving files extension=mak +# MIME type +mime_type=text/x-makefile + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.markdown 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ codebk=attribute_unknown # default extension used when saving files extension=mdml +# MIME type +mime_type=text/x-markdown + # sort tags by appearance symbol_list_sort_mode=1 Modified: data/filetypes.matlab 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,9 @@ primary=break case catch classdef continue else elseif end enumeration events fo # default extension used when saving files extension=m +# MIME type +mime_type=text/x-matlab + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.objectivec 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -14,6 +14,9 @@ docComment=attention author brief bug class code date def enum example exception # default extension used when saving files extension=m +# MIME type +mime_type=text/x-objc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.pascal 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -30,6 +30,9 @@ lexer.pascal.smart.highlighting=1 # default extension used when saving files extension=pas +# MIME type +mime_type=text/x-pascal + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.perl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -61,6 +61,9 @@ # default extension used when saving files extension=pl +# MIME type +mime_type=application/x-perl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.php 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -10,6 +10,9 @@ # default extension used when saving files extension=php +# MIME type +mime_type=application/x-php + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.po 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ error=error # default extension used when saving files extension=po +# MIME type +mime_type=text/x-gettext-translation + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.python 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -33,6 +33,9 @@ fold.quotes.python=1 # default extension used when saving files extension=py +# MIME type +mime_type=text/x-python + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.restructuredtext 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -6,6 +6,9 @@ # default extension used when saving files extension=rst +# MIME type +mime_type=text/x-rst + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.ruby 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ primary=__FILE__ load define_method attr_accessor attr_writer attr_reader and de # default extension used when saving files extension=rb +# MIME type +mime_type=application/x-ruby + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.sh 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -24,6 +24,9 @@ primary=break case continue do done elif else esac eval exit export fi for funct # default extension used when saving files extension=sh +# MIME type +mime_type=application/x-shellscript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.sql 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -29,6 +29,9 @@ keywords=absolute action add admin after aggregate alias all allocate alter and # default extension used when saving files extension=sql +# MIME type +mime_type=text/x-sql + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.tcl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -33,6 +33,9 @@ expand= # default extension used when saving files extension=tcl +# MIME type +mime_type=text/x-tcl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.txt2tags 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ postproc=preprocessor # default extension used when saving files extension=txt2tags +# MIME type +mime_type=text/x-txt2tags + # sort tags by appearance symbol_list_sort_mode=1 Modified: data/filetypes.vala 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ lexer_filetype=C # default extension used when saving files extension=vala +# MIME type +mime_type=text/x-vala + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.verilog 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -26,6 +26,9 @@ word3=real integer time reg wire input output inout # default extension used when saving files extension=v +# MIME type +mime_type=text/x-verilog + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.vhdl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -31,6 +31,9 @@ userwords= # default extension used when saving files extension=vhd +# MIME type +mime_type=text/x-vhdl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.xml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -7,6 +7,9 @@ # default extension used when saving files extension=xml +# MIME type +mime_type=application/xml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.yaml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -21,6 +21,9 @@ keywords=true false yes no # default extension used when saving files extension=yaml +# MIME type +mime_type=application/x-yaml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: doc/geany.txt 4 files changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -4204,6 +4204,10 @@ xml_indent_tags to filetypes for which the HTML or XML lexer is used. Such filetypes have this setting in their system configuration files. +mime_type + The MIME type for this file type, e.g. "text/x-csrc". This is used + for example to chose the icon to display for this file type. + [indentation] section ````````````````````` Modified: src/filetypes.c 79 files changed, 27 insertions(+), 52 deletions(-) =================================================================== @@ -107,7 +107,6 @@ static void init_builtin_filetypes(void) ft->lang = 0; ft->name = g_strdup("C"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-csrc"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define CPP @@ -115,7 +114,6 @@ static void init_builtin_filetypes(void) ft->lang = 1; ft->name = g_strdup("C++"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-c++src"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define OBJECTIVEC @@ -123,7 +121,6 @@ static void init_builtin_filetypes(void) ft->lang = 42; ft->name = g_strdup("Objective-C"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-objc"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define CS @@ -131,7 +128,6 @@ static void init_builtin_filetypes(void) ft->lang = 25; ft->name = g_strdup("C#"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-csharp"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define VALA @@ -139,7 +135,6 @@ static void init_builtin_filetypes(void) ft->lang = 33; ft->name = g_strdup("Vala"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-vala"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define D @@ -147,7 +142,6 @@ static void init_builtin_filetypes(void) ft->lang = 17; ft->name = g_strdup("D"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-dsrc"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define JAVA @@ -155,7 +149,6 @@ static void init_builtin_filetypes(void) ft->lang = 2; ft->name = g_strdup("Java"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-java"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define PAS /* to avoid warnings when building under Windows, the symbol PASCAL is there defined */ @@ -163,7 +156,6 @@ static void init_builtin_filetypes(void) ft->lang = 4; ft->name = g_strdup("Pascal"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-pascal"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define ASM @@ -185,7 +177,6 @@ static void init_builtin_filetypes(void) ft->lang = 18; ft->name = g_strdup("Fortran"); ft->title = g_strdup_printf(_("%s source file"), "Fortran (F90)"); - ft->mime_type = g_strdup("text/x-fortran"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define F77 @@ -193,7 +184,6 @@ static void init_builtin_filetypes(void) ft->lang = 30; ft->name = g_strdup("F77"); ft->title = g_strdup_printf(_("%s source file"), "Fortran (F77)"); - ft->mime_type = g_strdup("text/x-fortran"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define GLSL @@ -207,7 +197,6 @@ static void init_builtin_filetypes(void) ft = filetypes[GEANY_FILETYPES_CAML]; ft->name = g_strdup("CAML"); ft->title = g_strdup_printf(_("%s source file"), "(O)Caml"); - ft->mime_type = g_strdup("text/x-ocaml"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define PERL @@ -215,7 +204,6 @@ static void init_builtin_filetypes(void) ft->lang = 5; ft->name = g_strdup("Perl"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/x-perl"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define PHP @@ -223,7 +211,6 @@ static void init_builtin_filetypes(void) ft->lang = 6; ft->name = g_strdup("PHP"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/x-php"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define JAVASCRIPT @@ -231,7 +218,6 @@ static void init_builtin_filetypes(void) ft->lang = 23; ft->name = g_strdup("Javascript"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/javascript"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define PYTHON @@ -239,7 +225,6 @@ static void init_builtin_filetypes(void) ft->lang = 7; ft->name = g_strdup("Python"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-python"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define RUBY @@ -247,7 +232,6 @@ static void init_builtin_filetypes(void) ft->lang = 14; ft->name = g_strdup("Ruby"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/x-ruby"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define TCL @@ -255,7 +239,6 @@ static void init_builtin_filetypes(void) ft->lang = 15; ft->name = g_strdup("Tcl"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-tcl"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define LUA @@ -263,7 +246,6 @@ static void init_builtin_filetypes(void) ft->lang = 22; ft->name = g_strdup("Lua"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-lua"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define FERITE @@ -278,7 +260,6 @@ static void init_builtin_filetypes(void) ft->lang = 24; ft->name = g_strdup("Haskell"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-haskell"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define MARKDOWN @@ -286,7 +267,6 @@ static void init_builtin_filetypes(void) ft->lang = 36; ft->name = g_strdup("Markdown"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-markdown"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define TXT2TAGS @@ -294,7 +274,6 @@ static void init_builtin_filetypes(void) ft->lang = 37; ft->name = g_strdup("Txt2tags"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-txt2tags"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define ABC @@ -309,7 +288,6 @@ static void init_builtin_filetypes(void) ft->lang = 16; ft->name = g_strdup("Sh"); ft->title = g_strdup(_("Shell script")); - ft->mime_type = g_strdup("application/x-shellscript"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define MAKE @@ -317,14 +295,12 @@ static void init_builtin_filetypes(void) ft->lang = 3; ft->name = g_strdup("Make"); ft->title = g_strdup(_("Makefile")); - ft->mime_type = g_strdup("text/x-makefile"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define XML ft = filetypes[GEANY_FILETYPES_XML]; ft->name = g_strdup("XML"); ft->title = g_strdup(_("XML document")); - ft->mime_type = g_strdup("application/xml"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define DOCBOOK @@ -332,7 +308,6 @@ static void init_builtin_filetypes(void) ft->lang = 12; ft->name = g_strdup("Docbook"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/docbook+xml"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define HTML @@ -340,7 +315,6 @@ static void init_builtin_filetypes(void) ft->lang = 29; ft->name = g_strdup("HTML"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/html"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define CSS @@ -348,7 +322,6 @@ static void init_builtin_filetypes(void) ft->lang = 13; ft->name = g_strdup("CSS"); ft->title = g_strdup(_("Cascading StyleSheet")); - ft->mime_type = g_strdup("text/css"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; /* not really markup but fit quite well to HTML */ #define SQL @@ -356,7 +329,6 @@ static void init_builtin_filetypes(void) ft->lang = 11; ft->name = g_strdup("SQL"); filetype_make_title(ft, TITLE_FILE); - ft->mime_type = g_strdup("text/x-sql"); ft->group = GEANY_FILETYPE_GROUP_MISC; #define COBOL @@ -364,7 +336,6 @@ static void init_builtin_filetypes(void) ft->lang = 41; ft->name = g_strdup("COBOL"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-cobol"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define LATEX @@ -372,7 +343,6 @@ static void init_builtin_filetypes(void) ft->lang = 8; ft->name = g_strdup("LaTeX"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-tex"); ft->group = GEANY_FILETYPE_GROUP_MARKUP; #define VHDL @@ -380,7 +350,6 @@ static void init_builtin_filetypes(void) ft->lang = 21; ft->name = g_strdup("VHDL"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-vhdl"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define VERILOG @@ -388,7 +357,6 @@ static void init_builtin_filetypes(void) ft->lang = 39; ft->name = g_strdup("Verilog"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-verilog"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define DIFF @@ -396,7 +364,6 @@ static void init_builtin_filetypes(void) ft->lang = 20; ft->name = g_strdup("Diff"); filetype_make_title(ft, TITLE_FILE); - ft->mime_type = g_strdup("text/x-patch"); ft->group = GEANY_FILETYPE_GROUP_MISC; #define LISP @@ -409,7 +376,6 @@ static void init_builtin_filetypes(void) ft = filetypes[GEANY_FILETYPES_ERLANG]; ft->name = g_strdup("Erlang"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-erlang"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define CONF @@ -423,7 +389,6 @@ static void init_builtin_filetypes(void) ft = filetypes[GEANY_FILETYPES_PO]; ft->name = g_strdup("Po"); ft->title = g_strdup(_("Gettext translation file")); - ft->mime_type = g_strdup("text/x-gettext-translation"); ft->group = GEANY_FILETYPE_GROUP_MISC; #define HAXE @@ -438,7 +403,6 @@ static void init_builtin_filetypes(void) ft->lang = 34; ft->name = g_strdup("ActionScript"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("application/ecmascript"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define R @@ -460,21 +424,18 @@ static void init_builtin_filetypes(void) ft->lang = 32; ft->name = g_strdup("Matlab/Octave"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-matlab"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define YAML ft = filetypes[GEANY_FILETYPES_YAML]; ft->name = g_strdup("YAML"); filetype_make_title(ft, TITLE_FILE); - ft->mime_type = g_strdup("application/x-yaml"); ft->group = GEANY_FILETYPE_GROUP_MISC; #define CMAKE ft = filetypes[GEANY_FILETYPES_CMAKE]; ft->name = g_strdup("CMake"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-cmake"); ft->group = GEANY_FILETYPE_GROUP_SCRIPT; #define NSIS @@ -488,7 +449,6 @@ static void init_builtin_filetypes(void) ft = filetypes[GEANY_FILETYPES_ADA]; ft->name = g_strdup("Ada"); filetype_make_title(ft, TITLE_SOURCE_FILE); - ft->mime_type = g_strdup("text/x-adasrc"); ft->group = GEANY_FILETYPE_GROUP_COMPILED; #define FORTH @@ -591,9 +551,6 @@ static void filetype_add(GeanyFiletype *ft) /* list will be sorted later */ filetypes_by_title = g_slist_prepend(filetypes_by_title, ft); - - if (!ft->mime_type) - ft->mime_type = g_strdup("text/plain"); } @@ -763,16 +720,7 @@ static void create_set_filetype_menu(void) void filetypes_init() { - GSList *node; - filetypes_init_types(); - - /* this has to be here as GTK isn't initialized in filetypes_init_types(). */ - foreach_slist(node, filetypes_by_title) - { - GeanyFiletype *ft = node->data; - ft->icon = ui_get_mime_icon(ft->mime_type, GTK_ICON_SIZE_MENU); - } create_set_filetype_menu(); setup_config_file_menus(); } @@ -1212,6 +1160,10 @@ static void load_settings(guint ft_id, GKeyFile *config, GKeyFile *configh) SETPTR(filetypes[ft_id]->extension, result); } + /* MIME type */ + result = utils_get_setting(string, configh, config, "settings", "mime_type", "text/plain"); + SETPTR(filetypes[ft_id]->mime_type, result); + /* read comment notes */ result = utils_get_setting(string, configh, config, "settings", "comment_open", NULL); if (result != NULL) @@ -1432,6 +1384,12 @@ void filetypes_load_config(guint ft_id, gboolean reload) load_settings(ft_id, config, config_home); highlighting_init_styles(ft_id, config, config_home); + if (reload && ft->icon) + { + g_object_unref(ft->icon); + ft->icon = NULL; + } + g_key_file_free(config); g_key_file_free(config_home); } @@ -1840,3 +1798,20 @@ gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean singl return !EMPTY(*co); } + + +/* gets the filetype icon, possibly rendering it if not yet done + * Returns the filetype's icon, should not be freed + * + * This requires the mime_type setting so has to be done after the filetype + * is loaded, but we don't necessarily have GTK in filetypes_load_config(), + * so use a helper function that renders the icon if needed */ +GdkPixbuf *filetype_get_icon(GeanyFiletype *ft) +{ + g_return_val_if_fail(ft != NULL, NULL); + + if (! ft->icon) + ft->icon = ui_get_mime_icon(ft->mime_type, GTK_ICON_SIZE_MENU); + + return ft->icon; +} Modified: src/filetypes.h 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -218,6 +218,8 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message, gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean single_first, const gchar **co, const gchar **cc); +GdkPixbuf *filetype_get_icon(GeanyFiletype *ft); + G_END_DECLS #endif Modified: src/sidebar.c 5 files changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -456,6 +456,7 @@ void sidebar_openfiles_add(GeanyDocument *doc) gchar *basename; const GdkColor *color = document_get_status_color(doc); static GdkPixbuf *file_icon = NULL; + GdkPixbuf *ft_icon = doc->file_type ? filetype_get_icon(doc->file_type) : NULL; gtk_tree_store_append(store_openfiles, iter, parent); @@ -474,7 +475,7 @@ void sidebar_openfiles_add(GeanyDocument *doc) basename = g_path_get_basename(DOC_FILENAME(doc)); gtk_tree_store_set(store_openfiles, iter, - DOCUMENTS_ICON, (doc->file_type && doc->file_type->icon) ? doc->file_type->icon : file_icon, + DOCUMENTS_ICON, ft_icon ? ft_icon : file_icon, DOCUMENTS_SHORTNAME, basename, DOCUMENTS_DOCUMENT, doc, DOCUMENTS_COLOR, color, DOCUMENTS_FILENAME, DOC_FILENAME(doc), -1); g_free(basename); @@ -505,7 +506,7 @@ void sidebar_openfiles_update(GeanyDocument *doc) { /* just update color and the icon */ const GdkColor *color = document_get_status_color(doc); - GdkPixbuf *icon = doc->file_type->icon; + GdkPixbuf *icon = filetype_get_icon(doc->file_type); gtk_tree_store_set(store_openfiles, iter, DOCUMENTS_COLOR, color, -1); if (icon) Modified: src/ui_utils.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -2587,7 +2587,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, base_name = g_path_get_basename(DOC_FILENAME(doc)); menu_item = gtk_image_menu_item_new_with_label(base_name); - image = gtk_image_new_from_pixbuf(doc->file_type->icon); + image = gtk_image_new_from_pixbuf(filetype_get_icon(doc->file_type)); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), image); gtk_widget_show(menu_item); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 54f3c0: Merge branch 'wip/configurable-mime-type-gicon'
by Colomban Wendling
14 Apr '14
14 Apr '14
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Mon, 14 Apr 2014 18:32:59 UTC Commit: 54f3c0a904245c7be41d4ed940ecba0250dc725f
https://github.com/geany/geany/commit/54f3c0a904245c7be41d4ed940ecba0250dc7…
Log Message: ----------- Merge branch 'wip/configurable-mime-type-gicon' Modified Paths: -------------- data/filetypes.Go.conf data/filetypes.Graphviz.conf data/filetypes.Scala.conf data/filetypes.abc data/filetypes.actionscript data/filetypes.ada data/filetypes.c data/filetypes.caml data/filetypes.cmake data/filetypes.cobol data/filetypes.cpp data/filetypes.cs data/filetypes.css data/filetypes.d data/filetypes.diff data/filetypes.docbook data/filetypes.erlang data/filetypes.f77 data/filetypes.fortran data/filetypes.haskell data/filetypes.html data/filetypes.java data/filetypes.javascript data/filetypes.latex data/filetypes.lua data/filetypes.makefile data/filetypes.markdown data/filetypes.matlab data/filetypes.objectivec data/filetypes.pascal data/filetypes.perl data/filetypes.php data/filetypes.po data/filetypes.python data/filetypes.restructuredtext data/filetypes.ruby data/filetypes.rust data/filetypes.sh data/filetypes.sql data/filetypes.tcl data/filetypes.txt2tags data/filetypes.vala data/filetypes.verilog data/filetypes.vhdl data/filetypes.xml data/filetypes.yaml doc/geany.txt src/dialogs.c src/filetypes.c src/filetypes.h src/main.c src/sidebar.c src/ui_utils.c src/ui_utils.h Modified: data/filetypes.Go.conf 6 files changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -13,9 +13,13 @@ docComment=a addindex addtogroup anchor arg attention author authors b brief bug [lexer_properties=C] [settings] +lexer_filetype=C + # default extension used when saving files extension=go -lexer_filetype=C + +# MIME type +mime_type=text/x-go # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.Graphviz.conf 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -18,6 +18,9 @@ lexer_filetype=C # default extension used when saving files extension=gv +# MIME type +mime_type=text/vnd.graphviz + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.Scala.conf 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -18,6 +18,9 @@ lexer_filetype=C # default extension used when saving files extension=scala +# MIME type +mime_type=text/x-scala + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.abc 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -6,4 +6,6 @@ # default extension used when saving files extension=abc +# MIME type +mime_type=text/vnd.abc Modified: data/filetypes.actionscript 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -11,6 +11,9 @@ classes=ArgumentError Array Boolean Class Date DefinitionError Error EvalError F # default extension used when saving files extension=as +# MIME type +mime_type=application/ecmascript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.ada 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ primary=abort abs abstract accept access aliased all and array at begin body cas # default extension used when saving files extension=adb +# MIME type +mime_type=text/x-adasrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.c 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -48,6 +48,9 @@ preprocessor.end.$(file.patterns.cpp)=endif # default extension used when saving files extension=c +# MIME type +mime_type=text/x-csrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.caml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ keywords_optional=option Some None ignore ref # default extension used when saving files extension=ml +# MIME type +mime_type=text/x-ocaml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cmake 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ userdefined= # default extension used when saving files extension=cmake +# MIME type +mime_type=text/x-cmake + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cobol 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ keywords=accept access add address advancing after alphabet alphabetic alphabeti # default extension used when saving files extension=cob +# MIME type +mime_type=text/x-cobol + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cpp 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ lexer_filetype=C # default extension used when saving files extension=cpp +# MIME type +mime_type=text/x-c++src + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.cs 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ # default extension used when saving files extension=cs +# MIME type +mime_type=text/x-csharp + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.css 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,6 +43,9 @@ browser_pseudo_elements=^-ms- ^-apple- ^-epub- ^-moz- ^-o- ^-wap- ^-webkit- ^-xv # default extension used when saving files extension=css +# MIME type +mime_type=text/css + # the following characters are these which a "word" can contains, see documentation #wordchars=_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.d 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -35,6 +35,9 @@ fold.d.comment.explicit=0 # default extension used when saving files extension=d +# MIME type +mime_type=text/x-dsrc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.diff 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -15,6 +15,9 @@ changed=line_changed # default extension used when saving files extension=diff +# MIME type +mime_type=text/x-patch + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.docbook 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ fold.html.preprocessor=1 # default extension used when saving files extension=docbook +# MIME type +mime_type=application/docbook+xml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.erlang 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ doc_macro=@date @docRoot @link @module @package @section @time @type @version # default extension used when saving files extension=erl +# MIME type +mime_type=text/x-erlang + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.f77 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ primary=access action advance allocatable allocate apostrophe assign assignment # default extension used when saving files extension=f +# MIME type +mime_type=text/x-fortran + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.fortran 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -12,6 +12,9 @@ user_functions=cdabs cdcos cdexp cdlog cdsin cdsqrt cotan cotand dcmplx dconjg d # default extension used when saving files extension=f90 +# MIME type +mime_type=text/x-fortran + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.haskell 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -44,6 +44,9 @@ fold.haskell.imports=0 # default extension used when saving files extension=hs +# MIME type +mime_type=text/x-haskell + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.html 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -96,6 +96,9 @@ # default extension used when saving files extension=html +# MIME type +mime_type=text/html + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.java 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -13,6 +13,9 @@ # default extension used when saving files extension=java +# MIME type +mime_type=text/x-java + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.javascript 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -10,6 +10,9 @@ secondary=Array Boolean Date Function Math Number Object String RegExp EvalError # default extension used when saving files extension=js +# MIME type +mime_type=application/javascript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.latex 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -25,6 +25,9 @@ primary=above abovedisplayshortskip abovedisplayskip abovewithdelims accent adjd # default extension used when saving files extension=tex +# MIME type +mime_type=text/x-tex + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.lua 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -42,6 +42,9 @@ user4= # default extension used when saving files extension=lua +# MIME type +mime_type=text/x-lua + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.makefile 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -13,6 +13,9 @@ ideol=type # default extension used when saving files extension=mak +# MIME type +mime_type=text/x-makefile + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.markdown 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ codebk=attribute_unknown # default extension used when saving files extension=mdml +# MIME type +mime_type=text/x-markdown + # sort tags by appearance symbol_list_sort_mode=1 Modified: data/filetypes.matlab 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,9 @@ primary=break case catch classdef continue else elseif end enumeration events fo # default extension used when saving files extension=m +# MIME type +mime_type=text/x-matlab + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.objectivec 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -14,6 +14,9 @@ docComment=attention author brief bug class code date def enum example exception # default extension used when saving files extension=m +# MIME type +mime_type=text/x-objc + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.pascal 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -30,6 +30,9 @@ lexer.pascal.smart.highlighting=1 # default extension used when saving files extension=pas +# MIME type +mime_type=text/x-pascal + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.perl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -61,6 +61,9 @@ # default extension used when saving files extension=pl +# MIME type +mime_type=application/x-perl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.php 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -10,6 +10,9 @@ # default extension used when saving files extension=php +# MIME type +mime_type=application/x-php + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.po 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -22,6 +22,9 @@ error=error # default extension used when saving files extension=po +# MIME type +mime_type=text/x-gettext-translation + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.python 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -33,6 +33,9 @@ fold.quotes.python=1 # default extension used when saving files extension=py +# MIME type +mime_type=text/x-python + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.restructuredtext 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -6,6 +6,9 @@ # default extension used when saving files extension=rst +# MIME type +mime_type=text/x-rst + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.ruby 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -45,6 +45,9 @@ primary=__FILE__ load define_method attr_accessor attr_writer attr_reader and de # default extension used when saving files extension=rb +# MIME type +mime_type=application/x-ruby + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.rust 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -34,6 +34,9 @@ lexer.cpp.track.preprocessor=0 # default extension used when saving files extension=rs +# MIME type +mime_type=text/x-rustsrc + # single comments, like # in this file comment_single=// # multiline comments Modified: data/filetypes.sh 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -24,6 +24,9 @@ primary=break case continue do done elif else esac eval exit export fi for funct # default extension used when saving files extension=sh +# MIME type +mime_type=application/x-shellscript + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.sql 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -29,6 +29,9 @@ keywords=absolute action add admin after aggregate alias all allocate alter and # default extension used when saving files extension=sql +# MIME type +mime_type=text/x-sql + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.tcl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -33,6 +33,9 @@ expand= # default extension used when saving files extension=tcl +# MIME type +mime_type=text/x-tcl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.txt2tags 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -28,6 +28,9 @@ postproc=preprocessor # default extension used when saving files extension=txt2tags +# MIME type +mime_type=text/x-txt2tags + # sort tags by appearance symbol_list_sort_mode=1 Modified: data/filetypes.vala 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -23,6 +23,9 @@ lexer_filetype=C # default extension used when saving files extension=vala +# MIME type +mime_type=text/x-vala + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.verilog 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -26,6 +26,9 @@ word3=real integer time reg wire input output inout # default extension used when saving files extension=v +# MIME type +mime_type=text/x-verilog + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.vhdl 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -31,6 +31,9 @@ userwords= # default extension used when saving files extension=vhd +# MIME type +mime_type=text/x-vhdl + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.xml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -7,6 +7,9 @@ # default extension used when saving files extension=xml +# MIME type +mime_type=application/xml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: data/filetypes.yaml 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -21,6 +21,9 @@ keywords=true false yes no # default extension used when saving files extension=yaml +# MIME type +mime_type=application/x-yaml + # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Modified: doc/geany.txt 4 files changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -4211,6 +4211,10 @@ xml_indent_tags to filetypes for which the HTML or XML lexer is used. Such filetypes have this setting in their system configuration files. +mime_type + The MIME type for this file type, e.g. "text/x-csrc". This is used + for example to chose the icon to display for this file type. + [indentation] section ````````````````````` Modified: src/dialogs.c 6 files changed, 2 insertions(+), 4 deletions(-) =================================================================== @@ -1146,7 +1146,6 @@ void dialogs_show_file_properties(GeanyDocument *doc) GtkWidget *dialog, *label, *image, *check; gchar *file_size, *title, *base_name, *time_changed, *time_modified, *time_accessed, *enctext; gchar *short_name; - GdkPixbuf *pixbuf; #ifdef HAVE_SYS_TYPES_H struct stat st; off_t filesize; @@ -1222,9 +1221,8 @@ void dialogs_show_file_properties(GeanyDocument *doc) gtk_label_set_text(GTK_LABEL(label), base_name); image = ui_lookup_widget(dialog, "file_type_image"); - pixbuf = ui_get_mime_icon(doc->file_type->mime_type, GTK_ICON_SIZE_BUTTON); - gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); - g_object_unref(pixbuf); + gtk_image_set_from_gicon(GTK_IMAGE(image), doc->file_type->icon, + GTK_ICON_SIZE_BUTTON); label = ui_lookup_widget(dialog, "file_type_label"); gtk_label_set_text(GTK_LABEL(label), doc->file_type->title); Modified: src/filetypes.c 149 files changed, 71 insertions(+), 78 deletions(-) =================================================================== @@ -103,22 +103,20 @@ static gchar *filetype_make_title(const char *name, enum TitleType type) /* name argument (ie filetype name) must not be translated as it is used for * filetype lookup. Use filetypes_get_display_name() instead.*/ static void ft_init(filetype_id ft_id, int lang, const char *name, - const char *title_name, enum TitleType title_type, const char *mime_type, + const char *title_name, enum TitleType title_type, GeanyFiletypeGroupID group_id) { GeanyFiletype *ft = filetypes[ft_id]; ft->lang = lang; ft->name = g_strdup(name); ft->title = filetype_make_title((title_name != NULL) ? title_name : ft->name, title_type); - if (mime_type != NULL) - SETPTR(ft->mime_type, g_strdup(mime_type)); ft->group = group_id; } /* Evil macro to save typing and make init_builtin_filetypes() more readable */ -#define FT_INIT(ft_id, parser_id, name, title_name, title_type, mime_type, group_id) \ +#define FT_INIT(ft_id, parser_id, name, title_name, title_type, group_id) \ ft_init(GEANY_FILETYPES_##ft_id, TM_PARSER_##parser_id, name, title_name, \ - TITLE_##title_type, mime_type, GEANY_FILETYPE_GROUP_##group_id) + TITLE_##title_type, GEANY_FILETYPE_GROUP_##group_id) /* Note: remember to update HACKING if this function is renamed. */ @@ -130,68 +128,67 @@ static void init_builtin_filetypes(void) * [2] = Non-translated filetype name (*not* label for display) * [3] = Translatable human filetype title prefix or NULL to use [2] * [4] = Title type (TITLE_*) constant (ex. TITLE_SOURCE_FILE is 'source file' suffix) - * [5] = Mime type or NULL for none/unknown - * [6] = The filetype group constant (GEANY_FILETYPE_GROUP_*) + * [5] = The filetype group constant (GEANY_FILETYPE_GROUP_*) * -------------------------------------------------------------------------------------------------------------------------- - * [0] [1] [2] [3] [4] [5] [6] */ - FT_INIT( NONE, NONE, "None", _("None"), NONE, NULL, NONE ); - FT_INIT( C, C, "C", NULL, SOURCE_FILE, "text/x-csrc", COMPILED ); - FT_INIT( CPP, CPP, "C++", NULL, SOURCE_FILE, "text/x-c++src", COMPILED ); - FT_INIT( OBJECTIVEC, OBJC, "Objective-C", NULL, SOURCE_FILE, "text/x-objc", COMPILED ); - FT_INIT( CS, CSHARP, "C#", NULL, SOURCE_FILE, "text/x-csharp", COMPILED ); - FT_INIT( VALA, VALA, "Vala", NULL, SOURCE_FILE, "text/x-vala", COMPILED ); - FT_INIT( D, D, "D", NULL, SOURCE_FILE, "text/x-dsrc", COMPILED ); - FT_INIT( JAVA, JAVA, "Java", NULL, SOURCE_FILE, "text/x-java", COMPILED ); - FT_INIT( PASCAL, PASCAL, "Pascal", NULL, SOURCE_FILE, "text/x-pascal", COMPILED ); - FT_INIT( ASM, ASM, "ASM", "Assembler", SOURCE_FILE, NULL, COMPILED ); - FT_INIT( BASIC, FREEBASIC, "FreeBasic", NULL, SOURCE_FILE, NULL, COMPILED ); - FT_INIT( FORTRAN, FORTRAN, "Fortran", "Fortran (F90)", SOURCE_FILE, "text/x-fortran", COMPILED ); - FT_INIT( F77, F77, "F77", "Fortran (F77)", SOURCE_FILE, "text/x-fortran", COMPILED ); - FT_INIT( GLSL, GLSL, "GLSL", NULL, SOURCE_FILE, NULL, COMPILED ); - FT_INIT( CAML, NONE, "CAML", "(O)Caml", SOURCE_FILE, "text/x-ocaml", COMPILED ); - FT_INIT( PERL, PERL, "Perl", NULL, SOURCE_FILE, "application/x-perl", SCRIPT ); - FT_INIT( PHP, PHP, "PHP", NULL, SOURCE_FILE, "application/x-php", SCRIPT ); - FT_INIT( JS, JAVASCRIPT, "Javascript", NULL, SOURCE_FILE, "application/javascript", SCRIPT ); - FT_INIT( PYTHON, PYTHON, "Python", NULL, SOURCE_FILE, "text/x-python", SCRIPT ); - FT_INIT( RUBY, RUBY, "Ruby", NULL, SOURCE_FILE, "application/x-ruby", SCRIPT ); - FT_INIT( TCL, TCL, "Tcl", NULL, SOURCE_FILE, "text/x-tcl", SCRIPT ); - FT_INIT( LUA, LUA, "Lua", NULL, SOURCE_FILE, "text/x-lua", SCRIPT ); - FT_INIT( FERITE, FERITE, "Ferite", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( HASKELL, HASKELL, "Haskell", NULL, SOURCE_FILE, "text/x-haskell", COMPILED ); - FT_INIT( MARKDOWN, MARKDOWN, "Markdown", NULL, SOURCE_FILE, "text/x-markdown", MARKUP ); - FT_INIT( TXT2TAGS, TXT2TAGS, "Txt2tags", NULL, SOURCE_FILE, "text/x-txt2tags", MARKUP ); - FT_INIT( ABC, ABC, "Abc", NULL, FILE, NULL, MISC ); - FT_INIT( SH, SH, "Sh", _("Shell"), SCRIPT, "application/x-shellscript", SCRIPT ); - FT_INIT( MAKE, MAKEFILE, "Make", _("Makefile"), NONE, "text/x-makefile", SCRIPT ); - FT_INIT( XML, NONE, "XML", NULL, DOCUMENT, "application/xml", MARKUP ); - FT_INIT( DOCBOOK, DOCBOOK, "Docbook", NULL, DOCUMENT, "application/docbook+xml", MARKUP ); - FT_INIT( HTML, HTML, "HTML", NULL, DOCUMENT, "text/html", MARKUP ); - FT_INIT( CSS, CSS, "CSS", _("Cascading Stylesheet"), NONE, "text/css", MARKUP ); /* not really markup but fit quite well to HTML */ - FT_INIT( SQL, SQL, "SQL", NULL, FILE, "text/x-sql", MISC ); - FT_INIT( COBOL, COBOL, "COBOL", NULL, SOURCE_FILE, "text/x-cobol", COMPILED ); - FT_INIT( LATEX, LATEX, "LaTeX", NULL, SOURCE_FILE, "text/x-tex", MARKUP ); - FT_INIT( VHDL, VHDL, "VHDL", NULL, SOURCE_FILE, "text/x-vhdl", COMPILED ); - FT_INIT( VERILOG, VERILOG, "Verilog", NULL, SOURCE_FILE, "text/x-verilog", COMPILED ); - FT_INIT( DIFF, DIFF, "Diff", NULL, FILE, "text/x-patch", MISC ); - FT_INIT( LISP, NONE, "Lisp", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( ERLANG, NONE, "Erlang", NULL, SOURCE_FILE, "text/x-erlang", COMPILED ); - FT_INIT( CONF, CONF, "Conf", _("Config"), FILE, NULL, MISC ); - FT_INIT( PO, NONE, "Po", _("Gettext translation"), FILE, "text/x-gettext-translation", MISC ); - FT_INIT( HAXE, HAXE, "Haxe", NULL, SOURCE_FILE, NULL, COMPILED ); - FT_INIT( AS, ACTIONSCRIPT, "ActionScript", NULL, SOURCE_FILE, "application/ecmascript", SCRIPT ); - FT_INIT( R, R, "R", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( REST, REST, "reStructuredText", NULL, SOURCE_FILE, NULL, MARKUP ); - FT_INIT( MATLAB, MATLAB, "Matlab/Octave", NULL, SOURCE_FILE, "text/x-matlab", SCRIPT ); - FT_INIT( YAML, NONE, "YAML", NULL, FILE, "application/x-yaml", MISC ); - FT_INIT( CMAKE, NONE, "CMake", NULL, SOURCE_FILE, "text/x-cmake", SCRIPT ); - FT_INIT( NSIS, NSIS, "NSIS", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( ADA, NONE, "Ada", NULL, SOURCE_FILE, "text/x-adasrc", COMPILED ); - FT_INIT( FORTH, NONE, "Forth", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( ASCIIDOC, ASCIIDOC, "Asciidoc", NULL, SOURCE_FILE, NULL, MARKUP ); - FT_INIT( ABAQUS, ABAQUS, "Abaqus", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( BATCH, NONE, "Batch", NULL, SCRIPT, NULL, SCRIPT ); - FT_INIT( POWERSHELL, NONE, "PowerShell", NULL, SOURCE_FILE, NULL, SCRIPT ); - FT_INIT( RUST, RUST, "Rust", NULL, SOURCE_FILE, "text/x-rustsrc", COMPILED ); + * [0] [1] [2] [3] [4] [5] */ + FT_INIT( NONE, NONE, "None", _("None"), NONE, NONE ); + FT_INIT( C, C, "C", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( CPP, CPP, "C++", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( OBJECTIVEC, OBJC, "Objective-C", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( CS, CSHARP, "C#", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( VALA, VALA, "Vala", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( D, D, "D", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( JAVA, JAVA, "Java", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( PASCAL, PASCAL, "Pascal", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( ASM, ASM, "ASM", "Assembler", SOURCE_FILE, COMPILED ); + FT_INIT( BASIC, FREEBASIC, "FreeBasic", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( FORTRAN, FORTRAN, "Fortran", "Fortran (F90)", SOURCE_FILE, COMPILED ); + FT_INIT( F77, F77, "F77", "Fortran (F77)", SOURCE_FILE, COMPILED ); + FT_INIT( GLSL, GLSL, "GLSL", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( CAML, NONE, "CAML", "(O)Caml", SOURCE_FILE, COMPILED ); + FT_INIT( PERL, PERL, "Perl", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( PHP, PHP, "PHP", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( JS, JAVASCRIPT, "Javascript", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( PYTHON, PYTHON, "Python", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( RUBY, RUBY, "Ruby", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( TCL, TCL, "Tcl", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( LUA, LUA, "Lua", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( FERITE, FERITE, "Ferite", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( HASKELL, HASKELL, "Haskell", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( MARKDOWN, MARKDOWN, "Markdown", NULL, SOURCE_FILE, MARKUP ); + FT_INIT( TXT2TAGS, TXT2TAGS, "Txt2tags", NULL, SOURCE_FILE, MARKUP ); + FT_INIT( ABC, ABC, "Abc", NULL, FILE, MISC ); + FT_INIT( SH, SH, "Sh", _("Shell"), SCRIPT, SCRIPT ); + FT_INIT( MAKE, MAKEFILE, "Make", _("Makefile"), NONE, SCRIPT ); + FT_INIT( XML, NONE, "XML", NULL, DOCUMENT, MARKUP ); + FT_INIT( DOCBOOK, DOCBOOK, "Docbook", NULL, DOCUMENT, MARKUP ); + FT_INIT( HTML, HTML, "HTML", NULL, DOCUMENT, MARKUP ); + FT_INIT( CSS, CSS, "CSS", _("Cascading Stylesheet"), NONE, MARKUP ); /* not really markup but fit quite well to HTML */ + FT_INIT( SQL, SQL, "SQL", NULL, FILE, MISC ); + FT_INIT( COBOL, COBOL, "COBOL", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( LATEX, LATEX, "LaTeX", NULL, SOURCE_FILE, MARKUP ); + FT_INIT( VHDL, VHDL, "VHDL", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( VERILOG, VERILOG, "Verilog", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( DIFF, DIFF, "Diff", NULL, FILE, MISC ); + FT_INIT( LISP, NONE, "Lisp", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( ERLANG, NONE, "Erlang", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( CONF, CONF, "Conf", _("Config"), FILE, MISC ); + FT_INIT( PO, NONE, "Po", _("Gettext translation"), FILE, MISC ); + FT_INIT( HAXE, HAXE, "Haxe", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( AS, ACTIONSCRIPT, "ActionScript", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( R, R, "R", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( REST, REST, "reStructuredText", NULL, SOURCE_FILE, MARKUP ); + FT_INIT( MATLAB, MATLAB, "Matlab/Octave", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( YAML, NONE, "YAML", NULL, FILE, MISC ); + FT_INIT( CMAKE, NONE, "CMake", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( NSIS, NSIS, "NSIS", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( ADA, NONE, "Ada", NULL, SOURCE_FILE, COMPILED ); + FT_INIT( FORTH, NONE, "Forth", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( ASCIIDOC, ASCIIDOC, "Asciidoc", NULL, SOURCE_FILE, MARKUP ); + FT_INIT( ABAQUS, ABAQUS, "Abaqus", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( BATCH, NONE, "Batch", NULL, SCRIPT, SCRIPT ); + FT_INIT( POWERSHELL, NONE, "PowerShell", NULL, SOURCE_FILE, SCRIPT ); + FT_INIT( RUST, RUST, "Rust", NULL, SOURCE_FILE, COMPILED ); } @@ -261,9 +258,6 @@ static void filetype_add(GeanyFiletype *ft) /* list will be sorted later */ filetypes_by_title = g_slist_prepend(filetypes_by_title, ft); - - if (!ft->mime_type) - ft->mime_type = g_strdup("text/plain"); } @@ -431,16 +425,7 @@ static void create_set_filetype_menu(void) void filetypes_init(void) { - GSList *node; - filetypes_init_types(); - - /* this has to be here as GTK isn't initialized in filetypes_init_types(). */ - foreach_slist(node, filetypes_by_title) - { - GeanyFiletype *ft = node->data; - ft->icon = ui_get_mime_icon(ft->mime_type, GTK_ICON_SIZE_MENU); - } create_set_filetype_menu(); setup_config_file_menus(); } @@ -883,6 +868,10 @@ static void load_settings(guint ft_id, GKeyFile *config, GKeyFile *configh) SETPTR(filetypes[ft_id]->extension, result); } + /* MIME type */ + result = utils_get_setting(string, configh, config, "settings", "mime_type", "text/plain"); + SETPTR(filetypes[ft_id]->mime_type, result); + /* read comment notes */ result = utils_get_setting(string, configh, config, "settings", "comment_open", NULL); if (result != NULL) @@ -1110,6 +1099,10 @@ void filetypes_load_config(guint ft_id, gboolean reload) load_settings(ft_id, config, config_home); highlighting_init_styles(ft_id, config, config_home); + if (ft->icon) + g_object_unref(ft->icon); + ft->icon = ui_get_mime_icon(ft->mime_type); + g_key_file_free(config); g_key_file_free(config_home); } Modified: src/filetypes.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -140,7 +140,7 @@ struct GeanyFiletype gchar *error_regex_string; GeanyFiletype *lexer_filetype; gchar *mime_type; - GdkPixbuf *icon; + GIcon *icon; gchar *comment_single; /* single-line comment */ /* filetype indent settings, -1 if not set */ gint indent_type; Modified: src/main.c 4 files changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1040,6 +1040,10 @@ gint main(gint argc, gchar **argv) gint config_dir_result; const gchar *locale; +#if ! GLIB_CHECK_VERSION(2, 36, 0) + g_type_init(); +#endif + log_handlers_init(); app = g_new0(GeanyApp, 1); Modified: src/sidebar.c 15 files changed, 8 insertions(+), 7 deletions(-) =================================================================== @@ -276,7 +276,7 @@ static void prepare_openfiles(void) /* store the icon and the short filename to show, and the index as reference, * the colour (black/red/green) and the full name for the tooltip */ - store_openfiles = gtk_tree_store_new(5, GDK_TYPE_PIXBUF, G_TYPE_STRING, + store_openfiles = gtk_tree_store_new(5, G_TYPE_ICON, G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(tv.tree_openfiles), GTK_TREE_MODEL(store_openfiles)); @@ -287,11 +287,12 @@ static void prepare_openfiles(void) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); icon_renderer = gtk_cell_renderer_pixbuf_new(); + g_object_set(icon_renderer, "stock-size", GTK_ICON_SIZE_MENU, NULL); text_renderer = gtk_cell_renderer_text_new(); g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL); column = gtk_tree_view_column_new(); gtk_tree_view_column_pack_start(column, icon_renderer, FALSE); - gtk_tree_view_column_set_attributes(column, icon_renderer, "pixbuf", DOCUMENTS_ICON, NULL); + gtk_tree_view_column_set_attributes(column, icon_renderer, "gicon", DOCUMENTS_ICON, NULL); gtk_tree_view_column_pack_start(column, text_renderer, TRUE); gtk_tree_view_column_set_attributes(column, text_renderer, "text", DOCUMENTS_SHORTNAME, "foreground-gdk", DOCUMENTS_COLOR, NULL); @@ -413,7 +414,7 @@ static GtkTreeIter *get_doc_parent(GeanyDocument *doc) gchar *dirname = NULL; static GtkTreeIter parent; GtkTreeModel *model = GTK_TREE_MODEL(store_openfiles); - static GdkPixbuf *dir_icon = NULL; + static GIcon *dir_icon = NULL; if (!documents_show_paths) return NULL; @@ -436,7 +437,7 @@ static GtkTreeIter *get_doc_parent(GeanyDocument *doc) } /* no match, add dir parent */ if (!dir_icon) - dir_icon = ui_get_mime_icon("inode/directory", GTK_ICON_SIZE_MENU); + dir_icon = ui_get_mime_icon("inode/directory"); gtk_tree_store_append(store_openfiles, &parent, NULL); gtk_tree_store_set(store_openfiles, &parent, DOCUMENTS_ICON, dir_icon, @@ -457,7 +458,7 @@ void sidebar_openfiles_add(GeanyDocument *doc) GtkTreeIter *parent = get_doc_parent(doc); gchar *basename; const GdkColor *color = document_get_status_color(doc); - static GdkPixbuf *file_icon = NULL; + static GIcon *file_icon = NULL; gtk_tree_store_append(store_openfiles, iter, parent); @@ -472,7 +473,7 @@ void sidebar_openfiles_add(GeanyDocument *doc) gtk_tree_path_free(path); } if (!file_icon) - file_icon = ui_get_mime_icon("text/plain", GTK_ICON_SIZE_MENU); + file_icon = ui_get_mime_icon("text/plain"); basename = g_path_get_basename(DOC_FILENAME(doc)); gtk_tree_store_set(store_openfiles, iter, @@ -507,7 +508,7 @@ void sidebar_openfiles_update(GeanyDocument *doc) { /* just update color and the icon */ const GdkColor *color = document_get_status_color(doc); - GdkPixbuf *icon = doc->file_type->icon; + GIcon *icon = doc->file_type->icon; gtk_tree_store_set(store_openfiles, iter, DOCUMENTS_COLOR, color, -1); if (icon) Modified: src/ui_utils.c 49 files changed, 8 insertions(+), 41 deletions(-) =================================================================== @@ -2680,7 +2680,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, base_name = g_path_get_basename(DOC_FILENAME(doc)); menu_item = gtk_image_menu_item_new_with_label(base_name); - image = gtk_image_new_from_pixbuf(doc->file_type->icon); + image = gtk_image_new_from_gicon(doc->file_type->icon, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), image); gtk_widget_show(menu_item); @@ -2758,60 +2758,27 @@ void ui_editable_insert_text_callback(GtkEditable *editable, gchar *new_text, /* gets the icon that applies to a particular MIME type */ -GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size) +GIcon *ui_get_mime_icon(const gchar *mime_type) { - GdkPixbuf *icon = NULL; + GIcon *icon = NULL; gchar *ctype; - GIcon *gicon; - GtkIconInfo *info; - GtkIconTheme *theme; - gint real_size; - if (!gtk_icon_size_lookup(size, &real_size, NULL)) - { - g_return_val_if_reached(NULL); - } ctype = g_content_type_from_mime_type(mime_type); - if (ctype != NULL) + if (ctype) { - gicon = g_content_type_get_icon(ctype); - theme = gtk_icon_theme_get_default(); - info = gtk_icon_theme_lookup_by_gicon(theme, gicon, real_size, 0); - g_object_unref(gicon); + icon = g_content_type_get_icon(ctype); g_free(ctype); - - if (info != NULL) - { - icon = gtk_icon_info_load_icon(info, NULL); - gtk_icon_info_free(info); - } } - /* fallback for builds with GIO < 2.18 or if icon lookup failed, like it might happen on Windows */ - if (icon == NULL) + /* fallback if icon lookup failed, like it might happen on Windows (?) */ + if (! icon) { const gchar *stock_id = GTK_STOCK_FILE; - GtkIconSet *icon_set; if (strstr(mime_type, "directory")) stock_id = GTK_STOCK_DIRECTORY; - icon_set = gtk_icon_factory_lookup_default(stock_id); - if (icon_set) - { -#if GTK_CHECK_VERSION(3, 0, 0) - GtkStyleContext *ctx = gtk_style_context_new(); - GtkWidgetPath *path = gtk_widget_path_new(); - gtk_style_context_set_path(ctx, path); - gtk_widget_path_unref(path); - icon = gtk_icon_set_render_icon_pixbuf(icon_set, ctx, size); - g_object_unref(ctx); -#else - icon = gtk_icon_set_render_icon(icon_set, gtk_widget_get_default_style(), - gtk_widget_get_default_direction(), - GTK_STATE_NORMAL, size, NULL, NULL); -#endif - } + icon = g_themed_icon_new(stock_id); } return icon; } Modified: src/ui_utils.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -337,7 +337,7 @@ gboolean ui_is_keyval_enter_or_return(guint keyval); gint ui_get_gtk_settings_integer(const gchar *property_name, gint default_value); -GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size); +GIcon *ui_get_mime_icon(const gchar *mime_type); void ui_focus_current_document(void); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
16
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results per page:
10
25
50
100
200