diff -up ./panel-plugin/weather.c.orig ./panel-plugin/weather.c --- ./panel-plugin/weather.c.orig 2019-08-26 22:58:28.946952320 +0300 +++ ./panel-plugin/weather.c 2019-08-26 23:13:14.986917277 +0300 @@ -100,6 +100,9 @@ static void write_cache_file(plugin_data static void schedule_next_wakeup(plugin_data *data); +void sigusr1_handler(int sig); + +gboolean sigusr1_summary(plugin_data *user_data); void weather_http_queue_request(SoupSession *session, @@ -948,6 +951,9 @@ xfceweather_read_config(XfcePanelPlugin g_array_append_val(data->labels, val); } + /* Whether we show summary window on SIGUSR1 */ + data->sigusr1_summary = xfce_rc_read_bool_entry(rc, "sigusr1_summary", FALSE); + xfce_rc_close(rc); weather_debug("Config file read."); } @@ -1043,6 +1049,9 @@ xfceweather_write_config(XfcePanelPlugin data_types, i)); } + /* Whether we show summary window on SIGUSR1 */ + xfce_rc_write_bool_entry(rc, "sigusr1_summary", data->sigusr1_summary); + xfce_rc_close(rc); weather_debug("Config file written."); } @@ -2257,6 +2266,34 @@ weather_construct(XfcePanelPlugin *plugi #endif /* HAVE_UPOWER_GLIB */ weather_dump(weather_dump_plugindata, data); + +#ifdef GLIB_VERSION_2_36 + g_unix_signal_add(SIGUSR1, sigusr1_summary, data); +#else + g_warning(_("glib2 >= 2.36 is required for SIGUSR1 handling")); +#endif } +#ifdef GLIB_VERSION_2_36 +gboolean +sigusr1_summary(plugin_data *data) +{ + if (data->sigusr1_summary) { + /* This seems to do nothing at all. What's wrong? */ + /* + gboolean ret; + g_signal_emit_by_name(GTK_TOGGLE_BUTTON (data->button), "button-press-event", data, &ret); + */ + /* Neither does this. Giving up */ + /* + gboolean ret; + g_signal_emit_by_name(GTK_WIDGET (data->plugin), "button-press-event", data, &ret); + */ + /* This works but panel button does not appear as pressed */ + forecast_click(GTK_WIDGET(data->plugin), data); + } + return G_SOURCE_CONTINUE; +} +#endif + XFCE_PANEL_PLUGIN_REGISTER(weather_construct) diff -up ./panel-plugin/weather.h.orig ./panel-plugin/weather.h --- ./panel-plugin/weather.h.orig 2019-08-26 22:58:28.946952320 +0300 +++ ./panel-plugin/weather.h 2019-08-26 23:13:14.986917277 +0300 @@ -127,6 +127,7 @@ typedef struct { forecast_layouts forecast_layout; guint forecast_days; gboolean round; + gboolean sigusr1_summary; /* Whether we show summary window on SIGUSR1 */ } plugin_data;