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
0a018afa
Commit
0a018afa
authored
May 20, 2013
by
Harald Judt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Summary window: Add tooltip for forecast day header showing astrodata.
parent
750bfb22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
1 deletion
+88
-1
panel-plugin/weather-summary.c
panel-plugin/weather-summary.c
+88
-1
No files found.
panel-plugin/weather-summary.c
View file @
0a018afa
...
...
@@ -681,6 +681,87 @@ forecast_cell_get_tooltip_text(plugin_data *data,
}
static
gchar
*
forecast_day_header_tooltip_text
(
xml_astro
*
astro
)
{
GString
*
text
;
gchar
*
result
,
*
day
,
*
sunrise
,
*
sunset
,
*
moonrise
,
*
moonset
,
*
moonphase
;
/* TRANSLATORS: Please use spaces as needed or desired to properly
align the values; Monospace font is enforced with <tt> tags for
alignment, and the text is enclosed in <small> tags because
that looks much better and saves space.
*/
text
=
g_string_new
(
""
);
if
(
astro
)
{
day
=
format_date
(
astro
->
day
,
"%Y-%m-%d"
,
TRUE
);
g_string_append_printf
(
text
,
_
(
"<b>%s</b>
\n
"
),
day
);
g_free
(
day
);
if
(
astro
->
sun_never_rises
)
g_string_append
(
text
,
_
(
"<tt><small>"
"Sunrise: The sun never rises this day."
"</small></tt>
\n
"
));
else
if
(
astro
->
sun_never_sets
)
g_string_append
(
text
,
_
(
"<tt><small>"
"Sunset: The sun never sets this day."
"</small></tt>
\n
"
));
else
{
sunrise
=
format_date
(
astro
->
sunrise
,
NULL
,
TRUE
);
g_string_append_printf
(
text
,
_
(
"<tt><small>"
"Sunrise: %s"
"</small></tt>
\n
"
),
sunrise
);
g_free
(
sunrise
);
sunset
=
format_date
(
astro
->
sunset
,
NULL
,
TRUE
);
g_string_append_printf
(
text
,
_
(
"<tt><small>"
"Sunset: %s"
"</small></tt>
\n\n
"
),
sunset
);
g_free
(
sunset
);
}
if
(
astro
->
moon_phase
)
g_string_append_printf
(
text
,
_
(
"<tt><small>"
"Moon phase: %s"
"</small></tt>
\n
"
),
translate_moon_phase
(
astro
->
moon_phase
));
else
g_string_append
(
text
,
_
(
"<tt><small>"
"Moon phase: Unknown"
"</small></tt>
\n
"
));
if
(
astro
->
moon_never_rises
)
g_string_append
(
text
,
_
(
"<tt><small>"
"Moonrise: The moon never rises this day."
"</small></tt>
\n
"
));
else
if
(
astro
->
moon_never_sets
)
g_string_append
(
text
,
_
(
"<tt><small>"
"Moonset: The moon never sets this day."
"</small></tt>
\n
"
));
else
{
moonrise
=
format_date
(
astro
->
moonrise
,
NULL
,
TRUE
);
g_string_append_printf
(
text
,
_
(
"<tt><small>"
"Moonrise: %s"
"</small></tt>
\n
"
),
moonrise
);
g_free
(
moonrise
);
moonset
=
format_date
(
astro
->
moonset
,
NULL
,
TRUE
);
g_string_append_printf
(
text
,
_
(
"<tt><small>"
"Moonset: %s"
"</small></tt>"
),
moonset
);
g_free
(
moonset
);
}
}
/* Free GString only and return its character data */
result
=
text
->
str
;
g_string_free
(
text
,
FALSE
);
return
result
;
}
static
GtkWidget
*
wrap_forecast_cell
(
const
GtkWidget
*
widget
,
const
GdkColor
*
color
)
...
...
@@ -815,7 +896,8 @@ make_forecast(plugin_data *data)
const
GdkColor
lightbg
=
{
0
,
0xeaea
,
0xeaea
,
0xeaea
};
const
GdkColor
darkbg
=
{
0
,
0x6666
,
0x6666
,
0x6666
};
GArray
*
daydata
;
gchar
*
dayname
;
xml_astro
*
astro
;
gchar
*
dayname
,
*
text
;
gint
i
;
daytime
daytime
;
...
...
@@ -848,6 +930,11 @@ make_forecast(plugin_data *data)
ebox
=
add_forecast_header
(
dayname
,
90
.
0
,
&
darkbg
);
g_free
(
dayname
);
/* add tooltip to forecast day header */
astro
=
get_astro_data_for_day
(
data
->
astrodata
,
i
);
text
=
forecast_day_header_tooltip_text
(
astro
);
gtk_widget_set_tooltip_markup
(
GTK_WIDGET
(
ebox
),
text
);
if
(
data
->
forecast_layout
==
FC_LAYOUT_CALENDAR
)
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
GTK_WIDGET
(
ebox
),
i
+
1
,
i
+
2
,
0
,
1
);
...
...
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