From 12fc15c56844de1492c4ee31cbb12a54b37cfc2e Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 25 Feb 2009 16:45:06 +0900 Subject: [PATCH] Fix display of window icon --- Makefile.am | 19 ++++++++++++++++--- doc/automake.mk | 25 +++++++++++-------------- src/ui/gui/about.c | 3 +-- src/ui/gui/automake.mk | 26 +++++++++++++++++++++++++- src/ui/gui/psppire-dialog.c | 5 ++++- src/ui/gui/psppire-window.c | 2 ++ tests/automake.mk | 3 ++- 7 files changed, 61 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index 06ae2e00..f606cbf1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,9 +37,10 @@ noinst_PROGRAMS= check_PROGRAMS= bin_PROGRAMS= DIST_HOOKS = +INSTALL_DATA_HOOKS = +UNINSTALL_DATA_HOOKS = PHONY = -DIST_HOOKS += generate-changelog generate-changelog: if test -d $(top_srcdir)/.git; then \ $(top_srcdir)/gitlog-to-changelog --since=2008-07-27 \ @@ -48,6 +49,9 @@ generate-changelog: mv $(distdir)/cl-t $(distdir)/ChangeLog; \ fi +DIST_HOOKS += generate-changelog + + include $(top_srcdir)/lib/automake.mk include $(top_srcdir)/doc/automake.mk include $(top_srcdir)/config/automake.mk @@ -64,6 +68,15 @@ if WITH_PERL_MODULE include $(top_srcdir)/perl-module/automake.mk endif -PHONY += $(DIST_HOOKS) -dist-hook: $(DIST_HOOKS) +PHONY += $(DIST_HOOKS) $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) + .PHONY: $(PHONY) + +dist-hook: $(DIST_HOOKS) + +install-data-hook: $(INSTALL_DATA_HOOKS) + +uninstall-hook: $(UNINSTALL_DATA_HOOKS) + + + diff --git a/doc/automake.mk b/doc/automake.mk index c25e0cb3..f6f669b1 100644 --- a/doc/automake.mk +++ b/doc/automake.mk @@ -46,22 +46,19 @@ doc/ni.texi: $(top_srcdir)/src/language/command.def doc/get-commands.pl @$(MKDIR_P) doc @PERL@ $(top_srcdir)/doc/get-commands.pl $(top_srcdir)/src/language/command.def > $@ -# It seems that recent versions of yelp, upon which the gui relies to display the reference -# manual, are broken. It only works on compressed info files. So we must compress them. -if WITHGUI -YELP_CHECK = yelp-check -else -YELP_CHECK = -endif -install-data-hook:: $(YELP_CHECK) - for ifile in $(DESTDIR)$(infodir)/pspp.info-[0-9] \ - $(DESTDIR)$(infodir)/pspp.info ; do \ + +install-info-file: + for ifile in $(DESTDIR)$(infodir)/pspp.info-[0-9] $(DESTDIR)$(infodir)/pspp.info ; do \ gzip -f $$ifile ; \ - done + done + +INSTALL_DATA_HOOKS += install-info-file + +uninstall-info-file: + $(RM) $(DESTDIR)$(infodir)/pspp.info-[0-9].gz ; \ + $(RM) $(DESTDIR)$(infodir)/pspp.info.gz ; -uninstall-hook:: - rm -f $(DESTDIR)$(infodir)/pspp.info-[0-9].gz - rm -f $(DESTDIR)$(infodir)/pspp.info.gz +UNINSTALL_DATA_HOOKS += uninstall-info-file EXTRA_DIST += doc/OChangeLog CLEANFILES += pspp-dev.dvi diff --git a/src/ui/gui/about.c b/src/ui/gui/about.c index 23ae5b06..8ca91cbe 100644 --- a/src/ui/gui/about.c +++ b/src/ui/gui/about.c @@ -41,8 +41,7 @@ about_new (GtkMenuItem *m, GtkWindow *parent) gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (about), pb); - gtk_window_set_icon_from_file (GTK_WINDOW (about), - relocate (PKGDATADIR "/psppicon.png"), 0); + gtk_window_set_icon_name (GTK_WINDOW (about), "psppicon"); gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about), "http://www.gnu.org/software/pspp"); diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index e664ab9d..92acbd69 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -33,6 +33,29 @@ src_ui_gui_psppire_LDADD = \ src_ui_gui_psppiredir = $(pkgdatadir) + +themedir = $(DESTDIR)$(datadir)/icons/hicolor +context = apps + + +install-icons: + for size in 16x16 ; do \ + $(MKDIR_P) $(themedir)/$$size/$(context) ; \ + $(INSTALL) $(top_srcdir)/src/ui/gui/psppicon.png $(themedir)/$$size/$(context) ; \ + done + gtk-update-icon-cache --ignore-theme-index $(themedir) + +INSTALL_DATA_HOOKS += install-icons + +uninstall-icons: + for size in 16x16 ; do \ + $(RM) $(themedir)/$$size/$(context)/psppicon.png ; \ + done + gtk-update-icon-cache --ignore-theme-index $(themedir) + +UNINSTALL_DATA_HOOKS += uninstall-icons + + nodist_src_ui_gui_psppire_DATA = \ $(top_builddir)/src/ui/gui/crosstabs.ui \ $(top_builddir)/src/ui/gui/descriptives-dialog.ui \ @@ -52,7 +75,6 @@ nodist_src_ui_gui_psppire_DATA = \ dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/text-data-import.glade \ - $(top_srcdir)/src/ui/gui/psppicon.png \ $(top_srcdir)/src/ui/gui/pspplogo.png \ $(top_srcdir)/src/ui/gui/icons/value-labels.png \ $(top_srcdir)/src/ui/gui/icons/goto-variable.png\ @@ -214,6 +236,7 @@ yelp-check: echo ' Yelp is available from the GNOME project. ftp://ftp.gnome.org/pub/gnome/sources/yelp' ; \ echo ; \ fi + PHONY += yelp-check AM_CPPFLAGS += -Isrc @@ -228,6 +251,7 @@ src/ui/gui/psppire-marshal.h: src/ui/gui/marshaller-list gtk-builder-convert $< $@ EXTRA_DIST += src/ui/gui/OChangeLog\ + src/ui/gui/psppicon.png \ src/ui/gui/marshaller-list BUILT_SOURCES += src/ui/gui/psppire-marshal.c src/ui/gui/psppire-marshal.h diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c index 84f9e5de..6945c2a9 100644 --- a/src/ui/gui/psppire-dialog.c +++ b/src/ui/gui/psppire-dialog.c @@ -289,6 +289,8 @@ psppire_dialog_init (PsppireDialog *dialog) gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG); + g_object_set (dialog, "icon-name", "psppicon", NULL); + gtk_widget_show_all (dialog->box); } @@ -298,7 +300,8 @@ psppire_dialog_new (void) { PsppireDialog *dialog ; - dialog = g_object_new (psppire_dialog_get_type (), NULL); + dialog = g_object_new (psppire_dialog_get_type (), + NULL); return GTK_WIDGET (dialog) ; } diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index 1e2e75d3..6945914a 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -387,6 +387,8 @@ psppire_window_init (PsppireWindow *window) window->unsaved = FALSE; g_signal_connect (window, "delete-event", G_CALLBACK (on_delete), window); + + g_object_set (window, "icon-name", "psppicon", NULL); } diff --git a/tests/automake.mk b/tests/automake.mk index 61c66bd5..4c3899b1 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -341,11 +341,12 @@ EXTRA_DIST += \ CLEANFILES += *.save pspp.* foo* -DIST_HOOKS += check-for-export-var-val check-for-export-var-val: @if grep -q 'export .*=' $(dist_TESTS) ; then \ echo 'One or more tests contain non-portable "export VAR=val" syntax' ; \ false ; \ fi +DIST_HOOKS += check-for-export-var-val + EXTRA_DIST += tests/OChangeLog -- 2.30.2