Commit 31a69c0b0b3f6191d7e8cc742555d9ecfb37e9fd

Authored by Perry Werneck
1 parent c118e56f

Allowing customization of the 'about' icon.

rpm/pw3270.spec
1 # 1 #
2 # spec file for package pw3270 2 # spec file for package pw3270
3 # 3 #
4 -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. 4 +# Copyright (c) 2022 SUSE LLC
5 # Copyright (c) <2008> <Banco do Brasil S.A.> 5 # Copyright (c) <2008> <Banco do Brasil S.A.>
6 # 6 #
7 # All modifications and additions to the file contributed by third parties 7 # All modifications and additions to the file contributed by third parties
@@ -16,31 +16,30 @@ @@ -16,31 +16,30 @@
16 # Please submit bugfixes or comments via https://bugs.opensuse.org/ 16 # Please submit bugfixes or comments via https://bugs.opensuse.org/
17 # 17 #
18 18
19 -#---[ Versions ]------------------------------------------------------------------------------------------------------  
20 19
21 %define _product %(pkg-config --variable=product_name lib3270) 20 %define _product %(pkg-config --variable=product_name lib3270)
22 21
23 #---[ Packaging ]----------------------------------------------------------------------------------------------------- 22 #---[ Packaging ]-----------------------------------------------------------------------------------------------------
24 23
25 -Name: pw3270  
26 -Version: 5.4  
27 -Release: 0  
28 -Summary: IBM 3270 Terminal emulator for GTK  
29 -License: GPL-2.0  
30 -Group: System/X11/Terminals  
31 -Url: https://github.com/PerryWerneck/pw3270 24 +Name: pw3270
  25 +Version: 5.4
  26 +Release: 0
  27 +Summary: IBM 3270 Terminal emulator for GTK
  28 +License: GPL-2.0-only
  29 +Group: System/X11/Terminals
  30 +URL: https://github.com/PerryWerneck/pw3270
32 31
33 -Source: pw3270-%{version}.tar.xz 32 +Source: pw3270-%{version}.tar.xz
34 33
35 -BuildRoot: %{_tmppath}/%{name}-%{version}-build 34 +BuildRoot: %{_tmppath}/%{name}-%{version}-build
36 35
37 -Requires: shared-mime-info  
38 -Requires: %{name}-branding = %{version} 36 +Requires: %{name}-branding = %{version}
  37 +Requires: shared-mime-info
39 38
40 -Recommends: libv3270-config 39 +Recommends: libv3270-config
41 40
42 #--[ Setup by distribution ]------------------------------------------------------------------------------------------ 41 #--[ Setup by distribution ]------------------------------------------------------------------------------------------
43 -# 42 +#
44 # References: 43 # References:
45 # 44 #
46 # https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto#Detect_a_distribution_flavor_for_special_code 45 # https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto#Detect_a_distribution_flavor_for_special_code
@@ -50,10 +49,10 @@ Recommends: libv3270-config @@ -50,10 +49,10 @@ Recommends: libv3270-config
50 49
51 %if 0%{?centos_version} 50 %if 0%{?centos_version}
52 51
53 -BuildRequires: gtk3-devel  
54 -BuildRequires: glib2-devel  
55 -BuildRequires: libv3270-devel >= 5.3  
56 -BuildRequires: libappstream-glib 52 +BuildRequires: glib2-devel
  53 +BuildRequires: gtk3-devel
  54 +BuildRequires: libappstream-glib
  55 +BuildRequires: libv3270-devel >= 5.3
57 56
58 %endif 57 %endif
59 58
@@ -61,10 +60,10 @@ BuildRequires: libappstream-glib @@ -61,10 +60,10 @@ BuildRequires: libappstream-glib
61 60
62 %if 0%{?fedora} 61 %if 0%{?fedora}
63 62
64 -BuildRequires: pkgconfig(gtk+-3.0)  
65 -BuildRequires: pkgconfig(glib-2.0)  
66 -BuildRequires: pkgconfig(libv3270) >= 5.3  
67 -BuildRequires: libappstream-glib 63 +BuildRequires: libappstream-glib
  64 +BuildRequires: pkgconfig(glib-2.0)
  65 +BuildRequires: pkgconfig(gtk+-3.0)
  66 +BuildRequires: pkgconfig(libv3270) >= 5.3
68 67
69 %endif 68 %endif
70 69
@@ -72,11 +71,11 @@ BuildRequires: libappstream-glib @@ -72,11 +71,11 @@ BuildRequires: libappstream-glib
72 71
73 %if 0%{?suse_version} 72 %if 0%{?suse_version}
74 73
75 -BuildRequires: update-desktop-files  
76 -BuildRequires: pkgconfig(gtk+-3.0)  
77 -BuildRequires: pkgconfig(glib-2.0)  
78 -BuildRequires: pkgconfig(libv3270) >= 5.3  
79 -BuildRequires: appstream-glib 74 +BuildRequires: appstream-glib
  75 +BuildRequires: update-desktop-files
  76 +BuildRequires: pkgconfig(glib-2.0)
  77 +BuildRequires: pkgconfig(gtk+-3.0)
  78 +BuildRequires: pkgconfig(libv3270) >= 5.3
