Ejemplo n.º 1
0
static void
delete_ping_timeout_func (MetaDisplay *display,
                          Window       xwindow,
                          guint32      timestamp,
                          void        *user_data)
{
  MetaWindow *window = user_data;
  char *window_title;
  gchar *window_content;
  GPid dialog_pid;
  
  meta_topic (META_DEBUG_PING,
              "Got delete ping timeout for %s\n",
              window->desc);

  if (window->dialog_pid >= 0)
    {
      meta_window_present_delete_dialog (window, timestamp);
      return;
    }

  window_title = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL);

  window_content = g_strdup_printf(
      _("<big><b><tt>%s</tt> is not responding.</b></big>\n\n"
      "<i>You may choose to wait a short while for it to "
      "continue or force the application to quit entirely.</i>"),
      window_title);

  g_free (window_title);

  dialog_pid =
    meta_show_dialog ("--question",
                      window_content, 0,
                      window->screen->number,
                      _("_Wait"), _("_Force Quit"), window->xwindow,
                      NULL, NULL);

  g_free (window_content);

  window->dialog_pid = dialog_pid;

  g_signal_connect (sigchld_nexus, "sigchld",
                    G_CALLBACK (sigchld_handler),
                    window);

}
Ejemplo n.º 2
0
static void
delete_ping_timeout_func (MetaDisplay *display,
                          Window       xwindow,
                          guint32      timestamp,
                          void        *user_data)
{
  MetaWindow *window = user_data;
  char *window_title;
  gchar *window_content, *tmp;
  GPid dialog_pid;

  meta_topic (META_DEBUG_PING,
              "Got delete ping timeout for %s\n",
              window->desc);

  if (window->dialog_pid >= 0)
    {
      meta_window_present_delete_dialog (window, timestamp);
      return;
    }

  window_title = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL);

  /* Translators: %s is a window title */
  tmp = g_strdup_printf (_("<tt>%s</tt> is not responding."),
                         window_title);
  window_content = g_strdup_printf (
      "<big><b>%s</b></big>\n\n<i>%s</i>",
      tmp,
      _("You may choose to wait a short while for it to "
        "continue or force the application to quit entirely."));

  g_free (window_title);

  dialog_pid =
    meta_show_dialog ("--question",
                      window_content, 0,
                      window->screen->number,
                      _("_Wait"), _("_Force Quit"), window->xwindow,
                      NULL, NULL);

  g_free (window_content);
  g_free (tmp);

  window->dialog_pid = dialog_pid;
  g_child_watch_add (dialog_pid, dialog_exited, window);
}
Ejemplo n.º 3
0
static void
confirm_display_change (MetaPlugin *plugin)
{
  GPid pid;

  pid = meta_show_dialog ("--question",
                          "Does the display look OK?",
                          "20",
                          NULL,
                          "_Keep This Configuration",
                          "_Restore Previous Configuration",
                          "preferences-desktop-display",
                          0,
                          NULL, NULL);

  g_child_watch_add (pid, on_dialog_closed, plugin);
}
Ejemplo n.º 4
0
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 &quot;save current setup&quot; "
                           "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));
}
Ejemplo n.º 5
0
static void
delete_ping_timeout_func (MetaDisplay *display,
                          Window       xwindow,
                          guint32      timestamp,
                          void        *user_data)
{
  MetaWindow *window = user_data;
  char *window_title;
  gchar *window_content, *tmp;
  GPid dialog_pid;
  
  meta_topic (META_DEBUG_PING,
              "Got delete ping timeout for %s\n",
              window->desc);

  if (window->dialog_pid >= 0)
    {
      meta_window_present_delete_dialog (window, timestamp);
      return;
    }

  /* This is to get a better string if the title isn't representable
   * in the locale encoding; actual conversion to UTF-8 is done inside
   * meta_show_dialog */

  if (window->title && window->title[0])
    {
      tmp = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL);
      if (tmp == NULL)
        window_title = NULL;
      else
        window_title = window->title;
      g_free (tmp);
    }
  else
    {
      window_title = NULL;
    }

  /* Translators: %s is a window title */
  if (window_title)
    tmp = g_markup_printf_escaped (_("<tt>%s</tt> is not responding."),
                                   window_title);
  else
    tmp = g_strdup (_("Application is not responding."));

  window_content = g_strdup_printf (
      "<big><b>%s</b></big>\n\n<i>%s</i>",
      tmp,
      _("You may choose to wait a short while for it to "
        "continue or force the application to quit entirely."));

  dialog_pid =
    meta_show_dialog ("--question",
                      window_content, NULL,
                      window->screen->screen_name,
                      _("_Wait"), _("_Force Quit"), window->xwindow,
                      NULL, NULL);

  g_free (window_content);
  g_free (tmp);

  window->dialog_pid = dialog_pid;
  g_child_watch_add (dialog_pid, dialog_exited, window);
}