static void dialog_closed (GPid pid, int status, gpointer user_data) { gboolean shutdown = GPOINTER_TO_INT (user_data); if (WIFEXITED (status) && WEXITSTATUS (status) == 0) /* pressed "OK" */ { finish_interact (shutdown); } }
static void sigchld_handler (MetaNexus *nexus, guint arg1, gpointer arg2, gpointer user_data) { gboolean shutdown = GPOINTER_TO_INT (user_data); if (arg1 == 0) /* pressed "OK" */ { finish_interact (shutdown); } }
static void warn_about_lame_clients_and_finish_interact (gboolean shutdown) { GSList *lame = NULL; GSList *windows; GSList *lame_details = NULL; GSList *tmp; GSList *columns = NULL; GPid pid; windows = meta_display_list_windows (meta_get_display ()); tmp = windows; while (tmp != NULL) { MetaWindow *window; window = tmp->data; /* only complain about normal windows, the others * are kind of dumb to worry about */ if (window->sm_client_id == NULL && window->type == META_WINDOW_NORMAL) lame = g_slist_prepend (lame, window); tmp = tmp->next; } g_slist_free (windows); if (lame == NULL) { /* No lame apps. */ finish_interact (shutdown); return; } columns = g_slist_prepend (columns, "Window"); columns = g_slist_prepend (columns, "Class"); lame = g_slist_sort (lame, (GCompareFunc) windows_cmp_by_title); tmp = lame; while (tmp != NULL) { MetaWindow *w = tmp->data; lame_details = g_slist_prepend (lame_details, w->res_class ? w->res_class : ""); lame_details = g_slist_prepend (lame_details, w->title); tmp = tmp->next; } g_slist_free (lame); pid = meta_show_dialog("--list", _("These windows do not support "save current setup" " "and will have to be restarted manually next time " "you log in."), "240", meta_screen_get_screen_number (meta_get_display()->active_screen), NULL, NULL, None, columns, lame_details); g_slist_free (lame_details); g_child_watch_add (pid, dialog_closed, GINT_TO_POINTER (shutdown)); }