Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
xfce4-weather-plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
25
Issues
25
List
Boards
Labels
Service Desk
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Panel Plugins
xfce4-weather-plugin
Commits
fefdd9aa
Commit
fefdd9aa
authored
Jan 03, 2013
by
Harald Judt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reintroduce night time parameter for get_data().
Some kind of data will depend on whether it is night or day.
parent
683de85d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
20 deletions
+37
-20
panel-plugin/weather-data.c
panel-plugin/weather-data.c
+2
-1
panel-plugin/weather-data.h
panel-plugin/weather-data.h
+2
-1
panel-plugin/weather-summary.c
panel-plugin/weather-summary.c
+24
-13
panel-plugin/weather.c
panel-plugin/weather.c
+9
-5
No files found.
panel-plugin/weather-data.c
View file @
fefdd9aa
...
...
@@ -169,7 +169,8 @@ gchar *
get_data
(
const
xml_time
*
timeslice
,
const
units_config
*
units
,
const
data_types
type
,
gboolean
round
)
const
gboolean
round
,
const
gboolean
night_time
)
{
const
xml_location
*
loc
=
NULL
;
gdouble
val
;
...
...
panel-plugin/weather-data.h
View file @
fefdd9aa
...
...
@@ -103,7 +103,8 @@ gboolean timeslice_is_interval(xml_time *timeslice);
gchar
*
get_data
(
const
xml_time
*
timeslice
,
const
units_config
*
units
,
data_types
type
,
gboolean
round
);
gboolean
round
,
gboolean
night_time
);
const
gchar
*
get_unit
(
const
units_config
*
units
,
data_types
type
);
...
...
panel-plugin/weather-summary.c
View file @
fefdd9aa
...
...
@@ -50,7 +50,8 @@ lnk_clicked(GtkTextTag *tag,
g_free(value);
#define APPEND_TEXT_ITEM(text, item) \
rawvalue = get_data(conditions, data->units, item, FALSE); \
rawvalue = get_data(conditions, data->units, item, \
FALSE, data->night_time); \
unit = get_unit(data->units, item); \
value = g_strdup_printf("\t%s%s%s%s%s\n", \
text, text ? ": " : "", \
...
...
@@ -84,7 +85,8 @@ lnk_clicked(GtkTextTag *tag,
pos, pos+1, 0, 1); \
#define APPEND_TOOLTIP_ITEM(description, item) \
value = get_data(fcdata, data->units, item, data->round); \
value = get_data(fcdata, data->units, item, \
data->round, data->night_time); \
unit = get_unit(data->units, item); \
g_string_append_printf(text, description, value, \
strcmp(unit, "°") ? " " : "", \
...
...
@@ -422,8 +424,10 @@ create_summary_tab(plugin_data *data)
/* wind */
APPEND_BTEXT
(
_
(
"
\n
Wind
\n
"
));
wind
=
get_data
(
conditions
,
data
->
units
,
WIND_SPEED
,
FALSE
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_BEAUFORT
,
FALSE
);
wind
=
get_data
(
conditions
,
data
->
units
,
WIND_SPEED
,
FALSE
,
data
->
night_time
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_BEAUFORT
,
FALSE
,
data
->
night_time
);
value
=
g_strdup_printf
(
_
(
"
\t
%s: %s %s (%s on the Beaufort scale)
\n
"
),
_
(
"Speed"
),
wind
,
get_unit
(
data
->
units
,
WIND_SPEED
),
...
...
@@ -432,10 +436,12 @@ create_summary_tab(plugin_data *data)
g_free
(
wind
);
APPEND_TEXT_ITEM_REAL
(
value
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_DIRECTION
,
FALSE
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_DIRECTION
,
FALSE
,
data
->
night_time
);
wind
=
translate_wind_direction
(
rawvalue
);
g_free
(
rawvalue
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_DIRECTION_DEG
,
FALSE
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
WIND_DIRECTION_DEG
,
FALSE
,
data
->
night_time
);
value
=
g_strdup_printf
(
"
\t
%s: %s (%s%s)
\n
"
,
_
(
"Direction"
),
wind
,
rawvalue
,
get_unit
(
data
->
units
,
WIND_DIRECTION_DEG
));
...
...
@@ -630,7 +636,8 @@ add_forecast_cell(plugin_data *data,
}
/* symbol */
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
SYMBOL
,
FALSE
);
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
SYMBOL
,
FALSE
,
data
->
night_time
);
icon
=
get_icon
(
data
->
icon_theme
,
rawvalue
,
48
,
(
daytime
==
NIGHT
));
g_free
(
rawvalue
);
image
=
gtk_image_new_from_pixbuf
(
icon
);
...
...
@@ -639,7 +646,8 @@ add_forecast_cell(plugin_data *data,
g_object_unref
(
G_OBJECT
(
icon
));
/* symbol description */
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
SYMBOL
,
FALSE
);
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
SYMBOL
,
FALSE
,
data
->
night_time
);
value
=
g_strdup_printf
(
"%s"
,
translate_desc
(
rawvalue
,
(
daytime
==
NIGHT
)));
g_free
(
rawvalue
);
...
...
@@ -651,8 +659,8 @@ add_forecast_cell(plugin_data *data,
g_free
(
value
);
/* temperature */
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
TEMPERATURE
,
data
->
round
);
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
TEMPERATURE
,
data
->
round
,
data
->
night_time
);
value
=
g_strdup_printf
(
"%s %s"
,
rawvalue
,
get_unit
(
data
->
units
,
TEMPERATURE
));
g_free
(
rawvalue
);
...
...
@@ -663,9 +671,11 @@ add_forecast_cell(plugin_data *data,
g_free
(
value
);
/* wind direction and speed */
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
WIND_DIRECTION
,
FALSE
);
rawvalue
=
get_data
(
fcdata
,
data
->
units
,
WIND_DIRECTION
,
FALSE
,
data
->
night_time
);
wind_direction
=
translate_wind_direction
(
rawvalue
);
wind_speed
=
get_data
(
fcdata
,
data
->
units
,
WIND_SPEED
,
data
->
round
);
wind_speed
=
get_data
(
fcdata
,
data
->
units
,
WIND_SPEED
,
data
->
round
,
data
->
night_time
);
value
=
g_strdup_printf
(
"%s %s %s"
,
wind_direction
,
wind_speed
,
get_unit
(
data
->
units
,
WIND_SPEED
));
g_free
(
wind_speed
);
...
...
@@ -879,7 +889,8 @@ create_summary_window(plugin_data *data)
vbox
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
GTK_DIALOG
(
window
)
->
vbox
),
vbox
,
TRUE
,
TRUE
,
0
);
symbol
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
FALSE
);
symbol
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
FALSE
,
data
->
night_time
);
icon
=
get_icon
(
data
->
icon_theme
,
symbol
,
48
,
data
->
night_time
);
g_free
(
symbol
);
...
...
panel-plugin/weather.c
View file @
fefdd9aa
...
...
@@ -50,7 +50,8 @@
#define UPDATE_INTERVAL (10)
#define DATA_AND_UNIT(var, item) \
value = get_data(conditions, data->units, item, data->round); \
value = get_data(conditions, data->units, item, \
data->round, data->night_time); \
unit = get_unit(data->units, item); \
var = g_strdup_printf("%s%s%s", \
value, \
...
...
@@ -161,7 +162,8 @@ make_label(const plugin_data *data,
/* get current weather conditions */
conditions
=
get_current_conditions
(
data
->
weatherdata
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
type
,
data
->
round
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
type
,
data
->
round
,
data
->
night_time
);
switch
(
type
)
{
case
WIND_DIRECTION
:
...
...
@@ -261,7 +263,8 @@ update_icon(plugin_data *data)
/* set icon according to current weather conditions */
conditions
=
get_current_conditions
(
data
->
weatherdata
);
str
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
data
->
round
);
str
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
data
->
round
,
data
->
night_time
);
icon
=
get_icon
(
data
->
icon_theme
,
str
,
size
,
data
->
night_time
);
g_free
(
str
);
gtk_image_set_from_pixbuf
(
GTK_IMAGE
(
data
->
iconimage
),
icon
);
...
...
@@ -1347,7 +1350,7 @@ weather_get_tooltip_text(const plugin_data *data)
else
sunval
=
g_strdup_printf
(
""
);
sym
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
FALSE
);
sym
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
FALSE
,
data
->
night_time
);
DATA_AND_UNIT
(
alt
,
ALTITUDE
);
DATA_AND_UNIT
(
temp
,
TEMPERATURE
);
DATA_AND_UNIT
(
windspeed
,
WIND_SPEED
);
...
...
@@ -1456,7 +1459,8 @@ weather_get_tooltip_cb(GtkWidget *widget,
}
conditions
=
get_current_conditions
(
data
->
weatherdata
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
data
->
round
);
rawvalue
=
get_data
(
conditions
,
data
->
units
,
SYMBOL
,
data
->
round
,
data
->
night_time
);
switch
(
data
->
tooltip_style
)
{
case
TOOLTIP_SIMPLE
:
icon_size
=
96
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment