예제 #1
0
gint
gimp_message_box_repeat (GimpMessageBox *box)
{
  gchar *message;

  g_return_val_if_fail (GIMP_IS_MESSAGE_BOX (box), 0);

  box->repeat++;

  if (box->repeat > 1)
    message = g_strdup_printf (_("Message repeated %d times."), box->repeat);
  else
    message = g_strdup (_("Message repeated once."));

  if (box->label[2])
    {
      gtk_label_set_text (GTK_LABEL (box->label[2]), message);
    }
  else
    {
      GtkWidget *label = box->label[2] = gtk_label_new (message);

      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
      gimp_label_set_attributes (GTK_LABEL (label),
                                 PANGO_ATTR_STYLE, PANGO_STYLE_OBLIQUE,
                                 -1);
      gtk_box_pack_end (GTK_BOX (box), label, FALSE, FALSE, 0);
      gtk_widget_show (label);
    }

  g_free (message);

  return box->repeat;
}
예제 #2
0
void
gimp_message_box_set_markup (GimpMessageBox *box,
                             const gchar    *format,
                             ...)
{
  va_list args;

  g_return_if_fail (GIMP_IS_MESSAGE_BOX (box));

  va_start (args, format);
  gimp_message_box_set_label_markup (box, 1,format, args);
  va_end (args);
}
예제 #3
0
gint
gimp_message_box_repeat (GimpMessageBox *box)
{
  g_return_val_if_fail (GIMP_IS_MESSAGE_BOX (box), 0);

  box->repeat++;

  if (box->idle_id == 0)
    {
      /* When a same message is repeated dozens of thousands of times in
       * a short span of time, updating the GUI at each increment is
       * extremely slow (like really really slow, your GUI gets stuck
       * for 10 minutes). So let's just delay GUI update as a low
       * priority idle task.
       */
      box->idle_id = g_idle_add_full (G_PRIORITY_LOW,
                                      gimp_message_box_update,
                                      box, NULL);
    }

  return box->repeat;
}