xapp-gtk-window.c: Check for x11 at a more appropriate time.
The safety initially added in fea3ca82f missed the fact that
xapp_gtk_window_realize() directly called update_window_progress()
and update_window_icon(), bypassing our safeties. It's best to
move these checks to those methods instead.
Michael Webster
4 years ago
168 | 168 | update_window_icon (GtkWindow *window, |
169 | 169 | XAppGtkWindowPrivate *priv) |
170 | 170 | { |
171 | if (!is_x11_session ()) { | |
172 | return; | |
173 | } | |
174 | ||
171 | 175 | /* Icon name/path */ |
172 | 176 | if (priv->icon_name != NULL) |
173 | 177 | { |
193 | 197 | update_window_progress (GtkWindow *window, |
194 | 198 | XAppGtkWindowPrivate *priv) |
195 | 199 | { |
200 | if (!is_x11_session ()) { | |
201 | return; | |
202 | } | |
203 | ||
196 | 204 | /* Progress: 0 - 100 */ |
197 | 205 | set_window_hint_cardinal (get_window_xid (window), |
198 | 206 | PROGRESS_HINT, |
208 | 216 | XAppGtkWindowPrivate *priv, |
209 | 217 | const gchar *icon_name) |
210 | 218 | { |
211 | if (!is_x11_session ()) { | |
212 | goto out; | |
213 | } | |
214 | ||
215 | 219 | if (g_strcmp0 (icon_name, priv->icon_name) == 0) |
216 | 220 | { |
217 | 221 | gtk_window_set_icon_name (window, icon_name); |
234 | 238 | update_window_icon (window, priv); |
235 | 239 | } |
236 | 240 | |
237 | out: | |
238 | 241 | /* Call the GtkWindow method for compatibility */ |
239 | 242 | gtk_window_set_icon_name (GTK_WINDOW (window), icon_name); |
240 | 243 | } |
245 | 248 | const gchar *file_name, |
246 | 249 | GError **error) |
247 | 250 | { |
248 | if (!is_x11_session ()) { | |
249 | goto out; | |
250 | } | |
251 | ||
252 | 251 | if (g_strcmp0 (file_name, priv->icon_path) == 0) |
253 | 252 | { |
254 | 253 | gtk_window_set_icon_from_file (window, file_name, error); |
271 | 270 | update_window_icon (window, priv); |
272 | 271 | } |
273 | 272 | |
274 | out: | |
275 | 273 | gtk_window_set_icon_from_file (GTK_WINDOW (window), file_name, error); |
276 | 274 | } |
277 | 275 | |
280 | 278 | XAppGtkWindowPrivate *priv, |
281 | 279 | gint progress) |
282 | 280 | { |
283 | if (!is_x11_session ()) { | |
284 | return; | |
285 | } | |
286 | ||
287 | 281 | gboolean update; |
288 | 282 | guint clamped_progress; |
289 | 283 | |
319 | 313 | XAppGtkWindowPrivate *priv, |
320 | 314 | gboolean pulse) |
321 | 315 | { |
322 | if (!is_x11_session ()) { | |
323 | return; | |
324 | } | |
325 | ||
326 | 316 | gboolean update; |
327 | 317 | |
328 | 318 | update = FALSE; |