Ejemplo n.º 1
0
Archivo: util.c Proyecto: Feneric/xconq
DiceRep
multiply_dice1(DiceRep dice, int mult)
{
    Z16u numdice = 0, die = 0;
    Z16 offset = 0;

    dice1(dice, numdice, die, offset);
    if (!numdice) {
	offset = (offset * mult) / 100;
	if (0x4000 & offset)
	    run_warning("Scaled fixed dice value, %d, is out-of-range",
			offset);
	offset = max(-16384, offset);
	offset = min(16383, offset);
	return offset;
    }
    die = (die * mult) / 100;
    if (!between(2, die, 17))
	run_warning("Scaled die has %d spots. Must be between 2 and 17", die);
    die = max(2, die);
    die = min(17, die);
    offset = (offset * mult) / 100;
    if (!between(-128, offset, 127))
	run_warning("Scaled dice offset is %d. Must be between -128 and 127",
		    offset);
    offset = max(-128, offset);
    offset = min(127, offset);
    return 
	(DiceRep)(
	    (((0 < offset) ? 0 : 1) << 15) | (1 << 14)
	    | ((numdice - 1) << 11) | ((die - 2) << 7) 
	    | (((0 < offset) ? offset : -offset - 1) & 0x7f));
}
static void
purge_temp (CcPrivacyPanel *self)
{
  GDBusConnection *bus;
  gboolean result;
  GtkWidget *dialog;

  dialog = WID ("trash_dialog");
  result = run_warning (GTK_WINDOW (dialog), _("Delete all the temporary files?"),
                        _("All the temporary files will be permanently deleted."),
                        _("_Purge Temporary Files"));

  if (!result)
    return; 

  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
  g_dbus_connection_call (bus,
                          "org.gnome.SettingsDaemon",
                          "/org/gnome/SettingsDaemon/Housekeeping",
                          "org.gnome.SettingsDaemon.Housekeeping",
                          "RemoveTempFiles",
                          NULL, NULL, 0, -1, NULL, NULL, NULL);
  g_object_unref (bus);
}
static void
empty_trash (CcPrivacyPanel *self)
{
  GDBusConnection *bus;
  gboolean result;
  GtkWidget *dialog;

  dialog = WID ("trash_dialog");
  result = run_warning (GTK_WINDOW (dialog), _("Empty all items from Trash?"),
                        _("All items in the Trash will be permanently deleted."),
                        _("_Empty Trash"));

  if (!result)
    return; 

  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
  g_dbus_connection_call (bus,
                          "org.gnome.SettingsDaemon",
                          "/org/gnome/SettingsDaemon/Housekeeping",
                          "org.gnome.SettingsDaemon.Housekeeping",
                          "EmptyTrash",
                          NULL, NULL, 0, -1, NULL, NULL, NULL);
  g_object_unref (bus);
}