Codebase list xapp / e2e6567
xapp-gtk-window.c: only do an x11 check once, cache the result. Michael Webster 6 years ago
1 changed file(s) with 21 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
6868 };
6969
7070 G_DEFINE_TYPE_WITH_PRIVATE (XAppGtkWindow, xapp_gtk_window, GTK_TYPE_WINDOW)
71
72 static gboolean
73 is_x11_session (void)
74 {
75 static gboolean running_x11 = FALSE;
76 static gsize once_init_value = 0;
77
78 if (g_once_init_enter (&once_init_value))
79 {
80 running_x11 = GDK_IS_X11_DISPLAY(gdk_display_get_default());
81 g_debug ("XAppGtkWindow: is_x11_session: %s\n", running_x11 ? "TRUE" : "FALSE");
82
83 g_once_init_leave (&once_init_value, 1);
84 }
85
86 return running_x11;
87 }
7188
7289 static void
7390 clear_icon_strings (XAppGtkWindowPrivate *priv)
191208 XAppGtkWindowPrivate *priv,
192209 const gchar *icon_name)
193210 {
194 if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
211 if (!is_x11_session ()) {
195212 goto out;
196213 }
197214
228245 const gchar *file_name,
229246 GError **error)
230247 {
231 if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
248 if (!is_x11_session ()) {
232249 goto out;
233250 }
234251
263280 XAppGtkWindowPrivate *priv,
264281 gint progress)
265282 {
266 if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
283 if (!is_x11_session ()) {
267284 return;
268285 }
269286
302319 XAppGtkWindowPrivate *priv,
303320 gboolean pulse)
304321 {
305 if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
322 if (!is_x11_session ()) {
306323 return;
307324 }
308325