80 79
81 %glib2_gsettings_schema_requires 80 %glib2_gsettings_schema_requires
82 81
@@ -84,51 +83,69 @@ BuildRequires: appstream-glib @@ -84,51 +83,69 @@ BuildRequires: appstream-glib
84 83
85 #--------------------------------------------------------------------------------------------------------------------- 84 #---------------------------------------------------------------------------------------------------------------------
86 85
87 -BuildRequires: autoconf >= 2.61  
88 -BuildRequires: automake  
89 -BuildRequires: libtool  
90 -BuildRequires: binutils  
91 -BuildRequires: coreutils  
92 -BuildRequires: desktop-file-utils  
93 -BuildRequires: findutils  
94 -BuildRequires: gcc-c++  
95 -BuildRequires: gettext-devel  
96 -BuildRequires: m4  
97 -BuildRequires: pkgconfig  
98 -BuildRequires: sed  
99 -BuildRequires: fdupes  
100 -BuildRequires: autoconf-archive 86 +BuildRequires: autoconf >= 2.61
  87 +BuildRequires: autoconf-archive
  88 +BuildRequires: automake
  89 +BuildRequires: binutils
  90 +BuildRequires: coreutils
  91 +BuildRequires: desktop-file-utils
  92 +BuildRequires: fdupes
  93 +BuildRequires: findutils
  94 +BuildRequires: gcc-c++
  95 +BuildRequires: gettext-devel
  96 +BuildRequires: libtool
  97 +BuildRequires: m4
  98 +BuildRequires: pkgconfig
  99 +BuildRequires: sed
101 100
102 %description 101 %description
103 GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET. 102 GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET.
104 103
105 Based on the original x3270 code, pw3270 was originally created for Banco do Brasil, and is now used worldwide. 104 Based on the original x3270 code, pw3270 was originally created for Banco do Brasil, and is now used worldwide.
106 105
107 -#--[ Configuration & Branding ]---------------------------------------------------------------------------------------  
108 106
  107 +#--[ Configuration & Branding ]---------------------------------------------------------------------------------------
109 %package branding 108 %package branding
110 -Summary: Default branding for %{name}  
111 -Group: System/X11/Terminals 109 +Summary: Default branding for %{name}
  110 +Group: System/X11/Terminals
112 111
113 -Requires: %{name} = %{version}  
114 -BuildArch: noarch 112 +Requires: %{name} = %{version}
  113 +BuildArch: noarch
115 114
116 -Requires(post): desktop-file-utils  
117 -Requires(postun): desktop-file-utils 115 +Requires(post): desktop-file-utils
  116 +Requires(postun):desktop-file-utils
118 117
119 %description branding 118 %description branding
120 GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET. 119 GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET.
121 120
122 This package contains the default branding for %{name}. 121 This package contains the default branding for %{name}.
123 122
124 -#---[ Build & Install ]-----------------------------------------------------------------------------------------------  
125 123
  124 +#---[ Build & Install ]-----------------------------------------------------------------------------------------------
126 %prep 125 %prep
127 %setup 126 %setup
128 127
129 %global _lto_cflags %{_lto_cflags} -ffat-lto-objects 128 %global _lto_cflags %{_lto_cflags} -ffat-lto-objects
130 NOCONFIGURE=1 ./autogen.sh 129 NOCONFIGURE=1 ./autogen.sh
131 130
  131 +# Pull request #20 broke SLE-12 builds
  132 +update_for_compatibility() {
  133 + sed -i -e "s|<id>@APPLICATION_ID@|<id>@APPLICATION_ID@.desktop|" branding/metainfo.xml.in
  134 + sed -i -e "s|<component type=\"desktop-application\">|<component type=\"desktop\">|" branding/metainfo.xml.in
  135 +}
  136 +
  137 +%if 0%{?suse_version}
  138 + %if 0%{?suse_version} < 1500
  139 + update_for_compatibility
  140 + %endif
  141 +%endif
  142 +
  143 +%if 0%{?fedora}
  144 + %if 0%{?fedora_version} < 27
  145 + update_for_compatibility
  146 + %endif
  147 +%endif
  148 +
