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
c6c608b5
Commit
c6c608b5
authored
Dec 09, 2012
by
Harald Judt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename xfceweather_data to plugin_data and fix some compile warnings.
parent
e1f2d5cd
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
161 additions
and
161 deletions
+161
-161
panel-plugin/weather-config.c
panel-plugin/weather-config.c
+101
-101
panel-plugin/weather-config.h
panel-plugin/weather-config.h
+2
-2
panel-plugin/weather-debug.c
panel-plugin/weather-debug.c
+2
-2
panel-plugin/weather-debug.h
panel-plugin/weather-debug.h
+1
-1
panel-plugin/weather-parsers.c
panel-plugin/weather-parsers.c
+4
-4
panel-plugin/weather-summary.c
panel-plugin/weather-summary.c
+6
-6
panel-plugin/weather-summary.h
panel-plugin/weather-summary.h
+1
-1
panel-plugin/weather.c
panel-plugin/weather.c
+38
-38
panel-plugin/weather.h
panel-plugin/weather.h
+6
-6
No files found.
panel-plugin/weather-config.c
View file @
c6c608b5
...
...
@@ -116,21 +116,21 @@ static void
update_summary_window
(
xfceweather_dialog
*
dialog
,
gboolean
restore_position
)
{
if
(
dialog
->
w
d
->
summary_window
)
{
g
u
int
x
,
y
;
if
(
dialog
->
p
d
->
summary_window
)
{
gint
x
,
y
;
/* remember position */
if
(
restore_position
)
gtk_window_get_position
(
GTK_WINDOW
(
dialog
->
w
d
->
summary_window
),
gtk_window_get_position
(
GTK_WINDOW
(
dialog
->
p
d
->
summary_window
),
&
x
,
&
y
);
/* call toggle function two times to close and open dialog */
forecast_click
(
dialog
->
wd
->
summary_window
,
dialog
->
w
d
);
forecast_click
(
dialog
->
wd
->
summary_window
,
dialog
->
w
d
);
forecast_click
(
dialog
->
pd
->
summary_window
,
dialog
->
p
d
);
forecast_click
(
dialog
->
pd
->
summary_window
,
dialog
->
p
d
);
/* ask wm to restore position of new window */
if
(
restore_position
)
gtk_window_move
(
GTK_WINDOW
(
dialog
->
w
d
->
summary_window
),
x
,
y
);
gtk_window_move
(
GTK_WINDOW
(
dialog
->
p
d
->
summary_window
),
x
,
y
);
/* bring config dialog to the front, it might have been hidden
* beneath the summary window */
...
...
@@ -149,10 +149,10 @@ schedule_data_update(gpointer user_data)
/* force update of downloaded data */
weather_debug
(
"Delayed update timer expired, now scheduling data update."
);
update_weatherdata_with_reset
(
dialog
->
w
d
,
TRUE
);
update_weatherdata_with_reset
(
dialog
->
p
d
,
TRUE
);
/* make use of previously saved data */
read_cache_file
(
dialog
->
w
d
);
read_cache_file
(
dialog
->
p
d
);
gtk_spinner_stop
(
GTK_SPINNER
(
dialog
->
update_spinner
));
gtk_widget_hide
(
GTK_WIDGET
(
dialog
->
update_spinner
));
...
...
@@ -169,8 +169,8 @@ schedule_delayed_data_update(xfceweather_dialog *dialog)
g_source_remove
(
dialog
->
timer_id
);
/* stop any updates that could be performed by weather.c */
if
(
dialog
->
w
d
->
updatetimeout
)
g_source_remove
(
dialog
->
w
d
->
updatetimeout
);
if
(
dialog
->
p
d
->
updatetimeout
)
g_source_remove
(
dialog
->
p
d
->
updatetimeout
);
gtk_widget_show
(
GTK_WIDGET
(
dialog
->
update_spinner
));
gtk_spinner_start
(
GTK_SPINNER
(
dialog
->
update_spinner
));
...
...
@@ -233,7 +233,7 @@ cb_lookup_altitude(SoupSession *session,
alt
=
string_to_double
(
altitude
->
altitude
,
-
9999
);
weather_debug
(
"Altitude returned by GeoNames: %.0f meters"
,
alt
);
if
(
alt
>=
-
420
)
{
if
(
dialog
->
w
d
->
units
->
altitude
==
FEET
)
if
(
dialog
->
p
d
->
units
->
altitude
==
FEET
)
alt
/=
0
.
3048
;
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
dialog
->
spin_alt
),
alt
);
...
...
@@ -283,14 +283,14 @@ lookup_altitude_timezone(const gpointer user_data)
url
=
g_strdup_printf
(
"http://api.geonames.org"
"/srtm3XML?lat=%s&lng=%s&username=%s"
,
&
latbuf
[
0
],
&
lonbuf
[
0
],
GEONAMES_USERNAME
);
weather_http_queue_request
(
dialog
->
w
d
->
session
,
url
,
weather_http_queue_request
(
dialog
->
p
d
->
session
,
url
,
cb_lookup_altitude
,
user_data
);
g_free
(
url
);
/* lookup timezone */
url
=
g_strdup_printf
(
"http://www.earthtools.org/timezone/%s/%s"
,
&
latbuf
[
0
],
&
lonbuf
[
0
]);
weather_http_queue_request
(
dialog
->
w
d
->
session
,
url
,
weather_http_queue_request
(
dialog
->
p
d
->
session
,
url
,
cb_lookup_timezone
,
user_data
);
g_free
(
url
);
}
...
...
@@ -340,7 +340,7 @@ start_auto_locate(xfceweather_dialog *dialog)
gtk_widget_set_sensitive
(
dialog
->
text_loc_name
,
FALSE
);
gtk_entry_set_text
(
GTK_ENTRY
(
dialog
->
text_loc_name
),
_
(
"Detecting..."
));
gtk_spinner_start
(
GTK_SPINNER
(
dialog
->
update_spinner
));
weather_search_by_ip
(
dialog
->
w
d
->
session
,
auto_locate_cb
,
dialog
);
weather_search_by_ip
(
dialog
->
p
d
->
session
,
auto_locate_cb
,
dialog
);
}
...
...
@@ -353,7 +353,7 @@ cb_findlocation(GtkButton *button,
gchar
*
loc_name
,
*
lat
,
*
lon
;
gchar
latbuf
[
15
],
lonbuf
[
15
];
sdialog
=
create_search_dialog
(
NULL
,
dialog
->
w
d
->
session
);
sdialog
=
create_search_dialog
(
NULL
,
dialog
->
p
d
->
session
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
button
),
FALSE
);
if
(
run_search_dialog
(
sdialog
))
{
...
...
@@ -385,14 +385,14 @@ setup_altitude(xfceweather_dialog *dialog)
g_signal_handlers_block_by_func
(
dialog
->
spin_alt
,
G_CALLBACK
(
spin_alt_value_changed
),
dialog
);
switch
(
dialog
->
w
d
->
units
->
altitude
)
{
switch
(
dialog
->
p
d
->
units
->
altitude
)
{
case
METERS
:
gtk_label_set_text
(
GTK_LABEL
(
dialog
->
label_alt_unit
),
_
(
"meters"
));
gtk_spin_button_set_range
(
GTK_SPIN_BUTTON
(
dialog
->
spin_alt
),
-
420
,
10000
);
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
dialog
->
spin_alt
),
(
gdouble
)
(
dialog
->
w
d
->
msl
));
(
gdouble
)
(
dialog
->
p
d
->
msl
));
break
;
case
FEET
:
...
...
@@ -401,7 +401,7 @@ setup_altitude(xfceweather_dialog *dialog)
gtk_spin_button_set_range
(
GTK_SPIN_BUTTON
(
dialog
->
spin_alt
),
-
1378
.
0
,
32808
);
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
dialog
->
spin_alt
),
(
gdouble
)
dialog
->
w
d
->
msl
/
0
.
3048
);
(
gdouble
)
dialog
->
p
d
->
msl
/
0
.
3048
);
break
;
}
g_signal_handlers_unblock_by_func
(
dialog
->
spin_alt
,
...
...
@@ -416,8 +416,8 @@ text_loc_name_changed(const GtkWidget *spin,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
g_free
(
dialog
->
w
d
->
location_name
);
dialog
->
w
d
->
location_name
=
g_free
(
dialog
->
p
d
->
location_name
);
dialog
->
p
d
->
location_name
=
g_strdup
(
gtk_entry_get_text
(
GTK_ENTRY
(
dialog
->
text_loc_name
)));
}
...
...
@@ -431,8 +431,8 @@ spin_lat_value_changed(const GtkWidget *spin,
gdouble
val
;
val
=
gtk_spin_button_get_value
(
GTK_SPIN_BUTTON
(
spin
));
g_free
(
dialog
->
w
d
->
lat
);
dialog
->
w
d
->
lat
=
g_strdup
(
g_ascii_formatd
(
latbuf
,
10
,
"%.6f"
,
val
));
g_free
(
dialog
->
p
d
->
lat
);
dialog
->
p
d
->
lat
=
g_strdup
(
g_ascii_formatd
(
latbuf
,
10
,
"%.6f"
,
val
));
schedule_delayed_data_update
(
dialog
);
}
...
...
@@ -446,8 +446,8 @@ spin_lon_value_changed(const GtkWidget *spin,
gdouble
val
;
val
=
gtk_spin_button_get_value
(
GTK_SPIN_BUTTON
(
spin
));
g_free
(
dialog
->
w
d
->
lon
);
dialog
->
w
d
->
lon
=
g_strdup
(
g_ascii_formatd
(
lonbuf
,
10
,
"%.6f"
,
val
));
g_free
(
dialog
->
p
d
->
lon
);
dialog
->
p
d
->
lon
=
g_strdup
(
g_ascii_formatd
(
lonbuf
,
10
,
"%.6f"
,
val
));
schedule_delayed_data_update
(
dialog
);
}
...
...
@@ -460,9 +460,9 @@ spin_alt_value_changed(const GtkWidget *spin,
gdouble
val
;
val
=
gtk_spin_button_get_value
(
GTK_SPIN_BUTTON
(
spin
));
if
(
dialog
->
w
d
->
units
->
altitude
==
FEET
)
if
(
dialog
->
p
d
->
units
->
altitude
==
FEET
)
val
*=
0
.
3048
;
dialog
->
w
d
->
msl
=
(
gint
)
val
;
dialog
->
p
d
->
msl
=
(
gint
)
val
;
schedule_delayed_data_update
(
dialog
);
}
...
...
@@ -473,7 +473,7 @@ spin_timezone_value_changed(const GtkWidget *spin,
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
timezone
=
dialog
->
p
d
->
timezone
=
gtk_spin_button_get_value_as_int
(
GTK_SPIN_BUTTON
(
spin
));
}
...
...
@@ -511,9 +511,9 @@ create_location_page(xfceweather_dialog *dialog)
G_CALLBACK
(
cb_findlocation
),
dialog
);
gtk_box_pack_start
(
GTK_BOX
(
hbox
),
button_loc_change
,
FALSE
,
FALSE
,
0
);
if
(
dialog
->
w
d
->
location_name
)
if
(
dialog
->
p
d
->
location_name
)
gtk_entry_set_text
(
GTK_ENTRY
(
dialog
->
text_loc_name
),
dialog
->
w
d
->
location_name
);
dialog
->
p
d
->
location_name
);
else
gtk_entry_set_text
(
GTK_ENTRY
(
dialog
->
text_loc_name
),
_
(
"Unset"
));
/* update spinner */
...
...
@@ -526,7 +526,7 @@ create_location_page(xfceweather_dialog *dialog)
hbox
=
gtk_hbox_new
(
FALSE
,
BORDER
);
ADD_LABEL
(
_
(
"Latitud_e:"
),
sg_label
);
ADD_SPIN
(
dialog
->
spin_lat
,
-
90
,
90
,
1
,
(
string_to_double
(
dialog
->
w
d
->
lat
,
0
)),
6
,
sg_spin
);
(
string_to_double
(
dialog
->
p
d
->
lat
,
0
)),
6
,
sg_spin
);
SET_TOOLTIP
(
dialog
->
spin_lat
,
_
(
"Latitude specifies the north-south position of a point on "
"the Earth's surface. If you change this value manually, "
...
...
@@ -540,7 +540,7 @@ create_location_page(xfceweather_dialog *dialog)
hbox
=
gtk_hbox_new
(
FALSE
,
BORDER
);
ADD_LABEL
(
_
(
"L_ongitude:"
),
sg_label
);
ADD_SPIN
(
dialog
->
spin_lon
,
-
180
,
180
,
1
,
(
string_to_double
(
dialog
->
w
d
->
lon
,
0
)),
6
,
sg_spin
);
(
string_to_double
(
dialog
->
p
d
->
lon
,
0
)),
6
,
sg_spin
);
SET_TOOLTIP
(
dialog
->
spin_lon
,
_
(
"Longitude specifies the east-west position of a point on "
"the Earth's surface. If you change this value manually, "
...
...
@@ -553,7 +553,7 @@ create_location_page(xfceweather_dialog *dialog)
/* altitude */
hbox
=
gtk_hbox_new
(
FALSE
,
BORDER
);
ADD_LABEL
(
_
(
"_Altitude:"
),
sg_label
);
ADD_SPIN
(
dialog
->
spin_alt
,
-
420
,
10000
,
1
,
dialog
->
w
d
->
msl
,
0
,
sg_spin
);
ADD_SPIN
(
dialog
->
spin_alt
,
-
420
,
10000
,
1
,
dialog
->
p
d
->
msl
,
0
,
sg_spin
);
SET_TOOLTIP
(
dialog
->
spin_alt
,
_
(
"For locations outside Norway the elevation model that's used by "
...
...
@@ -577,7 +577,7 @@ create_location_page(xfceweather_dialog *dialog)
hbox
=
gtk_hbox_new
(
FALSE
,
BORDER
);
ADD_LABEL
(
_
(
"_Timezone:"
),
sg_label
);
ADD_SPIN
(
dialog
->
spin_timezone
,
-
24
,
24
,
1
,
dialog
->
w
d
->
timezone
,
0
,
sg_spin
);
dialog
->
p
d
->
timezone
,
0
,
sg_spin
);
SET_TOOLTIP
(
dialog
->
spin_timezone
,
_
(
"If the chosen location is not in your current timezone, this "
...
...
@@ -612,9 +612,9 @@ combo_unit_temperature_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
units
->
temperature
=
dialog
->
p
d
->
units
->
temperature
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -624,9 +624,9 @@ combo_unit_pressure_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
units
->
pressure
=
dialog
->
p
d
->
units
->
pressure
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -636,9 +636,9 @@ combo_unit_windspeed_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
units
->
windspeed
=
dialog
->
p
d
->
units
->
windspeed
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -648,9 +648,9 @@ combo_unit_precipitations_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
units
->
precipitations
=
dialog
->
p
d
->
units
->
precipitations
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -661,7 +661,7 @@ combo_unit_altitude_changed(GtkWidget *combo,
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
units
->
altitude
=
dialog
->
p
d
->
units
->
altitude
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
setup_altitude
(
dialog
);
update_summary_window
(
dialog
,
TRUE
);
...
...
@@ -735,8 +735,8 @@ create_units_page(xfceweather_dialog *dialog)
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hbox
,
FALSE
,
FALSE
,
BORDER
);
/* initialize widgets with current data */
if
(
dialog
->
w
d
)
setup_units
(
dialog
,
dialog
->
w
d
->
units
);
if
(
dialog
->
p
d
)
setup_units
(
dialog
,
dialog
->
p
d
->
units
);
gtk_box_pack_start
(
GTK_BOX
(
page
),
vbox
,
FALSE
,
FALSE
,
0
);
g_object_unref
(
G_OBJECT
(
sg_label
));
...
...
@@ -751,7 +751,7 @@ combo_icon_theme_set_tooltip(GtkWidget *combo,
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
gchar
*
text
;
if
(
G_UNLIKELY
(
dialog
->
w
d
->
icon_theme
==
NULL
))
{
if
(
G_UNLIKELY
(
dialog
->
p
d
->
icon_theme
==
NULL
))
{
/* this should never happen, but who knows... */
gtk_widget_set_tooltip_text
(
GTK_WIDGET
(
combo
),
_
(
"Choose an icon theme."
));
...
...
@@ -763,10 +763,10 @@ combo_icon_theme_set_tooltip(GtkWidget *combo,
"<b>Author:</b> %s
\n\n
"
"<b>Description:</b> %s
\n\n
"
"<b>License:</b> %s"
),
TEXT_UNKNOWN
(
dialog
->
w
d
->
icon_theme
->
dir
),
TEXT_UNKNOWN
(
dialog
->
w
d
->
icon_theme
->
author
),
TEXT_UNKNOWN
(
dialog
->
w
d
->
icon_theme
->
description
),
TEXT_UNKNOWN
(
dialog
->
w
d
->
icon_theme
->
license
));
TEXT_UNKNOWN
(
dialog
->
p
d
->
icon_theme
->
dir
),
TEXT_UNKNOWN
(
dialog
->
p
d
->
icon_theme
->
author
),
TEXT_UNKNOWN
(
dialog
->
p
d
->
icon_theme
->
description
),
TEXT_UNKNOWN
(
dialog
->
p
d
->
icon_theme
->
license
));
gtk_widget_set_tooltip_markup
(
GTK_WIDGET
(
combo
),
text
);
g_free
(
text
);
}
...
...
@@ -784,14 +784,14 @@ combo_icon_theme_changed(GtkWidget *combo,
if
(
G_UNLIKELY
(
i
==
-
1
))
return
;
theme
=
g_array_index
(
dialog
->
icon_themes
,
icon_theme
*
,
i
);
theme
=
g_array_index
(
dialog
->
icon_themes
,
icon_theme
*
,
i
);
if
(
G_UNLIKELY
(
theme
==
NULL
))
return
;
icon_theme_free
(
dialog
->
w
d
->
icon_theme
);
dialog
->
w
d
->
icon_theme
=
icon_theme_copy
(
theme
);
icon_theme_free
(
dialog
->
p
d
->
icon_theme
);
dialog
->
p
d
->
icon_theme
=
icon_theme_copy
(
theme
);
combo_icon_theme_set_tooltip
(
combo
,
dialog
);
update_icon
(
dialog
->
w
d
);
update_icon
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -801,7 +801,7 @@ combo_tooltip_style_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
tooltip_style
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
dialog
->
p
d
->
tooltip_style
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
}
...
...
@@ -810,7 +810,7 @@ combo_forecast_layout_changed(GtkWidget *combo,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
forecast_layout
=
dialog
->
p
d
->
forecast_layout
=
gtk_combo_box_get_active
(
GTK_COMBO_BOX
(
combo
));
update_summary_window
(
dialog
,
FALSE
);
}
...
...
@@ -821,7 +821,7 @@ spin_forecast_days_value_changed(const GtkWidget *spin,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
forecast_days
=
dialog
->
p
d
->
forecast_days
=
gtk_spin_button_get_value_as_int
(
GTK_SPIN_BUTTON
(
spin
));
update_summary_window
(
dialog
,
FALSE
);
}
...
...
@@ -832,9 +832,9 @@ check_round_values_toggled(GtkWidget *button,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
round
=
dialog
->
p
d
->
round
=
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
button
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
update_summary_window
(
dialog
,
TRUE
);
}
...
...
@@ -858,11 +858,11 @@ create_appearance_page(xfceweather_dialog *dialog)
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hbox
,
FALSE
,
FALSE
,
0
);
dialog
->
icon_themes
=
find_icon_themes
();
for
(
i
=
0
;
i
<
dialog
->
icon_themes
->
len
;
i
++
)
{
theme
=
g_array_index
(
dialog
->
icon_themes
,
icon_theme
*
,
i
);
theme
=
g_array_index
(
dialog
->
icon_themes
,
icon_theme
*
,
i
);
ADD_COMBO_VALUE
(
dialog
->
combo_icon_theme
,
theme
->
name
);
/* set selection to current theme */
if
(
G_LIKELY
(
dialog
->
w
d
->
icon_theme
)
&&
!
strcmp
(
theme
->
dir
,
dialog
->
w
d
->
icon_theme
->
dir
))
{
if
(
G_LIKELY
(
dialog
->
p
d
->
icon_theme
)
&&
!
strcmp
(
theme
->
dir
,
dialog
->
p
d
->
icon_theme
->
dir
))
{
SET_COMBO_VALUE
(
dialog
->
combo_icon_theme
,
i
);
combo_icon_theme_set_tooltip
(
dialog
->
combo_icon_theme
,
dialog
);
}
...
...
@@ -874,7 +874,7 @@ create_appearance_page(xfceweather_dialog *dialog)
ADD_COMBO
(
dialog
->
combo_tooltip_style
);
ADD_COMBO_VALUE
(
dialog
->
combo_tooltip_style
,
_
(
"Simple"
));
ADD_COMBO_VALUE
(
dialog
->
combo_tooltip_style
,
_
(
"Verbose"
));
SET_COMBO_VALUE
(
dialog
->
combo_tooltip_style
,
dialog
->
w
d
->
tooltip_style
);
SET_COMBO_VALUE
(
dialog
->
combo_tooltip_style
,
dialog
->
p
d
->
tooltip_style
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hbox
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
page
),
vbox
,
FALSE
,
FALSE
,
0
);
...
...
@@ -889,14 +889,14 @@ create_appearance_page(xfceweather_dialog *dialog)
ADD_COMBO_VALUE
(
dialog
->
combo_forecast_layout
,
_
(
"Days in columns"
));
ADD_COMBO_VALUE
(
dialog
->
combo_forecast_layout
,
_
(
"Days in rows"
));
SET_COMBO_VALUE
(
dialog
->
combo_forecast_layout
,
dialog
->
w
d
->
forecast_layout
);
dialog
->
p
d
->
forecast_layout
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hbox
,
FALSE
,
FALSE
,
0
);
/* number of days shown in forecast */
hbox
=
gtk_hbox_new
(
FALSE
,
BORDER
);
ADD_LABEL
(
_
(
"_Number of forecast _days:"
),
sg
);
ADD_SPIN
(
dialog
->
spin_forecast_days
,
1
,
MAX_FORECAST_DAYS
,
1
,
(
dialog
->
wd
->
forecast_days
?
dialog
->
w
d
->
forecast_days
:
5
),
(
dialog
->
pd
->
forecast_days
?
dialog
->
p
d
->
forecast_days
:
5
),
0
,
NULL
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hbox
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
page
),
vbox
,
FALSE
,
FALSE
,
0
);
...
...
@@ -914,7 +914,7 @@ create_appearance_page(xfceweather_dialog *dialog)
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
dialog
->
check_round_values
,
FALSE
,
FALSE
,
0
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
dialog
->
check_round_values
),
dialog
->
w
d
->
round
);
dialog
->
p
d
->
round
);
gtk_box_pack_start
(
GTK_BOX
(
page
),
vbox
,
FALSE
,
FALSE
,
0
);
g_object_unref
(
G_OBJECT
(
sg
));
...
...
@@ -927,9 +927,9 @@ check_scrollbox_show_toggled(GtkWidget *button,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
show_scrollbox
=
dialog
->
p
d
->
show_scrollbox
=
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
button
));
scrollbox_set_visible
(
dialog
->
w
d
);
scrollbox_set_visible
(
dialog
->
p
d
);
}
...
...
@@ -938,9 +938,9 @@ spin_scrollbox_lines_value_changed(const GtkWidget *spin,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
scrollbox_lines
=
dialog
->
p
d
->
scrollbox_lines
=
(
guint
)
gtk_spin_button_get_value_as_int
(
GTK_SPIN_BUTTON
(
spin
));
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
}
...
...
@@ -955,9 +955,9 @@ button_scrollbox_font_pressed(GtkWidget *button,
return
FALSE
;
if
(
event
->
button
==
2
)
{
g_free
(
dialog
->
w
d
->
scrollbox_font
);
dialog
->
w
d
->
scrollbox_font
=
NULL
;
gtk_scrollbox_set_fontname
(
GTK_SCROLLBOX
(
dialog
->
w
d
->
scrollbox
),
g_free
(
dialog
->
p
d
->
scrollbox_font
);
dialog
->
p
d
->
scrollbox_font
=
NULL
;
gtk_scrollbox_set_fontname
(
GTK_SCROLLBOX
(
dialog
->
p
d
->
scrollbox
),
NULL
);
gtk_button_set_label
(
GTK_BUTTON
(
button
),
_
(
"Select _font"
));
return
TRUE
;
...
...
@@ -977,18 +977,18 @@ button_scrollbox_font_clicked(GtkWidget *button,
fsd
=
GTK_FONT_SELECTION_DIALOG
(
gtk_font_selection_dialog_new
(
_
(
"Select font"
)));
if
(
dialog
->
w
d
->
scrollbox_font
)
if
(
dialog
->
p
d
->
scrollbox_font
)
gtk_font_selection_dialog_set_font_name
(
fsd
,
dialog
->
w
d
->
scrollbox_font
);
dialog
->
p
d
->
scrollbox_font
);
result
=
gtk_dialog_run
(
GTK_DIALOG
(
fsd
));
if
(
result
==
GTK_RESPONSE_OK
||
result
==
GTK_RESPONSE_ACCEPT
)
{
fontname
=
gtk_font_selection_dialog_get_font_name
(
fsd
);
if
(
fontname
!=
NULL
)
{
gtk_button_set_label
(
GTK_BUTTON
(
button
),
fontname
);
g_free
(
dialog
->
w
d
->
scrollbox_font
);
dialog
->
w
d
->
scrollbox_font
=
fontname
;
gtk_scrollbox_set_fontname
(
GTK_SCROLLBOX
(
dialog
->
w
d
->
scrollbox
),
g_free
(
dialog
->
p
d
->
scrollbox_font
);
dialog
->
p
d
->
scrollbox_font
=
fontname
;
gtk_scrollbox_set_fontname
(
GTK_SCROLLBOX
(
dialog
->
p
d
->
scrollbox
),
fontname
);
}
}
...
...
@@ -1011,8 +1011,8 @@ button_scrollbox_color_pressed(GtkWidget *button,
return
FALSE
;
if
(
event
->
button
==
2
)
{
dialog
->
w
d
->
scrollbox_use_color
=
FALSE
;
gtk_scrollbox_clear_color
(
GTK_SCROLLBOX
(
dialog
->
w
d
->
scrollbox
));
dialog
->
p
d
->
scrollbox_use_color
=
FALSE
;
gtk_scrollbox_clear_color
(
GTK_SCROLLBOX
(
dialog
->
p
d
->
scrollbox
));
return
TRUE
;
}
...
...
@@ -1027,10 +1027,10 @@ button_scrollbox_color_set(GtkWidget *button,
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
gtk_color_button_get_color
(
GTK_COLOR_BUTTON
(
button
),
&
(
dialog
->
w
d
->
scrollbox_color
));
gtk_scrollbox_set_color
(
GTK_SCROLLBOX
(
dialog
->
w
d
->
scrollbox
),
dialog
->
w
d
->
scrollbox_color
);
dialog
->
w
d
->
scrollbox_use_color
=
TRUE
;
&
(
dialog
->
p
d
->
scrollbox_color
));
gtk_scrollbox_set_color
(
GTK_SCROLLBOX
(
dialog
->
p
d
->
scrollbox
),
dialog
->
p
d
->
scrollbox_color
);
dialog
->
p
d
->
scrollbox_use_color
=
TRUE
;
}
...
...
@@ -1061,7 +1061,7 @@ update_scrollbox_labels(xfceweather_dialog *dialog)
GValue
value
=
{
0
};
gint
option
;
dialog
->
wd
->
labels
=
labels_clear
(
dialog
->
w
d
->
labels
);
dialog
->
pd
->
labels
=
labels_clear
(
dialog
->
p
d
->
labels
);
hasiter
=
gtk_tree_model_get_iter_first
(
GTK_TREE_MODEL
(
dialog
->
model_datatypes
),
...
...
@@ -1070,13 +1070,13 @@ update_scrollbox_labels(xfceweather_dialog *dialog)
gtk_tree_model_get_value
(
GTK_TREE_MODEL
(
dialog
->
model_datatypes
),
&
iter
,
1
,
&
value
);
option
=
g_value_get_int
(
&
value
);
g_array_append_val
(
dialog
->
w
d
->
labels
,
option
);
g_array_append_val
(
dialog
->
p
d
->
labels
,
option
);
g_value_unset
(
&
value
);
hasiter
=
gtk_tree_model_iter_next
(
GTK_TREE_MODEL
(
dialog
->
model_datatypes
),
&
iter
);
}
update_scrollbox
(
dialog
->
w
d
);
update_scrollbox
(
dialog
->
p
d
);
}
...
...
@@ -1193,10 +1193,10 @@ check_scrollbox_animate_toggled(GtkWidget *button,
gpointer
user_data
)
{
xfceweather_dialog
*
dialog
=
(
xfceweather_dialog
*
)
user_data
;
dialog
->
w
d
->
scrollbox_animate
=
dialog
->
p
d
->
scrollbox_animate
=
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
button
));
gtk_scrollbox_set_animate
(
GTK_SCROLLBOX
(
dialog
->
w
d
->
scrollbox
),
dialog
->
w
d
->
scrollbox_animate
);
gtk_scrollbox_set_animate
(
GTK_SCROLLBOX
(
dialog
->
p
d
->
scrollbox
),
dialog
->
p
d
->
scrollbox_animate
);
}
...
...
@@ -1223,14 +1223,14 @@ create_scrollbox_page(xfceweather_dialog *dialog)
TRUE
,
TRUE
,
0
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
dialog
->
check_scrollbox_show
),
dialog
->
w
d
->
show_scrollbox
);
dialog
->
p
d
->
show_scrollbox
);
/* values to show at once (multiple lines) */
label
=
gtk_label_new_with_mnemonic
(
_
(
"L_ines:"
));
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
1
,
0
.
5
);
gtk_box_pack_start
(
GTK_BOX
(
hbox
),
label
,
TRUE
,
TRUE
,
0
);
ADD_SPIN
(
dialog
->
spin_scrollbox_lines
,
1
,
MAX_SCROLLBOX_LINES
,
1
,
dialog
->
w
d
->
scrollbox_lines
,
0
,
sg_misc
);
dialog
->
p
d
->
scrollbox_lines
,
0
,
sg_misc
);
SET_TOOLTIP
(
dialog
->
spin_scrollbox_lines
,
_
(
"Decide how many values should be shown at once in the scrollbox. "
...
...
@@ -1252,11 +1252,11 @@ create_scrollbox_page(xfceweather_dialog *dialog)
"theme's default."
));
gtk_box_pack_start
(
GTK_BOX
(
hbox
),
dialog
->
button_scrollbox_font
,
TRUE
,
TRUE
,
0
);
if
(
dialog
->
w
d
->
scrollbox_font
)
if
(
dialog
->
p
d
->
scrollbox_font
)
gtk_button_set_label
(
GTK_BUTTON
(
dialog
->
button_scrollbox_font
),
dialog
->
w
d
->
scrollbox_font
);
dialog
->
p
d
->
scrollbox_font
);
dialog
->
button_scrollbox_color
=
gtk_color_button_new_with_color
(
&
(
dialog
->
w
d
->
scrollbox_color
));
gtk_color_button_new_with_color
(
&
(
dialog
->
p
d
->
scrollbox_color
));
gtk_size_group_add_widget
(
sg_misc
,
dialog
->
button_scrollbox_color
);
SET_TOOLTIP
(
dialog
->
button_scrollbox_color
,
...
...
@@ -1336,9 +1336,9 @@ create_scrollbox_page(xfceweather_dialog *dialog)
gtk_box_pack_start
(
GTK_BOX
(
hbox
),
table
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
page
),
hbox
,
FALSE
,
FALSE
,
0
);
if
(
dialog
->
w
d
->
labels
->
len
>
0
)
{
for
(
i
=
0
;
i
<
dialog
->
w
d
->
labels
->
len
;
i
++
)
{
type
=
g_array_index
(
dialog
->
w
d
->
labels
,
data_types
,
i
);
if
(
dialog
->
p
d
->
labels
->
len
>
0
)
{
for
(
i
=
0
;
i
<
dialog
->
p
d
->
labels
->
len
;
i
++
)
{
type
=
g_array_index
(
dialog
->
p
d
->
labels
,
data_types
,
i
);
if
((
n
=
option_i
(
type
))
!=
-
1
)
add_model_option
(
dialog
->
model_datatypes
,
n
);
...
...
@@ -1349,7 +1349,7 @@ create_scrollbox_page(xfceweather_dialog *dialog)
(
_
(
"Animate _transitions between labels"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
dialog
->
check_scrollbox_animate
),
dialog
->
w
d
->
scrollbox_animate
);
dialog
->
p
d
->
scrollbox_animate
);
SET_TOOLTIP
(
dialog
->
check_scrollbox_animate
,
_
(
"Scroll the current displayed value(s) out and the "
"new value(s) in instead of simply changing them. "
...
...
@@ -1429,14 +1429,14 @@ setup_notebook_signals(xfceweather_dialog *dialog)
xfceweather_dialog
*
create_config_dialog
(
xfceweather
_data
*
data
,
create_config_dialog
(
plugin
_data
*
data
,
GtkWidget
*
vbox
)
{
xfceweather_dialog
*
dialog
;
GtkWidget
*
notebook
;
dialog
=
g_slice_new0
(
xfceweather_dialog
);
dialog
->
wd
=
(
xfceweather
_data
*
)
data
;
dialog
->
pd
=
(
plugin
_data
*
)
data
;
dialog
->
dialog
=
gtk_widget_get_toplevel
(
vbox
);
notebook
=
gtk_notebook_new
();
...
...
@@ -1455,7 +1455,7 @@ create_config_dialog(xfceweather_data *data,
setup_notebook_signals
(
dialog
);
/* automatically detect current location if it is yet unknown */
if
(
!
(
dialog
->
wd
->
lat
&&
dialog
->
w
d
->
lon
))
if
(
!
(
dialog
->
pd
->
lat
&&
dialog
->
p
d
->
lon
))
start_auto_locate
(
dialog
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
notebook
,
TRUE
,
TRUE
,
0
);
...
...
panel-plugin/weather-config.h
View file @
c6c608b5
...
...
@@ -28,7 +28,7 @@ typedef struct {
typedef
struct
{
GtkWidget
*
dialog
;
xfceweather_data
*
w
d
;
plugin_data
*
p
d
;
guint
timer_id
;
/* location page */
...
...
@@ -67,7 +67,7 @@ typedef struct {
}
xfceweather_dialog
;
xfceweather_dialog
*
create_config_dialog
(
xfceweather
_data
*
data
,
xfceweather_dialog
*
create_config_dialog
(
plugin
_data
*
data
,
GtkWidget
*
vbox
);
G_END_DECLS
...
...
panel-plugin/weather-debug.c
View file @
c6c608b5
...
...
@@ -387,7 +387,7 @@ weather_dump_weatherdata(const xml_weather *wd)
g_string_append_printf
(
out
,
"%d timeslices available.
\n
"
,
wd
->
timeslices
->
len
);
for
(
i
=
0
;
i
<
wd
->
timeslices
->
len
;
i
++
)
{
timeslice
=
g_array_index
(
wd
->
timeslices
,
xml_time
*
,
i
);