Skip to content

Commit 96b5ddb

Browse files
authored
don't hardcode weathershow icon path (#473)
* don't hardcode weathershow icon path * Move weathershow data files to data dir
1 parent d804a12 commit 96b5ddb

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

budgie-weathershow/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ install_data('schema/org.ubuntubudgie.plugins.weathershow.gschema.xml',
3030

3131
install_data(
3232
'cities',
33-
install_dir: join_paths(LIB_INSTALL_DIR)
33+
install_dir: WEATHERSHOW_DATADIR
3434
)
3535

3636

budgie-weathershow/src/desktop_weather/desktop_weather.vala

+1-4
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,7 @@ public class DesktopWeather : Gtk.Window {
307307

308308
private void get_icondata () {
309309
// fetch the icon list
310-
string icondir = "/".concat(
311-
"usr/lib/budgie-desktop/plugins",
312-
"/budgie-weathershow/weather_icons"
313-
);
310+
string icondir = GLib.Path.build_filename(Config.WEATHERSHOW_DATADIR, "weather_icons");
314311
iconnames = {};
315312
iconpixbufs_1 = {};
316313
iconpixbufs_2 = {};

budgie-weathershow/src/desktop_weather/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ executable(
4747
install: true,
4848
vala_args: DesktopWeatherValaArgs,
4949
c_args: DesktopWeatherCArgs,
50+
include_directories: config_inc_dir,
5051
install_dir: LIB_INSTALL_DIR,
5152
)
5253

budgie-weathershow/src/weathershow/WeatherShow.vala

+7-9
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ namespace WeatherShowFunctions {
165165
} return -1;
166166
}
167167

168-
private string[] get_matches(string lookfor, string dir) {
168+
private string[] get_matches(string lookfor) {
169169
// find matching cities
170-
File datasrc = File.new_for_path(dir.concat("/cities"));
170+
string citiesfile = GLib.Path.build_filename(Config.WEATHERSHOW_DATADIR, "cities");
171+
File datasrc = File.new_for_path(citiesfile);
172+
171173
string fixed = lookfor.down().to_ascii();
172174
try {
173175
var dis = new DataInputStream (datasrc.read ());
@@ -990,9 +992,7 @@ namespace WeatherShowApplet {
990992
private string set_initialcity() {
991993
// on opening settings, set the gui to the current value
992994
string initial_citycode = citycode;
993-
string[] initline = WeatherShowFunctions.get_matches(
994-
initial_citycode, moduledir
995-
);
995+
string[] initline = WeatherShowFunctions.get_matches(initial_citycode);
996996
// fix for change of cityfile (!)
997997
if (initline.length == 0) {
998998
citycode = "2643743";
@@ -1084,9 +1084,7 @@ namespace WeatherShowApplet {
10841084
edit_citymenu == true &&
10851085
entry != null
10861086
) {
1087-
string[] matches = WeatherShowFunctions.get_matches(
1088-
currentry, moduledir
1089-
);
1087+
string[] matches = WeatherShowFunctions.get_matches(currentry);
10901088
int n_matches = matches.length;
10911089
if (n_matches > 0) {
10921090
foreach (string s in matches) {
@@ -1507,7 +1505,7 @@ namespace WeatherShowApplet {
15071505

15081506
private void get_icondata () {
15091507
// fetch the icon list
1510-
string icondir = moduledir.concat("/weather_icons");
1508+
string icondir = GLib.Path.build_filename(Config.WEATHERSHOW_DATADIR, "weather_icons");
15111509
iconnames = {}; iconpixbufs = {}; iconpixbufs_large = {};
15121510
try {
15131511
var dr = Dir.open(icondir);

budgie-weathershow/weather_icons/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ install_data(
6767
'804d-overcast-clouds.svg',
6868
'804n-overcast-clouds.svg',
6969
'error_icon.svg',
70-
install_dir: join_paths(LIB_INSTALL_DIR, 'weather_icons')
70+
install_dir: join_paths(WEATHERSHOW_DATADIR, 'weather_icons')
7171
)

meson.build

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ conf.set_quoted('PREVIEWS_DIR', join_paths(libdir, PREVIEWS))
7171
WSWITCHER = 'budgie-wswitcher'
7272
conf.set_quoted('WSWITCHER_DIR', join_paths(PLUGINS_INSTALL_DIR, WSWITCHER))
7373

74+
WEATHERSHOW_DATADIR = join_paths(datadir, 'budgie-desktop', 'budgie-weathershow')
75+
conf.set_quoted('WEATHERSHOW_DATADIR', WEATHERSHOW_DATADIR)
76+
7477
with_stateless = get_option('with-stateless')
7578
if with_stateless == true
7679
warning('Only use stateless option with a supported OS like Solus')

vapi/config.vapi

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ namespace Config {
99
public const string SHUFFLER_DIR;
1010
public const string PREVIEWS_DIR;
1111
public const string WSWITCHER_DIR;
12+
public const string WEATHERSHOW_DATADIR;
1213
}

0 commit comments

Comments
 (0)