132 %configure --with-release=%{release} CFLAGS="${CFLAGS} -fpie" LDFLAGS="${LDFLAGS} -pie" 149 %configure --with-release=%{release} CFLAGS="${CFLAGS} -fpie" LDFLAGS="${LDFLAGS} -pie"
133 150
134 %build 151 %build
@@ -153,7 +170,6 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf @@ -153,7 +170,6 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf
153 170
154 # Main application 171 # Main application
155 %dir %{_datadir}/%{_product} 172 %dir %{_datadir}/%{_product}
156 -%dir %{_datadir}/%{_product}/ui  
157 %dir %{_datadir}/%{_product}/keypad 173 %dir %{_datadir}/%{_product}/keypad
158 %dir %{_libdir}/%{_product}-plugins 174 %dir %{_libdir}/%{_product}-plugins
159 %dir %{_datadir}/%{_product}/icons 175 %dir %{_datadir}/%{_product}/icons
@@ -162,6 +178,11 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf @@ -162,6 +178,11 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf
162 178
163 # Desktop files 179 # Desktop files
164 %{_datadir}/applications/*.desktop 180 %{_datadir}/applications/*.desktop
  181 +
  182 +%if 0%{?suse_version} < 1500
  183 +%dir %{_datadir}/metainfo
  184 +%endif
  185 +
165 %{_datadir}/metainfo/*.metainfo.xml 186 %{_datadir}/metainfo/*.metainfo.xml
166 187
167 # Icons 188 # Icons
@@ -173,10 +194,11 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf @@ -173,10 +194,11 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainf
173 # Configuration & Themes 194 # Configuration & Themes
174 %{_datadir}/glib-2.0/schemas/*.xml 195 %{_datadir}/glib-2.0/schemas/*.xml
175 %{_datadir}/mime/packages/*.xml 196 %{_datadir}/mime/packages/*.xml
  197 +%exclude %{_datadir}/glib-2.0/schemas/*.compiled
176 198
177 %files branding 199 %files branding
178 %defattr(-,root,root) 200 %defattr(-,root,root)
179 -%{_datadir}/%{_product}/ui/* 201 +%{_datadir}/%{_product}/*.ui.xml
180 %{_datadir}/%{_product}/*.svg 202 %{_datadir}/%{_product}/*.svg
181 203
182 %posttrans 204 %posttrans
src/objects/application/actions/about.c
@@ -46,6 +46,21 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication * @@ -46,6 +46,21 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication *
46 46
47 // Get application logo 47 // Get application logo
48 { 48 {
  49 + static const char * names[] = {
  50 + G_STRINGIFY(PRODUCT_NAME) "-about.svg",
  51 + G_STRINGIFY(PRODUCT_NAME) "-logo.svg",
  52 + G_STRINGIFY(PRODUCT_NAME) ".svg",
  53 + G_STRINGIFY(PRODUCT_NAME) "-logo.png",
  54 + G_STRINGIFY(PRODUCT_NAME) ".png",
  55 +
  56 + G_STRINGIFY(PACKAGE_NAME) "-about.svg",
  57 + G_STRINGIFY(PACKAGE_NAME) "-logo.svg",
  58 + G_STRINGIFY(PACKAGE_NAME) ".svg",
  59 + G_STRINGIFY(PACKAGE_NAME) "-logo.png",
  60 + G_STRINGIFY(PACKAGE_NAME) ".png",
  61 + };
  62 +
  63 + /*
49 #ifdef DEBUG 64 #ifdef DEBUG
50 static const char * logo = "./branding/" G_STRINGIFY(PRODUCT_NAME) "-logo.svg"; 65 static const char * logo = "./branding/" G_STRINGIFY(PRODUCT_NAME) "-logo.svg";
51 static const char * icon = "./branding/" G_STRINGIFY(PRODUCT_NAME) ".svg"; 66 static const char * icon = "./branding/" G_STRINGIFY(PRODUCT_NAME) ".svg";
@@ -58,18 +73,26 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication * @@ -58,18 +73,26 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication *
58 logo, 73 logo,
59 icon 74 icon
60 }; 75 };
  76 + */
61 77
62 size_t ix; 78 size_t ix;
63 79
64 - for(ix = 0; ix < G_N_ELEMENTS(imgs); ix++) { 80 + for(ix = 0; ix < G_N_ELEMENTS(names); ix++) {
  81 +
  82 +#ifdef DEBUG
  83 + g_autofree gchar * filename = g_build_filename(".","branding",names[ix],NULL);
  84 + debug("Searching for '%s'",filename);
  85 +#else
  86 + lib3270_autoptr(char) filename = lib3270_build_data_filename(names[ix],NULL);
  87 +#endif // DEBUG
65 88
66 - if(!g_file_test(imgs[ix],G_FILE_TEST_IS_REGULAR)) 89 + if(!g_file_test(filename,G_FILE_TEST_IS_REGULAR))
67 continue; 90 continue;
68 91
69 GError * error = NULL; 92 GError * error = NULL;
70 - g_autoptr(GdkPixbuf) pix = gdk_pixbuf_new_from_file_at_size(imgs[ix],-1,150,&error); 93 + g_autoptr(GdkPixbuf) pix = gdk_pixbuf_new_from_file_at_size(filename,-1,150,&error);
71 if(error) { 94 if(error) {
72 - g_warning("Can't load \"%s\": %s",imgs[ix],error->message); 95 + g_warning("Can't load \"%s\": %s",filename,error->message);
73 g_error_free(error); 96 g_error_free(error);
74 continue; 97 continue;
75 } 98 }